/* Bonjour Brilliant palette (from the Canva brand kit) */
:root {
  --bg: #f8f6f6;
  --card: #ffffff;
  --ink: #01175e;
  --muted: #3a4a56;
  --line: #dbcab8;
  --accent: #cd1a1a;
  --accent-soft: #e8eff5;
  --ok: #3a6080;
  --ok-soft: #e8eff5;
  --bad: #cd1a1a;
  --bad-soft: #f5f0e8;
  --warn-soft: #f5f0e8;
  --track: #dbcab8;
  --track-done: #8fb8d4;
  --cream: #f5f0e8;
  --radius: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
kbd { background: #fff; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; font-size: 12px; }

.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 20px; }
.brand { font-weight: 800; font-size: 20px; letter-spacing: -.01em; }
.brand span { font-weight: 500; color: var(--muted); font-size: 14px; margin-left: 8px; }
.lesson-pick { display: flex; align-items: center; gap: 10px; min-width: 0; }
.lesson-meta { color: var(--muted); font-size: 14px; }
select { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; max-width: 100%; }

.layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); gap: 20px; padding: 0 20px 28px; max-width: 1280px; margin: 0 auto; align-items: start; }
@media (max-width: 900px) { .layout { grid-template-columns: minmax(0, 1fr); padding: 0 16px 24px; } }

