/* VidaVue dashboard styles.

   Three screens share one column: the camera lens (start, countdown,
   recording) and the review of one finished session. Dark is the default
   surface -- true black behind a soft-grey lens frame -- and light is its own
   selected set of steps, not an invert. Two faces: Fraunces for the few
   things that carry the name (wordmark, session number, countdown, score,
   panel titles), Manrope for everything read.

   Chart series and status colours were validated against both surfaces with
   the dataviz palette validator -- keep the values, change nothing else.

   The one memorable element is the lens: the preview sits in a padded frame
   like a viewfinder. Everything else stays quiet: one accent hue, borders
   that mean something, no glow, no gradients. */

/* Bundled, never fetched: the app runs local-only and makes no external
   requests. Latin subsets of the variable fonts (SIL OFL, licences beside
   the files). */
@font-face {
  font-family: "Fraunces";
  src: url("/static/fonts/Fraunces.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("/static/fonts/Fraunces-Italic.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Manrope";
  src: url("/static/fonts/Manrope.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Manrope", system-ui, sans-serif;

  --bg: #000000;
  --surface: #101211;
  --surface-2: #161a18;
  --surface-3: #1c211e;
  --line: #232725;
  --line-soft: #1a1e1c;

  --text-primary: #eef2ef;
  --text-secondary: #b5c0ba;
  --muted: #7f8c85;

  --accent: #5fd3b3;
  --accent-ink: #8fe3cb;

  /* Categorical series, validated on surface #101211 (dark) and #ffffff
     (light) with the dataviz palette validator. Posture takes the accent
     hue, but the accent itself (#5fd3b3, OKLCH L 0.79) sits above the dark
     lightness band for a chart line, and no mint separates from the old
     green attention colour (#199e70) -- same hue family, normal-vision
     ΔE < 15. So posture is the nearest in-band mint and attention moved to
     the blue that posture used to have: ΔE 19 normal / 18 protan. */
  --series-1: #35ab8d; /* posture */
  --series-3: #3987e5; /* attention */

  /* Reserved status palette — quality levels, always label-paired. */
  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-serious: #ec835a;
  --status-critical: #d03b3b;
  --success-text: #35c435;
  --alert-ink: #fab219;

  --grid: #1a1e1c;
  --axis: #2e3532;

  --radius: 20px;
  --radius-sm: 12px;
  --radius-lens: 28px;

  /* Primary button: mint fill, dark text (10.5:1). */
  --accent-strong: #5fd3b3;
  --accent-hover: #79dcc1;
  --btn-ink: #06110d;

  /* Text over the camera preview (always a dark surface, both themes). */
  --overlay-bg: rgb(0 0 0 / 55%);
  --overlay-ink: #eef2ef;
  --overlay-muted: rgb(238 242 239 / 72%);
  --overlay-line: rgb(255 255 255 / 12%);

  /* Live-row tier borders: the review's status palette, but the warning
     and good steps darkened in light mode so they clear 3:1 on white. */
  --tier-good: var(--status-good);
  --tier-warning: var(--status-warning);
  --tier-critical: var(--status-critical);
  --dot: 9px;
}

@media (prefers-color-scheme: light) {
  :root:where(:not([data-theme="dark"])) {
    color-scheme: light;

    --bg: #f7f8f7;
    --surface: #ffffff;
    --surface-2: #eef1ef;
    --surface-3: #e4e9e6;
    --line: #dce2de;
    --line-soft: #e8ece9;

    --text-primary: #0e1512;
    --text-secondary: #4a5650;
    --muted: #66736d;

    --accent: #1f9a7b;
    --accent-ink: #167a61;

    --series-1: #1f9a7b;
    --series-3: #2a78d6;

    --success-text: #0a7a0a;
    --alert-ink: #8a5a00;

    --tier-good: #0a8a0a;
    --tier-warning: #b87d00;

    --grid: #e4e8e5;
    --axis: #c4cbc7;

    /* Primary button: white on the deeper mint (3.5:1). */
    --accent-strong: #1f9a7b;
    --accent-hover: #24a785;
    --btn-ink: #ffffff;
  }
}

:root[data-theme="light"] {
  color-scheme: light;

  --bg: #f7f8f7;
  --surface: #ffffff;
  --surface-2: #eef1ef;
  --surface-3: #e4e9e6;
  --line: #dce2de;
  --line-soft: #e8ece9;

  --text-primary: #0e1512;
  --text-secondary: #4a5650;
  --muted: #66736d;

  --accent: #1f9a7b;
  --accent-ink: #167a61;

  --series-1: #1f9a7b;
  --series-3: #2a78d6;

  --success-text: #0a7a0a;
  --alert-ink: #8a5a00;

  --tier-good: #0a8a0a;
  --tier-warning: #b87d00;

  --grid: #e4e8e5;
  --axis: #c4cbc7;

  /* Primary button: white on the deeper mint (3.5:1). */
  --accent-strong: #1f9a7b;
  --accent-hover: #24a785;
  --btn-ink: #ffffff;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }
h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- buttons ---------- */

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary { background: var(--accent-strong); color: var(--btn-ink); }
.btn-primary:not(:disabled):hover { background: var(--accent-hover); }

.btn-secondary {
  background: transparent;
  border-color: var(--line);
  color: var(--text-primary);
}
.btn-secondary:not(:disabled):hover { border-color: var(--accent); }

.btn-danger {
  background: transparent;
  border-color: var(--status-critical);
  color: var(--text-primary);
}
.btn-danger:not(:disabled):hover { background: var(--status-critical); color: #fff; }

.icon-btn {
  appearance: none;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  flex: none;
}
.icon-btn:hover { color: var(--text-primary); border-color: var(--accent); }
.icon-btn svg { width: 17px; height: 17px; }

/* ---------- shell ---------- */

.main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 36px 32px 64px;
  min-width: 0;
}

.topbar {
  position: relative;
  text-align: center;
  margin-bottom: 28px;
  min-height: 60px;
}

.topbar-title { display: grid; gap: 8px; justify-items: center; }

.brand {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1;
}
.brand-vue { color: var(--accent); font-style: italic; }

.tagline { color: var(--muted); font-size: 14px; }

.topbar-controls {
  position: absolute;
  top: 4px;
  right: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar-sessions { padding: 8px 16px 8px 13px; }
.topbar-sessions svg { width: 16px; height: 16px; }
.topbar-sessions[hidden], body.has-sidebar .topbar-sessions, .topbar-auth[hidden] { display: none; }
.topbar-auth { padding: 8px 18px; }
/* The Log in / Sign up pair: in the header, or in the live row while
   recording (session.js moves it), where it is smaller. */
.topbar-auth-group { display: inline-flex; align-items: center; gap: 10px; }
.live-head .topbar-auth { padding: 6px 14px; font-size: 13px; }
/* Logged in: "Welcome, <name>", one line, cut with an ellipsis if long. */
.topbar-welcome {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
}
.topbar-welcome[hidden] { display: none; }
@media (max-width: 600px) {
  .topbar-sessions { padding: 8px 12px; font-size: 13px; }
}

/* Recording: the page header folds into the live row (wordmark chip on the
   left, theme toggle by the clock) so the lens and the five state rows
   share one viewport at 1440x830. */
body.is-recording .main { padding-top: 22px; padding-bottom: 24px; }
body.is-recording .topbar { display: none; }
/* Phone: no room for the buttons beside a centred wordmark, so the header
   becomes a row, wordmark left and buttons right. */
@media (max-width: 600px) {
  .main .topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left; }
  .topbar-title { justify-items: start; }
  .brand { font-size: 32px; }
  .tagline { display: none; }
  .topbar-controls { position: static; }
}

.live-brand {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1;
  padding: 8px 16px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-primary);
}
.live-head > .icon-btn { margin-left: 4px; }

/* ---------- live: setup, countdown, recording ---------- */

.live { display: grid; gap: 16px; justify-items: center; }

/* Recording breaks out of the 1080px review column: the picture and the
   five states are the whole job of that screen, so they take the width. */
.live:not(.is-setup) {
  width: min(1720px, calc(100vw - 48px));
  position: relative;
  left: 50%;
  transform: translateX(-50%);
}

/* Recording fills the viewport height: the lens takes the height left under
   the live row (16:9, so its width follows), and the state rows stretch to
   the same height. --live-chrome is the header row plus page padding. */
.live:not(.is-setup) .live-body {
  --live-chrome: 124px; /* 22 top + 46 live row + 16 gap + 24 bottom, rounded up */
  grid-template-columns: auto minmax(380px, 1fr);
  align-items: stretch;
  /* When the lens is width-bound (16:10 laptops) the leftover height is
     split above and below instead of piling up at the bottom. */
  min-height: calc(100vh - var(--live-chrome));
  align-content: center;
}
.live:not(.is-setup) .live-video {
  height: min(calc(100vh - var(--live-chrome)), calc((100vw - 48px - 420px) * 9 / 16));
  width: auto;
  aspect-ratio: 16 / 9;
  max-width: 100%;
}
/* With the Breaks column: breaks | picture | detectors. The picture gives
   up the breaks column's width (260 px + a 20 px gap). */
.live:not(.is-setup) .live-body.has-breaks {
  grid-template-columns: minmax(220px, 260px) auto minmax(340px, 1fr);
}
.live:not(.is-setup) .live-body.has-breaks .live-video {
  height: min(calc(100vh - var(--live-chrome)), calc((100vw - 48px - 420px - 280px) * 9 / 16));
}
.live:not(.is-setup) .live-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 100%;
}
.live:not(.is-setup) .live-metrics {
  flex: 1;
  grid-auto-rows: 1fr;
}

.live-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 4px;
}

