/* ------------------------------------------------------------------
   Dashboard styles, v2
   Five board themes, three canvas patterns, resting tilt,
   accent header bands, and a display face for the big moments.
------------------------------------------------------------------- */

:root {
  /* eight vibrant accents, referenced by name in widget state */
  --accent-coral: #f2604c;
  --accent-tangerine: #f0862e;
  --accent-sunflower: #eeb414;
  --accent-emerald: #23a866;
  --accent-teal: #14a3a0;
  --accent-azure: #3a86f0;
  --accent-violet: #7a5af5;
  --accent-magenta: #e04e92;

  --danger: #d64f52;
  --radius: 18px;
  --radius-sm: 11px;

  --shadow-rest: 0 1px 2px rgba(20, 15, 5, 0.04), 0 5px 16px rgba(20, 15, 5, 0.06);
  --shadow-lift: 0 4px 10px rgba(20, 15, 5, 0.09), 0 20px 44px rgba(20, 15, 5, 0.16);

  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  --font: ui-rounded, "SF Pro Rounded", -apple-system, system-ui, "Segoe UI", sans-serif;
  --display: ui-rounded, "SF Pro Rounded", -apple-system, system-ui, "Segoe UI", sans-serif;
}

/* --------------------------- themes ------------------------------ */

body, body[data-theme="paper"] {
  --bg: #f7f3ec;
  --surface: #fffdf8;
  --surface-2: #efe9dc;
  --border: #e4dcca;
  --line: #ddd2bd;
  --t1: #2b2620;
  --t2: #6f6759;
  --t3: #a89f8d;
  --glass: rgba(255, 253, 248, 0.74);
  --glass-border: rgba(255, 255, 255, 0.65);
  --on-ink: #fffdf8;
}

body[data-theme="mist"] {
  --bg: #edf0f5;
  --surface: #ffffff;
  --surface-2: #e5eaf1;
  --border: #d9e0ea;
  --line: #cfd8e5;
  --t1: #21252c;
  --t2: #5f6875;
  --t3: #97a1b0;
  --glass: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.65);
  --on-ink: #ffffff;
}

body[data-theme="meadow"] {
  --bg: #ecf3ea;
  --surface: #fbfef9;
  --surface-2: #e1ecdd;
  --border: #d5e3d0;
  --line: #c9ddc2;
  --t1: #232a20;
  --t2: #60705a;
  --t3: #94a58d;
  --glass: rgba(251, 254, 249, 0.74);
  --glass-border: rgba(255, 255, 255, 0.65);
  --on-ink: #fbfef9;
}

body[data-theme="berry"] {
  --bg: #f5eef3;
  --surface: #fffbfe;
  --surface-2: #ede0e9;
  --border: #e3d2dd;
  --line: #dcc7d5;
  --t1: #2c2329;
  --t2: #71606b;
  --t3: #a893a1;
  --glass: rgba(255, 251, 254, 0.74);
  --glass-border: rgba(255, 255, 255, 0.65);
  --on-ink: #fffbfe;
}

body[data-theme="chalk"] {
  --bg: #1e2023;
  --surface: #292c30;
  --surface-2: #34383d;
  --border: #3e434a;
  --line: #383d44;
  --t1: #f2f3f4;
  --t2: #b6bbc1;
  --t3: #7f858d;
  --glass: rgba(41, 44, 48, 0.74);
  --glass-border: rgba(255, 255, 255, 0.09);
  --on-ink: #1e2023;
  --shadow-rest: 0 1px 2px rgba(0, 0, 0, 0.25), 0 6px 18px rgba(0, 0, 0, 0.3);
  --shadow-lift: 0 6px 14px rgba(0, 0, 0, 0.35), 0 24px 50px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overscroll-behavior: none;
}

body {
  font-family: var(--font);
  color: var(--t1);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  touch-action: none;
  transition: background 0.4s ease;
}

/* --------------------------- canvas ------------------------------ */

#canvas {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

body[data-pattern="dots"] #canvas {
  background-image: radial-gradient(var(--line) 1.2px, transparent 1.2px);
  background-size: 26px 26px;
  background-position: 13px 13px;
}

body[data-pattern="grid"] #canvas {
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 36px 36px;
}

body[data-pattern="lines"] #canvas {
  background-image: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 35px,
    var(--line) 35px,
    var(--line) 36px
  );
}

/* ------------------------- empty state ---------------------------- */

.empty-hint {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--t3);
  pointer-events: none;
  transition: opacity 0.3s ease;

  p { margin: 0; font-size: 17px; font-weight: 500; }
  .empty-sub { margin-top: 6px; font-size: 14px; }
  .empty-plus {
    display: inline-grid;
    place-content: center;
    width: 22px; height: 22px;
    border: 1.5px solid var(--t3);
    border-radius: 7px;
    font-weight: 600;
  }
}

body.has-widgets .empty-hint { opacity: 0; }

/* ----------------------------- FAB ------------------------------- */

.fab {
  position: fixed;
  right: max(22px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
  width: 58px;
  height: 58px;
  border: none;
  border-radius: 19px;
  background: var(--t1);
  color: var(--on-ink);
  display: grid;
  place-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-rest);
  transition: transform 0.45s var(--spring), box-shadow 0.25s ease, opacity 0.25s ease;
  z-index: 900;
}

.fab:hover { transform: scale(1.06) rotate(-4deg); box-shadow: var(--shadow-lift); }
.fab:active { transform: scale(0.95); }
.fab svg { transition: transform 0.45s var(--spring); }
.fab[aria-expanded="true"] svg { transform: rotate(45deg); }

/* ------------------------ drawer + scrim -------------------------- */

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.12);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 940;
}

.scrim.open { opacity: 1; }

.drawer {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: 14px;
  bottom: max(14px, env(safe-area-inset-bottom));
  width: min(432px, calc(100vw - 28px));
  background: var(--glass);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  backdrop-filter: blur(24px) saturate(1.5);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  box-shadow: var(--shadow-lift);
  display: flex;
  flex-direction: column;
  transform: translateX(calc(100% + 28px));
  transition: transform 0.55s var(--spring);
  z-index: 950;
}

.drawer.open { transform: translateX(0); }

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 8px;

  h2 {
    margin: 0;
    font-family: var(--display);
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.3px;
  }
}

.icon-btn {
  border: none;
  background: transparent;
  color: var(--t2);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-content: center;
  cursor: pointer;
  transition: background 0.2s ease;
}

.icon-btn:hover { background: rgba(128, 128, 128, 0.14); }

.drawer-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 2px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cat { display: flex; flex-direction: column; gap: 8px; }

.cat-label {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--t3);
  padding-left: 2px;
}

.tile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.widget-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  min-height: 92px;
  border: 1px solid var(--border);
  border-radius: 17px;
  background: var(--surface);
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.3s var(--spring), border-color 0.15s ease, box-shadow 0.15s ease;
}

.widget-tile:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--ta) 55%, var(--border));
  box-shadow: 0 3px 10px color-mix(in srgb, var(--ta) 18%, transparent);
}

