:root {
  color-scheme: dark;
  --night: #111a2d;
  --night-soft: #18243a;
  --panel: rgba(25, 38, 59, .92);
  --panel-light: #202f48;
  --gold: #eac77d;
  --gold-bright: #f4dda1;
  --cream: #f2ead7;
  --muted: #a9b2c3;
  --line: rgba(234, 199, 125, .24);
  --green: #7ebd94;
  --coral: #e9a18d;
  --radius: 18px;
  --shadow: 0 22px 60px rgba(4, 9, 19, .42);
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--night);
  color: var(--cream);
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(ellipse at 15% 0%, rgba(84, 102, 145, .18), transparent 36rem),
    radial-gradient(ellipse at 95% 34%, rgba(53, 103, 84, .12), transparent 34rem),
    linear-gradient(165deg, #111a2d 0%, #131e32 52%, #101829 100%);
}
button, a { font: inherit; }
button { color: inherit; }
button:focus-visible, a:focus-visible, summary:focus-visible, canvas:focus-visible { outline: 3px solid var(--gold-bright); outline-offset: 3px; }
.ambient { position: fixed; z-index: -1; width: 22rem; height: 22rem; border-radius: 50%; pointer-events: none; filter: blur(90px); opacity: .11; }
.ambient-one { left: -10rem; top: 27%; background: #6872b3; }
.ambient-two { right: -11rem; top: 65%; background: #56a67f; }

.site-header {
  width: min(1360px, calc(100% - 56px));
  min-height: 74px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(235, 219, 184, .1);
}
.wordmark { display: inline-flex; align-items: center; gap: 11px; color: var(--cream); text-decoration: none; font: 600 14px ui-monospace, 'SFMono-Regular', Consolas, monospace; letter-spacing: .03em; }
.wordmark em { color: var(--gold); font-style: normal; }
.wordmark-seal { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid rgba(234, 199, 125, .48); border-radius: 50%; color: var(--gold); font-size: 16px; box-shadow: inset 0 0 12px rgba(234, 199, 125, .1); }
.header-note { display: inline-flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px rgba(126, 189, 148, .6); }
.page-shell { width: min(1240px, calc(100% - 48px)); margin: auto; }
.intro { max-width: 800px; padding: 54px 0 34px; }
.eyebrow, .micro-label { margin: 0; color: var(--gold); font: 500 10px ui-monospace, 'SFMono-Regular', Consolas, monospace; letter-spacing: .16em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin: 14px 0 14px; color: #f8f1e2; font: 600 clamp(38px, 6vw, 68px)/.98 Georgia, 'Times New Roman', serif; letter-spacing: -.045em; }
h1 span { color: var(--gold); }
.intro-copy { max-width: 690px; margin-bottom: 18px; color: #c3cbd8; font-size: 15px; line-height: 1.75; }
.story-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.story-tags span { padding: 7px 11px; border: 1px solid rgba(223, 213, 188, .14); border-radius: 99px; background: rgba(255, 255, 255, .025); color: #c0c6d1; font-size: 11px; }

.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 20px; align-items: start; }
.game-column { min-width: 0; }
.game-toolbar { min-height: 57px; display: flex; align-items: center; justify-content: space-between; padding: 0 15px; border: 1px solid var(--line); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; background: rgba(25, 38, 59, .82); }
.chapter-label { display: inline-flex; align-items: center; gap: 11px; }
.chapter-gem { color: var(--gold); font-size: 16px; text-shadow: 0 0 12px rgba(234, 199, 125, .5); }
.chapter-label div { display: grid; gap: 2px; }
.chapter-label strong { color: var(--cream); font-size: 12px; font-weight: 600; }
.micro-label { color: #a9b4c4; font-size: 9px; letter-spacing: .13em; }
.quiet-button { padding: 8px 11px; border: 1px solid rgba(255,255,255,.12); border-radius: 9px; background: transparent; color: #bdc5d1; font-size: 11px; cursor: pointer; transition: color .2s, border-color .2s, background .2s; }
.quiet-button:hover { border-color: var(--line); background: rgba(234,199,125,.07); color: var(--gold-bright); }
.canvas-shell { position: relative; overflow: hidden; border: 1px solid var(--line); border-top-color: rgba(234,199,125,.12); border-radius: 0 0 var(--radius) var(--radius); background: #213b37; box-shadow: var(--shadow); }
#gameCanvas { display: block; width: 100%; height: auto; aspect-ratio: 13 / 8; image-rendering: pixelated; touch-action: none; background: #26463d; }
.start-card { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; overflow-y: auto; text-align: center; background: linear-gradient(180deg, rgba(12, 23, 34, .32), rgba(12, 23, 34, .78)); }
.start-card[hidden] { display: none; }
.start-emblem { display: grid; place-items: center; width: 54px; height: 54px; margin-bottom: 16px; border: 1px solid rgba(234,199,125,.66); border-radius: 50%; color: var(--gold); font-size: 27px; box-shadow: 0 0 30px rgba(234,199,125,.18), inset 0 0 18px rgba(234,199,125,.1); }
.start-card .eyebrow { margin-bottom: 9px; }
.start-card h2 { max-width: 560px; margin: 0 0 10px; color: #fff5df; font: 600 clamp(22px, 3.8vw, 34px)/1.1 Georgia, 'Times New Roman', serif; }
.start-card > p:not(.eyebrow):not(.start-hint) { max-width: 500px; margin: 0 0 20px; color: #d3d7dc; font-size: 13px; line-height: 1.55; }
.gold-button { padding: 12px 17px; border: 1px solid #f0d38e; border-radius: 9px; background: linear-gradient(135deg, #f0d38e, #d4a953); color: #222536; box-shadow: 0 8px 22px rgba(0,0,0,.2); font-size: 12px; font-weight: 700; cursor: pointer; transition: transform .18s, filter .18s; }
.gold-button:hover { transform: translateY(-2px); filter: brightness(1.08); }
.gold-button span { margin-left: 8px; }
.start-hint { margin: 12px 0 0; color: #b1bbc6; font-size: 10px; }
.game-toast { position: absolute; top: 13px; left: 50%; z-index: 2; max-width: calc(100% - 28px); padding: 8px 13px; border: 1px solid rgba(234,199,125,.45); border-radius: 99px; background: rgba(17,26,45,.92); color: var(--gold-bright); font-size: 11px; text-align: center; opacity: 0; transform: translate(-50%, -8px); transition: opacity .2s, transform .2s; pointer-events: none; }
.game-toast.visible { opacity: 1; transform: translate(-50%, 0); }

.touch-controls { display: none; align-items: center; justify-content: space-between; padding: 14px 8px 4px; }
.dpad { display: grid; grid-template-columns: repeat(3, 42px); grid-template-rows: repeat(2, 38px); gap: 4px; }
.pad-button { display: grid; place-items: center; border: 1px solid rgba(234,199,125,.32); border-radius: 10px; background: rgba(31,47,72,.92); color: var(--gold-bright); font-size: 13px; touch-action: none; user-select: none; -webkit-user-select: none; }
.pad-up { grid-column: 2; grid-row: 1; }.pad-left { grid-column: 1; grid-row: 2; }.pad-down { grid-column: 2; grid-row: 2; }.pad-right { grid-column: 3; grid-row: 2; }
.pad-button:active, .pad-button.pressed, .action-button:active { background: #455a73; transform: scale(.96); }
.action-button { min-height: 46px; padding: 0 15px; border: 1px solid rgba(234,199,125,.46); border-radius: 13px; background: linear-gradient(145deg, #283954, #1b2940); color: var(--gold-bright); font-size: 11px; font-weight: 600; touch-action: none; }
.action-button span { margin-left: 5px; }
.keyboard-hint { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; padding: 12px 2px 0; color: #9da9b9; font-size: 10px; }
.keycap { display: inline-grid; place-items: center; min-width: 20px; height: 21px; padding: 0 4px; border: 1px solid rgba(234,199,125,.25); border-bottom-width: 2px; border-radius: 5px; background: rgba(255,255,255,.04); color: #e4d9be; font: 10px ui-monospace, 'SFMono-Regular', Consolas, monospace; }
.keycap-wide { min-width: 24px; }.hint-divider { margin: 0 5px; color: var(--gold); }
.dialogue-box { display: grid; grid-template-columns: 52px minmax(0,1fr); gap: 13px; margin-top: 15px; padding: 15px; border: 1px solid rgba(234,199,125,.38); border-radius: 14px; background: linear-gradient(140deg, rgba(34,49,71,.98), rgba(24,37,58,.98)); box-shadow: 0 12px 30px rgba(0,0,0,.22); }
.dialogue-box[hidden] { display: none; }
.dialogue-portrait { display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid rgba(234,199,125,.4); border-radius: 12px; background: linear-gradient(145deg,#554b61,#283b4d); color: var(--gold-bright); font: 600 21px Georgia, 'Times New Roman', serif; }
.dialogue-heading { display: flex; align-items: center; justify-content: space-between; }
.dialogue-speaker { margin: 1px 0 6px; color: var(--gold-bright); font: 500 10px ui-monospace, 'SFMono-Regular', Consolas, monospace; letter-spacing: .14em; text-transform: uppercase; }
.dialogue-mark { color: var(--gold); }
.dialogue-text { margin: 0 0 9px; color: #e2e5e9; font-size: 13px; line-height: 1.65; }
.dialogue-next { padding: 5px 0; border: 0; background: transparent; color: #d6bd82; font-size: 10px; cursor: pointer; }
.dialogue-next span { margin-left: 5px; }

.quest-panel { padding: 20px 19px 15px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(155deg, rgba(29,44,67,.96), rgba(22,34,53,.96)); box-shadow: 0 14px 38px rgba(4,9,19,.22); }
.panel-heading { display: flex; align-items: center; gap: 11px; margin-bottom: 17px; }
.panel-icon { display: grid; place-items: center; width: 37px; height: 37px; border: 1px solid rgba(234,199,125,.33); border-radius: 12px; color: var(--gold); font-size: 19px; }
.panel-heading .micro-label { margin-bottom: 3px; }.panel-heading h2 { margin: 0; color: #f3ecd9; font: 600 21px/1.1 Georgia, 'Times New Roman', serif; }
.quest-progress { width: 100%; height: 5px; margin-bottom: 9px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.09); }
.quest-progress span { display: block; width: 5%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #9cbe94, var(--gold)); transition: width .5s ease; }
.quest-stage { margin-bottom: 13px; color: #aeb9c7; font: 10px ui-monospace, 'SFMono-Regular', Consolas, monospace; letter-spacing: .08em; text-transform: uppercase; }
.objective-card { display: grid; grid-template-columns: 20px 1fr; gap: 8px; padding: 12px 11px; border: 1px solid rgba(234,199,125,.17); border-radius: 11px; background: rgba(234,199,125,.055); }
.objective-star { padding-top: 1px; color: var(--gold); }.objective-card .micro-label { margin-bottom: 5px; font-size: 8px; }.objective-card p:last-child { margin: 0; color: #e4e3dd; font-size: 11px; line-height: 1.5; }
.inventory-section, .people-section { margin-top: 19px; }
.section-label { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 9px; }
.section-label h3 { margin: 0; color: #e6dfd0; font: 600 12px Georgia, 'Times New Roman', serif; }.section-label > span { color: #8997a9; font-size: 9px; }
.inventory-list, .people-list { margin: 0; padding: 0; list-style: none; }
.inventory-list { display: grid; gap: 7px; }
.inventory-list li { display: flex; align-items: center; gap: 8px; color: #e4ddcc; font-size: 10px; }
.inventory-list li:not(.inventory-empty)::before { content: '✦'; color: var(--gold); font-size: 11px; }
.inventory-empty { color: #8e9aac !important; font-style: italic; }
.people-list { display: grid; gap: 8px; }
.people-list li { display: grid; grid-template-columns: 29px 1fr auto; gap: 8px; align-items: center; }
.person-avatar { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; font: 600 12px Georgia, 'Times New Roman', serif; }
.avatar-mom { background: #3c4d58; color: #e9c99a; }.avatar-sis { background: #41564d; color: #a6d3a4; }.avatar-gran { background: #5b4d65; color: #e3c6e4; }
.people-list strong, .people-list small { display: block; }.people-list strong { color: #e5e3dd; font-size: 10px; font-weight: 600; }.people-list small { margin-top: 2px; color: #8f9bac; font-size: 9px; }.person-star { color: var(--gold); font-size: 11px; }
.story-note { margin-top: 17px; padding-top: 13px; border-top: 1px solid rgba(255,255,255,.09); }
.story-note summary { color: #c7b581; font-size: 10px; cursor: pointer; }.story-note p { margin: 9px 0 0; color: #a9b5c3; font-size: 10px; line-height: 1.6; }
.panel-footnote { display: flex; gap: 7px; margin: 18px 0 0; color: #8592a4; font-size: 9px; line-height: 1.5; }.panel-footnote span { color: var(--gold); }
.epilogue-card { display: flex; align-items: center; justify-content: center; gap: 17px; margin: 24px 0 40px; padding: 17px; border-top: 1px solid rgba(234,199,125,.18); border-bottom: 1px solid rgba(234,199,125,.18); color: #b9c1cd; text-align: center; }
.epilogue-card p { margin: 0; font: italic 15px/1.5 Georgia, 'Times New Roman', serif; }.epilogue-ornament { color: var(--gold); font-size: 14px; }
.site-footer { display: flex; justify-content: space-between; width: min(1360px, calc(100% - 56px)); margin: auto; padding: 17px 0 22px; border-top: 1px solid rgba(235,219,184,.1); color: #778598; font: 9px ui-monospace, 'SFMono-Regular', Consolas, monospace; letter-spacing: .05em; }

@media (max-width: 980px) {
  .game-layout { grid-template-columns: minmax(0,1fr) 270px; gap: 14px; }
  .quest-panel { padding: 17px 14px; }
}
@media (max-width: 760px) {
  .site-header { width: calc(100% - 32px); min-height: 62px; }
  .header-note { max-width: 130px; font-size: 10px; line-height: 1.35; }
  .page-shell { width: calc(100% - 28px); }
  .intro { padding: 38px 0 24px; }
  .intro-copy { font-size: 13px; }
  .game-layout { grid-template-columns: 1fr; }
  .quest-panel { order: 2; }
  .game-column { order: 1; }
  .touch-controls { display: flex; }
  .keyboard-hint { display: none; }
  .quest-panel { padding: 17px; }
  .people-list { grid-template-columns: 1fr; }
}
@media (max-width: 430px) {
  .wordmark { gap: 7px; font-size: 11px; }.wordmark-seal { width: 29px; height: 29px; }
  .header-note { max-width: 105px; }
  .game-toolbar { padding: 0 10px; }.quiet-button { padding: 7px 8px; font-size: 10px; }
  .chapter-label strong { font-size: 10px; }
  .start-card { padding: 12px; }.start-card > p:not(.eyebrow):not(.start-hint) { font-size: 11px; }
  .start-emblem { width: 42px; height: 42px; margin-bottom: 10px; font-size: 22px; }
  .touch-controls { padding-left: 0; padding-right: 0; }
  .dpad { grid-template-columns: repeat(3, 38px); grid-template-rows: repeat(2, 34px); }
  .action-button { min-height: 42px; padding: 0 11px; font-size: 10px; }
  .dialogue-box { grid-template-columns: 39px minmax(0,1fr); gap: 10px; padding: 12px; }
  .dialogue-portrait { width: 38px; height: 38px; border-radius: 10px; }
  .dialogue-text { font-size: 11px; }
  .epilogue-card { gap: 9px; padding: 14px 3px; }.epilogue-card p { font-size: 13px; }
  .site-footer { width: calc(100% - 32px); gap: 12px; font-size: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
