:root{color-scheme:dark;--cyan:#009db6;--orange:#ffab00;--muted:#8d8d96;--neutral:#29292d;--active:var(--cyan)}*{box-sizing:border-box}body{margin:0;background:#000;color:#f6f6f7;font:16px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;-webkit-tap-highlight-color:transparent}button,input,select{font:inherit}button,a,input,select{touch-action:manipulation}button{cursor:pointer;border:0;background:#262629;color:#fff;font-weight:650;min-height:48px;border-radius:18px;padding:12px 18px;transition:background .18s,opacity .18s}button:hover{filter:brightness(1.12)}button:disabled{opacity:.35;cursor:default}:focus{outline:none}[hidden]{display:none!important}.lobby{max-width:408px;margin:0 auto;padding:62px 26px 26px}.brand-mark{display:flex;align-items:center;justify-content:center;margin-bottom:30px}.brand-mark span{width:58px;height:58px;display:grid;place-items:center;background:var(--cyan);border-radius:50%;font-size:42px;color:white}.brand-mark span:last-child{background:var(--orange)}.brand-mark i{width:62px;height:1px;background:#3b3b40;margin:0 10px}.eyebrow{font-size:11px;letter-spacing:.18em;color:var(--muted);font-weight:700;text-align:center}.lobby h1{font-size:42px;line-height:1.15;letter-spacing:-1.8px;text-align:center;margin:12px 0}.intro{text-align:center;color:#a4a4ad;margin:14px 0 36px;font-size:17px;line-height:1.6}.setup label,.join label{display:block;color:#b8b8c0;font-size:12px;letter-spacing:.02em;font-weight:650;margin:19px 0 8px}input,select{background:#171719;color:#fff;border:1px solid #353539;border-radius:12px;min-height:51px;padding:13px 14px;width:100%;font-size:16px}select{appearance:auto}.field-note{font-size:12px;color:var(--muted);line-height:1.55}.primary{background:var(--active);color:#000}.setup .primary{--active:var(--orange);width:100%;display:flex;justify-content:space-between;align-items:center;margin-top:24px}.primary span{font-size:21px}.join{margin-top:28px;padding-top:4px;border-top:1px solid #252529}.join-row{display:flex;gap:9px}.join-row input{width:54%;letter-spacing:.11em;text-transform:uppercase}.join-row button{flex:1;border-radius:12px;white-space:nowrap}.text-button{background:none;color:var(--muted);padding:8px 0;min-height:44px;border-radius:4px;font-size:13px;font-weight:500}#practice{color:#d7d7dc;display:block;margin:22px auto 0}.center{text-align:center}.lobby-footer{margin-top:30px;display:flex;flex-direction:column;align-items:center;font-size:11px;color:#686872}.lobby-footer button{color:#b9b9c0}.match{max-width:450px;padding:20px 15px max(20px,env(safe-area-inset-bottom));margin:0 auto}.match-header{display:flex;justify-content:space-between;align-items:center;text-align:center;margin-bottom:2px}.match-header h1{font-size:20px;letter-spacing:-.6px;margin:0}.match-header p{font-size:13px;color:var(--muted);margin:1px 0}.round{border-radius:50%;width:46px;height:46px;min-height:46px;display:grid;place-items:center;padding:0;font-size:25px;background:#1e1e20;border:1px solid #303034}.room-strip{display:flex;justify-content:space-between;align-items:center;min-height:35px;color:#777780;font-size:10px;letter-spacing:.09em}.room-strip .text-button{font-size:11px;min-height:35px}.players{display:flex;justify-content:space-around;margin:23px 0 27px;gap:12px}.player{position:relative;display:flex;align-items:center;gap:10px;max-width:48%;min-width:0}.cyan{--player:var(--cyan)}.orange{--player:var(--orange)}.avatar{flex:0 0 51px;height:51px;background:color-mix(in srgb,var(--player) 24%,black);border-radius:50%;display:grid;place-items:center;color:var(--player);font-size:28px;font-weight:700}.player-name{font-size:18px;display:block;max-width:115px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;letter-spacing:-.5px}.wins{display:flex;align-items:center;gap:7px;font-size:18px;line-height:1.3}.wins i{background:var(--player);border-radius:50%;height:13px;width:13px}.turn-arrow{position:absolute;top:-23px;left:18px;font-size:15px;visibility:hidden}.player.active .turn-arrow{visibility:visible} .board{position:relative;width:100%;aspect-ratio:440/485;margin:0 auto;user-select:none}
.tile{--tile-fill:var(--neutral);--tile-edge:#424249;position:absolute;width:17.272727%;aspect-ratio:2/1.7320508;height:auto;border-radius:0;border:0;clip-path:polygon(25% 0,75% 0,100% 50%,75% 100%,25% 100%,0 50%);background:var(--tile-edge);isolation:isolate;padding:0;min-height:0;display:grid;place-items:center;font-size:clamp(21px,6.2vw,30px);font-weight:650;line-height:1;transition:color .23s,transform .13s}
.tile::before{content:"";position:absolute;inset:1.2px;background:var(--tile-fill);clip-path:inherit;z-index:-1;transition:background .23s}
.tile.fog{--tile-fill:#111113;--tile-edge:#303036}
.tile:disabled{opacity:1;cursor:default}
.tile.owned-0{--tile-fill:var(--cyan);--tile-edge:var(--cyan)}
.tile.owned-1{--tile-fill:var(--orange);--tile-edge:var(--orange)}
.tile.selected{--tile-fill:var(--active);--tile-edge:#fff;color:#fff;transform:scale(.96);box-shadow:none}
.tile.selected::before{inset:2px}
.tile:focus-visible:not(.selected):not(.owned-0):not(.owned-1){--tile-fill:color-mix(in srgb,var(--active) 16%,#29292d)}
.tile .dot{width:7px;height:7px;background:#fff;border-radius:50%}.tile svg{width:54%;height:54%;fill:#fff}.word{height:49px;display:flex;align-items:center;justify-content:center;font-size:27px;letter-spacing:.07em;font-weight:650;color:var(--active);overflow-wrap:anywhere;line-height:1.1;padding:0 8px}.turn-info{text-align:center;color:#92929b;font-size:12px;min-height:26px;margin-top:16px}.move-controls{display:flex;gap:12px}.move-controls button{width:50%;border-radius:35px;display:flex;align-items:center;justify-content:space-between;padding:17px 24px;min-height:61px;font-size:14px}.move-controls #clear{background:color-mix(in srgb,var(--active) 22%,#171719)}.move-controls span{font-size:24px;font-weight:400}.match-meta{display:flex;align-items:center;justify-content:space-between;font-size:10px;color:#686872}.match-meta .text-button{font-size:11px}.results{text-align:center;margin:26px 0 12px}.results h2{font-size:29px;letter-spacing:-1px;margin:12px 0;color:var(--active)}.results p{color:var(--muted);font-size:13px}.results .primary{min-width:200px}.history{border-top:1px solid #252528;margin-top:15px;padding-top:16px}.history h2{font-size:12px;color:var(--muted);font-weight:500}.history-columns{display:grid;grid-template-columns:1fr 1fr;gap:22px}.history-columns h3{font-size:14px;color:var(--player);margin:8px 0 15px}.history-columns p{margin:6px 0;font-size:14px;letter-spacing:.06em}.history-columns p span{color:#5f5f67;font-size:10px;float:right}.notice{position:fixed;bottom:max(24px,env(safe-area-inset-bottom));left:50%;transform:translateX(-50%);width:max-content;max-width:min(90vw,430px);padding:14px 20px;color:white;background:#303035;border:1px solid #4b4b54;border-radius:14px;box-shadow:0 10px 40px #000a;z-index:4;font-size:13px;text-align:center}dialog{background:#171719;color:#dddde3;border:1px solid #3c3c43;border-radius:24px;padding:30px 25px;max-width:450px;width:90%;max-height:85vh;line-height:1.7;font-size:14px}dialog::backdrop{background:#000c;backdrop-filter:blur(8px)}dialog h2{font-size:25px;line-height:1.25;color:white;letter-spacing:-.7px}dialog .eyebrow{text-align:left;margin-top:4px}dialog li{margin:12px 0}dialog ol{padding-left:20px}dialog a{color:var(--cyan)}.dialog-close{float:right;background:none;padding:0;min-height:30px;font-size:28px;color:#aaa}.busy{opacity:.6;pointer-events:none}@media(min-width:700px){.lobby{padding-top:65px}.match{padding-top:32px}.players{margin-top:30px}.match-header{margin-bottom:5px}}@media(max-height:750px) and (max-width:500px){.match{padding-top:10px}.players{margin:18px 0 20px}.avatar{height:44px;flex-basis:44px}.turn-info{margin-top:7px}.word{height:40px}.move-controls button{min-height:52px;padding-top:10px;padding-bottom:10px}.lobby{padding-top:28px}}

/* Allow translated labels to fit comfortably on smaller screens. */
.join-row input{min-width:0;flex:1;width:0;letter-spacing:.05em}.join-row button{flex:0 0 auto;font-size:14px;padding:12px 14px}
.round{flex:0 0 46px}.match-header>div{min-width:0;padding:0 8px}.match-header p{overflow-wrap:anywhere}.player>div{min-width:0}
.dialog-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:20px}.reading-page{max-width:540px;margin:auto;padding:32px 24px 60px;font-size:14px;line-height:1.75}.reading-page a{color:var(--cyan)}.reading-page h1{font-size:27px;line-height:1.25}.reading-page h2{font-size:18px;margin-top:28px}.reading-page .eyebrow{text-align:left;margin-top:35px}

.brand-mark span svg{width:34px;height:34px;fill:#fff}

.tile .letter-points{position:absolute;right:24%;bottom:9%;font-size:clamp(9px,2.5vw,11px);font-weight:600;font-variant-numeric:tabular-nums;line-height:1;color:#c9c9d1;pointer-events:none}
.tile.selected .letter-points{color:#fff}

/* HQ resources and prospective word score. */
.tile.hq{display:flex;align-items:center;justify-content:center;flex-direction:column;gap:0;line-height:1;overflow:hidden}
.tile.hq svg{width:36%;height:40%;margin-top:0;flex-shrink:0}
.tile .hq-points{font-size:clamp(13px,4vw,20px);font-weight:750;line-height:1.1;max-width:90%;letter-spacing:-.03em}
.word-preview{margin-bottom:12px;text-align:center}
.word-preview .word{margin-bottom:2px;overflow-wrap:anywhere}
.word-score{font-size:15px;font-weight:650;color:var(--active);min-height:21px}


.notification-settings{display:flex;align-items:center;justify-content:space-between;gap:8px}.notification-settings .text-button{padding:6px 0;font-size:13px;white-space:nowrap}.notification-settings .field-note{font-size:12px;line-height:1.35;margin:0}.notification-settings button[aria-pressed="true"]{color:var(--cyan)}

.bot-start{display:block;width:100%;margin-top:22px;background:#10282d;border:1px solid #23515a;color:#e9fafd;font-weight:650}.bot-start+.field-note{margin:7px 0 4px}#bot-retry{display:block;margin:0 auto 12px}#bot-retry[hidden]{display:none}

.bot-setup{margin-top:22px}.bot-setup label{display:block;margin-bottom:8px;font-size:14px;font-weight:650;color:#bdbdc5}.bot-setup select{width:100%}.bot-setup .field-note{margin:7px 0;line-height:1.45}.bot-setup .bot-start{margin-top:12px}

/* Player summaries stay readable across portrait phones, including long names. */
.players{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;align-items:start;margin:23px 0 20px}
.player{display:flex;flex-direction:column;align-items:center;gap:7px;width:100%;max-width:none;text-align:center}
.avatar{flex:0 0 51px;width:51px;height:51px}
.player-summary{display:grid;justify-items:center;gap:3px;width:100%;min-width:0}
.player-name{font-size:15px;line-height:1.25;letter-spacing:-.2px;max-width:none;width:100%;min-height:2.5em;white-space:normal;overflow:visible;text-overflow:clip;overflow-wrap:anywhere;display:flex;align-items:center;justify-content:center}
.wins{justify-content:center;font-variant-numeric:tabular-nums}
.turn-arrow{left:50%;transform:translateX(-50%);top:-23px}
.last-play{display:flex;flex-wrap:wrap;justify-content:center;align-items:baseline;gap:3px 6px;min-height:18px;margin:2px 0 0;width:100%;font-size:12px;line-height:1.4}
.last-word{min-width:0;overflow-wrap:anywhere;color:#c5c5ce;letter-spacing:.025em}
.last-points{color:var(--player);font-weight:700;white-space:nowrap;font-variant-numeric:tabular-nums}
@media(max-height:750px) and (max-width:500px){.players{margin:18px 0 16px}.avatar{width:44px;height:44px;flex-basis:44px}.player{gap:5px}}

/* viewport-fit=cover lets installed iPhone PWAs extend behind the status bar.
   Keep every page inside the device's safe area, independently of page spacing. */
:root{--safe-area-top:env(safe-area-inset-top,0px);--safe-area-left:env(safe-area-inset-left,0px);--safe-area-right:env(safe-area-inset-right,0px)}
body{padding-top:var(--safe-area-top);padding-left:var(--safe-area-left);padding-right:var(--safe-area-right)}

/* Compact player summaries; match context belongs directly beneath the title. */
.match-header p{font-size:11px;line-height:1.3;margin:2px 0 0;letter-spacing:.035em}
.room-strip{justify-content:flex-end}
.players{margin:16px 0 10px;gap:14px}
.player{gap:0}
.player-summary{gap:1px}
.player-name{color:var(--player);min-height:2.3em;line-height:1.15}
.wins{font-size:16px;line-height:1.15;gap:6px}
.wins i{width:10px;height:10px}
.last-play{margin-top:1px;min-height:16px;line-height:1.2;font-size:11px;gap:2px 5px}
.turn-arrow{top:-14px;font-size:11px;line-height:1}
.word-preview{margin-top:6px}
.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
@media(max-height:750px) and (max-width:500px){.players{margin:14px 0 8px}.player{gap:0}}

/* Dictionary feedback sits over the selected word, leaving move controls clear. */
#back svg{width:23px;height:23px}
.word-preview{margin:5px 0 8px}
.word-display{position:relative}
.word-preview .word{height:auto;min-height:32px;line-height:1.05;margin-bottom:0;padding:2px 8px}
.word-score{line-height:1.15;min-height:18px;margin:0}
.word-notice{position:absolute;inset:0;z-index:2;display:flex;align-items:center;justify-content:center;margin:0;padding:4px 10px;border:1px solid #ffffff26;border-radius:10px;background:rgb(48 48 53 / 50%);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);color:#fff;font-size:13px;font-weight:550;line-height:1.25;text-align:center;pointer-events:none}
/* Compact home screen, with comfortable touch targets and existing safe areas. */
.lobby{padding:24px 26px 20px}
.lobby .brand-mark{margin-bottom:12px}
.lobby .brand-mark span{width:46px;height:46px}
.lobby .brand-mark span svg{width:28px;height:28px}
.lobby h1{font-size:38px;line-height:1.1;margin:8px 0}
.lobby .intro{font-size:16px;line-height:1.35;margin:8px 0 16px}
.lobby .setup label,.lobby .join label{margin:12px 0 6px}
.lobby input,.lobby select{min-height:46px;padding:10px 12px}
.lobby .setup .primary{margin-top:14px}
.lobby .join{margin-top:18px}
.lobby .bot-setup{margin-top:16px}
.lobby .bot-setup label{margin-bottom:6px}
.lobby .bot-setup .field-note{margin:4px 0;line-height:1.35}
.lobby .bot-setup .bot-start{margin-top:8px}
#practice{margin-top:10px}
#offline-ready{margin:4px 0;line-height:1.3}
#offline-ready:empty{display:none}
.lobby-footer{margin-top:12px}

/* Three clear move actions and a title-sized history opener. */
.move-controls{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.3fr) minmax(0,1fr);gap:8px}
.move-controls button{width:100%;min-width:0;min-height:54px;padding:12px 6px;justify-content:center;border-radius:28px;font-size:14px}
.move-controls #pass{background:#262629;color:#fff}
.match-meta{justify-content:center;min-height:30px}
.match-title{display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;min-height:46px;padding:0;border-radius:8px;background:none;color:inherit}
.match-title .game-title{font-size:20px;line-height:1.2;letter-spacing:-.6px}
#room-label{display:block;font-size:11px;font-weight:400;line-height:1.3;margin:2px 0 0;letter-spacing:.035em;color:var(--muted);overflow-wrap:anywhere}
/* The sheet fills the viewport; only its central word area scrolls. */
html.history-open,html.history-open body{overflow:hidden}
dialog.history-overlay{position:fixed;inset:0;width:100%;max-width:none;height:100vh;height:100dvh;max-height:none;margin:0;padding:0;border:0;border-radius:0;overflow:hidden;background:rgb(18 18 22 / 50%);color:#fff;box-shadow:none;transform:translateY(-100%);transition:transform .24s cubic-bezier(.22,.68,.2,1)}
dialog.history-overlay.is-visible{transform:translateY(0)}
dialog.history-overlay::backdrop{background:transparent;backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px)}
.history-sheet{height:100%;min-height:0;display:flex;flex-direction:column;padding:calc(var(--safe-area-top) + 16px) max(18px,var(--safe-area-right)) calc(env(safe-area-inset-bottom,0px) + 16px) max(18px,var(--safe-area-left))}
.history-header{flex:0 0 auto}
#history .history-title-row{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;column-gap:8px;margin:0 0 10px;font-size:clamp(16px,4.7vw,20px);font-weight:700;line-height:1.2}
#history .history-title-row h2{margin:0;font-size:inherit}
#history #history-round{width:auto;min-height:44px;padding:0 2px;border:0;border-radius:6px;background:transparent;font:inherit;color:inherit}
#history #history-round:focus-visible{background:color-mix(in srgb,var(--active) 20%,transparent)}
#history #history-round option{background:#19191d}
#history-round-status{text-align:center;color:var(--muted)}
.history-header h2{font-size:24px;line-height:1.2;margin:0 0 18px;text-align:center;letter-spacing:-.5px}
.history-headings,.history-scroll .history-columns{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}
.history-headings{padding-bottom:12px;border-bottom:1px solid #ffffff24}
.history-headings h3{min-width:0;font-size:15px;line-height:1.25;margin:0;color:var(--player);overflow-wrap:anywhere}
.history-scroll{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;touch-action:pan-y;padding:8px 0}
.history-scroll:focus-visible{background-color:#ffffff04}
.history-scroll .history-columns p{display:flex;justify-content:space-between;align-items:baseline;gap:6px;margin:0;padding:9px 0;font-size:13px;line-height:1.35;letter-spacing:.02em;border-bottom:1px solid #ffffff10}
.history-scroll .history-word{flex:1 1 auto;min-width:0;float:none;color:#f6f6f7;font-size:13px;line-height:1.35;text-align:left;overflow-wrap:anywhere}
.history-scroll button.history-word{height:auto;min-height:24px;padding:0;border:0;border-radius:4px;background:transparent;font-weight:500;text-decoration:underline;text-decoration-color:#ffffff55;text-underline-offset:3px;cursor:pointer}
.history-scroll button.history-word:is(:hover,:focus-visible){text-decoration-color:currentColor}
#word-definition{width:min(394px,calc(100% - 32px));max-height:min(70dvh,560px);overscroll-behavior:contain}
#word-definition h2{margin:0 36px 12px 0;overflow-wrap:anywhere}
#word-definition h3{font-size:17px;margin:0 0 4px;overflow-wrap:anywhere}
#definition-entries section+section{margin-top:12px;padding-top:12px;border-top:1px solid #ffffff20}
#definition-entries ul{list-style:none;padding:0;margin:0}
#definition-entries li{font-size:15px;line-height:1.45;margin:0 0 8px;overflow-wrap:anywhere}
#definition-entries li i{display:block;color:#b5b5bf;font-size:12px}
#word-definition .definition-credit{font-size:12px;margin:2px 0 12px}
#word-definition a{color:#79cad8;text-underline-offset:3px}
#definition-more{display:inline-block;font-size:14px}
.history-scroll .history-points{flex:0 0 auto;float:none;font-size:10px;color:var(--player);text-align:right;letter-spacing:0}
.history-actions{flex:0 0 auto;padding-top:12px}
.history-actions button{display:block;width:100%;max-width:360px;margin:0 auto;min-height:50px;border-radius:28px;background:#f0f0f3;color:#111}
@media(prefers-reduced-motion:reduce){dialog.history-overlay{transition:none}}

.history-settings{flex:0 0 auto;padding-bottom:8px;margin-bottom:10px;border-bottom:1px solid #ffffff24}
.history-settings-summary{color:#b5b5bf;font-size:14px;line-height:1.4}
.history-settings-summary h2{margin:0 0 6px;padding-right:38px;color:#f6f6f7;font-size:18px;line-height:1.25;letter-spacing:-.3px}
.history-settings-summary p{margin:0}
#history-board-action{display:block;margin:0 auto}

.word-score-display{position:relative;min-height:44px}

/* Finished matches reuse the word and action slots instead of adding a lower panel. */
#winner{margin:0;letter-spacing:-.6px}
#rematch-status{margin:0;font-size:12px;line-height:1.4;color:var(--muted)}
.results{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.3fr) minmax(0,1fr);gap:8px;margin:0}
.results .primary{grid-column:2;width:100%;min-width:0;min-height:54px;padding:12px 6px;border-radius:28px;font-size:14px}

.tile .tile-multiplier{position:absolute;top:6%;left:24%;padding:1px 2px;border-radius:3px;background:rgb(0 0 0 / 72%);font-size:clamp(7px,2vw,10px);font-weight:750;line-height:1;pointer-events:none;letter-spacing:0}
.tile .multiplier-2{color:#45d9ec}
.tile .multiplier-3{color:#009db6}

.tile .multiplier-word.multiplier-2{color:#f45bd7}
.tile .multiplier-word.multiplier-3{color:#c02a9f}

.tile .multiplier-badges{position:absolute;top:6%;left:24%;display:flex;align-items:center;gap:1px;pointer-events:none}
.tile .multiplier-badges .tile-multiplier{position:static}
.tile .multiplier-count{padding:1px 2px;border-radius:3px;background:rgb(0 0 0 / 72%);color:#fff;font-size:clamp(7px,2vw,10px);font-weight:750;line-height:1;letter-spacing:0}

/* Name frames indicate the current turn; --turn-progress is reserved for a future timer. */
.players{align-items:stretch;margin:10px 0 4px}
.player{align-items:stretch}
.player-summary{--name-spacing:5px;flex:1;grid-template-rows:1fr auto;justify-items:stretch;gap:var(--name-spacing)}
.player-name-frame{--turn-progress:0;position:relative;isolation:isolate;display:flex;align-items:center;justify-content:center;width:100%;min-height:var(--battle-control-height);padding:var(--name-spacing) 8px;border:2px solid transparent;border-radius:12px;overflow:hidden}
.player-name-frame::before{content:"";position:absolute;inset:0;background:var(--player);opacity:.4;transform:scaleX(var(--turn-progress));transform-origin:left center;pointer-events:none;transition:transform .1s linear}
.player-name-frame .player-name{position:relative;z-index:1;min-height:0;padding:0;line-height:1.2}
.player.active .player-name-frame{border-color:var(--player)}
@media(prefers-reduced-motion:reduce){.player-name-frame::before{transition:none}}

.player-summary .last-play{margin-top:0}

/* Desktop views share the battle column; phones retain their existing full-screen sheets. */
:root{--battle-view-width:450px}
.match{max-width:var(--battle-view-width)}
@media(min-width:700px){
 .lobby,.reading-page{max-width:var(--battle-view-width);padding-inline:15px}
 dialog{width:var(--battle-view-width);max-width:var(--battle-view-width);padding-inline:14px}
 dialog.history-overlay{left:50%;right:auto;width:var(--battle-view-width);max-width:var(--battle-view-width);padding:0;transform:translate(-50%,-100%)}
 dialog.history-overlay.is-visible{transform:translate(-50%,0)}
 .history-sheet{padding-left:15px;padding-right:15px}
}

/* Keep battle actions as compact as the player name frames. */
:root{--battle-control-height:32px}
.move-controls button,.results .primary{height:var(--battle-control-height);min-height:var(--battle-control-height);padding:5px 6px;line-height:20px}

/* Board proportions follow the saved board, including older battles. */
.board{aspect-ratio:440 / var(--board-height,623.56);container-type:inline-size}
.tile{font-size:clamp(16px,6.2cqw,30px)}

/* Invitation actions occupy the vacant opponent name, without a separate board row. */
.player-invite{position:absolute;inset:0;z-index:1;min-height:0;width:100%;height:100%;font-weight:700;padding:0;border-radius:0;background:none;color:var(--player);font-size:15px;line-height:1.2;letter-spacing:-.5px}
.invite-menu{position:fixed;inset:auto;margin:0;width:210px;max-width:calc(100vw - 30px);padding:5px;border:1px solid #3c3c43;border-radius:12px;background:#202024;color:#fff;box-shadow:0 8px 25px #0008;z-index:10}
.invite-menu button{display:block;width:100%;min-height:40px;padding:8px 12px;border-radius:8px;text-align:left;background:none;font-size:14px;line-height:1.4}
.invite-menu button:hover,.invite-menu button:focus-visible{background:#ffffff14}

/* Battle geometry must never depend on feedback, menus or viewport height. */
.board{width:100%;min-width:100%;max-width:100%;flex-shrink:0}
/* Keep native scrolling while hiding the viewport and panel scroll indicators. */
*{scrollbar-width:none}
*::-webkit-scrollbar{display:none;width:0;height:0}
dialog{position:fixed}
#bot-retry{position:fixed;left:50%;bottom:calc(env(safe-area-inset-bottom,0px) + 76px);transform:translateX(-50%);z-index:5;max-width:min(90vw,420px);margin:0;padding:8px 16px;border:1px solid #ffffff26;border-radius:12px;background:rgb(48 48 53 / 75%);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);color:#fff}
