:root {
  color-scheme: dark;
  --paper: #ece3cc;
  --muted: #aaa795;
  --dim: #868c7b;
  --line: #303c33;
  --gold: #dfbd76;
  --amber: #f1cc82;
  --panel: #161d19;
  font-family: "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  color: var(--paper);
  background: #101512;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 300px; background: radial-gradient(ellipse at 47% 0, #253028, #101512 62%); }
button { font: inherit; color: var(--paper); cursor: pointer; }
button:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
button:disabled { cursor: default; opacity: .46; }
[hidden] { display: none !important; }
.game { max-width: 1232px; padding: 22px 24px 15px; margin: auto; }
.masthead, .brand, .top-tools, .workspace, .view-top, .control-strip, .strip-label,
.controls, .section-heading, .legend, footer { display: flex; align-items: center; }
.masthead { justify-content: space-between; padding: 0 0 17px; gap: 12px; }
.brand { gap: 13px; }
.sigil { color: var(--gold); width: 43px; height: 43px; display: grid; place-items: center; border: 1px solid #7e6942; background: #25251b; font: 31px Georgia, serif; }
.eyebrow, .chapter, footer, kbd { letter-spacing: .1em; }
.eyebrow { margin: 0 0 5px; font: 700 10px/1.4 system-ui, sans-serif; letter-spacing: .15em; color: var(--gold); }
h1, h2, p { margin: 0; }
h1, .journal h2, .overlay h2 { font-family: "Songti SC", "SimSun", serif; }
h1 { font-size: 32px; letter-spacing: .12em; line-height: 1.03; }
.top-tools { gap: 9px; }
.chapter { color: var(--muted); font-size: 12px; margin-right: 9px; }
.chapter span { color: #82704b; margin: 0 3px; }
.quiet, .controls button, .overlay-options button { border: 1px solid var(--line); background: #202921; padding: 7px 12px; font-size: 12px; border-radius: 3px; }
button:not(:disabled):hover { background: #343a28; border-color: #86764e; }
.quiet[aria-pressed="true"] { color: var(--gold); }
.workspace { align-items: start; display: grid; grid-template-columns: minmax(0, 1fr) minmax(215px, 265px); gap: 14px; }
.main-column, .sidebar { min-width: 0; }
.viewport { position: relative; display: grid; isolation: isolate; overflow: hidden; border: 1px solid #526052; background: #080c0a; }
.viewport > * { grid-area: 1 / 1; }
#view { width: 100%; height: auto; display: block; image-rendering: pixelated; }
.view-top { align-self: start; justify-content: space-between; margin: 13px; z-index: 1; pointer-events: none; }
.view-top span, .prompt, .encounter { font-size: 12px; color: #f6e5bf; background: #101510e8; border: 1px solid #5a5741; padding: 6px 10px; letter-spacing: .08em; }
.prompt { align-self: end; justify-self: center; z-index: 1; text-align: center; margin: 0 10px 13px; pointer-events: none; }
.prompt:empty { display: none; }
.encounter { z-index: 1; justify-self: center; align-self: start; margin-top: 48px; width: min(215px, 65%); display: grid; grid-template-columns: auto 1fr; gap: 5px 8px; }
#enemy-life { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
#enemy-armor { grid-column: 1 / -1; color: #c7cebc; font-size: 10px; }
.prompt[data-intent="heavy"] { border-color: #c86f52; color: #ffe0be; }
.prompt[data-intent="charge"] { border-color: #a79058; }
.prompt[data-intent="staggered"] { border-color: #81956c; color: #dce8b7; }
.enemy-meter { height: 4px; background: #40312b; grid-column: 1 / -1; }
.enemy-meter i { display: block; height: 100%; background: #c7664f; transition: width .16s; }
.control-strip { justify-content: space-between; gap: 8px; min-height: 53px; border: 1px solid var(--line); border-top: none; padding: 8px 10px; background: var(--panel); flex-wrap: wrap; }
.strip-label { align-items: baseline; gap: 8px; font-size: 12px; }
.strip-label strong { color: var(--gold); white-space: nowrap; }
.strip-label span { color: var(--muted); }
.controls { gap: 5px; flex-wrap: wrap; }
.controls button { min-width: 34px; min-height: 34px; padding: 4px 9px; }
.touch-label, .controls .touch-control { display: none; }
.controls .emphasis, .overlay-options button:first-child { background: #3a3221; border-color: #7c6943; color: #ffdda0; }
kbd { font: 10px system-ui, sans-serif; margin-left: 3px; color: #c4ae7d; }
.player-section { margin-top: 13px; }
.field-guide { display: flex; align-items: baseline; gap: 8px; border: 1px solid var(--line); border-top: 0; padding: 7px 10px; background: #24271b; color: #d1c7a8; font-size: 11px; line-height: 1.6; }
.field-guide strong { color: var(--gold); flex-shrink: 0; }
.section-heading { justify-content: space-between; gap: 8px; }
.section-heading h2 { color: var(--paper); font-size: 13px; letter-spacing: .08em; }
.section-heading span { color: var(--muted); font-size: 11px; }
.player-card { margin-top: 8px; display: grid; align-items: center; grid-template-columns: auto minmax(0, 1fr); gap: clamp(12px, 3vw, 32px); padding: 8px 12px; background: var(--panel); border: 1px solid var(--line); }
.player-card.active { background: #29281c; border-color: var(--gold); }
.player-card.fallen { opacity: .48; }
.player-identity { display: flex; align-items: center; gap: 9px; white-space: nowrap; }
.portrait { width: 36px; height: 47px; image-rendering: pixelated; background: #272c22; }
.player-name { font-size: 14px; font-weight: 700; }
.player-role { color: var(--muted); font-size: 11px; }
.player-stats { display: grid; gap: 8px; }
.stat { display: grid; grid-template-columns: auto minmax(0, 1fr) 38px; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.stat-value { text-align: right; font-variant-numeric: tabular-nums; }
.stat i { display: block; background: #33392e; height: 4px; }
.stat b { display: block; height: 100%; background: #9a6452; }
.stat.focus b { background: #77989c; }
.sidebar { display: grid; gap: 10px; }
.panel { background: var(--panel); border: 1px solid var(--line); padding: 12px; min-width: 0; }
.journal { border-top: 1px solid #8e7442; background: linear-gradient(110deg, #28271b, var(--panel)); }
.journal .eyebrow span { color: #a2936b; }
.journal h2 { font-size: 22px; line-height: 1.3; margin: 4px 0; }
#goal-detail, .sidequest p { color: var(--muted); font-size: 12px; line-height: 1.55; }
.sidequest { margin-top: 9px; border-top: 1px solid var(--line); padding-top: 8px; }
.sidequest h3 { margin: 0 0 3px; color: var(--gold); font-size: 12px; }
#map { display: block; width: 100%; max-width: 235px; margin: 8px auto 4px; image-rendering: pixelated; background: #111713; }
.legend { justify-content: space-between; gap: 5px; font-size: 10px; color: var(--muted); }
.legend span:nth-child(1) { color: #ffe0a0; }
.legend span:nth-child(2) { color: #bfb28b; }
.log-panel ol { list-style: none; margin: 8px 0 0; padding: 0; min-height: 110px; max-height: 153px; overflow: auto; scrollbar-color: #5a5741 #161d19; }
.log-panel li { color: var(--muted); font-size: 12px; line-height: 1.45; padding: 5px 0 5px 10px; border-bottom: 1px solid #29322b; position: relative; }
.log-panel li::before { content: ""; width: 3px; height: 3px; background: #7a826c; position: absolute; left: 1px; top: 12px; }
.log-panel li:first-child { color: var(--paper); }
.log-panel li.event { color: var(--gold); }
footer { justify-content: space-between; color: var(--dim); font-size: 10px; margin-top: 13px; }
footer b { color: #8b7549; }
.overlay { display: grid; place-items: center; padding: 14px; z-index: 3; background: #0a100bcd; overflow: auto; }
.overlay-card { background: #20271f; border: 1px solid #9a8251; padding: clamp(11px, 3vw, 27px); width: min(100%, 430px); box-shadow: 0 10px 30px #080b09b8; }
.overlay h2 { font-size: clamp(19px, 4vw, 33px); margin: 4px 0 7px; color: #f4dfb0; }
#overlay-copy { line-height: 1.6; font-size: 13px; color: #d1c9b4; white-space: pre-line; }
.overlay-options { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
@media (max-width: 860px) {
  .game { padding: 15px 13px; }
  .workspace { grid-template-columns: minmax(0, 1fr) minmax(175px, 28%); gap: 8px; }
}
@media (max-width: 630px) {
  .workspace { display: block; }
  .sidebar { margin-top: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .journal { grid-column: 1 / -1; }
  .chapter, footer > span:last-child { display: none; }
  .masthead { padding-bottom: 12px; }
  .view-top { margin: 6px; }
  .encounter { margin-top: 35px; }
  .prompt { margin-bottom: 6px; }
  .viewport:has(.overlay:not([hidden])) { min-height: 235px; }
}
@media (max-width: 670px), (pointer: coarse) {
  .quiet, .overlay-options button { min-height: 44px; }
  .control-strip .strip-label { width: 100%; }
  .control-strip .controls { width: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .control-strip .controls button { min-width: 0; min-height: 44px; height: 100%; padding: 4px; touch-action: manipulation; }
  #explore-actions { grid-template-areas: "left forward right interact" "strafe-left back strafe-right interact"; }
  #explore-actions [data-action="left"] { grid-area: left; }
  #explore-actions [data-action="right"] { grid-area: right; }
  #explore-actions [data-action="forward"] { grid-area: forward; }
  #explore-actions [data-action="back"] { grid-area: back; }
  #explore-actions [data-action="strafeLeft"] { grid-area: strafe-left; }
  #explore-actions [data-action="strafeRight"] { grid-area: strafe-right; }
  #explore-actions [data-action="interact"] { grid-area: interact; }
  .controls .touch-control { display: block; }
  .touch-label { display: block; font-size: 10px; color: var(--muted); }
  .control-strip kbd { display: none; }
}
@media (max-width: 380px) {
  .masthead, .brand, .top-tools { gap: 6px; }
  .sigil { flex: none; width: 34px; height: 36px; font-size: 24px; }
  .brand .eyebrow { font-size: 8px; letter-spacing: .07em; white-space: nowrap; }
  h1 { font-size: 24px; white-space: nowrap; }
  .top-tools .quiet { min-width: 44px; padding-inline: 7px; white-space: nowrap; }
}
