/* CoachIt brand. Only the six colours below; black and white stay on video surfaces only.
   Rules and reasons: docs/brand-implementation.md. Mobile first. */
@font-face { font-family: 'Rubik'; font-style: normal; font-weight: 700; font-display: swap; src: url(/fonts/rubik-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Rubik'; font-style: normal; font-weight: 700; font-display: swap; src: url(/fonts/rubik-hebrew-700-normal.woff2) format('woff2'); unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: 'Rubik'; font-style: normal; font-weight: 800; font-display: swap; src: url(/fonts/rubik-latin-800-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Rubik'; font-style: normal; font-weight: 800; font-display: swap; src: url(/fonts/rubik-hebrew-800-normal.woff2) format('woff2'); unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: 'Assistant'; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/assistant-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Assistant'; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/assistant-hebrew-400-normal.woff2) format('woff2'); unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: 'Assistant'; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/assistant-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Assistant'; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/assistant-hebrew-600-normal.woff2) format('woff2'); unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: 'Assistant'; font-style: normal; font-weight: 700; font-display: swap; src: url(/fonts/assistant-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Assistant'; font-style: normal; font-weight: 700; font-display: swap; src: url(/fonts/assistant-hebrew-700-normal.woff2) format('woff2'); unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }

:root {
  --deep: #00432F;
  --bottle: #006A4E;
  --mint: #E3EFEA;
  --white: #FFFFFF;
  --red: #B3261E;
  --pale-red: #FBE9E7;
  /* Roles. Styles below use these, not the colours above, so the dark theme only has to remap them. */
  --bg: var(--white);             /* screen, top bar, bottom nav */
  --surface: var(--mint);         /* cards */
  --surface-2: var(--mint);
  --line: var(--mint);
  --text: var(--deep);
  --muted: var(--bottle);
  --inverse: var(--white);
  --strong: var(--deep);          /* selected / active background */
  --on-strong: var(--white);
  --primary: var(--bottle);       /* main button */
  --on-primary: var(--white);
  --primary-active: var(--deep);
  --done: var(--bottle);          /* "Completed" tag */
  --on-done: var(--white);
  --field: var(--white);          /* text inputs */
  --field-line: var(--deep);
  --accent: var(--deep);          /* native checkboxes, sliders */
  --modal: var(--white);
  --focus: var(--deep);
  --scrim: rgba(0, 67, 47, .55);   /* deep, see-through */
  --shadow: rgba(0, 67, 47, .25);
  /* What sits on the current surface: mint on the screen, white on a card. Each card flips it. */
  --fill-on-bg: var(--mint);
  --fill-on-surface: var(--white);
  --fill-on-modal: var(--mint);    /* the modal is white like the screen in light, a bottle card in dark */
  --fill: var(--fill-on-bg);
  color-scheme: light;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --radius: 16px;
  --pill: 999px;
  --nav-h: 64px;
  --tap: 52px;
  --tap-small: 44px;
  --font-body: 'Assistant', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --font-head: 'Rubik', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  font-size: 16px;
  accent-color: var(--accent);
}
/* Dark theme (proposal, not yet in the brand book): the same six colours, deep screen and bottle cards.
   Settings → Appearance sets data-theme=dark on <html>; with no choice the app is light. */
:root[data-theme=dark] {
  --bg: var(--deep); --surface: var(--bottle); --surface-2: var(--bottle); --line: var(--bottle);
  --text: var(--white); --muted: var(--mint); --inverse: var(--deep);
  --strong: var(--white); --on-strong: var(--deep);
  --primary: var(--white); --on-primary: var(--deep); --primary-active: var(--mint);
  --done: var(--mint); --on-done: var(--deep);
  --field: var(--deep); --field-line: var(--mint); --accent: var(--mint); --modal: var(--bottle);
  --focus: var(--white); --scrim: rgba(0, 20, 14, .7); --shadow: rgba(0, 0, 0, .4);
  --fill-on-bg: var(--bottle); --fill-on-surface: var(--deep); --fill-on-modal: var(--deep); --btn2: var(--mint);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
a { color: inherit; }
img, video { max-width: 100%; display: block; }
h1, h2, h3, .hero, .wordmark { font-family: var(--font-head); line-height: 1.2; }
h1, h2, h3 { font-weight: 700; }
.hero { font-size: 40px; font-weight: 800; margin: 0 0 var(--space-3); }
h1 { font-size: 28px; margin: 0 0 var(--space-3); }
h2 { font-size: 20px; margin: var(--space-5) 0 var(--space-2); }
h3 { font-size: 18px; margin: var(--space-4) 0 var(--space-2); }
p { margin: var(--space-2) 0; }
strong, b { font-weight: 700; }
input { color: var(--text); }
::placeholder { color: var(--muted); opacity: 1; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.row { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: var(--space-3); }
.hidden, [hidden] { display: none !important; }

/* Layout */
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--bg);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-1) var(--space-4); min-height: 56px;
}
.wordmark { font-size: 22px; font-weight: 800; color: var(--text); }
.auth-mark { margin-bottom: var(--space-5); }
main.page { max-width: 720px; margin: 0 auto; padding: var(--space-4) var(--space-4) calc(var(--nav-h) + var(--space-5)); }
@media (max-width: 639px) { .feed-item { border-radius: 0; margin-inline: calc(-1 * var(--space-4)); } }
main.page.wide { max-width: 980px; }
.banner { --fill: var(--fill-on-surface); background: var(--surface); color: var(--text); font-weight: 700; border-radius: var(--radius); padding: var(--space-3) var(--space-4); margin: 0 0 var(--space-4); }
.card .banner { background: var(--fill-on-surface); --fill: var(--fill-on-bg); }
.banner.strong { background: var(--strong); color: var(--on-strong); }
.banner.strong .muted { color: var(--on-strong); }
.banner.strong .btn { background: var(--on-strong); color: var(--strong); }
.banner.strong .btn.secondary { background: var(--mint); color: var(--deep); }
.banner.strong .btn.ghost { background: transparent; color: var(--on-strong); }
.banner.error, .card .banner.error { background: var(--pale-red); color: var(--red); }

/* Bottom navigation */
nav.bottom {
  position: fixed; bottom: 0; inset-inline: 0; z-index: 30; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding: var(--space-1) var(--space-2) calc(var(--space-1) + env(safe-area-inset-bottom));
  background: var(--bg); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, minmax(0, 120px)); justify-content: center; gap: var(--space-1);
}
nav.bottom a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  text-decoration: none; color: var(--text); font-size: 14px; line-height: 1.2; position: relative; border-radius: var(--pill);
}
nav.bottom a svg { width: 24px; height: 24px; }
nav.bottom a.active { background: var(--strong); color: var(--on-strong); font-weight: 700; }
.badge {
  position: absolute; top: 2px; inset-inline-start: calc(50% + 4px);
  min-width: 20px; height: 20px; padding: 0 var(--space-1); border-radius: var(--pill);
  background: var(--strong); color: var(--on-strong); font-size: 14px; line-height: 1; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
nav.bottom a.active .badge { background: var(--on-strong); color: var(--strong); }
.icon-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; background: none; border: 0; padding: var(--space-2); min-width: 44px; min-height: 44px; cursor: pointer; color: var(--text); }
.icon-btn svg { width: 24px; height: 24px; }
.icon-btn .badge { top: 0; inset-inline-start: 24px; }