.widget-tile:active { transform: scale(0.96); }

.widget-tile .wt-icon {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-content: center;
  background: color-mix(in srgb, var(--ta) 16%, var(--surface));
  color: color-mix(in srgb, var(--ta) 72%, var(--t1));
  flex: none;
}

.widget-tile .wt-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--t1);
  text-align: left;
  line-height: 1.2;
}

/* board style panel */
.drawer-style {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 18px;
  border-top: 1px solid var(--glass-border);
}

.style-block { display: flex; flex-direction: column; gap: 7px; }

.style-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--t3);
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.theme-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 58px;
  padding: 8px 4px;
  border: 2px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.3s var(--spring), border-color 0.2s ease, box-shadow 0.2s ease;
}

.theme-card:hover { transform: translateY(-1px); }
.theme-card.active {
  border-color: var(--t1);
  box-shadow: 0 0 0 1px var(--t1);
}

.theme-card .tc-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(128, 128, 128, 0.35);
}

.theme-card .tc-name {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.style-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.foot-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--t2);
  cursor: pointer;
  input { accent-color: var(--t1); }
}

.drawer-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--glass-border);
}

.present-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  background: var(--t1);
  color: var(--on-ink);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 11px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.3s var(--spring);
}

.present-btn:hover { opacity: 0.85; }
.present-btn:active { transform: scale(0.97); }

.foot-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--t1);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.3s var(--spring);
}

.foot-btn:hover { background: var(--surface-2); }
.foot-btn:active { transform: scale(0.96); }
.foot-btn:first-child { margin-left: 0; }
.foot-danger { color: var(--danger); margin-left: auto; }

/* ------------------------- widget chrome -------------------------- */

.widget {
  position: absolute;
  min-width: 180px;
  min-height: 120px;
  perspective: 1400px;
  z-index: 10;
  transition: transform 0.2s var(--ease-out), rotate 0.45s var(--spring);
}

body.tilt .widget { rotate: var(--tilt, 0deg); }
body.tilt .widget.grabbed,
body.tilt .widget.dragging,
body.tilt .widget.flipped { rotate: 0deg; }

.widget.dragging { transition: rotate 0.45s var(--spring); }

.widget.snapping {
  transition:
    left 0.4s var(--spring),
    top 0.4s var(--spring),
    width 0.4s var(--spring),
    height 0.4s var(--spring),
    rotate 0.45s var(--spring);
}

.widget-inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.6s var(--spring);
}

.widget.flipped .widget-inner { transform: rotateY(180deg); }

.widget-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-rest);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.widget-back { transform: rotateY(180deg); }

.widget.grabbed { transform: scale(1.02); }
.widget.grabbed .widget-face { box-shadow: var(--shadow-lift); }

.widget-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: color-mix(in srgb, var(--wa, var(--surface-2)) 30%, var(--surface));
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.widget.dragging .widget-head { cursor: grabbing; }

.widget-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--t1) 78%, var(--wa, var(--t2)));
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.widget-gear, .widget-close {
  border: none;
  background: transparent;
  color: color-mix(in srgb, var(--t1) 62%, var(--wa, var(--t2)));
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: grid;
  place-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, background 0.15s ease, transform 0.3s var(--spring);
}

.widget:hover .widget-gear,
.widget:hover .widget-close,
.widget.flipped .widget-gear { opacity: 1; }

.widget-gear:hover, .widget-close:hover {
  background: rgba(0, 0, 0, 0.08);
  color: var(--t1);
}
.widget-gear:hover { transform: rotate(30deg); }
.widget-close:hover { color: var(--danger); }

.widget-body {
  flex: 1;
  padding: 10px 14px 14px;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.widget-back .widget-body { gap: 12px; overflow-y: auto; }

.set-group { display: flex; flex-direction: column; gap: 6px; }

.set-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--t3);
}

.swatches { display: flex; gap: 7px; flex-wrap: wrap; }

.swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform 0.3s var(--spring);
}

.swatch:hover { transform: scale(1.15); }
.swatch.active { border-color: var(--t1); }

/* -------------------------- shared controls ----------------------- */

.w-input, .w-textarea, .w-select {
  font-family: inherit;
  font-size: 14px;
  color: var(--t1);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  width: 100%;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.w-input:focus, .w-textarea:focus, .w-select:focus {
  border-color: var(--t2);
  background: var(--surface);
}

.w-textarea { resize: none; min-height: 64px; }

.w-btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--on-ink);
  background: var(--t1);
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  cursor: pointer;
  transition: transform 0.3s var(--spring), opacity 0.15s ease;
}

.w-btn:hover { opacity: 0.85; }
.w-btn:active { transform: scale(0.96); }
.w-btn.secondary { background: var(--surface-2); color: var(--t1); }
.w-btn:disabled { opacity: 0.4; cursor: default; }

