/* ============================================================
   theme.css — Week Seven: Shells (16-bit JRPG)
   Every piece of text sits in a menu window: blue vertical
   gradient, white rounded border with an inner rule.
   Layout (stage px, 1280 x 720, full-bleed world):
     top-left  location window (#hud-left)     top-right LV (#hud-right)
     top       quest log tabs (#section-nav); on the world map it
               becomes the full QUEST LOG window at the right
     bottom    dialogue window (#console) · command menu (#verbs)
               · party status (#party)
   The bundled pixel fonts have no arrow / tick glyphs, so every
   cursor, triangle and checkmark below is drawn with CSS.
   ============================================================ */

/* Window text: Pixelify Sans, but with VT323's digits (Pixelify's 5 reads as an S or 8 at this size) */
@font-face { font-family: 'JRPG Text'; src: url('../fonts/VT323.woff2') format('woff2'); unicode-range: U+0030-0039; size-adjust: 125%; font-display: block; }
@font-face { font-family: 'JRPG Text'; src: url('../fonts/PixelifySans.woff2') format('woff2'); unicode-range: U+0000-002F, U+003A-FFFF; font-display: block; }

:root {
  --ink: #ffffff;
  --dim: #aab6ec;
  --accent: #ffd84a;
  --accent-2: #7fe6ff;
  --accent-3: #ff9ac0;
  --warn: #ff7a5a;
  --font-display: 'Press Start 2P', monospace;
  --font-body: 'JRPG Text', 'Pixelify Sans', monospace;
  --fs: 28px;
  --jr-grad: linear-gradient(180deg, #2350c4 0%, #14338a 52%, #0a1c5e 100%);
  --jr-edge: #f4f4fa;
  --jr-shadow: inset 0 0 0 2px #0a1448, inset 0 0 0 4px #6c80d8, 0 0 0 2px #05071a, 5px 5px 0 rgba(0, 0, 0, 0.45);
  --panel-bg: var(--jr-grad);
  --panel-edge: var(--jr-edge);
  --panel-radius: 8px;
  --console-bg: var(--jr-grad);
  --console-edge: var(--jr-edge);
  --hud-bg: transparent;
  --hud-ink: #ffffff;
}

/* ---------- the window look, shared by every piece of chrome ---------- */
.frame-jrpg, #console, #verbs, #party, #hud-left, #hud-right, #section-nav, #speaker, #controls button, #hover-line, #badge,
.panel.title .start, .damage .kicker, .damage .sub {
  background: var(--jr-grad);
  border: 3px solid var(--jr-edge);
  border-radius: 8px;
  box-shadow: var(--jr-shadow);
  color: #fff;
  text-shadow: 2px 2px 0 #06103a;
}

#crt { background: repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0 2px, rgba(0,0,0,0.07) 2px 4px); }

/* ---------- top: location, quest log, level ---------- */
#hud { background: none; height: 48px; padding: 0; pointer-events: none; font-size: 11px; }
#hud > * { pointer-events: auto; }
#hud-left { position: absolute; left: 12px; top: 8px; min-width: 0; height: 38px; padding: 0 18px 0 14px; gap: 12px;
  font-family: var(--font-display); font-size: 11px; letter-spacing: 1px; }
#hud-mark { width: 9px; height: 9px; background: var(--accent); transform: rotate(45deg); animation: none; box-shadow: 1px 1px 0 #06103a; }
#hud-right { position: absolute; right: 12px; top: 8px; min-width: 0; height: 38px; padding: 0 16px;
  font-family: var(--font-display); font-size: 12px; color: var(--accent); }

#section-nav { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); height: 38px; padding: 0 8px; gap: 2px; align-items: center; }
#section-nav button { position: relative; font-family: var(--font-display); font-size: 9px; color: var(--dim); background: none; border: 0;
  padding: 6px 8px; border-radius: 4px; text-shadow: 1px 1px 0 #06103a; }
