/* An isolated practice flow, with the same colors and spacing as the online game. */
.tutorial-entry { display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap; padding:16px; margin:0 0 18px; border:1px solid #8db6ef; border-radius:12px; background:linear-gradient(115deg,#edf5ff,#f7fbff); }
.tutorial-entry-button { flex:none; border-color:#396cb3; color:#143d79; font-weight:700; }
:root[data-theme="dark"] .tutorial-entry { background:linear-gradient(115deg,#1a3458,#202b3b); border-color:#627fa7; }
:root[data-theme="dark"] .tutorial-entry-button { color:#e2efff; }

#tutorial { margin-bottom:20px; }
#tutorial .tu-panel { display:grid; gap:12px; padding:22px; border:1px solid var(--panel-edge); border-radius:16px; background:var(--surface); box-shadow:0 8px 28px #14254616; }
#tutorial .tu-header { display:flex; align-items:center; justify-content:space-between; gap:10px; }
#tutorial .tu-heading { display:flex; align-items:center; gap:8px; min-width:0; }
#tutorial .tu-header h2 { margin:0; color:var(--foreground); font-size:1.3rem; letter-spacing:-.02em; }
#tutorial .tu-header .btn { flex:none; min-height:40px; }
#tutorial .tu-progress { flex:none; margin:0; padding:5px 10px; border-radius:999px; background:#e5f0ff; color:#214f91; font-size:.82rem; font-weight:750; line-height:1.35; }
:root[data-theme="dark"] #tutorial .tu-progress { background:#243e65; color:#d3e7ff; }
#tutorial .tu-instruction { margin:0; color:var(--foreground); font-size:1rem; font-weight:650; line-height:1.5; }
#tutorial .tu-notice { margin:0; color:var(--foreground); font-size:.91rem; line-height:1.4; }
#tutorial .tu-rules { display:flex; gap:4px; flex-wrap:wrap; margin:0; color:var(--muted-foreground); font-size:.84rem; line-height:1.4; }
#tutorial .tu-rules span { padding:2px 6px; border-radius:5px; background:var(--hover); color:var(--foreground); }
#tutorial :is(.tu-rules,.tu-notice,.tu-palette)[hidden] { display:none; }
#tutorial .tu-palette { display:flex; gap:6px; flex-wrap:wrap; }
#tutorial .tu-color { min-width:54px; min-height:44px; font-weight:750; }
#tutorial .tu-color[aria-pressed="true"] { outline:3px solid #ffcf00; outline-offset:2px; }
#tutorial .tu-board { display:grid; grid-template-columns:repeat(var(--tu-size, 7),minmax(0,1fr)); gap:4px; width:min(100%,560px); touch-action:none; user-select:none; -webkit-user-select:none; }
#tutorial .tu-cell { position:relative; min-width:0; width:100%; aspect-ratio:1; padding:0; border:1px solid var(--edge); border-radius:5px; background:var(--surface); color:var(--foreground); font:inherit; font-weight:750; cursor:pointer; }
#tutorial .tu-cell:disabled { opacity:1; cursor:default; }
#tutorial .tu-cell.tu-wall { background:var(--muted); opacity:.65; cursor:default; }
#tutorial .tu-cell[data-route] { border-color:#627e9b; }
#tutorial .tu-disc { position:absolute; display:grid; place-items:center; left:50%; top:50%; width:70%; aspect-ratio:1; transform:translate(-50%,-50%); border:2px solid #26364a; border-radius:50%; box-shadow:0 1px 3px #0005; font-weight:800; line-height:1; }
#tutorial .tu-disc.tu-pending { border-style:dashed; }
#tutorial .tu-actions { display:flex; gap:8px; flex-wrap:wrap; }
#tutorial .tu-actions .btn { min-height:44px; }
#tutorial :is(button,select):focus-visible, #tutorial-open:focus-visible { outline:3px solid #efb800; outline-offset:3px; position:relative; z-index:2; }
@media(max-width:520px) { .tutorial-entry { align-items:stretch; } .tutorial-entry-button { width:100%; } #tutorial .tu-panel { padding:16px; } #tutorial .tu-board { gap:3px; } #tutorial .tu-cell { font-size:.88rem; } }

/* Practice uses the available viewport instead of the large lobby masthead. */
body:has(#tutorial:not([hidden])) main { max-width:1120px; padding:10px 14px; }
body:has(#tutorial:not([hidden])) .brand-hero,
body:has(#tutorial:not([hidden])) .header-label { display:none; }
body:has(#tutorial:not([hidden])) .site-header { margin-bottom:8px; }
body:has(#tutorial:not([hidden])) .header-controls { justify-content:flex-end; margin:0; }
body:has(#tutorial:not([hidden])) .display-settings { margin:0; }
body:has(#tutorial:not([hidden])) .setting-btn { min-height:34px; padding:4px 9px; font-size:.78rem; }
body:has(#tutorial:not([hidden])) .music-volume-control { min-height:34px; padding:0 6px; }
#tutorial { margin:0; }
#tutorial .tu-panel { grid-template-columns:minmax(0,1fr) minmax(280px,.8fr); grid-template-rows:repeat(6,auto); column-gap:24px; row-gap:9px; padding:18px; align-items:start; min-height:calc(100dvh - 74px); }
#tutorial .tu-header { grid-column:2; grid-row:1; }
#tutorial .tu-instruction { grid-column:2; grid-row:2; }
#tutorial .tu-rules { grid-column:2; grid-row:3; }
#tutorial .tu-notice { grid-column:2; grid-row:4; }
#tutorial .tu-palette { grid-column:2; grid-row:5; }
#tutorial .tu-board { grid-column:1; grid-row:1 / 7; align-self:center; justify-self:center; width:min(100%,calc(100dvh - 118px)); aspect-ratio:1; }
#tutorial .tu-actions { grid-column:2; grid-row:6; gap:6px; }
#tutorial .tu-panel[data-stage="2"] .tu-palette:not([hidden]) { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); }
#tutorial .tu-panel[data-stage="2"] .tu-color { min-width:0; min-height:36px; padding:4px 2px; font-size:.82rem; }
#tutorial .tu-board.tu-hex-board { grid-auto-rows:calc(var(--tu-hex-cell) * .8660254); gap:0; aspect-ratio:7.5 / 6.35085; padding-bottom:calc(var(--tu-hex-cell) * .288675); }
#tutorial .tu-board.tu-hex-board > .tu-cell { width:var(--tu-hex-cell); height:calc(var(--tu-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%); }
#tutorial .tu-board.tu-hex-board > .tu-hex-shift { margin-left:calc(var(--tu-hex-cell) / 2); }
#tutorial .tu-board.tu-hex-board > .tu-outside { visibility:hidden; pointer-events:none; }
#tutorial .tu-board.tu-hex-board > button::before { content:''; position:absolute; inset:0; pointer-events:none; z-index:1; 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"] #tutorial .tu-board.tu-hex-board > button::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"); }
#tutorial .tu-cross-target { box-shadow:inset 0 0 0 3px #e5b52f; font-size:1.3rem; color:#9d6a00; }
#tutorial .tu-disc { z-index:2; }
#tutorial .tu-bridge-junction { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; z-index:3; filter:drop-shadow(0 1px 2px #0007); }
#tutorial .tu-bridge-outline, #tutorial .tu-bridge-deck, #tutorial .tu-bridge-planks { fill:none; stroke-linecap:round; stroke-linejoin:round; }
#tutorial .tu-bridge-outline { stroke:#63330f; stroke-width:25; }
#tutorial .tu-bridge-deck { stroke:#d6a15c; stroke-width:19; }
#tutorial .tu-bridge-planks { stroke:#95602c; stroke-width:2; }
#tutorial .tu-bridge-hub { fill:#e3b46f; stroke:#955d28; stroke-width:1.5; }

@media(max-width:679px) and (min-height:521px), (max-width:599px) {
 body:has(#tutorial:not([hidden])) main { padding:6px 8px; }
 body:has(#tutorial:not([hidden])) .site-header { margin-bottom:5px; }
 body:has(#tutorial:not([hidden])) .display-settings { justify-content:flex-end; gap:4px; width:100%; }
 body:has(#tutorial:not([hidden])) .setting-btn { min-height:30px; font-size:.7rem; padding:3px 6px; }
 body:has(#tutorial:not([hidden])) .music-volume-control { min-height:30px; width:100%; font-size:.72rem; }
 #tutorial .tu-panel { display:flex; flex-direction:column; gap:6px; padding:10px; min-height:0; }
 #tutorial .tu-panel > * { flex:none; max-width:100%; }
 #tutorial .tu-header { width:100%; }
 #tutorial .tu-header h2 { font-size:1rem; }
 #tutorial .tu-header .btn { min-height:32px; padding:4px 9px; font-size:.8rem; }
 #tutorial .tu-progress { font-size:.73rem; padding:3px 8px; }
 #tutorial .tu-instruction { font-size:.84rem; line-height:1.35; }
 #tutorial .tu-notice { font-size:.8rem; line-height:1.35; }
 #tutorial .tu-rules { font-size:.74rem; line-height:1.3; }
 #tutorial .tu-palette { gap:4px; width:100%; }
 #tutorial .tu-color { min-width:44px; min-height:34px; padding:4px 7px; font-size:.82rem; }
 #tutorial .tu-panel[data-stage="2"] .tu-color { min-height:30px; font-size:.75rem; }
 #tutorial .tu-board { align-self:center; }
 #tutorial .tu-board.tu-hex-board { width:min(100%,max(248px,calc((100dvh - 410px) * 1.18))); }
 #tutorial .tu-actions { width:100%; gap:5px; }
 #tutorial .tu-actions .btn { min-height:36px; padding:5px 7px; font-size:.76rem; }
}
@media(max-height:520px) and (min-width:600px) {
 body:has(#tutorial:not([hidden])) main { max-width:1120px; padding:5px 8px; }
 body:has(#tutorial:not([hidden])) .site-header { margin-bottom:4px; }
 body:has(#tutorial:not([hidden])) .display-settings { gap:4px; justify-content:flex-end; flex-wrap:nowrap; }
 body:has(#tutorial:not([hidden])) .setting-btn { min-height:28px; padding:3px 7px; font-size:.68rem; }
 body:has(#tutorial:not([hidden])) .music-volume-control { min-height:28px; width:auto; font-size:.68rem; }
 body:has(#tutorial:not([hidden])) .music-volume-control input[type=range] { width:80px; min-height:24px; }
 #tutorial .tu-panel { grid-template-columns:minmax(220px,.82fr) minmax(0,1.18fr); gap:5px 14px; padding:9px 12px; min-height:0; }
 #tutorial .tu-board { width:min(100%,calc(100dvh - 66px)); gap:2px; }
 #tutorial .tu-board.tu-hex-board { width:min(100%,calc((100dvh - 66px) * 1.18)); }
 #tutorial .tu-header h2 { font-size:.95rem; }
 #tutorial .tu-header .btn { min-height:28px; padding:3px 7px; font-size:.75rem; }
 #tutorial .tu-progress { padding:2px 7px; font-size:.7rem; }
 #tutorial .tu-instruction { font-size:.79rem; line-height:1.3; }
 #tutorial .tu-notice { font-size:.75rem; line-height:1.3; min-height:0; }
 #tutorial .tu-rules { font-size:.7rem; line-height:1.25; }
 #tutorial .tu-palette { gap:3px; }
 #tutorial .tu-color, #tutorial .tu-panel[data-stage="2"] .tu-color { min-height:30px; min-width:36px; padding:3px; font-size:.72rem; }
 #tutorial .tu-panel[data-stage="2"] .tu-palette { grid-template-columns:repeat(14,minmax(0,1fr)); }
 #tutorial .tu-panel[data-stage="2"] .tu-color { min-width:0; }
 #tutorial .tu-actions .btn { min-height:30px; padding:3px 6px; font-size:.72rem; }
}

/* Hints are overlays: they never replace the player's actual painted cells. */
#tutorial .tu-hint-route { position:absolute; z-index:4; inset:15%; display:grid; place-items:center; pointer-events:none; border:2px dashed var(--tu-hint-color, var(--primary)); outline:1px solid color-mix(in srgb,var(--foreground) 45%,transparent); border-radius:5px; background:color-mix(in srgb,var(--surface) 88%,transparent); color:var(--foreground); font-size:clamp(9px,1.3vw,14px); font-weight:850; line-height:1; }
#tutorial .tu-cell:has(.tu-disc) .tu-hint-route { inset:auto 5% 5% auto; width:1.25em; height:1.25em; border-width:1px; border-radius:50%; font-size:clamp(8px,1.1vw,11px); }
#tutorial .tu-hint-route.tu-hint-prior { opacity:.45; background:transparent; }
#tutorial .tu-hint-next::after, #tutorial .tu-hint-erase::after { content:'↓'; position:absolute; z-index:6; left:50%; top:50%; transform:translate(-50%,-50%); display:grid; place-items:center; width:58%; aspect-ratio:1; border:2px solid #86600b; border-radius:50%; background:#ffe5a1; color:#513900; font-size:clamp(13px,2vw,23px); line-height:1; font-weight:900; pointer-events:none; box-shadow:0 0 0 2px #fff9; animation:tu-hint-pulse 1.25s ease-in-out infinite; }
#tutorial .tu-hint-erase::after { content:'×'; border-color:#a82d42; background:#ffe0e5; color:#881c30; }
#tutorial .tu-quiz-blocker .tu-disc { outline:3px solid #ffce49; outline-offset:3px; }
#tutorial .tu-cell:has(.tu-disc).tu-hint-next::after, #tutorial .tu-cell:has(.tu-disc).tu-hint-erase::after { left:7%; top:7%; transform:none; width:30%; font-size:.75em; }
#tutorial .tu-hint-color { outline:3px dashed var(--primary); outline-offset:3px; }
#tutorial .tu-actions :is(.tu-hint-button,.tu-answer-button,.tu-hint-clear) { border-style:dashed; border-color:var(--primary); color:var(--foreground); background:var(--hover); }
#tutorial .tu-actions .tu-hint-clear { background:var(--surface); }
@keyframes tu-hint-pulse { 0%,100% { box-shadow:0 0 0 2px #fff9; } 50% { box-shadow:0 0 0 5px #e7b84166; } }
@media(prefers-reduced-motion:reduce) { #tutorial .tu-hint-next::after, #tutorial .tu-hint-erase::after { animation:none; } }
@media(min-width:900px) and (min-height:521px) { body:has(#tutorial:not([hidden])) main { max-width:none; } #tutorial .tu-panel { grid-template-columns:minmax(0,1fr) minmax(280px,clamp(320px,30vw,560px)); } }
