/* PokeWonder 通關模擬 — colours taken from the game's own UI: night navy behind gold-framed white dialog boxes,
   the dark teal "selected" button. Neutral page, flat colours only. */
:root {
  --navy: #1a2138; --gold: #c9a64a; --gold-d: #9c7c2c; --teal: #24506a; --teal-d: #183a4e;
  --bg: #f3f4f2; --ink: #1c2230; --muted: #5b6372; --line: #d9dcd6; --white: #fff;
  --ok: #2e7d4f; --mid: #a86b00; --bad: #b3362c;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.7 "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif; }
a { color: var(--teal); text-underline-offset: 2px; }
a:hover { color: var(--teal-d); }
img.px { image-rendering: pixelated; }
.wrap { max-width: 1220px; margin: 0 auto; padding: 0 20px; }
main.wrap { padding-top: 20px; padding-bottom: 48px; }
h1 { font-size: 1.75rem; line-height: 1.3; margin: .4em 0 .5em; }
h2 { font-size: 1.3rem; margin: 1.8em 0 .6em; }
h3 { font-size: 1.05rem; margin: 1.2em 0 .4em; }
p, li { max-width: 46em; }
.lede { font-size: 1.06rem; }
.small, .note { color: var(--muted); font-size: .9rem; }
code { background: #e7e9e4; padding: 1px 5px; border-radius: 3px; font-size: .9em; }

.top { background: var(--navy); border-bottom: 3px solid var(--gold); position: sticky; top: 0; z-index: 20; }
.top-in { display: flex; align-items: center; gap: 18px; min-height: 56px; }
.brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-weight: 700; white-space: nowrap; }
.nav { min-width: 0; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: #e8e3d2; text-decoration: none; padding: 6px 10px; border-radius: 4px; white-space: nowrap; font-size: .95rem; }
.nav a:hover { background: #2a3352; color: #fff; }
.nav a[aria-current="page"] { background: var(--teal); color: #fff; box-shadow: inset 0 0 0 2px var(--gold); }
.crumbs { font-size: .88rem; color: var(--muted); }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
.top a:focus-visible { outline-color: var(--gold); }
.opp-t td.who, .team-t td.who, .lineup td.who { position: sticky; left: 0; background: #fff; z-index: 1; }

.btn { display: inline-block; background: var(--teal); color: #fff; border: 2px solid var(--gold); border-radius: 6px; padding: 8px 16px; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; box-shadow: 0 3px 0 var(--gold-d); transition: transform .06s, box-shadow .06s, background .15s; }
.btn:hover { background: var(--teal-d); color: #fff; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--gold-d); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn.ghost { background: #fff; color: var(--teal); border-color: var(--line); box-shadow: none; }
.btn.small { padding: 4px 10px; font-size: .88rem; box-shadow: 0 2px 0 var(--gold-d); }
.btn.go { font-size: 1.05rem; padding: 10px 26px; }
.linkbtn { background: none; border: 0; color: var(--teal); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }

.hero-l { margin-top: -.2em; }
.shot { margin: 0 0 16px; max-width: 560px; }
.shot img { width: 100%; height: auto; border: 3px solid var(--gold); border-radius: 6px; display: block; }
.shot figcaption { font-size: .85rem; color: var(--muted); margin-top: 4px; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 420px); gap: 28px; align-items: center; margin-bottom: 18px; }
.hero-shot { margin: 0; }
.hero-shot img { width: 100%; height: auto; border: 3px solid var(--gold); border-radius: 6px; display: block; }
.hero-shot figcaption { font-size: .8rem; color: var(--muted); margin-top: 4px; }

/* the game's dialog box: white, gold double frame */
.frame { background: #fff; border: 3px solid var(--gold); border-radius: 8px; box-shadow: inset 0 0 0 3px #f1ead6; padding: 16px; }
.sim-top { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-end; }
.fld { display: flex; flex-direction: column; font-size: .85rem; color: var(--muted); gap: 3px; }
.fld.grow { flex: 1 1 320px; }
select, input[type="text"], input[type="number"], input[type="email"], input:not([type]) { font: inherit; font-size: .95rem; color: var(--ink); background: #fff; border: 1px solid #868b82; border-radius: 5px; padding: 6px 8px; min-height: 38px; }
select:focus, input:focus { outline: 2px solid var(--teal); outline-offset: 1px; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .85rem; color: var(--muted); }
.presets button { font: inherit; font-size: .85rem; background: #f6f2e4; border: 1px solid #e1d6b4; color: var(--ink); border-radius: 4px; padding: 4px 9px; cursor: pointer; }
.presets button:hover { border-color: var(--gold); }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; margin: 14px 0; }
.slot { border: 1px solid var(--line); border-radius: 6px; padding: 10px; background: #fbfbf9; }
.slot-h { display: grid; grid-template-columns: 48px minmax(0, 1fr) 76px 30px; gap: 8px; align-items: center; }
.slot-h input.sp-in { width: 100%; }
.slot-h input.lv { width: 100%; }
.slot .x { background: none; border: 0; font-size: 1.2rem; color: var(--muted); cursor: pointer; }
.slot .mvs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.slot .mvs select { width: 100%; min-width: 0; font-size: .88rem; }
.slot details { margin-top: 6px; font-size: .9rem; }
.slot details summary { padding: 6px 0; cursor: pointer; }
.slot details .row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 6px; }
.slot details .row select { width: 100%; min-width: 0; }
.slot details .row select:first-child { grid-column: 1 / -1; }
.slot .best { margin-top: 8px; }
.slot .best-out { font-size: .88rem; margin-top: 6px; }
.sim-opts { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; border-top: 1px solid var(--line); padding-top: 12px; }
.sim-opts .pair { display: flex; gap: 6px; }
.chk { font-size: .9rem; display: flex; gap: 6px; align-items: center; max-width: 280px; }
.quota { font-size: .85rem; color: var(--muted); margin: 8px 0 0; min-height: 1.2em; }

.out { margin-top: 18px; }
.out-cap { font-size: .92rem; color: var(--muted); }
.verdict { display: flex; gap: 20px; align-items: center; background: #fff; border: 1px solid var(--line); border-left: 6px solid var(--bad); border-radius: 6px; padding: 14px 18px; }
.verdict.ok { border-left-color: var(--ok); } .verdict.mid { border-left-color: var(--mid); }
.v-main { display: flex; flex-direction: column; align-items: center; min-width: 110px; }
.v-num { font-size: 2.4rem; font-weight: 800; line-height: 1; }
.verdict.ok .v-num { color: var(--ok); } .verdict.mid .v-num { color: var(--mid); } .verdict.bad .v-num { color: var(--bad); }
.v-lab { font-size: .8rem; color: var(--muted); }
.v-side p { margin: .2em 0; }
.r-h { margin-top: 1.2em; }
.ladder { list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 6px; }
.ladder li { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 8px 8px 10px; display: grid; justify-items: center; gap: 2px; max-width: none; font-size: .88rem; }
.ladder li img { height: 40px; width: 40px; }
.ladder .lp { font-size: 1.2rem; font-weight: 800; line-height: 1.1; }
.ladder .bar { width: 100%; }
.ladder li.drop { border: 2px solid var(--bad); }
.ladder li.drop small { color: var(--bad); font-weight: 700; }
.ladder li.fin { border-color: var(--gold); background: #fbf7ea; align-content: end; }
.members { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.member { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; max-width: none; }
.m-head { display: grid; grid-template-columns: minmax(90px, 1.2fr) auto minmax(60px, 1fr) auto minmax(60px, 1fr); gap: 8px; align-items: center; font-size: .92rem; }
.member.locked { background: #faf8f1; }
.member .btn { margin-top: 8px; }
.bar { display: inline-block; height: 8px; background: #e6e8e3; border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--teal); transition: width .4s; }
.bar.win i { background: var(--ok); }
.locked-box { background: #faf8f1; border: 2px dashed var(--gold); border-radius: 6px; padding: 12px 14px; margin-top: 12px; }

.tbl { overflow-x: auto; margin: 8px 0; }
table { border-collapse: collapse; width: 100%; background: #fff; font-size: .92rem; }
th, td { text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: #eceee9; font-weight: 700; white-space: nowrap; }
td.who { white-space: nowrap; }
td.who img { vertical-align: middle; margin-right: 6px; }
td.who small { color: var(--muted); }
td.mv { min-width: 260px; }
.mvg { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; }
td.mv small { color: var(--muted); margin-left: 4px; font-size: .78rem; }
td.uses { font-size: .85rem; min-width: 220px; }
.ty { display: inline-block; font-size: .78rem; border: 1px solid #c8ccc3; background: #f2f3ef; border-radius: 3px; padding: 0 6px; margin: 1px 3px 1px 0; white-space: nowrap; }

.explain .cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.explain h3 { margin-top: .2em; }
.cards { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.cards li { max-width: none; }
.cards a { display: grid; grid-template-columns: 48px 1fr; grid-template-rows: auto 1fr; gap: 2px 10px; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 10px; text-decoration: none; color: var(--ink); height: 100%; transition: border-color .15s, transform .15s; }
.cards a:hover { border-color: var(--gold); transform: translateY(-2px); }
.cards img { grid-row: 1 / 3; }
.cards span { font-size: .86rem; color: var(--muted); line-height: 1.5; }

.gym { margin: 26px 0; }
.gym-head { display: flex; gap: 14px; align-items: flex-start; }
.gym-head h2 { margin: 0 0 .2em; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gym-head p { margin: .15em 0; }
img.tr { width: 64px; height: auto; flex: none; background: #fff; border: 2px solid var(--gold); border-radius: 6px; padding: 2px; }
.toc { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.toc a { background: #fff; border: 1px solid var(--line); padding: 3px 10px; border-radius: 4px; text-decoration: none; font-size: .9rem; }
.sample { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 4px 16px 12px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 180px; gap: 20px; }
figure.side { margin: 1em 0 0; text-align: center; background: #fff; border: 2px solid var(--gold); border-radius: 8px; padding: 10px; align-self: start; }
figure.side figcaption { font-size: .82rem; color: var(--muted); }
.cta { display: flex; gap: 12px; align-items: center; background: #fff; border: 2px solid var(--gold); border-radius: 8px; padding: 10px 14px; margin: 24px 0; }
.cta b { display: block; margin-bottom: 6px; }

.modal { position: fixed; inset: 0; background: rgba(15, 20, 34, .6); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal-card { background: #fff; border: 3px solid var(--gold); box-shadow: inset 0 0 0 3px #f1ead6; border-radius: 8px; max-width: 520px; width: 100%; padding: 18px 20px; max-height: 90vh; overflow: auto; }
.modal-card h2 { margin-top: 0; }
.modal-card ul { padding-left: 1.2em; }
.modal-card .row { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.restore summary { cursor: pointer; font-size: .9rem; color: var(--muted); }
.restore div { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

.foot { background: #e6e8e3; border-top: 1px solid var(--line); font-size: .86rem; color: var(--muted); padding: 18px 0 28px; }
.foot .links a { margin-right: 14px; }

/* home: editor on the left, result on the right */
main.wrap.wide { max-width: 1220px; }
.sim { display: grid; grid-template-columns: minmax(0, 400px) minmax(0, 1fr); gap: 24px; align-items: start; margin-top: 8px; }
.editor { display: flex; flex-direction: column; gap: 12px; }
.editor .slots { grid-template-columns: minmax(0, 1fr); margin: 0; }
.editor .presets span { width: 100%; }
.editor .add { width: 100%; }
.editor .sim-opts { display: block; border-top: 1px solid var(--line); padding-top: 10px; }
.editor .sim-opts summary { cursor: pointer; font-size: .9rem; color: var(--muted); padding: 4px 0; }
.editor .sim-opts summary span { color: var(--ink); }
.editor .sim-opts[open] .fld, .editor .sim-opts[open] .chk { margin-top: 10px; }
.editor .sim-opts .pair select { flex: 1 1 0; min-width: 0; }
.editor .chk { max-width: none; }
.editor .btn.go { width: 100%; padding: 12px; font-size: 1.1rem; }
.editor .quota { margin: 0; }
.sim .out { margin-top: 0; min-width: 0; }
.sim .out-cap { margin-top: 0; }
.m-sum { display: none; }
.slot .best-out p { margin: .3em 0; }
.best-list { padding-left: 1.2em; margin: .3em 0; }
.story-in { display: grid; grid-template-columns: minmax(0, 440px) minmax(0, 1fr); gap: 24px; align-items: start; }
.story .vid { margin: 0; }
.story .vid img { width: 100%; height: auto; display: block; border: 3px solid var(--gold); border-radius: 6px; image-rendering: auto; }
.story .vid figcaption { font-size: .84rem; color: var(--muted); margin-top: 4px; }
.story-in p:first-child { margin-top: 0; }

@media (max-width: 960px) {
  .sim { grid-template-columns: minmax(0, 1fr); }
  .story-in { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .ladder { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .m-sum { display: block; background: #fff; border-left: 5px solid var(--bad); border-radius: 4px; padding: 8px 12px; font-size: .92rem; }

  h1 { font-size: 1.4rem; }
  .hero { grid-template-columns: 1fr; gap: 10px; }
  .hero-shot { display: none; }
  .explain .cols { grid-template-columns: 1fr; gap: 6px; }
  .slots { grid-template-columns: 1fr; }
  .verdict { flex-direction: column; align-items: flex-start; gap: 6px; }
  .v-main { flex-direction: row; gap: 10px; align-items: baseline; }
  .m-head { grid-template-columns: minmax(0, 1fr) auto; }
  .m-head .bar { grid-column: 1 / -1; width: 100%; display: block; }
  .split { grid-template-columns: 1fr; }
  figure.side { display: none; }
  .brand span { font-size: .95rem; }
  .top-in { gap: 0 10px; flex-wrap: wrap; padding-top: 6px; }
  .nav { width: 100%; padding-bottom: 6px; margin: 0 -10px; }
  .mvg { grid-template-columns: 1fr; }
  td.mv { min-width: 150px; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
.sample h2 { margin-top: .8em; }
