:root {
  color-scheme: dark;
  --ground: #21191e;
  --surface: #2d2229;
  --edge: #50383f;
  --cream: #fff1d7;
  --muted: #d2b9a9;
  --peach: #ffb16e;
  --gold: #fadc8b;
  --mint: #a9e1bb;
  font-family: "DM Sans", "Microsoft JhengHei", "PingFang TC", system-ui, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: radial-gradient(ellipse at 75% 5%, #392229 0, transparent 44%), var(--ground);
  color: var(--cream);
  min-height: 100dvh;
}
button { font: inherit; cursor: pointer; color: inherit; }
button:focus-visible { outline: 3px solid var(--mint); outline-offset: 4px; }
.shell { width: min(1120px, calc(100% - 64px)); margin: 0 auto; }
.top {
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--edge);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 2px; background: none; border: 0; font-weight: 900; letter-spacing: .09em; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: #fbb978; }
.brand-mark i { width: 24px; height: 21px; border-radius: 60% 60% 46% 46%; border: 2px solid #3b2630; border-top: 4px solid #e35957; background: #fff3da; position: relative; }
.brand-mark i::before { content: ""; position: absolute; top: 6px; left: 5px; width: 3px; height: 4px; border-radius: 50%; background: #3b2630; box-shadow: 7px 0 #3b2630; }
.top-actions { display: flex; align-items: center; gap: 20px; }
.record { font-size: 13px; color: var(--muted); white-space: nowrap; }
.record strong { color: var(--gold); margin-left: 5px; font-variant-numeric: tabular-nums; }
.utility { border: 1px solid #725059; border-radius: 10px; padding: 8px 13px; background: #382832; color: var(--cream); font-size: 13px; font-weight: 750; white-space: nowrap; }
.utility:hover { background: #513541; }
.hero { display: grid; grid-template-columns: minmax(310px, .82fr) minmax(0, 1.18fr); gap: 32px; align-items: center; padding: 35px 0 31px; }
.hero-copy { padding: 10px 0 6px; }
.eyebrow { font-size: 13px; font-weight: 850; letter-spacing: .14em; color: var(--peach); margin: 0; }
.eyebrow span { display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: #ffad72; box-shadow: 0 0 12px #ffad7280; }
h1 { font-size: clamp(65px, 8.6vw, 122px); line-height: .99; margin: 18px 0 24px; font-weight: 1000; letter-spacing: -.078em; -webkit-text-stroke: 1px currentColor; }
h1 em { color: var(--peach); font-style: normal; }
.pitch { color: var(--muted); font-size: 16px; line-height: 1.75; font-weight: 650; margin: 0 0 25px; }
.start {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 34px;
  border: 1px solid #ffd4a4;
  border-radius: 13px;
  padding: 13px 19px;
  background: var(--peach);
  color: #301a21;
  font-size: 19px;
  font-weight: 900;
  box-shadow: 0 5px 0 #ae604c;
}
.start:hover { background: #ffca91; }
.start:active { transform: translateY(3px); box-shadow: 0 2px 0 #ae604c; }
.start:disabled, .utility:disabled { cursor: default; opacity: .58; box-shadow: none; transform: none; }
.home-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.home-actions .start { margin-right: 4px; }
.start span { font-size: 23px; line-height: 1; }
.controls { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 20px 0 0; color: var(--muted); font-size: 12px; }
kbd { font: inherit; border: 1px solid #70545a; border-radius: 5px; padding: 2px 5px; background: #30242b; color: var(--cream); }
.controls span { margin-right: 7px; }
.hero-art {
  position: relative;
  isolation: isolate;
  min-height: 440px;
  align-self: stretch;
  border: 1px solid #8b5552;
  border-radius: 24px;
  box-shadow: 0 20px 70px #140d1380, inset 0 0 0 6px #2a171838;
  overflow: hidden;
  background: #57343f url("cover.webp") center / cover;
}
.hero-art::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(transparent 68%, #291822bc); }
.art-stamp {
  position: absolute;
  top: 20px;
  right: 21px;
  transform: rotate(7deg);
  color: #3d2427;
  background: #ffdda0;
  border: 2px solid #4b2e33;
  box-shadow: 3px 4px #41272b;
  border-radius: 50%;
  width: 87px;
  height: 87px;
  display: block;
  text-align: center;
  padding-top: 13px;
  font-weight: 900;
  font-size: 14px;
  line-height: 1.1;
}
.art-stamp b { font-size: 37px; }
.art-caption { position: absolute; bottom: 16px; left: 23px; color: #fff5dc; font-weight: 800; letter-spacing: .09em; font-size: 13px; text-shadow: 0 2px 7px #211318; }
.art-caption span { color: #ffbe80; margin: 0 5px; }
.route { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding-bottom: 28px; }
.route article { display: flex; gap: 12px; align-items: center; position: relative; background: var(--surface); border: 1px solid var(--edge); border-radius: 14px; padding: 13px; }
.route-icon { width: 46px; height: 46px; display: grid; place-items: center; font: 24px "Segoe UI Emoji", sans-serif; border-radius: 10px; flex-shrink: 0; }
.fort { background: #73403e; }.park { background: #285247; }.market { background: #634057; }
.route h2 { font-size: 16px; margin: 0 0 4px; }
.route p { font-size: 12px; margin: 0; color: var(--muted); }
.route-time { color: var(--gold); font-size: 12px; font-weight: 800; margin-left: auto; align-self: start; font-variant-numeric: tabular-nums; }
.island-route { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 9px; }
.island-route article { gap: 9px; padding: 9px; }
.island-route h2 { font-size: 14px; }
.island-route p { font-size: 11px; line-height: 1.4; }
.island-route .route-icon { width: 33px; height: 34px; font-size: 18px; background: color-mix(in srgb, var(--station) 24%, #3c2638); }
.touch-help, .dash-touch { display: none; }

#play { max-width: 1000px; margin: 0 auto; }
.game-toolbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; padding: 12px 0; }
.game-toolbar strong { display: block; margin-top: 3px; font-size: 18px; }
.stage-label { display: flex; gap: 9px; align-items: center; }
.stage-icon { width: 38px; height: 38px; flex-shrink: 0; display: grid; place-items: center; border-radius: 10px; border: 1px solid #fff2da33; background: color-mix(in srgb, var(--stage-accent, #ffb16e) 26%, #39222e); font-size: 21px; }
.game-toolbar .eyebrow { color: var(--stage-accent, var(--peach)); }
.game-toolbar .utility { justify-self: end; }
.timer { font-size: 33px; line-height: 1; font-weight: 900; font-variant-numeric: tabular-nums; }
.timer small { font-size: 13px; color: var(--muted); }
.arena { width: 100%; height: clamp(365px, 57vw, 562px); position: relative; border: 1px solid color-mix(in srgb, var(--stage-accent, #ffb16e) 55%, #29202c); border-radius: 18px; overflow: hidden; isolation: isolate; background: #3f2c35; box-shadow: 0 13px 54px #110b14aa; }
#field { display: block; width: 100%; height: 100%; touch-action: none; }
.hud { position: absolute; inset: 13px 14px auto; display: flex; justify-content: space-between; gap: 8px; pointer-events: none; }
.meters, .scoreboard, .boss-hud { background: #231923ed; border: 1px solid #a1757699; border-radius: 11px; padding: 7px 10px; }
.meters { width: clamp(136px, 28%, 235px); }
.meter-label { display: flex; justify-content: space-between; gap: 5px; font-size: 12px; font-weight: 800; margin-bottom: 4px; }
.meter { height: 8px; background: #513943; overflow: hidden; border-radius: 10px; }
.meter > div { background: #f58384; width: 100%; height: 100%; border-radius: inherit; }
.meter.xp { height: 4px; margin-top: 5px; }
.meter.xp > div { background: #a6ebc1; width: 0; }
.scoreboard { display: flex; align-items: center; align-self: start; gap: 12px; font-size: 12px; color: #f5d5c5; white-space: nowrap; }
.scoreboard b { color: var(--gold); font-size: 14px; }
.scoreboard:has(.coin-balance:not([hidden])) { display: grid; grid-template-columns: auto auto; gap: 2px 10px; }
.coin-balance { grid-column: 1 / -1; color: #ffe6a3; text-align: right; }
.coin-balance::before, .camp-wallet strong::before { content: ""; display: inline-block; vertical-align: -.08em; width: .64em; height: .64em; margin-right: .38em; border: 2px solid #ffd271; border-radius: 50%; background: #a86733; }
.camp-wallet { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin: 10px 0 13px; font-size: 13px; color: var(--muted); }
.camp-wallet strong { color: #ffdc91; }
.boss-hud { position: absolute; top: 74px; left: 50%; width: min(270px, 64%); transform: translateX(-50%); text-align: center; font-size: 12px; font-weight: 900; pointer-events: none; }
.boss-hud .meter { margin-top: 4px; height: 5px; }
.boss-hud .meter > div { background: #ffaa70; }
.boss-status { display: block; margin-top: 4px; color: var(--stage-accent, #ffd695); font-size: 11px; }
.boss-status.open { color: #bdf8bf; }
:is(.dialogue, .monster-talk) {
  --talk-border: #ffe4a2ad;
  position: absolute;
  width: max-content;
  max-width: min(265px, 67%);
  padding: 8px 11px;
  border: 1px solid var(--talk-border);
  border-radius: 11px;
  background: #2a1e2cf5;
  color: #fff1da;
  box-shadow: 0 4px 13px #21192483;
  line-height: 1.4;
  pointer-events: none;
  overflow-wrap: anywhere;
}
.dialogue { --talk-border: var(--stage-accent, #ffe4a2); max-width: min(320px, 70%); font-size: 18px; font-weight: 650; }
.dialogue b { display: block; color: var(--stage-accent, #ffe4a2); font-size: 13px; margin-bottom: 2px; }
.monster-talk { font-size: 16px; }
:is(.dialogue, .monster-talk)::after { content: ""; position: absolute; width: 8px; height: 8px; background: #2a1e2c; transform: rotate(45deg); border: solid var(--talk-border); }
:is(.dialogue, .monster-talk)[data-side="above"]::after { left: calc(var(--tail-x) - 5px); bottom: -5px; border-width: 0 1px 1px 0; }
:is(.dialogue, .monster-talk)[data-side="below"]::after { left: calc(var(--tail-x) - 5px); top: -5px; border-width: 1px 0 0 1px; }
:is(.dialogue, .monster-talk)[data-side="left"]::after { top: calc(var(--tail-y) - 5px); right: -5px; border-width: 1px 1px 0 0; }
:is(.dialogue, .monster-talk)[data-side="right"]::after { top: calc(var(--tail-y) - 5px); left: -5px; border-width: 0 0 1px 1px; }
.arena:has(.overlay:not([hidden])) :is(.dialogue, .monster-talk) { visibility: hidden; }
.panel .culture-note { margin: 0 0 12px; font-size: 12px; }
.culture-note a { color: #b9eac7; text-underline-offset: 2px; margin-left: 7px; }
.choosing .game-toolbar, .choosing .game-footer, .choosing .hud, .choosing #field { visibility: hidden; }
.choosing .arena { background: #452c3a url("cover.webp") center 43% / cover; }
.choosing .dash-indicator, .choosing .dash-touch, .choosing #message, .choosing #boss-hud, .choosing .dialogue { display: none; }
.camp-actions { margin-top: 13px; }
.camp-stamps { display: flex; flex-wrap: wrap; gap: 5px; margin: 13px 0; }
.camp-stamps span { display: grid; place-items: center; width: 26px; height: 26px; border: 1px solid #654854; border-radius: 7px; color: #ad8690; }
.camp-stamps .earned { color: #492833; background: #f8cf8c; border-color: #ffe1a4; }
.choice:disabled { cursor: default; opacity: .68; }
.choice.picked { border-color: var(--mint); opacity: 1; background: #355147; }
.panel .boss-quote { color: var(--gold); font-size: 17px; }
#camp-status { font-size: 12px; margin: 9px 0 0; }
.message { position: absolute; top: 28%; left: 50%; transform: translateX(-50%); pointer-events: none; white-space: nowrap; color: var(--gold); font-size: clamp(15px, 3vw, 27px); text-shadow: 0 2px 8px #200d17; font-weight: 950; }
.message:empty { display: none; }
.message.topline { padding: .32em .85em; border-radius: 9px; border: 1px solid #f9d69084; color: #fff0c3; background: #32212ef0; box-shadow: 0 5px 20px #24162370; animation: stamp-in .24s ease-out; }
.message.boss { top: 22%; font-size: clamp(22px, 4.5vw, 42px); color: #2b1928; background: #ffbe7a; border: 2px solid #fff0be; box-shadow: 0 0 28px #ffad7880, 4px 5px #622c42; text-shadow: none; letter-spacing: .03em; }
.message.chain { left: auto; right: 16px; top: 60px; transform: rotate(-5deg); font-size: clamp(14px, 2vw, 22px); color: #ffdf93; -webkit-text-stroke: .3px #ffdf93; }
@keyframes stamp-in { from { opacity: 0; transform: translateX(-50%) scale(.88); } to { opacity: 1; transform: translateX(-50%) scale(1); } }
@media (prefers-reduced-motion: reduce) { .message.topline { animation: none; } }
.dash-indicator, .dash-touch { position: absolute; right: 13px; bottom: 13px; border: 1px solid #a1757699; border-radius: 9px; padding: 6px 10px; background: #231923e8; color: var(--mint); font-size: 12px; font-weight: 800; }
.dash-indicator { pointer-events: none; }
.game-footer { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 10px 15px; padding: 12px 0 18px; font-size: 13px; }
#loadout { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { background: #382a34; border: 1px solid #654854; border-radius: 7px; padding: 4px 8px; }
.recipe { color: var(--muted); font-size: 12px; }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 8px; background: #21141ab8; overflow: auto; }
.panel { width: min(710px, 100%); max-height: 100%; overflow: auto; padding: 23px; border: 1px solid #9d675c; border-radius: 18px; background: #31232c; box-shadow: 0 12px 50px #170c16bb; }
.panel h2 { font-size: clamp(23px, 4.5vw, 35px); margin: 0 0 9px; }
.panel p { color: var(--muted); margin: 0 0 16px; line-height: 1.5; }
.choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.choice { display: grid; gap: 6px; justify-items: start; text-align: left; border: 1px solid #845c66; border-radius: 12px; padding: 12px; background: #442f3a; min-height: 131px; }
.choice:hover, .choice:focus-visible { background: #5b3a44; border-color: var(--peach); }
.item-icon { display: inline-grid; place-items: center; min-width: 1em; height: 1em; vertical-align: -.1em; font-family: "Segoe UI Emoji", sans-serif; }
.choice .item-icon { font-size: 23px; }
.item-icon.tea, .item-icon.shoes { position: relative; }
.item-icon.tea::before { content: ""; width: .54em; height: .66em; border-radius: .08em .08em .18em .18em; border: .06em solid #53333d; background: radial-gradient(circle at 25% 78%, #653c42 .06em, transparent .07em), radial-gradient(circle at 66% 61%, #653c42 .07em, transparent .08em), radial-gradient(circle at 60% 88%, #653c42 .06em, transparent .07em), #e9b17c; margin-top: .18em; }
.item-icon.tea::after { content: ""; position: absolute; top: -.01em; left: .53em; width: .11em; height: .32em; background: #f399a2; transform: rotate(15deg); border-radius: .05em; }
.item-icon.shoes::before { content: ""; width: .46em; height: .86em; border-radius: 48%; background: linear-gradient(145deg, #88c8ef 34%, #fff2dd 35% 48%, #3996ca 49%); border: .05em solid #272743; transform: rotate(26deg); }
.choice small { color: var(--muted); }
.choice i { color: var(--gold); font-style: normal; font-size: 12px; }
.panel-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 5px; }
.result-stats { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0 0 18px; }
.result-stats div { display: grid; gap: 4px; min-width: 80px; }
.result-stats dt { color: var(--muted); font-size: 12px; }
.result-stats dd { font-size: 22px; color: var(--gold); font-weight: 900; margin: 0; }

@media (max-width: 800px) {
  .shell { width: calc(100% - 32px); }
  .hero { gap: 20px; grid-template-columns: minmax(240px, .8fr) minmax(0, 1fr); }
  .hero-art { min-height: 348px; }
  .route article { gap: 8px; padding: 9px; }
  .route-icon { width: 34px; height: 38px; font-size: 20px; }
  .island-route { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 590px) {
  .shell { width: calc(100% - 22px); }
  .top { min-height: 58px; }
  .top-actions { gap: 8px; }
  .top-actions .utility { font-size: 12px; padding-inline: 6px; }
  .top .record { font-size: 11px; }
  .monster-talk { font-size: 15px; }
  .brand { gap: 7px; font-size: 14px; }
  .brand-mark { width: 30px; height: 30px; }
  .utility { padding: 7px 8px; }
  .hero { grid-template-columns: 1fr; gap: 17px; padding: 18px 0 14px; }
  .hero-copy { padding: 0 4px; }
  h1 { font-size: clamp(51px, 13vw, 71px); margin: 9px 0 12px; letter-spacing: -.065em; }
  h1 br, .wide { display: none; }
  .pitch { font-size: 14px; margin-bottom: 13px; }
  .pitch br:first-child { display: none; }
  .start { padding: 9px 14px; font-size: 17px; }
  .hero-art { min-height: 0; aspect-ratio: 1.5; border-radius: 16px; }
  .art-stamp { width: 66px; height: 66px; top: 12px; right: 12px; padding-top: 10px; font-size: 11px; }
  .art-stamp b { font-size: 26px; }
  .route { grid-template-columns: 1fr; gap: 6px; }
  .island-route { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .island-route article { padding: 7px 5px; gap: 5px; }
  .route h2 { font-size: 14px; }
  .route article { padding: 7px 9px; }
  .hud { inset: 8px 8px auto; }
  .arena { height: clamp(350px, 66dvh, 630px); border-radius: 12px; }
  .timer { font-size: 26px; }
  .timer small { display: block; text-align: center; font-size: 10px; }
  .dialogue { font-size: 16px; }
  .stage-icon { width: 26px; height: 29px; border-radius: 7px; font-size: 15px; }
  .stage-label { gap: 5px; }
  .game-toolbar strong { font-size: 15px; }
  .panel { padding: 12px; }
  .choices { grid-template-columns: 1fr; gap: 6px; }
  .choice { min-height: 0; grid-template-columns: auto 1fr auto; align-items: center; gap: 3px 7px; padding: 6px 8px; }
  .choice small { grid-column: 2 / -1; }
}
@media (pointer: coarse) {
  .controls, .dash-indicator { display: none; }
  .touch-help { display: block; margin: 13px 0 0; color: var(--muted); font-size: 12px; }
  .dash-touch { display: block; width: 68px; height: 50px; touch-action: manipulation; }
  .dash-touch:disabled { color: var(--muted); cursor: default; }
}
