@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Khmer:wght@400;500;600;700&display=swap');
:root{font-family:Inter,"Noto Sans Khmer",system-ui,sans-serif;color:#272638;background:#f5f5f8;font-synthesis:none;--primary:#5e4fcc;--muted:#747383;--border:#e7e7ee;--navy:#24243a}
*{box-sizing:border-box}body{margin:0;padding:max(env(safe-area-inset-top),var(--tg-safe-top,0px)) env(safe-area-inset-right) max(env(safe-area-inset-bottom),var(--tg-safe-bottom,0px)) env(safe-area-inset-left)}button,input{font:inherit}button{cursor:pointer}button:disabled{cursor:default;opacity:.45}button:focus-visible,a:focus-visible,input:focus-visible{outline:3px solid #8272ea;outline-offset:3px}button{touch-action:manipulation}h1,h2,h3,p{margin:0}button{border:0} [hidden]{display:none!important}
.header{max-width:1180px;margin:auto;min-height:106px;display:flex;align-items:center;justify-content:space-between;padding:20px 36px;border-bottom:1px solid var(--border);gap:16px}.brand{display:flex;gap:13px;align-items:center;min-width:0}.brandmark{flex-shrink:0}.brandmark{background:var(--navy);color:#e6be7f;border-radius:15px;width:54px;height:54px;display:grid;place-items:center;font-size:23px}.brand h1{font-size:20px;font-weight:700;letter-spacing:0;line-height:1.6}.brand div>span{display:block;color:var(--muted);font-size:14px;margin-top:4px}.header-actions{display:flex;gap:20px;align-items:center}.edition{font-size:14px;color:var(--muted)}.quiet{color:#595767;background:transparent;padding:10px 13px;border-radius:9px;font-size:14px;font-weight:600;min-height:42px}.quiet:hover:enabled{background:#ededf4}
.layout{max-width:1108px;margin:32px auto 0;display:grid;grid-template-columns:minmax(0,620px) minmax(280px,340px);gap:44px;padding:0 20px;align-items:start}.play-area{min-width:0}.player{display:flex;align-items:center;gap:12px;padding:0 2px 15px}.avatar{height:40px;width:40px;flex-shrink:0;border-radius:12px;display:grid;place-items:center;font-weight:700;font-size:15px}.ai{background:#39304d;color:#fff1e8}.human{background:#fffaf0;color:#5d5042;font-size:20px}.player-text{display:flex;flex-direction:column;gap:4px}.player-text strong{font-size:15px}.player-text span{font-size:13px;color:var(--muted)}.thinking{margin-left:auto;color:var(--primary);font-size:14px;animation:pulse 1.5s infinite}.board-frame{border:10px solid #453d3b;border-bottom-width:0;border-radius:10px;background:#453d3b;box-shadow:0 8px 28px #25243a12}.board{display:grid;grid-template-columns:repeat(8,minmax(0,1fr));grid-template-rows:repeat(8,minmax(0,1fr));width:100%;aspect-ratio:1;background:#d8ba90;overflow:hidden;border:1px solid #9f815d}.cell{border:0;border-right:1px solid #ac8b6366;border-bottom:1px solid #ac8b6366;border-radius:0;background:#dfc49f;display:flex;align-items:center;justify-content:center;position:relative;min-width:0;min-height:0;width:100%;height:100%;padding:3px;aspect-ratio:auto;overflow:hidden;color:inherit}.cell:nth-child(16n+1),.cell:nth-child(16n+3),.cell:nth-child(16n+5),.cell:nth-child(16n+7),.cell:nth-child(16n+10),.cell:nth-child(16n+12),.cell:nth-child(16n+14),.cell:nth-child(16n+16){background:#dbc099}.cell.last{background:#c4b784}.cell.selected{background:#bba9dc}.cell.check{background:#d98881}.cell:focus-visible{outline:3px solid #5e4fcc;outline-offset:-3px;z-index:2}.cell.legal:after{content:"";position:absolute;width:23%;height:23%;border-radius:50%;background:#5e4fcc70;pointer-events:none}.cell.legal:has(.piece):after{width:88%;height:88%;border:3px solid #5e4fcc;background:transparent}.piece{width:90%;height:90%;max-width:100%;max-height:100%;min-width:0;min-height:0;flex-shrink:1;object-fit:contain;display:block;user-select:none;pointer-events:none;filter:drop-shadow(0 2px 1px #44362735)}.rank{position:absolute;left:3px;top:2px;color:#785f45;font-size:12px;z-index:1}.files{display:grid;grid-template-columns:repeat(8,1fr);height:26px;align-items:center;text-align:center;font-size:12px;color:#e0c7aa}.bottom-player{padding:16px 2px 0}.turn-badge{font-size:12px;padding:6px 10px;border:1px solid var(--border);border-radius:20px;margin-left:auto;color:var(--muted);background:white}.turn-badge.active{color:var(--primary);border-color:#d9d3f5;background:#eeebfb}.board-note{text-align:center;margin:20px 0 0;color:var(--muted);font-size:14px;min-height:24px}
.panel{background:#fff;border:1px solid var(--border);border-radius:20px;padding:27px 24px;box-shadow:0 4px 16px #29244203}.eyebrow{font-size:12px;font-weight:700;letter-spacing:1.5px;color:var(--primary)}.panel h2{font-size:23px;line-height:1.4;letter-spacing:-.6px;margin:8px 0}.panel-heading p{font-size:14px;line-height:1.7;color:var(--muted);margin-bottom:25px}fieldset{padding:0;margin:0;border:0;min-width:0}legend{font-size:14px;font-weight:600;margin-bottom:10px}.level{display:flex;position:relative;align-items:center;gap:12px;min-height:76px;border:1px solid var(--border);border-radius:12px;padding:12px;margin-bottom:9px;cursor:pointer}.level:has(input:checked){border:1.5px solid var(--primary);background:#f7f5ff;padding:11.5px}.level:has(input:disabled){cursor:default}.level:has(input:focus-visible){outline:3px solid #b7aaf0;outline-offset:2px}.level input{position:absolute;opacity:0;width:1px;height:1px}.level-icon{width:33px;height:36px;display:grid;place-items:center;flex-shrink:0;border-radius:7px;background:#f1f0f6;color:#817b95;font-family:Georgia,serif;font-size:23px}.level:has(input:checked) .level-icon{background:#e9e4fa;color:var(--primary)}.level strong{font-size:15px;display:block}.level small{font-size:12px;color:var(--muted);display:block;margin-top:4px;line-height:1.5}.radio-mark{border:1.5px solid #cccad5;width:16px;height:16px;flex-shrink:0;border-radius:50%;margin-left:auto}.level:has(input:checked) .radio-mark{border:5px solid var(--primary)}.primary{background:var(--primary);color:white;min-height:48px;border-radius:10px;padding:12px 20px;font-weight:650;font-size:15px}.primary:hover{background:#4e40b2}#start{width:100%;margin-top:10px}.game-status{border-top:1px solid var(--border);padding-top:23px;margin-top:24px;display:flex;flex-direction:column;gap:8px}.status-label{font-size:11px;letter-spacing:1.3px;font-weight:650;color:#94919f}.game-status strong{font-size:17px}.game-status>span:last-child{font-size:13px;color:var(--muted);line-height:1.5}.game-actions{display:flex;justify-content:space-between;margin:9px -10px 0}.count-button{padding:9px;width:100%;border:1px solid #ded7ee;border-radius:8px;background:#f6f3fb;color:#5b4b96;font-size:13px;margin-top:8px}.history{border-top:1px solid var(--border);margin-top:17px;padding-top:18px}.history-heading{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px}.history h3{font-size:14px}.history-heading>span{font-size:12px;color:var(--muted)}.move-list{max-height:136px;overflow:auto;font-size:14px}.empty{font-size:13px;line-height:1.7;color:#9995a3}.move-row{display:grid;grid-template-columns:25px 1fr 1fr;padding:6px 8px;border-radius:5px;gap:8px}.move-row:nth-child(odd){background:#f6f5f9}.move-number{color:#9993a7}.move-text{font-variant-numeric:tabular-nums}footer{max-width:1068px;display:flex;justify-content:space-between;padding:24px 0;margin:28px auto 0;border-top:1px solid var(--border);color:#918c9c;font-size:12px}footer span:first-child{font-size:14px}
dialog{border:1px solid var(--border);border-radius:20px;padding:26px;color:var(--navy);background:white;max-width:min(530px,calc(100vw - 28px));max-height:85dvh;overflow:auto;box-shadow:0 24px 80px #17132940}dialog::backdrop{background:#1f1b365c;backdrop-filter:blur(4px)}.dialog-top{display:flex;justify-content:space-between;align-items:center;margin-bottom:15px;gap:20px}.dialog-top h2,dialog>h2{font-size:22px}.close{background:#f4f3f7;border-radius:50%;width:36px;height:36px;font-size:26px;color:#777;flex-shrink:0}#rules-content{font-size:14px;line-height:1.8;color:#676173}#rules-content p{margin:14px 0}#rules-content a{color:var(--primary)}.rule-row{display:grid;grid-template-columns:90px 1fr;gap:14px;padding:10px 0;border-bottom:1px solid var(--border)}.rule-name{font-weight:650;color:#3f384d}dialog>p{line-height:1.7;color:var(--muted);margin:16px 0;font-size:15px}.dialog-actions{display:flex;justify-content:flex-end;gap:12px;margin-top:25px}#status.finished{color:var(--primary)}@keyframes pulse{50%{opacity:.5}}

@media(max-width:850px){.layout{gap:22px;grid-template-columns:minmax(0,1fr) 280px}.panel{padding:20px 17px}.panel h2{font-size:20px}.level{gap:8px}.level-icon{width:25px}.level small{font-size:12px}footer{margin-left:25px;margin-right:25px}}
@media(max-width:680px){.header{min-height:82px;padding:12px;gap:10px;flex-wrap:wrap}.brandmark{width:43px;height:43px;border-radius:12px;font-size:20px}.brand h1{font-size:17px}.brand div>span{font-size:12px;margin-top:3px}.header-actions{gap:4px;margin-left:auto}.header-actions .quiet{padding:8px;min-height:44px}.edition{display:none}.layout{display:flex;flex-direction:column;margin-top:17px;padding:0 12px;gap:18px}.play-area{width:100%;order:2}.panel{display:contents}.panel-heading{display:none}#levels{width:100%;order:0;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px}legend{display:none}.level{margin:0;min-height:56px;padding:10px 6px;justify-content:center;gap:6px;background:#fff;border-radius:10px}.level:has(input:checked){padding:9.5px 5.5px}.level-icon{width:20px;font-size:21px;background:transparent!important}.level strong{font-size:13px;overflow-wrap:anywhere;line-height:1.6}.level small,.radio-mark{display:none}#start{order:1;margin-top:-8px;min-height:43px}.board-frame{border-width:7px;border-bottom:0;border-radius:8px}.player{padding-bottom:11px}.avatar{width:35px;height:35px;border-radius:10px}.player-text strong{font-size:14px}.player-text span{font-size:12px}.bottom-player{padding-top:12px}.piece{width:94%;height:94%}.board-note{font-size:12px;margin-top:13px;min-height:18px}.game-status{order:3;width:100%;margin-top:0;padding:16px;background:#fff;border:1px solid var(--border);border-radius:13px;gap:6px}.status-label{display:none}.game-status strong{font-size:16px}.game-actions{order:4;width:100%;margin:-10px 0 0;justify-content:space-around}.history{order:6;width:100%;margin-top:0;padding:16px;background:white;border:1px solid var(--border);border-radius:13px}.count-button{order:5;margin-top:-5px}footer{margin:22px 16px 0;padding:18px 0;gap:18px}footer span:last-child{font-size:11px}.rank{font-size:10px;left:2px;top:1px}.files{height:20px;font-size:10px}.thinking{font-size:12px}.move-list{max-height:118px}}
@media(prefers-reduced-motion:reduce){*{animation:none!important}}

#share-url{width:100%;padding:12px;border:1px solid var(--border);border-radius:8px;font:inherit;font-size:14px;color:var(--navy)}

.sound-row{display:flex;justify-content:flex-end;margin-top:8px}.sound-row .quiet{padding:6px 10px;font-size:13px;min-height:36px;border:1px solid var(--border)}#sound[aria-checked="true"]{color:var(--primary);background:#f6f3ff}.game-notice{font-size:14px;line-height:1.7;padding:10px 14px;border-radius:10px;margin-top:14px;background:#eeebfb;color:#4b3f91;border:1px solid #ddd6f4}.game-notice[data-tone="error"],.game-notice[data-tone="check"]{background:#fff1ed;color:#934632;border-color:#f0d6cd}.game-notice[data-tone="result"]{font-weight:650;background:#eeebfb;color:#4b3f91}/* Endgame count stays beside the board, including on small screens. */
.count-display{display:block;margin:0 0 12px;padding:12px 16px;border:1px solid #d4cbee;border-left:4px solid var(--primary);border-radius:14px;background:#f4f0ff;color:#493c76;font-size:14px;line-height:1.7}
.count-top{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.count-top>strong{font-size:16px}.count-top .count-value{display:inline-block;font-size:26px;line-height:1.3;font-variant-numeric:tabular-nums;white-space:nowrap;color:var(--primary)}
#count-side{overflow-wrap:anywhere}#count-remaining{font-weight:600}.count-display progress{display:block;width:100%;height:5px;margin-top:8px;border:0;border-radius:8px;overflow:hidden;background:#ded7ef;accent-color:var(--primary)}.count-display progress::-webkit-progress-bar{background:#ded7ef}.count-display progress::-webkit-progress-value{background:var(--primary)}.count-display progress::-moz-progress-bar{background:var(--primary)}
.count-display.near-limit{border-color:#cfa561;background:#fff5df;color:#71501f}.count-display.near-limit .count-value{color:#825719}.count-display.near-limit progress{accent-color:#9a6820}.count-display.near-limit progress::-webkit-progress-value{background:#9a6820}.count-display.near-limit progress::-moz-progress-bar{background:#9a6820}
#count-alert{width:420px;border-radius:22px}#count-alert h2{font-size:23px;line-height:1.6}#count-alert .count-alert-value{display:block;margin:20px 0 8px;font-size:40px;line-height:1.4;font-variant-numeric:tabular-nums;color:var(--primary)}#count-alert p{font-size:16px;line-height:1.8;overflow-wrap:anywhere}#count-alert-detail{margin-bottom:6px}#count-alert-remaining{font-weight:600;color:var(--primary)}#count-alert-rule{margin:20px 0;color:var(--muted)}#count-alert-close{width:100%;min-height:48px}
#result-dialog{width:410px}#result-title{margin-top:12px;font-size:26px;line-height:1.5}#result-detail{white-space:pre-line}.cell.invalid-target{box-shadow:inset 0 0 0 3px #b34c39}.piece-credit{font-size:12px}
@media(max-width:680px){.sound-row{order:4;width:100%;margin:-8px 0 0;justify-content:center}.game-actions{order:5}.count-button{order:6}.history{order:7}.game-notice{margin-top:12px;font-size:14px}.board-note{margin-top:10px}}

.mode-picker{display:grid;grid-template-columns:1fr 1fr;gap:5px;padding:4px;background:#f3f1f7;border-radius:10px;margin-bottom:20px}.mode-picker legend{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}.mode-picker label{position:relative;cursor:pointer;text-align:center}.mode-picker input{position:absolute;opacity:0;width:1px}.mode-picker span{display:block;padding:10px 4px;font-size:14px;font-weight:650;border-radius:7px;line-height:1.6}.mode-picker input:checked+span{background:white;color:var(--primary);box-shadow:0 2px 6px #29244212}.mode-picker input:focus-visible+span{outline:2px solid var(--primary)}.partner-lobby{font-size:14px;line-height:1.7;margin-bottom:12px}.partner-lobby p{color:var(--muted);margin:10px 0}.partner-lobby .primary{width:100%}.invite-row{display:flex;margin:6px 0 15px;gap:5px}.invite-row input{width:100%;min-width:0;border:1px solid var(--border);border-radius:8px;padding:8px;font:inherit;font-size:12px}.invite-row button{white-space:nowrap;padding:8px}.color-options{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:12px 0}.color-option{display:flex;flex-direction:column;align-items:center;padding:12px 6px;border:1px solid var(--border);background:#faf9fc;border-radius:12px;color:var(--navy);gap:4px}.color-option img{width:50px;height:50px;object-fit:contain}.color-option strong{font-size:14px}.color-option span{font-size:12px;min-height:20px}.color-option.your-seat{border:2px solid var(--primary);background:#f3efff;opacity:1}.color-option:disabled:not(.your-seat){opacity:.55}.color-option:enabled:hover{border-color:var(--primary)}#connection-status[data-error="true"]{color:#934632}.avatar.side-white{background:#fffaf0;color:#554539;border:1px solid #e4d8c6}.avatar.side-purple{background:#39304d;color:#fff}.partner-game .eyebrow{letter-spacing:1px}
@media(max-width:680px){.mode-picker{order:-2;width:100%;margin:0}.partner-lobby{order:-1;width:100%;background:white;border:1px solid var(--border);border-radius:13px;padding:14px;margin:0}.partner-lobby .color-options{gap:10px}.color-option{flex-direction:row;flex-wrap:wrap;justify-content:center;gap:8px}.color-option img{width:35px;height:35px}.color-option span{width:100%}.partner-game .play-area{order:2}.mode-picker span{font-size:14px}}

@media(max-width:680px){.partner-lobby.in-play .color-options,.partner-lobby.in-play [data-i18n="colorHelp"],.partner-lobby.in-play #room-instruction{display:none}.partner-lobby.in-play .invite-row{margin-bottom:0}.partner-lobby.in-play #connection-status{margin-top:0}}

.comments{margin-top:22px;border:1px solid var(--border);border-radius:16px;background:#fff;padding:20px}.comments h2{font-size:18px;line-height:1.6}.comments-help{font-size:14px;color:var(--muted);line-height:1.7;margin-top:3px}.comments-empty{font-size:14px;color:var(--muted);padding:18px 0}.comments-list{max-height:280px;overflow:auto;overscroll-behavior:contain;margin:12px 0;scrollbar-width:thin}.comments-list:empty{display:none}.comment{padding:7px 10px;margin-bottom:4px;background:#f7f7fa;border-radius:10px}.comment.mine{background:#f3f0fc}.comment-author{font-size:14px;color:#726b83;margin-inline-end:6px}.comment-author::after{content:":"}.comment-author.w{color:#746149}.comment-author.b{color:#514073}.comment time{font-size:11px;color:#8b8496;margin-inline-start:8px;white-space:nowrap}.comment p{font-size:14px;line-height:1.7;margin:0;overflow-wrap:anywhere}.comment-text{white-space:pre-wrap}.comments form{border-top:1px solid var(--border);padding-top:14px}.comments label{display:block;font-size:14px;font-weight:600;margin-bottom:7px}.comments textarea{display:block;width:100%;resize:vertical;min-height:76px;max-height:200px;padding:10px 12px;font:inherit;font-size:16px;line-height:1.7;border:1px solid #dcd8e5;border-radius:10px;color:var(--navy);background:#fff}.comments textarea:focus{outline:2px solid #b6a9eb;outline-offset:1px}.comment-compose-actions{display:flex;justify-content:space-between;align-items:center;margin-top:8px;gap:12px}.comment-compose-actions>span{font-size:12px;color:var(--muted)}.comment-compose-actions .primary{min-height:40px;padding:8px 22px;font-size:14px}#comment-status{font-size:13px;color:var(--muted);line-height:1.7;margin-top:7px;min-height:0}#comment-status[data-error="true"]{color:#934632}@media(max-width:680px){.comments{margin-top:17px;padding:15px}.comments-list{max-height:250px}}

.profile-bar{max-width:1108px;margin:16px auto 0;display:flex;justify-content:space-between;align-items:center;gap:12px;padding:12px 16px;background:#fff;border:1px solid var(--border);border-radius:14px;font-size:14px;line-height:1.6}.profile-bar>div{min-width:0}.profile-bar strong{display:block;overflow-wrap:anywhere}.profile-bar span{display:block;color:var(--muted);font-size:13px}.profile-bar button{flex-shrink:0;color:var(--primary);background:#f3f1fb}.player-text{min-width:0}.player-text strong,.comment-author{overflow-wrap:anywhere}.player-text .player-record{font-size:12px;color:var(--primary);line-height:1.6}#profile-dialog{width:min(440px,calc(100% - 24px))}#profile-dialog label{display:block;margin:16px 0 8px;font-size:14px;font-weight:600}#profile-name{width:100%;font:inherit;font-size:16px;padding:12px;border:1px solid var(--border);border-radius:10px}#profile-error{color:#934632;min-height:22px;font-size:14px;line-height:1.6}.turn-badge{flex-shrink:0}
@media(max-width:680px){.profile-bar{margin:12px 12px 0;padding:10px 12px}.profile-bar strong{font-size:14px}.profile-bar span{font-size:12px}.profile-bar button{font-size:13px;padding:8px;max-width:42%;white-space:normal}.player{gap:9px}.player-text .player-record{font-size:12px}.turn-badge{max-width:110px;text-align:center;white-space:normal}}

.comments-profile-gate{border-top:1px solid var(--border);padding-top:14px;margin-top:12px;font-size:14px;line-height:1.7;color:var(--muted)}.comments-profile-gate .primary{margin-top:10px;min-height:44px}.color-option{min-width:0}.color-option span{overflow-wrap:anywhere}.board-frame{width:100%;min-width:0}
@media(max-width:380px){.level-icon{display:none}.brand{gap:8px}.brandmark{width:36px;height:36px}.header-actions .quiet{font-size:13px}.profile-bar{align-items:flex-start}.turn-badge{max-width:90px;padding:6px}.player-text strong{line-height:1.5}.comments{padding:12px}dialog{padding:20px}}

.learning-guide{margin-top:14px;padding:15px 17px;background:#f8f6ff;border:1px solid #ddd6f1;border-radius:16px;line-height:1.7}.guide-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:4px}.guide-heading h2{font-size:16px;color:#493c96}.guide-heading .quiet{font-size:13px;flex-shrink:0;background:#eee8fc;color:var(--primary)}#guide-toggle[aria-checked="false"]{background:#efedf2;color:var(--muted)}#guide-move{display:block;font-size:15px}#guide-reason{font-size:14px;margin-top:5px;color:#625a73}.guide-steps{font-size:13px;color:var(--primary);margin-top:7px}.guide-tip{font-size:12px;color:var(--muted);margin-top:6px}#guide-select,#guide-retry{margin-top:7px;color:var(--primary);background:#eee8fc;min-height:44px}.guide-square{box-shadow:inset 0 0 0 3px #6851bd}.guide-square::before{content:attr(data-guide-step);position:absolute;top:2px;right:2px;z-index:2;border-radius:50%;background:#5e4fcc;color:white;width:18px;height:18px;font-size:12px;font-weight:700;line-height:18px;text-align:center;pointer-events:none}.cell.check.guide-square{box-shadow:inset 0 0 0 3px #a33b36}.learning-guide p:empty{display:none}@media(max-width:680px){.learning-guide{padding:12px 14px;margin-top:10px;border-radius:15px}.guide-heading h2{font-size:15px}.guide-heading .quiet{padding:7px 10px}.guide-square::before{width:16px;height:16px;line-height:16px}.guide-square{box-shadow:inset 0 0 0 2px #6851bd}}

.guide-plan{white-space:pre-line;margin-top:10px;padding:10px 12px;border-radius:10px;background:#eeebf8;color:#514467;font-size:13px;line-height:1.8}.guide-analysis{font-size:12px;color:var(--muted);margin-top:4px}

.account-panel{border-top:1px solid var(--border);margin-top:22px;padding-top:20px;font-size:14px;line-height:1.7}.account-panel h3{font-size:18px;margin:0 0 6px}.account-panel p{margin:6px 0 14px;color:var(--muted)}.account-panel-actions{display:flex;gap:10px}.account-panel-actions button{flex:1;min-height:44px}.account-panel [hidden],.auth-dialog [hidden]{display:none!important}#account-member{position:relative;padding-right:80px}#account-linked{display:block;font-size:14px;overflow-wrap:anywhere;margin-top:4px}.account-verified{color:var(--primary);font-size:13px}#account-signout{position:absolute;right:0;top:0;min-height:44px}#account-panel-message:empty{display:none}#account-panel-message{color:#934632;margin-bottom:0}
#account-dialog{width:min(440px,calc(100vw - 28px));padding:0;border-radius:22px}.auth-top{display:flex;justify-content:space-between;align-items:center;padding:20px 24px 0;gap:12px}.auth-brand{display:flex;align-items:center;gap:9px;font-size:14px;font-weight:650;color:var(--muted)}.auth-body{padding:24px 28px 28px}.auth-body h2{font-size:27px;line-height:1.5;letter-spacing:-.5px;margin:0}.auth-body #account-intro{color:var(--muted);font-size:16px;line-height:1.7;margin:8px 0 0}.auth-body #account-destination{display:block;font-size:16px;line-height:1.6;overflow-wrap:anywhere;margin:4px 0 0}.auth-body form{margin-top:24px}.auth-body label{display:block;font-size:14px;font-weight:600;margin:0 0 8px}.auth-body input{width:100%;min-width:0;border:1px solid #dcd8e7;background:#fff;border-radius:12px;padding:13px 14px;font:inherit;font-size:16px;line-height:1.5;color:var(--navy);outline:none}.auth-body input:focus{border-color:var(--primary);box-shadow:0 0 0 3px #5e4fcc18}.auth-body input:disabled{background:#faf9fc}.auth-body #account-name-wrap{margin-bottom:18px}.auth-primary{width:100%;min-height:48px;margin-top:20px;border-radius:12px;font-size:16px;line-height:1.6;white-space:normal}.auth-body #account-code{text-align:center;font-size:24px;font-weight:650;letter-spacing:.18em;font-variant-numeric:tabular-nums}.auth-code-actions{display:flex;justify-content:space-between;flex-wrap:wrap;gap:8px;margin-top:10px}.auth-link{padding:8px 0;background:transparent;color:var(--primary);font-size:14px;font-weight:600;min-height:44px}.auth-link:hover{text-decoration:underline}.auth-switch{border-top:1px solid var(--border);margin-top:22px;padding-top:12px;text-align:center;font-size:14px;color:var(--muted)}.auth-switch .auth-link{margin-left:4px}.auth-footnote{text-align:center;color:var(--muted);font-size:13px;line-height:1.7;margin:14px 0 0}.auth-body #account-message{font-size:14px;line-height:1.7;color:#934632;margin:12px 0 0}.auth-body #account-message:empty{display:none}.auth-body #account-message[data-tone="info"]{color:var(--primary)}.auth-notice{background:#f4f1fc;color:var(--primary);border-radius:10px;padding:12px;font-size:14px;line-height:1.7}.auth-dialog button:disabled{opacity:.55;cursor:default}.auth-dialog .close{min-height:40px;min-width:40px}
@media(max-width:680px){#account-dialog{width:100%;max-width:100%;height:100dvh;max-height:100dvh;border:0;border-radius:0;margin:0;padding-top:env(safe-area-inset-top);padding-bottom:env(safe-area-inset-bottom);overflow-y:auto}.auth-top{padding:18px 20px 0}.auth-body{width:100%;max-width:440px;margin:0 auto;padding:40px 24px 28px}.auth-body h2{font-size:28px}.auth-switch{margin-top:28px}}@media(max-height:650px){.auth-body{padding-top:20px}.auth-body form{margin-top:18px}}

#profile-dialog [hidden]{display:none!important}.profile-dialog-top{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:24px}.profile-dialog-top h2{font-size:22px;line-height:1.5;margin:0}.profile-dialog-top .close{width:40px;height:40px}.profile-identity{display:flex;align-items:center;gap:16px}.profile-avatar{width:66px;height:66px;flex:0 0 66px;border-radius:20px;display:grid;place-items:center;background:#efebfa;color:var(--primary);font-size:27px;font-weight:650;line-height:1.6}.profile-identity-text{min-width:0}.profile-identity h3{margin:0 0 6px;font-size:23px;line-height:1.5;overflow-wrap:anywhere}.profile-status{font-size:13px;line-height:1.7;color:var(--muted)}.profile-edit-button{margin-top:16px;min-height:44px;padding:9px 18px;color:var(--primary);border:1px solid var(--border);border-radius:11px}.profile-overview-help{font-size:14px;line-height:1.7;color:var(--muted);margin:12px 0 24px}.profile-stats-label{font-size:14px;font-weight:600;margin:0 0 10px}.profile-stat-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}.profile-stat-grid>div{background:#f7f6fa;border:1px solid #eeeaf4;border-radius:14px;text-align:center;padding:14px 6px}.profile-stat-grid strong{display:block;font-size:25px;line-height:1.4;font-variant-numeric:tabular-nums}.profile-stat-grid span{display:block;font-size:14px;line-height:1.7;color:var(--muted);overflow-wrap:anywhere}#profile-notice{color:var(--primary);font-size:14px;line-height:1.6;margin-top:12px}#profile-notice:empty{display:none}#profile-form #profile-help{font-size:14px;color:var(--muted);line-height:1.7;margin:0 0 20px}#profile-form .dialog-actions button{min-height:44px}#profile-name:focus{outline:2px solid var(--primary);outline-offset:2px}@media(max-width:380px){.profile-identity{gap:12px}.profile-avatar{width:56px;height:56px;flex-basis:56px}.profile-identity h3{font-size:21px}.profile-stat-grid{gap:7px}}

.rematch-panel{display:flex;align-items:center;gap:16px;justify-content:space-between;background:#f2edfc;border:1px solid #ddd4f1;border-radius:16px;padding:16px;margin-top:14px}.rematch-panel>div{min-width:0}.rematch-panel h2{font-size:17px;line-height:1.6;margin:0}.rematch-panel p{font-size:14px;line-height:1.7;color:var(--muted);margin:5px 0 0}.rematch-panel .primary{min-height:44px;flex-shrink:0;max-width:50%;white-space:normal}#play-again{white-space:normal}#play-again:disabled,.rematch-panel button:disabled{opacity:.65;cursor:default}@media(max-width:680px){.rematch-panel{align-items:stretch;flex-direction:column;padding:14px;gap:12px}.rematch-panel .primary{max-width:none;width:100%}}

.comments-heading,.comments-heading>div{display:flex;align-items:center;gap:8px}.comments-heading{justify-content:space-between;gap:12px}.comments-heading h2{margin:0}.comments-heading .quiet{padding:6px 10px;min-height:36px;font-size:12px;color:var(--primary);background:#f3effb;white-space:normal}.comments-heading .quiet[aria-pressed="false"]{color:var(--muted);background:#f5f5f8}.comment-badge{display:inline-flex;align-items:center;justify-content:center;min-width:20px;height:20px;padding:0 5px;border-radius:12px;background:var(--primary);color:#fff;font-size:11px;font-weight:650;line-height:1}#mobile-chat{position:relative}#mobile-chat-unread{position:absolute;right:10%;top:0}.comment-toast{position:fixed;z-index:90;right:20px;bottom:20px;width:380px;max-width:calc(100vw - 32px);display:flex;align-items:flex-start;gap:4px;padding:6px 8px;background:white;border:1px solid #ded7ef;border-radius:16px;box-shadow:0 8px 28px #30264724}.comment-toast>button:first-child{flex:1;min-width:0;text-align:left;padding:8px;background:transparent;color:var(--navy);font-size:14px;line-height:1.6;border-radius:10px}.comment-toast>button:first-child:hover{background:#f7f5fc}#comment-toast-heading{display:block;color:var(--primary);font-size:12px;font-weight:600;margin-bottom:3px}#comment-toast-preview{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}#comment-toast-close{min-width:36px;padding:6px;font-size:20px}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}@media(max-width:680px){.comment-toast{bottom:calc(90px + max(env(safe-area-inset-bottom),var(--tg-safe-bottom,0px)));right:12px;max-width:calc(100vw - 24px)}body:has(#comment-text:focus) .comment-toast{bottom:12px}}

.board-turn{display:flex;align-items:center;justify-content:space-between;gap:10px;padding-top:8px;min-height:32px}.board-seat{font-size:13px;color:var(--muted);line-height:1.6}.board-turn .turn-badge{margin-left:auto}.play-area>.game-notice{margin:8px 0 10px}.board-turn .turn-badge{max-width:100%;white-space:normal}