#section-nav button.done { color: #8ff0a0; padding-left: 20px; }
#section-nav button.done::before { content: ''; position: absolute; left: 7px; top: 50%; width: 4px; height: 8px;
  border: solid #8ff0a0; border-width: 0 3px 3px 0; transform: translateY(-65%) rotate(45deg); }
#section-nav button.active { color: #10183a; background: var(--accent); border: 0; text-shadow: none; }

/* on the world map the tabs open into the QUEST LOG window */
body[data-room="overworld"] #section-nav { left: auto; right: 14px; top: 60px; transform: none; width: 356px; height: auto;
  flex-direction: column; align-items: stretch; padding: 50px 14px 16px; gap: 4px; }
body[data-room="overworld"] #section-nav::before { content: 'QUEST LOG'; position: absolute; left: 18px; top: 18px;
  font-family: var(--font-display); font-size: 11px; color: var(--accent); letter-spacing: 1px; }
body[data-room="overworld"] #section-nav button { display: flex; gap: 14px; align-items: baseline; text-align: left;
  font-family: var(--font-body); font-size: 25px; color: #fff; padding: 6px 8px 6px 34px; }
body[data-room="overworld"] #section-nav button::after { content: attr(title); }
body[data-room="overworld"] #section-nav button.done { color: #8ff0a0; }
body[data-room="overworld"] #section-nav button.done::before { left: 12px; width: 6px; height: 13px; border-width: 0 4px 4px 0; }
body[data-room="overworld"] #section-nav button.active { background: rgba(255, 255, 255, 0.12); color: var(--accent); text-shadow: 2px 2px 0 #06103a; }
body[data-room="overworld"] #section-nav button.active::before { content: ''; position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  border-left: 12px solid #fff; border-top: 8px solid transparent; border-bottom: 8px solid transparent; animation: blink 1s steps(2) infinite; }

#hover-line { left: 50%; right: auto; top: 56px; bottom: auto; transform: translateX(-50%); padding: 7px 14px; font-size: 10px; color: var(--accent); }
#hover-line:empty { display: none; }
#badge { color: var(--accent); top: 58px; padding: 10px 16px; }

/* ---------- bottom: dialogue window ---------- */
body.narration-window #console, #console {
  left: 12px; top: auto; bottom: 10px; width: 900px; height: 166px; z-index: 30;
  display: block; padding: 24px 30px 14px; overflow: visible; border-top-width: 3px;
}
#speaker { position: absolute; left: 20px; top: -18px; height: 30px; padding: 7px 14px 0; font-family: var(--font-display);
  font-size: 10px; letter-spacing: 1px; color: var(--accent); }
#speaker:empty { display: none; }
#dialogue-text { --dialogue-fs: 27px; height: 100%; font-family: var(--font-body); line-height: 1.14; color: #fff; text-shadow: 2px 2px 0 #06103a; }
#dialogue-text.typing::after { content: ''; display: inline-block; width: 11px; height: 20px; margin-left: 4px; vertical-align: -2px; background: #fff; }
#dialogue-text:not(.typing):not(:empty)::after { content: ''; display: inline-block; margin-left: 10px; vertical-align: 1px;
  border-top: 11px solid var(--accent); border-left: 8px solid transparent; border-right: 8px solid transparent; animation: blink 1s steps(2) infinite; }
#dialogue-text a { color: var(--accent-2); }
#controls { position: absolute; right: 18px; top: -18px; display: flex; gap: 6px; }
#controls button { width: auto; min-width: 34px; height: 30px; padding: 0 9px; font-family: var(--font-display); font-size: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; }
#controls button:hover { color: var(--accent); }
.tri { display: inline-block; border-left: 9px solid currentColor; border-top: 6px solid transparent; border-bottom: 6px solid transparent; }
.tri.left { border-left: 0; border-right: 9px solid currentColor; }

/* ---------- bottom: command menu ---------- */
#verbs { position: absolute; left: 922px; bottom: 10px; width: 132px; height: 166px; z-index: 31; grid-column: auto;
  display: flex; flex-direction: column; justify-content: center; align-items: stretch; gap: 1px; padding: 8px 8px 8px 34px;
  font-family: var(--font-display); font-size: 11px; }
