  /* Apple-inspired look. The frosted overlays are a web approximation (backdrop-filter), not Apple's Liquid Glass. */
  :root {
    --bg: #f5f5f7; --surface: #ffffff; --surface-2: #fbfbfd; --ink: #1d1d1f; --ink-2: #424245; --muted: #6e6e73;
    --line: rgba(0,0,0,.08); --accent: #0071e3; --accent-ink: #ffffff; --accent-soft: rgba(0,113,227,.10);
    --filler: #c9341f; --filler-bg: rgba(255,59,48,.12); --pause: #8a5a00; --pause-bg: rgba(255,179,0,.18);
    --good: #1a7f37; --good-bg: rgba(52,199,89,.14); --rec: #ff3b30;
    --shadow: 0 1px 2px rgba(20,20,40,.04), 0 12px 40px rgba(20,20,40,.06);
    --radius: 22px; --radius-sm: 14px;
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Geist", system-ui, sans-serif;
    --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Geist", system-ui, sans-serif;
  }
  @media (prefers-color-scheme: dark) {
    :root { --bg: #0b0b0d; --surface: #161618; --surface-2: #1c1c1f; --ink: #f5f5f7; --ink-2: #d2d2d7; --muted: #98989d;
      --line: rgba(255,255,255,.09); --accent: #2997ff; --accent-soft: rgba(41,151,255,.16);
      --filler: #ff7b6e; --filler-bg: rgba(255,69,58,.18); --pause: #ffd060; --pause-bg: rgba(255,204,0,.16);
      --good: #4cd17b; --good-bg: rgba(48,209,88,.16); --shadow: 0 1px 2px rgba(0,0,0,.3), 0 12px 40px rgba(0,0,0,.35); }
  }
  * { box-sizing: border-box; }
  html { -webkit-font-smoothing: antialiased; }
  body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.5 var(--font); letter-spacing: -.01em; }
  i.ph, i.ph-bold, i.ph-fill { font-size: 1.15em; vertical-align: -.15em; }

  /* Nav */
  nav { position: sticky; top: 0; z-index: 20; height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 24px;
    background: color-mix(in srgb, var(--bg) 72%, transparent); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--line); }
  nav .brand { font: 600 19px var(--display); letter-spacing: -.02em; display: flex; align-items: center; gap: 8px; }
  nav .brand i { color: var(--accent); }
  nav .spacer { flex: 1; }
  nav .meta { color: var(--muted); font-size: 14px; }

  main { max-width: 1440px; margin: 0 auto; padding: 28px 24px 80px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
  main > *, .topic > * { min-width: 0; }
  .card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; }
  .label { font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 0 12px; }

  /* Topic */
  .topic { display: grid; grid-template-columns: 1fr auto; gap: 20px 32px; align-items: center; padding: 28px 32px; }
  .topic .kind { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 4px 12px; border-radius: 999px; }
  .topic h1 { font: 600 clamp(26px, 3.2vw, 40px)/1.12 var(--display); letter-spacing: -.03em; margin: 12px 0 8px; outline: none; border-radius: 8px; }
  .topic h1:focus { box-shadow: 0 0 0 3px var(--accent-soft); }
  .topic .tip { color: var(--muted); margin: 0; max-width: 70ch; }
  .topic .actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
  .topic .count { color: var(--muted); font-size: 14px; text-align: right; margin-top: 8px; }
  .last { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); grid-column: 1 / -1; display: flex; gap: 12px; align-items: flex-start; color: var(--ink-2); font-size: 15px; }
  .last i { color: var(--accent); font-size: 20px; }

  /* Buttons */
  button, .btn { font: 500 15px var(--font); border: 0; cursor: pointer; border-radius: 999px; padding: 10px 18px; display: inline-flex; align-items: center; gap: 8px;
    background: var(--surface-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); transition: transform .15s ease, background .2s ease; white-space: nowrap; text-decoration: none; }
  button:hover, .btn:hover { background: color-mix(in srgb, var(--surface-2) 85%, var(--ink) 6%); }
  button:active, .btn:active { transform: scale(.97); }
  button.primary { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
  button.primary:hover { background: color-mix(in srgb, var(--accent) 88%, black); }
  button:disabled { opacity: .45; cursor: default; transform: none; }
  button:focus-visible, .btn:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; }

  /* Stage */
  .stage { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(340px, 1fr); gap: 24px; align-items: stretch; }
  .video-wrap { position: relative; border-radius: var(--radius); overflow: hidden; background: #0a0a0c; aspect-ratio: 16 / 10; box-shadow: var(--shadow); }
  video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
  .glass { background: rgba(28,28,32,.42); color: #fff; border: 1px solid rgba(255,255,255,.18);
    backdrop-filter: blur(22px) saturate(170%); -webkit-backdrop-filter: blur(22px) saturate(170%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 10px 30px rgba(0,0,0,.25); }
  @media (prefers-reduced-transparency: reduce) { .glass { background: rgba(28,28,32,.92); backdrop-filter: none; -webkit-backdrop-filter: none; } }
  .hud { position: absolute; top: 16px; left: 16px; right: 16px; display: flex; justify-content: space-between; gap: 8px; pointer-events: none; }
  .pill { border-radius: 999px; padding: 7px 14px; font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
  .rec-pill { opacity: 0; transition: opacity .3s ease; }
  .rec-pill.on { opacity: 1; }
  .rec-pill .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--rec); }
  .rec-pill.on .dot { animation: blink 1.2s infinite; }
  @keyframes blink { 50% { opacity: .25; } }
  .stats-pills { display: flex; gap: 8px; }
  .pill.silent { background: rgba(255,179,0,.55); }
  .prompter { position: absolute; left: 16px; right: 16px; bottom: 112px; max-height: 42%; overflow: auto; border-radius: var(--radius-sm); padding: 16px 20px; font-size: 20px; line-height: 1.45; display: none; }
  .prompter.on { display: block; }
  .dock { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); border-radius: 999px; padding: 10px 14px; display: flex; align-items: center; gap: 14px; }
  .dock .side { background: transparent; color: #fff; box-shadow: none; padding: 8px 12px; }
  .dock .side:hover { background: rgba(255,255,255,.12); }
  .shutter { width: 64px; height: 64px; border-radius: 50%; padding: 0; justify-content: center; background: transparent; box-shadow: inset 0 0 0 4px #fff; }
  .shutter::after { content: ""; width: 50px; height: 50px; border-radius: 50%; background: var(--rec); transition: all .25s cubic-bezier(.16,1,.3,1); }
  .shutter.recording::after { width: 24px; height: 24px; border-radius: 6px; }
  .shutter:hover { background: rgba(255,255,255,.08); }
  .cam-error { position: absolute; inset: 0; display: none; place-items: center; text-align: center; color: #f5f5f7; padding: 32px; }
  .cam-error.on { display: grid; }
  .cam-error i { font-size: 40px; display: block; margin-bottom: 10px; }

  .live { display: flex; flex-direction: column; padding: 24px; min-height: 0; }
  .live-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
  .live-head .label { margin: 0; }
  .captions { flex: 1; min-height: 300px; overflow: auto; font-size: 22px; line-height: 1.55; letter-spacing: -.015em; color: var(--ink); }
  .captions .interim { color: var(--muted); }
  .captions .empty { color: var(--muted); font-size: 17px; display: flex; flex-direction: column; gap: 8px; }
  .captions .empty i { font-size: 32px; color: var(--accent); }
  .live .note { margin: 14px 0 0; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
  .status { font-size: 15px; color: var(--muted); min-height: 1.5em; }
  .status.err { color: var(--filler); }

  .f { color: var(--filler); background: var(--filler-bg); border-radius: 6px; padding: 0 4px; font-weight: 600; }
  .p { color: var(--pause); background: var(--pause-bg); border-radius: 6px; padding: 1px 6px; font-size: .62em; font-weight: 700; white-space: nowrap; vertical-align: .2em; }
  .p.long { box-shadow: inset 0 0 0 1.5px var(--pause); }

  /* Analysing skeleton */
  .loading { display: none; }
  .loading.on { display: grid; gap: 14px; }
  .sk { height: 18px; border-radius: 8px; background: linear-gradient(90deg, var(--line) 25%, color-mix(in srgb, var(--line) 40%, transparent) 50%, var(--line) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite linear; }
  @keyframes shimmer { to { background-position: -200% 0; } }

  /* Results */
  #results { display: grid; gap: 24px; }
  #results.enter { animation: rise .6s cubic-bezier(.16,1,.3,1); }
  @keyframes rise { from { opacity: 0; transform: translateY(16px); } }
  .overview { display: grid; grid-template-columns: auto 1fr; gap: 28px 36px; align-items: center; }
  .score-ring { width: 128px; height: 128px; border-radius: 50%; display: grid; place-items: center;
    background: conic-gradient(var(--accent) calc(var(--v) * 1%), var(--line) 0); }
  .score-ring div { width: 106px; height: 106px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font: 700 38px var(--display); letter-spacing: -.03em; }
  .score-ring small { display: block; font: 500 13px var(--font); color: var(--muted); margin-top: -18px; }
  .overview h2 { font: 600 26px/1.2 var(--display); letter-spacing: -.02em; margin: 0 0 6px; }
  .overview p { margin: 0; color: var(--ink-2); max-width: 75ch; }
  .tiles { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
  .tile { background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px 16px; box-shadow: inset 0 0 0 1px var(--line); }
  .tile b { display: block; font: 600 28px var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
  .tile span { color: var(--muted); font-size: 13px; }
  .tile.bad b { color: var(--filler); }
  .chips { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
  .chip { background: var(--filler-bg); color: var(--filler); border-radius: 999px; padding: 4px 12px; font-size: 14px; font-weight: 600; }
  .transcript { font-size: 22px; line-height: 2; letter-spacing: -.015em; }
  .fb { margin: 16px 0 0; color: var(--ink-2); display: flex; gap: 10px; }
  .fb i { color: var(--pause); font-size: 20px; flex: none; }
  .versions { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
  .version { white-space: pre-wrap; font-size: 19px; line-height: 1.6; }
  .card.story { background: linear-gradient(160deg, var(--accent-soft), transparent 60%), var(--surface); }
  .card.story .label { color: var(--accent); }
  .coach { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
  .habit { padding: 14px 0; }
  .habit + .habit { border-top: 1px solid var(--line); }
  .habit b { display: block; font-size: 17px; }
  .habit q { display: block; color: var(--muted); font-style: italic; margin: 4px 0 6px; }
  .rw { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; margin-bottom: 10px; font-size: 15px; }
  .rw div { border-radius: var(--radius-sm); padding: 10px 14px; }
  .rw .b { background: var(--filler-bg); }
  .rw .a { background: var(--good-bg); }
  .rw i { color: var(--muted); }
  .drill { margin-top: 20px; padding: 18px 20px; border-radius: var(--radius-sm); background: var(--accent-soft); display: flex; gap: 12px; }
  .drill i { color: var(--accent); font-size: 22px; flex: none; }

  /* History */
  table { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
  th { text-align: left; font-weight: 500; color: var(--muted); font-size: 13px; padding: 0 12px 10px; }
  td { padding: 12px; }
  tbody tr:nth-child(odd) td { background: var(--surface-2); }
  tbody tr td:first-child { border-radius: 10px 0 0 10px; }
  tbody tr td:last-child { border-radius: 0 10px 10px 0; }
  tr.click { cursor: pointer; }
  tr.click:hover td { background: var(--accent-soft); }
  .empty-history { color: var(--muted); display: flex; align-items: center; gap: 10px; }
  .hidden { display: none !important; }

  @media (max-width: 1100px) { .stage { grid-template-columns: 1fr; } .captions { min-height: 220px; } .tiles { grid-template-columns: repeat(3, 1fr); } }
  @media (max-width: 760px) {
    main { padding: 16px 16px 60px; gap: 16px; } nav { padding: 0 16px; }
    .card { padding: 20px; } .topic { grid-template-columns: minmax(0, 1fr); padding: 22px; } .topic .actions { justify-content: flex-start; } .topic .count { text-align: left; }
    .versions, .coach { grid-template-columns: 1fr; } .overview { grid-template-columns: 1fr; } .tiles { grid-template-columns: repeat(2, 1fr); }
    .rw { grid-template-columns: 1fr; } .rw i { display: none; } .video-wrap { aspect-ratio: 3 / 4; } .stats-pills .pill span { display: none; }
    .table-wrap { overflow-x: auto; }
  }
  @media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Tabs (shared nav) */
.tabs { display: flex; gap: 4px; margin-left: 20px; background: color-mix(in srgb, var(--ink) 6%, transparent); padding: 3px; border-radius: 999px; }
.tabs a { color: var(--ink-2); text-decoration: none; font-size: 14px; font-weight: 500; padding: 6px 14px; border-radius: 999px; white-space: nowrap; }
.tabs a.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
@media (max-width: 760px) { nav .meta { display: none; } .tabs { margin-left: 8px; } .tabs a { padding: 6px 10px; font-size: 13px; } nav .brand span.word { display: none; } }

/* Logo: an original sticker-style "yapping" speech bubble (nod to the 🗣️ yap meme) */
.brand { gap: 10px !important; }
.logo { width: 34px; height: 34px; display: inline-block; transform: rotate(-8deg); filter: drop-shadow(2px 2px 0 var(--ink)); transition: transform .25s cubic-bezier(.16,1,.3,1); }
.logo svg { width: 100%; height: 100%; display: block; overflow: visible; }
.logo .bubble { fill: var(--accent); stroke: var(--ink); stroke-width: 2.6; stroke-linejoin: round; }
.logo .mouth { transform-origin: 20px 16px; transform-box: view-box; }
.brand .word { font: 600 19px var(--display); letter-spacing: -.03em; text-transform: lowercase; }
.brand .word b { font-weight: 800; }
.brand:hover .logo { transform: rotate(4deg) scale(1.06); }
.brand:hover .logo .mouth, body.playing .logo .mouth { animation: yap .22s ease-in-out infinite alternate; }
@keyframes yap { from { transform: scaleY(1); } to { transform: scaleY(.28); } }
@media (prefers-reduced-motion: reduce) { .logo .mouth { animation: none !important; } }