.live-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 15.5px;
  font-weight: 600;
}

.live-dot {
  width: var(--dot);
  height: var(--dot);
  border-radius: 50%;
  background: var(--muted);
  flex: none;
}

.live-dot.is-live {
  background: var(--accent);
  box-shadow: 0 0 0 0 rgb(95 211 179 / 55%);
  animation: live-pulse 1.6s ease-out infinite;
}

@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgb(95 211 179 / 55%); }
  100% { box-shadow: 0 0 0 9px rgb(95 211 179 / 0%); }
}

.live-clock {
  margin-left: auto;
  font-size: 17px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

/* Recording: preview beside the five states, the pair as wide as the review. */
.live-body {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(360px, 1fr);
  gap: 20px;
  align-items: start;
}

/* The lens: a padded frame around the picture. Every child shares the one
   grid cell, so the picture, the camera-off note and the countdown overlay
   all sit inside the same 20px-rounded window; the chips and toggle are
   offset by the frame's padding. */
.live-video {
  --lens-pad: 10px;
  --lens-inner: 20px;
  position: relative;
  padding: var(--lens-pad);
  border: 1px solid var(--line);
  border-radius: var(--radius-lens);
  background: var(--surface);
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
}
.live-video::before {
  content: "";
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  border-radius: var(--lens-inner);
  background: #050605;
}
.live-video > * { grid-area: 1 / 1; }

/* Pinned to the same box as the countdown overlay (inset by the lens
   padding), not sized by the grid: a camera frame larger than the lens
   used to overflow the grid cell and slide out from under the blur. */
.live-video img,
.live-video video {
  position: absolute;
  top: var(--lens-pad);
  left: var(--lens-pad);
  /* Explicit, not auto: a replaced element with auto size would take the
     camera's intrinsic pixels instead of the box. */
  width: calc(100% - 2 * var(--lens-pad));
  height: calc(100% - 2 * var(--lens-pad));
  display: block;
  object-fit: cover;
  border-radius: var(--lens-inner);
  overflow: hidden;
}
.live-video > * { min-width: 0; min-height: 0; }

.camera-error {
  max-width: 34ch;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--overlay-ink);
  padding: 10px 14px;
  border: 1px solid var(--status-warning);
  border-radius: var(--radius-sm);
  background: rgb(0 0 0 / 80%);
}

