/* Make the current turn and the next action readable at a glance. */
#colorlink-game .turn-badge{display:flex;align-items:center;justify-self:stretch;gap:12px;width:100%;min-height:58px;padding:7px 14px;border:1px solid var(--panel-edge);border-radius:12px;background:var(--surface);color:var(--muted-foreground);font-size:1.25rem;font-weight:850;line-height:1.2;letter-spacing:-.02em;white-space:nowrap;box-sizing:border-box}
#colorlink-game .turn-badge[hidden]{display:none}
#colorlink-game .turn-portrait{display:block;flex:none;width:42px;height:42px}
#colorlink-game .turn-portrait svg{display:block;width:100%;height:100%}
#colorlink-game .turn-badge.is-mine{--turn-icon-surface:#116d49;background:#116d49;border-color:#116d49;color:#fff;box-shadow:0 3px 10px #116d4926}
#colorlink-game .turn-badge.is-waiting{--turn-icon-surface:#295aa3;background:#295aa3;border-color:#295aa3;color:#fff;box-shadow:0 3px 10px #295aa31f}
#colorlink-game .turn-badge.turn-arrival{animation:turn-arrival .65s cubic-bezier(.2,.8,.2,1)}
body.game-screen-active #colorlink-game[data-turn="mine"] .gl-board-stage{border-color:#5aa982;box-shadow:inset 0 0 0 1px #29a36822,0 0 14px #29a36812}
body.game-screen-active #colorlink-game[data-turn="opponent"] .gl-board-stage{border-color:#8ca2c8;box-shadow:inset 0 0 0 1px #6684ba16}
:root[data-theme="dark"] #colorlink-game .turn-badge.is-mine{--turn-icon-surface:#116b48;background:#116b48;border-color:#60c899;color:#fff}
:root[data-theme="dark"] #colorlink-game .turn-badge.is-waiting{--turn-icon-surface:#28579b;background:#28579b;border-color:#8aaee9;color:#fff}
@keyframes turn-arrival{0%{transform:translateY(4px) scale(.96);filter:brightness(1.3)}55%{transform:translateY(-1px) scale(1.015)}100%{transform:translateY(0) scale(1);filter:brightness(1)}}
/* The width of the bar is the time remaining; the empty track is elapsed time. */
#colorlink-game #cl-clock.timer-clock{display:grid;align-items:center;gap:4px;min-width:0;padding:3px 0;color:var(--foreground);font-variant-numeric:tabular-nums}
#colorlink-game #cl-clock.timer-clock[hidden]{display:none}
#colorlink-game #cl-clock .timer-heading{display:flex;align-items:center;gap:6px;min-width:0;line-height:1}
#colorlink-game #cl-clock .timer-icon{display:block;width:19px;height:19px;flex:none;color:var(--muted-foreground)}
#colorlink-game #cl-clock .timer-icon svg{display:block;width:100%;height:100%}
#colorlink-game #cl-clock .timer-label{font-size:.72rem;line-height:1.15;font-weight:700;color:var(--muted-foreground);white-space:nowrap}
#colorlink-game #cl-clock .timer-value{margin-left:auto;font-size:1.8rem;line-height:1;font-weight:850;letter-spacing:-.035em;white-space:nowrap;color:inherit}
#colorlink-game #cl-clock .timer-track{display:block;width:100%;height:9px;overflow:hidden;border:1px solid #8ba2bd55;border-radius:999px;background:#acbed13b}
#colorlink-game #cl-clock .timer-fill{display:block;width:100%;height:100%;border-radius:inherit;background:linear-gradient(90deg,#2b9b82,#63cba4);transform-origin:left center;transition:transform .2s linear,background .2s ease}
#colorlink-game #cl-clock[data-timer-state="warning"]{color:#a46400}
#colorlink-game #cl-clock[data-timer-state="warning"] .timer-fill{background:linear-gradient(90deg,#c17c10,#f2bd43)}
#colorlink-game #cl-clock[data-timer-state="urgent"],#colorlink-game #cl-clock[data-timer-state="expired"]{color:var(--error)}
#colorlink-game #cl-clock[data-timer-state="urgent"] .timer-fill,#colorlink-game #cl-clock[data-timer-state="expired"] .timer-fill{background:var(--error)}
#colorlink-game #cl-clock[data-timer-state="urgent"] .timer-track{box-shadow:0 0 0 2px #ed5b5720;border-color:#e15b62}
#colorlink-game #cl-clock[data-timer-state="preparing"] .timer-fill{background:#8b9cb4}
:root[data-theme="dark"] #colorlink-game #cl-clock[data-timer-state="warning"]{color:#ffd17d}
@media(max-width:899px), (max-width:1199px) and (orientation:portrait) and (min-height:521px){
 #colorlink-game .turn-portrait{width:30px;height:30px}
 #colorlink-game #cl-clock .timer-label{font-size:.62rem}
 #colorlink-game #cl-clock .timer-value{font-size:1.55rem}
 #colorlink-game #cl-clock .timer-icon{width:15px;height:15px}
 #colorlink-game #cl-clock .timer-track{height:8px}
}
@media(max-height:520px) and (min-width:600px){
 #colorlink-game .turn-portrait{width:26px;height:26px}
 #colorlink-game #cl-clock.timer-clock{padding:1px 0;gap:3px}
 #colorlink-game #cl-clock .timer-value{font-size:1.4rem}
 #colorlink-game #cl-clock .timer-label{font-size:.62rem}
 #colorlink-game #cl-clock .timer-icon{width:15px;height:15px}
 #colorlink-game #cl-clock .timer-track{height:7px}
}
@media(prefers-reduced-motion:reduce){#colorlink-game .turn-badge.turn-arrival{animation:none}#colorlink-game #cl-clock .timer-fill{transition:none}}
#colorlink-game #cl-status{min-height:0;padding:12px 14px;border:1px solid var(--panel-edge);border-radius:12px;background:var(--surface);font-size:1.05rem;line-height:1.45}
#colorlink-game #cl-score{font-variant-numeric:tabular-nums;line-height:1.5}
#colorlink-game .game-action-hint{color:var(--muted-foreground);font-size:.9rem;line-height:1.45}
#colorlink-game #cl-message:not(:empty){padding:9px 12px;border-left:3px solid var(--primary);border-radius:4px;background:var(--surface);line-height:1.5}
/* A disabled board remains easy to read while the opponent is playing. */
#colorlink-game #cl-board .btn:disabled{opacity:1}
#colorlink-game #cl-board .btn:focus-visible,#colorlink-game #cl-palette .btn:focus-visible,#colorlink-game .actions .btn:focus-visible{outline:3px solid #efb800;outline-offset:2px;position:relative;z-index:1}
#colorlink-game .actions{padding:4px 0 2px}
#colorlink-game .actions .btn{min-height:46px}
#colorlink-game .actions .btn-primary:disabled{opacity:.65}
#colorlink-game #cl-actions .btn[data-action="give-up"]{min-width:86px;white-space:nowrap;font-weight:750;border-color:#d89aa8;background:#fff1f4;color:#9e2d47}
#colorlink-game #cl-actions .btn[data-action="give-up"]:hover:not(:disabled){border-color:#bc6077;background:#ffe3ea;color:#8f1e39}
#colorlink-game #cl-actions .btn[data-action="give-up"]:disabled{opacity:.55}
:root[data-theme="dark"] #colorlink-game #cl-actions .btn[data-action="give-up"]{border-color:#a65f73;background:#482735;color:#ffd0da}
:root[data-theme="dark"] #colorlink-game #cl-actions .btn[data-action="give-up"]:hover:not(:disabled){border-color:#d1879d;background:#603044;color:#ffe5eb}
#colorlink-game #cl-scroll-hint{display:flex;justify-content:space-between;align-items:center;gap:8px;color:var(--muted-foreground);font-size:.85rem;line-height:1.4}
#colorlink-game .board-scroll-controls{display:inline-flex;gap:6px;flex:none}
#colorlink-game .board-scroll-button{min-width:44px;min-height:40px;padding:5px 10px}
#colorlink-game .board-scroll{scrollbar-color:var(--edge) transparent;scrollbar-width:thin}
@media(min-width:580px){#colorlink-game #cl-palette{grid-template-columns:repeat(7,minmax(0,1fr))}}
@media(max-width:480px){#colorlink-game #cl-status{font-size:1rem;padding:10px 12px}#colorlink-game .game-action-hint{font-size:.85rem}#colorlink-game #cl-score{font-size:.9rem}}

/* Pointed hexagons use staggered rows, matching odd-r adjacency in game.js. */
#colorlink-game .board.hex-board { gap:0; grid-auto-rows:calc(var(--hex-cell) * .8660254); padding-bottom:calc(var(--hex-cell) * .288675); }
#colorlink-game .board.hex-board > * { width:var(--hex-cell); height:calc(var(--hex-cell) * 1.1547); aspect-ratio:auto; border-radius:0; clip-path:polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
#colorlink-game .board.hex-board > .hex-shift { margin-left:calc(var(--hex-cell) / 2); }
#colorlink-game .board.hex-board > button { font-size:clamp(.66rem, 2vw, 1rem); }
#colorlink-game .bridge-info { display:inline-flex; padding:5px 10px; border:1px solid var(--panel-edge); border-radius:999px; background:var(--surface); font-weight:700; font-size:.9rem; white-space:nowrap; }

/* Keep hex boundaries legible even where neighbouring cells share an edge. */
#colorlink-game .board.hex-board > .viz-tile { position:relative; background-color:var(--surface); }
#colorlink-game .board.hex-board > .viz-tile::before {
 content:''; position:absolute; inset:0; z-index:1; pointer-events:none;
 background:center / 100% 100% no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 115' preserveAspectRatio='none'%3E%3Cpolygon points='50,2 98,29 98,86 50,113 2,86 2,29' fill='none' stroke='%237d92a8' stroke-width='1.5' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
}
:root[data-theme="dark"] #colorlink-game .board.hex-board > .viz-tile::before {
 background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 115' preserveAspectRatio='none'%3E%3Cpolygon points='50,2 98,29 98,86 50,113 2,86 2,29' fill='none' stroke='%23acc4da' stroke-width='1.5' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
}
#colorlink-game .board .endpoint-cell { position:relative; background:var(--surface) !important; }
#colorlink-game .board .endpoint-disc { position:absolute; z-index:2; left:50%; top:50%; transform:translate(-50%,-50%); width:68%; aspect-ratio:1; border-radius:50%; display:grid; place-items:center; border:2px solid #24344c; box-shadow:0 1px 3px #0006; font-weight:800; line-height:1; }
#colorlink-game .board .endpoint-disc.pending-marker { border-style:dashed; }
#colorlink-game .board .provisional-endpoint .endpoint-disc { opacity:.78; }

/* The active game fits the complete board to the space provided by its shell. */
body.game-screen-active #colorlink-game #cl-board { max-width:none; flex:none; }
body.game-screen-active #colorlink-game #cl-board:not(.hex-board) { gap:clamp(1px,.25vmin,3px); }
body.game-screen-active #colorlink-game #cl-board > button { font-size:clamp(7px,calc(var(--board-cell,30px) * .43),18px); }
body.game-screen-active #colorlink-game #cl-board .endpoint-disc { border-width:clamp(1px,calc(var(--board-cell,30px) * .05),2px); }
body.game-screen-active #colorlink-game #cl-board .bridge-colors { font-size:clamp(6px,calc(var(--board-cell,30px) * .25),11px); }
body.game-screen-active #colorlink-game #cl-scroll-hint { display:none !important; }
