/* Lavagna Online — stile della lavagna */
:root {
  --blue: #204660;
  --blue-dark: #16334a;
  --blue-soft: #e8eef3;
  --text: #333;
  --muted: #737665;
  --bg: #f7f7f7;
  --coral: #f36a55;
  --gold: #c99f22;
  --olive: #737665;
  --white: #fff;
  --line: #dde3e8;
  --shadow: 0 8px 28px rgba(22, 51, 74, .16), 0 2px 6px rgba(22, 51, 74, .08);
  --radius: 10px;
  --serif: 'Crimson Text', Georgia, serif;
  --sans: 'Work Sans', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  color: var(--text);
  background: #dfe5ea;
  -webkit-font-smoothing: antialiased;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
[hidden] { display: none !important; }
button { font-family: inherit; color: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; color: var(--text); }
svg.lucide { width: 22px; height: 22px; stroke-width: 2; }

/* ---------- Bottoni ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border: 2px solid var(--blue); background: var(--blue); color: #fff;
  font-weight: 600; font-size: 14px; letter-spacing: .06em; text-transform: uppercase;
  padding: 11px 20px; border-radius: var(--radius);
  transition: background .15s, color .15s, transform .1s;
}
.btn:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn:active { transform: translateY(1px); }
.btn-outline { background: transparent; color: var(--blue); }
.btn-outline:hover { background: var(--blue-soft); color: var(--blue); }
.btn-coral { background: var(--coral); border-color: var(--coral); }
.btn-coral:hover { background: #dc5541; border-color: #dc5541; }
.btn-sm { padding: 7px 12px; font-size: 12px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--blue); }
.btn-ghost:hover { background: var(--blue-soft); border-color: transparent; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

.icon-btn {
  width: 40px; height: 40px; display: inline-grid; place-items: center;
  border: 0; background: transparent; border-radius: var(--radius); color: var(--blue);
}
.icon-btn:hover { background: var(--blue-soft); }

.bar { width: 100px; height: 4px; background: var(--coral); }

/* ---------- Login ---------- */
.login {
  position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(201,159,34,.18), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(243,106,85,.16), transparent 60%),
    var(--blue);
  padding: 24px; overflow: auto; user-select: auto;
}
.login-card {
  width: min(440px, 100%); background: #fff; border-radius: 16px; padding: 40px 36px 32px;
  box-shadow: 0 30px 80px rgba(0,0,0,.3); display: flex; flex-direction: column; align-items: center; text-align: center;
}
.login-logo { height: 64px; margin-bottom: 22px; }
.login-card h1 { font-family: var(--serif); font-weight: 600; color: var(--blue); font-size: 46px; margin: 14px 0 4px; }
.login-sub { margin: 0 0 26px; color: var(--muted); }
.login-card .btn { width: 100%; }
.btn-google { background: #fff; color: var(--blue); border-color: var(--line); text-transform: none; letter-spacing: 0; font-size: 16px; }
.btn-google:hover { background: var(--bg); border-color: var(--blue); color: var(--blue); }
.login-note { font-size: 13px; color: var(--muted); margin: 10px 0 0; line-height: 1.45; }
.login-note.small { font-size: 12px; }
.login-or { display: flex; align-items: center; gap: 12px; width: 100%; margin: 22px 0 18px; color: #9aa; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; }
.login-or::before, .login-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.login-error { margin: 18px 0 0; padding: 10px 14px; border-radius: 8px; background: #fdeceb; color: #b23a2a; font-size: 14px; width: 100%; }
.login-foot { color: rgba(255,255,255,.7); font-size: 12px; margin-top: 22px; letter-spacing: .03em; }
/* Finché non si conosce la scuola la scheda non si mostra (niente logo o nome sbagliati per un attimo). */
.login.wait .login-card, .login.wait .login-foot { visibility: hidden; }
.login-logo.school-logo { height: auto; max-height: 96px; max-width: 280px; }
.top-logo.school-logo { width: auto; max-width: 150px; object-fit: contain; }
.login-msg { margin: 6px 0 0; font-size: 15px; line-height: 1.6; color: var(--text); }
.login-msg b { word-break: break-all; }
.login-msg .btn { width: auto; margin: 16px 4px 0; text-decoration: none; }

/* ---------- Stage e lavagna ---------- */
#stage { position: fixed; inset: 0; }
#board-wrap { position: absolute; box-shadow: 0 4px 30px rgba(22,51,74,.18); background: #fff; }
#board-wrap canvas { position: absolute; inset: 0; display: block; }
#overlay { cursor: crosshair; touch-action: none; }
#overlay.t-select { cursor: default; }
#overlay.t-text { cursor: text; }
#overlay.t-eraser { cursor: none; }
#overlay.t-laser { cursor: none; }
body.fs #board-wrap { box-shadow: none; }

.text-editor {
  position: absolute; border: 2px dashed var(--coral); background: rgba(255,255,255,.6);
  outline: none; resize: none; overflow: hidden; padding: 0; margin: 0;
  font-family: var(--sans); line-height: 1.25; min-width: 40px; white-space: pre; user-select: text; z-index: 5;
}

/* ---------- Barre UI ---------- */
.ui { position: fixed; z-index: 40; background: rgba(255,255,255,.96); box-shadow: var(--shadow); backdrop-filter: blur(8px); }
body.ui-hidden .ui { display: none !important; }
#topbar {
  top: 12px; left: 12px; right: 12px; height: 54px; border-radius: 14px;
  display: flex; align-items: center; gap: 10px; padding: 0 10px;
  pointer-events: auto; right: auto; max-width: calc(100vw - 24px);
}
.top-logo { height: 30px; }
.lesson-title {
  border: 0; background: transparent; font-family: var(--serif); font-size: 22px; font-weight: 600; color: var(--blue);
  width: 260px; padding: 6px 8px; border-radius: 8px; user-select: text;
}
.lesson-title:hover, .lesson-title:focus { background: var(--bg); outline: none; }
.save-status { font-size: 12px; color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.save-status svg.lucide { width: 14px; height: 14px; }
.spacer { flex: 1; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 4px; border-radius: 30px; cursor: pointer; font-size: 13px; font-weight: 500; }
.user-chip:hover { background: var(--bg); }
.user-chip img, .user-chip .avatar { width: 34px; height: 34px; border-radius: 50%; }
.user-chip .avatar { display: grid; place-items: center; background: var(--olive); color: #fff; }
.user-chip .avatar svg { width: 18px; height: 18px; }
.btn .badge { margin-left: 8px; vertical-align: 1px; }
.badge { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; padding: 2px 6px; border-radius: 4px; background: var(--gold); color: #fff; font-weight: 700; }

#tools {
  left: 12px; top: 50%; transform: translateY(-50%); border-radius: 14px; padding: 8px;
  display: flex; flex-direction: column; gap: 4px;
  max-height: calc(100vh - 150px); overflow-y: auto; scrollbar-width: none;
}
.tool {
  width: 46px; height: 46px; border-radius: 10px; border: 0; background: transparent; color: var(--blue);
  display: grid; place-items: center; position: relative;
}
.tool:hover { background: var(--blue-soft); }
.tool.active { background: var(--blue); color: #fff; }
.tool.has-sub::after { content: ''; position: absolute; right: 5px; bottom: 5px; border: 4px solid transparent; border-right-color: currentColor; border-bottom-color: currentColor; opacity: .6; }
.tool-sep { height: 1px; background: var(--line); margin: 4px 6px; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); display: block; }

#dock {
  bottom: 12px; left: 50%; transform: translateX(-50%); border-radius: 16px; padding: 8px 10px;
  display: flex; gap: 2px; align-items: stretch; max-width: calc(100vw - 140px); overflow-x: auto; scrollbar-width: none;
}
#dock::-webkit-scrollbar { display: none; }
.dock-item {
  border: 0; background: transparent; border-radius: 12px; padding: 6px 6px 4px; min-width: 74px;
  display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; color: var(--text); font-weight: 500;
}
.dock-item:hover { background: var(--bg); }
.dock-item .wicon { width: 44px; height: 44px; }
.dock-item span { white-space: nowrap; }
.dock-sep { width: 1px; background: var(--line); margin: 6px 4px; }
.wicon {
  border-radius: 12px; display: grid; place-items: center; color: #fff; flex: none;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.12);
}
.wicon svg.lucide { width: 24px; height: 24px; }

#pager {
  right: 12px; top: 12px; border-radius: 14px; padding: 6px; display: flex; align-items: center; gap: 2px;
}
.page-count { border: 0; background: transparent; font-weight: 600; color: var(--blue); padding: 8px 10px; border-radius: 8px; font-size: 15px; min-width: 64px; }
.page-count:hover { background: var(--blue-soft); }
.pager-sep { width: 1px; height: 26px; background: var(--line); margin: 0 4px; }

.showui {
  position: fixed; right: 14px; bottom: 14px; z-index: 45; width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: rgba(32,70,96,.55); color: #fff; display: grid; place-items: center; opacity: .8; transition: opacity .2s;
}
.showui:hover { opacity: 1; background: var(--blue); }

/* ---------- Popover ---------- */
.popover {
  position: fixed; z-index: 60; background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 14px;
  animation: pop .14s ease-out;
}
@keyframes pop { from { opacity: 0; transform: scale(.97); } }
.popover h3 { margin: 0 0 10px; font-family: var(--serif); font-size: 20px; color: var(--blue); font-weight: 600; }
.pop-title { text-align: center; color: var(--blue); font-weight: 600; margin: 0 0 12px; font-size: 15px; }
.menu { min-width: 270px; padding: 8px; }
.menu-item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px; border: 0; background: none;
  border-radius: 8px; font-size: 14px; text-align: left;
}
.menu-item:hover { background: var(--blue-soft); }
.menu-item svg.lucide { width: 18px; height: 18px; color: var(--blue); }
.menu-item .kbd { margin-left: auto; font-size: 11px; color: #999; }
.menu-item[disabled] { opacity: .45; cursor: not-allowed; }
.menu-item.locked { color: #9aa3a9; }
.menu-item.locked svg { opacity: .55; }
.menu-item.locked .lock { margin-left: auto; width: 15px; height: 15px; opacity: .8; }
.menu-item[disabled]:hover { background: none; }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu-label { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding: 8px 12px 4px; display: flex; align-items: center; gap: 6px; }

.colors { display: grid; grid-template-columns: repeat(6, 32px); gap: 8px; }
.color-dot { width: 32px; height: 32px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.color-dot.active { box-shadow: 0 0 0 3px var(--blue); }
.color-dot.custom { background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); position: relative; overflow: hidden; }
.color-dot.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.sizes { display: flex; gap: 6px; margin-top: 14px; align-items: center; }
.size-btn { width: 40px; height: 40px; border-radius: 10px; border: 0; background: var(--bg); display: grid; place-items: center; }
.size-btn.active { background: var(--blue-soft); box-shadow: inset 0 0 0 2px var(--blue); }
.size-btn i { display: block; border-radius: 50%; background: var(--text); }
.range { width: 100%; margin-top: 12px; accent-color: var(--blue); }
.check { display: flex; gap: 8px; align-items: center; font-size: 13px; margin-top: 12px; }
.check input { accent-color: var(--blue); width: 16px; height: 16px; }

.shape-grid { display: grid; grid-template-columns: repeat(4, 46px); gap: 6px; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 44px); gap: 4px; max-height: 300px; overflow: auto; }
.emoji-grid button { border: 0; background: none; font-size: 28px; border-radius: 8px; height: 44px; }
.emoji-grid button:hover, .emoji-grid button.active { background: var(--blue-soft); }

.more-grid { display: grid; grid-template-columns: repeat(4, 110px); gap: 6px; }
.more-item { position: relative; border: 0; background: none; border-radius: 12px; padding: 12px 4px 8px; display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 13px; }
.more-item:hover { background: var(--bg); }
.more-item .wicon { width: 52px; height: 52px; }
.more-item .pin { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 6px; border: 0; background: none; color: #bbb; display: grid; place-items: center; }
.more-item .pin svg { width: 16px; height: 16px; }
.more-item .pin.on { color: var(--gold); }
.more-item .pin.on svg { fill: var(--gold); }
.more-hint { font-size: 12px; color: var(--muted); text-align: center; margin: 10px 0 0; }

/* ---------- Modali ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(22,51,74,.45); z-index: 80; display: grid; place-items: center; padding: 20px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: #fff; border-radius: 16px; box-shadow: 0 30px 80px rgba(0,0,0,.3); width: min(560px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; user-select: text; }
.modal.wide { width: min(900px, 100%); }
.modal-head { padding: 22px 24px 8px; }
.modal-head .bar { margin-bottom: 10px; }
.modal-head h2 { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 28px; color: var(--blue); }
.modal-body { padding: 10px 24px; overflow: auto; }
.modal-foot { padding: 14px 24px 20px; display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-size: 13px; font-weight: 600; color: var(--blue); }
.field input, .field textarea, .field select, .inp {
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 15px; font-weight: 400; background: #fff; width: 100%;
}
.field input:focus, .field textarea:focus, .field select:focus, .inp:focus { outline: 2px solid var(--blue); outline-offset: -1px; border-color: transparent; }
.radio-row { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-row label { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-weight: 500; color: var(--text); }
.radio-row label:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); }
.radio-row input { accent-color: var(--blue); }
.list { display: flex; flex-direction: column; gap: 6px; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: #fff; text-align: left; width: 100%; font-size: 14px; }
.list-item:hover { border-color: var(--blue); background: var(--blue-soft); }
.list-item img { width: 72px; height: 40px; object-fit: cover; border-radius: 4px; background: var(--bg); }
.list-item .meta { font-size: 12px; color: var(--muted); }
.list-item input[type=checkbox] { accent-color: var(--blue); width: 18px; height: 18px; }
.empty { color: var(--muted); text-align: center; padding: 30px 10px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--blue-soft); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Pagine */
.pages-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.page-thumb { position: relative; border-radius: 10px; overflow: hidden; border: 2px solid var(--line); cursor: pointer; background: #fff; }
.page-thumb.active { border-color: var(--coral); }
.page-thumb canvas { display: block; width: 100%; aspect-ratio: 16/9; }
.page-thumb .pn { position: absolute; left: 6px; bottom: 6px; background: var(--blue); color: #fff; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; }
.page-thumb .acts { position: absolute; right: 4px; top: 4px; display: flex; gap: 2px; }
.page-thumb .acts button { width: 30px; height: 30px; border: 0; border-radius: 8px; background: rgba(255,255,255,.95); color: var(--blue); display: grid; place-items: center; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.page-thumb .acts svg { width: 16px; height: 16px; }

/* Sfondi */
.bg-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.bg-opt { aspect-ratio: 16/10; border-radius: 10px; border: 2px solid var(--line); cursor: pointer; padding: 0; overflow: hidden; }
.bg-opt.active { border-color: var(--coral); box-shadow: 0 0 0 2px var(--coral); }
.bg-opt canvas { width: 100%; height: 100%; display: block; }
.sec-label { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 16px 0 8px; font-weight: 600; }

/* ---------- Toast ---------- */
#toast { position: fixed; left: 50%; top: 80px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--blue); color: #fff; padding: 10px 18px; border-radius: 10px; box-shadow: var(--shadow); font-size: 14px; animation: pop .2s; }
.toast.err { background: #b23a2a; }

/* ---------- Widget ---------- */
#widgets { position: fixed; inset: 0; pointer-events: none; z-index: 30; }
.widget {
  position: absolute; pointer-events: auto; background: #fff; border-radius: 16px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; min-width: 140px; min-height: 100px; overflow: hidden;
}
.widget.dragging { box-shadow: 0 20px 50px rgba(22,51,74,.3); opacity: .96; }
.w-head {
  height: 38px; flex: none; display: flex; align-items: center; gap: 4px; padding: 0 4px 0 12px; cursor: grab;
  font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .08em;
  touch-action: none;
}
.w-head:active { cursor: grabbing; }
.w-title { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.w-btn { width: 34px; height: 34px; border: 0; background: none; border-radius: 6px; display: grid; place-items: center; color: #999; }
.w-btn:hover { background: var(--bg); color: var(--blue); }
.w-btn svg.lucide { width: 18px; height: 18px; }
.w-body { flex: 1; position: relative; overflow: hidden; display: flex; flex-direction: column; container-type: size; }
.w-resize { position: absolute; right: 0; bottom: 0; width: 30px; height: 30px; cursor: nwse-resize; touch-action: none;
  background: linear-gradient(135deg, transparent 55%, #c5ccd2 55%, #c5ccd2 62%, transparent 62%, transparent 72%, #c5ccd2 72%, #c5ccd2 79%, transparent 79%); }
.widget.bare { background: transparent; box-shadow: none; }
/* Su lavagne touch non esiste l'hover: intestazione sempre visibile. */
.widget.bare .w-head { background: rgba(255,255,255,.92); border-radius: 10px; box-shadow: 0 2px 8px rgba(22,51,74,.12); }

.w-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 8px; }
.w-row { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; align-items: center; }
.w-actions { display: flex; gap: 6px; justify-content: center; padding: 8px; flex-wrap: wrap; }
.pill { border: 0; background: var(--bg); color: var(--blue); padding: 6px 12px; border-radius: 20px; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.pill:hover { background: var(--blue-soft); }
.pill.primary { background: var(--blue); color: #fff; }
.pill.primary:hover { background: var(--blue-dark); }
.pill.coral { background: var(--coral); color: #fff; }
.pill svg.lucide { width: 16px; height: 16px; }
.round-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--blue); color: #fff; }
.round-btn.light { background: var(--bg); color: var(--blue); }
.round-btn:hover { filter: brightness(1.1); }
.w-input { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 14px; width: 100%; user-select: text; }
.w-textarea { flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-size: 15px; resize: none; width: 100%; user-select: text; line-height: 1.4; }
.w-pad { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 0; }
.big-num { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--blue); line-height: 1; }

/* Semaforo */
.tl-housing { background: #2a2f33; border-radius: 22cqmin; padding: 6cqmin; display: flex; flex-direction: column; gap: 5cqmin; height: 92%; aspect-ratio: 1/2.75; box-shadow: inset 0 -6px 0 rgba(0,0,0,.25); }
.tl-light { flex: 1; border-radius: 50%; border: 0; aspect-ratio: 1; opacity: .22; transition: opacity .2s, box-shadow .2s; }
.tl-light.on { opacity: 1; }
.tl-light.red { background: radial-gradient(circle at 35% 35%, #ff8a7a, #e8321e 60%); }
.tl-light.yellow { background: radial-gradient(circle at 35% 35%, #ffe680, #f2b705 60%); }
.tl-light.green { background: radial-gradient(circle at 35% 35%, #8af0a5, #1fae4b 60%); }
.tl-light.red.on { box-shadow: 0 0 30px 6px rgba(232,50,30,.7); }
.tl-light.yellow.on { box-shadow: 0 0 30px 6px rgba(242,183,5,.7); }
.tl-light.green.on { box-shadow: 0 0 30px 6px rgba(31,174,75,.7); }

/* Timer */
.timer-ring { position: relative; flex: 1; width: 100%; min-height: 0; display: grid; place-items: center; }
.timer-ring > svg { position: absolute; width: 100%; height: 100%; }
.timer-digits { position: relative; font-size: 44px; font-size: clamp(22px, 16cqmin, 120px); border: 0; background: none; color: var(--blue); font-weight: 600; font-variant-numeric: tabular-nums; }
.timer-digits:hover { color: var(--coral); }
.widget.done { animation: flash 1s ease-in-out 4; }
@keyframes flash { 50% { background: #fde3df; box-shadow: 0 0 0 8px var(--coral), var(--shadow); } }

/* Dadi */
.dice-row { display: flex; gap: 6cqmin; flex-wrap: wrap; justify-content: center; }
.die { width: 34cqmin; height: 34cqmin; background: #fff; border-radius: 18%; box-shadow: inset 0 -4px 0 rgba(0,0,0,.08), 0 2px 8px rgba(0,0,0,.15); border: 2px solid #e4e7ea;
  display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 14%; }
.die i { width: 70%; height: 70%; border-radius: 50%; background: var(--blue); place-self: center; visibility: hidden; }
.die.rolling { animation: roll .5s ease-out; }
@keyframes roll { 0% { transform: rotate(0) scale(.8); } 50% { transform: rotate(200deg) scale(1.1); } 100% { transform: rotate(360deg); } }

/* Rumorometro */
.meter { flex: 1; width: 40%; max-width: 90px; background: var(--bg); border-radius: 14px; position: relative; overflow: hidden; border: 2px solid var(--line); }
.meter-fill { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(to top, #1fae4b, #f2b705 60%, #e8321e); transition: height .08s; }
.meter-thr { position: absolute; left: -2px; right: -2px; height: 3px; background: var(--blue); }
.meter-face { font-size: 18cqmin; transition: transform .2s; }
.widget.loud { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* Simboli di lavoro */
.ws-big { font-size: 36cqmin; line-height: 1; }
.ws-label { font-family: var(--serif); font-size: 11cqmin; font-weight: 600; color: var(--blue); text-align: center; }
.ws-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 8px; flex: 1; }
.ws-opt { border: 0; background: var(--bg); border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--blue); }
.ws-opt span:first-child { font-size: 30px; }
.ws-opt:hover { background: var(--blue-soft); }

/* Nota */
.note-body { flex: 1; padding: 12px 16px; outline: none; overflow: auto; user-select: text; line-height: 1.35; }
.note-colors { display: flex; gap: 6px; padding: 6px 10px; align-items: center; }
.note-colors button.c { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.15); padding: 0; }

/* Estrazione / gruppi */
.pick-name { font-family: var(--serif); font-weight: 700; color: var(--blue); text-align: center; font-size: 16cqmin; line-height: 1.05; padding: 0 8px; word-break: break-word; }
.pick-name.spin { color: var(--muted); }
.pick-name.win { animation: winpop .4s; }
@keyframes winpop { 0% { transform: scale(.6); } 70% { transform: scale(1.12); } }
.groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; padding: 8px 12px; overflow: auto; flex: 1; align-content: start; }
.group { border-radius: 10px; padding: 8px 10px; color: #fff; font-size: 14px; }
.group b { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 4px; opacity: .9; }

/* Sondaggio, punteggio */
.poll-opt { display: flex; align-items: center; gap: 8px; }
.poll-bar { flex: 1; position: relative; height: 38px; border-radius: 10px; background: var(--bg); overflow: hidden; border: 0; text-align: left; padding: 0; }
.poll-bar .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 10px; transition: width .3s; }
.poll-bar .lbl { position: relative; padding: 0 12px; font-weight: 600; line-height: 38px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.poll-count { width: 34px; text-align: right; font-weight: 700; color: var(--blue); font-variant-numeric: tabular-nums; }
.score-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; padding: 8px; flex: 1; }
.team { border-radius: 12px; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 8px; gap: 4px; position: relative; }
.team input { background: transparent; border: 0; color: #fff; font-weight: 700; text-align: center; font-size: 15px; width: 100%; text-transform: uppercase; letter-spacing: .05em; }
.team .sc { font-size: 15cqmin; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
.team .b { display: flex; gap: 6px; }
.team .b button { width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(255,255,255,.25); color: #fff; font-size: 20px; font-weight: 700; }
.team .x { position: absolute; top: 4px; right: 4px; background: none; border: 0; color: rgba(255,255,255,.7); }

/* Orario */
.tt-row { display: grid; grid-template-columns: 80px 1fr 28px; gap: 6px; align-items: center; padding: 4px 6px; border-radius: 8px; }
.tt-row.now { background: #fde3df; box-shadow: inset 4px 0 0 var(--coral); }
.tt-row input { border: 0; background: transparent; font-size: 15px; padding: 6px; border-radius: 6px; }
.tt-row input:focus { background: var(--bg); outline: none; }
.tt-row input.t { font-weight: 700; color: var(--blue); font-variant-numeric: tabular-nums; }

/* Calendario, conto alla rovescia */
.cal { text-align: center; }
.cal .wd { font-size: 9cqmin; text-transform: uppercase; letter-spacing: .12em; color: var(--coral); font-weight: 700; }
.cal .d { font-family: var(--serif); font-size: 42cqmin; color: var(--blue); font-weight: 700; line-height: .95; }
.cal .my { font-size: 9cqmin; color: var(--muted); font-weight: 500; }
.cd-grid { display: flex; gap: 4cqmin; justify-content: center; }
.cd-grid div { text-align: center; }
.cd-grid b { display: block; font-size: 18cqmin; color: var(--blue); font-variant-numeric: tabular-nums; line-height: 1; }
.cd-grid span { font-size: 4.5cqmin; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.cd-title { font-family: var(--serif); font-size: 9cqmin; color: var(--blue); font-weight: 600; text-align: center; }

/* Webcam */
.cam-wrap { flex: 1; background: #111; position: relative; display: grid; place-items: center; min-height: 0; }
.cam-wrap video { width: 100%; height: 100%; object-fit: contain; }
.cam-wrap video.mirror { transform: scaleX(-1); }
.cam-bar { position: absolute; bottom: 8px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; }
.cam-bar select { max-width: 160px; border-radius: 20px; border: 0; padding: 6px 10px; font-size: 12px; }

.embed-frame { flex: 1; border: 0; width: 100%; background: #000; }
.qr-img { flex: 1; min-height: 0; display: grid; place-items: center; padding: 8px; }
.qr-img img { height: 100%; max-width: 100%; aspect-ratio: 1; image-rendering: pixelated; }

.clock-digital { font-size: 18cqmin; font-weight: 600; color: var(--blue); font-variant-numeric: tabular-nums; }
.clock-date { font-size: 6cqmin; color: var(--muted); text-transform: capitalize; }
.analog { flex: 1; min-height: 0; aspect-ratio: 1; max-width: 100%; }

.sw-laps { max-height: 30%; overflow: auto; width: 100%; font-size: 13px; padding: 0 12px; font-variant-numeric: tabular-nums; }
.sw-laps div { display: flex; justify-content: space-between; border-bottom: 1px solid var(--bg); padding: 3px 0; }
.link-btn { font-size: 7cqmin; padding: 4cqmin 8cqmin; text-transform: none; letter-spacing: 0; max-width: 92%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Sotto i 1280 px la barra delle pagine non sta accanto a quella del titolo: va in basso a destra. */
@media (max-width: 1279px) { #pager { top: auto; bottom: 104px; } }
@media (max-width: 900px) {
  #dock { max-width: calc(100vw - 24px); }
  .lesson-title { width: 150px; font-size: 18px; }
  .top-logo, .save-status { display: none; }
  .more-grid { grid-template-columns: repeat(3, 96px); }
}

/* ---------- Tocco, zoom, schermo intero ---------- */
.exitfs {
  position: fixed; right: 12px; top: 78px; z-index: 45; display: none; align-items: center; gap: 8px;
  height: 48px; padding: 0 18px; border: 0; border-radius: 24px; background: rgba(32,70,96,.85); color: #fff;
  font-weight: 600; font-size: 14px; letter-spacing: .06em; text-transform: uppercase; box-shadow: var(--shadow);
}
body.fs .exitfs { display: inline-flex; }
body.fs.ui-hidden .exitfs { top: 12px; opacity: .8; }
.zoom-chip {
  position: fixed; left: 12px; bottom: 12px; z-index: 45; display: inline-flex; align-items: center; gap: 6px;
  height: 44px; padding: 0 14px; border: 0; border-radius: 22px; background: var(--blue); color: #fff; font-weight: 600; box-shadow: var(--shadow);
}
.zoom-chip[hidden] { display: none; }
.size-row { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.size-row input[type=range] { flex: 1; accent-color: var(--blue); height: 32px; }
.size-preview { width: 100%; height: 56px; margin-top: 12px; border-radius: 10px; background: var(--bg); display: block; }
.size-val { min-width: 36px; text-align: right; font-weight: 600; color: var(--blue); font-variant-numeric: tabular-nums; }
.seg { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.seg label { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; cursor: pointer; }
.seg label:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); }
.seg input { accent-color: var(--blue); margin-top: 3px; }
.seg small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.thick-dot { display: block; border-radius: 50%; background: currentColor; }
.hw-chip {
  position: fixed; z-index: 55; display: flex; gap: 4px; flex-wrap: wrap; max-width: 520px; padding: 6px; background: #fff;
  border-radius: 12px; box-shadow: var(--shadow); animation: pop .14s ease-out;
}
.hw-chip button { border: 0; background: var(--bg); color: var(--blue); border-radius: 8px; padding: 8px 12px; font-size: 16px; font-weight: 500; min-height: 40px; }
.hw-chip button.on { background: var(--blue); color: #fff; }
.hw-chip button.undo { background: none; color: var(--muted); font-size: 13px; }

/* ---------- Widget Grafico ---------- */
.g-wrap { display: flex; flex-direction: column; flex: 1; min-height: 0; padding: 8px 10px 10px; gap: 6px; }
.g-list { display: flex; flex-direction: column; gap: 4px; max-height: 34%; overflow-y: auto; }
.g-fn { display: flex; align-items: center; gap: 8px; background: var(--bg); border-radius: 10px; padding: 2px 4px 2px 8px; }
.g-fn.off { opacity: .45; }
.g-fn.bad .g-lbl { color: #c2402c; }
.g-dot { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--c); background: var(--c); padding: 0; }
.g-fn.off .g-dot { background: #fff; }
.g-lbl { flex: 1; text-align: left; border: 0; background: none; font: 600 17px var(--sans); color: var(--blue); padding: 6px 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-lbl small { font-weight: 500; font-size: 12px; }
.g-empty { font-size: 13px; color: var(--muted); padding: 2px 2px 4px; }
.g-ex { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.g-input { display: flex; align-items: center; gap: 6px; }
.g-fx { font: italic 600 17px var(--serif); color: var(--blue); }
.g-input input { flex: 1; min-width: 0; font: 500 16px var(--sans); color: var(--blue); border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.g-input input:focus { outline: none; border-color: var(--blue); }
.g-input .pill { padding: 8px 12px; }
.g-err { margin: 0; font-size: 12px; color: #c2402c; }
.g-params { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.g-params:empty { display: none; }
.g-par { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--blue); }
.g-par b { font: italic 700 17px var(--serif); }
.g-par input { width: 110px; accent-color: var(--coral); }
.g-par span { min-width: 34px; font-variant-numeric: tabular-nums; }
.g-plot { position: relative; flex: 1; min-height: 120px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; touch-action: none; }
.g-plot canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; }
.g-plot canvas:active { cursor: grabbing; }
.g-zoom { position: absolute; right: 8px; bottom: 8px; display: flex; flex-direction: column; gap: 6px; }
.g-zoom button { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.95); color: var(--blue); display: grid; place-items: center; box-shadow: 0 2px 6px rgba(22,51,74,.12); }
.g-zoom svg { width: 20px; height: 20px; }
.g-tip { position: absolute; pointer-events: none; background: #fff; border: 1px solid var(--line); box-shadow: 0 4px 12px rgba(22,51,74,.15); border-radius: 8px; padding: 4px 10px; font-size: 14px; color: #333; white-space: nowrap; }
.fx-chip .fx-ok { font: italic 600 18px var(--serif); color: var(--blue); padding: 4px 10px 4px 6px; border-right: 1px solid var(--line); margin-right: 2px; }

/* ---------- Note e simboli musicali ---------- */
.mus-pop { width: 372px; max-height: min(78vh, 640px); overflow-y: auto; }
.mus-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.mus-top .pill { padding: 8px 14px; }
.mus-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.mus-grid button { border: 1.5px solid var(--line); background: #fff; border-radius: 10px; padding: 2px; display: grid; place-items: center; aspect-ratio: 1; }
.mus-grid button:hover { border-color: var(--blue); }
.mus-grid button.on { border-color: var(--coral); background: #fff4f2; box-shadow: 0 0 0 2px rgba(243,106,85,.25); }
.mus-hint { font-size: 12.5px; color: var(--muted); margin: 10px 0 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.mus-top .check { margin-top: 0; }

/* Impostazione del timer: pulsanti grandi, dimensioni limitate anche con il widget ingrandito.
   Prima il valore in pixel (browser senza unità cq*), poi quello che segue la grandezza del widget. */
.timer-edit { position: relative; display: flex; align-items: center; gap: 8px; gap: clamp(4px, 2cqmin, 14px); }
.te-col { display: flex; flex-direction: column; align-items: center; gap: 4px; gap: clamp(2px, 1cqmin, 8px); }
.te-col button { width: 40px; width: clamp(38px, 12cqmin, 64px); height: 30px; height: clamp(30px, 8cqmin, 48px); border: 0; border-radius: 10px; background: var(--bg); color: var(--blue); display: grid; place-items: center; padding: 0; touch-action: manipulation; }
.te-col button:active { background: var(--blue-soft); }
.te-col button svg, .te-ok svg { position: static; width: 60%; height: 60%; }
.te-v { font-size: 28px; font-size: clamp(22px, 12cqmin, 76px); font-weight: 700; color: var(--blue); font-variant-numeric: tabular-nums; line-height: 1.05; }
.te-col small { font-size: 11px; font-size: clamp(10px, 3cqmin, 15px); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.te-sep { font-size: 24px; font-size: clamp(20px, 10cqmin, 64px); font-weight: 700; color: var(--blue); padding-bottom: 14px; padding-bottom: clamp(14px, 4cqmin, 26px); }
.te-ok { width: 40px; width: clamp(40px, 12cqmin, 64px); height: 40px; height: clamp(40px, 12cqmin, 64px); border-radius: 50%; border: 0; background: var(--blue); color: #fff; display: grid; place-items: center; padding: 0; margin-left: 4px; margin-left: clamp(2px, 1.5cqmin, 10px); }
/* Timer piccolo: niente tempi rapidi e pulsanti più compatti, così tutto resta dentro il widget. */
@container (max-height: 270px) { .w-body .presets { display: none; } }
@container (max-width: 250px) { .w-body .presets { display: none; } }
.te-col button, .te-ok { flex: none; }
@container (max-height: 300px) {
  .te-col button { width: 34px; height: 26px; }
  .te-v { font-size: 22px; }
  .te-ok { width: 34px; height: 34px; }
  .te-col small { display: none; }
  .te-sep { padding-bottom: 0; font-size: 20px; }
}
.seg.seg-row { flex-direction: row; flex-wrap: wrap; gap: 6px; }
.seg.seg-row label { padding: 7px 10px; font-size: 13px; align-items: center; }
.seg.seg-row input { margin-top: 0; }

/* ---------- Strumenti per presentare ---------- */
.curtain { position: fixed; left: 0; right: 0; top: 0; z-index: 35; background: repeating-linear-gradient(90deg, #1b3d55 0 46px, #204660 46px 92px); box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.curtain-handle { position: absolute; left: 50%; bottom: -26px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; background: var(--coral); color: #fff; font-weight: 600; font-size: 15px; padding: 10px 12px 10px 20px; border-radius: 26px; box-shadow: 0 6px 18px rgba(0,0,0,.3); cursor: ns-resize; touch-action: none; user-select: none; }
.curtain-handle svg { width: 22px; height: 22px; }
.curtain-x { width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(255,255,255,.25); color: #fff; display: grid; place-items: center; }
.spot { position: fixed; inset: 0; z-index: 35; pointer-events: none; }
.spot-dark { position: absolute; inset: 0; background: rgba(8,18,28,.9); }
.spot-ring { position: absolute; overflow: visible; }
.spot-ring circle { fill: none; stroke: rgba(255,255,255,.35); stroke-width: 22; pointer-events: stroke; cursor: move; touch-action: none; }
.spot-ring circle:hover { stroke: rgba(243,106,85,.6); }
.spot-bar { position: absolute; left: 50%; top: 84px; transform: translateX(-50%); display: flex; gap: 8px; pointer-events: auto; }
.spot-bar button, .reader-handle button { width: 48px; height: 48px; border-radius: 50%; border: 0; background: #fff; color: var(--blue); display: grid; place-items: center; box-shadow: 0 4px 14px rgba(0,0,0,.3); }
.reader { position: fixed; inset: 0; z-index: 36; pointer-events: none; }
.reader-top, .reader-bottom { position: absolute; left: 0; right: 0; background: rgba(8,18,28,.55); }
.reader-top { top: 0; } .reader-bottom { bottom: 0; }
.reader-band { position: absolute; left: 0; right: 0; border-top: 3px solid var(--coral); border-bottom: 3px solid var(--coral); }
.reader-handle { position: absolute; right: 12px; display: flex; align-items: center; gap: 6px; background: rgba(255,255,255,.95); border-radius: 30px; padding: 6px 6px 6px 12px; box-shadow: 0 4px 14px rgba(0,0,0,.25); pointer-events: auto; cursor: ns-resize; touch-action: none; color: var(--blue); }

/* Sipario rosso per il silenzio: due teli che si chiudono, una mantovana in alto e (con «shhh») il 🤫 al centro. */
.pager-quiet.emoji-btn { font-size: 23px; line-height: 1; }
#btn-stage { color: #b3161b; }
.stage-curtain { position: fixed; inset: 0; z-index: 95; overflow: hidden; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; }
.sc-panel {
  position: absolute; top: 0; bottom: 0; width: 51%;
  background:
    linear-gradient(180deg, rgba(0,0,0,.5) 0, rgba(0,0,0,0) 24%, rgba(0,0,0,0) 76%, rgba(0,0,0,.55) 100%),
    repeating-linear-gradient(90deg, #4f0610 0, #861019 2.4%, #bb1d29 4.6%, #d9353f 5.4%, #a3151f 7.4%, #4f0610 9.8%);
  transition: transform .95s cubic-bezier(.2,.85,.25,1) .08s;
}
.sc-l { left: 0; transform: translateX(-103%); box-shadow: inset -40px 0 50px -30px rgba(0,0,0,.7); transform-origin: top left; }
.sc-r { right: 0; transform: translateX(103%); box-shadow: inset 40px 0 50px -30px rgba(0,0,0,.7); transform-origin: top right; }
.stage-curtain.closed .sc-panel { transform: none; }
.stage-curtain.closed .sc-l { animation: sc-sway-l 1.6s ease-out 1s; }
.stage-curtain.closed .sc-r { animation: sc-sway-r 1.6s ease-out 1s; }
@keyframes sc-sway-l { 35% { transform: skewX(.8deg); } 70% { transform: skewX(-.4deg); } }
@keyframes sc-sway-r { 35% { transform: skewX(-.8deg); } 70% { transform: skewX(.4deg); } }
.sc-valance {
  position: absolute; left: -1%; right: -1%; top: 0; height: max(70px, 12vh); transform: translateY(-110%);
  background: linear-gradient(180deg, rgba(0,0,0,.4), rgba(0,0,0,0) 55%), repeating-linear-gradient(90deg, #6d0a14 0 2vw, #b81b28 2vw 4vw, #6d0a14 4vw 6vw);
  -webkit-mask: radial-gradient(3vw 2.6vw at 50% 0, #000 98%, transparent 100%) bottom / 6vw 2.6vw repeat-x, linear-gradient(#000, #000) top / 100% calc(100% - 2.55vw) no-repeat;
  mask: radial-gradient(3vw 2.6vw at 50% 0, #000 98%, transparent 100%) bottom / 6vw 2.6vw repeat-x, linear-gradient(#000, #000) top / 100% calc(100% - 2.55vw) no-repeat;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,.45));
  transition: transform .55s cubic-bezier(.2,.85,.25,1);
}
.sc-valance::after { content: ''; position: absolute; left: 0; right: 0; bottom: calc(2.6vw + 2px); height: max(6px, .7vh); background: linear-gradient(180deg, #f0cd5a, #c99f22 55%, #8a6a10); }
.stage-curtain.closed .sc-valance { transform: none; }
.sc-shh {
  position: absolute; left: 50%; top: 53%; width: min(44vh, 46vw); aspect-ratio: 1; border: 0; border-radius: 50%;
  display: grid; place-items: center; align-content: center; gap: 1vh; background: #fffaf2; cursor: pointer;
  box-shadow: 0 0 0 min(1.3vh, 1.4vw) #c99f22, 0 30px 80px rgba(0,0,0,.55);
  transform: translate(-50%, -50%) scale(.3); opacity: 0;
  transition: transform .55s cubic-bezier(.3,1.5,.5,1) .8s, opacity .25s .8s;
}
.sc-shh span { font-size: min(21vh, 23vw); line-height: 1; }
.sc-shh b { font: 700 min(6.5vh, 7vw) var(--serif); color: #8f111b; letter-spacing: .02em; }
.sc-shh.again span { animation: sc-wiggle .7s ease-in-out; }
@keyframes sc-wiggle { 20% { transform: rotate(-9deg) scale(1.08); } 45% { transform: rotate(7deg) scale(1.08); } 70% { transform: rotate(-4deg); } }
.stage-curtain.closed .sc-shh { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.sc-hint { position: absolute; left: 0; right: 0; bottom: 4vh; margin: 0; text-align: center; color: rgba(255,255,255,.8); font: 500 clamp(14px, 2.3vh, 22px) var(--sans); text-shadow: 0 2px 6px rgba(0,0,0,.5); opacity: 0; transition: opacity .4s 1.3s; pointer-events: none; }
.stage-curtain.closed .sc-hint { opacity: 1; }
/* Apertura: i teli tornano ai lati, la mantovana sale per ultima. */
.stage-curtain.opening { pointer-events: none; }
.stage-curtain.opening .sc-panel { transition: transform .9s cubic-bezier(.55,0,.35,1); }
.stage-curtain.opening .sc-valance { transition: transform .45s ease-in .55s; }
.stage-curtain.opening .sc-shh, .stage-curtain.opening .sc-hint { transition: transform .3s ease-in, opacity .25s; }
@media (prefers-reduced-motion: reduce) {
  .sc-panel, .sc-valance, .stage-curtain.opening .sc-panel { transition-duration: .2s; transition-delay: 0s; }
  .stage-curtain.closed .sc-panel { animation: none; }
}
@media (max-width: 600px) { .pager-quiet { display: none; } }
.reader-handle button { width: 40px; height: 40px; box-shadow: none; background: var(--bg); }
.rec-badge { position: fixed; top: 76px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 30px; padding: 6px 6px 6px 16px; box-shadow: var(--shadow); color: var(--blue); }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: #e8321e; animation: recblink 1s infinite; }
.rec-badge.paused .rec-dot { animation: none; background: #999; }
@keyframes recblink { 50% { opacity: .2; } }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 48px; }
.rec-badge button { height: 40px; min-width: 40px; border-radius: 20px; border: 0; background: var(--bg); color: var(--blue); display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 12px; font-weight: 600; }
.rec-badge .rec-stop { background: #e8321e; color: #fff; }
body.rec-on #toast { top: 140px; } /* i messaggi non coprono la barra REC */
/* «Scorri per cancellare tutto» nelle opzioni della gomma */
.swipe { position: relative; height: 52px; border-radius: 26px; background: #fde6e2; overflow: hidden; user-select: none; -webkit-user-select: none; }
.swipe-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 52px; border-radius: 26px; background: rgba(243,106,85,.35); }
.swipe-text { position: absolute; inset: 0; display: grid; place-items: center; padding-left: 40px; font-weight: 600; font-size: 14px; color: #b9412f; pointer-events: none; }
.swipe-knob { position: absolute; left: 4px; top: 4px; width: 44px; height: 44px; border-radius: 50%; background: var(--coral); color: #fff; display: grid; place-items: center; box-shadow: 0 3px 8px rgba(0,0,0,.2); cursor: grab; touch-action: none; }
.swipe-knob svg { width: 22px; height: 22px; }
.swipe.done .swipe-fill { background: var(--coral); }
.swipe.off { background: var(--bg); }
.swipe.off .swipe-knob { background: #c9cfd3; cursor: default; box-shadow: none; }
.swipe.off .swipe-text { color: var(--muted); }
/* Pulsante della registrazione nella barra in alto: pallino rosso; durante la registrazione quadrato che lampeggia. */
.rec-ico { width: 16px; height: 16px; border-radius: 50%; background: #e8321e; box-shadow: 0 0 0 2.5px #fff, 0 0 0 4.5px #e8321e; transition: border-radius .2s; }
.rec-btn:hover .rec-ico { background: #c4200f; }
.rec-btn.on { background: #fde6e2; }
.rec-btn.on .rec-ico { border-radius: 3px; animation: recblink 1s infinite; }
/* Livello del microfono come su Meet: tre puntini bianchi su un cerchio blu che diventano righine. */
.rec-badge .rec-mic { padding: 0 8px 0 6px; gap: 4px; }
.rec-mic svg { width: 18px; height: 18px; }
.rec-meter { width: 28px; height: 28px; border-radius: 50%; background: var(--blue); display: inline-flex; align-items: center; justify-content: center; gap: 2.5px; transition: background .2s; }
.rec-meter i { width: 4px; height: 4px; border-radius: 2px; background: #fff; }
.rec-meter.off { background: #9aa3a9; }
.rec-done video { width: 100%; max-height: 50vh; border-radius: 10px; background: #000; }
.rec-done p { margin: 8px 0 0; color: var(--muted); font-size: 14px; }

/* ---------- Dettatura ---------- */
.dict-chip { position: fixed; bottom: 112px; left: 50%; transform: translateX(-50%); z-index: 70; display: flex; align-items: center; gap: 10px; max-width: min(760px, 90vw); background: #fff; border-radius: 30px; padding: 6px 6px 6px 16px; box-shadow: var(--shadow); color: var(--blue); }
.dict-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--coral); animation: recblink 1s infinite; }
.dict-live { color: var(--muted); font-style: italic; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.dict-chip button { flex: none; height: 40px; border-radius: 20px; border: 0; background: var(--coral); color: #fff; display: inline-flex; align-items: center; gap: 6px; padding: 0 14px; font-weight: 600; }
.dict-chip button svg { width: 16px; height: 16px; }
#btn-dict.active { background: var(--coral); color: #fff; }

/* ---------- Modelli ---------- */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.tpl { border: 1.5px solid var(--line); border-radius: 12px; background: #fff; padding: 8px; display: flex; flex-direction: column; gap: 8px; text-align: left; font: 600 14px var(--sans); color: var(--blue); }
.tpl:hover { border-color: var(--coral); box-shadow: 0 6px 18px rgba(22,51,74,.12); }
.tpl-thumb canvas { width: 100%; height: auto; border-radius: 6px; border: 1px solid var(--line); display: block; }

/* ---------- Leggibilità e accessibilità ---------- */
.a11y .sec-label { margin: 14px 0 6px; }
.a11y .sec-label:first-child { margin-top: 0; }
.a11y .check { margin-top: 6px; font-size: 15px; }
.a11y .ui-size-label { margin: 0; font-size: 14px; }
.a11y .ui-size-note { margin: 6px 0 4px; font-size: 12.5px; color: var(--muted); }
body.big-ui #tools, body.big-ui #topbar, body.big-ui #dock, body.big-ui #pager { zoom: 1.22; }
body.hc { --text: #000; --muted: #222; --line: #000; --blue: #0b2233; }
body.hc .ui { background: #fff; box-shadow: none; border: 2px solid #000; }
body.hc .tool, body.hc .icon-btn, body.hc .dock-item { color: #000; }
body.hc .tool.active, body.hc .tool[aria-pressed="true"] { background: #000; color: #fff; }
body.hc .dock-item span:last-child { color: #000; font-weight: 700; }
body.hc .widget { border: 2px solid #000; box-shadow: none; }
body.hc .w-title { color: #000; }
body.hc .popover, body.hc .modal { border: 2px solid #000; }
body.hc .menu-item { color: #000; }

/* ---------- Geometria ---------- */
#geo { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 3; }
.geo-body { fill: rgba(232, 238, 243, .72); stroke: #204660; stroke-width: 2.5; pointer-events: visiblePainted; cursor: move; touch-action: none; }
.geo-ticks { stroke: #16334a; stroke-width: 1.6; fill: none; pointer-events: none; }
.geo-num { font: 600 20px 'Work Sans', sans-serif; fill: #16334a; text-anchor: middle; pointer-events: none; user-select: none; }
.geo-num.small { font-size: 17px; } .geo-num.tiny { font-size: 13px; fill: #737665; }
.geo-angle { font: 700 22px 'Work Sans', sans-serif; fill: #f36a55; text-anchor: middle; pointer-events: none; user-select: none; }
.geo-angle.big { font-size: 34px; }
.geo-knob circle, .geo-pencil circle { fill: #fff; stroke: #204660; stroke-width: 3; pointer-events: all; cursor: grab; touch-action: none; }
.geo-knob:hover circle, .geo-pencil:hover circle { fill: #e8eef3; }
.geo-close circle { stroke: #f36a55; }
.geo-ico { fill: none; stroke: #204660; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.geo-close .geo-ico { stroke: #f36a55; }
.geo-needle { stroke: #f36a55; stroke-width: 3; pointer-events: none; }
.geo-arc { fill: none; stroke: #f36a55; stroke-width: 3; pointer-events: none; }
.geo-knob-tip { fill: #f36a55; stroke: #fff; stroke-width: 4; pointer-events: all; cursor: grab; touch-action: none; }
.geo-legs { fill: none; stroke: #204660; stroke-width: 12; stroke-linecap: round; stroke-linejoin: round; opacity: .85; pointer-events: none; }
.geo-hinge { fill: #c99f22; stroke: #fff; stroke-width: 3; pointer-events: none; }
.geo-pin { fill: #204660; stroke: #fff; stroke-width: 4; pointer-events: all; cursor: move; touch-action: none; }
.geo-pencil circle { fill: #f36a55; stroke: #fff; }
.geo-pencil .geo-ico { stroke: #fff; }
.geo-list { display: grid; gap: 6px; }
.geo-opt { display: flex; align-items: center; gap: 10px; border: 1.5px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 12px; font: 600 15px var(--sans); color: var(--blue); }
.geo-opt.on { border-color: var(--blue); background: var(--blue-soft); }
.geo-opt .geo-state { margin-left: auto; opacity: .6; }

/* ---------- Widget musicali ---------- */
.piano { position: relative; flex: 1; margin: 6px 8px 8px; touch-action: none; user-select: none; }
.pk { position: absolute; top: 0; border: 0; padding: 0; touch-action: none; }
.pk.w { height: 100%; background: linear-gradient(#fff, #f3f3f3); border: 1px solid #c9ced3; border-radius: 0 0 8px 8px; z-index: 1; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 8px; }
.pk.w span { font: 600 clamp(10px, 3.2cqmin, 16px) var(--sans); color: var(--muted); pointer-events: none; }
.pk.w sub { font-size: .7em; }
.pk.b { height: 60%; background: linear-gradient(#3a3f45, #16181b); border-radius: 0 0 6px 6px; z-index: 2; box-shadow: 0 3px 4px rgba(0,0,0,.35); }
.pk.w.on { background: linear-gradient(#ffe1dc, #f9b6aa); }
.pk.b.on { background: linear-gradient(#f36a55, #c2402c); }
.metro { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 8px 12px; }
.metro-dots { display: flex; gap: 10px; }
.metro-dots span { width: 22px; height: 22px; border-radius: 50%; background: var(--bg); border: 2px solid var(--line); transition: background .05s; }
.metro-dots span.first { border-color: var(--coral); }
.metro-dots span.on { background: var(--blue); border-color: var(--blue); }
.metro-dots span.first.on { background: var(--coral); border-color: var(--coral); }
.metro-bpm { display: flex; align-items: center; gap: 14px; }
.metro-bpm div { display: grid; text-align: center; line-height: 1; }
.metro-bpm b { font-size: 44px; font-size: clamp(30px, 16cqmin, 80px); color: var(--blue); font-variant-numeric: tabular-nums; }
.metro-bpm small { font-size: 11px; letter-spacing: .12em; color: var(--muted); font-weight: 600; }
.metro input { width: 90%; accent-color: var(--coral); }
.tuner { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 8px 14px; }
.tuner-note { font: 700 54px var(--serif); font-size: clamp(36px, 20cqmin, 110px); color: var(--blue); line-height: 1; }
.tuner-note sub { font-size: .4em; }
.tuner.ok .tuner-note { color: #2e9d5b; }
.tuner-hz { font-size: 13px; color: var(--muted); text-align: center; }
.tuner-scale { position: relative; width: 90%; height: 34px; border-radius: 10px; background: linear-gradient(90deg, #fde6e2, #e9f6ee 45%, #e9f6ee 55%, #fde6e2); display: flex; justify-content: space-between; align-items: flex-end; padding: 0 6px 2px; font-size: 11px; color: var(--muted); }
.tuner-mid { position: absolute; left: 50%; top: 4px; bottom: 4px; width: 2px; background: #2e9d5b; }
.tuner-needle { position: absolute; left: 50%; top: -4px; bottom: -4px; width: 4px; margin-left: -2px; border-radius: 2px; background: var(--coral); transition: left .12s; }
.tuner.ok .tuner-needle { background: #2e9d5b; }
.tuner-cents { font-size: 14px; font-weight: 600; color: var(--blue); min-height: 1.2em; }

/* ---------- Lingua ---------- */
.login-card { position: relative; }
.lang-switch { position: absolute; top: 14px; right: 14px; display: flex; background: var(--bg); border-radius: 20px; padding: 3px; }
.lang-switch button { border: 0; background: none; font: 700 12px var(--sans); color: var(--muted); padding: 6px 10px; border-radius: 16px; letter-spacing: .06em; }
.lang-switch button.on { background: var(--blue); color: #fff; }