#verbs button { position: relative; text-align: left; color: #fff; padding: 6px 0; font: inherit; text-shadow: 2px 2px 0 #06103a; }
#verbs button:hover, #verbs button.active { color: var(--accent); }
#verbs button.cur::before, #verbs button:hover::before { content: ''; position: absolute; left: -20px; top: 50%; transform: translateY(-50%);
  border-left: 11px solid #fff; border-top: 7px solid transparent; border-bottom: 7px solid transparent; }
#verbs button.cur::before { animation: nudge 0.9s steps(2) infinite; }

/* ---------- bottom: party status ---------- */
#party { position: absolute; left: 1064px; bottom: 10px; width: 204px; height: 166px; z-index: 31;
  display: flex; flex-direction: column; justify-content: space-between; padding: 10px 14px 12px; }
#party .pm, #party .xp { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto 6px; gap: 3px 6px; align-items: end; }
#party .nm { font-family: var(--font-display); font-size: 8px; color: #fff; letter-spacing: 1px; }
#party .n { font-family: 'VT323', monospace; font-size: 18px; line-height: 10px; color: #fff; }
#party .bar { grid-column: 1 / -1; height: 6px; background: #070b2a; border: 1px solid #8a9ae8; }
#party .bar i { display: block; height: 100%; width: 100%; background: #58e070; transition: width 0.7s steps(7); }
#party .pm.low .bar i { background: #f0c040; }
#party .pm.low .n { color: #f0c040; }
#party .xp .nm { color: var(--accent-2); }
#party .xp .bar i { background: var(--accent-2); width: 0; }
#party .pm.hit { animation: hit 0.25s steps(2) 3; }
#party .pm.heal .n { animation: heal 0.3s steps(2) 3; }