.live-video-off {
  color: var(--overlay-muted);
  font-size: 13px;
  text-align: center;
  padding: 0 16px;
}

.camera-toggle {
  position: absolute;
  top: calc(var(--lens-pad) + 14px);
  right: calc(var(--lens-pad) + 14px);
  z-index: 3;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  appearance: none;
  border: 1px solid var(--overlay-line);
  border-radius: 50%;
  background: var(--overlay-bg);
  color: var(--overlay-ink);
  cursor: pointer;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.camera-toggle svg { width: 17px; height: 17px; }
.camera-toggle:hover { background: rgb(0 0 0 / 75%); }
.camera-toggle.is-off { color: var(--overlay-muted); }
.camera-toggle.is-off #previewOffSlash { stroke: var(--status-critical); }
/* The countdown covers the preview; a toggle for a hidden picture is noise. */
.live-video:has(.session-overlay:not([hidden])) .camera-toggle { display: none; }

/* Start screen: the session's id, top-left inside the picture. */
.video-chips {
  position: absolute;
  top: calc(var(--lens-pad) + 14px);
  left: calc(var(--lens-pad) + 16px);
  z-index: 3;
  display: flex;
  gap: 8px;
}
.video-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 7px 14px 8px;
  border-radius: 999px;
  border: 1px solid var(--overlay-line);
  background: var(--overlay-bg);
  color: var(--overlay-muted);
  font-size: 13px;
  font-weight: 500;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.session-chip #sessionIdValue {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  line-height: 1;
  color: var(--overlay-ink);
}

/* Start screen: Start along the foot of the picture, on its own, with a
   soft shadow so it sits on any camera background. */
.lens-start {
  position: absolute;
  left: var(--lens-pad);
  right: var(--lens-pad);
  bottom: calc(var(--lens-pad) + 22px);
  z-index: 3;
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.lens-start[hidden] { display: none; }
.lens-start .btn {
  pointer-events: auto;
  min-height: 52px;
  padding: 14px 34px;
  font-size: 16px;
  font-weight: 700;
  gap: 12px;
  box-shadow: 0 10px 34px rgb(0 0 0 / 40%), 0 0 0 1px rgb(255 255 255 / 10%) inset;
}
.lens-start .btn svg { width: 16px; height: 16px; fill: currentColor; }
.live-video:has(.session-overlay:not([hidden])) .lens-start { display: none; }
@media (max-width: 600px) {
  .lens-start { bottom: calc(var(--lens-pad) + 12px); }
  .lens-start .btn { min-height: 46px; padding: 12px 26px; font-size: 15px; }
}

/* Recording: one instruction along the foot of the preview. */
.live-caption {
  position: absolute;
  left: var(--lens-pad);
  right: var(--lens-pad);
  bottom: var(--lens-pad);
  z-index: 3;
  padding: 9px 14px;
  border-radius: 0 0 var(--lens-inner) var(--lens-inner);
  background: linear-gradient(to top, rgb(0 0 0 / 85%), rgb(0 0 0 / 0%));
  color: var(--overlay-ink);
  font-size: 12.5px;
  text-align: center;
}

/* Right column: nudges above the five state rows. */
.live-side { display: grid; gap: 14px; align-content: start; min-width: 0; }

.live-nudges { display: grid; gap: 8px; }
/* Whether nudges can reach another window, with a one-click fix. */
.notify-btn { border: 1px solid var(--line); background: none; color: var(--text-primary); border-radius: 999px; padding: 3px 12px; font: inherit; font-weight: 600; cursor: pointer; }
.notify-btn:hover { border-color: var(--accent); }
.notify-btn[hidden] { display: none; }
.notify-control[hidden] { display: none; }
.notify-help { flex-basis: 100%; margin: 2px 0 0; font-size: 12.5px; line-height: 1.45; color: var(--text-secondary); text-align: center; }
.notify-help[hidden] { display: none; }
/* On the start screen it sits under the two cards, centred. */
.live-nudges:empty { display: none; }

.live-nudge {
  display: grid;
  gap: 3px;
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--alert-ink);
  border-radius: var(--radius);
  background: var(--surface);
  animation: nudge-in 0.25s ease-out;
}
@keyframes nudge-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}
.live-nudge-module { font-size: 12.5px; color: var(--muted); }
.live-nudge-text { font-size: 14.5px; color: var(--text-primary); line-height: 1.4; }

.live-metrics {
  display: grid;
  gap: 10px;
  grid-auto-rows: auto;
}

/* One row per detector: name left, state right, nothing else. The tier
   lives in the left border and the state colour, the same language as
   the nudge strip. */
.live-row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  padding: 12px 22px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--muted);
  border-radius: var(--radius);
  background: var(--surface);
}
.live-row.is-good { border-left-color: var(--tier-good); }
.live-row.is-fair { border-left-color: var(--tier-warning); }
.live-row.is-bad { border-left-color: var(--tier-critical); }
.live-row.is-neutral { border-left-color: var(--line); }

.live-row-name { font-size: clamp(16px, 1.15vw, 21px); font-weight: 650; flex: 1; }

.live-row-value {
  display: grid;
  gap: 2px;
  justify-items: end;
  text-align: right;
  min-width: 0;
}
.live-row-state { font-weight: 650; font-size: clamp(18px, 1.35vw, 25px); }
.live-row.is-alert .live-row-state { color: var(--alert-ink); }
.live-row.is-neutral .live-row-state { color: var(--text-secondary); }

/* "Breaks": a column left of the picture while recording -- what the
   camera has seen of drinks, stretches and eye rests, then the next
   reminder. Plain tiles: these are times, not verdicts. */