/* Buttons. The 2px border is see-through here; the editor's outlined buttons give it a colour. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--tap); padding: var(--space-1) var(--space-5); border-radius: var(--pill);
  font: inherit; font-weight: 700; line-height: 1.2; text-align: center; text-decoration: none; cursor: pointer;
  border: 2px solid transparent; background: var(--primary); color: var(--on-primary);
}
.btn:active { background: var(--primary-active); }
.btn.secondary { background: var(--btn2, var(--fill)); color: var(--deep); }
.btn.danger { background: var(--pale-red); color: var(--red); }
.btn.secondary:active, .btn.danger:active { box-shadow: inset 0 0 0 2px currentColor; }
.btn.ghost { background: transparent; color: var(--text); text-decoration: underline; border: 0; padding: var(--space-1) 0; }
.btn.block { width: 100%; }
.btn.small { min-height: var(--tap-small); padding: var(--space-1) var(--space-4); }
.btn.ghost.small { padding: var(--space-1) 0; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn[disabled], .btn.disabled { opacity: .45; cursor: not-allowed; }
.btn[aria-busy=true] { opacity: 1; cursor: progress; white-space: nowrap; }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, label.chip:has(input:focus-visible), label.choice:has(input:focus-visible) {
  outline: 3px solid var(--focus); outline-offset: 2px;
}
/* A white ring outside a deep element would vanish on the white screen, so it sits inside. */
nav.bottom a.active:focus-visible, .tabs button[aria-selected=true]:focus-visible, .chip.on:focus-visible, label.chip:has(input:checked:focus-visible), label.choice:has(input:checked:focus-visible), .banner.strong a:focus-visible, .banner.strong button:focus-visible, #toast .t:not(.err) a:focus-visible {
  outline-color: var(--on-strong); outline-offset: -5px;
}
.btn-row { display: flex; gap: var(--space-2); flex-wrap: wrap; }
/* Buttons never sit tight under text: a row of buttons after anything else gets a gap above it.
   Flex containers that already space their children (rows, empty/error states, the crop screen) are left alone. */
* + .btn-row { margin-top: var(--space-3); }
.row > .btn-row, .state > .btn-row, .crop > .btn-row { margin-top: 0; }
/* Google sign-in */
.social { display: grid; gap: var(--space-2); margin: var(--space-4) 0; }
.social .logo { display: inline-flex; }
.social .logo svg { width: 20px; height: 20px; }
.or { display: flex; align-items: center; gap: var(--space-3); color: var(--muted); font-size: 14px; margin: var(--space-1) 0 0; }
.or::before, .or::after { content: ''; flex: 1; border-top: 1px solid var(--line); }
.btn-row > .btn { flex: 1 1 160px; }

/* Forms */
label, .label { display: block; font-weight: 600; margin-bottom: var(--space-1); }
.field { margin-bottom: var(--space-4); }
.hint { color: var(--muted); font-size: 14px; margin-top: var(--space-1); }
.error-text { background: var(--pale-red); color: var(--red); font-weight: 700; font-size: 14px; margin: var(--space-1) 0 0; padding: var(--space-2) var(--space-3); border-radius: var(--radius); }
.error-text::before { content: "⚠ "; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=search], select, textarea {
  width: 100%; min-height: var(--tap); padding: var(--space-2) var(--space-3); font: inherit; font-size: 16px; color: var(--text);
  background: var(--field); border: 2px solid var(--field-line); border-radius: var(--radius);
}
textarea { min-height: 110px; resize: vertical; }
/* Password box with an eye button inside, on the right */
.pw { position: relative; }
.pw input { padding-right: 56px; }
.pw input::-ms-reveal { display: none; }   /* Edge's own eye icon would double up */
.pw-toggle {
  position: absolute; right: var(--space-1); top: 50%; transform: translateY(-50%);
  width: var(--tap-small); height: var(--tap-small); padding: 0; border: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--text); cursor: pointer;
}
.pw-toggle svg { width: 22px; height: 22px; }
@media (hover: hover) { .pw-toggle:hover { background: var(--surface); } }   /* phones keep :hover after a tap */
input[aria-invalid=true], textarea[aria-invalid=true] { border-style: dashed; }
label.btn { margin-bottom: 0; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; border: 0 !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; inset-inline-start: 0; }
.file-pick { position: relative; display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; padding: var(--space-3); border-radius: var(--radius); }
input[type=file] { font: inherit; width: 100%; padding: var(--space-3); border-radius: var(--radius); background: var(--fill); color: var(--text); }

/* Surfaces that sit on the screen or inside a card: mint on white, white on mint */
.choice, .file-pick, .ai-step, .cover-picker { background: var(--surface); --fill: var(--fill-on-surface); }
.card .choice, .card .file-pick, .card .ai-step, .card .cover-picker,
.rec .file-pick, .rec .cover-picker { background: var(--fill-on-surface); --fill: var(--fill-on-bg); }