.seg {
  display: inline-flex;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

.seg button {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--t2);
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.seg button.active {
  background: var(--surface);
  color: var(--t1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.w-range { width: 100%; accent-color: var(--t1); }

/* resize handle */
.widget-resize {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 18px;
  height: 18px;
  cursor: nwse-resize;
  color: var(--t3);
  opacity: 0;
  transition: opacity 0.2s ease;
  display: grid;
  place-content: center;
  z-index: 5;
}

.widget:hover .widget-resize { opacity: 1; }

/* ------------------------ presentation mode ----------------------- */

body.presenting .fab,
body.presenting .widget-gear,
body.presenting .widget-close,
body.presenting .widget-resize {
  opacity: 0 !important;
  pointer-events: none;
}

body.presenting .widget-head { cursor: default; }

.present-hint {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--t1);
  color: var(--on-ink);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 999px;
  z-index: 990;
  animation: hint-fade 3s ease forwards;
}

@keyframes hint-fade {
  0% { opacity: 0; transform: translateX(-50%) translateY(8px); }
  12% { opacity: 1; transform: translateX(-50%) translateY(0); }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

/* --------------------------- confetti ----------------------------- */

.confetti-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.confetti {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  animation: conf-toss 0.95s var(--ease-out) forwards;
}

@keyframes conf-toss {
  0% { transform: translate(0, 0) rotate(0deg) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(0.7); opacity: 0; }
}

/* ---------------------------------------------------------------
   Widgets 1 to 3
--------------------------------------------------------------- */

/* 1. Clock and countdown */
.clock-widget .widget-body { container-type: size; }

.clock-time {
  flex: 1;
  display: grid;
  place-content: center;
  font-family: var(--display);
  font-size: clamp(34px, 20cqi, 96px);
  font-weight: 600;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.clock-meta {
  text-align: center;
  font-size: 12px;
  color: var(--t3);
  font-weight: 500;
}

.countdown-controls {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding-top: 8px;
}

@keyframes pulse-red {
  0%, 100% { box-shadow: var(--shadow-rest); }
  50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--danger) 24%, transparent); }
}

.widget.count-critical .widget-front {
  border-color: var(--danger);
  animation: pulse-red 1s ease-in-out infinite;
}

.widget.count-critical .clock-time { color: var(--danger); }

/* 2. QR code */
.qr-box {
  flex: 1;
  display: grid;
  place-content: center;
  padding: 4px;
}

.qr-box img, .qr-box canvas {
  border-radius: 8px;
  max-width: 100%;
  max-height: 100%;
  background: #fff;
  padding: 6px;
}

.qr-caption {
  text-align: center;
  font-size: 12px;
  color: var(--t3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-top: 6px;
}

/* 3. Quick poll */
.poll-setup { display: flex; flex-direction: column; gap: 8px; }

.poll-live { flex: 1; display: flex; flex-direction: column; gap: 10px; min-height: 0; }

.poll-q {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.poll-link {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--t2);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 7px 10px;

  code { font-family: ui-monospace, SFMono-Regular, monospace; font-weight: 600; color: var(--t1); }
  button { margin-left: auto; }
}

.poll-bars { flex: 1; display: flex; flex-direction: column; gap: 9px; overflow-y: auto; }

.poll-row { display: flex; flex-direction: column; gap: 3px; }

.poll-row .pr-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 500;
  span:last-child { color: var(--t3); font-variant-numeric: tabular-nums; }
}

.poll-row .pr-track {
  height: 10px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}

.poll-row .pr-fill {
  height: 100%;
  width: 0%;
  background: var(--wa, var(--t1));
  border-radius: 999px;
  transition: width 0.7s var(--ease-out);
}

.poll-total { font-size: 12px; color: var(--t3); }

.poll-error { font-size: 13px; color: var(--danger); }

/* ---------------------------------------------------------------
   Widgets 4 to 10
--------------------------------------------------------------- */

/* 4. Random picker */
.picker-widget .widget-body { container-type: size; }

.picker-stage {
  position: relative;
  flex: 1;
  display: grid;
  place-content: center;
  text-align: center;
  min-height: 0;
}

.picker-name {
  font-family: var(--display);
  font-size: clamp(22px, 14cqi, 52px);
  font-weight: 600;
  letter-spacing: -0.5px;
  transition: filter 0.15s ease;
}

.picker-name.spinning { filter: blur(1.5px); opacity: 0.75; }
.picker-name.winner { animation: winner-pop 0.6s var(--spring); }

@keyframes winner-pop {
  0% { transform: scale(0.7); }
  60% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

.picker-controls { display: flex; justify-content: center; padding-top: 6px; }

/* 5. Lesson hook */
.hook-form { display: flex; gap: 8px; }
.hook-form input { flex: 1; }

.hook-out {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 10px;
  min-height: 0;
}

.hook-text {
  margin: 0;
  flex: 1;
  overflow-y: auto;
  font-size: 15px;
  line-height: 1.45;
  background: color-mix(in srgb, var(--wa, var(--surface-2)) 12%, var(--surface));
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.hook-loading { color: var(--t3); animation: hook-pulse 1.2s ease-in-out infinite; }

@keyframes hook-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.hook-actions { display: flex; gap: 8px; }

/* 6. Whiteboard */
.board-tools { display: flex; gap: 6px; padding-bottom: 8px; }

.board-tool {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--t2);
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-content: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.board-tool:hover { background: var(--surface-2); }
.board-tool.active { background: var(--t1); color: var(--on-ink); border-color: var(--t1); }
.board-clear { margin-left: auto; }
.board-clear:hover { color: var(--danger); }

.board-wrap {
  flex: 1;
  min-height: 0;
  border-radius: var(--radius-sm);
  background:
    color-mix(in srgb, var(--wa, var(--surface-2)) 8%, var(--surface))
    radial-gradient(var(--line) 1px, transparent 1px);
  background-size: 18px 18px;
  overflow: hidden;
}

.board-canvas { display: block; touch-action: none; cursor: crosshair; }

body[data-theme="chalk"] .board-canvas { filter: invert(1) hue-rotate(180deg); }

/* 7. Agenda */
.task-add { display: flex; gap: 8px; }
.task-add input { flex: 1; }
.task-add .w-btn { width: 40px; padding: 0; font-size: 18px; }

.task-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.35s ease;
}

.task-item:hover { background: var(--surface-2); }

.task-text { flex: 1; position: relative; }

.task-text::after {
  content: "";
  position: absolute;
  left: 0;
  top: 55%;
  height: 1.5px;
  width: 0;
  background: currentColor;
  transition: width 0.35s var(--ease-out);
}

.task-item.completed { opacity: 0.4; }
.task-item.completed .task-text::after { width: 100%; }

.task-del {
  border: none;
  background: transparent;
  color: var(--t3);
  width: 24px;
  height: 24px;
  border-radius: 7px;
  display: grid;
  place-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.task-item:hover .task-del { opacity: 1; }
.task-del:hover { color: var(--danger); }

.task-empty { list-style: none; font-size: 13px; color: var(--t3); padding: 8px 10px; }

/* 8. Focus chime */
.chime-grid { flex: 1; display: flex; flex-direction: column; gap: 8px; }

.chime-btn {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--t1);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.3s var(--spring);

  strong { font-size: 14px; font-weight: 600; }
  span { font-size: 12px; color: var(--t3); margin-left: auto; }
}

.chime-btn:hover { background: color-mix(in srgb, var(--wa, var(--surface-2)) 12%, var(--surface)); }
.chime-btn:active { transform: scale(0.97); }
.chime-btn.ringing { animation: chime-ring 0.5s var(--spring); }

@keyframes chime-ring {
  0% { transform: scale(1); }
  30% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

/* 9. Noise monitor */
.noise-idle {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: center;

  p { margin: 0; font-size: 13px; color: var(--t3); line-height: 1.4; }
}

.noise-live {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}

.noise-track {
  position: relative;
  height: 22px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}

.noise-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: #23a866;
  transition: background 0.4s ease;
}

.noise-fill[data-zone="yellow"] { background: #eeb414; }
.noise-fill[data-zone="red"] { background: var(--danger); }

.noise-mark {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  background: var(--t1);
  opacity: 0.5;
}

.noise-meta {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 500;
  color: var(--t2);
  span:last-child { font-variant-numeric: tabular-nums; color: var(--t3); }
}

/* 10. Sticky note */
.note-widget .widget-front {
  background: color-mix(in srgb, var(--wa, var(--accent-sunflower)) 22%, var(--surface));
}

.note-widget .widget-front .widget-head {
  background: color-mix(in srgb, var(--wa, var(--accent-sunflower)) 34%, var(--surface));
}

.note-pad {
  flex: 1;
  outline: none;
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-y: auto;
  cursor: text;
}

.note-pad:empty::before {
  content: attr(data-placeholder);
  color: color-mix(in srgb, var(--t1) 32%, transparent);
  pointer-events: none;
}

/* ---------------------------------------------------------------
   Widgets 11 to 15
--------------------------------------------------------------- */

/* 11. Dice */
.dice-widget .widget-body { container-type: size; }

.dice-row {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 0;
}

.die {
  width: clamp(58px, 34cqi, 110px);
  aspect-ratio: 1;
  display: grid;
  place-content: center;
  font-family: var(--display);
  font-size: clamp(26px, 16cqi, 52px);
  font-weight: 600;
  background: color-mix(in srgb, var(--wa, var(--surface-2)) 18%, var(--surface));
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-rest);
}

.die.rolling { animation: die-shake 0.12s ease-in-out infinite; }
.die.landed { animation: winner-pop 0.5s var(--spring); }

@keyframes die-shake {
  0%, 100% { transform: rotate(-5deg) translateY(-1px); }
  50% { transform: rotate(5deg) translateY(1px); }
}

.dice-controls { display: flex; justify-content: center; padding-top: 8px; }

/* 12. Scoreboard */
.score-widget .widget-body { container-type: size; }

.score-grid {
  flex: 1;
  display: flex;
  gap: 10px;
  min-height: 0;
}

.score-team {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: color-mix(in srgb, var(--wa, var(--surface-2)) 12%, var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 6px;
  min-width: 0;
}

.score-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--t2);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.score-num {
  font-family: var(--display);
  font-size: clamp(28px, 16cqi, 64px);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.score-num.bumped { animation: winner-pop 0.4s var(--spring); }

.score-btns { display: flex; gap: 6px; }

.score-btns button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--t1);
  width: 30px;
  height: 30px;
  border-radius: 9px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.3s var(--spring);
}

.score-btns button:hover { background: var(--surface-2); }
.score-btns button:active { transform: scale(0.9); }

/* 13. Voice level */
.signal-widget .widget-body { container-type: size; }

.signal-stage {
  flex: 1;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 6px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--sig, var(--surface-2)) 30%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--sig, var(--border)) 55%, var(--border));
  transition: background 0.4s ease, border-color 0.4s ease;
  min-height: 0;
  cursor: pointer;
}