/* ---------- title screen: no chrome, a logo and a menu ---------- */
body.is-title #hud, body.is-title #console, body.is-title #verbs, body.is-title #party { display: none; }
.frame-title { background: none; border: 0; box-shadow: none; text-align: center; }
.panel.title .kicker { font-size: 0.4em; color: var(--accent-2); letter-spacing: 2px; text-shadow: 2px 2px 0 #06103a; }
.panel.title h1 { margin: 0.5em 0 0.2em; text-shadow: none; }
.panel.title .t-small { display: block; font-size: 0.62em; letter-spacing: 6px; color: #fff; text-shadow: 3px 3px 0 #06103a; }
.panel.title .t-big { display: block; margin-top: 0.25em; font-size: 2.9em; line-height: 1.05; letter-spacing: 8px; color: #ffe066;
  text-shadow: 0 4px 0 #e09a20, 0 8px 0 #a0500c, 0 12px 0 #4a1e00, 6px 16px 0 rgba(0, 0, 0, 0.45); }
.panel.title .sub { margin-top: 0.55em; font-size: 1.1em; color: var(--accent-2); text-shadow: 2px 2px 0 #06103a; }
.panel.title .byline { margin-top: 0.3em; font-size: 0.95em; color: #fff; text-shadow: 2px 2px 0 #06103a; }
.panel.title .byline strong { color: #fff; }
.panel.title .start { animation: none; display: inline-block; position: relative; margin-top: 1.1em; padding: 12px 20px 11px 40px;
  font-family: var(--font-display); font-size: 0.42em; color: #fff; }
.cursor { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); border-left: 11px solid #fff;
  border-top: 7px solid transparent; border-bottom: 7px solid transparent; animation: blink 1s steps(2) infinite; }

/* ---------- menu windows ---------- */
.panel.frame-jrpg { padding: 0.7em 0.95em 0.7em; text-shadow: 2px 2px 0 #06103a; }
.frame-jrpg .tag { color: var(--accent-3); }
.frame-jrpg .tag .right { color: var(--dim); }
.frame-jrpg h2 { font-family: var(--font-body); font-size: 1.32em; line-height: 1.08; color: var(--accent); margin-bottom: 0.45em; }
.frame-jrpg em { color: var(--accent); }
.frame-jrpg strong { color: var(--accent-2); }
.panel ul li::before { content: ''; left: 0.1em; top: 0.42em; border-left: 0.36em solid var(--accent-2);
  border-top: 0.22em solid transparent; border-bottom: 0.22em solid transparent; }
.panel.list ul li { margin: 0.42em 0; padding-left: 1.05em; }

/* images, video, gallery tiles: a window with a name bar and a dark screen */
.panel.media.frame-jrpg, .tile.frame-jrpg { padding: 6px 8px 8px; }
.frame-jrpg .bar { background: none; color: #fff; font-size: 10px; padding: 6px 4px 9px; text-shadow: 2px 2px 0 #06103a; }
.frame-jrpg .screen { background: #040716; border: 2px solid #050a30; border-radius: 3px; }
.frame-jrpg .caption { background: none; color: var(--dim); }
.tile.frame-jrpg .bar { font-size: 9px; }

/* quotes: the enemy's line in the battle window */
.panel.quote.frame-jrpg blockquote { font-size: 1.28em; line-height: 1.1; }
.panel.quote blockquote::before, .panel.quote blockquote::after { color: var(--accent-3); }
.panel.quote cite { color: var(--dim); font-size: 0.78em; }
.enemy-line .tag { margin-bottom: 0.7em; }

/* status screens (stats with one column) */
.stats-panel.frame-jrpg .stats { gap: 0; }
.stats-panel.frame-jrpg .stat { display: flex; justify-content: space-between; align-items: baseline; gap: 1em; border-left: 0;
  border-bottom: 2px dotted rgba(255, 255, 255, 0.28); padding: 0.42em 0.1em; }
.stats-panel.frame-jrpg .stat .k { margin: 0; font-size: 0.4em; color: var(--accent-3); }
.stats-panel.frame-jrpg .stat .v { text-align: right; font-size: 1.05em; }
.stats-panel.frame-jrpg .stat.flag .v { color: var(--accent); }
.chain { display: flex; flex-wrap: wrap; gap: 0.5em 0; margin-top: 1.1em; font-family: var(--font-display); font-size: 0.32em; }
.chain span { padding: 0.75em 0.8em; border: 2px solid var(--accent-2); border-radius: 3px; color: var(--accent-2); }
.chain span + span { position: relative; margin-left: 2em; }
.chain span + span::before { content: ''; position: absolute; left: -1.55em; top: 50%; transform: translateY(-50%);
  border-left: 0.95em solid #fff; border-top: 0.6em solid transparent; border-bottom: 0.6em solid transparent; }

/* option windows + the prompt as a spell scroll */
.spell { margin-top: 0.6em; padding: 0.55em 0.75em 0.6em; background: rgba(2, 6, 40, 0.55); border: 2px solid #8a9ae8; border-radius: 5px;
  font-size: 1em; line-height: 1.16; }
.spell-k { display: block; font-family: var(--font-display); font-size: 0.34em; color: var(--accent-3); letter-spacing: 1px; margin-bottom: 0.8em; }

/* equipment compare */
.compare-panel .compare { grid-template-columns: auto 1fr 1fr; gap: 0 1em; font-size: 0.95em; }
.compare-panel .compare > div { padding: 0.35em 0; border-bottom: 2px dotted rgba(255, 255, 255, 0.22); }
.compare-panel .compare .h { font-size: 0.4em; line-height: 1.7; color: var(--accent-2); border-bottom: 2px solid rgba(255, 255, 255, 0.4); }
.compare-panel .compare .h .sub { display: block; color: var(--dim); }
.compare-panel .compare .k { font-family: var(--font-display); font-size: 0.36em; color: var(--accent-3); align-self: stretch; display: flex; align-items: center; }
.compare-panel .compare .a { color: #fff; }
.compare-panel .compare .b { color: var(--accent); }

/* battle messages */
.panel.sign.battle-msg { padding: 0.55em 1em 0.6em; }
.panel.sign.battle-msg .kicker { font-size: 0.4em; color: var(--accent); letter-spacing: 1px; }
.panel.sign.battle-msg .sign-text { font-family: var(--font-body); font-size: 1.4em; line-height: 1.1; margin-top: 0.15em; color: #fff; text-shadow: 2px 2px 0 #06103a; }
.panel.sign.battle-msg .sign-text em { color: var(--accent); }
.panel.sign.cite-msg .sign-text { font-size: 1.15em; color: var(--accent-2); margin-top: 0.4em; }

/* the damage number */
.panel.sign.damage { background: none; border: 0; box-shadow: none; overflow: visible; }
.panel.sign.damage .kicker { display: inline-block; padding: 9px 14px 8px; font-size: 0.4em; color: var(--accent); }
.panel.sign.damage .sign-text { font-family: var(--font-display); font-size: 3.3em; line-height: 1.25; margin: 0.25em 0 0.2em; color: #fff;
  text-shadow: 4px 0 0 #c0182a, -4px 0 0 #c0182a, 0 4px 0 #c0182a, 0 -4px 0 #c0182a, 4px 4px 0 #c0182a, -4px -4px 0 #c0182a, 4px -4px 0 #c0182a, -4px 4px 0 #c0182a, 8px 10px 0 rgba(20, 0, 16, 0.7);
  animation: dmg 0.9s steps(9) both; }
.panel.sign.shown.damage .sign-text { animation: none; }
.panel.sign.damage .sub { display: inline-block; margin-top: 0.6em; padding: 12px 18px; font-size: 0.4em; line-height: 1.9; color: #fff; }
.damage .src { display: block; margin-top: 6px; color: var(--dim); }

/* the hush: the house lights are down, the windows go quiet */
.panel.hushed { background: linear-gradient(180deg, #141a40 0%, #080b22 100%); border-color: #c8cad8;
  box-shadow: inset 0 0 0 2px #04061a, inset 0 0 0 4px #3a4070, 0 0 0 2px #020208, 5px 5px 0 rgba(0, 0, 0, 0.5); }
.panel.hushed h2 { color: #fff; font-size: 1.55em; margin: 0.1em 0; }
.panel.hushed.reading p { font-size: 1.1em; }

/* the inn */
.panel.question h2 { color: #fff; font-size: 1.6em; line-height: 1.12; margin-bottom: 0.1em; }
.panel.objective h2 { margin-bottom: 0.3em; }
.checks { font-family: var(--font-display); font-size: 0.42em; color: var(--dim); display: flex; align-items: center; }
.checks .box { display: inline-block; width: 22px; height: 22px; border: 3px solid #fff; border-radius: 3px; margin: 0 12px 0 0; }
.checks .box + * , .checks .box:not(:first-child) { margin-left: 30px; }

/* the ending credits */
.panel.credits ul li { margin: 0.32em 0; font-size: 0.95em; }
.panel.credits a { color: var(--accent-2); }

/* missing image stand-in inside a window */
.frame-jrpg .missing { background: repeating-linear-gradient(45deg, #0a1240 0 12px, #101a52 12px 24px); color: var(--accent); }

/* ---------- overlays ---------- */
.font-warm { position: absolute; left: -9999px; top: 0; font-family: var(--font-body); }
#preloader { background: #000; }
#preloader .pl-title { color: #fff; }
#preloader .pl-outer { border-color: #fff; border-radius: 6px; }
#preload-bar { background: #58e070; }

@keyframes nudge { 50% { transform: translate(3px, -50%); } }
@keyframes hit { 50% { background: rgba(255, 60, 80, 0.55); transform: translateX(3px); } }
@keyframes heal { 50% { color: #8ff0a0; } }
@keyframes dmg { 0% { opacity: 0; transform: translateY(40px); } 25% { opacity: 1; transform: translateY(-28px); } 50% { transform: translateY(0); }
  70% { transform: translateY(-9px); } 100% { opacity: 1; transform: translateY(0); } }

@media (prefers-reduced-motion: reduce) {
  .damage .sign-text, #verbs button.cur::before, .cursor, #dialogue-text::after, #section-nav button::before, #party .pm { animation: none !important; }
}
