/* The live tally stays inside the result dialog's top layer. */
.counting-show{position:relative;color:#4d5b43;font-size:1rem;line-height:1.75;margin:10px 0 18px;isolation:isolate}
.count-head{position:relative;display:flex;gap:12px;align-items:center;min-height:88px;padding:10px 14px;margin:10px 0 14px;border:1px solid #d5ddc9;border-radius:16px;background:#fffdf7;overflow:hidden}
.count-head img{width:30px;height:45px;object-fit:contain;flex:none}.count-head p{font-size:1.125rem;font-weight:700;margin:0;line-height:1.7}
.count-head-copy{flex:1;min-width:0;padding-right:22px}
.count-next{display:block;position:relative;width:36px;height:32px;margin:0 0 0 auto;padding:0;min-height:32px;border:0;background:transparent;color:#77806e;font-size:0!important;cursor:pointer;opacity:.75;animation:count-cue-arrive 1.1s ease-out both,count-cue-breathe 3.6s ease-in-out 1.1s infinite}
.count-next:after{content:'';display:block;width:11px;height:13px;margin:auto;background:currentColor;clip-path:polygon(0 0,100% 50%,0 100%);border-radius:2px}
.count-head .count-next{position:absolute;right:3px;bottom:1px}
.count-next[hidden]{display:none}
.count-next:focus-visible{outline:2px solid #7c9265;outline-offset:3px;border-radius:5px}
.scoring-cue-row{display:none}
.scoring-mode .scoring-cue-row{display:flex;justify-content:flex-end;min-height:34px;margin-bottom:4px}
@keyframes count-cue-arrive{from{opacity:0}to{opacity:.75}}
@keyframes count-cue-breathe{0%,100%{opacity:.75}50%{opacity:.28}}
@media(prefers-reduced-motion:reduce){.count-next{animation:none}}
.count-root{max-width:390px;margin:auto}.count-board{position:relative;aspect-ratio:1;background:linear-gradient(110deg,#f0d9ad,#e8c58e 55%,#efd5a7);border:8px solid #d7b17b;border-radius:16px;box-shadow:inset 0 0 0 3px #f8e4c1;isolation:isolate}
.count-board>svg{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;overflow:visible}
.count-board>[data-count=grid]{z-index:0}.count-board [data-count=grid] line{stroke:#937343;stroke-width:1.5;opacity:.7}
.count-board>[data-count=hands]{z-index:3}.count-board .arm-hook{transform-box:fill-box;transform-origin:0% 50%}.count-board .arm-hook path{fill:none;stroke:#555e4c;stroke-width:4.5;stroke-linecap:round;stroke-linejoin:round}
.count-board .board-stone{position:absolute;width:7.7%;height:auto;aspect-ratio:1;transform:translate(-50%,-50%);z-index:4}.count-board .count-dead{opacity:.7;outline:2px dashed #aa8053;outline-offset:2px}
.count-board>[data-count=flags]{position:absolute;inset:0;overflow:hidden;pointer-events:none;z-index:5}
.counting-show .flag-token{position:absolute;width:7.8%;height:auto;aspect-ratio:34/40;transform:translate(-24%,-85%);z-index:5;pointer-events:none}
.counting-show .flag-token svg{display:block;width:100%;height:100%;overflow:visible}
.counting-show .flag-cloth{fill:var(--cloth);stroke:var(--edge);stroke-width:1}.counting-show .flag-shine{fill:var(--shine);opacity:.8}.counting-show .flag-token text{font-size:13px;font-weight:700;fill:#82602b}
.counting-show .count-live{display:flex;justify-content:center;gap:28px;margin:10px 0;padding:7px;border:1px solid #dcded0;background:#fffdf7;border-radius:10px;font-size:1rem}
.count-live>span{display:flex;align-items:center;gap:8px}.count-live strong{font-size:1.25rem;font-weight:600;font-variant-numeric:tabular-nums}
.count-komi{display:flex;gap:10px;align-items:center;flex-wrap:wrap;background:#faf6e9;border:1px dashed #d5c79e;border-radius:11px;padding:7px 12px;margin:12px 0;min-height:55px;font-size:.875rem;color:#806c46}
.counting-show [data-count=komiFlags]{display:flex;align-items:center;flex-wrap:wrap;min-height:32px}.counting-show [data-count=komiFlags] .flag-token{position:relative;left:auto!important;top:auto!important;transform:none;width:24px;height:30px}
.count-trays{display:grid;grid-template-columns:1fr 1fr;gap:10px}.count-tray{padding:10px;background:#eeede3;border-radius:12px;min-width:0}.count-tray b{display:block;font-weight:500;font-size:.8125rem;line-height:1.7}.count-tray b span{font-weight:700}
.counting-show .tray-pieces{display:flex;flex-wrap:wrap;align-items:center;gap:4px;margin-top:7px;min-height:22px}.counting-show .tray-pieces .stone{width:20px;height:20px}.counting-show .tray-pieces .flag-token{position:relative;left:auto!important;top:auto!important;transform:none;width:23px;height:28px}.counting-show .tray-pieces small{font-size:.75rem;line-height:1.6}.counting-show .extra-label{flex-basis:100%}
.counting-show .count-note{font-size:.9375rem;line-height:1.9;margin:14px 0;color:#647257;min-height:3.6em}
.count-overlay .demo-flight{position:absolute;transform:translate(-50%,-50%);z-index:20;pointer-events:none}
.count-board .impact-word{position:absolute;transform:translate(-50%,-100%);z-index:30;background:#fffbea;border:1px solid #b8ad89;border-radius:11px;padding:3px 7px;font-size:.875rem;color:#655c45;white-space:nowrap;pointer-events:none}
.count-board .impact-word:after{content:'';position:absolute;top:100%;left:50%;transform:translateX(-50%);width:8px;height:6px;background:#fffbea;clip-path:polygon(0 0,100% 0,50% 100%)}
.count-labels span{position:absolute;left:8%;font-size:.8125rem;font-weight:600;background:#f8f4d6e8;padding:0 6px;border-radius:6px;z-index:6}
.count-board.arranged>[data-count=grid],.count-board.arranged>[data-count=hands]{opacity:.1!important}.count-board.arranged .board-stone{opacity:.06!important}
.counting-show .count-overlay{position:absolute;inset:0;pointer-events:none;z-index:35}.count-overlay .travelling-flag,.count-overlay .dead-flight{position:absolute;pointer-events:none}
.result-dialog{width:620px}.result-count-toolbar{display:flex;align-items:center;justify-content:space-between;gap:14px;position:sticky;top:-30px;z-index:45;background:#f8f7f0f5;backdrop-filter:blur(4px);padding:8px 0;margin-bottom:8px;border-bottom:1px solid #e0e3d6}
.result-count-toolbar .count-controls{flex:1;margin:0;justify-content:flex-end;gap:18px}.result-count-toolbar .text-button{font-size:1rem;min-height:44px;letter-spacing:0}.result-count-toolbar form{margin:0}.result-count-toolbar .close-button{min-width:44px;min-height:44px}
#resultDialog .result-breakdown[hidden],#resultDialog #resultAfterCount[hidden],#resultDialog #resultStep[hidden],#resultDialog .result-breakdown tr[hidden]{display:none!important}
#resultDialog #resultAfterCount[hidden]{visibility:hidden}
#resultDialog .result-breakdown caption{font-size:.875rem;line-height:1.8}.result-dialog .result-step{min-height:0}
@media(max-width:700px){.result-dialog{padding:20px 16px}.result-count-toolbar{top:-20px}.result-count-toolbar .text-button{font-size:.875rem}.result-count-toolbar .count-controls{gap:12px}.count-head{min-height:82px;padding:9px 10px;gap:9px}.count-head p{font-size:1rem}.count-head img{width:26px;height:40px}.count-board{border-width:6px;border-radius:12px}.count-tray{padding:8px}.count-tray b{font-size:.75rem}.counting-show .tray-pieces .stone{width:18px;height:18px}.counting-show .count-note{font-size:.9375rem}.counting-show .count-live{gap:18px;font-size:.9375rem}.count-live strong{font-size:1.125rem}}
@media(min-width:701px){.result-dialog{width:760px}.counting-show{display:grid;grid-template-columns:minmax(0,360px) minmax(180px,1fr);grid-template-areas:'head head' 'board live' 'board komi' 'board trays' 'board note';gap:8px 18px;align-items:start}.count-head{grid-area:head;min-height:70px;margin:4px 0 8px}.count-root{grid-area:board;width:100%;margin:0;align-self:start}.counting-show .count-live{grid-area:live;flex-wrap:wrap;gap:8px 16px;margin:0;padding:8px}.count-komi{grid-area:komi;margin:0}.count-trays{grid-area:trays;grid-template-columns:1fr;gap:8px}.counting-show .count-note{grid-area:note;margin:0;min-height:0;font-size:.875rem;line-height:1.8}}
@media(max-width:700px){.result-count-toolbar>.eyebrow{display:none}.result-count-toolbar .text-button{font-size:1rem;white-space:nowrap}.result-count-toolbar .count-controls{gap:12px}}
.count-root{min-width:0}.count-board{width:100%}
.count-board.arranged [data-count=flags] .flag-token{width:var(--arranged-flag-size,7.8%)}
.dead-help{margin:14px 0;border:1px solid #d7dfcc;background:#f8faef;border-radius:12px;padding:8px 13px;font-size:1rem;line-height:1.85}.dead-help summary{cursor:pointer;padding:5px 0;color:#4e6543}.scoring-panel .dead-help p{font-size:.9375rem;max-width:none;margin:10px 0;color:#5c6c50}
.life-status{padding:12px 14px;background:#edf3e4;border:1px solid #c7d7b5;border-radius:12px;font-weight:600;line-height:1.85!important;color:#48613c!important}.life-status[data-state=unknown]{background:#faf2df;border-color:#ddcdaa;color:#766344!important}
/* Candidate stones hold a white flag until their removal is confirmed. */
.surrender-flag{position:absolute;left:48%;top:-43%;width:70%;height:85%;display:block;z-index:6;pointer-events:none;transform-origin:25% 90%;transform:rotate(-3deg);animation:raise-surrender-flag 350ms cubic-bezier(.15,.7,.25,1) 80ms both}
.surrender-flag svg{display:block;width:100%;height:100%;overflow:visible;filter:drop-shadow(0 1px 1px #5d58422b)}
.surrender-pole{stroke:#73776d;stroke-width:2.1;fill:none;stroke-linecap:round}.surrender-cloth{fill:#fffef8;stroke:#858a7a;stroke-width:1.15;stroke-linejoin:round}.surrender-shine{fill:none;stroke:white;stroke-width:1.3;stroke-linecap:round}
.cell.surrendering .stone{opacity:1;outline:none;animation:surrender-stone-pop 350ms ease-in-out both}
.count-board .count-dead{opacity:1;outline:none}
.count-board .surrender-flag,.count-overlay .dead-flight .surrender-flag{animation:none}
.scoring-panel .surrender-note{font-size:1rem;line-height:1.9;max-width:none;color:#5b6b4e;margin:4px 0 16px}
#surrenderNote[hidden]{display:none!important}
@keyframes surrender-stone-pop{0%{scale:1 1}23%{scale:1.12 .9}60%{scale:.96 1.055}83%{scale:1.015 .99}100%{scale:1 1}}
@keyframes raise-surrender-flag{0%{opacity:0;transform:translateY(10px) rotate(7deg) scale(.2,.7)}22%{opacity:1;transform:translateY(-3px) rotate(-5deg) scale(1.03,1.08)}45%{opacity:1;transform:translateY(0) rotate(-3deg) scale(1)}70%{opacity:1;transform:translateY(-1px) rotate(-1deg) scale(1)}100%{opacity:1;transform:translateY(0) rotate(-3deg) scale(1)}}
@media(prefers-reduced-motion:reduce){.surrender-flag,.cell.surrendering .stone{animation:none}}
.surrender-preview-notice{max-width:1060px;margin:16px auto 0;padding:10px 18px;background:#fff9e9;border:1px dashed #d6c89c;border-radius:11px;color:#7b6f49;font-size:.9375rem;line-height:1.8}
.surrender-preview-notice[hidden]{display:none!important}
@media(max-width:700px){.surrender-preview-notice{margin:14px 15px 0}}
/* The normal end review is one board and one choice; study tools belong elsewhere. */
.scoring-mode .layout{display:block;max-width:min(560px,calc(100svh - 348px));margin:20px auto;padding:0 18px}
.scoring-mode .board-heading,.scoring-mode .commentary-entry,.scoring-mode #broadcastSlot,.scoring-mode .under-board,.scoring-mode .actions,.scoring-mode .komi-promise,.scoring-mode .sidebar,.scoring-mode .page-footer{display:none}
.scoring-mode #boardLegend{visibility:hidden!important}
.scoring-mode .board[aria-disabled=true]{cursor:default}
.scoring-announcer{min-height:78px;margin:0 0 12px;overflow:hidden;padding-bottom:8px;pointer-events:none}
.scoring-announcer[hidden]{display:none}
.scoring-announcer .broadcast-card{grid-template-rows:auto;min-height:66px}
.scoring-announcer .broadcast-message{grid-row:1;font-size:1.25rem}
.scoring-announcer .broadcast-mic{grid-row:1}
.scoring-panel.surrender-confirmation{scroll-margin-bottom:12px;display:block;position:static;margin:16px 0 0;padding:19px 20px 20px;border-radius:16px;background:#fffdf7;box-shadow:0 3px 14px #30372212}
.scoring-panel.surrender-confirmation[hidden]{display:none}
.surrender-confirmation h2{font-size:1.375rem;font-weight:600;line-height:1.6;margin:0 0 16px;color:#3d5035}
.surrender-confirmation #surrenderNote{font-size:1rem;line-height:1.7;margin:0 0 16px;color:#6a715e}
.surrender-confirmation .scoring-actions{padding:0;display:grid;grid-template-columns:1fr 1fr;gap:12px}
.scoring-panel.surrender-confirmation .scoring-actions .button{font-size:1.125rem;min-height:54px;padding:11px 8px}
@media(max-width:700px){.scoring-mode .layout{max-width:560px;margin:14px auto;padding:0 12px}.scoring-announcer{min-height:74px;margin-bottom:6px}.scoring-announcer .broadcast-message{font-size:1.125rem}.scoring-panel.surrender-confirmation{margin-top:12px;padding:16px}.surrender-confirmation h2{font-size:1.25rem;line-height:1.6;margin-bottom:14px}.scoring-panel.surrender-confirmation .scoring-actions .button{font-size:1.0625rem}}

/* In both modes the board and the trays share the viewport during counting. */
.game-result{
 --tally-size:clamp(132px,calc(100dvh - 254px),380px);
 --final-board-size:clamp(110px,calc(100dvh - 425px),220px);
 width:740px;max-width:calc(100% - 16px);max-height:calc(100dvh - 16px);padding:12px 16px;overflow-x:hidden;
}
.game-result [hidden]{display:none!important}
.game-result .result-count-toolbar{top:0;gap:6px;padding:0 5px 4px 9px;margin:0 0 8px}
.game-result .result-count-toolbar h2{flex:1;min-width:0;margin:0;font-size:clamp(1.0625rem,4.8vw,1.375rem);line-height:1.25}
.game-result .result-count-toolbar .count-controls{flex:none;min-height:0}
.game-result .result-count-toolbar .text-button{min-height:44px;padding:4px 7px;font-size:.875rem;white-space:nowrap}
.game-result .result-ribbon{
 display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:3px 14px;
 margin:0 0 8px;padding:5px 8px;min-height:40px;border:1px solid #859472;border-radius:8px;
 background:#eaf0db;color:#304927;font-size:clamp(.9375rem,4.3vw,1.25rem);line-height:1.25;
 font-variant-numeric:tabular-nums;
}
.game-result .result-ribbon-side,.game-result .result-verdict{display:inline-flex;align-items:center;gap:4px;white-space:nowrap}
.game-result .visually-hidden{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.game-result .result-ribbon .mini-stone{width:16px;height:16px;flex:none}
.game-result .result-verdict{padding-left:10px;border-left:1px solid #aab799}
.game-result .result-panels{min-width:0}
.game-result .counting-show{margin:0}
.game-result .count-root{width:min(100%,var(--tally-size));margin:0 auto}
.game-result .count-board{border-width:clamp(4px,1.4vw,8px)}
.game-result .count-labels span{font-size:.75rem;line-height:1.2;padding:1px 4px}
.game-result .count-head{min-height:74px}
.game-result .count-head .count-next{min-height:32px;padding:0}
.game-result .count-head .count-next[hidden]{display:block!important;visibility:hidden}
.game-result.result-complete .counting-show{display:block}
.game-result.result-complete .count-root{width:min(100%,var(--final-board-size))}
.game-result.result-complete :is(.count-head,.count-live,.count-komi,.count-trays,.count-note,.count-reveal){display:none}
.game-result .result-step{margin:4px 0;min-height:0;font-size:.875rem;line-height:1.45}
.game-result .result-breakdown{margin:0 0 3px;table-layout:auto}
.game-result .result-breakdown thead td{width:auto}
.game-result .result-breakdown thead th{font-size:1rem;padding:2px 4px;white-space:nowrap}
.game-result .result-breakdown small{line-height:1.3}
.game-result .result-breakdown .mini-stone{margin-right:4px}
.game-result .result-breakdown tbody th,.game-result .result-breakdown tbody td{padding:4px;line-height:1.25}
.game-result .result-breakdown tbody td{white-space:nowrap;overflow-wrap:normal}
.game-result .result-breakdown .result-total td{font-size:1.25rem}
.game-result .result-message{margin:5px 0 0;line-height:1.4;font-size:.875rem;color:#526047}
.game-result .result-actions{display:flex;flex-wrap:wrap;gap:8px}
.game-result .result-actions .button{flex:1 1 auto;min-height:44px;padding:5px 7px;font-size:.9375rem}
.game-result .closing-ring{height:clamp(154px,24dvh,200px);margin:6px auto;overflow:visible}
.game-result .closing-reply:not(.below){transform:translate(-50%,calc(-100% - 11px))}
.game-result .closing-reply.below{transform:translate(-50%,11px)}
.game-result .counting-show .tray-pieces{min-height:21px;margin-top:3px;gap:3px}
.game-result .counting-show .tray-pieces :is(.stone,.flag-token){flex:none;width:18px;height:18px}
.game-result .counting-show .tray-pieces .flag-token{height:21px}
.game-result .tray-pieces small{white-space:nowrap}
@media(min-width:701px){
 .game-result .counting-show{grid-template-columns:minmax(0,var(--tally-size)) minmax(190px,1fr);grid-template-areas:'head head' 'board trays' 'board komi';grid-template-rows:auto auto 1fr}
 .game-result.result-complete .result-panels{display:grid;grid-template-columns:minmax(0,var(--final-board-size)) minmax(0,1fr);gap:18px;align-items:center}
 .game-result{--final-board-size:clamp(112px,calc(100dvh - 240px),255px)}
}
@media(max-width:700px){
 .game-result{padding:10px 14px}
 .game-result .result-count-toolbar{margin-bottom:4px}
 .game-result .counting-show{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);grid-template-areas:'head head' 'board board' 'trays trays' 'komi komi';gap:6px}
 .game-result .count-head{grid-area:head;min-height:74px;margin:0;padding:9px 10px;border-radius:10px;align-items:center}
 .game-result .count-head img{width:23px;height:31px}
 .game-result .count-head p{font-size:1rem;line-height:1.3}
 .game-result .count-root{grid-area:board}
 .game-result .counting-show .count-live{grid-area:live;flex-wrap:wrap;align-content:center;gap:2px 7px;margin:0;padding:4px;font-size:.75rem}
 .game-result .count-live>span{gap:3px}
 .game-result .count-live .mini-stone{width:12px;height:12px}
 .game-result .count-live strong{font-size:.9375rem}
 .game-result .count-komi{grid-area:komi;display:flex;justify-content:center;align-items:center;gap:8px;min-height:32px;margin:0;padding:3px 5px;font-size:.8125rem;line-height:1.25}
 .game-result .counting-show [data-count=komiFlags]{min-height:19px}
 .game-result .counting-show [data-count=komiFlags] .flag-token{width:16px;height:19px}
 .game-result .count-trays{grid-area:trays;gap:6px}
 .game-result .count-tray{padding:4px 6px;border-radius:9px}
 .game-result .count-tray b{line-height:1.35}
 .game-result .counting-show .count-note{grid-area:note;min-height:0;margin:0;font-size:.8125rem;line-height:1.5}
 .game-result .result-score-sheet{margin-top:3px}
}
@media(max-width:700px) and (max-height:780px){
 .game-result.result-complete .result-panels{
  display:grid;grid-template-columns:minmax(0,clamp(100px,33%,160px)) minmax(0,1fr);gap:8px;align-items:start
 }
 .game-result.result-complete .count-root{width:100%}
 .game-result .result-score-sheet{margin:0;min-width:0}
 .game-result .result-breakdown :is(thead th,tbody th,tbody td){font-size:.875rem}
 .game-result .result-breakdown .result-total td{font-size:1rem}
 .game-result .result-breakdown .mini-stone{width:13px;height:13px;margin-right:2px}
}
@media(max-width:700px) and (max-height:620px){
 .game-result{--tally-size:clamp(128px,calc(100dvh - 254px),380px)}
 .game-result .closing-ring .closing-stone{width:22px;height:22px}
 .game-result .closing-reply:not(.below){transform:translate(-50%,calc(-100% - 8px))}
 .game-result .closing-reply.below{transform:translate(-50%,8px)}
}

/* The stones travel from a compact pile; only the final reveal shows the score. */
.count-komi[data-visible=false]{visibility:hidden}
.counting-show .tray-bundle{position:relative;display:inline-flex;align-items:center;gap:3px;height:28px;min-width:48px;padding:0 4px 0 0;border-radius:9px;background:#dedfd0}
.counting-show .tray-stack{position:relative;display:block;width:29px;height:26px}
.game-result .counting-show .tray-stack :is(.stone,.flag-token){position:absolute;left:0!important;top:8px!important;width:16px;height:16px;transform:none}
.game-result .counting-show .tray-stack :is(.stone,.flag-token):nth-child(2){left:12px!important;top:8px!important}
.game-result .counting-show .tray-stack :is(.stone,.flag-token):nth-child(3){left:6px!important;top:1px!important}
.game-result .counting-show .tray-stack .flag-token{height:19px}
.game-result .counting-show .tray-bundle small{font-size:.8125rem;font-weight:700}
.game-result .counting-show .tray-pieces{min-height:28px;flex-wrap:nowrap}
.count-transform-shine{position:absolute;width:26px;height:26px;transform:translate(-50%,-50%);filter:drop-shadow(0 0 3px #fff3bc);pointer-events:none}
.count-transform-shine svg{display:block;width:100%;height:100%;overflow:visible}
.game-result .count-reveal{position:absolute;left:8px;right:8px;top:4px;z-index:40;min-height:40px;box-shadow:0 3px 12px #4d5b4326}
.game-result .counting-show[data-stage='5'] .count-head-copy,.game-result .counting-show[data-stage='5'] .count-head img{visibility:hidden}
.game-result .counting-show[data-stage='5'] .count-trays,.game-result .counting-show[data-stage='5'] .count-komi{visibility:hidden}