.choices { display: grid; gap: var(--space-2); }
.choice {
  display: flex; gap: var(--space-3); align-items: center; padding: var(--space-3) var(--space-4);
  margin: 0; border-radius: var(--radius); cursor: pointer;
}
/* Own radio circle (the browser's one can't be styled): field-coloured circle, dot when chosen. Theme tokens keep it right in dark mode */
.choice input[type=radio] {
  appearance: none; -webkit-appearance: none; width: 22px; height: 22px; margin: 0; flex: none;
  border: 2px solid var(--field-line); border-radius: 50%; background: var(--field);
  display: grid; place-content: center; cursor: inherit;
}
.choice input[type=radio]::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--field-line); transform: scale(0); transition: transform .12s; }
.choice input[type=radio]:checked::before { transform: scale(1); }
.choice:has(input:checked) { background: var(--strong); color: var(--on-strong); --fill: var(--fill-on-bg); }
.choice:has(input:checked) input[type=radio] { border-color: var(--on-strong); background: var(--on-strong); }
.choice:has(input:checked) input[type=radio]::before { background: var(--strong); }
.choice:has(input:checked) .d { color: var(--on-strong); }
.choice:has(input:checked) .tag:not(.soft):not(.fill) { border-color: var(--on-strong); color: var(--on-strong); }
.choice:has(input:checked) .tag.fill { background: var(--on-strong); color: var(--strong); border-color: var(--on-strong); }
.choice.disabled { opacity: .55; cursor: not-allowed; }
.choice .t { font-weight: 700; display: block; }
.choice .d { color: var(--muted); font-size: 14px; display: block; }
.chips { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: var(--space-1); min-height: var(--tap-small); padding: 0 var(--space-4); margin: 0;
  border: 0; border-radius: var(--pill); background: var(--fill); font: inherit; font-weight: 600; cursor: pointer; color: var(--text);
}
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip.on, .chip:has(input:checked) { background: var(--strong); color: var(--on-strong); }
/* Languages: pills for the common ones, then a search box whose list opens under it (in the page flow, so the
   bottom nav never covers it). Role tokens with today's colours as fallback, ready for the dark theme. */
.lang-search { position: relative; margin-top: var(--space-3); }
.lang-search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--muted, var(--bottle)); pointer-events: none; }
.lang-search .lang-input { padding-left: 44px; }
.lang-list { list-style: none; margin: var(--space-1) 0 0; padding: var(--space-1); max-height: 232px; overflow-y: auto; overscroll-behavior: contain;
  background: var(--field, var(--white)); border: 2px solid var(--field-line, var(--deep)); border-radius: var(--radius); }
.lang-list li { min-height: var(--tap-small); display: flex; align-items: center; padding: 0 var(--space-3); border-radius: var(--radius); cursor: pointer; font-weight: 600; }
.lang-list li[aria-selected=true] { background: var(--strong, var(--deep)); color: var(--on-strong, var(--white)); }
@media (hover: hover) { .lang-list li[role=option]:hover:not([aria-selected=true]) { background: var(--fill-on-bg, var(--mint)); } }
.lang-list .lang-empty { cursor: default; font-weight: 400; color: var(--muted, var(--bottle)); }

/* Tags. The plain tag is the outlined one. */
.tag { display: inline-block; padding: 0 var(--space-3); border-radius: var(--pill); border: 1px solid var(--text); color: var(--text); font-size: 14px; font-weight: 700; line-height: 1.5; }
.tag.fill { background: var(--strong); color: var(--on-strong); border-color: var(--strong); }
.tag.soft { background: var(--fill); border-color: transparent; }
.tag.status-completed { background: var(--done); border-color: var(--done); color: var(--on-done); }
.tag.status-declined { background: var(--pale-red); border-color: var(--pale-red); color: var(--red); }

/* Cards & lists */
.card { --fill: var(--fill-on-surface); border: 2px solid transparent; border-radius: var(--radius); padding: 14px; background: var(--surface); }   /* 14 + 2 border = 16 */
.card + .card, .card + .state, .state + .card { margin-top: var(--space-3); }
/* Analysis boxes (request page, video page, feed overlay): the coach's words in big quotation marks,
   recordings and drawings as a box with a play button on the right */
.an-quote { position: relative; margin-top: 30px; padding-top: 26px; }
.an-quote blockquote { margin: 0; font-size: 20px; line-height: 1.4; font-weight: 600; }
.an-marks { position: absolute; top: -19px; left: 18px; width: 44px; height: 34px; color: var(--muted, var(--bottle)); }
.an-marks svg { display: block; width: 100%; height: 100%; }
.an-play { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 76px;
  font: inherit; font-size: 17px; font-weight: 700; text-align: start; color: inherit; cursor: pointer; }
.an-play-btn { flex: none; width: 48px; height: 48px; border-radius: 50%; background: var(--strong, var(--deep)); color: var(--on-strong, var(--white)); display: grid; place-items: center; }
.an-play-btn svg { width: 22px; height: 22px; margin-left: 3px; fill: currentColor; }
.an-rec-video { display: block; width: 100%; max-height: 60vh; border-radius: var(--radius); }
/* Inside another card (video page): white boxes, like other fills on a card */
.card .an-list { margin-top: var(--space-3); }
.card .an-list .card { background: var(--fill); }
.card.link { display: block; text-decoration: none; }
.card.unread { border-color: var(--text); }
.list-item { display: flex; gap: var(--space-3); align-items: center; justify-content: space-between; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--text); flex: none; }
.meta { color: var(--muted); font-size: 14px; }
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: var(--space-1) var(--space-3); margin: var(--space-2) 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; font-weight: 600; }

/* Tabs */
.tabs { display: flex; gap: var(--space-1); margin: var(--space-2) 0 var(--space-4); padding: var(--space-1) 0; overflow-x: auto; }
.tabs button {
  flex: 0 0 auto; min-height: var(--tap-small); padding: 0 var(--space-4); background: none; border: 0; border-radius: var(--pill);
  font: inherit; font-weight: 600; cursor: pointer; color: var(--text); white-space: nowrap;
}
.tabs button[aria-selected=true] { background: var(--strong); color: var(--on-strong); font-weight: 700; }

/* Grid of videos */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.tile {
  --fill: var(--fill-on-surface);
  display: flex; flex-direction: column; justify-content: flex-end; gap: var(--space-1); aspect-ratio: 3/4; padding: var(--space-3);
  border-radius: var(--radius); background: var(--surface); text-decoration: none; overflow: hidden; position: relative;
}
.tile .play { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-60%); width: 44px; height: 44px; color: var(--muted); }
.tile .t { font-weight: 700; line-height: 1.25; }
.tile img.cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* A tile with a cover is a video preview: white on the image, over a black shade */
.tile:has(img.cover:not([hidden])) .play { color: #fff; filter: drop-shadow(0 1px 3px rgba(0,0,0,.6)); }
.tile:has(img.cover:not([hidden])) > span:not(.play) { position: relative; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.8); }
.tile:has(img.cover:not([hidden]))::after { content: ""; position: absolute; inset: 40% 0 0; background: linear-gradient(transparent, rgba(0,0,0,.7)); }
.tile > span { z-index: 1; }
.tile:has(img.cover:not([hidden])) .tag { background: var(--white); color: var(--deep); border-color: var(--white); text-shadow: none; }
.tile:has(img.cover:not([hidden])) .tag.status-completed { background: var(--bottle); border-color: var(--bottle); color: var(--white); }
.tile:has(img.cover:not([hidden])) .tag.status-declined { background: var(--pale-red); border-color: var(--pale-red); color: var(--red); }