.live-breaks { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.live-breaks[hidden] { display: none; }
.live.is-setup .live-breaks { display: none; }
.live-breaks-title {
  margin: 0;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.live-breaks-rows { display: grid; gap: 12px; flex: 1; grid-auto-rows: 1fr; }
.break-tile {
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  min-width: 0;
}
.break-name { font-size: clamp(15px, 1vw, 18px); font-weight: 650; }
.break-value { font-size: clamp(15px, 1.05vw, 19px); color: var(--text-secondary); }
.break-tile.is-next { border-color: var(--accent); }
.break-tile.is-next .break-value { color: var(--text-primary); font-weight: 650; }

/* Start screen and countdown: the preview on the left with Start inside it,
   and a column beside it -- the reminders, a guest's way in with a code,
   and desktop notifications at the foot -- so the whole screen fits one
   desktop viewport (1440x900 and 1280x720) with nothing to scroll to. */
.live.is-setup .live-head { display: none; }
.live.is-setup .live-side { display: none; }
.main:has(.live.is-setup:not([hidden])) { max-width: 1480px; }
.live.is-setup .live-body {
  grid-template-columns: minmax(0, 1fr) 420px;
  grid-template-rows: auto auto auto;
  align-items: start;
  justify-items: stretch;
  gap: 14px 24px;
}
/* The start form's parts are placed on this grid directly: the guest's
   bar under the lens, the panel beside both, any camera notice below. */
.live.is-setup .session-start { display: contents; }
.session-start[hidden] { display: none !important; }
/* As wide as the column allows, but never taller than what is left of the
   viewport under the header. */
.live.is-setup .live-video {
  grid-column: 1;
  grid-row: 1;
  width: min(100%, calc((100vh - 250px) * 16 / 9));
  height: auto;
  max-height: none;
  aspect-ratio: 16 / 9;
  justify-self: center;
}
.live.is-setup .reminders { grid-column: 2; grid-row: 1; align-self: stretch; }
.live.is-setup .session-start > .camera-error { grid-column: 1; grid-row: 2; justify-self: center; }

/* Countdown: the grid stays exactly as it was, so nothing reflows. The
   panel and the guest's bar fade, and the lens slides half the width of
   the empty column (420 px + the 24 px gap, over 2) into the middle of the
   page -- a transform, so it runs on the compositor and cannot stutter or
   collapse. Cancel slides it back. */
.live.is-setup .live-video { transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1); }
.live.is-setup .session-start > * { transition: opacity 0.3s ease; }
.live.is-countdown .live-video { transform: translateX(222px); }
.live.is-countdown .session-start > * { opacity: 0; pointer-events: none; }
@media (max-width: 960px) {
  .live.is-countdown .live-video { transform: none; }
}

/* Countdown: the number over the preview, which stays visible but blurred. */
.session-overlay {
  position: absolute;
  inset: var(--lens-pad);
  z-index: 2;
  display: grid;
  align-content: center;
  border-radius: var(--lens-inner);
  overflow: hidden;
  background: rgb(0 0 0 / 45%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--overlay-ink);
}

.session-start { text-align: center; }
.session-start .camera-error { color: var(--text-primary); background: var(--surface); }


/* Countdown: one number, one instruction, a real Cancel button. */
.session-countdown {
  display: grid;
  gap: 14px;
  justify-items: center;
  align-self: center;
  justify-self: center;
  padding: 16px;
  text-align: center;
}

.countdown-label { font-size: 13px; color: var(--overlay-muted); }

.countdown-number {
  font-family: var(--font-display);
  font-size: 72px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--overlay-ink);
}

.countdown-hint {
  max-width: 34ch;
  font-size: 13px;
  line-height: 1.45;
  color: var(--overlay-muted);
}

.session-countdown .btn-secondary {
  background: rgb(255 255 255 / 8%);
  border-color: rgb(255 255 255 / 22%);
  color: var(--overlay-ink);
}
.session-countdown .btn-secondary:hover { border-color: var(--accent-ink); }

