:root {
  color-scheme: dark;
  --bg:#0b1411; --panel:#15221b; --edge:#2a3b30; --ink:#f4f8ec;
  --muted:#a6b5a8; --lime:#d4f87c; --soft:#a7d376;
  font-family: "DM Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
}
*, *::before, *::after { box-sizing:border-box; }
[hidden] { display:none !important; }
body { margin:0; color:var(--ink); background:radial-gradient(ellipse at 50% 0,#21392a 0,transparent 760px),var(--bg); min-height:100vh; }
button, input { font:inherit; }
button { cursor:pointer; color:inherit; }
button:disabled { cursor:default; opacity:.5; }
button:focus-visible, a:focus-visible, input:focus-visible { outline:2px solid var(--lime); outline-offset:3px; }
a { color:inherit; text-decoration:none; }
.top { border-bottom:1px solid #35483a; background:#0e1914dd; }
.top-inner, .shell, .footer { max-width:1320px; margin:auto; padding-inline:clamp(16px,4vw,52px); }
.top-inner { display:flex; align-items:center; justify-content:space-between; height:70px; gap:10px; }
.brand { display:flex; align-items:center; gap:13px; font-weight:750; letter-spacing:.02em; }
.brand b { color:var(--lime); }
.brand small { display:block; font:700 9px/1.4 "DM Sans",sans-serif; color:#a0ae9d; letter-spacing:.17em; margin-top:4px; }
.sigil { font:bold italic 22px/1 sans-serif; color:#233015; display:grid; place-content:center; grid-auto-flow:column; letter-spacing:-.18em; padding-right:4px; width:40px; height:40px; border-radius:13px 6px; background:var(--lime); }
.sigil span { opacity:.62; }
.header-actions, .save-actions { display:flex; align-items:center; gap:9px; flex-wrap:wrap; }
.button, .primary { padding:9px 14px; border:1px solid #425847; border-radius:9px; background:#18271e; font-weight:700; }
.button:hover:enabled { border-color:var(--soft); background:#253a2c; }
.primary { background:var(--lime); color:#17230c; border-color:var(--lime); }
.primary:hover:enabled { background:#e7ffa1; }
.heading { display:flex; align-items:end; justify-content:space-between; gap:12px; padding:30px 0 22px; }
.eyebrow { margin:0 0 6px; color:var(--soft); font-size:10px; font-weight:800; letter-spacing:.17em; display:flex; align-items:center; gap:9px; }
.eyebrow span,.map-tag span { width:7px; height:7px; background:var(--lime); border-radius:50%; box-shadow:0 0 10px #bcf96c70; }
.eyebrow i { width:15px; height:1px; background:#789171; }
h1 { font-size:clamp(32px,4.1vw,62px); line-height:1.08; margin:0; letter-spacing:-.06em; font-weight:850; }
.subheading { margin:8px 0 0; color:#b4c5b5; font-size:13px; }
.location { display:flex; gap:10px; align-items:center; min-width:max-content; padding:9px 14px; border:1px solid var(--edge); background:#142119a0; border-radius:10px; }
.location b { color:var(--lime); font-size:24px; line-height:1; }
.location small,.location strong { display:block; font-size:11px; }
.location small { color:var(--muted); }
.location strong { margin-top:3px; font-size:13px; }
.layout { display:grid; grid-template-columns:minmax(0,1fr) 270px; gap:18px; align-items:start; }
.play-column { min-width:0; }
.stage { position:relative; isolation:isolate; overflow:hidden; aspect-ratio:12/7; background:#314635; border:1px solid #556b50; border-radius:16px 16px 0 0; }
#world { display:block; width:100%; height:100%; }
.stage-header { position:absolute; inset:14px 14px auto; display:flex; justify-content:space-between; z-index:1; pointer-events:none; }
.map-tag,.stage-day { display:flex; align-items:center; gap:8px; padding:7px 9px; border:1px solid #a6c49e57; border-radius:6px; background:#0d1d14de; color:#eff6e9; font:700 10px/1.2 "DM Sans",sans-serif; letter-spacing:.12em; }
.map-tag span { width:5px;height:5px; }
.stage-day { color:#e6edac; }
.intro { position:absolute; inset:0; display:grid; place-items:center; background:linear-gradient(180deg,#101e1542,#0c1712e8 86%); z-index:2; }
.intro-content { text-align:center; width:min(100%,560px); padding:9px 16px; }
.intro h2 { font-size:clamp(18px,3vw,38px); letter-spacing:-.045em; margin:0; text-shadow:0 3px 18px #101d14; }
.intro p { margin:5px 0 14px; color:#e1ebdc; font-size:12px; text-shadow:0 2px 8px #0b180e; }
.starters { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:9px; }
.starter { background:radial-gradient(ellipse at 50% 38%,var(--wash),#192b20 77%); border:1px solid #64826e; border-radius:12px; min-width:0; padding:5px 3px 8px; display:flex; flex-direction:column; align-items:center; gap:2px; box-shadow:0 5px 15px #0005; }
.starter:hover,.starter[aria-pressed=true] { border-color:var(--lime); }
.starter[aria-pressed=true] { outline:1px solid var(--lime); background:radial-gradient(ellipse at 50% 35%,var(--wash),#304729 86%); }
.starter img { width:92%; height:clamp(42px,7.8vw,110px); object-fit:contain; filter:drop-shadow(0 5px 4px #10180c88); }
.starter strong { font-size:14px; }
.starter small { color:#d2e2cd; font-size:10px; }
#start-button { margin-top:13px; padding:9px 18px; }
#start-button span { margin-left:7px; }
.interaction { position:absolute; z-index:3; bottom:18px; left:50%; transform:translateX(-50%); width:max-content; max-width:95%; }
.interaction .primary { box-shadow:0 5px 22px #0b140dbb; }
.controls { background:#142119; border:1px solid var(--edge); border-top:0; border-radius:0 0 12px 12px; min-height:51px; padding:8px 11px; }
.explore-controls,.battle-controls { display:flex; gap:13px; flex-wrap:wrap; align-items:center; min-height:32px; }
.keyboard-hint { display:inline-flex; align-items:center; gap:4px; color:#becebe; white-space:nowrap; font-size:11px; }
.keyboard-hint span { margin-left:3px; }
kbd { display:inline-grid; place-items:center; min-width:17px; height:19px; padding-inline:4px; border:1px solid #506452; border-radius:4px; background:#233528; color:#f0f5e9; font:700 10px/1 monospace; }
.hint-end { margin-left:auto; color:#aebcac; font-size:11px; }
.touch-controls { display:none; gap:5px; }
.touch-controls button,.battle-controls button { touch-action:none; border:1px solid #405848; border-radius:7px; background:#203225; font-size:12px; min-height:32px; padding:4px 8px; }
.touch-controls button { min-width:40px; font-size:17px; }
.battle-controls { gap:6px; }
.battle-controls button:not(:disabled):hover { border-color:var(--lime); }
.battle-controls .move:not(:disabled) { color:var(--lime); }
.notice { margin:8px 0 0; min-height:20px; color:#bbcdbc; font-size:12px; }
.sidebar { display:grid; gap:12px; }
.panel { background:#142119; border:1px solid var(--edge); border-radius:12px; padding:14px; }
.panel-heading { display:flex; justify-content:space-between; align-items:center; gap:5px; margin-bottom:12px; }
.panel h2 { font-size:14px; margin:0; }
.panel-heading span { color:#a6b8a9; font-size:10px; }
.empty { margin:0; padding:15px 9px; color:var(--muted); border:1px dashed #3e5543; border-radius:8px; font-size:11px; text-align:center; }
.team { display:grid; gap:5px; }
.team button { display:grid; grid-template-columns:37px minmax(0,1fr) auto; gap:7px; align-items:center; text-align:left; padding:4px 7px; border:1px solid #354d3a; border-radius:8px; background:#1e3124; width:100%; }
.team button[aria-pressed=true] { border-color:#9bbc75; background:#304629; }
.team img { width:33px; height:34px; object-fit:contain; }
.team b { display:block; font-size:12px; margin-bottom:4px; }
.team span { font-size:10px; color:#d0d9c7; }
.meter { height:5px; overflow:hidden; border-radius:9px; background:#304337; }
.meter > div { height:100%; background:var(--lime); width:0; transition:width .18s ease; }
.rank-line { display:flex; align-items:center; gap:11px; margin-bottom:11px; }
.rank-line > strong { display:grid; place-items:center; width:43px; height:43px; border:1px solid #79a159; border-radius:10px 5px; color:var(--lime); background:#2d4327; font:bold italic 28px/1 sans-serif; }
.rank-line div > * { display:block; }
.rank-line small,.rank-panel p { color:var(--muted); font-size:11px; }
.rank-line b { font-size:14px; margin-top:3px; }
.rank-panel p { margin:9px 0 0; }
.inventory > div:not(.panel-heading) { display:flex; gap:9px; align-items:center; }
.inventory p { display:flex; justify-content:space-between; width:100%; margin:0; font-size:12px; }
.ball-icon { width:18px; height:18px; border:2px solid #e8eee5; border-radius:50%; background:linear-gradient(#e8886d 0 43%,#142119 43% 58%,#e8eee5 58%); flex:none; }
.dex-link { width:100%; display:flex; justify-content:space-between; margin-top:10px; padding:9px 0 0; border:0; border-top:1px solid #334538; background:none; font-size:11px; color:#c6e69c; }
.battle { position:absolute; inset:0; z-index:2; background:radial-gradient(ellipse at 52% 50%,#1c23103b,#111b14d9 100%); pointer-events:none; }
.duel { position:absolute; inset:14% 8% 14%; display:flex; justify-content:space-between; align-items:stretch; gap:8%; }
.combatant { width:min(45%,300px); display:flex; flex-direction:column; gap:4px; }
.combatant img { width:100%; height:calc(100% - 47px); object-fit:contain; padding:8px; filter:drop-shadow(0 12px 10px #000a); }
.hp-label { display:flex; justify-content:space-between; align-items:center; color:#fff; gap:3px; text-shadow:0 2px 6px #000; }
.hp-label span,.hp-number { font-size:11px; }
.hp-number { color:#ecf0e0; }
.foe .meter>div { background:#ffb482; }
.foe .meter.weakened>div { background:#ffd375; }
.battle-message { position:absolute; bottom:6%; left:50%; transform:translateX(-50%); color:#edf6df; text-align:center; width:max-content; max-width:93%; padding:7px 12px; border-radius:6px; background:#102018e8; font-size:12px; }
.stage[data-flash=hit] .ally img,.stage[data-flash=attack] .foe img { animation:hit .24s ease; }
@keyframes hit { 30% { opacity:.4; transform:translateX(7px); } 65% { transform:translateX(-4px); } }
.footer { display:flex; justify-content:space-between; gap:10px; padding-block:12px 22px; color:#a2b3a6; font-size:10px; }
dialog { position:fixed; color:var(--ink); width:min(91vw,580px); max-height:85vh; overflow:auto; border:1px solid #597657; background:#1a2a20; border-radius:15px; padding:22px; }
dialog::backdrop { background:#080f0ce0; }
dialog h2 { margin:0 0 12px; }
dialog .close { position:absolute; top:11px; right:11px; width:30px; height:30px; background:#2b4333; border:1px solid #466551; border-radius:6px; font-size:20px; line-height:1; }
.muted { color:#bcc9b9; font-size:13px; line-height:1.55; }
#save-dialog label { display:block; margin-top:16px; font-size:12px; }
#save-code { display:block; width:100%; background:#101d15; color:var(--ink); border:1px solid #526951; border-radius:6px; padding:9px; margin:6px 0 9px; }
.dex-list { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
.dex-list div { display:flex; align-items:center; flex-direction:column; padding:8px 4px; gap:3px; border-radius:8px; border:1px solid #426049; background:#202f22; }
.dex-list img { width:80%; height:65px; object-fit:contain; }
.dex-list .unknown img { filter:brightness(0) opacity(.42); }
.dex-list span { font-size:10px; color:#b2c0ad; }
@media (max-width:980px) { .layout { grid-template-columns:minmax(0,1fr) 218px; gap:12px; } }
@media (max-width:730px) {
  .layout { grid-template-columns:1fr; }
  .sidebar { grid-template-columns:1fr 1fr; }
  .inventory { grid-column:1 / -1; }
  .top-inner { height:60px; }
  .heading { padding:22px 0 16px; }
}
@media (max-width:480px) {
  .stage { aspect-ratio:auto; min-height:253px; }
  #world { position:absolute; inset:0; }
  .brand { gap:7px; font-size:13px; }
  .sigil { width:32px; height:32px; font-size:18px; }
  .brand small { font-size:7px; letter-spacing:.1em; }
  .header-actions { gap:5px; }
  .header-actions .button { padding:7px; font-size:11px; }
  .location { padding:6px; }
  .location strong { font-size:11px; }
  .stage-header { inset:8px 7px auto; }
  .starter { border-radius:8px; }
  .starter strong { font-size:11px; }
  .intro-content { padding-inline:12px; }
  .subheading { font-size:11px; }
  .sidebar { gap:7px; }
  .panel { padding:10px; }
  .hint-end { margin-left:0; }
}
@media (pointer:coarse), (max-width:730px) {
  .touch-controls { display:flex; margin-top:5px; justify-content:center; }
  .touch-controls button { min-width:44px; min-height:42px; }
  .keyboard-hint { display:none; }
  .explore-controls { justify-content:space-between; gap:6px; }
}
