:root {
  color-scheme: dark;
  --bg: #171e19;
  --panel: #202820;
  --edge: #3b4537;
  --edge-warm: #4e5039;
  --text: #f2ebd8;
  --muted: #afb5a3;
  --gold: #e5bd78;
  --font: "Avenir Next", Avenir, system-ui, sans-serif;
  --serif: Iowan Old Style, "Palatino Linotype", Palatino, Georgia, serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100svh;
  background: radial-gradient(ellipse at 33% 30%, #222b20 0%, transparent 62%), var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
}
button { font: inherit; color: inherit; }
button:not(:disabled) { cursor: pointer; }
button:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
h1, h2, p, ul, ol { margin: 0; }
button { background: none; }
.shell { width: min(1336px, calc(100% - 88px)); margin: 0 auto; }
.site-header { min-height: 83px; border-bottom: 1px solid #ffffff0d; background: #171e19b8; }
.header-inner { min-height: inherit; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wordmark { display: flex; gap: 13px; align-items: center; color: #f7e8c4; font: 700 26px/.92 var(--serif); letter-spacing: .115em; text-transform: uppercase; }
.wordmark small { display: block; color: #bfaa79; font: 700 10px/1 var(--font); letter-spacing: .29em; margin-top: 7px; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; position: relative; color: #ddad60; flex: none; }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; transform: rotate(45deg); }
.brand-mark::before { inset: 5px; border: 1px solid #b68f55; background: #a6824121; }
.brand-mark::after { inset: 8px; border: 1px solid #b68f555b; }
.brand-mark i { width: 12px; height: 24px; position: relative; z-index: 1; background: currentColor; clip-path: polygon(50% 0,92% 26%,83% 55%,68% 57%,91% 91%,100% 100%,0 100%,9% 91%,32% 57%,17% 55%,8% 26%,28% 36%); }
.header-actions { display: flex; gap: 10px; }
.utility, .map-button { display: inline-flex; gap: 8px; align-items: center; min-height: 38px; color: #d6d6c4; font-size: .85rem; font-weight: 650; border: 1px solid var(--edge); border-radius: 6px; padding: 0 12px; background: #232c23; white-space: nowrap; }
.utility:hover, .map-button:hover { background: #343e2c; border-color: #7f7852; }
.music-icon { color: var(--gold); font-size: 17px; line-height: 1; }
.help-icon { color: var(--gold); border: 1px solid #ab9664; width: 16px; height: 16px; font: 700 11px/14px var(--font); text-align: center; border-radius: 50%; }
.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(286px, 310px); gap: 22px; padding-top: clamp(26px, 5vh, 53px); align-items: start; }
.play { min-width: 0; }
.play-frame { padding: 5px; border: 1px solid #706649; border-radius: 10px; background: #2b2f23; box-shadow: 0 17px 42px #0c110d77, inset 0 0 0 1px #141711; }
.stage { aspect-ratio: 480 / 312; background: #253524; border: 1px solid #101711; border-radius: 6px; position: relative; overflow: hidden; isolation: isolate; user-select: none; }
#world { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.stage:focus { outline: 1px solid #a38c5a; outline-offset: -1px; }
.game-hud { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; position: absolute; inset: 14px 14px auto; pointer-events: none; }
.vitals, .location { border: 1px solid #b4a47186; background: #181d16e8; box-shadow: 0 3px 8px #0e160c80, inset 0 0 0 2px #222a20; border-radius: 6px; }
.vitals { padding: 7px 10px; display: grid; gap: 5px; }
.hearts { display: flex; gap: 3px; }
.hearts canvas { width: 22px; height: 21px; image-rendering: pixelated; }
.coin { display: flex; align-items: center; gap: 6px; font: 700 13px/16px var(--font); color: #f5d196; }
.coin-icon { width: 10px; height: 10px; background: #e5a742; border: 2px solid #f5ce78; box-shadow: 0 1px 0 #815422; border-radius: 50%; }
.location { display: flex; align-items: center; gap: 8px; padding: 7px 10px; color: #f5e6c3; font: 700 14px/1.25 var(--serif); letter-spacing: .03em; }
.location-pin { width: 8px; height: 8px; background: var(--gold); border: 2px solid #7f6c45; transform: rotate(45deg); }
.zone-title { position: absolute; top: 28%; left: 50%; transform: translate(-50%, -4px); opacity: 0; color: #fff1ce; text-align: center; font: 700 clamp(21px, 4vw, 42px)/1 var(--serif); letter-spacing: .13em; white-space: nowrap; text-shadow: 0 2px 6px #192818, 0 0 30px #16201a; pointer-events: none; transition: opacity .35s, transform .35s; }
.zone-title.visible { opacity: 1; transform: translate(-50%, 0); }
.toast { position: absolute; left: 50%; top: 15%; width: max-content; max-width: 86%; transform: translateX(-50%); background: #151e18f5; border: 1px solid #bba270; padding: 6px 12px; border-radius: 5px; color: #ffebbe; text-align: center; font-size: .82rem; box-shadow: 0 4px 17px #16170e90; pointer-events: none; z-index: 4; }
.prompt { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); max-width: 90%; display: flex; align-items: center; gap: 9px; justify-content: center; border: 1px solid #c5a974; background: #1c241aee; border-radius: 5px; padding: 6px 12px 6px 8px; color: #ffedc9; white-space: nowrap; font-size: .85rem; box-shadow: 0 3px 8px #10140ba0; }
.prompt:hover { background: #36402a; }
kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 23px; min-height: 23px; padding: 1px 5px; border: 1px solid #5b6351; border-bottom-width: 2px; border-radius: 4px; font: 700 11px/1.1 var(--font); color: #e1dec9; background: #30382c; white-space: nowrap; }
.prompt kbd, .dialogue-next kbd { border-color: #968259; color: #ffe6ac; }
.dialogue { position: absolute; z-index: 6; left: 3%; right: 3%; bottom: 4%; display: grid; grid-template-columns: clamp(38px, 7vw, 74px) minmax(0, 1fr) auto; align-items: center; gap: 13px; padding: clamp(8px, 1.7vw, 16px); border: 1px solid #b39b68; border-radius: 7px; background: #1d261df7; box-shadow: 0 6px 24px #10160cb2, inset 0 0 0 3px #393d2c; }
.portrait { width: 100%; aspect-ratio: 1; image-rendering: pixelated; background: #323f2e; border: 1px solid #6d664b; border-radius: 4px; }
.speech h2 { font: 700 clamp(15px, 2vw, 23px)/1.15 var(--serif); color: var(--gold); margin-bottom: 4px; }
.speech p { font-size: clamp(.82rem, 1.2vw, 1.02rem); line-height: 1.38; }
.dialogue-next { align-self: end; border: 0; padding: 3px 0 0 5px; white-space: nowrap; font-size: .78rem; color: var(--gold); }
.boss-bar { text-align: center; position: absolute; pointer-events: none; top: 12px; left: 50%; transform: translateX(-50%); width: min(42%, 240px); font: 700 .85rem/1.25 var(--serif); color: #ffe9c0; text-shadow: 0 1px 2px #111a15; }
.boss-bar div { height: 9px; border-radius: 3px; padding: 2px; background: #211e1c; border: 1px solid #b59b60; margin-top: 4px; }
.boss-bar i { display: block; height: 100%; background: #df7960; border-radius: 1px; transition: width .12s; }
.ending { position: absolute; inset: 0; z-index: 7; background: #152019c2; display: grid; place-items: center; padding: 12px; text-align: center; }
.ending-card { max-width: 385px; border: 1px solid #c5a974; border-radius: 8px; background: #212a20; padding: 16px 26px 23px; box-shadow: 0 14px 32px #10130ea0; }
.ending-card .brand-mark { margin: 0 auto 8px; }
.ending h2 { font: 700 clamp(22px, 4vw, 34px)/1.1 var(--serif); margin: 5px 0 8px; }
.ending p:not(.eyebrow) { color: #d1d4bd; font-size: .9rem; }
.primary { background: #d6af68; border: 1px solid #ebc78a; border-radius: 5px; padding: 7px 12px; color: #252215; font-weight: 750; font-size: .85rem; margin-top: 13px; }
.primary:hover { background: #f2cf90; }
.controls { display: flex; align-items: center; flex-wrap: wrap; min-height: 54px; gap: 8px 17px; padding: 9px 8px; color: var(--muted); }
.controls > span { display: inline-flex; align-items: center; gap: 3px; }
.control-label { font-weight: 650; font-size: .81rem; margin-left: 3px; }
.map-button { margin-left: auto; min-height: 32px; padding: 2px 7px 2px 9px; }
.map-button kbd { min-width: 20px; min-height: 20px; }
.map-icon { position: relative; width: 16px; height: 12px; border: 1px solid var(--gold); transform: skewY(-12deg); }
.map-icon::before, .map-icon::after { content: ""; position: absolute; inset: 0 auto 0 29%; border-left: 1px solid var(--gold); }
.map-icon::after { left: 65%; }
.touch { display: none; }
.journal { border: 1px solid var(--edge-warm); border-radius: 9px; background: linear-gradient(152deg, #273026, #202820 56%, #1d251e); box-shadow: 0 12px 32px #0d140c4d; padding: 23px 21px 20px; }
.journal-intro > p { color: #bfc2ae; font-size: .93rem; line-height: 1.58; margin-top: 9px; }
.eyebrow { font: 750 .71rem/1.3 var(--font); text-transform: uppercase; letter-spacing: .17em; color: var(--gold); display: flex; align-items: center; gap: 8px; }
.book-icon { display: inline-block; position: relative; border: 1px solid var(--gold); width: 15px; height: 12px; border-radius: 2px 2px 1px 1px; }
.book-icon::after { content: ""; position: absolute; top: 0; bottom: 0; left: 6px; border-right: 1px solid var(--gold); }
.journal h1 { font: 700 clamp(30px, 2.8vw, 42px)/1.05 var(--serif); letter-spacing: -.045em; margin-top: 10px; color: #f6ebd1; }
.objective { padding: 13px 12px 12px; border: 1px solid #716342; border-radius: 6px; background: #4a432980; margin-top: 19px; }
.objective-dot { width: 7px; height: 7px; background: var(--gold); transform: rotate(45deg); margin: 0 3px 0 1px; flex: none; }
#goal { margin-top: 6px; font-size: .95rem; font-weight: 750; line-height: 1.35; }
.hint { color: #d0cbb2; margin-top: 4px; font-size: .83rem; line-height: 1.4; }
.quest-section, .inventory { border-top: 1px solid #515543; margin-top: 19px; padding-top: 15px; }
.quest-section h2, .inventory h2 { font: 700 1.18rem/1.2 var(--serif); color: #ece4cf; }
.quest-list { list-style: none; margin-top: 9px; padding: 0; display: grid; gap: 5px; }
.quest-list li { display: flex; align-items: center; gap: 10px; min-height: 24px; color: #abad9a; font-size: .86rem; position: relative; }
.quest-list li i { display: grid; place-items: center; width: 13px; height: 13px; flex: none; border: 1px solid #777d65; background: #273025; transform: rotate(45deg) scale(.74); margin-left: 1px; }
.quest-list li.current { color: #f2d598; font-weight: 700; }
.quest-list li.current i { background: #e4b967; border-color: #f1d394; outline: 2px solid #9b7f49; outline-offset: 2px; }
.quest-list li.complete { color: #cbdbc0; }
.quest-list li.complete i { border-color: #9db286; background: #82936b; }
.items { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); list-style: none; padding: 0; gap: 9px; margin-top: 10px; }
.item { width: 100%; min-height: 55px; border: 1px solid #4e5a45; border-radius: 5px; background: #161e18; display: grid; place-items: center; }
.item.selected { border-color: #bda56a; background: #574a2a52; }
.item.missing { border-style: dashed; color: #8a917d; }
.item canvas { width: 32px; height: 32px; image-rendering: pixelated; }
.item-label { margin-top: 6px; font-size: .78rem; color: #b5b9a5; min-height: 20px; }
footer { padding: 7px 0 17px; text-align: right; color: #a1ac97; font-size: .76rem; }
footer i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #829d6c; margin: 0 4px 1px 0; }
.modal { max-width: min(495px, calc(100% - 26px)); width: 100%; max-height: 86svh; padding: 25px; color: var(--text); border: 1px solid #897751; border-radius: 10px; background: #232d23; box-shadow: 0 20px 64px #0a100ccc; }
.modal::backdrop { background: #111910bb; }
.modal h2 { font: 700 32px/1.1 var(--serif); margin: 7px 0 15px; }
.modal > p:not(.eyebrow), .reset { margin-top: 14px; font-size: .92rem; color: #d0d5c1; }
.close { position: absolute; top: 10px; right: 11px; border: 1px solid var(--edge); border-radius: 5px; width: 34px; height: 34px; color: #e8dcbc; font-size: 22px; line-height: 1; }
.close:hover { background: #414a37; }
.guide { padding: 0; list-style: none; }
.guide li { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 9px; justify-content: space-between; border-top: 1px solid #515743; padding: 7px 0; font-size: .94rem; }
.text-button { color: #e5c289; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; }
.map-canvas { border: 1px solid #847551; line-height: 0; border-radius: 5px; overflow: hidden; }
#chart { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.map-key { padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 5px 14px; margin-top: 12px; color: #c9ceba; font-size: .86rem; }
.map-key li.current { color: #f3ce8d; font-weight: 750; }
.map-key li.current::before { content: "◆ "; }
@media (max-width: 1100px) {
  .shell { width: calc(100% - 48px); }
  .game-layout { grid-template-columns: minmax(0, 1fr) 265px; gap: 14px; }
  .controls { gap: 8px 10px; padding-inline: 2px; }
  .journal { padding: 18px 16px; }
}
@media (max-width: 850px) {
  .shell { width: calc(100% - 28px); }
  .site-header { min-height: 64px; }
  .game-layout { grid-template-columns: minmax(0, 1fr); padding-top: 17px; }
  .journal { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .journal > section { margin-top: 0; }
  .objective { align-self: start; }
}
@media (max-width: 480px) {
  .shell { width: calc(100% - 18px); }
  .header-actions { gap: 5px; }
  .utility { min-height: 34px; padding: 0 7px; font-size: .72rem; gap: 4px; }
  .wordmark { font-size: 19px; gap: 7px; }
  .wordmark small { font-size: 8px; margin-top: 5px; }
  .brand-mark { width: 33px; height: 33px; }
  .brand-mark i { height: 19px; width: 10px; }
  .play-frame { padding: 3px; }
  .game-hud { inset: 6px 6px auto; }
  .vitals { padding: 4px 5px; gap: 1px; }
  .hearts canvas { width: 16px; height: 15px; }
  .coin { font-size: 11px; gap: 4px; line-height: 13px; }
  .coin-icon { width: 8px; height: 8px; }
  .location { font-size: 12px; padding: 4px 6px; gap: 6px; }
  .prompt { bottom: 6px; padding: 4px 7px; }
  .dialogue { left: 2%; right: 2%; bottom: 2%; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 7px; }
  .dialogue-next span { display: none; }
  .journal { padding: 14px 11px; gap: 10px; }
  .journal h1 { font-size: 26px; }
  .journal-intro > p, #goal { font-size: .85rem; }
  .hint, .quest-list li { font-size: .77rem; }
  .objective { padding: 9px 8px; }
  .eyebrow { letter-spacing: .1em; font-size: .67rem; }
  .item { min-height: 42px; }
  .items { gap: 4px; }
  .item canvas { width: 29px; height: 29px; }
}
@media (pointer: coarse) {
  .controls { min-height: 38px; padding-block: 4px; }
  .controls > span, .map-button kbd { display: none; }
  .touch { display: flex; align-items: center; justify-content: space-between; gap: 7px; padding: 2px 4px; }
  .touch button { touch-action: none; user-select: none; border: 1px solid #606850; border-radius: 5px; color: #f1e3be; background: #30382b; min-height: 40px; min-width: 42px; font-size: .75rem; font-weight: 700; padding: 3px 7px; }
  .touch button:active, .touch button.held { background: #5a5939; }
  .dpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
  .dpad button:first-child { grid-column: 2; }
  .dpad button:nth-child(2) { grid-column: 1; }
  .dpad button { min-height: 37px; font-size: 1.08rem; }
  .touch-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
}
@media (max-width: 345px) {
  .journal { grid-template-columns: 1fr; }
  .touch button { min-width: 35px; padding-inline: 3px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; }
}

.portrait { image-rendering: auto; background: #344337; }
.dialogue {
  grid-template-columns: clamp(46px, 8vw, 94px) minmax(0, 1fr) auto;
  background: linear-gradient(100deg, #283528fc, #1c251dfc);
}
.dialogue .speech { padding: 3px 0; }
.dialogue-next { min-height: 30px; }
.ending-card .eyebrow { justify-content: center; }
.ending-card { max-width: 430px; }
.supplies { display: flex; align-items: center; gap: 10px; margin-top: 2px; font-size: .75rem; color: #e4e9c8; }
.supplies > span { display: flex; align-items: center; gap: 4px; }
.supplies > span > span { color: var(--gold); font-weight: 700; }
#magic-hud > span { color: #9ddafa; }
.loadout { display: grid; gap: 7px; grid-template-columns: 1fr 1fr; margin-top: 9px; }
.loadout button {
  min-width: 0; min-height: 51px; padding: 5px 6px; display: grid; grid-template-columns: auto 1fr; gap: 0 4px;
  justify-items: start; align-items: center; border: 1px solid #69674a; border-radius: 5px;
  background: #19231b; color: #e9dfc4; text-align: left; font-size: .76rem; line-height: 1.15; font-weight: 650;
}
.loadout button:hover, .gear-option:hover { border-color: var(--gold); background: #39412e; }
.loadout button.empty { color: #aab09c; border-style: dashed; }
.loadout button kbd { grid-row: 1 / span 2; }
.loadout button canvas { width: 24px; height: 24px; }
.loadout button span { grid-column: 2; }
.quest-items-label { font: 650 .78rem/1.3 var(--font); color: #c2c4ad; margin: 10px 0 0; }
.inventory .items { margin-top: 5px; }
.inventory .item { min-height: 42px; }
.inventory .item canvas { width: 27px; height: 27px; }
.gear-list { display: grid; gap: 6px; }
.gear-option {
  display: grid; grid-template-columns: 42px minmax(0, 1fr); width: 100%; align-items: center; text-align: left;
  border: 1px solid #52634e; border-radius: 5px; padding: 8px 9px; background: #1a241c;
}
.gear-option:disabled { color: #969d8f; border-style: dashed; opacity: .84; }
.gear-option canvas { width: 34px; height: 34px; }
.gear-option span { display: block; }
.gear-option small { display: block; color: #c3c7b4; font-size: .8rem; line-height: 1.25; margin-top: 3px; }
.gear-option .equipped { color: #e9bd76; font-size: .77rem; margin-left: 6px; font-weight: 650; }
@media (max-width: 1100px) {
  .game-layout { grid-template-columns: minmax(0, 1fr) 248px; }
  .journal { padding: 16px 13px; }
  .journal-intro > p { line-height: 1.42; }
  .quest-list { gap: 2px; }
}
@media (max-width: 850px) {
  .game-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 480px) {
  .dialogue { grid-template-columns: 39px minmax(0, 1fr) auto; }
  .journal { padding: 12px 10px; }
  .supplies { gap: 5px; font-size: .66rem; }
  .loadout button { padding: 4px; font-size: .69rem; }
  .loadout button kbd { min-width: 18px; min-height: 20px; }
  .ending-card { padding: 10px 14px 13px; }
  .ending-card .brand-mark { display: none; }
  .ending-card p:not(.eyebrow) { font-size: .79rem; }
}