.signal-label {
  font-family: var(--display);
  font-size: clamp(20px, 13cqi, 44px);
  font-weight: 600;
  letter-spacing: -0.5px;
}

.signal-sub { font-size: 12px; color: var(--t2); font-weight: 500; }

.signal-dots {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding-top: 10px;
}

.signal-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  opacity: 0.55;
  transition: transform 0.3s var(--spring), opacity 0.2s ease;
}

.signal-dot:hover { transform: scale(1.15); }
.signal-dot.active { opacity: 1; border-color: var(--t1); }

/* 14. Banner */
.banner-widget .widget-body { container-type: size; }

.banner-text {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  outline: none;
  font-family: var(--display);
  font-size: clamp(24px, 15cqi, 88px);
  font-weight: 600;
  letter-spacing: -1px;
  line-height: 1.1;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-y: auto;
  cursor: text;
  color: color-mix(in srgb, var(--t1) 82%, var(--wa, var(--t1)));
}

.banner-text:empty::before {
  content: attr(data-placeholder);
  color: color-mix(in srgb, var(--t1) 30%, transparent);
  pointer-events: none;
}

/* 15. Group maker */
.groups-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.groups-controls input { width: 58px; }

.groups-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  align-content: start;
  padding-top: 10px;
  min-height: 0;
}

.group-card {
  background: color-mix(in srgb, var(--wa, var(--surface-2)) 12%, var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  animation: group-in 0.45s var(--spring) backwards;
}

.group-card:nth-child(2) { animation-delay: 0.05s; }
.group-card:nth-child(3) { animation-delay: 0.1s; }
.group-card:nth-child(4) { animation-delay: 0.15s; }
.group-card:nth-child(5) { animation-delay: 0.2s; }
.group-card:nth-child(6) { animation-delay: 0.25s; }
.group-card:nth-child(n+7) { animation-delay: 0.3s; }

@keyframes group-in {
  from { opacity: 0; transform: translateY(8px) scale(0.95); }
  to { opacity: 1; transform: none; }
}

.group-card h4 {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--t3);
}

.group-card ul {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.55;
}

.groups-empty { font-size: 13px; color: var(--t3); padding-top: 12px; }

/* --------------------- present exit control ----------------------- */

.present-exit {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  top: max(18px, env(safe-area-inset-top));
  width: 46px;
  height: 46px;
  border: none;
  border-radius: 15px;
  background: color-mix(in srgb, var(--t1) 55%, transparent);
  color: var(--on-ink);
  display: none;
  place-content: center;
  cursor: pointer;
  opacity: 0.35;
  transition: opacity 0.25s ease, transform 0.3s var(--spring);
  z-index: 980;
}

body.presenting .present-exit { display: grid; }
.present-exit:hover, .present-exit:focus-visible { opacity: 1; }
.present-exit:active { transform: scale(0.92); }

/* ---------------------------------------------------------------
   Skeuomorphic layer
   Physical depth: raised buttons, sunken wells, glossy accents.
   Highlights and lows run through --hi and --lo so the Chalk
   theme can dim them. Sizes lean on em and cqi units so every
   detail grows and shrinks with its card.
--------------------------------------------------------------- */

body { --hi: rgba(255, 255, 255, 0.5); --lo: rgba(30, 22, 10, 0.12); }
body[data-theme="chalk"] { --hi: rgba(255, 255, 255, 0.07); --lo: rgba(0, 0, 0, 0.45); }

/* card faces: soft top light, hairline under the header band */
.widget-face {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 88%, white) 0%, var(--surface) 52%);
  box-shadow: var(--shadow-rest), inset 0 1px 0 var(--hi);
}

body[data-theme="chalk"] .widget-face {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 94%, white) 0%, var(--surface) 52%);
}

.widget-head {
  border-bottom: 1px solid color-mix(in srgb, var(--wa, var(--border)) 30%, var(--border));
  box-shadow: inset 0 1px 0 var(--hi);
}

/* raised primary, pressed when pushed */
.w-btn, .present-btn {
  background: linear-gradient(180deg, color-mix(in srgb, var(--t1) 86%, white) 0%, var(--t1) 60%);
  box-shadow: 0 2px 5px var(--lo), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.w-btn:active, .present-btn:active {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 1px 2px var(--lo), inset 0 2px 3px rgba(0, 0, 0, 0.22);
}

.w-btn.secondary {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 90%, white) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px var(--lo), inset 0 1px 0 var(--hi);
}

.w-btn.secondary:active {
  box-shadow: 0 0 1px var(--lo), inset 0 2px 3px var(--lo);
}

/* sunken wells for anything you type into */
.w-input, .w-textarea, .w-select {
  box-shadow: inset 0 1.5px 3px var(--lo);
}

/* segmented controls: recessed track, raised thumb */
.seg { box-shadow: inset 0 1px 3px var(--lo); }

.seg button.active {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 88%, white) 0%, var(--surface) 100%);
  box-shadow: 0 1px 3px var(--lo), inset 0 1px 0 var(--hi);
}

/* glossy color dots: swatches, voice level dots */
.swatch, .signal-dot {
  background-image: radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 45%);
  box-shadow: 0 1px 3px var(--lo), inset 0 -2px 3px rgba(0, 0, 0, 0.18), inset 0 1px 1px rgba(255, 255, 255, 0.45);
}

