/* Shared Rooms, window focus, and DocCam-style annotation palettes. */#library { width: 320px; }
.library-heading h1 { font-size: 20px; }
.library-tabs { display: flex; gap: 5px; margin: -6px 0 14px; }
.library-tabs button { flex: 1; }
.library-tabs .active { background: var(--selected); color: var(--accent); }
#rooms-list { display: flex; flex-direction: column; gap: 3px; max-height: 130px; overflow: auto; }
#room-actions { display: flex; flex-wrap: wrap; margin-top: 6px; gap: 3px; }
#room-actions button { min-height: 30px; }
#rooms-section .section-label { margin-top: 12px; }
.new-wall-button { width: 100%; min-height: 36px; margin-bottom: 10px; background: var(--selected); color: var(--accent); flex-shrink: 0; }
.wall-list-item { position: relative; }
.wall-order { display: flex; justify-content: flex-end; gap: 4px; margin-top: -10px; margin-bottom: 10px; }
.wall-order button { min-height: 28px; padding: 3px 9px; font-size: 11px; }
#wall-rooms { border: 1px solid var(--line); border-radius: 10px; padding: 10px; max-height: 200px; overflow: auto; }
#wall-rooms legend { font-size: 11px; color: var(--muted); }
#wall-rooms label, #room-wall-choices label { display: flex; flex-direction: row; gap: 10px; align-items: center; padding: 7px; font-size: 13px; color: var(--ink); }
#room-wall-choices { max-height: 45vh; overflow: auto; }
#room-dialog p { font-size: 13px; }
.widget-header { padding: 0 5px 0 0; cursor: default; }
.widget-handle { flex: 1; min-width: 0; border: 0; background: transparent; padding: 5px 10px; height: 42px; justify-content: flex-start; cursor: grab; touch-action: none; border-radius: 16px 0 0 0; }
.widget-handle:hover { background: #879db018; }
.widget-handle span { text-align: left; }
.widget-focus { width: 36px; min-height: 36px; height: 36px; border: 0; background: transparent; padding: 7px; color: #657a91; }
.widget-focus:hover { background: #879db029; }
.widget-ink { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3; pointer-events: none; touch-action: none; }
.widget-ink.drawing, #wall-ink.drawing { pointer-events: auto; cursor: none; }
.camera-frame canvas.drawing { cursor: none; }
.widget.focused { inset: 0 !important; width: 100% !important; height: 100% !important; border-radius: 0; border: 0; box-shadow: none; outline: none; z-index: 100; }
.widget.focused > .widget-header { height: 48px; }
.widget.focused .widget-handle { cursor: default; height: 48px; }
.widget.focused .widget-focus { width: auto; padding: 6px 15px; min-height: 42px; gap: 7px; }
.widget.focused > .widget-resize { display: none; }
.widget.focused .time-display { font-size: clamp(80px, 20cqw, 260px); }
.widget.focused .dice-face, .widget.focused .tally-value { font-size: clamp(100px, 25cqw, 300px); }
.widget.focused .widget-controls button { min-height: 52px; min-width: 64px; }
body.widget-focused .app-header, body.widget-focused .wall-navigation, body.widget-focused #wall-ink, body.widget-focused #empty-wall { display: none !important; }


/* Each contextual row uses the same glass and compact controls as the dock. */#context-toolbar.annotation-panel { display: flex; flex-direction: column; align-items: center; padding: 0; gap: 7px; width: 480px; max-height: calc(100dvh - 150px); overflow: auto; white-space: normal; border: 0; background: none; box-shadow: none; }
.ink-command-bar, .ink-palette { background: var(--glass); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); backdrop-filter: blur(16px); padding: 7px; }
.ink-command-bar { display: flex; align-items: center; gap: 6px; width: 100%; }
.ink-heading { display: flex; min-width: 0; flex: 1; }
.ink-heading label { min-width: 0; width: 100%; }
#context-toolbar .ink-heading select { width: 100%; padding: 6px; height: 36px; }
.ink-tools, .ink-footer { display: flex; align-items: center; gap: 3px; }
.ink-footer { border-left: 1px solid var(--line); padding-left: 6px; }
#context-toolbar .ink-tools button, #context-toolbar .ink-footer button { width: 36px; min-width: 36px; padding: 7px; background: transparent; border: 0; }
#context-toolbar .ink-tools button.active { background: var(--selected); box-shadow: inset 0 0 0 1px var(--accent); }
.ink-palette { display: flex; flex-direction: column; gap: 7px; width: 100%; }
.ink-colors, .ink-sizes { display: flex; gap: 6px; align-items: center; justify-content: center; }
#context-toolbar .ink-colors button { min-width: 28px; width: 28px; height: 28px; min-height: 28px; padding: 0; border: 1px solid var(--line); border-radius: 50%; }
#context-toolbar .ink-colors .active { outline: 2px solid var(--accent); outline-offset: 2px; }
#context-toolbar .ink-sizes button { flex: 1; min-height: 30px; padding: 4px 7px; background: transparent; border: 0; }
.ink-hint { color: var(--muted); font-size: 10px; }
.stamp-favorites, .stamp-results { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; }
.stamp-favorites { grid-template-columns: repeat(6, 1fr); }
#context-toolbar .stamp-favorites button, #context-toolbar .stamp-results button { font-family: "Segoe UI Emoji", "Apple Color Emoji", sans-serif; font-size: 26px; min-width: 40px; height: 46px; padding: 2px; touch-action: manipulation; }
.stamp-results { min-height: 52px; max-height: 160px; overflow: auto; }
#stamp-search { width: 100%; min-height: 42px; }
.stamp-sound { align-self: flex-start; }
#ink-cursor { position: fixed; z-index: 10020; transform: translate(-50%, -50%); border: 1px solid; border-radius: 50%; pointer-events: none; display: flex; align-items: center; justify-content: center; font-family: "Segoe UI Emoji", "Apple Color Emoji", sans-serif; line-height: 1; }
#ink-cursor.cursor-pencil { background: var(--cursor-color); opacity: .4; }
#ink-cursor.cursor-highlighter { background: var(--cursor-color); opacity: .35; }
#ink-cursor.cursor-eraser { background: #ffffff50; border-color: #233449 !important; box-shadow: 0 0 0 1px #ffffffa0; }
#ink-cursor.cursor-stamp { border: 0; }
@media (max-width: 720px) {
#library { width: min(320px, calc(100vw - 20px)); }
#context-toolbar.annotation-panel { width: calc(100vw - 20px); padding: 0; max-height: calc(100dvh - 125px); }
.ink-command-bar { flex-wrap: wrap; }
.ink-heading { flex-basis: 100%; }
.ink-colors { gap: 4px; flex-wrap: wrap; }
#context-toolbar .ink-colors button { width: 30px; min-width: 30px; min-height: 30px; }
.stamp-results { grid-template-columns: repeat(6, 1fr); }
.ink-footer .ink-hint { display: none; }

}


/* Compact window chrome retains clear drag, focus, and resize affordances. */.widget { border-radius: 10px; border-color: #7890a526; box-shadow: 0 3px 12px #2942540c; }
.widget.selected { outline: 1px solid #5282d7; outline-offset: 1px; }
.widget-header, .widget.focused > .widget-header { height: 32px; }
.widget-handle, .widget.focused .widget-handle { height: 32px; min-height: 32px; padding: 3px 8px; border-radius: 10px 0 0; }
.widget-header span { font-size: 10px; letter-spacing: .4px; }
.widget-header svg { width: 15px; height: 15px; }
.widget-focus, .widget.focused .widget-focus { min-height: 28px; height: 28px; padding: 4px 8px; font-size: 11px; }
.widget-content { border-radius: 0 0 10px 10px; }
.widget-resize { width: 26px; height: 26px; min-height: 26px; right: -8px; bottom: -8px; border-width: 2px; }
.widget-resize svg { width: 15px; height: 15px; }
#library { top: 68px; bottom: 88px; padding: 16px 14px 12px; overflow-y: auto; }
.library-heading { margin-bottom: 16px; }
.library-heading h1 { font-size: 18px; }
.library-tabs button { min-height: 34px; padding: 5px 10px; }
#room-actions { gap: 3px; margin-top: 9px; }
#manage-room { width: 100%; min-height: 36px; font-size: 12px; }
.room-help { color: var(--muted); font-size: 11px; line-height: 1.45; width: 100%; margin: 3px 0; }
#room-actions > .text-button { flex: 1; font-size: 11px; }
#rooms-section { flex-shrink: 0; }
.section-label { margin-top: 14px; }
.wall-card { padding: 6px; margin-bottom: 8px; }
.wall-preview { height: 65px; }
.wall-card strong { margin-top: 6px; }
.wall-order { margin-top: -5px; margin-bottom: 7px; }
.library-footer { padding-top: 8px; margin-top: 8px; }
#backup-status:empty { display: none; }
@media (pointer: coarse) {
.widget-header, .widget.focused > .widget-header, .widget-handle, .widget.focused .widget-handle { height: 40px; }
.widget-focus, .widget.focused .widget-focus { min-height: 36px; height: 36px; }
.widget-resize { width: 36px; height: 36px; min-height: 36px; }

}

/* The dock changes its tool set; only temporary settings float above it. */body.annotation-dock #main-toolbar > :is(#data-sources-toggle, #active-tools-toggle, #dock-walls, #theme-toggle, #fullscreen-toggle, #add-widget, #background-tool, #undo, #redo, .dock-divider, #draw-tool) { display: none; }
#main-toolbar > .ink-command-bar { display: none; }
body.annotation-dock #main-toolbar > .ink-command-bar { display: flex; width: auto; padding: 0; border: 0; box-shadow: none; background: none; backdrop-filter: none; gap: 5px; }
#main-toolbar .ink-tools button, #main-toolbar .ink-footer button { width: 38px; min-width: 38px; height: 42px; min-height: 42px; border: 0; background: none; padding: 8px; }
#main-toolbar .ink-tools button.active { background: var(--selected); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
#main-toolbar .ink-heading { flex: none; }
.ink-target { position: relative; display: flex; align-items: center; justify-content: center; width: 36px; height: 40px; }
.ink-target > svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; }
#main-toolbar .ink-target select { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.ink-target:focus-within { outline: 2px solid var(--accent); border-radius: 8px; }
#context-toolbar.annotation-panel { width: 400px; }
.widget.annotation-target { outline: 1px solid var(--accent); outline-offset: 1px; }
#context-toolbar.widget-toolbar { position: fixed; z-index: 55; max-width: calc(100vw - 16px); width: max-content; flex-wrap: wrap; white-space: normal; overflow: auto; max-height: calc(100dvh - 100px); }
.widget:not(.focused) .widget-focus { opacity: 0; }
.widget:hover .widget-focus, .widget:focus-within .widget-focus { opacity: 1; }
@media (max-width: 720px) {
#main-toolbar .ink-tools, #main-toolbar .ink-footer { gap: 1px; }
#main-toolbar .ink-tools button, #main-toolbar .ink-footer button { width: 30px; min-width: 30px; padding: 5px; }
#main-toolbar .ink-footer { padding-left: 2px; }
#main-toolbar .ink-command-bar { gap: 2px !important; flex-wrap: nowrap; }
#main-toolbar .ink-heading { flex-basis: auto; }
#context-toolbar.annotation-panel { width: min(400px, calc(100vw - 20px)); }

}
@media (pointer: coarse) {
.widget .widget-focus { opacity: 1; }
 }
#draw-tool.has-ink-color { position: relative; }
#draw-tool.has-ink-color::after { content: ''; position: absolute; bottom: 4px; width: 14px; height: 3px; border-radius: 2px; background: var(--ink-color); box-shadow: 0 0 0 1px var(--line); }
.camera-surface.panning { cursor: grab; touch-action: none; }
.camera-surface.panning:active { cursor: grabbing; }
.camera-surface img, .camera-surface video { user-select: none; -webkit-user-drag: none; }
#context-toolbar.widget-toolbar:has([aria-label="Pan camera"]) .context-label { display: none; }

/* Classroom surfaces and in-widget teaching controls. */.widget[data-type=sticky] .note-content { padding: 16px; }
.widget[data-type=blur], .widget[data-type=curtain] { background: transparent; }
.widget[data-type=blur] .widget-header, .widget[data-type=curtain] .widget-header { background: var(--glass); }
.widget[data-type=blur] .widget-header span, .widget[data-type=curtain] .widget-header span { color: var(--ink); }
.timer-face { display: flex; align-items: center; justify-content: center; gap: clamp(5px, 2cqw, 15px); width: 100%; }
.timer-face .time-display { font-size: clamp(25px, 16cqw, 76px); letter-spacing: -2px; min-width: 0; }
.time-steps { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.time-step { width: 40px; height: 40px; min-height: 40px; padding: 0; font-size: 24px; background: #e9eff7; color: #345575; border: 0; touch-action: none; user-select: none; }
.widget.focused .timer-face { width: min(100%, 850px); }
.widget.focused .timer-face .time-display { font-size: clamp(60px, 15cqw, 190px); }
.widget.focused .time-step { width: 52px; height: 52px; }
#context-toolbar .surface-swatch { min-width: 26px; width: 26px; height: 26px; min-height: 26px; border-radius: 50%; padding: 0; }
#context-toolbar.background-panel { display: flex; flex-direction: column; width: 390px; max-height: calc(100dvh - 155px); overflow-y: auto; align-items: stretch; padding: 12px; }
.background-heading, .background-images, .surface-colors { display: flex; align-items: center; gap: 6px; }
.background-heading { justify-content: space-between; }
#context-toolbar .background-heading > .icon-button { width: 42px; height: 42px; padding: 8px; font-size: 22px; }
.surface-colors { flex-wrap: wrap; }
#context-toolbar .surface-colors button { min-width: 29px; width: 29px; height: 29px; min-height: 29px; border-radius: 50%; padding: 0; }
.background-patterns { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; margin: 8px 0; }
.background-choice { flex-direction: column; padding: 5px; }
.background-preview { width: 100%; height: 45px; border-radius: 6px; }
#library { width: 340px; }
.wall-card { min-height: 83px; padding: 8px 40px 8px 82px; position: relative; }
.wall-preview { position: absolute; left: 7px; top: 8px; width: 65px; height: 65px; }
.wall-card strong { white-space: normal; overflow-wrap: anywhere; margin-top: 8px; }
.wall-card small { display: block; line-height: 1.4; }
.organize-wall { position: absolute; top: 28px; right: 6px; width: 32px; height: 32px; min-height: 32px; padding: 6px; border: 0; background: transparent; color: var(--accent); }
.library-empty { font-size: 13px; line-height: 1.5; color: var(--muted); }
#organize-wall-rooms { max-height: 40vh; overflow: auto; }
#organize-wall-rooms label { flex-direction: row; align-items: center; gap: 10px; padding: 10px 0; }
#room-wall-search { width: 100%; margin-bottom: 10px; }
@media(max-width:720px) {
#library { width: min(340px, calc(100vw - 20px)); }
.time-step { width: 36px; min-height: 36px; height: 36px; }
 }
.time-step:hover { background: #d3e1f2; color: #233449; }

/* Tool chrome follows the classroom theme; writing surfaces keep their chosen color. */.widget > .widget-header { background: var(--surface); color: var(--ink); border-bottom-color: var(--line); border-radius: 10px 10px 0 0; }
.widget > .widget-header span, .widget > .widget-header svg, .widget .widget-focus { color: var(--ink); }
.widget.focused { z-index: 1000002 !important; }
.widget:is([data-type=timer],[data-type=alarm],[data-type=clock],[data-type=dice],[data-type=tally],[data-type=traffic],[data-type=image]) { background: var(--surface); color: var(--ink); }
.widget:is([data-type=timer],[data-type=alarm],[data-type=clock],[data-type=dice],[data-type=tally]) :is(.time-label,.clock-date,.alarm-status) { color: var(--muted); }
.time-step, .time-step:hover, .widget-controls button:not(.primary) { background: var(--selected); color: var(--ink); border-color: var(--line); }
.widget.finished { background: var(--selected) !important; outline: 2px solid var(--accent); }
.tool-surface-colors { display: flex; gap: 5px; align-items: center; }
.surface-menu { position: relative; }
.surface-menu summary { display: flex; align-items: center; justify-content: center; width: 34px; height: 36px; cursor: pointer; list-style: none; border-radius: 8px; }
.surface-menu summary::-webkit-details-marker { display: none; }
.surface-menu summary svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.surface-menu[open] .tool-surface-colors { display: grid; grid-template-columns: repeat(4,26px); padding: 8px; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
#context-toolbar button[data-direction] svg { transform: rotate(var(--direction-angle)); }
body.overlay-focused #wall-ink { display: block !important; }

/* Neutral, theme-aware reveal grip; direction belongs to the reveal setting. */
/* Larger scroll targets and a roomier library drawer. */* { scrollbar-width: auto; }
::-webkit-scrollbar { width: 18px; height: 18px; }
::-webkit-scrollbar-track { background: var(--page); border-radius: 10px; }
::-webkit-scrollbar-thumb { background: var(--muted); border: 3px solid var(--page); border-radius: 10px; min-height: 40px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }
::-webkit-scrollbar-corner { background: var(--page); }
#library { width: min(480px, calc(100vw - 36px)); padding: 20px; }
#rooms-list { max-height: 22dvh; gap: 5px; }
#rooms-list .folder-button { min-height: 48px; padding: 10px 14px; font-size: 14px; }
#library .library-tabs button, #library #manage-room, #library #new-wall { min-height: 44px; font-size: 14px; }
#library .text-button { min-height: 40px; padding: 6px 9px; font-size: 13px; }
#library .wall-card { min-height: 100px; padding: 10px 54px 10px 104px; }
#library .wall-preview { width: 82px; height: 80px; top: 9px; left: 9px; }
#library .wall-card strong { font-size: 14px; }
#library .wall-card small { font-size: 12px; }
#library .organize-wall { top: 29px; right: 8px; width: 42px; height: 42px; min-height: 42px; padding: 10px; }
#library .wall-order button { min-height: 38px; min-width: 42px; font-size: 15px; }
@media (pointer: coarse) {
::-webkit-scrollbar { width: 22px; height: 22px; }
 }
@media (max-width: 720px) {
#library { width: calc(100vw - 20px); padding: 14px; }
 }

/* Two-column Room folders and Wall browser. */#library { width: min(1120px, calc(100vw - 36px)); bottom: 88px; overflow: hidden; }
.library-browser { display: grid; grid-template-columns: minmax(220px, 27%) minmax(0, 1fr); flex: 1; min-height: 0; gap: 22px; }
.library-room-pane, .library-wall-pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.library-room-pane { border-right: 1px solid var(--line); padding-right: 18px; }
#rooms-section { display: flex; flex-direction: column; min-height: 0; flex: 1; flex-shrink: 1; }
#rooms-list { max-height: none; flex: 1; min-height: 0; overflow-y: auto; }
#rooms-list .folder-button { flex-shrink: 0; }
#room-actions { flex-shrink: 0; margin-top: 12px; }
.library-wall-pane > .section-label { margin: 0 0 12px; font-size: 16px; letter-spacing: 0; color: var(--ink); }
.library-wall-actions { display: flex; gap: 10px; flex-shrink: 0; }
#library .library-wall-actions > button { width: auto; flex: 1; margin: 0; }
#library-room-hint { margin: 10px 0; font-size: 12px; }
.library-wall-pane .search { margin-bottom: 12px; flex-shrink: 0; }
.library-wall-pane #wall-list { padding: 3px 6px 3px 3px; }
.room-add-wall { margin: -2px 0 12px; min-height: 40px; color: var(--accent); }
.library-footer > div { justify-content: flex-end; gap: 12px; }
@media(max-width:720px) {
.library-browser { grid-template-columns: 170px minmax(0,1fr); gap: 12px; }
.library-room-pane { padding-right: 10px; }
.library-wall-actions { flex-direction: column; }
#library { width: calc(100vw - 20px); }
 }
@media(max-width:560px) {
.library-browser { grid-template-columns: 1fr; grid-template-rows: minmax(100px, 30%) minmax(0,1fr); gap: 12px; }
.library-room-pane { border-right: 0; border-bottom: 1px solid var(--line); padding: 0 0 8px; }
.library-room-pane .section-label { margin: 0; }
#room-actions { margin: 3px 0; }
.library-tabs { margin: 0 0 5px; }
.library-wall-actions { flex-direction: row; }
#library #new-wall, #library #manage-room { font-size: 12px; }
 }

/* Larger previews in a narrower, reorderable Wall grid. */#library { width: min(980px, calc(100vw - 36px)); }
.library-browser { grid-template-columns: minmax(205px, 25%) minmax(0, 1fr); gap: 18px; }
.library-wall-pane #wall-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; gap: 16px 12px; }
#library .wall-card { display: block; min-height: 0; padding: 8px; margin: 0; text-align: left; }
#library .wall-preview { position: relative; inset: auto; width: 100%; height: auto; aspect-ratio: 16 / 9; }
#library .wall-card strong { margin: 10px 2px 4px; font-size: 14px; }
#library .wall-card small { font-size: 11px; }
.wall-card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; padding-top: 5px; }
#library .wall-card-actions button { position: static; min-width: 34px; width: 34px; min-height: 36px; height: 36px; padding: 7px; border: 0; background: transparent; }
#library .wall-card-actions button:hover { background: var(--selected); }
#library .wall-drag { margin-left: auto; cursor: grab; touch-action: none; font-size: 24px; }
#library .wall-drag:active { cursor: grabbing; }
.wall-list-item.drop-target { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 12px; }
#library .wall-order { margin: 3px 0 0; }
#library .wall-order button { min-height: 32px; min-width: 36px; }
#library .room-add-wall { width: 100%; margin: 5px 0 0; }
.mini-widget { overflow: hidden; }
.mini-widget img { width: 100%; height: 100%; object-fit: contain; display: block; }
.mini-widget.mini-text { font-size: 5px; line-height: 1.25; padding: 3px; color: #233449; white-space: pre-wrap; }
.mini-widget.mini-text::after { display: none; }
@media(max-width:850px) {
.library-wall-pane #wall-list { grid-template-columns: 1fr; }
 }
@media(max-width:720px) {
#library { width: calc(100vw - 20px); }
.library-browser { grid-template-columns: 170px minmax(0,1fr); gap: 12px; }
 }
@media(max-width:560px) {
.library-browser { grid-template-columns: 1fr; }
 }
#library { width: min(1280px, calc(100vw - 36px)); }
.library-browser { grid-template-columns: 235px minmax(0,1fr); }
.library-wall-pane #wall-list { grid-template-columns: repeat(3,minmax(0,1fr)); }
#categories-section { display: flex; flex-direction: column; min-height: 0; flex: 1; }
#categories-list { overflow-y: auto; min-height: 0; display: flex; flex-direction: column; gap: 5px; }
#categories-section .folder-button { flex-shrink: 0; min-height: 48px; font-size: 14px; }
#all-walls-category { margin-bottom: 8px; }
#category-actions { display: flex; gap: 8px; padding-top: 12px; }
#category-actions button { flex: 1; }
@media(max-width:1100px) {
.library-wall-pane #wall-list { grid-template-columns: repeat(2,minmax(0,1fr)); }
 }
@media(max-width:800px) {
.library-browser { grid-template-columns: 180px minmax(0,1fr); }
.library-wall-pane #wall-list { grid-template-columns: 1fr; }
 }
@media(max-width:560px) {
#library { width: calc(100vw - 20px); }
.library-browser { grid-template-columns: 1fr; }
 }

/* Teaching displays scale against both window dimensions, including Focus. */.widget:is([data-type=timer],[data-type=alarm],[data-type=clock],[data-type=tally],[data-type=traffic]) { container-type: size; }
.widget:is([data-type=timer],[data-type=alarm],[data-type=clock],[data-type=tally]) :is(.time-content,.tally-content) { padding: min(3cqw, 3cqh); gap: min(2cqw, 2cqh); }
.widget:is([data-type=timer],[data-type=alarm]) { --timer-step: clamp(28px, min(10cqw, 12cqh), 80px); }
.widget:is([data-type=timer],[data-type=alarm]) .timer-face { width: 100%; gap: min(2cqw, 2cqh); }
.widget:is([data-type=timer],[data-type=alarm]) .timer-face .time-display { font-size: min(calc((90cqw - 2 * var(--timer-step)) / var(--digits,5) * 1.5), calc(42cqh - 12px)); line-height: 1.15; letter-spacing: -.035em; white-space: nowrap; }
.widget:is([data-type=timer],[data-type=alarm]) .time-step { width: var(--timer-step); height: var(--timer-step); min-height: var(--timer-step); font-size: calc(var(--timer-step) * .58); }
.widget:is([data-type=timer],[data-type=alarm]) .time-steps { gap: min(1cqh, 8px); }
.widget:is([data-type=timer],[data-type=alarm]) .time-label { font-size: min(3cqw, 5cqh); letter-spacing: .08em; }
.widget:is([data-type=timer],[data-type=alarm],[data-type=tally]) .widget-controls { flex-wrap: nowrap; gap: min(2cqw, 2cqh); }
.widget:is([data-type=timer],[data-type=alarm],[data-type=tally]) .widget-controls button { min-height: clamp(32px, min(11cqw, 13cqh), 88px); min-width: clamp(38px, 14cqw, 150px); padding: min(1.5cqw, 2cqh); font-size: clamp(12px, min(4cqw, 6cqh), 38px); }


/* Keep classroom content clear; navigation lives along the bottom edge. */.app-header { inset: auto auto 16px 14px; width: 280px; max-width: calc(100vw - 28px); }
.wall-heading { flex: 1; width: 100%; }
.header-center { bottom: 80px; }
#library { top: 16px; }
.library-footer > .library-footer-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px; }
.library-brand { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--ink); }
.library-brand .brand-mark { display: block; width: 32px; height: 32px; object-fit: contain; background: transparent; border-radius: 0; }
.library-backup-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-left: auto; }
@media (max-width: 1100px) {
.app-header { inset: auto auto 84px 10px; width: 240px; }
.header-center { bottom: 146px; }

}
@media (max-width: 420px) {
#main-toolbar > .dock-button { width: 32px; min-width: 32px; padding: 6px; }

}
#active-tools { inset: 16px 18px 88px auto; width: 320px; max-width: calc(100vw - 28px); max-height: none; padding: 14px; display: flex; flex-direction: column; }
#active-tools .popup-heading { margin-bottom: 10px; flex-shrink: 0; }
#active-tools h2 { font-size: 17px; }
#active-tools-list { flex: 1; overflow-y: auto; min-height: 0; overscroll-behavior: contain; }
.active-tool-row { display: flex; align-items: center; gap: 6px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.active-tool-row:last-child { border-bottom: 0; }
.active-tool-title { text-align: left; justify-content: flex-start; border: 0; background: transparent; padding: 8px; min-height: 42px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.tool-hidden .active-tool-title { color: var(--muted); }
.active-tool-row .icon-button { flex-shrink: 0; width: 40px; min-height: 42px; }
.active-tools-empty { color: var(--muted); font-size: 13px; }
.active-tool-title[aria-pressed="true"] { background: var(--selected); color: var(--accent); }
@media(max-width:720px) {
#active-tools { right: 10px; }
 }
.widget:is([data-type=scoreboard],[data-type=stopwatch],[data-type=soundboard]) { container-type: size; }
.widget:is([data-type=scoreboard],[data-type=stopwatch],[data-type=soundboard],[data-type=youtube]) > .widget-content { padding: 0; background: var(--surface); color: var(--ink); }
.soundboard-content { display: flex; flex-direction: column; height: 100%; padding: 12px; gap: 12px; }
.youtube-form { display: flex; flex-direction: column; justify-content: center; gap: 12px; padding: 20px; height: 100%; overflow: auto; }
.youtube-form label { display: flex; flex-direction: column; gap: 8px; }
.youtube-form small { color: var(--muted); }
.youtube-error:empty { display: none; }
.youtube-error { color: var(--ink); font-size: 13px; margin: 0; }
.soundboard-content { overflow-y: auto; }
.embed-form-actions { display: flex; gap: 10px; }
.embed-form-actions > button { flex: 0 0 calc(50% - 5px); }
.widget:is([data-type=website],[data-type=pdf],[data-type=qr]) > .widget-content { padding: 0; background: var(--surface); color: var(--ink); }
.website-content,.pdf-content { height: 100%; display: flex; flex-direction: column; }
.website-footer,.pdf-footer { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; gap: 8px; padding: 7px 10px; font-size: 12px; }
.website-footer a,.pdf-footer a { color: var(--accent); flex-shrink: 0; }
.widget:is([data-type=checklist],[data-type=weblinks]) > .widget-content { padding: 0; background: var(--surface); color: var(--ink); }
.list-tool-content { display: flex; flex-direction: column; height: 100%; padding: 12px; gap: 8px; }
.list-tool-items { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; list-style: none; padding: 0; margin: 0; }
.list-tool-items[data-text-size=medium] { font-size: 20px; }
.list-tool-items[data-text-size=large] { font-size: 28px; }
.list-tool-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.checklist-label { display: flex; flex-direction: row; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 4px; cursor: pointer; overflow-wrap: anywhere; }
.checklist-label input { width: 22px; height: 22px; margin: 0; flex-shrink: 0; accent-color: var(--accent); cursor: pointer; }
.checked .checklist-label span { text-decoration: line-through; color: var(--muted); }
.web-link { flex: 1; min-width: 0; color: var(--accent); overflow-wrap: anywhere; padding: 6px 3px; }
.list-tool-remove { flex-shrink: 0; width: 36px; min-height: 40px; padding: 6px; background: transparent; border-color: transparent; }
.list-tool-add { display: flex; gap: 8px; flex-shrink: 0; }
.list-tool-add input { flex: 1; min-width: 0; width: 0; }
.list-tool-add button { flex-shrink: 0; width: 42px; padding: 8px; }
.list-tool-empty { color: var(--muted); padding: 12px 4px; font-size: 13px; }
.list-tool-error { font-size: 12px; color: var(--ink); margin: 0; }
.list-tool-error:empty { display: none; }
.wall-heading { display: flex; align-items: center; gap: 6px; }
.wall-heading > div { flex: 1; min-width: 0; }
#saved-states-toggle { width: 34px; height: 34px; min-height: 34px; padding: 6px; color: inherit; }
#saved-states { inset: 16px auto 88px 14px; width: 340px; max-width: calc(100vw - 28px); max-height: none; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
#saved-states .popup-heading { margin: 0; flex-shrink: 0; }
#saved-states h2 { font-size: 17px; }
.state-scopes { display: flex; gap: 6px; }
.state-scopes button { flex: 1; }
.state-scopes .active, #saved-states-toggle.active { background: var(--selected); }
#state-target { margin: 0; color: var(--muted); overflow-wrap: anywhere; }
#state-create { display: flex; gap: 6px; }
#state-name { width: 0; flex: 1; }
#saved-state-list { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; }
.saved-state-card { display: grid; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.saved-state-card > strong { overflow-wrap: anywhere; }
.saved-state-card > small { color: var(--muted); }
.saved-state-actions { display: flex; justify-content: flex-end; gap: 6px; }
.state-preview { width: 100%; height: auto; inset: auto; aspect-ratio: 16/9; position: relative; overflow: hidden; }
.state-preview canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
@media(max-width:1100px) {
#saved-states { bottom: 144px; left: 10px; }
 }
#background-library { width: min(1180px, calc(100vw - 32px)); max-width: none; height: min(820px, calc(100dvh - 40px)); max-height: none; padding: 20px; overflow: hidden; }
#background-library[open] { display: flex; flex-direction: column; gap: 12px; }
.background-library-header, .background-library-search, .background-library-tabs, .background-library-footer { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.background-library-header { justify-content: space-between; }
.background-library-header h2 { margin: 0; }
#background-library-search { flex: 1; width: 0; }
.background-library-tabs .active { background: var(--selected); }
#background-library-count { margin-left: auto; color: var(--muted); font-size: 12px; }
.background-library-body { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; flex: 1; min-height: 0; }
#background-library-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-content: start; gap: 12px; overflow-y: auto; min-height: 0; padding: 4px; overscroll-behavior: contain; }
.background-library-card { position: relative; min-width: 0; }
.background-library-choice { display: flex; flex-direction: column; padding: 5px; width: 100%; gap: 6px; height: 100%; justify-content: flex-start; }
.background-library-choice[aria-pressed=true] { outline: 3px solid var(--accent); outline-offset: -2px; background: var(--selected); }
.background-library-choice img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 6px; }
.background-library-choice span { width: 100%; font-size: 12px; text-align: left; overflow-wrap: anywhere; padding: 2px 4px; }
.background-library-card > .icon-button { position: absolute; right: 8px; top: 8px; background: var(--surface); border: 1px solid var(--line); width: 34px; height: 34px; min-height: 34px; padding: 6px; }
.background-library-preview { min-width: 0; overflow-y: auto; }
#background-library-preview { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 10px; margin-bottom: 12px; }
#background-library-name { display: block; overflow-wrap: anywhere; }
.background-library-preview p, .background-library-empty { color: var(--muted); font-size: 13px; }
.background-library-empty { grid-column: 1/-1; }
#background-library-status { flex-shrink: 0; margin: 0; font-size: 13px; }
#background-library-status:empty { display: none; }
.background-library-footer { justify-content: flex-end; }


/* Annotation commands share the primary dock's button sizes and rhythm. */#main-toolbar { --command-size: 42px; --command-gap: 5px; }
body.annotation-dock #main-toolbar > .ink-command-bar { gap: var(--command-gap) !important; }
#main-toolbar .ink-tools, #main-toolbar .ink-footer { gap: var(--command-gap); }
#main-toolbar .ink-footer { border: 0; padding: 0; }
#main-toolbar .ink-tools button, #main-toolbar .ink-footer button { width: var(--command-size); min-width: var(--command-size); height: 42px; padding: 10px; border-radius: 12px; }
#main-toolbar .ink-target { position: relative; width: 156px; height: 42px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 0; }
#main-toolbar .ink-target > svg { position: absolute; left: 9px; top: 11px; width: 19px; height: 19px; pointer-events: none; color: var(--muted); }
.ink-target-caption { position: absolute; top: 3px; left: 36px; font-size: 9px; line-height: 12px; color: var(--muted); pointer-events: none; }
#main-toolbar .ink-target select { position: static; opacity: 1; width: 100%; height: 100%; min-height: 0; border: 0; border-radius: inherit; padding: 12px 20px 1px 36px; font-size: 12px; color: var(--ink); background-color: transparent; text-overflow: ellipsis; cursor: pointer; }
#main-toolbar .ink-target select option { background: var(--surface); color: var(--ink); }
#context-toolbar .ink-sizes button { flex-direction: column; gap: 3px; min-height: 52px; padding: 5px 7px; border: 1px solid transparent; border-radius: 10px; font-size: 12px; }
#context-toolbar .ink-sizes button[aria-pressed=true] { background: var(--selected); border-color: var(--accent); color: var(--accent); }
.ink-size-preview { display: flex; align-items: center; justify-content: center; height: 20px; width: 24px; }
.ink-size-sample { display: block; flex-shrink: 0; width: var(--sample-size); height: var(--sample-size); border-radius: 50%; background: currentColor; }
#workspace { isolation: isolate; }
#spotlight-shade { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1000001; pointer-events: none; }
#laser-pointer { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 40; touch-action: none; cursor: none; }
.laser-colors { display: flex; gap: 8px; align-items: center; padding: 4px; }
#context-toolbar .laser-swatch { width: 30px; height: 30px; min-width: 30px; min-height: 30px; padding: 0; border-radius: 50%; border: 1px solid var(--line); }
.laser-swatch[aria-pressed=true] { outline: 2px solid var(--accent); outline-offset: 2px; }
body.annotation-dock #main-toolbar > #laser-tool { display: none; }
.ink-target-name { width: 100%; padding: 12px 8px 0 36px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media(max-width:720px) {
.ink-target-name { padding: 0 6px; }
 }
@media(max-width:720px) {
#main-toolbar { --command-size: 38px; --command-gap: 2px; }
#main-toolbar .ink-tools button, #main-toolbar .ink-footer button { padding: 8px; }
#main-toolbar .ink-target { width: 100px; }
#main-toolbar .ink-target > svg, .ink-target-caption { display: none; }
#main-toolbar .ink-target select { padding: 5px 18px 5px 7px; }

}
@media(max-width:420px) {
#main-toolbar { --command-size: 30px; --command-gap: 1px; gap: 1px; }
#main-toolbar > .dock-button { width: 30px; min-width: 30px; padding: 5px; }
#main-toolbar .dock-divider { margin: 0; }
#main-toolbar .ink-tools button, #main-toolbar .ink-footer button { padding: 6px; }
#main-toolbar .ink-target { width: 68px; }

}
@media(max-width:900px) {
.background-library-body { grid-template-columns: minmax(0,1fr) 220px; }
#background-library-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
 }
@media(max-width:620px) {
#background-library { padding: 12px; width: calc(100vw - 20px); height: calc(100dvh - 20px); }
.background-library-search { flex-wrap: wrap; }
#background-library-search { flex-basis: 100%; width: 100%; }
.background-library-body { display: flex; flex-direction: column; }
#background-library-grid { flex: 1; }
.background-library-preview { display: none; }
.background-library-tabs { gap: 4px; }
.background-library-tabs button { padding: 6px 10px; }
 }
#data-sources { position:fixed; z-index:80; left:50%; top:auto; bottom:90px; transform:translateX(-50%); margin:0; box-shadow:var(--shadow); width:min(900px,calc(100vw - 24px)); height:min(650px,calc(100dvh - 110px)); padding: 20px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
#data-sources header { display:flex; justify-content:space-between; align-items:center; height:48px; }
#data-sources h2 { margin:0; }
.source-columns { display:grid; grid-template-columns:minmax(220px, 1fr) minmax(0, 1.6fr); gap:20px; height:calc(100% - 60px); }
.source-columns > section { display:flex; flex-direction:column; gap:10px; min-height:0; }
.source-list { flex:1; min-height:0; overflow-y:auto; }
.source-row { display:flex; gap:4px; margin-bottom:6px; }
.source-row > button:first-child { flex:1; min-width:0; overflow-wrap:anywhere; justify-content:flex-start; }
.source-row > button:not(:first-child) { width:36px; padding:6px; flex-shrink:0; }
.source-row .active { background:var(--selected); }
.source-actions { display:flex; gap:6px; flex-wrap:wrap; }
.source-editor { display:flex; flex-direction:column; gap:12px; min-height:0; }
.source-editor p { margin:0; color:var(--muted); }
.source-editor textarea { flex:1; min-height:100px; resize:none; }
.class-tool { height:100%; display:flex; flex-direction:column; align-items:stretch; gap:10px; padding:12px; overflow:auto; color:var(--ink); background:var(--surface); }
.widget:is([data-type=calendar],[data-type=worksymbols],[data-type=randomizer]) > .widget-content { padding:0; container-type:size; }
@media(max-width:600px) {
.source-columns { grid-template-columns:minmax(140px,1fr) minmax(0,1.3fr); gap:8px; }
#data-sources { padding:10px; }
.source-row { flex-wrap:wrap; }
.source-row > button:first-child { flex-basis:100%; }
 }
.source-picker { width:min(520px,92vw); max-height:80vh; padding:20px; border:1px solid var(--line); border-radius:16px; color:var(--ink); background:var(--surface); }
.source-picker header { display:flex; align-items:center; justify-content:space-between; gap:16px; }
.source-picker h2 { margin:0; }
.source-picker input { width:100%; margin:12px 0; }
.source-picker-list { display:flex; flex-direction:column; gap:8px; max-height:50vh; overflow:auto; }
.source-picker-list button { justify-content:flex-start; overflow-wrap:anywhere; }
.source-picker-list [aria-pressed=true] { background:var(--selected); }
.randomizer-content, .spinner-content { overflow:hidden; min-height:0; }
.widget .chance-controls { flex:0 0 auto; position:static; display:flex; justify-content:center; margin:0; padding:8px; }
.widget.focused .randomizer-content, .widget.focused .spinner-content { padding-bottom:110px; }
.groupmaker-content { overflow:hidden; }
#room-title-editor { flex:1; width:0; min-width:0; min-height:34px; padding:5px 7px; margin-right:8px; font-size:16px; font-weight:650; letter-spacing:normal; color:var(--ink); background:transparent; border-color:transparent; }
#room-title-editor:hover, #room-title-editor:focus { background:var(--surface); border-color:var(--line); }
#storage-manager { width:min(960px,94vw); height:min(760px,90dvh); padding:20px; color:var(--ink); background:var(--surface); border:1px solid var(--line); border-radius:16px; }
#storage-manager[open] { display:flex; flex-direction:column; gap:14px; }
#storage-manager header,#storage-manager footer { display:flex; align-items:center; gap:10px; flex-shrink:0; }
#storage-manager header { justify-content:space-between; }
#storage-manager h2,#storage-manager p { margin:0; }
.storage-summary { display:flex; flex-direction:column; gap:8px; }
.storage-summary small,.storage-item p { color:var(--muted); }
.storage-summary progress { width:100%; height:12px; accent-color:var(--accent); }
.storage-columns { display:grid; grid-template-columns:minmax(150px,1fr) minmax(0,2fr); gap:20px; flex:1; min-height:0; }
.storage-columns nav { display:flex; flex-direction:column; gap:6px; overflow:auto; }
.storage-columns nav button { flex-shrink:0; display:flex; flex-direction:column; align-items:flex-start; text-align:left; }
.storage-columns nav button[aria-pressed=true] { background:var(--selected); border-color:var(--accent); }
.storage-columns section { min-height:0; min-width:0; display:flex; flex-direction:column; gap:10px; }
.storage-items { overflow:auto; flex:1; min-height:0; }
.storage-item { border-bottom:1px solid var(--line); padding:12px 4px; display:flex; flex-direction:column; gap:8px; overflow-wrap:anywhere; }
.storage-item-heading { display:flex; align-items:center; gap:8px; }
.storage-item-heading strong { flex:1; min-width:0; }
.storage-item-heading span { white-space:nowrap; }
.storage-item summary { cursor:pointer; }
#storage-manager footer p { flex:1; font-size:12px; color:var(--muted); }
.library-backup-actions { flex-wrap:wrap; }
@media(max-width:600px) {
#storage-manager { padding:10px; gap:8px; }
.storage-columns { gap:8px; grid-template-columns:minmax(120px,1fr) minmax(0,1.6fr); }
#storage-manager footer { flex-wrap:wrap; }
#storage-manager footer p { flex-basis:100%; }
.storage-summary { font-size:12px; }
 }
.widget:is([data-type=teachingclock],[data-type=wordbuilder],[data-type=sortingboard]) > .widget-content { padding:0; background:var(--surface); color:var(--ink); }
.learning-content { width:100%; height:100%; min-height:0; display:flex; flex-direction:column; gap:10px; padding:14px; overflow:auto; }
.widget.focused .learning-content { padding-top:80px; padding-bottom:110px; }
.learning-hint { margin:0; font-size:13px; color:var(--muted); flex-shrink:0; }
.learning-content button { min-width:44px; min-height:44px; }
.letter-tile[aria-pressed=true],.sorting-tile[aria-pressed=true] { background:var(--selected); outline:2px solid var(--accent); }
.learning-drag-ghost { position:fixed; z-index:200; transform:translate(-50%,-50%); pointer-events:none; opacity:.85; background:var(--surface); color:var(--ink); border:2px solid var(--accent); }
.tile-dragging { opacity:.35; }

/* Shared feedback for touch-reorderable list rows. */
.list-dragging { opacity:.5; }
.list-tool-row.drop-before { box-shadow:0 -3px var(--accent); }
.list-tool-row.drop-after { box-shadow:0 3px var(--accent); }

#stage.saving-wall-image .widget.selected { outline:none; }
