/* vgc guru: one type scale, shared controls, no dashboard chrome. */
:root {
  color-scheme: dark;
  --font: "Geist", system-ui, sans-serif;
  --bg: #0c0d0f; --bg-2: #111214; --panel: #17181b; --panel-2: #202227; --raise: #292c33;
  --line: #2d3036; --line-2: #42464f;
  --text: #f0f1f3; --text-2: #c2c5cd; --text-3: #a3a8b3;
  --accent: #2f6bff; --accent-text: #a8c1ff; --accent-soft: #1c2b49;
  --win: #34d399; --loss: #fb7185;
  --g-best: #34d399; --g-good: #8ab2ff; --g-inaccuracy: #fbbf24;
  --g-mistake: #fb923c; --g-blunder: #fb7185; --g-forced: #a3a8b3;
  --type-caption: 13px; --type-body: 14px; --type-lead: 17px;
  --r: 8px; --r-lg: 14px;
}
* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: #454a55 transparent; }
[hidden] { display: none !important; }
html { background: var(--bg); text-rendering: optimizeLegibility; scroll-padding-top: 24px; }
body { margin: 0; min-height: 100vh; color: var(--text); background: var(--bg); font: 400 var(--type-body)/1.6 var(--font); -webkit-font-smoothing: antialiased; }
::selection { background: #284b91; color: white; }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 4px; }
button,input,textarea { font: inherit; color: inherit; }
input,textarea { caret-color: var(--accent-text); }
button { cursor: pointer; }
a { color: var(--accent-text); text-underline-offset: 4px; }
button,a,summary { -webkit-tap-highlight-color: transparent; }
button { transition: background-color 140ms, border-color 140ms; }
button:disabled { cursor: not-allowed; }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.num,.acc b,.p,.wc,.chip b { font-variant-numeric: tabular-nums; }

/* Header */
.site-header { max-width: 1440px; height: 88px; margin: auto; padding: 0 48px; display: flex; align-items: center; gap: 24px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: #f0f1f3; color: #181a1e; flex: none; }
.mark .i { width: 24px; height: 24px; }
.brand h1 { font-size: 16px; font-weight: 600; line-height: 1.4; letter-spacing: -.025em; margin: 0; }
.brand small { display: block; font-size: var(--type-caption); color: var(--text-3); }
.spacer { flex: 1; }
.guide-link { color: var(--text-2); font-size: var(--type-body); text-decoration: none; }
.guide-link:hover { color: white; }
.btn { min-height: 42px; padding: 9px 16px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--panel-2); font-weight: 500; font-size: var(--type-body); line-height: 1.4; }
.btn:hover:not(:disabled) { background: #2b2e35; }
.btn:disabled { color: #8a8f9b; background: #191b20; border-color: var(--line); }
.btn.primary { min-height: 48px; justify-content: space-between; background: #eceef3; border-color: #eceef3; color: #181a20; font-weight: 600; margin-top: 4px; }
.btn.primary:hover:not(:disabled) { background: white; }
.btn.primary:disabled { background: #292c33; color: #a5aab5; border-color: #42464f; }

/* Import */
.layout { max-width: 1280px; margin: auto; padding: 72px 48px 80px; display: grid; grid-template-columns: minmax(0,1fr) 420px; gap: 72px; grid-template-areas: 'intro setup'; align-items: start; }
.stage { grid-area: intro; min-width: 0; display: grid; gap: 24px; }
.rail { grid-area: setup; min-width: 0; }
.intro { padding-top: 20px; }
.intro h2 { margin: 0 0 24px; font-size: clamp(38px,4vw,56px); font-weight: 500; line-height: 1.12; letter-spacing: -.035em; }
.intro h2 span { color: #a3a8b3; }
.intro-copy { font-size: var(--type-lead); line-height: 1.75; color: var(--text-2); max-width: 42ch; margin: 0; }
.review-features { display: grid; gap: 24px; margin: 40px 0 0; padding-top: 28px; border-top: 1px solid var(--line); max-width: 44ch; }
.review-features dt { font-size: var(--type-body); font-weight: 500; color: var(--text); }
.review-features dd { margin: 6px 0 0; font-size: var(--type-body); line-height: 1.7; color: var(--text-3); }
.plate { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); }
.form { padding: 28px; display: grid; gap: 16px; border-color: #373a42; }
.form-heading h2 { font-size: 22px; font-weight: 500; letter-spacing: -.025em; line-height: 1.3; margin: 0 0 8px; }
.form-heading p { margin: 0; font-size: var(--type-body); color: var(--text-3); line-height: 1.6; }
.setup-progress { list-style: none; display: flex; gap: 16px; margin: 8px 0 12px; padding: 0; counter-reset: setup; }
.setup-progress li { display: flex; align-items: center; gap: 8px; font-size: var(--type-caption); color: var(--text-3); flex: 1; }
.setup-progress li::before { counter-increment: setup; content: counter(setup); display: grid; place-items: center; width: 24px; height: 24px; flex: none; border-radius: 50%; border: 1px solid #505561; font-size: 12px; }
.setup-progress li.current { color: #dae5ff; }
.setup-progress li.current::before { background: var(--accent); border-color: var(--accent); color: white; }
.lbl { font-size: var(--type-body); font-weight: 500; color: var(--text-2); }
.field-row { height: 48px; display: flex; align-items: center; gap: 10px; padding: 0 12px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r); }
.field-row .i { color: var(--text-3); }
.field-row:focus-within { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.field-row input { width: 100%; min-width: 0; flex: 1; border: 0; outline: 0; background: none; font-size: var(--type-body); }
input::placeholder,textarea::placeholder { color: #a0a5b0; }
.team-details { margin-top: 4px; border-top: 1px solid var(--line); }
.team-details summary { display: flex; align-items: center; gap: 9px; padding: 16px 0 0; color: var(--text-2); font-size: var(--type-body); cursor: pointer; }
.team-details summary::before { content: '+'; font-size: 18px; line-height: 1; }
.team-details[open] summary::before { content: '−'; }
.team-details summary span { font-size: var(--type-caption); color: var(--text-3); margin-left: auto; }
.team-content { display: grid; gap: 12px; margin-top: 16px; }
textarea { width: 100%; min-height: 160px; padding: 12px; resize: vertical; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r); font-size: var(--type-body); line-height: 1.6; }
.team-content p,.hint { margin: 0; color: var(--text-3); font-size: var(--type-caption); line-height: 1.6; }
.hint { min-height: 22px; }
.hint.err { color: #fecdd3; }
.player-section h3 { margin: 4px 0 12px; font-size: var(--type-body); font-weight: 500; }
.players { display: grid; gap: 10px; }
.pbtn { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 6px 12px; align-items: center; padding: 12px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg-2); text-align: left; }
.pbtn:hover { border-color: #697180; }
.pbtn[aria-pressed='true'] { background: var(--accent-soft); border-color: #709bff; }
.pbtn .nm { font-size: var(--type-body); font-weight: 500; overflow-wrap: anywhere; }
.pbtn .res { font-size: var(--type-caption); color: var(--text-3); }
.pbtn .res.w { color: var(--win); }
.pbtn .mons { display: flex; flex-wrap: wrap; grid-column: 1 / -1; }
.pbtn .mons img { width: 32px; height: 32px; image-rendering: pixelated; }

/* Grading reference */
.grade-guide { max-width: 1184px; margin: 0 auto; border-top: 1px solid var(--line); padding: 32px 0; scroll-margin-top: 24px; }
.guide-heading { display: grid; grid-template-columns: 1fr 1fr; align-items: start; gap: 32px; margin-bottom: 32px; }
.guide-heading h2 { margin: 0; font-size: 20px; font-weight: 500; letter-spacing: -.02em; line-height: 1.4; }
.guide-heading p { margin: 0; color: var(--text-3); font-size: var(--type-body); line-height: 1.7; max-width: 60ch; }
.grade-scale { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 20px; }
.grade-scale > div { border-top: 1px solid var(--line); padding-top: 16px; }
.grade-scale h3 { display: inline; margin: 0; font-size: var(--type-body); font-weight: 500; }
.grade-scale p { margin: 8px 0 0; font-size: var(--type-caption); color: var(--text-3); line-height: 1.6; }
.grade-dot { display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; }
.grade-dot.best { background: var(--g-best); } .grade-dot.good { background: var(--g-good); }
.grade-dot.inaccuracy { background: var(--g-inaccuracy); } .grade-dot.mistake { background: var(--g-mistake); } .grade-dot.blunder { background: var(--g-blunder); }
.guide-note { max-width: 82ch; font-size: var(--type-caption); line-height: 1.7; color: var(--text-3); margin: 28px 0 0; }
.site-footer { max-width: 1184px; margin: 0 auto; padding: 24px 0; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 20px; font-size: var(--type-caption); color: var(--text-3); }

/* Results */
.has-result .layout { display: block; max-width: 1440px; padding: 36px 40px 56px; }
.has-result .rail { display: none; }
.has-result.show-setup .rail { display: block; max-width: 520px; margin: 0 auto 40px; }
.has-result .grade-guide,.has-result .site-footer { max-width: 1360px; margin-left: 40px; margin-right: 40px; }
.summary { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 16px 24px; padding: 0 0 28px; background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.vs { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 14px; }
.vs h2 { margin: 0; font-size: 26px; font-weight: 500; line-height: 1.3; letter-spacing: -.025em; overflow-wrap: anywhere; }
.vs .op { font-size: var(--type-body); color: var(--text-3); overflow-wrap: anywhere; }
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: var(--type-caption); font-weight: 500; }
.badge.w { color: #a7f3d0; background: #142820; } .badge.l { color: #fecdd3; background: #321c23; }
.acc { text-align: right; }
.acc b { display: block; font-size: 32px; font-weight: 500; line-height: 1.1; letter-spacing: -.025em; }
.acc small { display: block; margin-top: 6px; font-size: var(--type-caption); color: var(--text-3); }
.chips,.meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px 20px; }
.chip { display: inline-flex; align-items: baseline; gap: 7px; font-size: var(--type-caption); color: var(--text-2); }
.chip b { font-size: 15px; font-weight: 500; color: var(--c); }
.meta { font-size: var(--type-caption); color: var(--text-3); }
.meta a { display: inline-flex; align-items: center; gap: 6px; }
.recon { grid-column: 1 / -1; font-size: var(--type-caption); color: var(--text-3); }
.recon summary { cursor: pointer; color: var(--text-2); }
.recon ul { display: grid; gap: 8px; padding-left: 20px; margin: 14px 0 0; overflow-wrap: anywhere; }
.board { display: grid; grid-template-columns: minmax(0,1.3fr) minmax(380px,1fr); gap: 32px; align-items: start; }
.playback-column { position: sticky; top: 24px; min-width: 0; }
.playback-heading,.dhead h3,.curve h3 { margin: 0; font-size: 16px; font-weight: 500; line-height: 1.5; letter-spacing: -.015em; }
.playback-heading { margin-bottom: 16px; }
.viewer { padding: 0; overflow: visible; background: var(--bg-2); border-radius: 12px; }
.viewer iframe { display: block; width: 100%; aspect-ratio: 640 / 360; border: 0; background: var(--bg-2); }
.curve { margin-top: 24px; background: none; border: 0; }
.curve .sub { font-size: var(--type-caption); color: var(--text-3); margin-top: 6px; line-height: 1.7; }
.curve svg { display: block; width: 100%; height: auto; margin-top: 12px; }
.curve svg text { font: 500 12px var(--font); fill: var(--text-3); }
.curve circle { cursor: pointer; }
.dlist { min-width: 0; display: grid; gap: 16px; }
.dhead { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.dhead span { font-size: var(--type-caption); color: var(--text-3); }
.turn-nav { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; }
.turn-nav button { flex: none; min-width: 40px; min-height: 40px; border: 1px solid var(--line-2); border-bottom: 2px solid var(--turn-color,var(--line-2)); border-radius: 7px; background: #1b1e23; color: var(--text-2); font-size: var(--type-caption); }
.turn-nav button:hover { background: #2c3039; }
.turn-nav button[aria-current='step'] { background: #eceef3; border-color: #eceef3; color: #181a20; }
.turn { background: none; border: 0; border-radius: 0; }
.turn header { display: flex; align-items: baseline; gap: 16px; padding: 18px 0; border-top: 1px solid var(--line); }
.turn header > b { font-weight: 500; font-size: 20px; letter-spacing: -.02em; }
.wc { margin-left: auto; font-size: var(--type-caption); color: var(--text-3); }
.wc b { color: var(--text); font-weight: 500; }
.slots { display: grid; grid-template-columns: minmax(0,1fr); gap: 16px; }
.slot { min-width: 0; display: grid; gap: 16px; padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.mon { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 500; min-height: 32px; }
.mon img { width: 40px; height: 40px; margin: -4px; image-rendering: pixelated; }
.verdict { display: grid; gap: 6px; padding: 0; border-radius: 0; background: none; }
.verdict small { color: var(--text-3); font-size: var(--type-caption); }
.verdict .pl { font-size: var(--type-body); font-weight: 500; overflow-wrap: anywhere; }
.verdict .gr { display: inline-block; margin-left: 0; font-size: var(--type-caption); font-weight: 500; color: var(--c); }
.verdict .alt { padding-top: 8px; margin-top: 2px; border-top: 1px solid var(--line); font-size: var(--type-caption); color: var(--text-2); overflow-wrap: anywhere; }
.verdict .alt em { font-style: normal; color: var(--text); }
.options-heading { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--text-3); margin-top: 4px; }
.opts { display: grid; gap: 2px; padding: 0; margin: 0; list-style: none; }
.opts li { display: grid; grid-template-columns: minmax(0,1fr) 72px 38px; align-items: center; gap: 10px; padding: 8px 6px; font-size: var(--type-caption); border-radius: 6px; color: var(--text-2); }
.opts li.pl { background: #202329; color: var(--text); }
.opts .o { overflow-wrap: anywhere; }
.opts .bar { height: 3px; background: var(--raise); border-radius: 3px; overflow: hidden; }
.opts .bar i { display: block; height: 100%; background: #717888; border-radius: inherit; }
.opts li.top .bar i { background: #7ca5ff; }
.opts .p { text-align: right; color: var(--text-3); }
.tag { display: inline-block; margin-left: 5px; padding: 0 5px; border-radius: 4px; font-size: 12px; color: var(--accent-text); background: var(--accent-soft); }
.tgt { color: var(--text-3); font-weight: 400; }
.unseen { font-size: var(--type-body); color: var(--text-3); padding: 12px; border-top: 1px solid var(--line); border-radius: 0; }
.decision-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 16px; border-top: 1px solid var(--line); }
.decision-footer > span { font-size: var(--type-caption); color: var(--text-3); font-variant-numeric: tabular-nums; }
.review-keys { font-size: var(--type-caption); color: var(--text-3); text-align: center; margin: 0; }
kbd { font: 12px var(--font); border: 1px solid #4c515e; border-bottom-width: 2px; padding: 2px 5px; margin-right: 3px; border-radius: 4px; background: #22252c; }

/* Feedback */
.working { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 32px; min-height: 260px; background: none; border: 0; }
.working b { display: block; font-size: 16px; font-weight: 500; }
.working span { font-size: var(--type-body); color: var(--text-3); }
.spin { width: 20px; height: 20px; flex: none; border: 2px solid var(--line-2); border-top-color: var(--accent-text); border-radius: 50%; animation: spin 800ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.err-plate { display: flex; gap: 16px; align-items: center; min-height: 160px; padding: 24px; border-color: #64313d; background: #24171c; color: #fecdd3; }
.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 30; }
.toast { max-width: min(360px,calc(100vw - 40px)); padding: 14px 18px; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 12px; font-size: var(--type-body); }

@media (max-width: 1240px) {
  .layout { padding: 56px 36px 64px; gap: 40px; grid-template-columns: minmax(0,1fr) 390px; }
  .grade-guide,.site-footer { margin-left: 36px; margin-right: 36px; }
  .intro h2 { font-size: 44px; }
}
@media (max-width: 1000px) {
  .site-header { padding: 0 28px; }
  .layout { padding: 48px 28px; gap: 32px; grid-template-columns: minmax(0,1fr) 360px; }
  .intro h2 { font-size: 38px; }
  .intro-copy { font-size: 16px; }
  .form { padding: 24px; }
  .board { grid-template-columns: minmax(0,1fr) minmax(320px,1fr); gap: 24px; }
  .has-result .layout { padding: 28px; }
  .grade-guide,.site-footer,.has-result .grade-guide,.has-result .site-footer { margin-left: 28px; margin-right: 28px; }
  .grade-scale { gap: 16px; }
}
@media (max-width: 760px) {
  .site-header { height: 72px; padding: 0 20px; gap: 12px; }
  .brand small { display: none; } .brand h1 { font-size: 15px; } .mark { width: 30px; height: 30px; }
  .guide-link { font-size: 13px; } .new-review { font-size: 13px; padding: 8px 12px; }
  .has-result .guide-link { display: none; }
  .layout { display: grid; grid-template-columns: minmax(0,1fr); grid-template-areas: 'intro' 'setup'; padding: 36px 20px 48px; gap: 32px; }
  .intro { padding: 0; } .intro h2 { font-size: clamp(32px,8.5vw,42px); line-height: 1.16; margin-bottom: 20px; }
  .review-features { display: none; } .intro-copy { font-size: 16px; }
  .form { padding: 24px; }
  .field-row input,textarea { font-size: 16px; }
  .setup-progress { gap: 10px; }
  .grade-guide,.site-footer,.has-result .grade-guide,.has-result .site-footer { margin-left: 20px; margin-right: 20px; }
  .guide-heading { display: block; } .guide-heading p { margin-top: 12px; }
  .grade-scale { grid-template-columns: 1fr 1fr; gap: 24px 20px; }
  .site-footer { flex-wrap: wrap; gap: 8px 20px; }
  .has-result .layout { padding: 28px 20px 40px; }
  .vs h2 { font-size: 22px; } .summary { gap: 16px; }
  .chips { gap: 8px 16px; }
  .board { grid-template-columns: minmax(0,1fr); gap: 32px; }
  .playback-column { position: static; } .slot { padding: 14px; }
  .opts li { grid-template-columns: minmax(0,1fr) 40px 34px; gap: 8px; }
  .review-keys { display: none; }
  .turn-nav button { min-width: 44px; min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
/* Contextual explanations and recovery use the existing type and control scale. */
.guide-explainer { margin-top: 28px; max-width: 76ch; font-size: var(--type-caption); color: var(--text-3); }
.guide-explainer summary { cursor: pointer; color: var(--text-2); padding: 8px 0; }
.guide-explainer p { margin: 12px 0 0; line-height: 1.8; }
.guide-explainer b { color: var(--text-2); font-weight: 500; }
.error-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.err-plate p { max-width: 60ch; margin: 8px 0 0; }
.turn-nav button { padding: 0 10px; }

/* Replay transport and move comparisons share the app's control and type scale. */
.viewer iframe { border-radius: 12px 12px 0 0; }
.player-toolbar { display: flex; align-items: center; gap: 4px; padding: 12px; background: var(--panel); border-top: 1px solid var(--line); border-radius: 0 0 12px 12px; }
.player-toolbar button,.player-settings summary { min-height: 40px; padding: 8px 10px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--text-2); font: 500 13px var(--font); cursor: pointer; }
.player-toolbar button:hover,.player-settings summary:hover { background: var(--raise); color: var(--text); }
.player-toolbar button:disabled { opacity: .45; cursor: wait; }
.player-toolbar svg { width: 18px; height: 18px; display: block; }
.player-toolbar .play-button { display: flex; align-items: center; justify-content: center; gap: 8px; background: var(--text); color: var(--bg); min-width: 86px; margin-right: 4px; }
.player-toolbar .play-button:hover { background: #d7dce6; color: var(--bg); }
#playbackState { margin-left: 8px; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.player-settings { position: relative; margin-left: auto; }
.player-settings summary { display: flex; align-items: center; list-style: none; }
.player-settings summary::-webkit-details-marker { display: none; }
.player-settings-panel { position: absolute; right: 0; top: 46px; z-index: 5; width: 230px; padding: 16px; display: grid; gap: 12px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--panel-2); }
.player-settings-panel label { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--text-2); }
.player-settings-panel select,.player-settings-panel input { width: 112px; min-height: 36px; padding: 6px; font: 13px var(--font); border: 1px solid var(--line-2); border-radius: 6px; color: var(--text); background: var(--bg-2); }
.player-settings-panel button { border-color: var(--line-2); }
.choice-label,.choice-line { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.choice-line { margin-top: 4px; }
.choice-percent { flex-shrink: 0; font-size: 14px; font-variant-numeric: tabular-nums; color: var(--text-2); }
.choice-label .gr { padding: 2px 7px; border-radius: 4px; background: color-mix(in srgb,var(--c) 10%,transparent); }
.verdict .alt { margin-top: 12px; padding-top: 12px; }
.verdict .alt em { font-size: 14px; }
.grade-note { font-size: 12px; line-height: 1.65; margin: 6px 0 0; color: var(--text-3); }
.options-heading { margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.opts .p { font-variant-numeric: tabular-nums; }
@media(max-width:760px) {
  .player-toolbar { padding: 8px; gap: 0; }
  .player-toolbar button,.player-settings summary { min-height: 44px; padding: 8px; }
  .player-toolbar .play-button { min-width: 72px; gap: 4px; }
  #playbackState { margin-left: 4px; }
}

/* Desktop review desk: both Pokémon and transport fit in the working viewport. */
.guide-close { display: none; }
@media (min-width: 1100px) {
  .has-result .site-header { max-width: 1800px; height: 64px; padding-inline: 28px; }
  .has-result .layout { max-width: 1800px; padding: 16px 28px 20px; }
  .has-result:not(.show-setup) .layout { height: calc(100dvh - 64px); }
  .has-result:not(.show-setup) .stage { height: 100%; grid-template-rows: auto minmax(0,1fr); gap: 16px; }
  .summary { grid-template-columns: minmax(0,1fr) auto auto; gap: 8px 24px; padding-bottom: 12px; align-items: center; }
  .vs h2 { font-size: 22px; }
  .acc { grid-column: 3; grid-row: 1 / 3; }
  .acc b { font-size: 28px; }
  .chips { grid-column: 2; grid-row: 1; gap: 8px 14px; }
  .meta { grid-column: 1; gap: 8px 16px; }
  .recon { grid-column: 2; grid-row: 2; justify-self: end; }
  .recon[open] { grid-column: 1 / -1; grid-row: 3; justify-self: stretch; max-height: 180px; overflow: auto; }
  .board { grid-template-columns: minmax(0,.8fr) minmax(0,1.2fr); gap: 24px; min-height: 0; }
  .playback-column { position: static; min-height: 0; }
  .playback-heading { margin-bottom: 12px; }
  .viewer { max-width: min(100%,calc((100dvh - 480px) * 16 / 9)); margin-inline: auto; }
  .player-toolbar { padding: 8px; }
  .curve { margin-top: 16px; }
  .curve .sub { margin-top: 2px; font-size: 12px; }
  .curve svg { height: clamp(80px,14dvh,140px); margin-top: 4px; }
  .dlist { height: 100%; min-height: 0; grid-template-rows: auto auto minmax(0,1fr) auto; gap: 8px; }
  #decisionDetail { min-height: 0; overflow-y: auto; padding: 2px; }
  .turn header { padding: 8px 0 10px; }
  .turn header > b { font-size: 18px; }
  .slots { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; align-items: start; }
  .slot { padding: 12px; gap: 8px; }
  .mon { font-size: 14px; gap: 8px; }
  .mon img { width: 32px; height: 32px; margin: 0; }
  .verdict { gap: 4px; }
  .verdict .alt { margin-top: 8px; padding-top: 8px; }
  .choice-line { gap: 8px; }
  .options-heading { margin-top: 0; padding-top: 10px; gap: 8px; }
  .opts li { grid-template-columns: minmax(0,1fr) 32px 34px; gap: 6px; padding: 6px 0; }
  .opts li.pl { padding-inline: 4px; }
  .decision-footer { padding-top: 10px; }
  .review-keys { display: none; }
  .has-result .grade-guide,.has-result .site-footer { display: none; }
  .has-result .grade-guide:target { display: block; margin: 24px auto; max-width: 1400px; padding: 24px 28px; }
  .has-result .guide-close { display: inline-block; margin-bottom: 20px; }
  .has-result.show-setup .dlist { height: auto; }
  .has-result.show-setup #decisionDetail { overflow: visible; }
}

@media (min-width: 1100px) and (max-height: 760px) {
  .has-result .layout { padding-top: 12px; padding-bottom: 12px; }
  .has-result:not(.show-setup) .stage { gap: 12px; }
  .slot { gap: 4px; padding: 10px; }
  .opts li { grid-template-columns: minmax(0,1fr) 34px; padding-block: 3px; }
  .opts .bar { display: none; }
  .verdict .alt { padding-top: 6px; margin-top: 4px; }
  .options-heading { padding-top: 6px; }
}

/* Reusable, browser-local team sheets. */
.team-library-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.team-library-heading h3 { margin: 0; font-size: 15px; font-weight: 500; }
.team-library-heading .btn { padding: 6px 12px; }
.team-storage-note,.team-empty,#teamStatus { font-size: 13px; color: var(--text-3); }
#teamStatus:empty { display: none; }
#teamStatus.err { color: var(--g-blunder); }
.saved-teams { display: grid; gap: 8px; max-height: 280px; overflow-y: auto; margin: 12px 0 20px; }
.saved-team-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; align-items: center; }
.saved-team-select { padding: 10px 12px; display: grid; gap: 4px; text-align: left; border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg-2); }
.saved-team-select:hover { background: var(--panel-2); }
.saved-team-select[aria-pressed='true'] { border-color: #709bff; background: var(--accent-soft); }
.saved-team-name { font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.saved-team-mons { display: flex; flex-wrap: wrap; gap: 2px; }
.saved-team-mons img { image-rendering: pixelated; }
.team-delete { min-height: 44px; padding: 8px; border: 0; border-radius: 6px; background: transparent; color: var(--text-3); font-size: 13px; }
.team-delete:hover { background: #321c23; color: #fecdd3; }
.team-name { width: 100%; padding: 10px 12px; margin-bottom: 16px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg-2); }
.team-save-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
@media(max-width:760px) { .team-name { font-size: 16px; } }

/* Team management is a separate task; replay setup only selects a sheet. */
.team-picker-section { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.team-picker-section .lbl { margin: 0; }
.team-picker-section .optional { margin-left: 6px; font-size: 12px; font-weight: 400; color: var(--text-3); }
.team-picker-section a { font-size: 13px; }
#teamPicker { width: 100%; min-height: 44px; margin-top: 12px; padding: 10px; font: 14px var(--font); border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg-2); color: var(--text); }
.brand-home { color: var(--text); font-size: 16px; font-weight: 600; text-decoration: none; }
.teams-layout { max-width: 1280px; margin: auto; padding: 72px 48px 80px; display: grid; grid-template-columns: minmax(0,1fr) 420px; column-gap: 72px; grid-template-rows: min-content 1fr; align-items: start; }
.teams-title { grid-column: 1; grid-row: 1; padding-top: 20px; margin-bottom: 40px; }
.teams-title h1 { font-size: clamp(38px,4vw,56px); font-weight: 500; line-height: 1.12; letter-spacing: -.035em; margin: 0 0 24px; }
.teams-title p { margin: 0; max-width: 38ch; color: var(--text-2); font-size: var(--type-lead); line-height: 1.75; }
.teams-page a.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.teams-workspace { display: contents; }
.team-library { grid-column: 1; grid-row: 2; min-width: 0; border-top: 1px solid var(--line); padding-top: 24px; }
.teams-workspace h2 { margin: 0; font-size: 18px; font-weight: 500; }
.teams-page .saved-teams { max-height: 48dvh; }
.teams-page .team-empty { padding: 24px 0; margin: 0; max-width: 38ch; line-height: 1.7; }
.team-storage-note { margin: 10px 0 0; }
.team-editor { grid-column: 2; grid-row: 1 / 3; padding: 28px; display: grid; gap: 12px; border-color: #373a42; min-width: 0; }
.team-editor > .team-library-heading { margin-bottom: 12px; }
.team-editor h2 { font-size: 22px; letter-spacing: -.025em; }
.team-editor .team-name { height: 48px; margin-bottom: 8px; }
.team-editor textarea { min-height: 240px; width: 100%; }
.team-editor .team-save-actions { margin-top: 8px; }
.team-editor .primary { width: 100%; justify-content: center; }
.team-editor #teamStatus { margin: 0; }
@media(max-width:1240px) { .teams-layout { grid-template-columns: minmax(0,1fr) 390px; padding: 56px 36px 64px; column-gap: 40px; } .teams-title h1 { font-size: 44px; } }
@media(max-width:1000px) { .teams-layout { grid-template-columns: minmax(0,1fr) 360px; padding: 48px 28px; column-gap: 32px; } .teams-title h1 { font-size: 38px; } }
@media(max-width:760px) {
  .teams-layout { display: flex; flex-direction: column; padding: 32px 20px 48px; gap: 28px; }
  .teams-title { padding: 0; margin: 0; }
  .teams-title h1 { font-size: clamp(32px,8.5vw,42px); margin-bottom: 16px; }
  .teams-title p { font-size: 16px; }
  .team-library,.team-editor { width: 100%; }
  .team-editor { padding: 24px 20px; }
  .teams-page .saved-teams { max-height: 320px; }
  #teamPicker { font-size: 16px; }
  .teams-page .site-header { gap: 16px; }
  .teams-page .site-header .guide-link:last-child { display: none; }
}

@media(max-width:360px) { .site-header .nav-teams { display: none; } }

/* Team preview uses the same paired surfaces and grade treatment as move review. */
.preview-label { color: var(--text-3); font-size: var(--type-caption); }
.preview-group { display: grid; gap: 4px; }
.preview-pokemon { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.preview-pokemon > span { display: flex; align-items: center; gap: 6px; min-width: 0; }
.preview-pokemon img { flex: none; image-rendering: pixelated; }
.preview-pokemon b { font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
.preview-metrics { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; color: var(--text-3); font-size: 13px; }
.preview-metrics b { margin-left: 4px; color: var(--text-2); font-weight: 500; font-variant-numeric: tabular-nums; }
.opts.preview-options li { grid-template-columns: minmax(0,1fr) 38px; align-items: start; padding-block: 8px; }
.preview-combination { display: grid; gap: 4px; }
.preview-combination > span { display: grid; grid-template-columns: 34px minmax(0,1fr); gap: 6px; }
.preview-combination small { color: var(--text-3); font-size: 12px; }
.preview-options li + li { border-top: 1px solid var(--line); border-radius: 0; }
@media(min-width:1100px) and (max-height:760px) {
  .preview-card .preview-pokemon img { width: 24px; height: 24px; }
  .opts.preview-options li { padding-block: 4px; }
}
@media(min-width:1100px) and (max-height:760px) {
  .preview-card .preview-group { gap: 2px; }
  .preview-options .preview-combination { gap: 2px; }
  .opts.preview-options li { padding-block: 3px; }
}