/* the FAB becomes a physical key */
.fab {
  background: linear-gradient(180deg, color-mix(in srgb, var(--t1) 84%, white) 0%, var(--t1) 65%);
  box-shadow: 0 3px 8px var(--lo), 0 8px 22px var(--lo), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

/* clock and stopwatch: a sunken display window */
.clock-widget .clock-time,
.stopwatch-widget .clock-time {
  margin: 4px 2px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--wa, var(--surface-2)) 10%, var(--surface-2));
  box-shadow: inset 0 2px 6px var(--lo), inset 0 -1px 0 var(--hi);
}

/* picker: a slot machine reel window */
.picker-stage {
  border-radius: 14px;
  background: color-mix(in srgb, var(--wa, var(--surface-2)) 8%, var(--surface-2));
  box-shadow: inset 0 2px 8px var(--lo), inset 0 -1px 0 var(--hi);
  overflow: hidden;
}

.picker-stage::before,
.picker-stage::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 22%;
  pointer-events: none;
  z-index: 1;
}

.picker-stage::before {
  top: 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-2) 85%, var(--t1) 4%), transparent);
}

.picker-stage::after {
  bottom: 0;
  background: linear-gradient(0deg, color-mix(in srgb, var(--surface-2) 85%, var(--t1) 4%), transparent);
}

.confetti {
  width: max(6px, 2.6cqi);
  height: max(6px, 2.6cqi);
  z-index: 2;
}

/* poll: recessed tracks, glass fills that scale with the card */
.poll-widget .widget-body { container-type: size; }

.poll-row .pr-track {
  height: clamp(9px, 4.5cqi, 18px);
  box-shadow: inset 0 1px 3px var(--lo);
}

.poll-row .pr-fill {
  background-color: var(--wa, var(--t1));
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0) 55%);
}

/* whiteboard: marker tray and a framed board */
.board-tools {
  background: var(--surface-2);
  border-radius: 12px;
  padding: 5px 6px;
  box-shadow: inset 0 1px 3px var(--lo);
  margin-bottom: 8px;
}

.board-tool {
  box-shadow: 0 1px 2px var(--lo), inset 0 1px 0 var(--hi);
}

.board-tool.active {
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.28);
}

.board-wrap {
  box-shadow: inset 0 2px 8px var(--lo), inset 0 0 0 1px var(--hi);
}

/* agenda: real check circles that fill in */
.task-check {
  flex: none;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--t3) 65%, var(--border));
  box-shadow: inset 0 1px 2px var(--lo);
  position: relative;
  transition: background 0.25s ease, border-color 0.25s ease;
}

.task-check::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 4px;
  width: 7px;
  height: 4px;
  border-left: 2px solid var(--surface);
  border-bottom: 2px solid var(--surface);
  transform: rotate(-45deg) scale(0);
  transform-origin: center;
  transition: transform 0.3s var(--spring);
}

.task-item.completed .task-check {
  background: var(--wa, var(--t1));
  border-color: var(--wa, var(--t1));
  box-shadow: 0 1px 3px var(--lo), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.task-item.completed .task-check::after { transform: rotate(-45deg) scale(1); }

/* chime: raised keys with a real press */
.chime-btn {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 88%, white) 0%, var(--surface) 100%);
  box-shadow: 0 2px 4px var(--lo), inset 0 1px 0 var(--hi);
}

.chime-btn:active {
  transform: translateY(1px);
  box-shadow: 0 0 1px var(--lo), inset 0 2px 4px var(--lo);
}

/* noise: a segmented meter that grows with the card */
.noise-widget .widget-body { container-type: size; }

.noise-track {
  height: clamp(18px, 14cqi, 44px);
  box-shadow: inset 0 2px 5px var(--lo);
}

.noise-track::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: repeating-linear-gradient(
    90deg,
    transparent 0 clamp(7px, 3.5cqi, 14px),
    var(--surface-2) clamp(7px, 3.5cqi, 14px) clamp(9px, 4.3cqi, 17px)
  );
  pointer-events: none;
}

.noise-fill {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 60%);
}

/* sticky note: folded corner */
.note-widget .widget-front::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 28px;
  height: 28px;
  background: linear-gradient(
    315deg,
    transparent 46%,
    rgba(0, 0, 0, 0.14) 47%,
    color-mix(in srgb, var(--wa, var(--accent-sunflower)) 46%, var(--surface)) 52%
  );
  border-radius: 0 0 var(--radius) 0;
}

/* dice: beveled cubes with pressed pips */
.die {
  background:
    linear-gradient(145deg,
      color-mix(in srgb, var(--wa, var(--surface-2)) 26%, white) 0%,
      color-mix(in srgb, var(--wa, var(--surface-2)) 22%, var(--surface)) 100%);
  border-radius: 18%;
  width: clamp(56px, 36cqi, 220px);
  font-size: clamp(24px, 17cqi, 92px);
  box-shadow: 0 3px 8px var(--lo), inset 0 2px 3px rgba(255, 255, 255, 0.5), inset 0 -3px 5px var(--lo);
}

body[data-theme="chalk"] .die {
  background:
    linear-gradient(145deg,
      color-mix(in srgb, var(--wa, var(--surface-2)) 34%, var(--surface)) 0%,
      color-mix(in srgb, var(--wa, var(--surface-2)) 22%, var(--surface)) 100%);
  box-shadow: 0 3px 8px var(--lo), inset 0 1px 2px rgba(255, 255, 255, 0.12), inset 0 -3px 5px var(--lo);
}

.die { position: relative; }

.die-pips {
  position: absolute;
  inset: 15%;
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  grid-template-columns: repeat(3, 1fr);
}

.pip {
  width: 68%;
  aspect-ratio: 1;
  border-radius: 50%;
  place-self: center;
  background: var(--t1);
  box-shadow: inset 0 2px 2px rgba(0, 0, 0, 0.45), 0 1px 1px var(--hi);
}

/* scoreboard: sunken tally displays sized by their digits */
.score-num {
  background: color-mix(in srgb, var(--t1) 5%, var(--surface-2));
  border-radius: 0.22em;
  padding: 0.05em 0.28em;
  min-width: 1.1em;
  text-align: center;
  box-shadow: inset 0 0.06em 0.14em var(--lo), inset 0 -0.03em 0 var(--hi);
}

.score-team {
  box-shadow: 0 1px 3px var(--lo), inset 0 1px 0 var(--hi);
}

.score-btns button {
  box-shadow: 0 1px 2px var(--lo), inset 0 1px 0 var(--hi);
}

.score-btns button:active {
  box-shadow: inset 0 2px 3px var(--lo);
}

/* voice level: a lamp that actually glows */
.signal-stage {
  box-shadow:
    0 0 clamp(14px, 8cqi, 36px) color-mix(in srgb, var(--sig, transparent) 32%, transparent),
    inset 0 1px 0 var(--hi),
    inset 0 -2px 8px color-mix(in srgb, var(--sig, var(--border)) 14%, transparent);
}

