:root {
  color-scheme: dark;
  --bg: #0b0e13;
  --panel: rgba(19, 25, 37, 0.95);
  --panel-2: #182131;
  --panel-3: rgba(255, 255, 255, 0.03);
  --text: #eef3ff;
  --muted: #9fb0ca;
  --accent: #4cc9f0;
  --ok: #57cc99;
  --warn: #ffd166;
  --danger: #ef476f;
  --border: rgba(255, 255, 255, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: Inter, system-ui, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(76, 201, 240, 0.08), transparent 28%),
    radial-gradient(circle at top right, rgba(239, 71, 111, 0.06), transparent 22%),
    linear-gradient(180deg, #050b16 0%, #081225 100%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--text);
}

main {
  width: min(1600px, calc(100% - 32px));
  margin: 0 auto 48px;
}

.hero {
  width: min(1600px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 24px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.hero-side,
.admin-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-start;
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2rem, 5vw, 3rem); }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.05rem; }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
  font-size: 0.72rem;
  margin-bottom: 8px;
}

.subtle,
.scene-description {
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.badge {
  display: inline-flex;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.9rem;
}

.badge.secondary { color: var(--muted); }
.badge.ok { background: rgba(87, 204, 153, 0.12); color: #b8f5d6; }

.button {
  border: 1px solid transparent;
  background: var(--accent);
  color: #081019;
  border-radius: 14px;
  padding: 10px 16px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

.button.secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.button.warning { background: var(--warn); }
.button.danger { background: var(--danger); color: white; }
.button:disabled { opacity: 0.6; cursor: not-allowed; }

.empty-state,
.scene-card,
.admin-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.scene-list,
.admin-scene-list,
.admin-section-stack,
.scene-images-list {
  display: grid;
  gap: 18px;
}

.admin-create-card {
  margin-bottom: 18px;
}

.card-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.card-heading.compact {
  margin-bottom: 14px;
}

.scene-header,
.admin-card-top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.admin-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
}

.admin-subsection {
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 16px;
  background: var(--panel-3);
}

.admin-form {
  display: grid;
  gap: 14px;
}

.admin-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-form label,
.image-caption-form label {
  display: grid;
  gap: 8px;
}

.admin-form span,
.image-caption-form span {
  font-size: 0.92rem;
  color: var(--muted);
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(7, 14, 26, 0.95);
  color: var(--text);
  padding: 12px 14px;
  font: inherit;
}

textarea {
  resize: vertical;
}

.full-width {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.form-actions.split {
  justify-content: space-between;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.image-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.image-tile {
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  background: var(--panel-2);
  cursor: pointer;
  text-align: center;
}

.image-grid img,
.admin-image-preview {
  width: 100%;
  display: block;
  object-fit: cover;
}

.image-grid img {
  height: 360px;
}

.image-grid.compact img {
  height: 260px;
  border-radius: 16px;
}

.image-caption {
  display: block;
  padding: 12px 14px;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.95rem;
}

.admin-image-card {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  background: rgba(7, 14, 26, 0.75);
}

.admin-image-preview {
  height: 240px;
  border-radius: 16px;
}

.admin-image-meta {
  display: grid;
  gap: 12px;
}

.admin-image-name {
  font-weight: 700;
  word-break: break-word;
}

.empty-thumb {
  min-height: 180px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
  color: var(--muted);
}

.flash {
  position: sticky;
  top: 12px;
  z-index: 20;
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(76, 201, 240, 0.12);
}

.flash.ok {
  background: rgba(87, 204, 153, 0.14);
}

.flash.error {
  background: rgba(239, 71, 111, 0.16);
}

.lightbox {
  position: relative;
  width: min(96vw, 1400px);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 24px;
  background: #0c1018;
  color: var(--text);
}

.lightbox::backdrop {
  background: rgba(0, 0, 0, 0.75);
}

.lightbox-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: min(78vh, 900px);
}

.lightbox img {
  width: 100%;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 18px;
}

.lightbox-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: transparent;
  color: var(--text);
  border: none;
  font-size: 2rem;
  cursor: pointer;
}

.lightbox-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  color: var(--muted);
}

.lightbox-scene-title {
  color: var(--text);
  font-weight: 700;
  margin-bottom: 6px;
}

.lightbox-caption {
  line-height: 1.5;
}

.lightbox-counter {
  white-space: nowrap;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(8, 16, 25, 0.78);
  color: var(--text);
  font-size: 2rem;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 2;
}

.lightbox-nav.prev { left: 20px; }
.lightbox-nav.next { right: 20px; }
.lightbox-nav:disabled {
  opacity: 0.35;
  cursor: default;
}

@media (max-width: 900px) {
  .admin-form-grid,
  .admin-image-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .hero,
  .scene-header,
  .admin-card-top,
  .card-heading {
    flex-direction: column;
  }

  .image-grid,
  .image-grid.compact {
    grid-template-columns: 1fr;
  }

  .image-grid img {
    height: 280px;
  }

  .lightbox {
    width: min(98vw, 98vw);
    padding: 18px;
  }

  .lightbox-stage {
    min-height: 50vh;
  }

  .lightbox-nav {
    width: 46px;
    height: 46px;
    font-size: 1.7rem;
    top: auto;
    bottom: 80px;
    transform: none;
  }

  .lightbox-nav.prev { left: 18px; }
  .lightbox-nav.next { right: 18px; }

  .lightbox-meta {
    flex-direction: column;
    gap: 6px;
  }
}


.admin-image-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.admin-image-preview.is-hidden {
  opacity: 0.35;
  filter: grayscale(0.8);
}
