/* The browser game. Fills the screen with no page scrolling, and works by
   tap or drag. Three layouts: wide (desktop, iPad landscape), short (phones
   in landscape), and tall (iPad portrait). */
.game-page,.game-page body{height:100%;margin:0;overflow:hidden;overscroll-behavior:none}
/* Windows/Linux Chrome and Edge reserve space for a scrollbar and paint it
   light by default; macOS hides it until you scroll, so this never showed
   there. Any scroll box in the game (the reward modal included) gets a
   slim dark one instead of the stray pale bar. */
.game-page *{scrollbar-width:thin;scrollbar-color:#3a3a66 transparent}
.game-page *::-webkit-scrollbar{width:9px;height:9px}
.game-page *::-webkit-scrollbar-track{background:transparent}
.game-page *::-webkit-scrollbar-thumb{background:#3a3a66;border-radius:5px}
.game-page *::-webkit-scrollbar-thumb:hover{background:#4a4a80}
.g-app{position:fixed;inset:0;display:flex;background:radial-gradient(1000px 600px at 50% 20%,#1d1d4d,#08081a);color:var(--ink);user-select:none;-webkit-user-select:none;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)}
/* Covers the whole viewport, so it has to go transparent too for the body's
   roaming sprites (site.js setupRoamers) to show through on the landing page. */
.g-app:has(.g-home-box.page-main){background:transparent}
.g-stage{flex:1;min-width:0;display:flex;flex-direction:column}

.g-top{display:flex;align-items:center;gap:6px 14px;padding:6px 10px;border-bottom:1px solid var(--line);background:rgba(8,8,26,.7);min-height:44px;flex:none}
.g-top .g-logo img{display:block;height:32px;width:auto}
.g-round{font-weight:700;white-space:nowrap}
.g-round small{display:block;font-weight:500;font-size:12px;color:#b9c4ff}
.g-stat{white-space:nowrap;font-size:14px}.g-stat b{color:var(--accent);font-size:17px}
.g-xp{width:90px;height:7px;border-radius:4px;background:#0b0b1c;overflow:hidden;margin-top:2px}.g-xp i{display:block;height:100%;background:#4f74ff}
.g-info{margin-left:auto;display:flex;gap:4px}
.g-tool{appearance:none;font:inherit;font-size:13px;font-weight:600;padding:7px 10px;border-radius:8px;border:1px solid var(--line);background:linear-gradient(180deg,#1b1b3e,#121228);color:#dfe4ff;cursor:pointer;white-space:nowrap}
.g-tool:hover:not(:disabled){border-color:#4f74ff}.g-tool:disabled{opacity:.45;cursor:default}
.g-tool[aria-pressed=true]{border-color:var(--accent);color:var(--accent)}

.g-main{flex:1;min-height:0;display:flex}
.g-left,.g-right{width:190px;flex:none;overflow-y:auto;padding:8px;display:flex;flex-direction:column;gap:10px}
.g-left h3,.g-right h3{margin:0 0 4px;font-size:13px;color:#b9c4ff}
.g-center{flex:1;min-width:0;display:flex;flex-direction:column}
.g-boardwrap{flex:1;min-height:0;display:flex;align-items:center;justify-content:center;overflow:hidden}
.g-board{position:relative;touch-action:none}
.g-syn{appearance:none;font:inherit;color:inherit;width:100%;display:flex;align-items:center;gap:6px;padding:3px 4px;background:none;border:0;border-top:1px solid var(--line-soft);cursor:pointer;text-align:left;opacity:.72}
.g-syn.live{opacity:1}.g-syn:hover{background:rgba(255,255,255,.05)}
.g-syn .type{font-size:11px;padding:0 6px}.g-syn span.n{margin-left:auto;font-size:12px;font-weight:700}.g-syn.live span.n{color:var(--good)}
.g-player{display:flex;gap:6px;align-items:center;font-size:13px;padding:3px 0;border-top:1px solid var(--line-soft)}
.g-player small{font-size:11px;color:var(--accent)}.g-player small.away{color:#e58a8a}
.g-timer.low b{color:#ff8a7a}
button.g-player{width:100%;font:inherit;font-size:13px;color:inherit;text-align:left;background:none;border-width:1px 0 0;cursor:pointer}button.g-player:hover span{color:var(--accent)}
.g-scout{position:relative;margin:8px auto}.g-scout-bench{display:flex;flex-wrap:wrap;gap:4px;justify-content:center;margin-bottom:8px}
.g-standing{display:flex;gap:10px;align-items:center;padding:4px 10px;font-size:14px;border-top:1px solid var(--line-soft)}.g-standing b{color:var(--accent);min-width:14px}.g-standing.me{font-weight:700}.g-standing small{margin-left:auto;font-size:11px;color:var(--accent)}
.g-ready:has(small){flex-direction:column;gap:2px;line-height:1.1}.g-ready small{font-size:10px;font-weight:600}
.g-lobby-code{display:grid;justify-items:center;gap:4px;text-align:center}.g-lobby-code b{font-size:38px;letter-spacing:.14em;color:var(--accent);line-height:1.1}
.g-seats{display:grid;grid-template-columns:1fr 1fr;gap:6px}
.g-seat{display:flex;gap:8px;align-items:center;min-height:46px;padding:6px 10px;border:1px solid var(--line);border-radius:8px;background:rgba(18,18,40,.8)}
.g-seat b{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px}.g-seat small{font-size:11px;color:var(--accent)}.g-seat.open{opacity:.55}.g-seat.open small{color:inherit}
.g-seat-blank{width:32px;height:32px;flex:none;border-radius:50%;border:1px dashed var(--line)}
/* Trainers on the right, as in the old players panel: icon, name, health bar, hearts, and an eye to spectate. */
.g-trs{display:grid;gap:6px}
.g-tr{display:grid;grid-template-columns:28px minmax(0,1fr) auto;grid-template-areas:"face name eye" "hp hp hp";gap:5px 6px;align-items:center;width:100%;padding:6px 7px;border-radius:10px;background:#12142a;border:1px solid var(--line);color:var(--ink);font:inherit;text-align:left}
button.g-tr{cursor:pointer}button.g-tr:hover{border-color:#6b74c9}button.g-tr:hover .g-tr-eye{color:var(--accent);background:#232a52}
.g-tr.me{background:#1a1e44;border-color:var(--accent)}
.g-tr.spied{background:#281f3e;border:2px solid #b9a4ff;padding:5px 6px}.g-tr.spied .g-tr-eye{color:#d6c9ff;background:#3a2f5c}
.g-tr-face{grid-area:face;position:relative;width:28px;height:28px;border-radius:8px;background:var(--surface-2);display:flex;align-items:center;justify-content:center;color:var(--muted)}
.g-tr-face img{width:100%;height:100%;border-radius:8px;image-rendering:pixelated}
.g-tr-ai{position:absolute;right:-5px;bottom:-4px;font:800 8.5px/1 system-ui,sans-serif;font-style:normal;color:#23180a;background:var(--accent);border-radius:4px;padding:2px 3px}.g-tr-face svg{width:22px;height:22px;fill:currentColor}
.g-tr-name{grid-area:name;display:flex;align-items:baseline;gap:4px;min-width:0;font-size:13px}
.g-tr-name b{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.g-tr-name small{flex:none;font-size:10px;font-weight:700;color:var(--accent)}.g-tr-name small.away{color:#e58a8a}
.g-tr.me .g-tr-name small:first-of-type{color:#b9c4ff}
.g-tr-eye{grid-area:eye;width:22px;height:22px;border-radius:50%;display:flex;align-items:center;justify-content:center;color:var(--muted)}.g-tr-eye svg{width:15px;height:15px;fill:currentColor}
.g-tr-eye.on{color:#d6c9ff}
.g-tr-hp{grid-area:hp;display:flex;align-items:center;gap:6px;min-width:0}
.g-tr-bar{flex:1;height:6px;border-radius:3px;background:#0b0c1e;overflow:hidden;box-shadow:inset 0 0 0 1px rgba(255,255,255,.06)}
.g-tr-bar i{display:block;height:100%;border-radius:3px;transition:width .6s ease-out}
.g-tr-tag{flex:none;font-size:10px;font-weight:700;color:var(--accent);line-height:1}.g-tr-tag.away{color:#e58a8a}
.g-tr-lives{flex:none;display:flex;align-items:center;gap:2px;font-size:13px;line-height:1}.g-tr-lives svg{width:12px;height:12px;fill:currentColor}
.g-tr.hit .g-tr-lives{animation:g-hit .6s}
@keyframes g-hit{30%{transform:scale(1.35)}}
.g-tr.out{opacity:.45}.g-tr.out .g-tr-name b{text-decoration:line-through}
#g-board.spying .gui-hex-bg,.g-arena #g-board.spying .gui-hex-bg{background:linear-gradient(180deg,rgba(78,60,130,.6),rgba(38,28,72,.66))}
.g-unit.spied{cursor:default}
.g-spybar{display:flex;align-items:center;gap:12px;flex-wrap:wrap;justify-content:center}
.g-spybar .g-tr-face{width:40px;height:40px}
.g-spybar>div{display:flex;flex-direction:column;align-items:flex-start;gap:2px}.g-spybar .btn{white-space:nowrap}
#g-menu-box .g-players{text-align:left}#g-menu-box .g-players h3{margin:6px 0 4px}
@media (prefers-reduced-motion:reduce){.g-tr-bar i{transition:none}.g-tr.hit .g-tr-lives{animation:none}}
.g-player.out{opacity:.4;text-decoration:line-through}.g-player.next{color:var(--accent);font-weight:700}.g-player b{margin-left:auto}
.g-items{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:4px}
.g-item{appearance:none;aspect-ratio:1;padding:2px;background:var(--surface-2);border:1px solid var(--line);border-radius:6px;cursor:grab;touch-action:none;display:flex;align-items:center;justify-content:center}
.g-item.sel{border-color:var(--accent);box-shadow:0 0 0 1px var(--accent)}
.g-item img{width:100%;height:100%;image-rendering:pixelated;pointer-events:none}

.g-unit{position:absolute;display:flex;align-items:center;justify-content:center;cursor:grab;touch-action:none;z-index:2}
.g-hexcell:hover .gui-hex-bg{background:linear-gradient(180deg,#3a3a7c,#23234e)}
.g-hexcell.sel .gui-hex-bg{background:linear-gradient(180deg,#a8842a,#5e4a16)}
.g-benchslot.sel{border:2px solid var(--accent);background:#3a2f12}
.g-pips{position:absolute;bottom:2px;left:0;right:0;display:flex;gap:1px;justify-content:center;pointer-events:none}
.g-pips img{width:14px;height:14px;image-rendering:pixelated}
.g-hexcell.drop .gui-hex-bg{background:linear-gradient(180deg,#3a5a3a,#1f3a24)}
.g-hex-enemy .gui-hex-bg{background:linear-gradient(180deg,#3a2233,#1f1428)}

.g-bench{flex:none;display:grid;grid-template-columns:repeat(8,minmax(0,64px));gap:5px;justify-content:center;padding:4px 8px}
.g-benchslot{position:relative;aspect-ratio:1;background:#0d0d20;border:1px dashed var(--line);border-radius:8px;display:flex;align-items:center;justify-content:center;min-width:0}
.g-benchslot .g-unit{position:absolute;inset:0}

.g-shop{flex:none;display:flex;gap:8px;padding:6px 10px 8px;background:rgba(8,8,26,.7);border-top:1px solid var(--line);position:relative;min-height:112px}
.g-shop-tools{display:flex;flex-direction:column;gap:5px;width:112px;flex:none}
.g-shop-tools .g-tool{flex:1;padding:4px 8px;line-height:1.15}
.g-tool small{display:block;font-size:11px;font-weight:500;opacity:.85;white-space:normal}
.g-cards{flex:1;min-width:0;display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:6px}
.g-cardwrap{position:relative;min-width:0;display:flex}
.g-cardwrap .gui-card{flex:1;padding:4px 3px;gap:2px;justify-content:center}
.g-cardwrap .gui-card-name{font-size:13px}
.g-card-i{position:absolute;top:4px;right:4px;width:24px;height:24px;border-radius:50%;border:1px solid var(--line);background:#0d0d20;color:#b9c4ff;font:700 13px/1 inherit;cursor:pointer;padding:0}
.g-ready{width:128px;flex:none;font-size:17px;font-weight:800}
.g-sell{position:absolute;inset:0;display:none;align-items:center;justify-content:center;background:rgba(120,30,40,.95);font-size:20px;font-weight:800;z-index:5}
.g-sell.on{display:flex}

.g-sheet{position:absolute;z-index:20;left:8px;bottom:150px;width:228px;padding:10px;background:#141430;border:1px solid var(--accent);border-radius:10px;box-shadow:0 8px 24px rgba(0,0,0,.6)}
.g-sheet h3{margin:0 0 4px}
.g-sheet .types{margin-bottom:6px}
.g-sheet-row{display:flex;gap:5px;flex-wrap:wrap;margin-top:6px}
.g-sheet-row .g-tool{flex:1 1 auto;padding:6px 7px}
.g-sheet-row .g-rotom-form{flex:0 0 auto;display:flex;align-items:center;justify-content:center;width:40px;height:40px;padding:0}
.g-held{display:flex;gap:4px;align-items:center;margin-top:4px}
.g-held button{appearance:none;width:34px;height:34px;padding:2px;background:var(--surface-2);border:1px solid var(--line);border-radius:6px;cursor:pointer}
.g-held img{width:100%;height:100%;image-rendering:pixelated}

.g-tip{position:fixed;z-index:80;width:250px;max-width:60vw;padding:9px 11px;background:#141430;border:1px solid var(--line);border-radius:10px;box-shadow:0 8px 24px rgba(0,0,0,.65);pointer-events:none;font-size:13px}
.g-tip[hidden]{display:none}
.g-tip h3,.g-sheet h3{margin:0 0 4px;font-size:15px}.g-tip h3 small,.g-sheet h3 small{font-weight:500;font-size:11px}
.g-tip p,.g-sheet p{margin:5px 0 0;line-height:1.3}
.g-stats{display:grid;grid-template-columns:repeat(3,auto);justify-content:start;gap:2px 12px;margin-top:6px;font-size:12px}.g-stats span{white-space:nowrap;color:var(--muted)}.g-stats b{color:var(--ink)}
.g-stats .up b{color:#5fd98a}.g-stats .up i{font-style:normal;font-size:10px;font-weight:700;color:#5fd98a;margin-left:1px}
.g-cost{font-weight:600;color:var(--accent)!important}
.g-evo{display:inline-flex;gap:3px;margin-left:6px;vertical-align:middle}.g-evo i{width:7px;height:7px;border-radius:50%;border:1px solid var(--accent)}.g-evo i.on{background:var(--accent)}
.g-held-row{display:flex;flex-wrap:wrap;align-items:center;gap:4px;margin-top:6px}.g-held-row img{width:20px;height:20px;image-rendering:pixelated;vertical-align:middle}
.g-held-row button{appearance:none;flex:none;width:28px;height:28px;padding:2px;background:var(--surface-2);border:1px solid var(--line);border-radius:6px;cursor:pointer}.g-held-row button img{width:100%;height:100%}
.g-eff{font-size:11px;font-weight:700;color:#5fd98a;background:rgba(95,217,138,.12);border-radius:999px;padding:1px 7px}.g-eff.bad{color:#ff8a7a;background:rgba(255,107,107,.12)}
.g-comes{font-size:12px}.g-comes b{color:var(--accent)}.g-comes span{color:var(--muted)}
.g-abil{color:var(--muted)}.g-abil b{color:var(--ink)}
.g-download-pick{color:#f0c04a;font-weight:700}
.g-none{margin:0;font-size:12px;color:var(--faint,#6f6f96)}
.g-item.empty{border-style:dashed;background:transparent;cursor:default;opacity:.5}
.g-right h3 small,.g-left h3 small{font-size:11px;color:var(--muted);font-weight:600}
.g-item-h{display:flex;align-items:center;gap:6px}.g-item-h img{width:22px;height:22px;image-rendering:pixelated}
.g-result{display:grid;grid-template-columns:repeat(auto-fit,minmax(78px,1fr));gap:6px;margin:8px 0}
.g-result>div{background:var(--surface-2);border-radius:10px;padding:8px 6px;text-align:center}
.g-result b{display:flex;align-items:center;justify-content:center;gap:4px;font-size:22px;line-height:1.1}.g-result b span{color:var(--muted);font-weight:500}
.g-result small{display:block;font-size:11px;color:var(--muted);margin-top:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.g-result .bad b{color:#ff8a7a}.g-result .good b{color:var(--accent)}.g-result .g-mvp b{font-size:16px}
.g-why{margin:0 0 10px}
h2.g-won{color:var(--accent)}h2.g-lost{color:#ff8a7a}
.g-bp{opacity:.7}.g-bp.on{opacity:1;color:var(--good)}
.g-syn-head{display:flex;align-items:center;gap:6px}
.g-syn-dot{width:9px;height:9px;border-radius:50%;flex:none;display:inline-block}
.g-syn-head small{margin-left:auto;font-weight:500}
.g-bp-row{display:flex;align-items:flex-start;gap:6px;margin-top:6px;opacity:.55}
.g-bp-row.on,.g-bp-row.hot{opacity:1}
.g-bp-dot{width:17px;height:17px;border-radius:50%;flex:none;display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:700;background:#2a2a52;color:var(--muted);margin-top:1px}
.g-bp-desc{display:block;font-size:11px;opacity:.8;margin-top:1px}
.g-syn-mons{display:flex;flex-wrap:wrap;gap:3px;margin-top:4px}
.g-syn-mon{width:24px;height:24px;border-radius:5px;background:#0b0b1c;border:1px solid var(--line-soft);display:flex;align-items:center;justify-content:center;opacity:.35;overflow:hidden}
.g-syn-mon.owned{opacity:1;border-color:var(--accent)}
.g-fx{position:absolute;z-index:9;image-rendering:pixelated;background-repeat:no-repeat;pointer-events:none}
.g-ghost{position:fixed;z-index:60;pointer-events:none;transform:translate(-50%,-60%);opacity:.9}

.g-toast{position:fixed;z-index:70;left:50%;top:56px;transform:translateX(-50%);padding:8px 14px;border-radius:8px;background:#23234e;border:1px solid var(--line);font-weight:600;opacity:0;transition:opacity .2s;pointer-events:none;max-width:90vw;text-align:center}
.g-toast.on{opacity:1}.g-toast.bad{background:#4a1f28;border-color:#a33}

.g-modal{position:fixed;inset:0;z-index:68;background:rgba(4,4,16,.72);display:flex;align-items:center;justify-content:center;padding:10px}
.g-menu{z-index:75}
.g-home[hidden]{display:none}
.g-menu .btn{display:block;width:100%;margin-top:8px}
.g-modal[hidden],.g-drawer[hidden],.g-sheet[hidden]{display:none}
.g-modal-box{max-width:620px;width:100%;max-height:100%;overflow:auto;text-align:center}
.g-modal-box h2{margin-top:0}
.g-choices{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:8px;margin:10px 0}
.g-choice{appearance:none;font:inherit;color:inherit;padding:10px;border-radius:10px;border:1px solid var(--line);background:var(--surface-2);cursor:pointer;display:flex;flex-direction:column;align-items:center;gap:4px}
@media (hover:hover){.g-choice:hover{border-color:#6b74c9}}
.g-choice{position:relative}
.g-choice[aria-pressed=true]{border-color:var(--accent);background:#2e2754;box-shadow:0 0 0 2px var(--accent)}
.g-pick{position:absolute;top:-8px;right:-8px;width:22px;height:22px;border-radius:50%;background:var(--accent);color:#23180a;font:800 12px/22px system-ui,sans-serif;font-style:normal;text-align:center;box-shadow:0 2px 6px #0008}
.g-evolves{font-size:11px;font-weight:800;color:#23180a;background:#5fd98a;border-radius:999px;padding:1px 8px}
.g-pool{display:inline-block;margin-left:6px;font-size:10.5px;font-weight:700;color:var(--muted);border:1px solid var(--line);border-radius:999px;padding:0 6px;vertical-align:middle}
.g-pool.low{color:#f0c04a;border-color:#6b5a22}.g-pool.out{color:#ff8a7a;border-color:#6b2f2a}
.g-choice small{opacity:.8}
.g-coin{font-size:26px;font-weight:800;color:var(--accent)}
.g-types{display:flex;flex-wrap:wrap;gap:6px;justify-content:center}
.g-types button{appearance:none;background:none;border:0;padding:0;cursor:pointer}

/* Info panel: covers the board area only. Top bar and shop stay put and live,
   and the real board and synergies sit in a rail beside it. */
.g-app{--rail:clamp(230px,30vw,380px);--it:44px;--ib:0px;--ir:0px;--idt:44px;--area:100vh}
.g-drawer{position:fixed;z-index:50;top:var(--idt);bottom:var(--ib);right:var(--ir);left:var(--rail);display:flex;flex-direction:column;background:#0b0b1c;border-left:1px solid var(--accent);box-shadow:-6px 0 18px rgba(0,0,0,.5);animation:g-in .12s ease-out}
@keyframes g-in{from{opacity:0}to{opacity:1}}
.g-app.info .g-center{position:fixed;z-index:51;left:0;width:var(--rail);top:var(--it);height:calc(var(--area) * .62);background:#0b0b1c}
.g-app.info .g-left{position:fixed;z-index:51;left:0;width:var(--rail);top:calc(var(--it) + var(--area) * .62);height:calc(var(--area) * .38);background:#0b0b1c;border-top:1px solid var(--line)}
.g-app.info .g-right{display:none}
.g-app.info .g-bench{grid-template-columns:repeat(8,minmax(0,1fr));gap:2px;padding:2px 4px}
.g-app.no-game .g-drawer{z-index:66;inset:0;left:0;right:0;top:0;bottom:0;border:0}
.g-drawer-top{display:flex;gap:4px;padding:6px;align-items:center;border-bottom:1px solid var(--line)}
.g-info-tabs{flex:1;min-width:0;display:flex;gap:4px;overflow-x:auto}
.g-drawer iframe{flex:1;width:100%;border:0;background:#0b0b1c}

/* Battle */
.g-actor{position:absolute;display:flex;align-items:center;justify-content:center;z-index:3;cursor:pointer}
.g-actor.moving{transition:left var(--step) linear,top var(--step) linear}
.g-sprite{position:absolute;image-rendering:pixelated;pointer-events:none;background-repeat:no-repeat}
.g-bars{position:absolute;top:-2px;left:12%;right:12%;pointer-events:none}
.g-bar{height:5px;background:#000;border:1px solid #000;border-radius:2px;overflow:hidden;position:relative}
.g-bar i{display:block;height:100%;background:#5fd98a;transition:width .12s linear}
.g-actor.b .g-bar i{background:#ff6b6b}
.g-bar .sh{position:absolute;right:0;top:0;bottom:0;background:#fff;opacity:.8}
.g-mana{height:3px;background:#000;margin-top:1px}.g-mana i{display:block;height:100%;background:#6db0ff}
.g-actor.ko{opacity:0;transition:opacity .35s,transform .35s;transform:translateY(8px)}
.g-flash{position:absolute;inset:0;z-index:8;pointer-events:none;background:#c9a24a;opacity:.25;animation:g-fade .35s forwards}
@keyframes g-fade{to{opacity:0}}
.g-watch{flex:1;display:flex;align-items:center;gap:8px;flex-wrap:wrap;justify-content:center}
.g-watch b{font-size:16px}

/* Short screens: phones held sideways. The shop becomes a side column. */
@media (max-height:520px){
  .g-top{min-height:36px;padding:2px 6px;gap:8px}
  .g-top .g-logo{display:none}
  .g-round{font-size:13px}.g-round small{display:inline;margin-left:5px}
  .g-stat{font-size:12px}.g-stat b{font-size:14px}.g-xp{width:50px}
  .g-tool{font-size:11px;padding:4px 6px}
  .g-left{width:112px;padding:4px;gap:6px}
  .g-right{display:none}
  .g-left .g-players{display:none}
  .g-bench{grid-template-columns:repeat(8,minmax(0,38px));gap:3px;padding:2px}
  .g-benchslot .mon-icon{transform:scale(.8)}
  .g-stage{position:relative}
  .g-shop{position:absolute;right:0;top:36px;bottom:0;width:186px;flex-direction:column;padding:4px;border-top:0;border-left:1px solid var(--line);min-height:0;gap:3px}
  .g-stage.battling .g-shop{height:auto;bottom:auto}
  .g-main{margin-right:186px}
  .g-stage.battling .g-main{margin-right:0}
  .g-shop-tools{flex-direction:row;width:auto;flex:none;gap:3px}
  .g-shop-tools .g-tool{padding:5px 3px;font-size:10px;min-width:0}
  .g-cards{grid-template-columns:1fr;gap:2px;grid-auto-rows:minmax(0,1fr);min-height:0}
  .g-cardwrap .gui-card{flex-direction:row;padding:0 22px 0 2px;gap:4px;border-top-width:1px;border-left:3px solid #8a8aa8;text-align:left;justify-content:flex-start;overflow:hidden}
  .g-cardwrap .gui-card.tier-2{border-left-color:#5fd98a}.g-cardwrap .gui-card.tier-3{border-left-color:#4f74ff}.g-cardwrap .gui-card.tier-4{border-left-color:#c77dff}.g-cardwrap .gui-card.tier-5{border-left-color:var(--accent)}
  .g-cardwrap .mon-icon{transform:scale(.72);margin:-6px}
  .g-cardwrap .gui-card-name{font-size:11px;line-height:1.1}
  .g-cardwrap .types{display:none}
  .g-cardwrap .gui-gold{font-size:11px;margin-left:auto;white-space:nowrap;flex:none}
  .g-cardwrap .gui-card-item{position:static;flex:none;width:20px;height:20px;margin-left:auto;border-radius:5px}.g-cardwrap .gui-card-item img{width:16px;height:16px}
  .g-cardwrap .gui-card-item + .gui-gold{margin-left:4px}
  .g-cardwrap .gui-card-name{overflow-wrap:normal;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
  .g-card-i{width:18px;height:18px;font-size:10px;top:50%;margin-top:-9px;right:2px}
  .g-ready{width:auto;font-size:14px;padding:6px;flex:none}
  .g-sheet{left:4px;bottom:4px;top:auto;width:200px;padding:6px;font-size:12px}
  .g-sheet .g-stats,.g-sheet p{display:none}
  .g-app{--rail:200px}
  .g-drawer-top{padding:3px}
  .g-modal-box{padding:10px}
}
.g-stage{overflow:hidden}
@media (max-width:1100px){
  .g-left,.g-right{width:150px}
  .g-info .g-tool.opt{display:none}
}
/* Phones held upright: ask them to turn it. */
.g-rotate{display:none;position:fixed;inset:0;z-index:90;background:#08081a;align-items:center;justify-content:center;text-align:center;padding:30px}
.g-rotate b{display:block;color:var(--accent);font-size:22px;margin-bottom:6px}
@media (orientation:portrait) and (max-width:640px){.g-rotate{display:flex}}
/* iPads held upright: side columns stay narrow. */
@media (orientation:portrait) and (min-width:641px){
  .g-left,.g-right{width:128px}
  .g-shop-tools{width:92px}.g-ready{width:92px;font-size:15px}
}

/* The game's menus */
.g-home{position:fixed;inset:0;z-index:65;display:flex;flex-direction:column;background:radial-gradient(1000px 600px at 50% 20%,#1d1d4d,#08081a)}
/* On the landing page, let the body's own roaming sprites (site.js
   setupRoamers) show through behind the logo and buttons. */
.g-home:has(.g-home-box.page-main){background:transparent}
body[data-page=game] .roamer{opacity:.7}
.g-home-bar{flex:none;display:flex;align-items:center;gap:6px;padding:6px 10px;padding-top:max(6px,env(safe-area-inset-top));border-bottom:1px solid var(--line);background:rgba(8,8,26,.7)}
.g-home-bar[hidden]{display:none}
.g-home-links{flex:1;min-width:0;display:flex;gap:4px;justify-content:center;overflow-x:auto}
/* Equal-width flanks so the centered links actually land in the middle of
   the bar, regardless of Back vs. Settings+profile being different widths. */
.g-home-side{flex:1;min-width:0;display:flex;align-items:center;gap:6px}
.g-home-side-r{justify-content:flex-end}
.g-home-scroll{flex:1;min-height:0;overflow-y:auto;display:flex;justify-content:center;padding:14px}
.g-home-box{width:100%;max-width:560px;display:flex;flex-direction:column;gap:8px;margin:auto 0}
.g-home-box.page-main{max-width:360px;gap:10px}
.page-main .g-row{text-align:center}.page-main .g-row b{justify-content:center;font-size:17px}
.g-home h1{margin:0;font-size:24px}.g-home h3{margin:10px 0 0;font-size:14px;color:#b9c4ff}
.g-home-logo{text-align:center}.g-home-logo img{height:120px;width:auto;max-width:80%}
.g-home-head{display:flex;gap:10px;align-items:center}
.g-home-main{display:flex;flex-direction:column;gap:8px}
.g-home-play{width:100%}
.g-row{appearance:none;font:inherit;color:var(--ink);width:100%;padding:11px 13px;display:block;text-align:left;background:linear-gradient(180deg,#1b1b3e,#121228);border:1px solid var(--line);border-radius:10px;cursor:pointer}
.g-row:hover{border-color:#4f74ff}
.g-row b{display:flex;gap:8px;align-items:center;color:#dfe4ff}.g-row small{display:block;margin-top:2px;font-size:13px;opacity:.8}
.g-toggle i{margin-left:auto;font-style:normal;color:var(--muted,#9090b4)}.g-toggle[aria-pressed=true] i{color:var(--good)}
.g-profile{appearance:none;font:inherit;font-weight:600;color:#dfe4ff;display:flex;gap:8px;align-items:center;padding:4px 12px 4px 4px;border-radius:20px;border:1px solid var(--line);background:var(--surface-2);cursor:pointer;min-height:40px}
.g-profile span{padding-left:6px}
.g-profile .portrait{border-radius:50%}
.g-panel{padding:12px;border:1px solid var(--line);border-radius:10px;background:rgba(18,18,40,.8)}
.g-panel h3{margin:0}.g-panel p{margin:3px 0 8px}
.g-panel .btn{width:100%}
.g-join{display:flex;gap:6px;margin-top:6px}.g-join input{flex:1;min-width:0;font:inherit;font-size:16px;padding:9px 11px;border:1px solid var(--line);border-radius:8px;background:#0b0b1c;color:var(--ink);text-transform:uppercase}.g-join .btn{width:auto}
.g-signin{display:flex;gap:8px;align-items:center;justify-content:space-between;padding:9px 12px;border:1px solid var(--accent);border-radius:10px;font-size:14px}
.g-base{min-height:90px;justify-content:flex-end;background-size:cover}
.g-base.b0{background:linear-gradient(180deg,#5aa86a,#2f6b45)}.g-base.b1{background:linear-gradient(180deg,#2f6b45,#143a26)}.g-base.b2{background:linear-gradient(180deg,#4f9ad6,#1e4f86)}
@media (max-height:520px){
  .g-home-logo img{height:64px}
  .g-lobby-code{grid-auto-flow:column;align-items:center;gap:12px;padding:6px 12px}.g-lobby-code b{font-size:24px}
  .g-seat{min-height:0;padding:3px 8px}
  .g-home-bar{padding:3px 6px;gap:4px}
  .g-home-scroll{padding:6px 14px}
  .g-profile{min-height:30px}
  .g-home-box{gap:5px}
  .g-home .btn.lg{padding:8px 20px}
  .g-row{padding:7px 10px}
}
a.g-tool{text-decoration:none}
.g-home-bar .g-profile{font-size:13px;min-height:32px;padding:2px 10px 2px 2px}
.g-home-bar .g-profile span{padding-left:6px}

/* Same panels as the menus */
.g-left>div,.g-right>div{padding:9px;border:1px solid var(--line);border-radius:10px;background:rgba(18,18,40,.8)}
.g-cardwrap .gui-card{border-radius:10px}
.g-benchslot{background:rgba(18,18,40,.8);border-color:var(--line)}

/* Sandbox */
.g-stage.sandbox .g-bench{display:none}
.g-stage.sandbox .g-left{width:220px;overflow:hidden}
.g-stage.sandbox .g-shop{min-height:0}
.g-sb-roster{display:flex;flex-direction:column;gap:6px;flex:1;min-height:0}
.g-sb-roster input,.g-sb-roster select{font:inherit;font-size:14px;padding:6px 8px;border:1px solid var(--line);border-radius:8px;background:#0b0b1c;color:var(--ink);width:100%;min-width:0}
.g-sb-list{flex:1;min-height:0;overflow-y:auto;display:flex;flex-direction:column;gap:2px;user-select:none}
.g-sb-mon{appearance:none;font:inherit;font-size:13px;color:inherit;display:flex;align-items:center;gap:6px;padding:2px 6px;background:none;border:1px solid transparent;border-radius:6px;cursor:grab;text-align:left}
.g-sb-mon:hover{background:rgba(255,255,255,.06)}.g-sb-mon.sel{border-color:var(--accent);background:#3a2f12}
.g-sb-mon *{pointer-events:none}
.g-sb-tabs{display:flex;gap:3px;margin-bottom:4px}.g-sb-tabs .g-tool{flex:1}
.g-sb-controls{flex:1;min-width:0;display:flex;flex-wrap:wrap;gap:6px;align-items:stretch}
.g-sb-controls .g-tool{flex:1 1 100px;padding:6px 8px;line-height:1.15}
.g-stage.sandbox .g-sheet{}
.g-sheet .g-types{gap:3px;justify-content:flex-start;margin-top:4px}.g-sheet .g-types .type{font-size:10px;padding:0 5px}
@media (max-height:520px){
  .g-stage.sandbox .g-left{width:170px}
  .g-sb-roster{gap:3px}.g-sb-roster input,.g-sb-roster select{font-size:12px;padding:3px 5px}
  .g-sb-mon{font-size:11px;padding:0 3px}
  .g-sb-controls{gap:3px;flex-direction:row;align-content:flex-start}
  .g-sb-controls .g-tool{flex:1 1 80px;padding:4px;font-size:11px}
  .g-stage.sandbox .g-shop{justify-content:space-between}
}
.g-cardwrap.target .gui-card{border-color:#5fd98a;box-shadow:0 0 0 1px #5fd98a,0 0 10px rgba(95,217,138,.45)}

/* guided tutorial */
.g-tut{position:fixed;z-index:72;top:54px;left:50%;transform:translateX(-50%);width:min(440px,92vw);padding:12px 14px;background:#141430;border:1px solid var(--accent);border-radius:10px;box-shadow:0 6px 24px rgba(0,0,0,.6);font-size:14px}
.g-tut[hidden]{display:none}.g-tut p{margin:0 0 8px;line-height:1.35}
.g-tut-row{display:flex;align-items:center;gap:8px}.g-tut-row .btn{margin-left:auto;padding:6px 16px;font-size:14px}.g-tut-row .small{white-space:nowrap}
.tut-target{outline:2px solid var(--accent);outline-offset:2px;border-radius:8px;animation:tut-pulse 1.4s ease-in-out infinite}
@keyframes tut-pulse{50%{outline-color:rgba(255,210,63,.25)}}
@media (prefers-reduced-motion:reduce){.tut-target{animation:none}}
@media (max-height:520px){.g-tut{top:40px;left:6px;right:auto;transform:none;width:232px;padding:8px 10px;font-size:12px}.g-tut.center{left:50%;transform:translateX(-50%);width:min(330px,60vw)}.g-tut-row .btn{padding:4px 10px;font-size:12px}}
.g-menu .g-logs{opacity:.8;font-size:13px}
/* damage meter during battle */
.g-meter{margin-top:8px}.g-meter:empty{display:none}
.g-meter-head{display:flex;flex-wrap:wrap;gap:0 6px;width:100%;justify-content:space-between;align-items:baseline;text-align:left;font:inherit;font-size:13px;font-weight:700;color:var(--accent);background:none;border:0;padding:0 0 4px;cursor:pointer}
.g-meter-head small{font-weight:500;font-size:11px;color:var(--muted,#9aa3c7)}
.g-meter-row{position:relative;display:flex;align-items:center;justify-content:space-between;gap:6px;font-size:12px;padding:4px 6px;margin:3px 0;border-radius:4px;overflow:hidden;min-height:24px}
.g-meter-row span,.g-meter-row b{position:relative;z-index:1}.g-meter-row b{font-variant-numeric:tabular-nums}
.g-meter-row span{display:flex;align-items:center;gap:5px;overflow:hidden;text-overflow:ellipsis}
.g-meter-row i{position:absolute;left:0;top:0;bottom:0;background:rgba(255,210,63,.22)}.g-meter-row.ko{opacity:.5}
/* your Pokemon above the enemy's where they overlap */
.g-actor.b{z-index:2}.g-actor.a{z-index:4}
/* the battle details card */
.g-sheet.g-card{width:300px;max-height:calc(100% - 24px);overflow-y:auto;bottom:auto;top:12px;z-index:30}
.g-card-head{display:flex;align-items:flex-start;justify-content:space-between;gap:6px}.g-card-head h3{margin:0}
.g-card-bars{display:flex;gap:12px;font-size:13px;margin:6px 0}
.g-card-stats{width:100%;border-collapse:collapse;font-size:12.5px;margin-top:4px}
.g-card-stats th{text-align:left;font-weight:600;color:var(--muted,#9aa3c7);padding:2px 3px}.g-card-stats td{padding:2px 3px;border-top:1px solid var(--line-soft,rgba(255,255,255,.08));font-variant-numeric:tabular-nums}
.g-card-stats small.up{color:#7fe08f}.g-card-stats small.down{color:#ff8a7a}
.g-card h4{margin:10px 0 4px;font-size:13px}
.g-card-fxs{display:flex;flex-wrap:wrap;gap:4px}.g-card-fx{display:inline-flex;align-items:center;gap:4px;font-size:12px;border:1px solid currentColor;border-radius:999px;padding:1px 8px 1px 4px}
.g-card-fx svg{width:13px;height:13px}
.g-card-items{display:flex;flex-direction:column;gap:3px}.g-card-item{display:flex;align-items:center;gap:6px;font-size:12.5px}
.g-sb-mon{touch-action:pan-y}
@media (max-height:520px){.g-sheet.g-card{width:250px;top:6px;font-size:12px}}

/* Home Base: the arena behind the board, from tools/build_arenas.py. Hexes
   let the floor show through, so the Pokémon stand on it. */
.g-center.g-arena{image-rendering:pixelated}   /* the picture itself is placed by fitArena() in game.js */
.g-arena .gui-hex-bg{background:linear-gradient(180deg,rgba(30,30,70,.42),rgba(14,14,36,.52))}
.g-arena .g-hex-enemy .gui-hex-bg{background:linear-gradient(180deg,rgba(90,30,58,.42),rgba(44,16,40,.52))}

/* Replays: one row per round, and each kept game opening into its rounds. */
.g-replays{display:grid;gap:6px;margin:8px 0;max-height:52vh;overflow:auto}
.g-replay b i{margin-left:auto;font-style:normal;font-weight:700}
.g-replay b i.up{color:var(--good,#6fd68a)}.g-replay b i.down{color:#ff8a8a}
.g-rp-game{border:1px solid var(--line);border-radius:10px;padding:8px 10px;margin:8px 0;background:#10102a}
.g-rp-game summary{cursor:pointer;display:flex;flex-direction:column;gap:2px}
.g-rp-game summary small{color:var(--muted)}