/* image: a matte photo frame */
.img-frame {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: clamp(8px, 3cqi, 16px);
  box-shadow: inset 0 2px 8px var(--lo);
}

.image-widget .widget-body { container-type: size; }
.img-frame img { border-radius: 5px; box-shadow: 0 1px 4px var(--lo); }

/* breathe: the orb fills the card and glows */
.breathe-widget .widget-body { container-type: size; }

.breathe-orb {
  width: 64cqmin;
  box-shadow:
    0 0 clamp(24px, 14cqmin, 70px) color-mix(in srgb, var(--wa, var(--accent-emerald)) 32%, transparent),
    inset 0 2px 6px rgba(255, 255, 255, 0.35),
    inset 0 -4px 10px rgba(0, 0, 0, 0.12);
}

/* qr: a printed card */
.qr-box img, .qr-box canvas {
  box-shadow: 0 2px 7px var(--lo);
}

/* hook and prompt output reads like an index card */
.hook-text {
  box-shadow: inset 0 1px 3px var(--lo), inset 0 -1px 0 var(--hi);
}

/* ---------------------------------------------------------------
   Design looks
   Three distinct identities on shared theme and accent tokens.
   Playful (base): rounded type, skeuomorphic depth, colored
     header bands, resting tilt.
   Minimal: bordered flat cards, no bands, straightened, accent
     reduced to a dot, underline tabs, outline buttons.
   Modern: large-radius smoked glass, accent status strip, mono
     microlabels, gradient numerals, ambient glow canvas.
--------------------------------------------------------------- */

/* -------- Minimal: quiet cards, ink and hairlines -------- */

body[data-look="minimal"] {
  --font: -apple-system, system-ui, "Segoe UI", sans-serif;
  --display: -apple-system, system-ui, "Segoe UI", sans-serif;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow-rest: none;
  --shadow-lift: 0 6px 20px rgba(0, 0, 0, 0.13);
  --hi: transparent;
  --lo: rgba(0, 0, 0, 0.04);
}

/* cards are defined by their border, not their shadow */
body[data-look="minimal"] .widget-face {
  background: var(--surface);
  box-shadow: none;
}

body[data-look="minimal"] .widget.grabbed .widget-face { box-shadow: var(--shadow-lift); }

/* everything sits straight */
body[data-look="minimal"] .widget { rotate: 0deg; }

/* the header band disappears; the accent survives as one dot */
body[data-look="minimal"] .widget-head {
  background: transparent;
  border-bottom: 1px solid var(--border);
  box-shadow: none;
}

body[data-look="minimal"] .widget-title { color: var(--t3); }

body[data-look="minimal"] .widget-title::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--wa, var(--t3));
  margin-right: 7px;
}

body[data-look="minimal"] .widget-gear,
body[data-look="minimal"] .widget-close { color: var(--t3); }

/* solid ink primary, outline secondary */
body[data-look="minimal"] .w-btn,
body[data-look="minimal"] .present-btn,
body[data-look="minimal"] .fab {
  background: var(--t1);
  box-shadow: none;
}

body[data-look="minimal"] .w-btn.secondary,
body[data-look="minimal"] .chime-btn {
  background: transparent;
  border: 1px solid var(--border);
  box-shadow: none;
}

body[data-look="minimal"] .w-btn.secondary:hover,
body[data-look="minimal"] .chime-btn:hover { background: var(--surface-2); opacity: 1; }

/* segmented controls become underline tabs */
body[data-look="minimal"] .seg {
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
  gap: 12px;
}

body[data-look="minimal"] .seg button {
  border-radius: 0;
  padding: 6px 2px;
  color: var(--t3);
}

body[data-look="minimal"] .seg button.active {
  background: transparent;
  color: var(--t1);
  box-shadow: inset 0 -2px 0 var(--t1);
}

body[data-look="minimal"] .w-input,
body[data-look="minimal"] .w-textarea,
body[data-look="minimal"] .w-select {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: none;
}

body[data-look="minimal"] .swatch,
body[data-look="minimal"] .signal-dot { background-image: none; box-shadow: none; }

/* flat widget internals: color only where it means something */
body[data-look="minimal"] .clock-widget .clock-time,
body[data-look="minimal"] .stopwatch-widget .clock-time,
body[data-look="minimal"] .picker-stage {
  background: transparent;
  box-shadow: none;
}

body[data-look="minimal"] .picker-stage::before,
body[data-look="minimal"] .picker-stage::after,
body[data-look="minimal"] .noise-track::after,
body[data-look="minimal"] .note-widget .widget-front::after { display: none; }

body[data-look="minimal"] .die {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: none;
}

body[data-look="minimal"] .pip { box-shadow: none; }

body[data-look="minimal"] .score-num,
body[data-look="minimal"] .score-team,
body[data-look="minimal"] .score-btns button,
body[data-look="minimal"] .board-tool,
body[data-look="minimal"] .board-tools,
body[data-look="minimal"] .board-wrap,
body[data-look="minimal"] .hook-text,
body[data-look="minimal"] .img-frame,
body[data-look="minimal"] .qr-box img,
body[data-look="minimal"] .qr-box canvas,
body[data-look="minimal"] .wx-pill,
body[data-look="minimal"] .task-check,
body[data-look="minimal"] .theme-card,
body[data-look="minimal"] .widget-tile,
body[data-look="minimal"] .signal-stage,
body[data-look="minimal"] .chime-btn { box-shadow: none; }

body[data-look="minimal"] .score-team,
body[data-look="minimal"] .hook-text,
body[data-look="minimal"] .group-card { background: var(--surface); border: 1px solid var(--border); }

body[data-look="minimal"] .widget-tile:hover { box-shadow: none; border-color: var(--t3); transform: none; }

body[data-look="minimal"] .note-widget .widget-front {
  background: color-mix(in srgb, var(--wa, var(--accent-sunflower)) 8%, var(--surface));
}

body[data-look="minimal"] .note-widget .widget-front .widget-head { background: transparent; }

body[data-look="minimal"] .wx-live {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: none;
}

body[data-look="minimal"] .wx-icon { filter: none; }

body[data-look="minimal"] .breathe-orb {
  background: color-mix(in srgb, var(--wa, var(--accent-emerald)) 50%, var(--surface));
  box-shadow: none;
}

body[data-look="minimal"] .clock-time,
body[data-look="minimal"] .picker-name,
body[data-look="minimal"] .wx-temp,
body[data-look="minimal"] .score-num,
body[data-look="minimal"] .die,
body[data-look="minimal"] .banner-text,
body[data-look="minimal"] .signal-label,
body[data-look="minimal"] .poll-q {
  font-weight: 600;
  letter-spacing: -0.5px;
}

/* -------- Modern: smoked glass, status strips, ambient glow -------- */

