/* The world is the page. All controls live on top of the same WebGL canvas. */
html:has(body.fullscreen-game) { width:100%; height:100%; overflow:hidden; background:#dfe3df; }
body.scene-page.fullscreen-game {
  --text:#eff5ef; --muted:#b9cbc9; --cold:#8de4cf; --warm:#f2be80; --bad:#ffae97;
  --hud:#203b43e8; --hud-edge:#e0eee53d;
  position:fixed; inset:0; width:100%; height:100%; height:100dvh; padding:0;
  overflow:hidden; overscroll-behavior:none; color-scheme:dark; background:#dfe3df;
}
.fullscreen-game .game-world,.fullscreen-game .scene-stage { position:absolute; inset:0; width:100%; height:100%; overflow:hidden; }
.fullscreen-game .scene-stage { background:radial-gradient(ellipse at 50% 42%, #fbfaf5 0%, #eeeee7 52%, #dfe3df 100%); }
.fullscreen-game canvas#board { position:absolute; inset:0; display:block; width:100%; height:100%; aspect-ratio:auto; touch-action:none; cursor:grab; }
.fullscreen-game[data-scene-view=work] canvas#board { cursor:crosshair; }
.fullscreen-game canvas#board:focus-visible { outline:none; box-shadow:inset 0 0 0 2px #6dd6c57f; }
.fullscreen-game .scene-callouts { position:absolute; inset:0; z-index:2; pointer-events:none; overflow:hidden; }
.fullscreen-game .scene-callouts svg { position:absolute; inset:0; width:100%; height:100%; overflow:visible; }
.fullscreen-game .scene-callouts path { fill:none; stroke-linecap:round; stroke-linejoin:round; }
.fullscreen-game .callout-outline { stroke:#fbfaf5cc; stroke-width:2.5px; }
.fullscreen-game .callout-line { stroke:#62766c; stroke-width:1.2px; }
.fullscreen-game .scene-callouts g[data-occluded=true] .callout-line { stroke-dasharray:4 4; }
.fullscreen-game .callout-dot { fill:#fafaf3; stroke:var(--callout-accent); stroke-width:2px; }
.fullscreen-game .scene-callout-label { position:absolute; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; width:78px; height:44px; box-sizing:border-box; padding:3px 2px; border:1px solid #91b3a1; border-left:3px solid var(--callout-accent); border-radius:8px; background:linear-gradient(#fbfff6,#dfede0); box-shadow:inset 0 1px #ffffff,0 3px 0 #779b88,0 5px 8px #203a3526; color:#263f36; font:650 13px/1.2 system-ui,-apple-system,sans-serif; white-space:nowrap; cursor:pointer; pointer-events:auto; touch-action:manipulation; transition:background-color .12s,box-shadow .12s; }
.fullscreen-game .callout-action { display:flex; align-items:center; gap:5px; font-size:12px; line-height:14px; font-weight:500; color:#3d725d; }
.fullscreen-game .callout-action::after { content:''; display:block; width:5px; height:5px; border-top:1.5px solid currentColor; border-right:1.5px solid currentColor; transform:rotate(45deg); }
@media(hover:hover) { .fullscreen-game .scene-callout-label:hover { background:linear-gradient(#fff,#d2eddb); border-color:#42886e; box-shadow:inset 0 1px #fff,0 3px 0 #56896f,0 6px 12px #203a3540; } }
.fullscreen-game .scene-callout-label:active { background:#cce5d5; box-shadow:inset 0 1px 2px #36584140,0 1px 0 #779b88; }
.fullscreen-game .scene-callout-label:focus-visible { outline:3px solid #257b6b; outline-offset:2px; }
.fullscreen-game .callouts-invite [data-callout=stave] { animation:callout-discover 1.2s ease-in-out 2; }
@keyframes callout-discover { 0%,100% { box-shadow:inset 0 1px #fff,0 3px 0 #779b88,0 5px 8px #203a3526; } 50% { box-shadow:inset 0 1px #fff,0 3px 0 #56896f,0 0 0 4px #78cda55c,0 5px 14px #29795357; } }
.fullscreen-game #section-key[data-invite=true] { color:#c0f2d8; font-weight:600; }
.fullscreen-game .callout-legend { position:absolute; transform:translateX(-50%); padding:2px 6px; border-radius:4px; background:#f8faf0ed; color:#455b55; white-space:nowrap; font-size:12px; line-height:16px; }
.fullscreen-game .hud-top,.fullscreen-game .hud-bottom { position:absolute; z-index:3; pointer-events:none; left:max(10px,env(safe-area-inset-left)); right:max(10px,env(safe-area-inset-right)); margin-inline:auto; }
.fullscreen-game .hud-top { top:max(10px,env(safe-area-inset-top)); max-width:760px; padding:10px 12px 9px; border-radius:18px; border:1px solid var(--hud-edge); background:linear-gradient(115deg,#203b43f5,#2f4849dc); box-shadow:0 8px 30px #142c2a20,inset 0 1px #eef5e91a; backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px); }
.fullscreen-game .hud-top button { pointer-events:auto; }
.fullscreen-game .hud-button { display:grid; place-items:center; min-width:44px; min-height:44px; padding:5px 8px; border:1px solid #c8e3d945; border-radius:10px; background:#edf7e90c; color:#e4f3e9; font-size:.875rem; white-space:nowrap; }
.fullscreen-game .hud-bottom { bottom:max(10px,env(safe-area-inset-bottom)); max-width:560px; display:flex; flex-direction:column; gap:7px; }
.fullscreen-game #fitting-notice {
  position:absolute; bottom:calc(100% + 6px); left:50%; transform:translateX(-50%);
  width:max-content; max-width:100%; margin:0; padding:5px 11px; border-radius:9px;
  border:1px solid #6a837f; background:#152b33f7; color:#e4f3e9;
  font-size:13px; line-height:1.4; text-align:center; pointer-events:none;
}

.fullscreen-game .dock { --action-gap:6px; position:static; width:100%; max-width:none; max-height:none; overflow:visible; margin:0; padding:9px; border-radius:17px; border:1px solid var(--hud-edge); background:var(--hud); box-shadow:0 5px 25px #142c2a29,inset 0 1px #eef5e914; backdrop-filter:blur(14px); -webkit-backdrop-filter:blur(14px); pointer-events:auto; }
.fullscreen-game .locate-button { padding:4px 6px; min-width:44px; min-height:44px; border-radius:10px; }
.fullscreen-game .primary { min-height:46px; padding:8px 12px; border-radius:12px; font-size:14px; background:linear-gradient(140deg,#c0ecd3,#83d2bb); color:#173c34; border:1px solid #b9efd670; box-shadow:inset 0 1px #f6ffeab3,0 2px 0 #143d316b; }
.fullscreen-game .primary:hover { background:linear-gradient(140deg,#d5ffe7,#99e0cb); }
.fullscreen-game .tool { flex-shrink:0; flex-direction:column; min-width:46px; width:46px; min-height:46px; gap:0; padding:3px; border-radius:11px; border:1px solid #bad6cc38; background:#d6e9d812; box-shadow:inset 0 1px #e5f2d80e; color:#dcece2; }
.fullscreen-game .tool>span { font-size:21px; line-height:1.05; }
.fullscreen-game .tool small { font-size:12px; line-height:1.4; }
.fullscreen-game .tool[aria-pressed=true] { background:#c295552b; color:var(--warm); border-color:#e7b56c99; }
.fullscreen-game .selection-toggle[data-repair=true] { color:var(--warm); border-color:#e4b376a0; }
.fullscreen-game .scene-view-tabs { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:3px; padding:3px; border-radius:14px; border:1px solid #e1eadd35; background:#1b343de3; box-shadow:0 3px 15px #142a2626; backdrop-filter:blur(12px); pointer-events:auto; }
.fullscreen-game .scene-view-tabs button { display:flex; align-items:center; justify-content:center; gap:7px; min-height:44px; min-width:0; border-radius:10px; background:transparent; color:#b7cbc5; font-size:13px; padding:4px; }
.fullscreen-game .view-icon { font-size:17px; }
.fullscreen-game .scene-view-tabs button[aria-pressed=true] { color:#ecf6e9; background:linear-gradient(125deg,#5d82725e,#73968a38); box-shadow:inset 0 0 0 1px #c9e7d233; }
.fullscreen-game .quiet { color:#d7e8dd; }
.fullscreen-game .scene-recovery { position:absolute; inset:0; display:flex; flex-direction:column; justify-content:center; align-items:center; padding:25px; gap:12px; pointer-events:none; }
.fullscreen-game .scene-status { max-width:360px; padding:22px; text-align:center; border:1px solid #e1e7d49c; border-radius:16px; background:#203b43ed; color:#e2ede0; font-size:15px; line-height:1.7; box-shadow:0 14px 40px #152a2635; }
.fullscreen-game .scene-status[data-state=loading]::before { content:''; display:block; width:24px; height:24px; margin:0 auto 12px; border:2px solid #6f9c893d; border-top-color:#a4e7ca; border-radius:50%; animation:scene-loading 1s linear infinite; }
.fullscreen-game .scene-fallback { pointer-events:auto; padding:13px 18px; border-radius:12px; color:#173b32; background:#b1e1c8; text-decoration:none; font-size:15px; }
.fullscreen-game[data-scene-state=error] .hud-top,.fullscreen-game[data-scene-state=error] .hud-bottom { visibility:hidden; }
.fullscreen-game[data-scene-state=loading] .hud-top,.fullscreen-game[data-scene-state=loading] .hud-bottom { visibility:hidden; }
.fullscreen-game dialog { width:min(540px,calc(100% - 24px)); max-height:calc(100dvh - max(24px,env(safe-area-inset-top)) - max(24px,env(safe-area-inset-bottom))); padding:20px; border-radius:22px; border:1px solid #b2c9ba85; background:linear-gradient(135deg,#2d484d,#1c353e); box-shadow:0 24px 100px #0a221b70; overscroll-behavior:contain; }
.fullscreen-game dialog::backdrop { background:#1029278a; backdrop-filter:blur(5px); }
.fullscreen-game .dialog-head { top:-20px; margin:-20px -20px 12px; padding:17px 20px 12px; background:#29444b; }
.fullscreen-game .dialog-head h2 { font-size:22px; }
.fullscreen-game .dialog-close { background:#e0ecda0b; color:#e2f0e3; border-color:#a9c2b657; }
.fullscreen-game .information-grid { grid-template-columns:1fr; gap:10px; }
.fullscreen-game .legend { font-size:12px; padding:8px 0; }
.fullscreen-game .info-panel { background:#a2c09b08; border-color:#a8c2b23b; }
.fullscreen-game .level-row { min-height:48px; }
.fullscreen-game [hidden] { display:none!important; }
@keyframes scene-loading { to{transform:rotate(360deg)} }
@media(max-width:430px) {
  .fullscreen-game .hud-top { padding:8px 9px; border-radius:15px; }
  .fullscreen-game .hud-bottom { gap:5px; }
  .fullscreen-game .dock { --action-gap:5px; padding:7px; border-radius:14px; }
  .fullscreen-game .primary { font-size:14px; }
  .fullscreen-game .scene-view-tabs { padding:2px; border-radius:12px; }
  .fullscreen-game .scene-view-tabs button { gap:4px; font-size:12px; }
  .fullscreen-game .view-icon { font-size:16px; }
}
@media(max-height:650px) and (orientation:portrait) {
  .fullscreen-game .hud-top { top:max(6px,env(safe-area-inset-top)); }
  .fullscreen-game .hud-bottom { bottom:max(6px,env(safe-area-inset-bottom)); }
}
@media(max-height:500px) and (orientation:landscape) {
  .fullscreen-game .hud-top { max-width:600px; top:max(6px,env(safe-area-inset-top)); padding:6px 10px; }
  .fullscreen-game .hud-bottom { max-width:660px; bottom:max(6px,env(safe-area-inset-bottom)); flex-direction:row; align-items:flex-end; gap:8px; }
  .fullscreen-game .dock { flex:1; width:auto; min-width:0; padding:6px; }
  .fullscreen-game .scene-view-tabs { width:180px; flex-shrink:0; }
  .fullscreen-game .scene-view-tabs button { flex-direction:column; gap:1px; font-size:12px; min-height:46px; }
}
@media(prefers-reduced-motion:reduce) { .fullscreen-game .scene-status::before { animation:none!important; } }
@media(max-height:500px) and (orientation:landscape) {
  .fullscreen-game .hud-top { left:max(6px,env(safe-area-inset-left)); right:auto; width:26%; max-width:230px; grid-template-columns:repeat(2,minmax(0,1fr)); }
  .fullscreen-game .hud-top #details-toggle { grid-column:1 / -1; }
  .fullscreen-game .hud-bottom { width:auto; flex-direction:column; align-items:stretch; }
  .fullscreen-game .dock { width:100%; flex:auto; }
  .fullscreen-game .tool { width:100%; min-width:0; }
  .fullscreen-game .scene-view-tabs { width:100%; }
}

.fullscreen-game #component-dialog { color-scheme:light; color:#263e3a; background:#f7f9f0; border-color:#b8c6b7; touch-action:pan-y; }
.fullscreen-game #component-dialog .dialog-head { background:#eff3e8; border-bottom:1px solid #d3ddcf; }
.fullscreen-game #component-dialog .dialog-close { color:#38534c; background:#e0e9dc; border-color:#b8cbbd; }
.fullscreen-game #component-dialog .component-kicker { color:#59766c; font-size:12px; }
.fullscreen-game #component-dialog h2 { margin:3px 0 0; }
.fullscreen-game #component-dialog .component-summary { margin:16px 0 18px; padding:12px 14px; border-left:3px solid var(--component-accent); background:#e7eee1; border-radius:0 8px 8px 0; color:#244339; font-size:16px; font-weight:600; line-height:1.65; }
.fullscreen-game #component-dialog .component-section { margin:18px 0; }
.fullscreen-game #component-dialog .component-section h3 { margin:0 0 5px; font-size:14px; color:#527264; }
.fullscreen-game #component-dialog .component-section p { margin:0; font-size:15px; line-height:1.75; overflow-wrap:anywhere; }
.fullscreen-game #component-dialog .component-sources { border-top:1px solid #d4dfd0; padding-top:12px; color:#526f62; }
.fullscreen-game #component-dialog .component-sources summary { padding:6px 0; font-size:13px; }
.fullscreen-game #component-dialog .component-sources ul { padding-left:19px; margin:6px 0; }
.fullscreen-game #component-dialog .component-sources li { margin:7px 0; font-size:13px; line-height:1.6; }
.fullscreen-game #component-dialog .component-sources a { color:#216e60; text-decoration:underline; }
.fullscreen-game #component-dialog .component-sources p { font-size:12px; line-height:1.65; }
.fullscreen-game #component-dialog .component-actions { position:sticky; bottom:-20px; margin:16px -20px -20px; padding:12px 20px 20px; background:#f7f9f0; border-top:1px solid #d4dfd0; }
.fullscreen-game #component-dialog .component-actions button { width:100%; }

/* Connection coaching uses the existing dock; the action row stays anchored. */
.fullscreen-game[data-section-close=true] #section-key { -webkit-line-clamp:3; }
.fullscreen-game .section-extra-tools { display:flex; gap:4px; flex-shrink:0; }
.fullscreen-game .section-extra-tools .tool { width:44px; min-width:44px; height:44px; min-height:44px; }
.fullscreen-game #connection-dialog { color-scheme:light; background:#f7f9f0; color:#263e3a; border-color:#b8c6b7; }
.fullscreen-game #connection-dialog .dialog-head { background:#eff3e8; border-bottom:1px solid #d3ddcf; }
.fullscreen-game #connection-dialog .dialog-close { color:#38534c; background:#e0e9dc; }
.fullscreen-game #connection-dialog .component-kicker { color:#59766c; font-size:12px; }
.fullscreen-game #connection-dialog p { font-size:14px; line-height:1.65; color:#3d5149; }
.fullscreen-game #connection-dialog .connection-summary { padding:12px; border-left:3px solid #318d80; background:#e4eee1; font-size:16px; font-weight:600; }
.fullscreen-game .connection-loop { list-style:none; padding:0; margin:16px 0; display:grid; gap:8px; }
.fullscreen-game .connection-loop li { padding:10px 12px; border:1px solid #d4ddce; border-radius:9px; background:#edf1e6; display:grid; gap:4px; }
.fullscreen-game .connection-loop b { font-size:14px; }.fullscreen-game .connection-loop span { font-size:13px; line-height:1.5; }
.fullscreen-game #connection-dialog[data-port=supply] [data-loop-port=supply] { border-color:#318d80; background:#dbefe1; }
.fullscreen-game #connection-dialog[data-port=return] [data-loop-port=return] { border-color:#bc8745; background:#f3ead5; }
.fullscreen-game .connection-current { border-top:1px solid #ccd6c6; padding-top:12px; }
.fullscreen-game #connection-dialog details { font-size:13px; line-height:1.6; }
.fullscreen-game .connection-actions { position:sticky; bottom:-20px; margin:14px -20px -20px; padding:12px 20px 20px; background:#f7f9f0; border-top:1px solid #d3ddcf; }
.fullscreen-game .connection-actions button { width:100%; }
@media(max-height:500px) and (orientation:landscape) { .fullscreen-game .section-extra-tools { flex-direction:column; gap:2px; } }

.fullscreen-game .section-extra-tools .section-more { display:none; }
.fullscreen-game .section-menu-actions { display:grid; gap:12px; }
@media(max-width:720px) and (max-height:500px) and (orientation:landscape) {
  .fullscreen-game .section-extra-tools #section-back,.fullscreen-game .section-extra-tools #section-task-help { display:none; }
  .fullscreen-game .section-extra-tools .section-more { display:flex; }
}

.fullscreen-game .scene-callout-label[data-task-needed=true] { border-color:#bf8d4e; box-shadow:inset 0 1px #fff,0 3px 0 #ad8655,0 5px 8px #203a3526; }
.fullscreen-game .scene-callout-label[data-task-needed=true] .callout-action { color:#8c5a22; font-weight:650; }
.fullscreen-game #component-dialog .component-task { padding:12px; background:#f2ead9; border:1px solid #d2b281; border-radius:10px; }
.fullscreen-game #component-dialog .component-task h3 { margin:0 0 6px; font-size:14px; color:#79562e; }
.fullscreen-game #component-dialog .component-task p { color:#3d5149; font-size:14px; line-height:1.6; }
.fullscreen-game #component-dialog .component-task button { width:100%; }

.fullscreen-game #legacy-record svg{border-radius:10px;}

.fullscreen-game #draw-button[aria-pressed=true] { color:#b9f5df; background:#81d9bb26; border-color:#92dfc899; }


/* Contextual hint sheet leaves the highlighted work surface visible. */
.fullscreen-game #hint-dialog { position:fixed; inset:auto 0 max(12px,env(safe-area-inset-bottom)); margin:0 auto; width:min(480px,calc(100% - 24px)); max-height:48dvh; color:#263e3a; background:#f7f9f0; }
.fullscreen-game #hint-dialog::backdrop { background:#10292718; backdrop-filter:none; }
.fullscreen-game #hint-dialog .dialog-head { background:#eff3e8; }
.fullscreen-game #hint-dialog .dialog-close { color:#38534c; background:#e0e9dc; }
.fullscreen-game #hint-dialog h2 { font-size:18px; }
.fullscreen-game #hint-dialog p { font-size:15px; line-height:1.7; overflow-wrap:anywhere; }
.fullscreen-game #hint-go { width:100%; min-height:44px; }
.fullscreen-game #hint-dialog p { color:#29483d; }