@media (max-width: 960px) {
  .live-body { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .live-head { flex-wrap: wrap; gap: 12px; }
  .session-start { grid-template-columns: 1fr; }
}

/* ---------- review: hero ---------- */

.review { display: grid; gap: 16px; }

.hero {
  display: grid;
  gap: 6px;
  justify-items: center;
  text-align: center;
  padding: 26px 20px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.gauge { position: relative; width: 240px; }
.gauge svg { display: block; width: 100%; height: auto; overflow: visible; }

.gauge-track,
.gauge-arc {
  fill: none;
  stroke-width: 14;
  stroke-linecap: round;
}
.gauge-track { stroke: var(--surface-3); }
.gauge-arc {
  stroke: var(--status-good);
  stroke-dasharray: 0 100;
  transition: stroke-dasharray 1s cubic-bezier(0.22, 1, 0.36, 1), stroke 0.3s ease;
}
.gauge-arc.is-good { stroke: var(--status-good); }
.gauge-arc.is-fair { stroke: var(--status-warning); }
.gauge-arc.is-bad { stroke: var(--status-critical); }

.gauge-value {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  justify-items: center;
  gap: 0;
}

.hero-number {
  font-family: var(--font-display);
  font-size: 64px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.hero-number.is-good { color: var(--success-text); }
.hero-number.is-fair { color: var(--alert-ink); }
.hero-number.is-bad { color: var(--status-critical); }

.hero-outof { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

.hero-verdict { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; margin-top: 12px; }
.hero-meta { color: var(--muted); font-size: 13px; }

/* Against the previous session: a mark in the tier colour, then one or two
   plain sentences. */
.hero-compare {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 7px 14px 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: 13.5px;
  line-height: 1.4;
  text-align: left;
}
.hero-compare[hidden] { display: none; }
.compare-mark {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex: none;
  color: var(--btn-ink);
}
.compare-mark svg { width: 13px; height: 13px; }
.compare-mark.is-up { background: var(--status-good); color: #fff; }
.compare-mark.is-down { background: var(--status-serious); color: #fff; }
.compare-mark.is-same { background: var(--surface-3); color: var(--text-secondary); }

/* ---------- review: five metric cards ---------- */

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

/* Review: "Breaks you took" -- four counts and the longest unbroken sit. */
.breaks-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px 18px;
}
.breaks-title { margin: 0 0 12px; font-size: 15px; font-weight: 650; }
.breaks-counts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.breaks-count { display: grid; gap: 2px; }
.breaks-number {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.breaks-label { color: var(--text-secondary); font-size: 13px; }
.breaks-longest { margin: 14px 0 0; color: var(--text-secondary); font-size: 14px; }

/* Review: "Your reminders this session" -- a thumbs up / down on each one. */
.votes-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px 10px;
}
.votes-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.votes-head .breaks-title { margin-bottom: 6px; }
.votes-note { margin: 0 0 6px; color: var(--text-secondary); font-size: 13px; }
.votes-list { list-style: none; margin: 0; padding: 0; }
.vote-row {
  display: grid;
  grid-template-columns: 68px 130px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.vote-row:first-child { border-top: 0; }
.vote-when { color: var(--text-secondary); font-size: 13px; font-variant-numeric: tabular-nums; }
.vote-what { font-size: 13px; font-weight: 600; }
.vote-text { font-size: 14px; color: var(--text-primary); }
.vote-buttons, .msg-vote { display: inline-flex; gap: 4px; }
.vote-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}
.vote-btn:hover { color: var(--text-primary); background: var(--surface-2); }
.vote-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.vote-btn[aria-pressed="true"][data-vote="up"] { color: var(--accent-ink); border-color: var(--accent); background: var(--surface-2); }
.vote-btn[aria-pressed="true"][data-vote="down"] { color: var(--alert-ink); border-color: var(--alert-ink); background: var(--surface-2); }
.votes-error { margin: 4px 0 8px; color: var(--alert-ink); font-size: 13px; }
.msg-vote { align-self: flex-start; margin: -4px 0 2px 4px; }

/* Review: "Download data (CSV)" and the link to what the columns mean. */
.export-line { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 4px; }
.export-line .btn { display: inline-flex; align-items: center; gap: 8px; }
.export-help { color: var(--text-secondary); font-size: 14px; }
.export-help:hover { color: var(--text-primary); }
.export-error { color: var(--alert-ink); font-size: 13px; }
.msg-vote .vote-btn { width: 28px; height: 28px; }

.metric {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 16px 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  min-width: 0;
}

.metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.metric-name { font-size: 13.5px; font-weight: 650; }

.metric-value {
  font-size: 32px;
  font-weight: 720;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.metric-value .unit { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 3px; letter-spacing: 0; }

.metric-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.metric-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  width: 0;
  transition: width 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.metric-bar i.is-good { background: var(--status-good); }
.metric-bar i.is-fair { background: var(--status-warning); }
.metric-bar i.is-bad { background: var(--status-critical); }
.metric-bar i.is-neutral { background: var(--accent); }

.metric-sentence { color: var(--text-secondary); font-size: 12.5px; line-height: 1.45; }

.status-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  color: #06110d;
  white-space: nowrap;
  flex: none;
}
.status-pill.is-good { background: var(--status-good); }
.status-pill.is-fair { background: var(--status-warning); }
.status-pill.is-bad { background: var(--status-critical); color: #fff; }

@media (max-width: 960px) { .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 600px) { .metrics { grid-template-columns: 1fr 1fr; } }

/* ---------- review: session facts ---------- */

.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.fact {
  display: grid;
  gap: 2px;
  padding: 14px 18px;
  border-left: 1px solid var(--line-soft);
}
.fact:first-child { border-left: 0; }

.fact-label { color: var(--muted); font-size: 12.5px; }
.fact-value {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.fact-value .unit { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 3px; letter-spacing: 0; }
.fact-note { color: var(--text-secondary); font-size: 12.5px; }
.fact-note.is-alert { color: var(--alert-ink); }

@media (max-width: 600px) {
  .facts { grid-template-columns: 1fr; }
  .fact { border-left: 0; border-top: 1px solid var(--line-soft); }
  .fact:first-child { border-top: 0; }
}

/* ---------- review: charts ---------- */

.charts {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: 12px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px 18px;
  min-width: 0;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.chart { width: 100%; height: 240px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }

.chart-note {
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 0 12px;
}

.legend { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.legend-swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }

/* Two stacked share bars with their own rows underneath. */
.shares { display: grid; gap: 18px; }

.share { display: grid; gap: 10px; }
.share-title { font-size: 13px; font-weight: 650; color: var(--text-secondary); }
.share-bar { display: flex; gap: 2px; height: 14px; border-radius: 999px; overflow: hidden; }
.share-bar i { display: block; height: 100%; min-width: 2px; }
.share-bar i:first-child { border-radius: 999px 0 0 999px; }
.share-bar i:last-child { border-radius: 0 999px 999px 0; }
.share-bar i:only-child { border-radius: 999px; }
.share-bar i.is-empty { min-width: 0; }

.share-rows { display: grid; gap: 4px; }

.share-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-secondary);
}
.share-row .legend-swatch { width: 9px; height: 9px; }
.share-row-value {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  font-weight: 600;
}
.share-row-time { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }
.share-row.is-zero { color: var(--muted); }
.share-row.is-zero .share-row-value { color: var(--muted); font-weight: 500; }

@media (max-width: 900px) { .charts { grid-template-columns: 1fr; } }

/* ---------- after the review: what next, and the closing card ---------- */

.review-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 22px;
}
.review-actions[hidden] { display: none; }
.review-actions .btn { padding: 13px 26px; font-size: 15px; font-weight: 700; gap: 10px; }
.review-actions .btn-primary svg { width: 16px; height: 16px; }

/* ---------- empty / placeholder ---------- */

.empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  display: grid;
  place-items: center;
  min-height: 40vh;
  text-align: center;
  padding: 24px;
  font-size: 14px;
  line-height: 1.6;
}
.empty p { max-width: 46ch; }

/* ---------- tooltip ---------- */

.tooltip {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  font-size: 12.5px;
  color: var(--text-primary);
  box-shadow: 0 10px 28px rgb(0 0 0 / 35%);
  max-width: 240px;
  font-variant-numeric: tabular-nums;
}
.tooltip .tt-title { color: var(--muted); margin-bottom: 4px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 6px; }
.tooltip .tt-swatch { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.tooltip .tt-value { margin-left: auto; font-weight: 650; }

/* ---------- toasts ---------- */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(360px, calc(100vw - 32px));
}

.toast {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--alert-ink);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-primary);
  box-shadow: 0 10px 28px rgb(0 0 0 / 35%);
  opacity: 1;
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.toast.is-leaving { opacity: 0; transform: translateY(6px); }

/* ---------- chat: launcher + side sheet ---------- */

.chat-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
  box-shadow: 0 10px 28px rgb(0 0 0 / 25%);
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.chat-fab svg { width: 22px; height: 22px; }
.chat-fab:hover { border-color: var(--accent); transform: translateY(-1px); }

/* After the prompt card or the sheet is closed, the launcher pulses twice
   and keeps a short label for a few seconds, so it is obvious where the
   chat went. */
.chat-fab.is-pulse { animation: fab-pulse 1.8s ease-out 2; }
@keyframes fab-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent), 0 10px 28px rgb(0 0 0 / 25%); }
  100% { box-shadow: 0 0 0 14px transparent, 0 10px 28px rgb(0 0 0 / 25%); }
}
.chat-fab-label {
  position: fixed;
  right: 84px;
  bottom: 34px;
  z-index: 40;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 12.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  animation: chat-in 0.3s ease;
}