body[data-look="modern"] {
  --font: -apple-system, system-ui, "Segoe UI", sans-serif;
  --display: -apple-system, system-ui, "Segoe UI", sans-serif;
  --radius: 24px;
  --radius-sm: 14px;
  --hi: rgba(255, 255, 255, 0.28);
  --lo: rgba(8, 10, 30, 0.15);
  --shadow-rest: 0 2px 8px rgba(8, 10, 30, 0.08), 0 12px 32px rgba(8, 10, 30, 0.09);
  --shadow-lift: 0 8px 18px rgba(8, 10, 30, 0.16), 0 28px 60px rgba(8, 10, 30, 0.22);
}

body[data-look="modern"][data-theme="chalk"] {
  --hi: rgba(255, 255, 255, 0.09);
  --lo: rgba(0, 0, 0, 0.5);
}

/* ambient glow scene behind the whole board */
body[data-look="modern"] #canvas::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(60% 50% at 12% 0%, color-mix(in srgb, var(--accent-azure) 11%, transparent), transparent 62%),
    radial-gradient(50% 45% at 92% 100%, color-mix(in srgb, var(--accent-violet) 11%, transparent), transparent 62%);
}

body[data-look="modern"] .widget-face {
  background: color-mix(in srgb, var(--surface) 74%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  backdrop-filter: blur(20px) saturate(1.5);
  border-color: color-mix(in srgb, var(--wa, var(--border)) 30%, var(--border));
  box-shadow: var(--shadow-rest), inset 0 1px 0 var(--hi);
}

/* accent status strip along the top edge */
body[data-look="modern"] .widget-face::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--wa, transparent) 0%, color-mix(in srgb, var(--wa, transparent) 15%, transparent) 100%);
  z-index: 1;
}

/* header goes transparent; the strip carries the accent */
body[data-look="modern"] .widget-head {
  background: transparent;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  box-shadow: none;
}

/* mono microlabels for the instrument read */
body[data-look="modern"] .widget-title,
body[data-look="modern"] .set-label,
body[data-look="modern"] .cat-label,
body[data-look="modern"] .style-label,
body[data-look="modern"] .wx-place,
body[data-look="modern"] .score-name,
body[data-look="modern"] .group-card h4 {
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.1em;
}

/* gradient numerals tinted toward the accent, tight tracking */
body[data-look="modern"] .clock-time,
body[data-look="modern"] .picker-name,
body[data-look="modern"] .wx-temp,
body[data-look="modern"] .banner-text,
body[data-look="modern"] .signal-label {
  background-image: linear-gradient(180deg, var(--t1) 25%, color-mix(in srgb, var(--wa, var(--t1)) 62%, var(--t1)) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -2px;
}

body[data-look="modern"] .clock-widget .clock-time,
body[data-look="modern"] .stopwatch-widget .clock-time {
  background-color: transparent;
  box-shadow: none;
  border: 1px solid color-mix(in srgb, var(--wa, var(--border)) 26%, var(--border));
}

body[data-look="modern"] .banner-text {
  caret-color: var(--t1);
}

body[data-look="modern"] .banner-text::selection {
  color: var(--on-ink);
  background: var(--t1);
  -webkit-text-fill-color: var(--on-ink);
}

body[data-look="modern"] .widget.count-critical .clock-time {
  background-image: linear-gradient(180deg, var(--danger), var(--danger));
}

body[data-look="modern"] .signal-stage .signal-label {
  background-image: linear-gradient(180deg, var(--t1) 25%, color-mix(in srgb, var(--sig, var(--t1)) 68%, var(--t1)) 100%);
}

body[data-look="modern"] .w-btn,
body[data-look="modern"] .present-btn {
  border-radius: 999px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--t1) 82%, var(--wa, white)) 0%, var(--t1) 70%);
  box-shadow: 0 2px 10px var(--lo), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

body[data-look="modern"] .w-btn.secondary {
  background: color-mix(in srgb, var(--surface-2) 65%, transparent);
  border: 1px solid color-mix(in srgb, var(--wa, var(--border)) 24%, var(--border));
  color: var(--t1);
}

body[data-look="modern"] .seg {
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
}

body[data-look="modern"] .seg button.active {
  background: color-mix(in srgb, var(--wa, var(--surface)) 20%, var(--surface));
  box-shadow: 0 0 10px color-mix(in srgb, var(--wa, transparent) 25%, transparent);
}

body[data-look="modern"] .w-input,
body[data-look="modern"] .w-textarea,
body[data-look="modern"] .w-select {
  background: color-mix(in srgb, var(--surface-2) 65%, transparent);
  border-color: color-mix(in srgb, var(--wa, var(--border)) 20%, var(--border));
}

body[data-look="modern"] .w-input:focus,
body[data-look="modern"] .w-textarea:focus,
body[data-look="modern"] .w-select:focus {
  border-color: var(--wa, var(--t2));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--wa, var(--t2)) 22%, transparent);
}

