/* Screen — the board at the front of a classroom.
 *
 * Two things govern every number in here:
 *
 *  * It is read from the back of a room, not from a desk. Type is large,
 *    contrast is high, and nothing important is thinner than 2px.
 *  * It is projected onto whatever the school owns. Widgets are placed
 *    in percentages so a board set up on a 16:10 laptop still makes
 *    sense thrown onto a 4:3 projector.
 */

.sc {
  position: fixed;
  inset: 0;
  overflow: hidden;
  font-family: var(--ff-sans);
  --sc-ink: #ffffff;
  --sc-panel: rgba(16, 20, 28, 0.72);
  --sc-edge: rgba(255, 255, 255, 0.16);
  /* One colour for "the thing you are doing right now": a snap guide, a
     pinned widget's edge, the card under the pointer. */
  --sc-accent: #7cc5ff;
}

/* A pale background needs dark widgets, or every one of them is a white
   card on a white sheet. */
.sc.is-light-bg {
  --sc-ink: #15181e;
  --sc-panel: rgba(255, 255, 255, 0.82);
  --sc-edge: rgba(0, 0, 0, 0.14);
  /* The same hue, darkened: #7cc5ff on paper is barely a line. */
  --sc-accent: #1668a8;
}

.sc-board {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, #20262e, #39414d);
}

/* The wash that keeps a photograph from eating the widgets on top of
   it. Only when asked for: a teacher who uploaded a picture of their
   class may well want to see it. */
.sc.is-dim .sc-board::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 14, 0.38);
  pointer-events: none;
}

.sc.is-light-bg.is-dim .sc-board::before { background: rgba(255, 255, 255, 0.3); }

.sc-board__empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: var(--space-2);
  text-align: center;
  color: var(--sc-ink);
  opacity: 0.82;
}
.sc-board__empty[hidden] { display: none; }
.sc-board__empty p { margin: 0; font-size: 1.5rem; }
.sc-board__hint { font-size: 1rem !important; opacity: 0.75; }

