:root {
  --overlay-bg: rgba(0, 0, 0, 0.5);
  --surface: #fff;
  --text: #111;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  --accent: #3b82f6;
}

header {
  padding: 32px 16px 0;
  text-align: center;
}
header h1 {
  margin: 0 0 8px;
  font-size: 28px;
}
header p {
  margin: 0 0 24px;
  color: #555;
}
main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px 16px 64px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.btn {
  appearance: none;
  border: none;
  background: var(--accent);
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
}
.btn:active {
  transform: translateY(1px);
}
.btn.secondary {
  background: #111;
}
[data-spawn-modals="target"] {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  display: none;
  padding: 24px;
  z-index: 999;
}
[data-spawn-modals="target"].is-open {
  display: block;
}
[data-type="spawn-modal-touch"] {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: min(720px, 100% - 32px);
  margin: 48px auto;
  opacity: 0;
  transform: scale(0.98) translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  max-height: calc(100dvh - 96px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
[data-type="spawn-modal-touch"].visible {
  opacity: 1;
  transform: none;
}
.spawn-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 20px;
  margin-bottom: 10px;
}
.spawn-modal-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}
.icon-btn {
  width: 24px;
  height: 24px;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
  border: none;
  outline: none;
  cursor: pointer;
  background-color: transparent;
}
.spawn-modal-body {
  padding: 0 12px 0 20px;
  overflow-y: auto;
  margin-right: 20px;
}
.spawn-modal-footer {
  padding: 10px 20px 16px 20px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  position: sticky;
  bottom: 0;
  background: var(--surface);
}
.spawn-modal-footer > button {
  width: 100%;
}
.spawn-modal-body .select-dropdown-list {
  max-height: unset;
}
@media (max-width: 768px) {
  [data-spawn-modals="target"] {
    padding: 0;
    display: none;
  }
  [data-spawn-modals="target"].is-open {
    display: block;
  }
  [data-type="spawn-modal-touch"] {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    margin: 0;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    max-height: 51dvh;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    opacity: 1;
  }
  .mobile-close {
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    min-height: 24px;
    display: grid;
    place-items: center;
  }
  .mobile-close .grabber {
    width: 24px;
    height: 4px;
    border-radius: 999px;
    background: #ccc;
  }
}