/* ---------- video ---------- */
.video-wrap { position: relative; aspect-ratio: 16 / 9; background: #111; border-radius: var(--radius); overflow: hidden; }
.video-wrap video, #ytHost, #ytHost iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
#ytHost:empty { display: none; }
.click-catcher { position: absolute; inset: 0; cursor: pointer; }
.subs { position: absolute; left: 0; right: 0; bottom: 5%; text-align: center; padding: 0 5%; pointer-events: none; }
.subs div { display: inline-block; background: rgba(1, 23, 94, .88); color: #fff; padding: 4px 12px; border-radius: 8px; font-size: clamp(15px, 2.3vw, 24px); font-weight: 600; line-height: 1.35; }
.subs .en { display: block; width: fit-content; margin: 5px auto 0; font-weight: 400; font-size: clamp(13px, 1.7vw, 18px); color: #dbcab8; }
.subs .en:empty { display: none; }
.hold { position: absolute; top: 12px; right: 12px; background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 12px; display: grid; gap: 1px; font-size: 13px; min-width: 150px; }
.hold strong { font-size: 17px; }
.hold .bar { height: 4px; background: rgba(255,255,255,.35); border-radius: 2px; margin-top: 5px; overflow: hidden; }
.hold .bar i { display: block; height: 100%; width: 0; background: #fff; }
.video-msg { position: absolute; inset: 0; display: grid; place-content: center; gap: 12px; text-align: center; padding: 24px; background: var(--ink); color: #fff; }
.video-msg p { margin: 0; max-width: 46ch; }
.video-msg .btn { background: var(--accent); border-color: var(--accent); justify-self: center; }
[hidden] { display: none !important; }

/* ---------- timeline ---------- */
.timeline { display: flex; gap: 3px; height: 30px; margin-top: 14px; }
.timeline .seg-t { position: relative; min-width: 6px; border: 0; padding: 0; border-radius: 6px; background: var(--track); overflow: hidden; color: var(--ink); font-size: 11px; font-weight: 700; }
.timeline .seg-t i { position: absolute; inset: auto auto 0 0; height: 5px; width: 0; background: var(--accent); }
.timeline .seg-t span { position: relative; }
.timeline .seg-t:hover { background: var(--track-done); }
.timeline .seg-t.done { background: var(--track-done); }
.timeline .seg-t.on { outline: 2px solid var(--ink); outline-offset: 1px; background: #fff; }
.timeline .gap-t { min-width: 0; border: 0; padding: 0; background: transparent; position: relative; }
.timeline .gap-t::after { content: ""; position: absolute; left: 0; right: 0; top: 13px; height: 4px; border-radius: 2px; background: var(--track); }
.time-row { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; margin-top: 6px; font-variant-numeric: tabular-nums; }

/* ---------- controls ---------- */
.controls { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.ctl { display: inline-flex; align-items: center; gap: 8px; height: 48px; min-width: 48px; justify-content: center; padding: 0 12px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; }
.ctl svg { width: 22px; height: 22px; fill: currentColor; }
.ctl:hover { border-color: var(--ink); }
.ctl.play { width: 60px; height: 60px; background: var(--ink); color: #fff; border-color: var(--ink); }
.ctl.replay { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; padding: 0 18px; }
.ctl .i-pause { display: none; }
.playing .ctl .i-pause { display: block; }
.playing .ctl .i-play { display: none; }

.options { display: flex; flex-wrap: wrap; gap: 14px 22px; justify-content: center; margin-top: 16px; }
.opt { display: grid; gap: 4px; }
.opt-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 6px 11px; border-radius: 7px; font-size: 14px; font-variant-numeric: tabular-nums; }
.seg button:hover { background: var(--bg); }
.seg button.on, .seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* ---------- side panel ---------- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; border: 0; background: transparent; padding: 13px 8px; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
.sent-list { list-style: none; margin: 0; padding: 8px; max-height: 68vh; overflow: auto; }
.sent-list li { display: grid; grid-template-columns: 26px 1fr; gap: 6px; padding: 9px 10px; border-radius: 10px; cursor: pointer; }
.sent-list li:hover { background: var(--bg); }
.sent-list li.on { background: var(--accent-soft); }
.sent-list .n { color: var(--muted); font-size: 13px; font-weight: 700; padding-top: 2px; }
.sent-list .fr { font-weight: 600; }
.sent-list .en { color: var(--muted); font-size: 14px; }
.sent-list .badge { font-size: 12px; font-weight: 700; color: var(--ok); margin-left: 6px; white-space: nowrap; }
.hide-text .sent-list .fr, .hide-text .sent-list .en, .hide-text .lab-fr, .hide-text .lab-en { filter: blur(6px); transition: filter .15s; }
.hide-text .sent-list li:hover .fr, .hide-text .sent-list li:hover .en, .hide-text .lab-target:hover p { filter: none; }
.hide-en .sent-list .en, .hide-en .lab-en { display: none; }

/* ---------- recording lab ---------- */
.lab { padding: 16px; display: grid; gap: 14px; }
.lab-target { background: var(--bg); border-radius: 12px; padding: 12px 14px; }
.lab-num { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.lab-fr { margin: 2px 0 0; font-size: 19px; font-weight: 700; line-height: 1.35; }
.lab-en { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.lab-steps { display: grid; gap: 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--ink); background: var(--ink); color: #fff; font-weight: 700; text-decoration: none; cursor: pointer; font-size: 15px; }
.btn.ghost { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink); }
.btn b { display: inline-grid; place-content: center; width: 22px; height: 22px; border-radius: 50%; background: rgba(127,127,127,.2); font-size: 13px; }
.btn.rec { background: var(--accent); border-color: var(--accent); }
.btn.rec.live { background: var(--bad); border-color: var(--bad); animation: pulse 1.2s infinite; }
.btn:disabled { opacity: .5; cursor: default; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(205,26,26,.18); } }
.meter { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--ok); transition: width .06s; }
.lab-result { display: grid; gap: 12px; }
#wave { width: 100%; height: 56px; background: var(--bg); border-radius: 10px; }
.lab-play { display: flex; gap: 8px; flex-wrap: wrap; }
.lab-play .btn { flex: 1; padding: 9px 10px; font-size: 14px; white-space: nowrap; }
.lab-note { color: var(--muted); font-size: 12.5px; margin: 0; }

.feedback { display: grid; gap: 10px; }
.score { display: flex; align-items: baseline; gap: 10px; }
.score strong { font-size: 30px; line-height: 1; }
.score span { font-weight: 700; }
.words { margin: 0; font-size: 18px; line-height: 2; }
.words span { padding: 2px 5px; border-radius: 6px; margin-right: 2px; }
.words .ok { background: var(--ok-soft); color: var(--ok); }
.words .miss { background: var(--bad-soft); color: var(--bad); text-decoration: underline wavy; text-underline-offset: 4px; }
.heard { margin: 0; font-size: 14px; color: var(--muted); }
.notes { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.notes li { padding: 8px 11px; border-radius: 10px; background: var(--bg); font-size: 14.5px; }
.notes li.good { background: var(--ok-soft); }
.notes li.fix { background: var(--warn-soft); }
.notes li b { display: block; }

.mic-help { display: grid; gap: 8px; padding: 12px 14px; border-radius: 12px; background: var(--warn-soft); border: 1px solid var(--line); font-size: 14.5px; }
.mic-help p { margin: 0; }
.mic-help .btn { justify-self: start; }

/* ---------- embed mode: index.html?embed=1, inside a course lesson page ---------- */
.embed body { background: transparent; }
.embed .top { display: none; }
.embed .layout { grid-template-columns: minmax(0, 1fr); gap: 18px; padding: 2px; max-width: 760px; }
.embed .sent-list { max-height: 340px; } /* fixed, so the frame height can follow the content */
.embed .options { gap: 12px 18px; }
@media (max-width: 480px) {
  .embed .controls { gap: 8px; }
  .embed .ctl.replay { padding: 0 14px; }
  .embed .options { justify-content: flex-start; }
  .embed .seg button { padding: 6px 9px; }
  .embed .lab { padding: 12px; }
}
@media (max-width: 400px) { /* keep the four playback buttons on one row on small phones */
  .embed .controls { gap: 6px; flex-wrap: nowrap; }
  .embed .ctl { height: 44px; min-width: 44px; padding: 0 10px; }
  .embed .ctl.play { width: 56px; height: 56px; flex: none; }
  .embed .ctl.replay { padding: 0 12px; font-size: 14px; white-space: nowrap; }
}
