/* ---------- Base 8-bit / Zelda title screen aesthetic ---------- */

/* SF Mono — six weights × upright + italic. Used site-wide EXCEPT the
   title page, where main.css overrides the font variables to VT323 +
   Press Start 2P for the retro splash. */
@font-face { font-family: "SF Mono"; src: url("/assets/fonts/SFMonoLight.woff")         format("woff"); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: "SF Mono"; src: url("/assets/fonts/SFMonoLightItalic.woff")   format("woff"); font-weight: 300; font-style: italic; font-display: swap; }
@font-face { font-family: "SF Mono"; src: url("/assets/fonts/SFMonoRegular.woff")       format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "SF Mono"; src: url("/assets/fonts/SFMonoRegularItalic.woff") format("woff"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "SF Mono"; src: url("/assets/fonts/SFMonoMedium.woff")        format("woff"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "SF Mono"; src: url("/assets/fonts/SFMonoMediumItalic.woff")  format("woff"); font-weight: 500; font-style: italic; font-display: swap; }
@font-face { font-family: "SF Mono"; src: url("/assets/fonts/SFMonoSemibold.woff")      format("woff"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "SF Mono"; src: url("/assets/fonts/SFMonoSemiboldItalic.woff")format("woff"); font-weight: 600; font-style: italic; font-display: swap; }
@font-face { font-family: "SF Mono"; src: url("/assets/fonts/SFMonoBold.woff")          format("woff"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "SF Mono"; src: url("/assets/fonts/SFMonoBoldItalic.woff")    format("woff"); font-weight: 700; font-style: italic; font-display: swap; }
@font-face { font-family: "SF Mono"; src: url("/assets/fonts/SFMonoHeavy.woff")         format("woff"); font-weight: 900; font-style: normal; font-display: swap; }
@font-face { font-family: "SF Mono"; src: url("/assets/fonts/SFMonoHeavyItalic.woff")   format("woff"); font-weight: 900; font-style: italic; font-display: swap; }

:root {
  --bg: #05070c;
  --ink: #e9e4c7;            /* parchment */
  --ink-dim: #b8b08a;
  --gold: #f4d17a;
  --gold-glow: rgba(244, 209, 122, 0.55);
  --accent: #8fd6ff;
  --accent-glow: rgba(143, 214, 255, 0.5);
  --danger: #ff8383;
  --shadow: 0 0 0 2px #000, 0 0 12px rgba(244,209,122,0.35);

  /* SF Mono across the site. main.css overrides these on the title page. */
  --font-ui:    "SF Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --font-prose: "SF Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.prose, .prose * {
  font-family: var(--font-prose);
  letter-spacing: 0.01em;
  line-height: 1.55;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  width: 100%; height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-prose);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: 0.01em;
  overflow: hidden;
  image-rendering: pixelated;
}

/* ---------- Visual hierarchy ----------
   HEAVY (900): hero / cinematic titles (gate name, end-card).
   BOLD  (700): page + section titles (H1/H2/H3).
   SEMIBOLD (600): buttons, chips, controls, column headers.
   MEDIUM (500): field labels, small meta, hints, helper text.
   REGULAR (400): body text, narration, data cells, form inputs.
   LIGHT (300): secondary / dim descriptions.                               */

.end-card .the-end, .gate-name {
  font-family: var(--font-ui);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.24em;
}

.brand .mark, .worlds-header .title, .row-title, .admin-title,
.hero-card h2, .scene-editor-title,
.audio-group h3, .cs-upload h3,
.modal h2, .modal h3,
.card h3,
.world-row .meta h4, .cs-row .info .title {
  font-family: var(--font-ui);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.pixel-btn, .tab-btn,
.chip, .scene-top .chip,
.card .sub, .card .difficulty, .hero-card .tag,
.dialogue .speaker,
.end-card .sub,
.gate-kicker, .gate-sub, .gate-prompt,
table.scene-table thead th,
.music-picker-row .name, .track-row .info .name,
.scene-list-row .meta .idx,
.scene-detail-head .scene-index,
.variant-card .v-meta .active-pill,
.modal.world-detail .meta span {
  font-family: var(--font-ui);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.field-label, .modal .field label,
.brand .sub, .dialogue .hint,
.footer, .press-start, .toast,
.scene-editor-sub {
  font-family: var(--font-ui);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

/* Dim helper / description text — lighter weight for secondary emphasis */
.cs-upload .desc,
.audio-group .desc,
.music-picker-empty,
.variant-card .v-prompt,
.music-picker-row .blurb,
.track-row .info .blurb,
.world-row .meta .sub,
.scene-empty {
  font-family: var(--font-prose);
  font-weight: 300;
  letter-spacing: 0.02em;
  line-height: 1.55;
}

/* CRT scanline overlay */
.crt::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 200;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255,255,255,0.025) 0 1px,
      transparent 1px 3px
    );
  mix-blend-mode: overlay;
}

.crt::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 201;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.75) 100%);
}

/* Pixelated button */
.pixel-btn {
  --btn-bg: rgba(10, 16, 28, 0.72);
  --btn-ink: var(--ink);
  --btn-border: var(--gold);
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 20px;
  color: var(--btn-ink);
  background: var(--btn-bg);
  border: 2px solid var(--btn-border);
  padding: 12px 22px;
  cursor: pointer;
  position: relative;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  image-rendering: pixelated;
  transition: transform 0.12s ease, box-shadow 0.12s ease, color 0.12s ease, background 0.12s ease;
  box-shadow:
    0 0 0 2px #000,
    inset 0 0 0 2px rgba(0,0,0,0.35),
    0 0 18px rgba(244,209,122,0.15);
  text-shadow: 1px 1px 0 #000;
}

.pixel-btn:hover, .pixel-btn:focus-visible {
  color: #fff;
  transform: translateY(-2px);
  box-shadow:
    0 0 0 2px #000,
    inset 0 0 0 2px rgba(0,0,0,0.35),
    0 0 28px var(--gold-glow),
    0 4px 0 rgba(0,0,0,0.8);
  outline: none;
}

.pixel-btn:active { transform: translateY(0); }

.pixel-btn.ghost { --btn-border: var(--accent); box-shadow: 0 0 0 2px #000, inset 0 0 0 2px rgba(0,0,0,0.35), 0 0 18px var(--accent-glow); }
.pixel-btn.danger { --btn-border: var(--danger); color: var(--danger); }

/* Blinking prompt */
@keyframes blink {
  0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; }
}
.blink { animation: blink 1.1s steps(2, start) infinite; }

/* Fade-in */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp 0.8s ease forwards; opacity: 0; }