/* The one thing that appears by itself: a small card above the launcher,
   once, when the session that was just recorded is on screen. */
.chat-nudge {
  position: fixed;
  right: 22px;
  bottom: 86px;
  z-index: 45;
  width: min(300px, calc(100vw - 44px));
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 18px 40px -16px rgb(0 0 0 / 55%);
  animation: chat-in 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.chat-nudge h3 { font-family: var(--font-display); font-size: 16px; font-weight: 500; }
.chat-nudge p { font-size: 13px; line-height: 1.5; color: var(--text-secondary); }
.chat-nudge-actions { display: flex; gap: 8px; }
.chat-nudge-actions .btn { padding: 8px 14px; font-size: 13px; }

@media (prefers-reduced-motion: reduce) {
  .chat-fab.is-pulse, .chat-fab-label, .chat-nudge { animation: none; }
}

/* A full-height sheet docked to the right edge. It never overlaps its own
   launcher: the launcher hides while the sheet is open, and the close button
   lives in the sheet's header. */
.chat {
  position: fixed;
  top: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  width: min(400px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 24px 60px -20px rgb(0 0 0 / 55%);
  overflow: hidden;
  animation: chat-in 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes chat-in {
  from { opacity: 0; transform: translateX(18px); }
  to { opacity: 1; transform: translateX(0); }
}

.chat-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 16px 14px 20px;
  border-bottom: 1px solid var(--line-soft);
}
.chat-head-text { flex: 1; display: grid; gap: 2px; min-width: 0; }
.chat-head h2 { font-family: var(--font-display); font-size: 17px; font-weight: 500; }
.chat-privacy { color: var(--muted); font-size: 12px; }

.chat-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-empty {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  max-width: 32ch;
  margin: auto;
  text-align: center;
}

.msg {
  padding: 10px 14px;
  font-size: 13.5px;
  line-height: 1.5;
  max-width: 88%;
  border-radius: 16px;
  word-wrap: break-word;
}
.msg.user {
  align-self: flex-end;
  background: var(--accent-strong);
  color: var(--btn-ink);
  border-bottom-right-radius: 5px;
}
.msg.bot {
  align-self: flex-start;
  background: var(--surface-2);
  color: var(--text-primary);
  border-bottom-left-radius: 5px;
}
.msg-text { white-space: pre-wrap; }

.msg-typing { display: inline-flex; gap: 3px; vertical-align: middle; }
.msg-typing i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted);
  animation: msg-typing-bounce 1.1s infinite ease-in-out;
}
.msg-typing i:nth-child(2) { animation-delay: 0.15s; }
.msg-typing i:nth-child(3) { animation-delay: 0.3s; }

@keyframes msg-typing-bounce {
  0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 20px 12px;
}

.chip {
  appearance: none;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-secondary);
  font: inherit;
  font-size: 12.5px;
  padding: 6px 12px;
  cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--text-primary); }

.chat-form {
  display: flex;
  gap: 8px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--line-soft);
}

.chat-form input {
  flex: 1;
  min-width: 0;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-primary);
  font: inherit;
  font-size: 13.5px;
  padding: 9px 16px;
}
.chat-form input::placeholder { color: var(--muted); }
.chat-form .btn { padding: 9px 16px; }

/* ---------- start screen: reminder tiles ---------- */

/* The panel: a heading, then one row per reminder divided by hairlines,
   and desktop notifications as the last row. Rows share the lens's height
   when there is room. */
.start-card.reminders { display: flex; flex-direction: column; gap: 0; padding: 0; text-align: left; }
.reminders-head { display: grid; gap: 4px; padding: 24px 26px 20px; border-bottom: 1px solid var(--line-soft); text-align: center; }
.reminders-title { font-family: var(--font-display); font-size: 26px; font-weight: 500; letter-spacing: -0.01em; }
.reminders-sub { color: var(--muted); font-size: 13.5px; }
.reminder-tiles { flex: 1; display: grid; grid-auto-rows: minmax(84px, 1fr); min-width: 0; }

