/* Full sprites get square, roomy frames. Native 40×30 party icons stay unchanged. */
.battlecolumn .combatant img.sprite{width:128px;height:128px;max-width:100%;object-fit:contain}
.connection-tile{min-height:148px}
.connection-tile img{width:96px;height:96px;max-width:100%;object-fit:contain}
.turn-roster{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px 4px}
.turn-roster img{width:96px;max-width:100%;height:96px;object-fit:contain}
.guess-slot img,.guess-tile img{width:96px;max-width:100%;height:96px;object-fit:contain}
.guess-placeholder{height:96px}
.guess-slot{min-height:158px}
.edithead img:not(.pokemonicon){object-fit:contain}
@media(max-width:680px){
  .guess-row{grid-template-columns:repeat(3,minmax(0,1fr));gap:7px}
  .guess-tile strong{font-size:12px}.guess-tile small{font-size:10px}
}
@media(max-width:600px){
  .connection-tile{min-height:118px}.connection-tile img{height:80px}
  .turn-roster{grid-template-columns:repeat(2,minmax(0,1fr))}
  .turn-roster img{height:80px}.turn-roster strong{font-size:10px}
}

/* Shared appearance control; light remains the original default. */
:root{color-scheme:light;--danger:#ba7052;--error:#b25744}
header{gap:12px;flex-wrap:wrap}
header>.brand{flex-shrink:0}
.theme-toggle{display:inline-flex;flex:none;align-items:center;gap:8px;min-height:40px;padding:8px 12px;border:1px solid var(--line);border-radius:99px;font-size:11px;white-space:nowrap;background:#fff5}
.theme-toggle svg{height:16px;width:16px;flex:none}
.theme-toggle .theme-moon{display:none}
.theme-switch-track{width:28px;height:16px;border-radius:99px;background:#c8d1c2;padding:2px}
.theme-switch-track>span{display:block;width:12px;height:12px;background:#fff;border-radius:50%;box-shadow:0 1px 3px #0003;transition:transform .18s ease}
.theme-toggle:hover:not(:disabled){transform:none}
@media(max-width:760px){header .header-note{display:none}}
@media(max-width:620px){
  header>.brand{margin-right:auto}header>.theme-toggle{order:1}
  header>nav{order:2;width:100%}header>.theme-toggle{min-height:40px}
}

/* Emerald night. The reference mint/emerald palette supplies the accents. */
html[data-theme=dark]{
  color-scheme:dark;
  --bg:#090f0d;--ink:#eaf5ef;--muted:#a2b7ac;--line:#2b4438;
  --green:#83d6b2;--gold:#f0ce79;--danger:#f49c8a;--error:#ffb1a2;
  --surface:#111d17;--surface-raised:#182a21;--surface-hover:#203b2d;
  --accent:#59c79a;--emerald:#14ae74;--accent-ink:#06281b;
  --soft-green:#173d2d;--soft-yellow:#4a3b16;--soft-red:#452725;
  --card-shadow:0 16px 44px #0003,0 1px 0 #c8ffe608 inset;
}
html[data-theme=dark] body{
  min-height:100vh;
  background:radial-gradient(ellipse 70% 460px at 50% -80px,#1c634538,transparent 85%),radial-gradient(ellipse 50% 700px at 100% 60%,#13432e1a,transparent),var(--bg);
}
html[data-theme=dark] ::selection{background:#59c79a55;color:#fff}
html[data-theme=dark] *{scrollbar-color:#426851 #101d16}
html[data-theme=dark] header{border-bottom-color:#31534080}
html[data-theme=dark] .brand{color:#edf9f2}
html[data-theme=dark] .brand i{color:var(--accent);text-shadow:0 0 12px #59c79ab3}
html[data-theme=dark] .theme-toggle{background:#15291f;border-color:#36634b;color:#bcebd3;box-shadow:0 0 18px #2aad7012}
html[data-theme=dark] .theme-toggle .theme-sun{display:none}
html[data-theme=dark] .theme-toggle .theme-moon{display:block}
html[data-theme=dark] .theme-switch-track{background:#2a7650}
html[data-theme=dark] .theme-switch-track>span{transform:translateX(12px);background:#a9edcc;box-shadow:0 0 7px #83d6b270}
html[data-theme=dark] .intro h1{color:#f0faf4;text-shadow:0 2px 30px #59c79a12}
html[data-theme=dark] :is(button,a){-webkit-tap-highlight-color:#59c79a22}
html[data-theme=dark] button:hover:not(:disabled),html[data-theme=dark] header .section-link:hover{background:var(--surface-hover)}
html[data-theme=dark] :is(button,a,input,select,textarea,summary):focus-visible{outline:2px solid #a4ebc7;outline-offset:3px;box-shadow:0 0 0 5px #59c79a19}
html[data-theme=dark] :is(input,select,textarea){background:#0c1811;color:var(--ink);border-color:#42624e;caret-color:#83d6b2}
html[data-theme=dark] :is(input,textarea)::placeholder{color:#91a79b;opacity:1}
html[data-theme=dark] option{background:#111d17;color:var(--ink)}
html[data-theme=dark] button:disabled{opacity:.55}
html[data-theme=dark] .primary,
html[data-theme=dark] .primary:hover:not(:disabled),
html[data-theme=dark] .animation-options button[aria-pressed=true]{
  color:var(--accent-ink);border-color:#78d4a8;
  background:linear-gradient(125deg,#83d6b2,#59c79a 53%,#14ae74);
  box-shadow:0 3px 16px #14ae7426,0 1px 0 #d4ffeb73 inset;
}
html[data-theme=dark] .primary:hover:not(:disabled){filter:brightness(1.08);box-shadow:0 4px 24px #14ae7440}
html[data-theme=dark] .generation-toggle{background:#0e1b14;border-color:#2d4c39;box-shadow:0 6px 24px #0002}
html[data-theme=dark] .generation-toggle a{color:#b7ccbe}
html[data-theme=dark] .generation-toggle a[aria-current=page]{color:#baf1d3;background:linear-gradient(125deg,#224d36,#153b28);box-shadow:inset 0 0 0 1px #427953,0 0 18px #14ae7414}
html[data-theme=dark] .game-navigation a{color:#b2c7ba}
html[data-theme=dark] .game-navigation a:hover{background:#162b1e}
html[data-theme=dark] .game-navigation a[aria-current=page]{color:#baf1d3;background:#1a3b28;box-shadow:0 0 0 1px #315c40 inset}
html[data-theme=dark] :is(.game-nav-label,.header-note){color:var(--muted)}
html[data-theme=dark] .eyebrow span{border-color:#396449;background:#153323;color:#98dfb8}
html[data-theme=dark] .pill{background:#3d3219;color:#f0ce79}
html[data-theme=dark] .dot{box-shadow:0 0 10px #59c79a70}

/* Cards and the battle surface. */
html[data-theme=dark] :is(.battle,.rivalbox,.attemptspanel,.savedteam,.turnrecap,.guess-editor,.guess-result,.puzzle-result,.player-round,.player-empty,.turn-team){
  border-color:var(--line);background:linear-gradient(145deg,#17291e,#111d17 60%);box-shadow:var(--card-shadow);border-radius:14px;
}
html[data-theme=dark] .battle{background:radial-gradient(ellipse at 50% 45%,#224c3238,transparent 80%),linear-gradient(145deg,#14281d,#101d16);border-color:#375a43;box-shadow:0 18px 60px #0003,0 0 28px #14ae740a,0 1px 0 #83d6b21a inset}
html[data-theme=dark] .battle:before{background-image:radial-gradient(#7cbe962e .7px,transparent .7px);background-size:18px 18px;opacity:.45}
html[data-theme=dark] :is(.sprite,.connection-tile img,.turn-roster img,.guess-slot img){filter:drop-shadow(0 6px 5px #0004)}
html[data-theme=dark] .versus{color:#8ca696}
html[data-theme=dark] .mysterysprite{color:#6e947d;text-shadow:0 0 35px #59c79a15}
html[data-theme=dark] .hp{background:#293d30}
html[data-theme=dark] .hp>i{box-shadow:0 0 8px #83d6b245}
html[data-theme=dark] :is(.opponent-team-top,.battle-team-indicators){border-color:#31503c}
html[data-theme=dark] .rosterrow .lead{background:#193a27;color:#a8e6c2}
html[data-theme=dark] :is(.move,.observedmoves li,.switchicon,.teamslots button,.archivelist>a,.classiclink){background:#14251a;border-color:#35543f}
html[data-theme=dark] :is(.move,.switchicon,.teamslots button,.archivelist>a,.classiclink):hover:not(:disabled){background:#213e2c;border-color:#5b9270}
html[data-theme=dark] .switchicon.isactive,html[data-theme=dark] .teamslots button.selected{background:#1e4730;box-shadow:inset 0 0 0 1px #568b66;border-color:#6ca780}
html[data-theme=dark] .switchicon:disabled{opacity:1}
html[data-theme=dark] .switchicon:disabled:not(.isactive){background:#111b15;border-color:#2a3b30}
html[data-theme=dark] :is(.knockedout small,.knockedout .minihealth){color:#9daa9f}
html[data-theme=dark] .komark{color:#f49c8a}
html[data-theme=dark] .animation-options{border-color:#3d5e48}
html[data-theme=dark] .animation-options button+button{border-color:#3d5e48}
html[data-theme=dark] .liveevent{background:#193b28;border-color:#3b6b4c;color:#c2eed3}
html[data-theme=dark] .recapheading{border-color:var(--line)}
html[data-theme=dark] :is(.recap-event,.recap-event small){color:#b3c5b9}
html[data-theme=dark] .recap-event.recap-move.p1{color:#9be6bc}
html[data-theme=dark] .recap-event.recap-move.p2{color:#f0ce79}
html[data-theme=dark] .recap-faint{color:#ffb1a2}
html[data-theme=dark] .recap-marker{color:#8caf99}
html[data-theme=dark] .teamcolumn #edit{background:linear-gradient(130deg,#72dcc6,#42bda3);border-color:#8de4cb;color:#072d23;box-shadow:0 3px 15px #42bda31c}
html[data-theme=dark] .teamcolumn #edit:hover:not(:disabled){background:#8ee6ce;color:#072d23}
html[data-theme=dark] .teamcolumn #edit:disabled{background:#233f34;border-color:#3b5f4c;color:#b1cbbb;box-shadow:none}
html[data-theme=dark] .mechanic-control select{background:#173725;border-color:#4d805e;color:#bcebd0}
html[data-theme=dark] .tile.live{background:#1c3b28;border-color:#78ba91;color:#bcebd0}
html[data-theme=dark] .tile{border-color:#3c5443}

/* Dialogs, team editor, help and archives. */
html[data-theme=dark] dialog{background:#111e16;border-color:#41654c;box-shadow:0 30px 90px #0009,0 0 30px #14ae740d}
html[data-theme=dark] dialog::backdrop{background:#030a07b8;backdrop-filter:blur(8px)}
html[data-theme=dark] dialog :is(p,li){color:#b1c6b9}
html[data-theme=dark] :is(.sharetext,main>details pre){background:#0b1710;color:#d3e9db;border:1px solid #2c4834}
html[data-theme=dark] :is(.archivebanner,.puzzle-help){background:#132a1b;border-color:#31563c;color:#afcdb9}
html[data-theme=dark] :is(.puzzle-help summary,.puzzle-help p){color:#bdd6c7}
html[data-theme=dark] .savebar{background:#111e16}
html[data-theme=dark] #specieslist{background:#0f1b13}
html[data-theme=dark] #specieslist b{color:#b5e7c8;background:#213d29}
html[data-theme=dark] .budgettrack{background:#293d2c}
html[data-theme=dark] .moveseditor small{color:#a7bdae}
html[data-theme=dark] #teampaste{background:#0b1710;color:var(--ink);border-color:#3b5e45}
html[data-theme=dark] :is(#editerror,#teampasteerror,.save-warning,#guessmessage,#savemessage){color:#ffb1a2}
html[data-theme=dark] :is(.randomizetools button,.buildertoolbar button){border-color:#42694e}
html[data-theme=dark] .sethint a{color:#98dfb8}
html[data-theme=dark] :is(.guess-archive a,.connections-archive a,.turn-archive a,#player-archive-links a){background:#13251a;border-color:#304d39;color:#c4dccd}
html[data-theme=dark] :is(.guess-archive a,.connections-archive a,.turn-archive a,#player-archive-links a)[aria-current=page]{background:#1b3a27;border-color:#659d78;color:#c0efd2}

/* Daily team guessing and player guessing. */
html[data-theme=dark] :is(.guess-slot,.player-choices button){background:#16281c;border-color:#36553e}
html[data-theme=dark] :is(.guess-slot,.player-choices button)[aria-pressed=true]{background:#234832;border-color:#83d6b2;box-shadow:inset 0 0 0 1px #83d6b266}
html[data-theme=dark] .pokemon-choices button{color:var(--ink)}
html[data-theme=dark] .pokemon-choices button[aria-pressed=true]{background:#203f2b;border-color:#609e75}
html[data-theme=dark] .pokemon-choices button.picker-lead,html[data-theme=dark] .picker-mark-lead{background:#4a3b16;color:#ffe098}
html[data-theme=dark] .pokemon-choices button.picker-lead:hover{background:#5b481b}
html[data-theme=dark] :is(.picker-absent .pokemon-choice-name,.picker-mark-absent){text-decoration-color:#e6ede8}
html[data-theme=dark] :is(.picker-correct .pokemon-choice-name,.picker-mark-correct){text-decoration-color:#83d6b2}
html[data-theme=dark] .picker-divider{border-color:#40634b;color:#b4cebe}
html[data-theme=dark] .daily-team-tabs a{background:#13251a;border-color:#36553e;color:#c7dfd0}
html[data-theme=dark] .daily-team-tabs a[aria-current=page]{background:linear-gradient(130deg,#21452e,#183523);border-color:#58966e;box-shadow:0 0 20px #14ae7410,inset 0 0 0 1px #58966e55}
html[data-theme=dark] .guess-result .answer-tile{background:#162a1d;border-color:#3b5c45;color:var(--ink)}
html[data-theme=dark] .player-progress>span{background:#14241a;color:#b8cdbf;border-color:#36543f}
html[data-theme=dark] .player-progress>span[aria-current=step]{outline-color:#83d6b2;background:#244831;color:#bdf3d4;box-shadow:0 0 16px #14ae741a}
html[data-theme=dark] .player-progress>span.guess-missed{background:#452725;color:#ffb1a2;border-color:#7c4940}
html[data-theme=dark] :is(.player-recap article,#player-history-list li){background:#13251a;border-color:#35533e}
html[data-theme=dark] .player-already-guessed{opacity:.65}

/* Connections: selection, tentative categories, and four distinct solved colors. */
html[data-theme=dark] .connection-tile{background:linear-gradient(145deg,#1c3022,#14261a);border:1px solid #35543e;box-shadow:0 4px 12px #0002;color:#e6f5ec}
html[data-theme=dark] .connection-tile:hover:not(:disabled){background:#254630;border-color:#659b76;box-shadow:0 4px 20px #14ae7414}
html[data-theme=dark] .connection-tile[aria-pressed=true],html[data-theme=dark] .connection-tile[aria-pressed=true]:hover{background:linear-gradient(140deg,#2c6140,#245235);border:1px solid #83d6b2;color:#f0fff6;box-shadow:0 0 0 1px #83d6b250 inset,0 0 20px #14ae7426}
html[data-theme=dark] .mistake-dots i{border-color:#556a5a}
html[data-theme=dark] .mistake-dots i.remaining{background:#83d6b2;border-color:#83d6b2;box-shadow:0 0 7px #83d6b235}
html[data-theme=dark] .solved-group{border:1px solid transparent}
html[data-theme=dark] .group-yellow{background:#4a3b16;color:#ffe098;border-color:#9c8140}
html[data-theme=dark] .group-green{background:#194b35;color:#b9f5d8;border-color:#4b916a}
html[data-theme=dark] .group-blue{background:#1f3e52;color:#bcdffa;border-color:#507e9b}
html[data-theme=dark] .group-purple{background:#3b2c53;color:#dfc7ff;border-color:#82619d}
html[data-theme=dark] [data-note=A]{--note-color:#658caa;--note-bg:#1a2e3e}
html[data-theme=dark] [data-note=B]{--note-color:#b18cab;--note-bg:#39283a}
html[data-theme=dark] [data-note=C]{--note-color:#67aaa0;--note-bg:#193731}
html[data-theme=dark] [data-note=D]{--note-color:#b69c65;--note-bg:#3b321c}
html[data-theme=dark] .connection-tile[data-note]:not([aria-pressed=true]){background:var(--note-bg);border-color:var(--note-color)}
html[data-theme=dark] .tentative-badge{color:#08130d}
html[data-theme=dark] .tentative-group{background:var(--note-bg);color:var(--ink)}
html[data-theme=dark] .tentative-actions button{background:#15231a}

/* Five turns, including editor feedback after each attempt. */
html[data-theme=dark] .turn-team{border-top-color:#6cba8b}
html[data-theme=dark] .turn-team:last-child{background:linear-gradient(145deg,#26281a,#181e14);border-color:#51513a;border-top-color:#d1b66d}
html[data-theme=dark] .turn-field{background:#14251a;border-color:#3d5a46}
html[data-theme=dark] .turn-field :is(input,select){background:#0b1710;border-color:#48634e;color:var(--ink)}
html[data-theme=dark] .turn-field :is(input,select):focus-visible{outline-color:#a4ebc7}
html[data-theme=dark] :is(.turn-attempt,.empty-history,.guess-empty){background:#111f16;border-color:#36533e;color:#b1c9bb}
html[data-theme=dark] .turn-row>h3{color:#bad5c4}
html[data-theme=dark] .turn-result .turn-row{border-color:#36533e}

/* Readable status colors: text is light on subdued, distinct colored surfaces. */
html[data-theme=dark] :is(.feedback-green,.turn-field.feedback-green,.guess-page .correct,.player-progress>span.guess-correct,#player-history-list li.player-history-correct){background:#194b35;color:#b9f5d8;border-color:#4b916a}
html[data-theme=dark] :is(.feedback-yellow,.turn-field.feedback-yellow,.guess-page .lead){background:#4a3b16;color:#ffe098;border-color:#9c8140}
html[data-theme=dark] :is(.feedback-orange,.turn-field.feedback-orange){background:#4b321e;color:#ffc490;border-color:#a36f43}
html[data-theme=dark] :is(.feedback-gray,.turn-field.feedback-gray,.guess-page .absent){background:#29362e;color:#d2dfd5;border-color:#5f7365}
html[data-theme=dark] .green{background:#23764c!important;color:#e6ffef}
html[data-theme=dark] .gold{background:#c0a05c!important;color:#21190b}
html[data-theme=dark] .gray{background:#4e5e52!important;color:#f1f8f3}
html[data-theme=dark] :is(.puzzle-result p,.guess-result>p){color:#c0d7c8}
html[data-theme=dark] :is(.guess-legend,.lead-note,.guess-empty,.guess-slot small,#pickerhint,.pokemon-choices button small,.pokemon-choices>p,.submit-row>span,.guess-archive small,#resetnote,.picker-legend,.picker-order-hint,.daily-team-tabs small,.player-day,.player-round-meta,.player-choices button small,.player-choices>p,.player-selection,.player-empty p,#player-reset,#player-team h3,.player-earlier h3,.player-recap article>p,#player-history-list li,.connections-topline,.tentative-hint,.tentative-empty,.connections-archive small,#connections-reset,.turn-order-note,.turn-archive small,#turn-reset,.turn-legend,.turn-roster small,.turn-editor-heading,.turn-submit-row,.turn-attempt>summary,.turn-attempt>summary>span:last-child,.history-side-labels){color:var(--muted)}
html[data-theme=dark] #player-history-list li.player-history-correct{color:#b9f5d8}
html[data-theme=dark] .pokemon-choices button.picker-lead small{color:#f4d999}
html[data-theme=dark] .puzzle-message{color:#a4e8bf}

@media(prefers-reduced-motion:reduce){.theme-switch-track>span{transition:none}html[data-theme=dark] button{transition:none}}
@media(forced-colors:active){.theme-switch-track{border:1px solid ButtonText}.theme-switch-track>span{background:ButtonText}}