body[data-look="modern"] .fab {
  background: color-mix(in srgb, var(--t1) 88%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 4px 14px var(--lo), 0 0 0 1px var(--hi);
}

body[data-look="modern"] .drawer {
  background: color-mix(in srgb, var(--surface) 62%, transparent);
  -webkit-backdrop-filter: blur(30px) saturate(1.6);
  backdrop-filter: blur(30px) saturate(1.6);
  border-radius: 28px;
}

body[data-look="modern"] .poll-row .pr-fill {
  background-image: linear-gradient(90deg, color-mix(in srgb, var(--wa, var(--t1)) 80%, white) 0%, var(--wa, var(--t1)) 100%);
  box-shadow: 0 0 10px color-mix(in srgb, var(--wa, transparent) 40%, transparent);
}

body[data-look="modern"] .die {
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  border: 1px solid color-mix(in srgb, var(--wa, var(--border)) 36%, var(--border));
  box-shadow: 0 3px 10px var(--lo), 0 0 16px color-mix(in srgb, var(--wa, transparent) 18%, transparent), inset 0 1px 0 var(--hi);
}

body[data-look="modern"] .pip {
  background: var(--wa, var(--t1));
  box-shadow: 0 0 8px color-mix(in srgb, var(--wa, transparent) 55%, transparent);
}

body[data-look="modern"] .task-item.completed .task-check {
  box-shadow: 0 0 10px color-mix(in srgb, var(--wa, transparent) 45%, transparent);
}

body[data-look="modern"] .note-widget .widget-front::after { display: none; }

body[data-look="modern"] .note-widget .widget-front {
  background: color-mix(in srgb, var(--wa, var(--accent-sunflower)) 24%, color-mix(in srgb, var(--surface) 78%, transparent));
}

body[data-look="modern"] .chime-btn {
  background: color-mix(in srgb, var(--surface-2) 55%, transparent);
  border-color: color-mix(in srgb, var(--wa, var(--border)) 22%, var(--border));
}

body[data-look="modern"] .signal-stage {
  box-shadow:
    0 0 clamp(20px, 11cqi, 48px) color-mix(in srgb, var(--sig, transparent) 42%, transparent),
    inset 0 1px 0 var(--hi);
}

body[data-look="modern"] .breathe-orb {
  box-shadow:
    0 0 clamp(30px, 18cqmin, 90px) color-mix(in srgb, var(--wa, var(--accent-emerald)) 42%, transparent),
    inset 0 2px 6px rgba(255, 255, 255, 0.3),
    inset 0 -4px 10px rgba(0, 0, 0, 0.12);
}

/* ---------------------- touch first sizing ------------------------ */

@media (pointer: coarse) {
  /* hover does not exist on a touch display, so editing controls
     stay visible at rest instead of appearing on hover */
  .widget-gear, .widget-close, .widget-resize, .task-del { opacity: 0.5; }
  .widget:hover .widget-gear,
  .widget:hover .widget-close,
  .widget:hover .widget-resize,
  .task-item:hover .task-del { opacity: 0.5; }
  .widget.flipped .widget-gear { opacity: 1; }
  .widget-gear:active, .widget-close:active,
  .widget-resize:active, .task-del:active { opacity: 1; }

  /* 44px minimum touch targets */
  .widget-gear, .widget-close {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }

  .widget-head { padding: 10px 12px; min-height: 56px; }

  .widget-resize {
    width: 40px;
    height: 40px;
    right: 0;
    bottom: 0;
    padding: 10px;
  }

  .w-btn { min-height: 46px; padding: 11px 18px; font-size: 15px; }
  .w-input, .w-select { min-height: 46px; font-size: 16px; }
  .w-textarea { font-size: 16px; }
  .seg button { padding: 10px 16px; font-size: 14px; min-height: 40px; }

  .swatch { width: 36px; height: 36px; }
  .theme-card { min-height: 68px; }
  .theme-card .tc-dot { width: 22px; height: 22px; }
  .theme-card .tc-name { font-size: 11.5px; }
  .signal-dot { width: 36px; height: 36px; }
  .task-item { padding: 12px; min-height: 48px; }
  .task-del { width: 36px; height: 36px; }
  .task-add .w-btn { width: 48px; }
  .board-tool { width: 44px; height: 44px; border-radius: 12px; }
  .score-btns button { width: 44px; height: 44px; font-size: 20px; }
  .chime-btn { min-height: 54px; }
  .groups-controls input { width: 72px; }
  .icon-btn { width: 42px; height: 42px; }
  .poll-link button { min-height: 36px; }

  .fab { width: 66px; height: 66px; border-radius: 21px; }
  .present-exit { width: 54px; height: 54px; }

  .widget-tile { padding: 16px; min-height: 108px; }
  .widget-tile .wt-icon { width: 48px; height: 48px; }
  .widget-tile .wt-name { font-size: 15px; }
  .present-btn { min-height: 48px; }
  .foot-btn { min-height: 42px; padding: 9px 15px; }
  .foot-toggle input { width: 20px; height: 20px; }

  .widget { min-width: 210px; min-height: 140px; }
}

/* ---------------------------------------------------------------
   Widgets 16 to 20
--------------------------------------------------------------- */

/* 16. Stopwatch shares the clock display face */
.stopwatch-widget .widget-body { container-type: size; }

/* 17. Weather: a sky panel tinted by the current condition */
.weather-widget .widget-body { container-type: size; }

.wx-idle {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: center;

  p { margin: 0; font-size: 13px; color: var(--t3); line-height: 1.4; }
}

.wx-live {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(6px, 3cqi, 14px);
  min-height: 0;
  padding: clamp(10px, 4cqi, 20px);
  border-radius: 14px;
  background: linear-gradient(
    165deg,
    color-mix(in srgb, var(--wx, var(--surface-2)) 22%, var(--surface)) 0%,
    color-mix(in srgb, var(--wx, var(--surface-2)) 6%, var(--surface)) 70%
  );
  box-shadow: inset 0 1px 0 var(--hi), inset 0 -2px 8px color-mix(in srgb, var(--wx, var(--border)) 10%, transparent);
  transition: background 0.6s ease;
}

.wx-place {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--t3);
}

.wx-place:empty { display: none; }

.wx-row {
  display: flex;
  align-items: center;
  gap: clamp(10px, 5cqi, 22px);
}

.wx-icon {
  color: color-mix(in srgb, var(--wx, var(--t2)) 82%, var(--t1));
  display: grid;
  place-content: center;
  filter: drop-shadow(0 0 clamp(8px, 5cqi, 22px) color-mix(in srgb, var(--wx, transparent) 45%, transparent));
}

.wx-icon svg { width: clamp(44px, 30cqi, 96px); height: clamp(44px, 30cqi, 96px); }

.wx-main { display: flex; flex-direction: column; }

.wx-temp {
  font-family: var(--display);
  font-size: clamp(34px, 26cqi, 88px);
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1;
}

.wx-label { font-size: clamp(12px, 5cqi, 16px); font-weight: 600; color: var(--t2); }

.wx-feels { font-size: clamp(11px, 4cqi, 14px); font-weight: 500; color: var(--t3); }
.wx-feels:empty { display: none; }

.wx-range { display: flex; gap: 8px; }

.wx-pill {
  font-size: clamp(11px, 4.5cqi, 14px);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--t2);
  background: color-mix(in srgb, var(--surface) 75%, transparent);
  border: 1px solid color-mix(in srgb, var(--wx, var(--border)) 24%, var(--border));
  border-radius: 999px;
  padding: 4px 11px;
  box-shadow: inset 0 1px 0 var(--hi);
}

/* 18. Image */
.img-frame {
  flex: 1;
  min-height: 0;
  display: grid;
  place-content: stretch;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
}

.img-frame img { width: 100%; height: 100%; }

.img-hint {
  display: grid;
  place-content: center;
  text-align: center;
  font-size: 13px;
  color: var(--t3);
  padding: 12px;
}

/* 19. Breathe */
.breathe-stage {
  position: relative;
  flex: 1;
  display: grid;
  place-content: center;
  min-height: 0;
}

.breathe-orb {
  position: absolute;
  inset: 0;
  margin: auto;
  width: min(70%, 160px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(
    circle at 35% 30%,
    color-mix(in srgb, var(--wa, var(--accent-emerald)) 55%, var(--surface)),
    color-mix(in srgb, var(--wa, var(--accent-emerald)) 85%, var(--t1) 6%)
  );
  transform: scale(0.7);
  transition-property: transform;
  transition-timing-function: ease-in-out;
  opacity: 0.9;
}

.breathe-cue {
  position: relative;
  font-family: var(--display);
  font-size: 19px;
  font-weight: 600;
  text-align: center;
  color: var(--t1);
  text-shadow: 0 1px 8px color-mix(in srgb, var(--surface) 60%, transparent);
}

/* 20. Class prompt */
.prompt-kinds { flex-wrap: wrap; border-radius: 14px; align-self: flex-start; }
.prompt-widget .hook-actions { padding-top: 10px; }

/* rounded system type carries the most character at heavy weights,
   so the big display moments step up to 700 */
.clock-time, .picker-name, .wx-temp, .score-num,
.die, .banner-text, .signal-label, .poll-q {
  font-weight: 700;
}

/* ---------------------------------------------------------------
   Reduced motion
--------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  body.tilt .widget { rotate: 0deg; }
}