.reminder-tile {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 16px 26px;
  border-top: 1px solid var(--line-soft);
  min-width: 0;
  text-align: left;
}
.reminder-tiles .reminder-tile:first-child { border-top: 0; }
.reminder-icon {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 14px;
  background: rgb(95 211 179 / 12%);
  color: var(--accent);
  transition: background 0.15s ease, color 0.15s ease;
}
.reminder-icon svg { width: 21px; height: 21px; }
.reminder-text { display: grid; gap: 6px; min-width: 0; justify-items: start; }
.reminder-label { font-size: 16px; font-weight: 650; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.reminder-every { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13.5px; white-space: nowrap; }
.reminder-switch {
  appearance: none;
  width: 46px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  position: relative;
  cursor: pointer;
  transition: background 0.15s ease;
}
.reminder-switch i {
  position: absolute;
  top: 3px;
  left: 23px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--btn-ink);
  transition: left 0.15s ease;
}
.reminder-switch:focus { outline: none; }
.reminder-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.reminder-tile.is-off .reminder-icon { background: var(--surface-2); color: var(--muted); }
.reminder-tile.is-off .reminder-label { color: var(--text-secondary); font-weight: 600; }
.reminder-tile.is-off .reminder-switch { background: var(--surface-3); }
.reminder-tile.is-off .reminder-switch i { left: 3px; background: var(--muted); }
.reminder-tile.is-off .reminder-every { opacity: 0.6; }

/* The notifications row: the state with a dot, and one button. */
.reminders .notify-control { grid-template-columns: auto minmax(0, 1fr) auto; border-top: 1px solid var(--line-soft); }
.reminders .notify-control[hidden] { display: none; }
.notify-state { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--text-secondary); }
.notify-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: none; }
.notify-control[data-permission="granted"] .notify-state { color: var(--success-text); font-weight: 600; }
.notify-control[data-permission="granted"] .notify-state::before { background: var(--success-text); }
.notify-control[data-permission="denied"] .notify-state::before { background: var(--status-critical); }
.notify-control[data-permission="denied"] .reminder-icon { color: var(--status-critical); background: rgb(208 59 59 / 12%); }
.notify-control[data-permission="default"] .reminder-icon { background: var(--surface-2); color: var(--muted); }
.reminders .notify-btn { padding: 8px 16px; font-size: 13.5px; }
.reminders .notify-help { grid-column: 1 / -1; text-align: left; }

@media (prefers-color-scheme: light) {
  :root:where(:not([data-theme="dark"])) .reminder-icon { background: rgb(31 154 123 / 14%); }
  :root:where(:not([data-theme="dark"])) .reminder-tile.is-off .reminder-icon,
  :root:where(:not([data-theme="dark"])) .notify-control[data-permission="default"] .reminder-icon { background: var(--surface-2); }
}
:root[data-theme="light"] .reminder-icon { background: rgb(31 154 123 / 14%); }
:root[data-theme="light"] .reminder-tile.is-off .reminder-icon,
:root[data-theme="light"] .notify-control[data-permission="default"] .reminder-icon { background: var(--surface-2); }

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

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- start screen: the two cards ---------- */