/* People */
.avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; border-radius: 50%; overflow: hidden;
  background: var(--fill); color: var(--muted); font-weight: 700; line-height: 1; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.person { display: inline-flex; align-items: center; gap: var(--space-2); text-decoration: none; }
.person:hover strong, .person:hover span { text-decoration: underline; }
nav.bottom a .avatar { width: 28px; height: 28px; }
.langs { color: var(--muted); font-size: 14px; }

/* Covers */
.cover-picker { border-radius: var(--radius); padding: var(--space-3); }
.cover-preview { aspect-ratio: 16/9; background: transparent; border-radius: var(--radius); overflow: hidden; display: flex; align-items: center; justify-content: center; margin-bottom: var(--space-2); }
.cover-preview img { width: 100%; height: 100%; object-fit: contain; }
.cover-scrub { width: 100%; max-height: 260px; background: transparent; border-radius: var(--radius); margin: var(--space-2) 0; }
.cover-picker input[type=range] { width: 100%; margin-bottom: var(--space-2); accent-color: var(--accent); }
.cover-thumb { width: 96px; aspect-ratio: 3 / 4; flex: none; border-radius: var(--radius); overflow: hidden; background: var(--fill); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 14px; }
.cover-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* Video player */
/* Inline players: a video narrower than its box leaves the sides see-through (the card shows), not black bars.
   Full-screen players and editors keep black, since there the video is the whole screen. */