/* Pixel hr (row of squares) */
.pixel-rule {
  height: 4px;
  background-image: linear-gradient(to right, var(--gold) 50%, transparent 0);
  background-size: 8px 4px;
  background-repeat: repeat-x;
  image-rendering: pixelated;
  opacity: 0.55;
}

/* Toasts */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: rgba(5,7,12,0.92);
  border: 2px solid var(--gold);
  padding: 10px 16px;
  font-size: 11px;
  z-index: 900;
  box-shadow: var(--shadow);
}

/* Modals — shared primitives used on every page */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.82);
  display: none;
  align-items: center; justify-content: center;
  z-index: 500;
  padding: 20px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal-backdrop.open {
  display: flex;
  animation: fadeUp 0.25s ease forwards;
}
.modal {
  background: #0a0f1a;
  border: 2px solid var(--gold);
  box-shadow: 0 0 0 2px #000, 0 0 32px rgba(244,209,122,0.2);
  padding: 28px 32px;
  width: min(560px, 92vw);
  max-height: 86vh;
  overflow: auto;
  color: var(--ink);
  font-family: var(--font-prose);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.6;
  letter-spacing: 0.01em;
  position: relative;
}
.modal h2 {
  font-size: 14px; color: var(--gold); margin: 0 0 14px;
  letter-spacing: 0.25em; text-transform: uppercase;
  text-shadow: 1px 1px 0 #000;
}
.modal .close {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 14px;
  padding: 6px 10px;
  line-height: 1;
  z-index: 2;
}

