:root {
  color-scheme: light;
  --bg: #f4f6f3;
  --frame: #f4f6f3;
  --panel: #f4f6f3;
  --panel2: #e9eeea;
  --line: #dce3dc;
  --line-strong: #bacdc0;
  --text: #273c35;
  --muted: #65756e;
  --faint: #78867e;
  --gold: #8c713b;
  --jade: #287d65;
  --blue: #6b8c9d;
  --red: #b4615a;
  --purple: #948698;
}
[hidden] { display: none !important; }
html, body { height: 100%; overflow: hidden; }
body { background: #e2e7e3; color: var(--text); -webkit-tap-highlight-color: transparent; }
button { touch-action: manipulation; border-radius: 6px; color: var(--text); background: #fff; }
button:hover { transform: none; background: #edf3ee; border-color: var(--line-strong); }
button:active:not(:disabled) { background: #dce9df; }
button:disabled { opacity: .53; }
button:focus-visible, textarea:focus-visible { outline: 2px solid var(--jade); outline-offset: 3px; }
button, textarea { font-size: 14px; }
svg.lucide { width: 20px; height: 20px; flex-shrink: 0; stroke-width: 1.7; }
.game-shell { height: 100dvh; min-height: 0; max-width: 520px; margin: 0 auto; padding: 0; }
.game-frame { padding: 0; border: 0; border-radius: 0; gap: 0; box-shadow: none; background: var(--bg); grid-template-rows: auto auto minmax(0, 1fr) auto auto; }
.game-header { display: flex; flex-wrap: wrap; gap: 12px; padding: calc(16px + env(safe-area-inset-top)) 20px 10px; border: 0; border-radius: 0; background: var(--bg); }
.brand { flex: 1; gap: 5px; }
.brand strong { color: var(--text); font-family: "STSong", "Songti SC", "SimSun", serif; font-size: 27px; font-weight: 700; line-height: 1.2; }
.brand small { font-size: 11px; color: var(--muted); white-space: normal; }
.hud { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; max-width: 180px; }
.badge { color: var(--muted); background: #e9eeea; border: 0; font-size: 11px; min-height: 24px; padding: 3px 7px; border-radius: 3px; white-space: normal; }
#realmBadge { background: #dfece3; color: #286a51; }
.purse-strip { display: flex; gap: 14px; align-items: center; padding: 8px 20px; border-block: 1px solid var(--line); color: var(--muted); font-size: 11px; min-height: 34px; }
.purse-strip span { display: flex; align-items: center; gap: 5px; }
.purse-strip svg { width: 14px; height: 14px; }
#cycleLabel { margin-left: auto; color: var(--gold); }
.game-board { display: block; min-height: 0; overflow: hidden; }
.game-panel { height: 100%; min-height: 0; border: 0; border-radius: 0; background: transparent; }
.panel-header { padding: 16px 20px 12px; background: transparent; border: 0; }
.panel-title { font-family: "STSong", "Songti SC", "SimSun", serif; font-size: 22px; font-weight: 700; }
.panel-body, .ledger-body, .scene-body { padding: 0 20px 22px; overscroll-behavior-y: contain; scrollbar-width: thin; scrollbar-color: #c7d4ca transparent; }
.scene-pane { grid-template-rows: minmax(0, 1fr); }
.scene-pane > .panel-header { display: none; }
.scene-body { display: flex; flex-direction: column; gap: 0; padding: 0 0 20px; }
.scene-body > * { flex-shrink: 0; }
.canvas-scene { position: relative; width: 100%; height: 190px; overflow: hidden; background: #e3e9e4; order: 0; }
#worldCanvas { display: block; width: 100%; height: 100%; touch-action: pan-y; }
.scene-caption { position: absolute; left: 20px; top: 18px; pointer-events: none; display: grid; gap: 5px; }
.scene-caption span { font-family: "STSong", "Songti SC", "SimSun", serif; font-size: 20px; color: #294139; }
.scene-caption small { color: #667d70; font-size: 11px; }
.icon-button { width: 44px; height: 44px; padding: 11px; display: grid; place-items: center; }
.scene-travel { position: absolute; top: 12px; right: 16px; border-color: #c4d1c5; background: #f4f6f3d9; }
.bars { order: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 12px 20px; gap: 14px; }
.bar-label { color: var(--muted); font-size: 10px; gap: 2px; }
.bar { height: 4px; border: 0; background: #e1e6df; }
.hp span { background: #b6766d; }
.stamina span { background: #559080; }
.karma span { background: #9a8aaa; }
.scene-card { order: 2; padding: 10px 20px 14px; border: 0; border-radius: 0; background: transparent; }
.story-title { color: var(--text); font-size: 19px; line-height: 1.4; font-family: "STSong", "Songti SC", "SimSun", serif; margin: 0 0 7px; }
.story-text { min-height: 0; color: #607168; font-size: 13px; line-height: 1.8; }
.result-box { order: 3; border: 0; border-left: 2px solid var(--jade); border-radius: 0; background: #e4eee6; color: #325d4a; font-size: 13px; padding: 10px 12px; margin: 0 20px 8px; line-height: 1.7; }
.scene-body > div:last-child { order: 4; padding: 0 20px; }
.section-label { font-size: 11px; font-weight: 500; color: var(--muted); margin: 12px 0 9px; }
.scene-body > div:last-child .section-label { margin-top: 4px; }
.action-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.action { min-height: 116px; padding: 12px; background: #fcfdfa; border: 1px solid #d6dfd4; text-align: left; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.action strong { color: #2f5141; font-size: 14px; line-height: 1.4; font-weight: 600; }
.action span { display: block; color: var(--muted); font-size: 11px; line-height: 1.6; }
.action small { color: #728064; white-space: normal; overflow: visible; text-overflow: clip; font-size: 10px; line-height: 1.5; margin-top: auto; }
.breakthrough { order: 5; margin: 18px 20px 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: transparent; padding: 16px 0 0; gap: 5px 12px; }
.breakthrough strong { color: var(--text); font-size: 14px; }
.breakthrough p { color: var(--muted); font-size: 11px; white-space: normal; overflow: visible; }
.breakthrough button { min-height: 44px; padding: 0 15px; }
.primary { background: #2c755d; color: #fff; border-color: #2c755d; }
.primary:hover { background: #245f4c; color: #fff; }
.command-bar { grid-template-columns: minmax(0, 1fr) minmax(136px, 1fr); gap: 12px; padding: 10px 20px; border-top: 1px solid var(--line); background: #f4f6f3; }
.command-bar button { min-height: 46px; font-size: 14px; }
.day-hint { display: flex; flex-direction: column; justify-content: center; gap: 3px; color: var(--muted); font-size: 11px; }
.day-hint strong { color: var(--text); font-size: 12px; font-weight: 500; }
.bottom-nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 5px 8px calc(6px + env(safe-area-inset-bottom)); background: #f9faf7; border-top: 1px solid var(--line); }
.bottom-nav button { border: 0; border-radius: 0; background: transparent; min-height: 51px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px; font-size: 10px; color: #859087; }
.bottom-nav button[aria-current="page"] { color: #267357; background: #eaf1e9; border-radius: 6px; }
.bottom-nav svg { width: 21px; height: 21px; }
.game-shell:not([data-view="scene"]) .command-bar { display: none; }
.game-shell:not([data-view="scene"]) .game-frame { grid-template-rows: auto auto minmax(0, 1fr) auto; }
.map-body { display: block; }
.route-heading { padding: 22px 0; border-bottom: 1px solid var(--line); }
.route-heading > span { font-family: "STSong", "Songti SC", "SimSun", serif; font-size: 36px; color: #375d49; }
.route-heading p { font-size: 12px; color: var(--muted); margin: 9px 0 0; }
.map-list { gap: 0; }
.location { position: relative; padding: 18px 12px 18px 28px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; min-height: 80px; background: transparent; }
.location::before { content: ""; position: absolute; left: 4px; top: 25px; width: 8px; height: 8px; transform: rotate(45deg); border: 1px solid #95aa99; background: var(--bg); }
.location.active { background: #e6eee3; border-color: var(--line); }
.location.active::before { background: #3b7859; border-color: #3b7859; }
.location strong, .task strong, .item-name { color: var(--text); font-size: 14px; font-weight: 600; }
.location span { color: var(--muted); font-size: 12px; margin-top: 5px; }
.tabs { padding: 0 20px 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.tab { min-height: 44px; background: transparent; font-size: 12px; }
.tab.active { color: #286a51; background: #dfece3; border-color: #c2d7c5; }
.task, .item, .log, .archive, .npc, .market-row { background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 14px 0; }
.task-list, .item-list, .log-list, .archive-list, .npc-list, .market-list { gap: 0; }
.task.complete { border-color: #b9cdbc; }
.task-line { align-items: flex-start; }
.task .badge { flex-shrink: 0; }
.task button, .market-actions button { min-width: 44px; min-height: 44px; margin-top: 8px; }
.task span, .item-desc, .npc span, .archive span, .log { color: var(--muted); font-size: 12px; }
.market-row { grid-template-columns: minmax(0, 1fr); }
.market-main { flex-wrap: wrap; font-size: 13px; }
.market-main strong { font-weight: 600; }
.market-actions { justify-content: flex-end; }
.market-actions button { margin-top: 0; }
.market-row .item-desc { margin-top: 5px; }
.empty { font-size: 12px; line-height: 1.8; }
.profile-heading { display: flex; align-items: center; gap: 16px; padding: 16px 0 24px; }
.seal { display: grid; place-items: center; width: 58px; height: 58px; background: #dfebe0; border: 1px solid #c1d4c0; color: #397451; font-family: "STSong", "Songti SC", "SimSun", serif; font-size: 34px; }
.profile-heading h2 { margin: 0 0 6px; font-size: 18px; font-family: "STSong", "Songti SC", "SimSun", serif; }
.profile-heading p { margin: 0; font-size: 12px; color: var(--muted); }
.status-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.chip { padding: 12px 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; gap: 6px; }
.chip span { color: var(--faint); font-size: 11px; }
.chip b { color: var(--text); font-size: 12px; line-height: 1.6; font-weight: 500; }
.save-tools { margin-top: 20px; gap: 8px; }
.save-tools .section-label { margin: 0; }
textarea { background: #fbfcf9; color: var(--text); font-size: 16px; min-height: 82px; max-height: 160px; }
.tool-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tool-row button { min-height: 46px; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 12px; }
.tool-row svg { width: 16px; height: 16px; }
.save-feedback { font-size: 12px; color: var(--jade); min-height: 18px; margin: 0; }
.cycle-tools { margin-top: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cycle-tools p { grid-column: 1 / -1; margin: 0; }
.cycle-tools button { min-height: 46px; font-size: 12px; }
.danger { color: #a75048; background: #f7eeea; border-color: #e7d3cc; }
@media (max-width: 360px) {
  .game-header { padding-inline: 16px; gap: 8px; }
  .brand strong { font-size: 24px; }
  .hud { max-width: 156px; }
  .badge { font-size: 10px; padding-inline: 5px; }
  .purse-strip { gap: 8px; padding-inline: 16px; }
  .canvas-scene { height: 160px; }
  .action { padding: 10px; }
  .action span { font-size: 11px; }
}
@media (max-height: 650px) {
  .canvas-scene { height: 110px; }
  .game-header { padding-top: calc(10px + env(safe-area-inset-top)); }
  .scene-card { padding-top: 4px; padding-bottom: 10px; }
  .story-text { font-size: 12px; line-height: 1.65; }
  .bars { padding-block: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
