/* Kandu brand — Eggplant on white/tint, large & high-contrast for low-vision
   / elderly patients. Palette + type per Kandu Brand Guidelines (Oct 2025):
   white & Eggplant Tint dominant, Eggplant for emphasis; body = Assistant. */
:root {
  --bg: #ffffff;
  --ink: #1c1430;          /* near-black eggplant for body text */
  --muted: #5f5e5a;        /* brand Grey */
  --brand: #2D0554;        /* Eggplant — primary actions/headers */
  --accent: #2D0554;
  --azure: #816998;        /* Eggplant Light — secondary accent (timer/progress) */
  --accent-ink: #ffffff;
  --ok: #1d9e75;           /* "good function" green (clinical readout) */
  --rec: #D1491F;          /* Pumpkin — record indicator */
  --line: #d8d3e0;         /* light eggplant border */
  --panel: #EAE6EE;        /* Eggplant Tint — surfaces */
  --figure: #2D0554;       /* demo figure eggplant */
}
* { box-sizing: border-box; }

/* brand header */
.brand-header { display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; padding: 8px 0 18px; border-bottom: 2px solid var(--line);
  margin-bottom: 22px; }
.research-badge { font-size: .85rem; font-weight: 700; color: var(--brand);
  border: 1.5px solid var(--line); border-radius: 999px; padding: 5px 12px;
  text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.brand-home { display: inline-flex; }
.brand-logo { height: 38px; width: auto; display: block; }
body {
  margin: 0;
  font: 20px/1.5 "Assistant", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}
#app { max-width: 1000px; margin: 0 auto; padding: 24px 20px 80px; }
h1, h2 { font-family: "Lexend Deca", "Assistant", sans-serif; color: var(--brand); }
h1 { font-size: 2.4rem; margin: 0 0 10px; }
h2 { font-size: 2rem; margin: 0 0 10px; }
.lead { font-size: 1.5rem; color: var(--ink); margin: 0 0 18px; }
.card {
  background: var(--bg);
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 26px;
  margin-bottom: 18px;
}
.hidden { display: none !important; }
.steps { padding-left: 26px; margin: 0 0 22px; font-size: 1.4rem; }
.steps li { margin-bottom: 14px; }

.field { display: block; margin: 18px 0; font-size: 1.3rem; font-weight: 600; }
.field select, .field input[type="text"] {
  display: block; margin-top: 8px; width: 100%; padding: 16px;
  background: #fff; color: var(--ink); border: 2px solid var(--line);
  border-radius: 10px; font-size: 1.4rem;
}
.toggle { display: flex; align-items: center; gap: 12px; font-size: 1.3rem;
  margin: 18px 0; font-weight: 600; }
.toggle input { width: 28px; height: 28px; flex-shrink: 0; }
.consent { align-items: flex-start; }
.consent input { margin-top: 3px; }

/* big arm-choice buttons (replaces a dropdown for low-vision/elderly users) */
.side-choice { display: flex; gap: 14px; margin-top: 10px; flex-wrap: wrap; }
.side-choice .choice {
  flex: 1 1 180px; min-height: 84px; font-size: 1.4rem; font-weight: 700;
  background: #fff; color: var(--ink); border: 3px solid var(--line);
  border-radius: 14px; cursor: pointer; padding: 16px;
}
.side-choice .choice:hover { border-color: var(--accent); }
.side-choice .choice.selected {
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
}
/* de-emphasized fallback: small, full-width, dashed — most patients know their side */
.side-choice .choice.mini {
  flex: 1 1 100%; min-height: 0; padding: 8px 12px; font-size: 1rem; font-weight: 500;
  border-style: dashed; color: var(--muted);
}
.side-choice .choice.mini.selected { color: var(--accent-ink); border-style: solid; }

button {
  font: inherit; cursor: pointer; border-radius: 12px; padding: 14px 22px;
  border: 2px solid var(--line); background: #fff; color: var(--ink);
}
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.primary:disabled { background: #9bb0d8; border-color: #9bb0d8; cursor: default; }
button.big { font-size: 1.6rem; padding: 18px 34px; }
.controls { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 20px; }
/* the lone Start button: wide + centered (before recording begins) */
#startBtn { flex: 1 1 100%; max-width: 560px; margin-inline: auto; }
.status { color: var(--muted); font-size: 1.2rem; min-height: 1.3em; }
.hint { color: var(--muted); font-size: 1rem; }

/* capture layout */
.prompt-wrap { display: flex; align-items: center; gap: 16px; margin-bottom: 10px;
  background: var(--panel); border-radius: 14px; padding: 14px 18px; }
.capture-hint { margin: 0 0 16px; font-size: 1.15rem; font-weight: 600; color: var(--muted); }
.step-timer {
  flex: 0 0 auto; min-width: 72px; height: 72px; border-radius: 50%;
  display: grid; place-items: center; font-size: 2rem; font-weight: 800;
  color: var(--accent-ink); background: var(--azure);
}
.step-timer.low { background: var(--rec); }   /* last few seconds */

/* progress through the movement sequence */
.progress { margin: 0 0 16px; }
.progress-label { font-size: 1rem; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.progress-track { height: 10px; background: var(--line); border-radius: 6px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: var(--azure); transition: width .3s ease; }
.prompt-big {
  flex: 1; font-size: 2.1rem; font-weight: 800; line-height: 1.25; text-align: left;
  min-height: 2.4em; display: flex; align-items: center;
}
.guide-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 760px) { .guide-grid { grid-template-columns: 1fr; } }

/* capture step rail (left): numbered moves, struck through as completed */
.capture-cols { display: flex; gap: 22px; align-items: flex-start; }
.capture-main { flex: 1; min-width: 0; }
.step-rail { flex: 0 0 210px; }
@media (max-width: 760px) {
  .capture-cols { flex-direction: column; }
  .step-rail { flex: none; width: 100%; }
}
.step-list { list-style: none; margin: 6px 0 0; padding: 0; }
.step-item { display: flex; align-items: center; gap: 10px; padding: 9px 0;
  font-size: 1.1rem; line-height: 1.25; color: var(--muted); }
.step-num { flex: 0 0 1.8em; height: 1.8em; border-radius: 50%; display: grid;
  place-items: center; background: var(--panel); color: var(--ink);
  font-weight: 800; font-size: .9rem; }
.step-item.active { color: var(--ink); font-weight: 700; }
.step-item.active .step-num { background: var(--accent); color: var(--accent-ink); }
.step-item.done .step-name { text-decoration: line-through; }
.step-item.done .step-num { background: var(--ok); color: #fff; }
.step-num.check { font-size: 1.1rem; }
.panel-label { font-size: 1.2rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; text-align: center; }
.demo-panel svg { width: 100%; height: auto; max-height: 420px; background: var(--panel);
  border-radius: 14px; }
.demo-video { width: 100%; aspect-ratio: 4 / 3; height: auto; background: var(--panel);
  border-radius: 14px; object-fit: contain; display: block; }
.sound-btn { display: block; margin: 0 auto 10px; font-size: .95rem; font-weight: 600;
  padding: 7px 16px; border: 1.5px dashed var(--line); border-radius: 999px;
  background: #fff; color: var(--brand); cursor: pointer; }
.sound-btn:hover { border-color: var(--accent); }
#demo line { stroke: var(--figure); stroke-width: 9; stroke-linecap: round; }
#demo #head { fill: var(--figure); }
#demo #lHand, #demo #rHand { fill: var(--figure); }
#demo #neck, #demo #torso, #demo #hips, #demo #shoulders,
#demo #lLeg, #demo #rLeg { stroke: #98a6bd; }

.stage { position: relative; width: 100%; aspect-ratio: 4/3; background: #000;
  border-radius: 14px; overflow: hidden; }
#video, #overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
#video { object-fit: cover; transform: scaleX(-1); }
#overlay { transform: scaleX(-1); }
.countdown { position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 7rem; font-weight: 900; color: #fff; text-shadow: 0 2px 16px #000; }
.rec { color: var(--rec); font-weight: 800; font-size: 1.4rem; letter-spacing: .03em; }

.scorebox { display: flex; gap: 24px; align-items: center; margin: 20px 0;
  padding: 24px; background: var(--panel); border-radius: 14px; }
.score-num { font-size: 4rem; font-weight: 900; color: var(--ok); line-height: 1; }
.score-num small { font-size: 1.3rem; color: var(--muted); font-weight: 600; }
.score-cap { font-size: 1.1rem; color: var(--muted); font-weight: 600; }
.score-label { font-weight: 700; font-size: 1.5rem; margin-bottom: 8px; }
.probs { display: flex; gap: 18px; color: var(--muted); font-size: 1.1rem; flex-wrap: wrap; }
.disclaimer { color: var(--muted); font-size: 1rem; border-top: 2px solid var(--line);
  padding-top: 14px; margin-top: 12px; }
.advanced summary { cursor: pointer; color: var(--muted); font-size: 1.1rem; }