.player { background: transparent; border-radius: var(--radius); overflow: hidden; }
.player video { width: 100%; max-height: 70vh; background: transparent; }
.player-placeholder { aspect-ratio: 16/9; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: var(--space-2); color: #fff; background: #000; padding: var(--space-4); text-align: center; }
.player-placeholder .btn { background: var(--white); color: var(--deep); }
.player-placeholder .spinner { border-color: rgba(255,255,255,.3); border-top-color: #fff; }
.player-placeholder.has-cover { position: relative; }
.player-placeholder img.cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.player-placeholder.has-cover .btn { position: relative; box-shadow: 0 2px 10px rgba(0,0,0,.4); white-space: nowrap; }

/* Feed player: full screen on top of .viewer; swipes move the video and bring in the analysis */
.player.opens { cursor: pointer; }
.fp { overscroll-behavior: none; }
html.fp-open, html.fp-open body { overscroll-behavior: none; }
/* Swipes may start over the bottom band too; only the position bar itself takes the touch */
.fp .viewer-bottom { pointer-events: none; }
.fp .viewer-scrub { pointer-events: auto; }
.fp-video.fp-sliding, .fp-panel.fp-sliding { transition: transform .18s ease-out; }
@media (prefers-reduced-motion: reduce) { .fp-video.fp-sliding, .fp-panel.fp-sliding { transition: none; } }
.fp-heading { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; text-shadow: 0 1px 3px rgba(0,0,0,.8); }
.fp-owner { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp .viewer-top-btn { margin-inline-start: 0; color: var(--deep); background: var(--white); min-height: var(--tap-small); border-radius: var(--pill); }
.fp-state { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 3; width: 72px; height: 72px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.fp-state svg { width: 36px; height: 36px; }
.fp-message { position: absolute; top: 50%; inset-inline: var(--space-4); transform: translateY(-50%); z-index: 3; text-align: center; pointer-events: none; }
.fp-hint { align-self: center; padding: var(--space-2) var(--space-3); border-radius: var(--pill); background: rgba(0,0,0,.7); font-size: 14px; text-align: center; pointer-events: none; }
/* Analysis over the video: see-through dark boxes stacked at the bottom, the paused frame stays visible behind.
   Dark-on-video like the other video overlays, so black is allowed here. */
.fp-panel { position: absolute; inset: 0; z-index: 6; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; transform: translateX(-100%);
  display: flex; flex-direction: column; gap: var(--space-3);
  padding: calc(env(safe-area-inset-top) + var(--space-7)) var(--space-4) calc(env(safe-area-inset-bottom) + var(--space-5));
  background: linear-gradient(rgba(0,0,0,.15), rgba(0,0,0,.45)); color: var(--white); user-select: text; -webkit-user-select: text; }
.fp-panel > * { width: 100%; max-width: 720px; margin-inline: auto; flex: none; }
/* Top box: title on the left, the close button tucked into its top corner */
.fp-head { display: flex; gap: var(--space-2); align-items: flex-start; }
.fp-head-text { flex: 1; min-width: 0; }
.fp-close { flex: none; width: 44px; height: 44px; margin: calc(-1 * var(--space-2)) calc(-1 * var(--space-2)) 0 0; padding: 0; border: 0; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer; background: transparent; color: var(--white); }
.fp-close:hover { background: rgba(255,255,255,.12); }
.fp-close svg { width: 22px; height: 22px; }
.fp-close:focus-visible { outline-color: var(--white); }
.fp-boxes { margin-top: auto; display: grid; gap: var(--space-3); }
.fp-boxes .stack > * + * { margin-top: var(--space-3); }
.fp-panel .card { --fill: var(--white); background: rgba(0,0,0,.62); color: var(--white); border: 1px solid rgba(255,255,255,.16);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.fp-panel h2 { margin: 0 0 var(--space-1); }
.fp-head .meta { margin: var(--space-2) 0 0; }
.fp-head .person { color: inherit; }
/* Analysis boxes in the overlay: white play button, mint quotation marks */
.fp-panel .an-marks { color: var(--mint); }
.fp-panel .an-play-btn { background: var(--white); color: var(--deep); }
.fp-panel .an-play:focus-visible { outline-color: var(--white); }
.fp-panel .muted, .fp-panel .meta { color: var(--mint); }
.fp-panel .spinner { border-color: rgba(255,255,255,.3); border-top-color: var(--white); }
/* While the analysis is open the video's own controls step aside. */
.fp .viewer-top, .fp .viewer-bottom { transition: opacity .18s, visibility .18s; }
.fp.fp-analysis-open .viewer-top, .fp.fp-analysis-open .viewer-bottom, .fp.fp-analysis-open .fp-state { opacity: 0; visibility: hidden; }

/* Floating-head video: the coach's face in a round bubble over the trainee's video (pip.js).
   Dark-on-video like the other video overlays. */
.pip-bubble { position: absolute; z-index: 5; width: clamp(96px, 30vw, 160px); aspect-ratio: 1; border-radius: 50%; overflow: hidden;
  border: 3px solid var(--white); box-shadow: 0 4px 16px rgba(0,0,0,.5); background: #000; touch-action: none; cursor: grab; }
.pip-bubble.moving { cursor: grabbing; box-shadow: 0 8px 24px rgba(0,0,0,.6); }
.pip-face { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.pip-bubble.mirror .pip-face { transform: scaleX(-1); }
.pip-status { margin-inline-start: auto; flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--pill);
  background: rgba(0,0,0,.55); font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pip-status .rec-dot { width: 10px; height: 10px; background: var(--white); }
.pip-rec-row { display: flex; justify-content: center; }
.pip-rec { width: 76px; height: 76px; padding: 0; border: 4px solid var(--white); border-radius: 50%; background: rgba(0,0,0,.3); display: grid; place-items: center; cursor: pointer; }
.pip-rec:disabled { opacity: .5; cursor: default; }
.pip-rec:focus-visible { outline-color: var(--white); }
.pip-rec-inner { width: 56px; height: 56px; border-radius: 50%; background: var(--white); transition: width .18s, height .18s, border-radius .18s; }
.pip.recording .pip-rec-inner { width: 28px; height: 28px; border-radius: 6px; }   /* stop sign (an icon, not a surface) */
.pip .viewer-rail .pip-color { display: none; }
.pip.drawing .viewer-rail .pip-color { display: inline-flex; }
.pip-swatch { display: block; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--white); }
.pip-solo .viewer-ink { display: none; }
.pip-help { margin: 0; text-align: center; font-size: 14px; color: var(--mint); text-shadow: 0 1px 3px rgba(0,0,0,.7); }
/* The trainee's video was removed (storage cleanup): the face clip plays on its own, big and centred */
.pip-solo .viewer-video { display: none; }
.pip-solo .pip-bubble { left: 50% !important; top: 45% !important; transform: translate(-50%, -50%); width: min(66vw, 55vh); }
.pip .fp-state { z-index: 6; }

/* Video settings: closed until asked for */
.video-settings { margin-top: var(--space-5); }
.settings-options { margin-top: var(--space-3); }
.settings-toggle[aria-expanded=true] svg { transform: rotate(180deg); }

/* Feed: a card with the video in it, edge to edge on phones */
.feed-item { --fill: var(--fill-on-surface); background: var(--surface); border-radius: var(--radius); overflow: hidden; margin-bottom: var(--space-3); }
.feed-item .head, .feed-item .foot { padding: var(--space-4); }
.feed-item .player { border-radius: 0; container-type: inline-size; }
/* Feed: every video fills the width. Tall ones are cropped to 4:5 at most (the full-screen player shows all of it). */
.feed-item .player video { display: block; max-height: min(125cqw, 80vh); object-fit: cover; }

/* Messages. Coaches and trainees write in any language, so each paragraph picks its own direction. */
.thread { display: flex; flex-direction: column; gap: var(--space-2); }
.msg { max-width: 85%; padding: var(--space-2) var(--space-3); border-radius: var(--radius); background: var(--surface); white-space: pre-wrap; unicode-bidi: plaintext; }
.msg.mine { align-self: flex-end; background: var(--strong); color: var(--on-strong); }
.msg.theirs { align-self: flex-start; }
.msg .meta { color: inherit; font-size: 14px; }
.pre { white-space: pre-wrap; unicode-bidi: plaintext; }

/* States */
.boot, .state { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: var(--space-2); padding: var(--space-7) var(--space-4); color: var(--muted); }
.boot { min-height: 70vh; }
.state.empty { --fill: var(--fill-on-surface); background: var(--surface); border-radius: var(--radius); color: var(--text); }
.state.error { --fill: var(--white); background: var(--pale-red); border-radius: var(--radius); color: var(--red); font-weight: 700; }
.state.success { --fill: var(--fill-on-surface); background: var(--surface); border-radius: var(--radius); color: var(--text); }
.state .big { font-size: 32px; line-height: 1; }
.spinner { width: 32px; height: 32px; border: 4px solid var(--fill); border-top-color: var(--text); border-radius: 50%; animation: spin .8s linear infinite; }
.spinner.sm { width: 16px; height: 16px; border-width: 2px; }
.btn .spinner { flex: none; border-color: transparent; border-top-color: currentColor; border-inline-end-color: currentColor; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } .rec-dot { animation: none; } }
.progress { height: 14px; background: var(--fill); border-radius: var(--pill); overflow: hidden; }
.progress > div { height: 100%; background: var(--primary); width: 0; transition: width .2s; }

/* Toast & modal */
#toast { position: fixed; bottom: calc(var(--nav-h) + var(--space-4) + env(safe-area-inset-bottom)); inset-inline: var(--space-4); z-index: 60; display: flex; flex-direction: column; gap: var(--space-2); align-items: center; pointer-events: none; }
#toast .t { max-width: 560px; width: 100%; background: var(--strong); color: var(--on-strong); padding: var(--space-3) var(--space-4); border-radius: var(--radius); font-weight: 600; box-shadow: 0 4px 18px var(--shadow); pointer-events: auto; }
#toast .t.err { background: var(--pale-red); color: var(--red); font-weight: 700; }
.modal-back { position: fixed; inset: 0; z-index: 70; background: var(--scrim); display: flex; align-items: flex-end; justify-content: center; padding: var(--space-4); }
@media (min-width: 640px) { .modal-back { align-items: center; } }
.modal { --fill: var(--fill-on-modal); background: var(--modal); border-radius: var(--radius); padding: var(--space-5); width: 100%; max-width: 480px; max-height: 90vh; overflow: auto; }
.modal h2 { margin-top: 0; }

/* Recorder */
.rec { --fill: var(--fill-on-surface); background: var(--surface); border-radius: var(--radius); padding: var(--space-4); }
.rec video { width: 100%; max-height: 300px; background: transparent; border-radius: var(--radius); }
.rec-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--text); animation: blink 1s infinite; vertical-align: middle; }
@keyframes blink { 50% { opacity: .2; } }

@media (min-width: 900px) {
  .two-col { display: grid; grid-template-columns: 1.2fr 1fr; gap: var(--space-5); align-items: start; }
}
.msg-row { display: flex; gap: var(--space-2); align-items: flex-end; }
.msg-row.mine { justify-content: flex-end; }
.msg-row .msg { align-self: auto; }

/* Coach viewer: full screen, the video is the page */
.viewer { position: fixed; inset: 0; z-index: 50; background: #000; color: #fff; overflow: hidden; user-select: none; -webkit-user-select: none; }
.viewer-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.fp .viewer-video.fp-fill, .viewer-video.fill { object-fit: cover; }
.viewer-ink { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.viewer.drawing .viewer-ink { pointer-events: auto; touch-action: none; cursor: crosshair; }
.viewer-tap { position: absolute; inset: 0; touch-action: none; z-index: 2; }
.viewer.drawing .viewer-tap { pointer-events: none; }
.viewer-top { position: absolute; top: 0; inset-inline: 0; display: flex; align-items: center; gap: .6rem; z-index: 4;
  padding: calc(env(safe-area-inset-top) + 10px) 12px 28px; background: linear-gradient(rgba(0,0,0,.65), transparent); pointer-events: none; }
.viewer-top > * { pointer-events: auto; }
.viewer-top .title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.viewer-rail { position: absolute; inset-inline-start: 10px; top: 50%; transform: translateY(-50%); z-index: 4; display: flex; flex-direction: column; gap: 12px; }
.viewer-round { width: 52px; height: 52px; flex: none; border-radius: 50%; border: 0; padding: 0; background: rgba(0,0,0,.55); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font: 700 .95rem/1 system-ui, sans-serif; cursor: pointer; }
.viewer-round svg { width: 26px; height: 26px; }
.viewer-round[aria-pressed=true] { background: #fff; color: #000; }
.viewer-undo { display: none; }
.viewer.drawing .viewer-undo { display: inline-flex; }
.viewer-bottom { position: absolute; inset-inline: 0; bottom: 0; z-index: 4; display: flex; flex-direction: column; gap: 10px;
  padding: 28px 12px calc(env(safe-area-inset-bottom) + 12px); background: linear-gradient(transparent, rgba(0,0,0,.8)); }
.viewer-scrub { font-variant-numeric: tabular-nums; }
/* Timeline ("glow"): thin line, white scrub circle with a soft mint glow, times under the ends, a bubble while dragging */
.viewer-track-wrap { position: relative; height: 24px; display: flex; align-items: center; }
.viewer-track { position: relative; width: 100%; height: 2px; border-radius: var(--pill); background: rgba(255,255,255,.35); cursor: pointer; touch-action: none; transition: height .15s; }
.viewer-track::before { content: ""; position: absolute; inset: -12px 0; }   /* easier to grab than the 2px line */
.viewer-fill { height: 100%; width: 0; border-radius: var(--pill); background: var(--mint); }
.viewer-thumb { position: absolute; top: 50%; left: 0; width: 11px; height: 11px; border-radius: 50%; background: var(--white); transform: translate(-50%, -50%);
  box-shadow: 0 0 0 4px rgba(227,239,234,.35); pointer-events: none; transition: width .15s, height .15s; }
.viewer-times { display: flex; justify-content: space-between; font-size: 11px; font-weight: 600; color: var(--mint); text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.viewer-bubble { position: absolute; bottom: 22px; left: 0; transform: translateX(-50%); padding: 1px 8px; border-radius: var(--pill); font-size: 12px; font-weight: 700;
  background: rgba(0,0,0,.55); color: var(--white); border: 1px solid rgba(255,255,255,.2); opacity: 0; transition: opacity .15s; pointer-events: none; white-space: nowrap; }
.viewer-scrub.scrubbing .viewer-track { height: 4px; }
.viewer-scrub.scrubbing .viewer-thumb { width: 16px; height: 16px; }
.viewer-scrub.scrubbing .viewer-bubble { opacity: 1; }
/* Frame marks: a short line = drawing, a dark circle with T = text, a mint circle with T = both */
.viewer-marks { position: absolute; inset: 0; pointer-events: none; }
.viewer-mark { position: absolute; top: 50%; width: 2px; height: 10px; transform: translate(-50%, -50%); border: 0; border-radius: var(--pill); background: var(--mint);
  padding: 0; pointer-events: auto; cursor: pointer; }
.viewer-mark::before { content: ""; position: absolute; inset: -10px -9px; }   /* bigger tap target */
.viewer-mark.text { width: 13px; height: 13px; border-radius: 50%; background: rgba(0,67,47,.9); color: var(--mint); box-shadow: 0 0 0 1px var(--mint);
  font: 800 9px/13px var(--font-head); text-align: center; }
.viewer-mark.draw.text { background: var(--mint); color: var(--deep); }
.viewer-mark.on { background: var(--white); color: var(--deep); }
.viewer-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.viewer-actions button { min-height: 52px; border-radius: 26px; border: 0; background: #fff; color: #000; font: inherit; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; cursor: pointer; }
.viewer-actions svg { width: 22px; height: 22px; }
.viewer-hint { position: absolute; top: 42%; left: 50%; transform: translate(-50%, -50%); z-index: 3; font-size: 2rem; font-weight: 800;
  text-shadow: 0 2px 8px rgba(0,0,0,.8); opacity: 0; transition: opacity .2s; pointer-events: none; }
.viewer-hint.show { opacity: 1; }
.viewer-sheet { position: absolute; inset-inline: 0; bottom: 0; z-index: 5; max-height: 80%; overflow: auto; padding: 14px 16px calc(env(safe-area-inset-bottom) + 16px);
  background: var(--bg); color: var(--text); border-radius: 18px 18px 0 0; box-shadow: 0 -4px 24px rgba(0,0,0,.35); }
.viewer-sheet[hidden] { display: none; }
.viewer-top-btn { margin-inline-start: auto; flex: none; min-height: 40px; padding: 0 1rem; border: 0; border-radius: 20px; background: #fff; color: #000;
  font: inherit; font-weight: 700; cursor: pointer; }
/* Both rails (coach drawing on the left, watching a finished analysis on the right): small glass buttons, play larger and white */
.viewer-rail { gap: 10px; align-items: center; }
.viewer-rail .viewer-round { width: 36px; height: 36px; background: rgba(0,0,0,.45); border: 1px solid rgba(255,255,255,.16);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); font: 800 13px/1 var(--font-head); }
.viewer-rail .viewer-round svg { width: 18px; height: 18px; }
.viewer-rail.watch .viewer-round svg, .viewer-rail .viewer-round:first-child svg { fill: currentColor; }
.viewer-rail .viewer-round:first-child { width: 44px; height: 44px; background: var(--white); color: var(--deep); border: 0; }
.viewer-rail .viewer-round:first-child svg { width: 20px; height: 20px; }
/* On (pencil drawing, half speed): brand "selected" green, so it never looks like the white play button */
.viewer-rail .viewer-round[aria-pressed=true] { background: var(--bottle); color: var(--white); border-color: var(--mint); }
.viewer-rail .viewer-undo { font-size: 18px; }
.viewer-rail.watch { inset-inline-start: auto; inset-inline-end: 10px; }

/* Cover that opens the viewer (coach request page) */
.viewer-card { position: relative; display: block; text-decoration: none; width: 100%; aspect-ratio: 3 / 4; max-height: 70vh; padding: 0; border: 0; border-radius: var(--radius);
  overflow: hidden; background: #000; color: #fff; cursor: pointer; }
.viewer-card img.cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.viewer-card-play { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 64px; height: 64px; }
.viewer-card-play svg { width: 64px; height: 64px; filter: drop-shadow(0 2px 6px rgba(0,0,0,.6)); }
.viewer-card-label { position: absolute; bottom: 12px; inset-inline-start: 12px; background: rgba(0,0,0,.7); padding: .35rem .7rem; border-radius: 999px; font-weight: 700; }

/* Drawings shown with a finished analysis */
.review-stage { position: relative; background: transparent; border-radius: var(--radius); overflow: hidden; }
.review-video { width: 100%; max-height: 60vh; display: block; background: transparent; }
.review-ink { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* Colours for the pencil, and the explanation line for a frame */
.viewer-palette { position: absolute; inset-inline-start: 64px; top: 50%; transform: translateY(-50%); z-index: 6;
  display: flex; flex-direction: column; gap: 10px; padding: 10px; border-radius: 30px; background: rgba(0,0,0,.7); }
.viewer-palette[hidden] { display: none; }
.viewer-swatch { width: 32px; height: 32px; border-radius: 50%; border: 2px solid #fff; padding: 0; cursor: pointer; }
.viewer-note { padding: 0 0 2px; }
.viewer-note[hidden] { display: none; }
.viewer-note:not([hidden]) { display: flex; gap: 8px; align-items: flex-start; }
.viewer-note-del { flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; display: inline-flex;
  align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.viewer-note-del svg { width: 22px; height: 22px; }
.viewer-note-del[hidden] { display: none; }
.viewer-undo-bar { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .55rem .6rem .55rem 1rem; border-radius: 12px;
  background: #fff; color: #000; font-weight: 600; }
.viewer-undo-bar[hidden] { display: none; }
.viewer-undo-bar button { flex: none; border: 2px solid #000; border-radius: 18px; background: #000; color: #fff; font: inherit; font-weight: 700; padding: .3rem .9rem; cursor: pointer; }
.viewer-note-input { display: block; width: 100%; min-height: 44px; max-height: 40vh; border: 0; border-radius: 16px; padding: .6rem 1rem;
  font: inherit; line-height: 1.4; resize: none; overflow-y: auto; background: #fff; color: #000; }
.review-note { font-weight: 600; margin: .6rem 0 0; }
.viewer-caption { display: flex; align-items: flex-start; gap: .6rem; padding: .55rem .8rem; border-radius: 12px; background: rgba(0,0,0,.72); color: #fff; }
.viewer-caption[hidden] { display: none; }
.viewer-caption-text { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-caption.open .viewer-caption-text { white-space: pre-wrap; max-height: 40vh; overflow: auto; }
.viewer-more { flex: none; border: 0; padding: 0; background: none; color: #ffd60a; font: inherit; font-weight: 700; cursor: pointer; }
.viewer-more[hidden] { display: none; }
.review-caption { margin-top: .5rem; background: var(--deep); }   /* stays dark: white text on it */

/* ---------- AI coach lab (admins) ---------- */
main.page.xwide { max-width: 1280px; }
.ai-grid { display: grid; gap: var(--space-4); align-items: start; }
@media (min-width: 900px) { .ai-grid { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); } }
.ai-stage { position: relative; overflow: hidden; background: #000; width: 100%; margin: 0 auto var(--space-2); direction: ltr; border-radius: var(--radius); aspect-ratio: 16 / 9; }
.ai-zoom { position: absolute; inset: 0; transform-origin: 0 0; transition: transform .35s ease; }
.ai-zoom video, .ai-zoom canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.ai-zoom video { object-fit: fill; }
.ai-zoom canvas { pointer-events: none; }
.ai-stage.editing .ai-zoom canvas, .ai-stage.picking .ai-zoom canvas { pointer-events: auto; cursor: crosshair; touch-action: none; }
.ai-caption { position: absolute; inset-inline: 0; bottom: 0; padding: 10px 14px 12px; background: rgba(0,0,0,.78); color: #fff; font-size: 15px; display: none; unicode-bidi: plaintext; }
.ai-caption b { display: block; font-size: 16px; }
.ai-caption.show { display: block; }
.ai-badge { position: absolute; top: 8px; left: 8px; background: rgba(0,0,0,.75); color: #fff; padding: 2px 8px; border-radius: var(--pill); font-size: 14px; display: none; }
.ai-badge.show { display: block; }
.ai-stage-box > .meta { padding: var(--space-6) 0; text-align: center; }
.ai-controls { margin-bottom: var(--space-3); }
.ai-controls > .btn { flex: 0 0 auto; }
.ai-steps { list-style: none; padding: 0; margin: var(--space-2) 0 0; display: grid; gap: var(--space-2); }
.ai-step { border: 2px solid transparent; border-radius: var(--radius); padding: var(--space-3); display: grid; gap: var(--space-2); }
.ai-step.active { border-color: var(--text); }
.ai-step p { margin: 0; }
.ai-step-head { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; cursor: pointer; }
.ai-step textarea { width: 100%; }
.ai-tools { align-items: center; }
.ai-pick-list { display: flex; flex-direction: column; gap: var(--space-2); margin: var(--space-2) 0; max-height: 240px; overflow: auto; }
.ai-pick-list .chip { text-align: start; }
.ai-lab .card { margin-bottom: var(--space-3); }
.ai-lab .card + .card { margin-top: 0; }
.ai-lab .row select { width: auto; flex: 0 1 auto; }
.ai-lab .row input[type=text] { flex: 1 1 200px; width: auto; }

/* Video editor (after choosing a video): trim + cover */
.ed { position: fixed; inset: 0; z-index: 80; background: #000; color: #fff; display: flex; flex-direction: column; }
.ed-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: calc(env(safe-area-inset-top) + 8px) 12px 8px; }
.ed-title { font-weight: 700; }
.ed-round { width: 44px; height: 44px; border-radius: 50%; border: 0; background: #fff; color: #000; font: 700 1.2rem/1 system-ui, sans-serif; cursor: pointer; }
.ed-round.ed-done { background: #0a84ff; color: #fff; }
.ed-body { flex: 1; overflow: auto; padding: 0 12px calc(env(safe-area-inset-bottom) + 16px); }
.ed-stage { position: relative; background: #000; }
.ed-video { width: 100%; max-height: 52vh; display: block; object-fit: contain; background: #000; }
.ed-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 60px; height: 60px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.55); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.ed-play svg { width: 30px; height: 30px; }
.ed-section { margin-top: 14px; }
.ed-label { font-weight: 700; margin-bottom: 6px; }
.ed-hint { font-size: .88rem; color: #ccc; margin: 0; }
.ed-info { font-size: .88rem; color: #ccc; margin-top: 8px; font-variant-numeric: tabular-nums; }
.ed-warn { font-size: .88rem; color: #ffd60a; margin: 6px 0 0; }
.ed-warn[hidden] { display: none; }
.ed-track { position: relative; height: 44px; border-radius: 8px; background: #333; touch-action: none; }
.ed-range { position: absolute; top: 0; bottom: 0; background: rgba(255,214,10,.35); border-top: 3px solid #ffd60a; border-bottom: 3px solid #ffd60a; }
.ed-head { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: #fff; pointer-events: none; }
.ed-handle { position: absolute; top: 0; bottom: 0; width: 22px; margin-left: -11px; border-radius: 6px; background: #ffd60a; cursor: ew-resize; touch-action: none; }
.ed-handle::after { content: ""; position: absolute; left: 50%; top: 30%; bottom: 30%; width: 2px; margin-left: -1px; background: #000; border-radius: 1px; }
.ed-cover-thumb { width: 72px; aspect-ratio: 3 / 4; flex: none; border-radius: 8px; overflow: hidden; background: #222; display: flex; align-items: center; justify-content: center; color: #999; font-size: .8rem; }
.ed-cover-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ed .btn.secondary { background: #fff; color: #000; border-color: #fff; }
.ed-progress { position: absolute; inset: 0; background: rgba(0,0,0,.8); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .75rem; }
.ed-progress[hidden] { display: none; }
.crop { position: fixed; inset: 0; z-index: 90; background: #000; display: flex; flex-direction: column; gap: 12px; padding: calc(env(safe-area-inset-top) + 12px) 12px calc(env(safe-area-inset-bottom) + 12px); }
.crop-area { position: relative; flex: 1; min-height: 0; touch-action: none; overflow: hidden; }
.crop-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.crop-frame { position: absolute; border: 2px solid #fff; box-shadow: 0 0 0 9999px rgba(0,0,0,.55); cursor: move; touch-action: none; }
.strip { position: relative; height: 64px; border-radius: 8px; overflow: hidden; background: #222; cursor: pointer; touch-action: none; }
.strip-thumbs { display: flex; height: 100%; pointer-events: none; }
.strip-thumbs canvas { flex: 1 1 0; min-width: 0; height: 100%; object-fit: cover; }
.strip-head { position: absolute; top: 0; bottom: 0; width: 36px; border: 3px solid #fff; border-radius: 6px; box-shadow: 0 0 0 9999px rgba(0,0,0,.35); pointer-events: none; }
.crop input[type=range] { width: 100%; accent-color: #fff; }
.crop .btn.secondary { background: transparent; color: #fff; border-color: #fff; }
.crop .btn { background: #fff; color: #000; border-color: #fff; }

/* Profile photo editor (avatar-crop.js): a deep screen, the circle stays still and the photo moves under it.
   On deep, primary turns white and secondary stays mint (brand rule). */
body.no-scroll { overflow: hidden; }
.acrop { position: fixed; inset: 0; z-index: 90; background: var(--deep); color: var(--white); display: flex; flex-direction: column; align-items: center; gap: var(--space-3);
  padding: calc(env(safe-area-inset-top) + var(--space-4)) var(--space-4) calc(env(safe-area-inset-bottom) + var(--space-4)); overflow-y: auto; }
.acrop > * { width: 100%; max-width: 420px; }
.acrop:focus { outline: none; }
.acrop h2 { margin: 0; color: var(--white); }
.acrop-hint { margin: 0; font-size: 14px; }
.acrop-stage { position: relative; aspect-ratio: 1; flex: none; overflow: hidden; border-radius: var(--radius); touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
/* Shrinks on short windows so the zoom slider and buttons stay on screen (about 260px for the rest). */
.acrop > .acrop-stage { width: min(100%, 420px, max(200px, calc(100vh - 260px))); width: min(100%, 420px, max(200px, calc(100dvh - 260px))); }
.acrop-stage:active { cursor: grabbing; }
.acrop-stage:focus-visible { outline: 3px solid var(--white); outline-offset: 3px; }
.acrop-img { position: absolute; left: 0; top: 0; max-width: none; width: auto; height: auto; transform-origin: 0 0; pointer-events: none; -webkit-user-drag: none; }
.acrop-ring { position: absolute; border-radius: 50%; border: 2px solid var(--white); box-shadow: 0 0 0 9999px var(--scrim); pointer-events: none; }
.acrop-zoom { display: flex; align-items: center; gap: var(--space-3); font-size: 20px; font-weight: 700; }
.acrop-zoom input { flex: 1; accent-color: var(--white); min-height: var(--tap-small); }
.acrop .btn { background: var(--white); color: var(--deep); }
.acrop .btn.secondary { background: var(--mint); color: var(--deep); }

/* Privacy policy (public/privacy.html), age consent at sign-up */
.legal h2 { margin-top: var(--space-6); }
.legal ul { padding-left: var(--space-5); }
.legal li { margin: var(--space-1) 0; }
.consent { display: flex; gap: var(--space-2); align-items: flex-start; cursor: pointer; line-height: 1.4; }
.consent input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.legal-links { text-align: center; font-size: 14px; color: var(--muted); margin-top: var(--space-4); }
