:root {
  --ink: #1d2433; --soft: #5b6475; --line: #e3e6ec; --bg: #fbfaf7; --card: #fff;
  --accent: #1f2a44; --hi: #fff1c9; --a: #b4442f; --b: #2f6b8f; --ok: #2e7d4f;
  --bar: 76px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink); background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }  /* a class with its own display (.bar, .gloss) must not outrank the attribute */
body { margin: 0; padding-bottom: calc(var(--bar) + env(safe-area-inset-bottom) + 16px); }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }

.top {
  position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between;
  align-items: center; padding: 10px 16px; background: var(--accent); color: #fff;
}
.home { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.1rem; letter-spacing: .02em; }
.who { background: rgba(255,255,255,.14); border: 0; border-radius: 999px; padding: 8px 14px; color: #fff; min-height: 40px; }

main { max-width: 640px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.5rem; margin: 4px 0 2px; line-height: 1.2; }
.sub { color: var(--soft); margin: 0 0 10px; }
.label { display: inline-block; font-size: .8rem; color: var(--soft); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; margin: 0 0 12px; }

.lessons { list-style: none; padding: 0; margin: 0; }
.lessons a {
  display: block; background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px; margin-bottom: 12px; text-decoration: none; color: inherit;
}
.lessons .t { font-size: 1.15rem; font-weight: 600; }
.lessons .e { color: var(--soft); }
.ticks { margin-top: 6px; font-size: .85rem; color: var(--soft); }
.ticks .on { color: var(--ok); font-weight: 600; }

.tabs { display: flex; gap: 6px; margin: 8px 0 16px; }
.tabs a {
  flex: 1; text-align: center; padding: 12px 6px; border-radius: 12px; text-decoration: none;
  color: var(--ink); background: var(--card); border: 1px solid var(--line); font-weight: 600;
}
.tabs a[aria-current="page"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.tabs .done::after { content: " ✓"; color: var(--ok); }
.tabs a[aria-current="page"].done::after { color: #9be3b5; }

.listen { text-align: center; padding: 12px 0; }
.big {
  width: 132px; height: 132px; border-radius: 50%; border: 0; background: var(--accent);
  color: #fff; font-size: 3rem; line-height: 1; box-shadow: 0 6px 18px rgba(31,42,68,.25);
}
.big:active { transform: scale(.97); }
/* the seek strip is taller than the bar it draws, so a thumb can find it */
.seek { padding: 16px 0; margin: 8px 0 0; touch-action: none; cursor: pointer; }
.progress { height: 10px; background: var(--line); border-radius: 6px; position: relative; }
.progress > i { position: absolute; inset: 0 auto 0 0; background: var(--accent); width: 0; border-radius: 6px; }
.progress > b { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--bg); }
.progress > span {
  position: absolute; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 1px 4px rgba(31,42,68,.35);
}
.seek.drag .progress > span { transform: scale(1.25); }
.where { color: var(--soft); min-height: 1.4em; }
.hint { color: var(--soft); font-size: .95rem; margin: 18px 0; }
.primary, .ghost {
  border-radius: 12px; padding: 14px 18px; min-height: 52px; font-weight: 600; width: 100%;
  margin-top: 10px;
}
.primary { background: var(--accent); color: #fff; border: 0; }
.ghost { background: var(--card); border: 1px solid var(--line); }

.covers { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.seg { display: flex; align-items: center; gap: 6px; }
.seg > span { width: 5.2em; color: var(--soft); font-size: .9rem; }
.seg button { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 6px 14px; min-height: 40px; }
.seg button[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.turn {
  display: grid; grid-template-columns: 48px 1fr; gap: 10px; background: var(--card);
  border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 10px;
}
.turn .play {
  width: 48px; height: 48px; border-radius: 50%; border: 0; color: #fff; font-size: 1.1rem;
  align-self: start;
}
.turn[data-speaker="0"] .play { background: var(--a); }
.turn[data-speaker="1"] .play { background: var(--b); }
.turn .who-said { font-size: .78rem; font-weight: 700; letter-spacing: .05em; color: var(--soft); }
.turn .es { font-size: 1.3rem; line-height: 1.45; margin: 2px 0; }
.turn .s { padding: 0 2px; margin: 0 -2px; border-radius: 4px; }
.turn .s.now { background: var(--hi); }
.turn .w { border: 0; background: none; padding: 0 1px; margin: 0; font: inherit; color: inherit; border-radius: 4px;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.turn .w.now { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.turn .w.picked { outline: 2px solid var(--accent); outline-offset: 1px; }
.turn .w.blank { display: inline-block; height: .85em; background: var(--line); vertical-align: middle; }
.turn .es.covered, .turn .en.covered { cursor: pointer; }
.turn .sp { border: 0; background: none; color: var(--soft); font-size: .85em; padding: 0 4px 0 0; }
.turn .all { border: 1px solid var(--line); background: none; border-radius: 999px; font-size: .72rem; padding: 2px 8px; margin-left: 6px; color: var(--soft); letter-spacing: 0; font-weight: 600; }
.gloss { display: block; margin-top: 6px; background: var(--hi); border: 0; border-radius: 8px; padding: 6px 10px;
  font: inherit; font-size: .95rem; color: inherit; text-align: left; width: 100%; }
button.gloss { cursor: pointer; }
.gloss.floating { position: fixed; left: 12px; right: 12px; width: auto; margin: 0; z-index: 5;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .18); pointer-events: none; }
.gloss .say { color: var(--a); }
.gloss .lemma { color: var(--soft); }
.turn .en { color: var(--soft); font-size: .98rem; }

.note { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin-bottom: 12px; }
.note h2 { font-size: 1.1rem; margin: 0 0 6px; }
.note p, .note li { line-height: 1.5; }
.note ul { padding-left: 1.2em; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.chips button { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 6px 12px; min-height: 40px; font-size: .9rem; }

.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; gap: 10px;
  align-items: center; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: var(--card); border-top: 1px solid var(--line);
}
.speeds { display: flex; flex: 1; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 4px; }
.speeds button { flex: 1; border: 0; background: none; border-radius: 10px; min-height: 48px; font-weight: 600; color: var(--soft); }
.speeds button[aria-checked="true"] { background: var(--accent); color: #fff; }
.repeat { flex: 0 0 auto; min-height: 56px; min-width: 120px; border: 0; border-radius: 14px; background: var(--a); color: #fff; font-weight: 700; font-size: 1.05rem; }
.repeat:disabled { opacity: .4; }

dialog { border: 0; border-radius: 16px; padding: 20px; width: min(92vw, 420px); }
dialog::backdrop { background: rgba(0,0,0,.4); }
dialog h2 { margin-top: 0; }
.profile-list { display: grid; gap: 8px; margin-bottom: 14px; }
.profile-list button { min-height: 52px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); font-weight: 600; }
.profile-list button.cur { border-color: var(--accent); background: var(--hi); }
dialog label { display: grid; gap: 6px; color: var(--soft); }
dialog input { font: inherit; font-size: 1.1rem; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.row { display: flex; gap: 8px; margin-top: 14px; }
.row button { flex: 1; min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); }
.row .primary { margin: 0; width: auto; background: var(--accent); color: #fff; border: 0; }  /* .row button outranks .primary; without this the text is white on white */
.err { color: var(--a); }

/* sign-in and account (aiggs-bia) */
.signin { text-align: center; padding: 48px 0; }
.signin p { color: var(--soft); }
.signin .primary { display: inline-block; width: auto; margin-top: 12px; padding: 14px 28px; text-decoration: none; border-radius: 12px; }
.devices { list-style: none; padding: 0; margin: 0 0 14px; }
.devices li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.devices li small { color: var(--soft); display: block; }
.devices button { border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 6px 10px; }
.who.pending::after { content: " •"; color: var(--hi); }