.sc-link {
  border: 0;
  background: none;
  padding: 0;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   A widget
   -------------------------------------------------------------------------- */

.sc-w {
  position: absolute;
  display: flex;
  flex-direction: column;
  min-width: 8%;
  min-height: 8%;
  border: 1px solid var(--sc-edge);
  border-radius: 14px;
  background: var(--sc-panel);
  color: var(--sc-ink);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.sc-w.is-moving {
  outline: 2px solid var(--accent);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
}

.sc-w__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 0.3rem 0.5rem;
  border-bottom: 1px solid var(--sc-edge);
  cursor: move;
  touch-action: none;
}

.sc-w__name {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.6;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The head is chrome, not content: it fades back until the pointer is
   on the widget, so a board being watched by thirty children is the
   widgets and not a row of title bars. */
.sc-w__tools { display: flex; gap: 0.15rem; opacity: 0; transition: opacity .12s; }
.sc-w:hover .sc-w__tools,
.sc-w:focus-within .sc-w__tools { opacity: 1; }

.sc-w__tool {
  display: grid;
  place-items: center;
  width: 1.4rem;
  height: 1.4rem;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: inherit;
  cursor: pointer;
  opacity: 0.7;
}
.sc-w__tool:hover { opacity: 1; background: rgba(127, 127, 127, 0.22); }
.sc-w__tool svg { width: 14px; height: 14px; fill: currentColor; }
.sc-w__tool--x:hover { background: rgba(214, 52, 44, 0.3); }

.sc-w__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem;
  min-height: 0;
  overflow: hidden;
  text-align: center;
}

.sc-w__grip {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 18px;
  height: 18px;
  cursor: nwse-resize;
  touch-action: none;
  background:
    linear-gradient(135deg, transparent 50%, var(--sc-edge) 50%);
}

/* --------------------------------------------------------------------------
   Shared bits inside widgets
   -------------------------------------------------------------------------- */

.sc-row { display: flex; flex-wrap: wrap; gap: 0.35rem; justify-content: center; }
.sc-row--tight { gap: 0.25rem; }

.sc-btn {
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--sc-edge);
  border-radius: 999px;
  background: rgba(127, 127, 127, 0.16);
  color: inherit;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.sc-btn:hover { background: rgba(127, 127, 127, 0.3); }
.sc-btn--go { background: var(--accent); border-color: transparent; color: #fff; }
.sc-btn--go:hover { filter: brightness(1.1); background: var(--accent); }

.sc-chips { display: flex; flex-wrap: wrap; gap: 0.25rem; justify-content: center; }
.sc-chip {
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--sc-edge);
  border-radius: 999px;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}
.sc-chip:hover { background: rgba(127, 127, 127, 0.24); }

.sc-dim { opacity: 0.6; margin: 0; font-size: 0.9rem; }

.sc-swatch {
  width: 1.3rem;
  height: 1.3rem;
  padding: 0;
  border: 1px solid var(--sc-edge);
  border-radius: 50%;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   Clock
   -------------------------------------------------------------------------- */

.sc-clock { flex: 1; min-height: 0; display: grid; place-items: center; width: 100%; }
.sc-clock__face { width: 100%; height: 100%; max-height: 100%; }
.sc-clock__rim { fill: none; stroke: currentColor; stroke-width: 2; opacity: 0.3; }
.sc-clock__tick { stroke: currentColor; stroke-width: 2; opacity: 0.5; }
.sc-clock__h, .sc-clock__m {
  stroke: currentColor; stroke-width: 5; stroke-linecap: round;
}
.sc-clock__m { stroke-width: 3.5; }
.sc-clock__s { stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; }
.sc-clock__pin { fill: currentColor; }
.sc-clock__digits {
  font-size: clamp(1rem, 3vw, 2rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   Timers
   -------------------------------------------------------------------------- */

.sc-timer__read {
  font-size: clamp(1.6rem, 7vw, 5rem);
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.sc-timer__read.is-done { color: #ff6b6b; }

.sc-timer__bar {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: rgba(127, 127, 127, 0.28);
  overflow: hidden;
}
.sc-timer__bar i {
  display: block;
  height: 100%;
  background: var(--accent);
  /* No transition: the bar is redrawn every second and a half-second
     ease would always be showing the previous second. */
}

/* A finished timer has to be noticeable from across a room without
   anybody watching it. */
@keyframes sc-flash {
  0%, 100% { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28); }
  50% { box-shadow: 0 0 0 4px #ff6b6b, 0 10px 30px rgba(0, 0, 0, 0.28); }
}
.sc-w.is-finished { animation: sc-flash 1.1s ease-in-out 6; }

.sc-pie { flex: 1; min-height: 0; width: 100%; display: grid; place-items: center; }
.sc-pie svg { width: 100%; height: 100%; }
.sc-pie__bg { fill: rgba(127, 127, 127, 0.22); }
.sc-pie__slice { fill: var(--accent); }
.sc-pie__read {
  font-size: clamp(1rem, 3.4vw, 2.2rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.sc-laps {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  opacity: 0.75;
  overflow-y: auto;
  min-height: 0;
}

/* --------------------------------------------------------------------------
   Traffic light and work symbols
   -------------------------------------------------------------------------- */

.sc-light {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.sc-light__lamp {
  flex: 1;
  width: 100%;
  max-width: 5.5rem;
  min-height: 0;
  border: 2px solid var(--sc-edge);
  border-radius: 50%;
  aspect-ratio: 1;
  background: rgba(127, 127, 127, 0.18);
  cursor: pointer;
  /* Off lamps are not hidden: a traffic light with one circle on it is
     a dot, and the whole point is that a child reads the position. */
  opacity: 0.35;
}
.sc-light__lamp.is-on { opacity: 1; }
.sc-light__lamp--red.is-on { background: #e3372c; box-shadow: 0 0 22px #e3372c88; }
.sc-light__lamp--amber.is-on { background: #f5a623; box-shadow: 0 0 22px #f5a62388; }
.sc-light__lamp--green.is-on { background: #35b55f; box-shadow: 0 0 22px #35b55f88; }

.sc-light__say { font-size: clamp(0.75rem, 1.6vw, 1.1rem); opacity: 0.85; }

.sc-work {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
  width: 100%;
  height: 100%;
}
.sc-work__one {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  padding: 0.3rem;
  border: 2px solid var(--sc-edge);
  border-radius: 10px;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: opacity .15s, border-color .15s;
}
.sc-work__one b { font-size: clamp(0.8rem, 1.8vw, 1.25rem); }
.sc-work__one small { font-size: 0.72rem; opacity: 0.65; }
.sc-work.is-picked .sc-work__one { opacity: 0.3; }
.sc-work__one.is-on {
  opacity: 1 !important;
  border-color: var(--accent);
  background: rgba(127, 127, 127, 0.18);
}

/* --------------------------------------------------------------------------
   Names
   -------------------------------------------------------------------------- */

.sc-pick__out {
  font-size: clamp(1.4rem, 5vw, 3.4rem);
  font-weight: 600;
  line-height: 1.1;
  word-break: break-word;
}
.sc-w.is-spinning .sc-pick__out { opacity: 0.55; }
.sc-pick__left { font-size: 0.85rem; opacity: 0.65; }

.sc-groups {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
  gap: 0.4rem;
  overflow-y: auto;
  align-content: start;
}
.sc-groups__one {
  padding: 0.4rem;
  border: 1px solid var(--sc-edge);
  border-radius: 10px;
  text-align: left;
}
.sc-groups__one b { font-size: 0.72rem; text-transform: uppercase; opacity: 0.6; }
.sc-groups__one ul { margin: 0.2rem 0 0; padding: 0; list-style: none; }
.sc-groups__one li { font-size: clamp(0.8rem, 1.5vw, 1.05rem); }

/* --------------------------------------------------------------------------
   Dice, score, tally
   -------------------------------------------------------------------------- */

.sc-dice { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: center; }
.sc-die {
  display: grid;
  place-items: center;
  min-width: 2.6rem;
  padding: 0.3rem 0.5rem;
  border: 2px solid var(--sc-edge);
  border-radius: 10px;
  font-size: clamp(1.2rem, 4vw, 2.6rem);
  font-weight: 600;
}
.sc-w.is-rolling .sc-die { animation: sc-roll .4s ease; }
@keyframes sc-roll {
  0% { transform: rotate(-14deg) scale(.8); }
  100% { transform: none; }
}
.sc-dice__total { font-size: 0.85rem; opacity: 0.65; }

.sc-score {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(5.5rem, 1fr));
  gap: 0.4rem;
  overflow-y: auto;
  align-content: start;
}
.sc-score__one {
  position: relative;
  padding: 0.4rem 0.3rem;
  border: 2px solid var(--sc-edge);
  border-radius: 10px;
}
.sc-score__one.is-top { border-color: var(--accent); }
.sc-score__name { font-size: 0.85rem; opacity: 0.8; outline: none; }
.sc-score__v {
  font-size: clamp(1.4rem, 4vw, 2.6rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.sc-score__pm { display: flex; gap: 0.2rem; justify-content: center; }
.sc-score__pm button {
  width: 1.7rem;
  height: 1.7rem;
  border: 1px solid var(--sc-edge);
  border-radius: 7px;
  background: rgba(127, 127, 127, 0.16);
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.sc-score__drop {
  position: absolute;
  top: 0.1rem;
  right: 0.2rem;
  border: 0;
  background: none;
  color: inherit;
  opacity: 0;
  cursor: pointer;
}
.sc-score__one:hover .sc-score__drop { opacity: 0.6; }

.sc-poll__q { font-size: clamp(0.9rem, 2.2vw, 1.5rem); outline: none; }
.sc-poll {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  justify-content: center;
}
.sc-poll__one {
  flex: 1;
  max-width: 5rem;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.2rem;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.sc-poll__one i {
  display: block;
  width: 100%;
  min-height: 3px;
  border-radius: 6px 6px 0 0;
  background: var(--accent);
  transition: height .18s;
}
.sc-poll__v { font-size: 1.1rem; font-weight: 600; }
.sc-poll__one b { font-size: 1rem; }

/* --------------------------------------------------------------------------
   Text, notes, pictures
   -------------------------------------------------------------------------- */

.sc-textbox,
.sc-sticky {
  width: 100%;
  flex: 1;
  min-height: 0;
  display: grid;
  place-content: center;
  overflow-y: auto;
  outline: none;
  line-height: 1.2;
  word-break: break-word;
}
.sc-textbox:empty::before,
.sc-sticky:empty::before {
  content: attr(data-placeholder);
  opacity: 0.4;
}

.sc-w--note { --sticky: #ffe9a8; }
.sc-w--note .sc-w__body { background: var(--sticky); color: #2a2412; }
.sc-sticky { place-content: start; text-align: left; font-size: 1.1rem; }

.sc-img { max-width: 100%; max-height: 100%; object-fit: contain; }
.sc-drop {
  width: 100%;
  flex: 1;
  border: 2px dashed var(--sc-edge);
  border-radius: 10px;
  background: none;
  color: inherit;
  font: inherit;
  opacity: 0.7;
  cursor: pointer;
}

.sc-canvas {
  width: 100%;
  flex: 1;
  min-height: 0;
  border-radius: 8px;
  background: #fff;
  touch-action: none;
  cursor: crosshair;
}

.sc-cam { width: 100%; flex: 1; min-height: 0; object-fit: cover; border-radius: 8px; }

/* --------------------------------------------------------------------------
   Meter, calendar, countdown, breathing, QR, agenda
   -------------------------------------------------------------------------- */

.sc-meter {
  width: 2.4rem;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: flex-end;
  border: 2px solid var(--sc-edge);
  border-radius: 999px;
  overflow: hidden;
}
.sc-meter i {
  display: block;
  width: 100%;
  height: 0;
  background: linear-gradient(to top, #35b55f, #f5a623);
  transition: height .1s linear;
}
.sc-w.is-loud .sc-meter i { background: linear-gradient(to top, #f5a623, #e3372c); }
.sc-meter__face { font-size: clamp(0.9rem, 2.4vw, 1.5rem); }
.sc-w.is-loud { outline: 2px solid #e3372c; }

.sc-cal__head { font-size: 1rem; font-weight: 600; }
.sc-cal {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  font-size: clamp(0.65rem, 1.4vw, 0.95rem);
  align-content: start;
}
.sc-cal__dow { opacity: 0.5; font-weight: 500; }
.sc-cal__d { padding: 0.1rem 0; border-radius: 5px; }
.sc-cal__d.is-today { background: var(--accent); color: #fff; font-weight: 600; }

.sc-count__n {
  font-size: clamp(2rem, 9vw, 6rem);
  font-weight: 700;
  line-height: 1;
}
.sc-count__what { font-size: clamp(0.8rem, 2vw, 1.2rem); opacity: 0.8; }

.sc-breathe {
  width: 55%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent), transparent 72%);
  /* Matched to the phase it is in, not a fixed duration: an ease that
     outlasts a 4-second inhale makes the class breathe out early. */
  transition: transform .9s linear;
}
.sc-breathe.is-hold { transition: none; }
.sc-breathe__say {
  font-size: clamp(1rem, 3vw, 2rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.sc-qr { max-width: 100%; max-height: 100%; flex: 1; min-height: 0; object-fit: contain; background: #fff; border-radius: 6px; padding: 2px; }
.sc-qr__cap { font-size: 0.85rem; opacity: 0.8; word-break: break-all; }

.sc-agenda {
  flex: 1;
  min-height: 0;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-y: auto;
  text-align: left;
}
.sc-agenda__one {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0;
  font-size: clamp(0.9rem, 2vw, 1.3rem);
}
.sc-agenda__one.is-done .sc-agenda__t { opacity: 0.45; text-decoration: line-through; }
.sc-agenda__tick {
  width: 1.2rem;
  height: 1.2rem;
  border: 2px solid var(--sc-edge);
  border-radius: 5px;
  background: none;
  cursor: pointer;
}
.sc-agenda__tick[aria-pressed="true"] { background: var(--accent); border-color: transparent; }
.sc-agenda__t { outline: none; }
.sc-agenda__x { border: 0; background: none; color: inherit; opacity: 0; cursor: pointer; }
.sc-agenda__one:hover .sc-agenda__x { opacity: 0.5; }

/* --------------------------------------------------------------------------
   The widget bar
   -------------------------------------------------------------------------- */

.sc-bar {
  position: absolute;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  align-items: stretch;
  gap: 0.2rem;
  max-width: calc(100vw - 2rem);
  padding: 0.35rem;
  border: 1px solid var(--sc-edge);
  border-radius: 16px;
  background: var(--sc-panel);
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.3);
  transition: transform .2s ease, opacity .2s ease;
}

/* Tucked away, because the bar sits over the lesson and a class does
   not need to see the teacher's tools for forty minutes. */
.sc.is-tucked .sc-bar { transform: translate(-50%, calc(100% + 1.4rem)); }
.sc.is-tucked .sc-bar__grab { transform: translate(-50%, -2.6rem) rotate(180deg); }

.sc-bar__grab {
  position: absolute;
  left: 50%;
  top: -1.1rem;
  transform: translateX(-50%);
  width: 2.6rem;
  height: 1.3rem;
  padding: 0;
  border: 1px solid var(--sc-edge);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  background: var(--sc-panel);
  color: var(--sc-ink);
  cursor: pointer;
}
.sc-bar__grab svg { width: 18px; height: 18px; fill: currentColor; }

.sc-bar__row {
  display: flex;
  gap: 0.2rem;
  overflow-x: auto;
  scrollbar-width: thin;
}

.sc-bar__end {
  display: flex;
  gap: 0.2rem;
  padding-left: 0.35rem;
  border-left: 1px solid var(--sc-edge);
}

.sc-tool {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  min-width: 4.1rem;
  padding: 0.35rem 0.3rem;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--sc-ink);
  font: inherit;
  font-size: 0.68rem;
  cursor: pointer;
}
.sc-tool:hover { background: rgba(127, 127, 127, 0.24); }
.sc-tool svg { width: 24px; height: 24px; fill: currentColor; }
.sc-tool span {
  max-width: 4.4rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sc-tray {
  position: absolute;
  left: 50%;
  bottom: 6.2rem;
  transform: translateX(-50%);
  z-index: 41;
  width: min(34rem, calc(100vw - 2rem));
  max-height: 60vh;
  overflow-y: auto;
  padding: 0.6rem;
  border: 1px solid var(--sc-edge);
  border-radius: 16px;
  background: var(--sc-panel);
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.3);
}
.sc-tray[hidden] { display: none; }
.sc-tray__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5rem, 1fr));
  gap: 0.2rem;
}

/* --------------------------------------------------------------------------
   Sheets
   -------------------------------------------------------------------------- */

.sc-sheet {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(6, 8, 12, 0.55);
  backdrop-filter: blur(3px);
}
.sc-sheet[hidden] { display: none; }

.sc-sheet__box {
  width: min(56rem, 100%);
  max-height: 86vh;
  overflow-y: auto;
  padding: 1.2rem;
  border-radius: 16px;
  background: var(--surface-2);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
.sc-sheet__box--narrow { width: min(26rem, 100%); }

.sc-sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.sc-sheet__head h2 { margin: 0; font-size: 1.3rem; }
.sc-sheet__sub { margin: 0.3rem 0 1rem; color: var(--text-dim); font-size: 0.92rem; }
.sc-sheet__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

.sc-x {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text-dim);
  cursor: pointer;
}
.sc-x:hover { background: var(--surface-1); color: var(--text); }
.sc-x svg { width: 18px; height: 18px; fill: currentColor; }

.sc-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
  gap: 0.7rem;
}
.sc-card {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-1);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
}
.sc-card:hover { border-color: var(--accent); }
.sc-card__pic {
  position: relative;
  aspect-ratio: 16 / 10;
  border-bottom: 1px solid var(--border);
}
/* The layout, sketched from the template's own numbers — accurate by
   construction, and nothing to re-shoot when a template changes. */
.sc-card__pic i {
  position: absolute;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.sc-card b { padding: 0.4rem 0.6rem 0; font-size: 0.95rem; }
.sc-card small { padding: 0 0.6rem 0.6rem; color: var(--text-dim); font-size: 0.78rem; }

.sc-bgs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
  gap: 0.6rem;
}
.sc-bg {
  position: relative;
  aspect-ratio: 16 / 10;
  display: flex;
  align-items: flex-end;
  padding: 0.4rem;
  border: 2px solid transparent;
  border-radius: 10px;
  color: #fff;
  font: inherit;
  font-size: 0.8rem;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  cursor: pointer;
}
.sc-bg[aria-pressed="true"] { border-color: var(--accent); }

.sc-check {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1rem;
  color: var(--text-dim);
  font-size: 0.88rem;
  cursor: pointer;
}

.sc-field { margin-bottom: 1rem; }
.sc-field__l {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--text-dim);
  font-size: 0.8rem;
}
.sc-input, .sc-area {
  width: 100%;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-1);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
}
.sc-area { resize: vertical; line-height: 1.5; }

.sc-seg { display: flex; flex-wrap: wrap; gap: 0.2rem; }
.sc-seg button {
  flex: 1;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-1);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.sc-seg button[aria-pressed="true"] {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
}

.sc-note {
  position: absolute;
  left: 50%;
  top: 1rem;
  transform: translateX(-50%) translateY(-120%);
  z-index: 70;
  margin: 0;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: var(--sc-panel);
  color: var(--sc-ink);
  font-size: 0.9rem;
  transition: transform .2s ease;
}
.sc-note.is-on { transform: translateX(-50%) translateY(0); }

/* --------------------------------------------------------------------------
   Small screens

   A phone is not a classroom board, but a teacher setting one up on the
   bus should still be able to. The bar scrolls and the labels go.
   -------------------------------------------------------------------------- */

@media (max-width: 40rem) {
  .sc-tool { min-width: 3rem; }
  .sc-tool span { display: none; }
  .sc-bar { bottom: 0.5rem; max-width: calc(100vw - 1rem); }
  .sc-w__name { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .sc-w.is-finished { animation: none; outline: 3px solid #ff6b6b; }
  .sc-breathe { transition: none; }
}


/* ---------------------------------------------------------------------------
   Pinning, snapping, and the screens a browser has kept
   --------------------------------------------------------------------------- */

/* A pinned widget keeps its settings and its close button -- it is held
   in place, not frozen -- so the only cue needed is that the grip and the
   drag-by-the-head have gone. */
.sc-w.is-locked > .sc-w__grip { display: none; }
.sc-w.is-locked > .sc-w__head { cursor: default; }
.sc-w.is-locked > .sc-w__head::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--sc-accent);
  opacity: .8;
}
.sc-w__head { position: relative; }

/* The line a dragged edge has stuck to. Thin, bright and only on screen
   while the pointer is down: a guide that lingers reads as part of the
   board. */
.sc-guide {
  position: absolute;
  color: var(--sc-accent);
  background: currentColor;
  pointer-events: none;
  z-index: 9;
  /* currentColor, not a literal: the glow has to follow the accent when
     a pale background flips it, or it is a blue halo on white paper. */
  box-shadow: 0 0 6px currentColor;
}
.sc-guide--x { top: 0; bottom: 0; width: 1px; margin-left: -.5px; }
.sc-guide--y { left: 0; right: 0; height: 1px; margin-top: -.5px; }

.sc-saved { margin-top: 1.4rem; }
.sc-saved > h3 {
  margin: 0 0 .2rem;
  font-size: 1rem;
  letter-spacing: .01em;
}

/* A kept screen is a card with a second button on it, so the card itself
   cannot be a <button>: a button inside a button is not valid markup and
   browsers disagree about which one a click belongs to. */
.sc-card--saved { position: relative; padding: 0; background: none; border: 0; }
.sc-card__open {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0;
  background: var(--sc-panel);
  border: 1px solid var(--sc-edge);
  border-radius: 12px;
  color: inherit;
  cursor: pointer;
  overflow: hidden;
}
.sc-card__open:hover,
.sc-card__open:focus-visible { border-color: var(--sc-accent); }
.sc-card__open > b { display: block; padding: .5rem .6rem 0; }
.sc-card__open > small { display: block; padding: 0 .6rem .6rem; opacity: .7; }

.sc-card__drop {
  position: absolute;
  top: .4rem;
  right: .4rem;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  cursor: pointer;
  opacity: 0;
  transition: opacity .12s ease;
}
.sc-card--saved:hover .sc-card__drop,
.sc-card__drop:focus-visible { opacity: 1; }
.sc-card__drop svg { width: 14px; height: 14px; fill: currentColor; }

.sc-tool[disabled] { opacity: .4; cursor: default; }

@media (prefers-reduced-motion: reduce) {
  .sc-card__drop { transition: none; opacity: 1; }
}


/* The shortcut list. Two columns rather than a sentence each: it is read
   by scanning, once, and then not again. */
.sc-keys {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .45rem;
}

.sc-keys li {
  display: grid;
  grid-template-columns: minmax(0, 8.5rem) 1fr;
  gap: .7rem;
  align-items: baseline;
}

.sc-keys kbd {
  justify-self: start;
  padding: .12rem .45rem;
  border: 1px solid var(--sc-edge);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .06);
  font: inherit;
  font-size: .82em;
  white-space: nowrap;
}

.sc.is-light-bg .sc-keys kbd { background: rgba(0, 0, 0, .05); }


/* ---------------------------------------------------------------------------
   Wheel, chance, sounds, reveal
   --------------------------------------------------------------------------- */

.sc-wheel {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  display: grid;
  place-items: center;
}

.sc-wheel__disc {
  /* Square, and as big as the smaller of the two sides allows. cqh would
     be neater but needs a container-type on the parent, and without one
     it silently falls back to the viewport -- a wheel taller than the
     widget it is in. */
  aspect-ratio: 1;
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  /* The pin is at the top, so the disc has to turn about its own middle
     or the whole arithmetic for landing on a slice is wrong. */
  transform-origin: 50% 50%;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .35));
}

.sc-wheel__empty { fill: none; stroke: var(--sc-edge); stroke-width: 2; }

.sc-wheel__label {
  fill: #fff;
  font-size: 7px;
  font-weight: 600;
  text-anchor: middle;
  dominant-baseline: middle;
  paint-order: stroke;
  stroke: rgba(0, 0, 0, .45);
  stroke-width: 1.6px;
}

/* The marker the wheel stops against. Pointing down into the disc from
   above, so what it indicates is the slice at twelve o'clock. */
.sc-wheel__pin {
  position: absolute;
  top: 0;
  left: 50%;
  width: 0;
  height: 0;
  margin-left: -9px;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-top: 16px solid var(--sc-accent);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .6));
}

.sc-wheel__out {
  font-size: clamp(1rem, 3vw, 1.8rem);
  font-weight: 600;
  line-height: 1.15;
  word-break: break-word;
  min-height: 1.2em;
  opacity: .7;
}
.sc-wheel__out.is-won { opacity: 1; }

.sc-chance__out {
  flex: 1;
  display: grid;
  place-items: center;
  font-size: clamp(1.6rem, 6vw, 4rem);
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.sc-chance__was {
  font-size: .78rem;
  opacity: .6;
  min-height: 1.1em;
  font-variant-numeric: tabular-nums;
}

.sc-sounds {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(5.5rem, 1fr));
  gap: .3rem;
}

.sc-sounds__one {
  border: 2px solid var(--sc-edge);
  border-radius: 10px;
  background: none;
  color: inherit;
  font: inherit;
  font-size: clamp(.72rem, 1.5vw, 1rem);
  cursor: pointer;
}
.sc-sounds__one:hover,
.sc-sounds__one:focus-visible { border-color: var(--sc-accent); }
.sc-sounds__one:active { transform: translateY(1px); }

.sc-reveal {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  border-radius: 10px;
  background: rgba(0, 0, 0, .25);
}

.sc-reveal__pic {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sc-reveal__tiles {
  position: absolute;
  inset: 0;
  display: grid;
  gap: 2px;
}

.sc-reveal__tile {
  border: 0;
  /* Opaque, not translucent: a tile you can see through is not hiding
     anything, which is the entire point of the widget. */
  background: #2b3340;
  color: rgba(255, 255, 255, .55);
  font: inherit;
  font-size: clamp(.7rem, 2vw, 1.4rem);
  font-weight: 600;
  cursor: pointer;
  transition: opacity .18s ease;
}
.sc-reveal__tile:hover { color: #fff; }
.sc-reveal__tile.is-open {
  opacity: 0;
  pointer-events: none;
}
/* Still reachable once it is open, so a tile taken off by accident can be
   put back -- but only from the keyboard, since clicking through an
   invisible tile would be worse. */
.sc-reveal__tile.is-open:focus-visible {
  opacity: .35;
  pointer-events: auto;
}

.sc.is-light-bg .sc-reveal__tile { background: #cfd6e0; color: rgba(0, 0, 0, .55); }
.sc.is-light-bg .sc-reveal__tile:hover { color: #000; }

@media (prefers-reduced-motion: reduce) {
  .sc-reveal__tile { transition: none; }
  .sc-wheel__disc { transition: none !important; }
}


/* ---------------------------------------------------------------------------
   Customising the board
   --------------------------------------------------------------------------- */

/* Lettering. Only families a browser already has: the site's CSP allows
   fonts from itself and nowhere else, so a web font would have to be
   downloaded into the repo, and none of these is worth 80KB on a school
   connection. "Rounded" is genuinely rounded on Apple devices and falls
   back to the plain stack elsewhere, which is honest rather than ideal. */
.sc.is-font-rounded { font-family: ui-rounded, "Segoe UI Variable", var(--ff-sans); }
.sc.is-font-serif { font-family: ui-serif, Georgia, "Times New Roman", serif; }
.sc.is-font-mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }

/* The writing inside every widget, as one multiplier. Widget text is set
   in clamp()s off the root size, so this reaches all of it at once
   instead of needing a rule per widget. */
.sc.is-scale-big .sc-w { font-size: 1.22em; }

/* How solid a widget looks over the background. "Clear" is for a board
   with a photograph behind it, where a row of solid cards hides the
   picture the teacher chose.

   Done by redefining the panel colour rather than by mixing it with
   transparent: color-mix() has no fallback, and on a browser that does
   not know it the declaration is dropped and the card has no background
   at all -- white text on a photograph. A projector in a school is the
   last place to find out. */
.sc.is-card-soft { --sc-panel: rgba(16, 20, 28, 0.5); }
.sc.is-card-soft.is-light-bg { --sc-panel: rgba(255, 255, 255, 0.6); }
.sc.is-card-clear { --sc-panel: rgba(16, 20, 28, 0.24); }
.sc.is-card-clear.is-light-bg { --sc-panel: rgba(255, 255, 255, 0.32); }
.sc.is-card-clear .sc-w { box-shadow: none; }

/* Corners. The grip and the head sit inside the card, which clips them,
   so only the card itself needs the radius. */
.sc.is-corner-sharp .sc-w { border-radius: 3px; }
.sc.is-corner-round .sc-w { border-radius: 26px; }

/* A board with the names turned off. The head stays — it is what a widget
   is dragged by, and the buttons live in it — but it shrinks to the tools
   and the name goes. */
.sc.is-untitled .sc-w__name { display: none; }
.sc.is-untitled .sc-w__head { justify-content: flex-end; padding: 0.15rem 0.3rem; }

/* A widget's own colour. Set as --sc-tint on the card by the script, so
   the head, the border and the name all follow one value. */
/* The script sets --sc-tint-rgb to three numbers rather than a colour, so
   these can be written as rgba() and work everywhere. */
.sc-w.has-tint {
  border-color: rgba(var(--sc-tint-rgb), 0.7);
}
.sc-w.has-tint > .sc-w__head {
  background: rgba(var(--sc-tint-rgb), 0.3);
  border-bottom-color: rgba(var(--sc-tint-rgb), 0.6);
}
.sc-w.has-tint > .sc-w__head > .sc-w__name { opacity: 0.95; }

.sc-tints {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.sc-tint {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}
.sc-tint[aria-pressed="true"] { border-color: var(--sc-ink); }

/* "None" has no colour to show, so it shows the absence of one. */
.sc-tint--none {
  background:
    linear-gradient(45deg, transparent 44%, var(--sc-ink) 44%,
                    var(--sc-ink) 56%, transparent 56%),
    var(--sc-panel);
  opacity: 0.7;
}


/* ---------------------------------------------------------- quickfire */
/* The question has to be readable from the back of a room, so it scales
   with the board rather than sitting at a fixed size. In vw, not cqw:
   nothing here sets a container-type, and a container unit without one
   falls back to the viewport silently -- it would look right on a laptop
   and wrong on the projector, which is the worst way round. */
.sc-sum__ask {
  flex: 1;
  display: grid;
  place-items: center;
  font-size: clamp(1.5rem, 5.5vw, 4.5rem);
  font-weight: 700;
  line-height: 1.05;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.sc-sum__got {
  font-size: clamp(1.1rem, 3.4vw, 2.8rem);
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  font-variant-numeric: tabular-nums;
  /* Dim until it is asked for: a greyed-out question mark reads as "not
     yet", where an empty space reads as a widget that has not loaded. */
  opacity: .35;
}

.sc-sum__got.is-open {
  opacity: 1;
  color: var(--sc-accent);
}

.sc-sum__tally { text-align: center; font-size: .78rem; }