/* ---------- UI sizes (SF Mono site-wide) ---------- */

/* Page-level titles */
.worlds-header .title         { font-size: 17px; }
.admin-title                  { font-size: 18px; }
.scene-editor-title           { font-size: 16px; }
.hero-card h2                 { font-size: 26px; letter-spacing: 0.08em; }

/* Section headings */
.row-title                    { font-size: 14px; }
.audio-group h3               { font-size: 14px; }
.cs-upload h3                 { font-size: 14px; }
.modal h2                     { font-size: 17px; }
.modal h3                     { font-size: 14px; }
.card h3                      { font-size: 15px; letter-spacing: 0.1em; }
.world-row .meta h4           { font-size: 14px; }
.cs-row .info .title          { font-size: 14px; }

/* Buttons + chips */
.pixel-btn                    { font-size: 13px; padding: 11px 20px; }
.pixel-btn.ghost              { font-size: 13px; }
.tab-btn                      { font-size: 12px; }
.scene-top .chip              { font-size: 11px; padding: 6px 12px; }
.card .sub                    { font-size: 11px; }
.card .difficulty             { font-size: 11px; padding: 5px 9px; }
.hero-card .tag               { font-size: 11px; }
.dialogue .speaker            { font-size: 12px; letter-spacing: 0.22em; }
.end-card .sub                { font-size: 12px; letter-spacing: 0.2em; }
.modal.world-detail .meta span{ font-size: 11px; }
table.scene-table thead th    { font-size: 11px; letter-spacing: 0.14em; }
.music-picker-row .name       { font-size: 12px; }
.track-row .info .name        { font-size: 13px; }
.scene-list-row .meta .idx    { font-size: 11px; }
.scene-detail-head .scene-index { font-size: 12px; }
.variant-card .v-meta .active-pill { font-size: 9px; letter-spacing: 0.18em; }

/* Labels + hints (MEDIUM) */
.field-label                  { font-size: 10px; }
.modal .field label           { font-size: 10px; }
.dialogue .hint               { font-size: 11px; letter-spacing: 0.24em; }
.toast                        { font-size: 12px; letter-spacing: 0.1em; }
.scene-editor-sub             { font-size: 11px; }

/* Body prose (REGULAR) */
.input-pixel                  { font-size: 14px; font-weight: 400; letter-spacing: 0.01em; }
.empty-state                  { font-size: 15px; font-weight: 400; letter-spacing: 0.01em; }

/* Helper / dim (LIGHT) */
.cs-upload .desc              { font-size: 13px; }
.audio-group .desc            { font-size: 13px; }
.music-picker-empty           { font-size: 12px; }
.variant-card .v-prompt       { font-size: 12px; max-height: 56px; }
.music-picker-row .blurb      { font-size: 11px; }
.track-row .info .blurb       { font-size: 12px; }
.world-row .meta .sub         { font-size: 12px; }
.scene-empty                  { font-size: 15px; }
.variant-card .v-meta         { font-size: 10px; font-weight: 500; letter-spacing: 0.08em; }

/* Hero weights (Heavy) */
.end-card .the-end            { font-size: 34px; letter-spacing: 0.3em; }

/* Entry gate (play page) */
.gate-kicker                  { font-size: 11px; letter-spacing: 0.4em; }
.gate-name                    { font-size: clamp(28px, 4vw, 46px); line-height: 1.1; }
.gate-sub                     { font-size: 11px; letter-spacing: 0.35em; }
.gate-prompt                  { font-size: 14px; letter-spacing: 0.3em; }