.start-card {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 16px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  min-width: 0;
}
.start-card[hidden] { display: none; }
.card-label {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
/* ---------- dialogs: log in / sign up, sign out ---------- */

.modal {
  position: relative;
  width: min(92vw, 420px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: 0 30px 80px rgb(0 0 0 / 45%);
}
.modal::backdrop { background: rgb(0 0 0 / 55%); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.modal-body { display: grid; gap: 10px; padding: 28px 28px 22px; margin: 0; text-align: center; }
.modal-body[hidden] { display: none; }
.modal-title { font-family: var(--font-display); font-size: 26px; font-weight: 500; letter-spacing: -0.01em; }
.modal-sub { margin-bottom: 6px; color: var(--text-secondary); font-size: 13.5px; line-height: 1.5; }
/* Close: a red cross in the top-right corner. */
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgb(208 59 59 / 45%);
  border-radius: 50%;
  background: transparent;
  color: var(--status-critical);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.modal-close svg { width: 16px; height: 16px; }
.modal-close:hover { background: rgb(208 59 59 / 12%); border-color: var(--status-critical); }
.modal-actions { display: flex; justify-content: center; gap: 10px; margin-top: 10px; }

/* The account form: labelled fields, left-aligned, inside the centred card. */
.auth-form { text-align: left; }
.auth-form .modal-title, .auth-form .modal-sub { text-align: center; }
.auth-label { margin-top: 4px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.auth-input {
  width: 100%;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text-primary);
  font: inherit;
  font-size: 15px;
}
.auth-input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.auth-label[hidden], .auth-input[hidden] { display: none; }
.auth-optional { font-weight: 500; }
.auth-submit { margin-top: 8px; min-height: 44px; font-size: 15px; font-weight: 700; }
.auth-switch { margin-top: 4px; text-align: center; font-size: 13.5px; color: var(--text-secondary); }
.auth-switch .link-btn { font-size: 13.5px; margin-left: 4px; }

/* Done: a check mark, the title, a line on where things are. */
.modal-done { justify-items: center; }
.modal-done-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 4px;
  border-radius: 50%;
  background: rgb(95 211 179 / 14%);
  color: var(--accent);
}
.modal-done-mark svg { width: 26px; height: 26px; }
.modal-done .btn { margin-top: 8px; padding: 10px 28px; }

/* ---------- code (start screen) ---------- */

.who-error { margin: 0; font-size: 13px; color: var(--alert-ink); }

/* Plain-text buttons (the sidebar's "I have a code"). */
.link-btn {
  appearance: none;
  border: 0;
  padding: 2px 0;
  background: none;
  color: var(--accent-ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.link-btn:hover { color: var(--accent); }
.link-btn[hidden] { display: none; }
/* A way out that should not compete with the main action. */
.link-quiet { color: var(--muted); font-weight: 500; text-decoration: none; }

/* ---------- sidebar ---------- */

/* While the overview or a past session is open, the camera panel steps
   aside (polls keep un-hiding it). */
body.is-browsing #livePanel { display: none !important; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: 284px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 14px 16px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}
body.has-sidebar { padding-left: 284px; }

/* "New session": the one filled button in the sidebar. */
.side-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.side-new {
  appearance: none;
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--accent-strong);
  color: var(--btn-ink);
  font: inherit;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.side-new svg { width: 17px; height: 17px; }
.side-new:hover { background: var(--accent-hover); }
.side-close { display: none; }

.side-link, .side-session {
  appearance: none;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.side-link { font-size: 14px; font-weight: 600; }
.side-link svg { width: 17px; height: 17px; flex: none; }
.side-link:hover, .side-session:hover { background: var(--line-soft); color: var(--text-primary); }
.side-link.is-active, .side-session.is-active { background: var(--line-soft); color: var(--text-primary); box-shadow: inset 3px 0 0 var(--accent); }

.side-sessions {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin: 8px -6px 0;
  padding: 0 6px;
  border-top: 1px solid var(--line-soft);
}
/* The day, in sentence case, over each group. */
.side-day { margin: 16px 12px 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.side-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.side-session { padding: 8px 10px; }
/* The session's number as a badge, in the display face. */
.side-session-num {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  transition: background 0.15s ease, color 0.15s ease;
}
.side-session.is-active .side-session-num { background: rgb(95 211 179 / 14%); color: var(--accent); }
.side-session-main { display: grid; gap: 1px; flex: 1; min-width: 0; }
.side-session-name { font-weight: 700; font-size: 14px; color: var(--text-primary); }
.side-session-meta { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-note { margin: 14px 12px 0; font-size: 13px; line-height: 1.5; color: var(--muted); }

/* The foot: a small code card -- what it is, the code, a line on keeping
   it, then Copy and a red Sign out. */
/* The foot: Sign out alone. */
.side-foot { padding: 12px 4px 0; margin-top: 8px; border-top: 1px solid var(--line-soft); }
.side-foot-actions { display: flex; gap: 8px; }
.side-btn {
  appearance: none;
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-primary);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.side-btn svg { width: 15px; height: 15px; flex: none; }
.side-btn[hidden] { display: none; }
.side-btn:hover { border-color: var(--accent); }
/* Sign out is red; signing out asks twice (a lost code is a lost account). */
.side-btn-danger { color: var(--status-critical); border-color: rgb(208 59 59 / 55%); }
.side-btn-danger:hover { border-color: var(--status-critical); background: rgb(208 59 59 / 10%); }

/* The menu button only exists for the phone drawer. */
.side-menu { display: none; }
.side-scrim { position: fixed; inset: 0; z-index: 25; background: rgb(0 0 0 / 50%); }

@media (min-width: 901px) {
  .side-scrim { display: none; }
}

@media (max-width: 900px) {
  body.has-sidebar { padding-left: 0; }
  .sidebar {
    width: min(86vw, 300px);
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.22s ease, visibility 0s linear 0.22s;
    box-shadow: none;
  }
  body.side-open .sidebar {
    transform: none;
    visibility: visible;
    transition: transform 0.22s ease;
    box-shadow: 0 0 40px rgb(0 0 0 / 35%);
  }
  .side-close { display: grid; }
  body.has-sidebar .side-menu { display: grid; position: absolute; top: 4px; left: 0; }
}
@media (max-width: 600px) {
  body.has-sidebar .side-menu { position: static; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar, body.side-open .sidebar { transition: none; }
}
@media (prefers-color-scheme: light) {
  :root:where(:not([data-theme="dark"])) .side-session.is-active .side-session-num { background: rgb(31 154 123 / 14%); }
}
:root[data-theme="light"] .side-session.is-active .side-session-num { background: rgb(31 154 123 / 14%); }

/* ---------- overview ---------- */

.overview { display: grid; gap: 16px; }
.overview-title { margin: 0; font-family: var(--font-display); font-size: 26px; font-weight: 600; }
.overview-sub { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.overview-who { font-weight: 600; color: var(--text-primary); }
.overview-note { margin: 0; color: var(--text-secondary); font-size: 14px; }

/* Every session, one row each: number, when, length, score. The columns
   line up down the list so the scores read as a column. */
.session-list { list-style: none; margin: -4px 0 0; padding: 0; display: grid; }
.session-list li + li { border-top: 1px solid var(--line-soft); }
.session-row {
  appearance: none;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto auto;
  align-items: center;
  gap: 16px;
  padding: 11px 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.session-row:hover { background: var(--line-soft); color: var(--text-primary); }
.session-row-name { font-weight: 700; font-size: 14px; color: var(--text-primary); }
.session-row-when, .session-row-length { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-row-length { font-variant-numeric: tabular-nums; }
.session-row-score {
  min-width: 64px;
  text-align: right;
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.session-row-score i { font-style: normal; font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.session-row-score.is-good { color: var(--success-text); }
.session-row-score.is-fair { color: var(--alert-ink); }
.session-row-score.is-bad { color: var(--tier-critical); }
@media (max-width: 600px) {
  .session-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 2px; }
  .session-row-when { grid-column: 1; font-size: 12.5px; }
  .session-row-length { display: none; }
  .session-row-score { grid-row: 1 / span 2; grid-column: 2; }
}

/* ---------- save your progress (review, logged out) ---------- */

.save-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px 28px;
  padding: 20px 24px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: rgb(95 211 179 / 6%);
}
.save-card[hidden] { display: none; }
.save-card-text { display: grid; gap: 4px; min-width: 0; }
.save-card-text h2 { font-size: 22px; }
.save-card-sub { color: var(--text-secondary); font-size: 14px; line-height: 1.5; }
.save-card-actions { display: flex; gap: 10px; flex: none; }
.save-card-actions .btn { padding: 11px 22px; font-size: 14.5px; font-weight: 700; }
@media (prefers-color-scheme: light) {
  :root:where(:not([data-theme="dark"])) .save-card { background: rgb(31 154 123 / 7%); }
}
:root[data-theme="light"] .save-card { background: rgb(31 154 123 / 7%); }

