/* BayRen Speaking — app-specific styles (built on main.css tokens). */

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hide-sm { }
.nav-badge {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px;
  padding: 0 5px; border-radius: 999px; background: var(--gold); color: var(--navy-900);
  font-size: .72rem; font-weight: 700;
}
.back-link { display: inline-block; margin: 1.2rem 0 .4rem; font-weight: 600; color: var(--muted); }
.back-link:hover { color: var(--gold-700); }

/* ── Flash messages ─────────────────────────────────────────────────────── */
.flash-wrap { margin-top: 1rem; display: grid; gap: .6rem; }
.flash {
  border-radius: var(--r-sm); padding: .7rem 1rem; font-size: .92rem; font-weight: 500;
  border: 1px solid var(--line);
}
.flash-error { background: var(--wrong-bg); color: var(--wrong); border-color: #f2c9c9; }
.flash-ok { background: var(--correct-bg); color: var(--correct); border-color: #bfe8d2; }

/* ── Home / topic grids ─────────────────────────────────────────────────── */
.home-wrap { padding: 1.6rem 0 3rem; }
.home-hello h1 { margin-bottom: .2rem; }
.part-block { margin-top: 2.2rem; }
.part-head { display: flex; align-items: baseline; gap: .9rem; flex-wrap: wrap; margin-bottom: 1rem; }
.part-head h2 { margin: 0; }
.stat-strip {
  display: flex; gap: 1.2rem; flex-wrap: wrap; padding: 1.1rem 1.4rem; margin-top: 1.2rem;
}
.stat-strip .stat { flex: 1; min-width: 120px; }
.stat-value { font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; color: var(--ink); }
.stat-label { font-size: .78rem; color: var(--muted); }

/* ── Question page ──────────────────────────────────────────────────────── */
.q-wrap { padding: 0 0 3rem; max-width: 760px; }
.q-head { margin-top: .4rem; }
.q-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.q-title { font-size: clamp(1.4rem, 4vw, 2rem); margin: .7rem 0 0; }
.cue-card {
  margin-top: 1.2rem; border: 1px solid var(--gold-300); background: var(--gold-50);
  border-radius: var(--r-md); padding: 1rem 1.2rem;
}
.cue-label { font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--gold-700); }
.cue-card ul { margin: .5rem 0 0; padding-left: 1.2rem; color: var(--navy-800); }

.q-controls { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin: 1.3rem 0 0; }
.seg-toggle {
  display: inline-flex; border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--surface); overflow: hidden;
}
.seg-btn {
  border: none; background: transparent; padding: .5rem 1.1rem; font-weight: 600;
  color: var(--muted); transition: background var(--t-fast), color var(--t-fast);
}
.seg-btn.active { background: var(--navy); color: #fff; }
.accent-pick select {
  font: inherit; font-weight: 600; color: var(--ink); padding: .5rem 2.1rem .5rem 1rem;
  border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface);
  appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2371809b' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .9rem center;
}
.pill-toggle {
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted);
  padding: .5rem 1.1rem; border-radius: 999px; font-weight: 600; font-family: var(--font-bn);
}
.pill-toggle.on { border-color: var(--gold); background: var(--gold-50); color: var(--gold-700); }
.xp-note { margin-left: auto; font-weight: 700; color: var(--gold-700); }

.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--line); margin-top: 1.5rem; }
.tab {
  border: none; background: transparent; border-bottom: 2px solid transparent;
  padding: .65rem 1.1rem; font-weight: 600; color: var(--muted);
}
.tab.active { border-bottom-color: var(--gold); color: var(--navy-800); }
.tab-pane { margin-top: 1.5rem; }

/* ── Read pane ──────────────────────────────────────────────────────────── */
.player-bar { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; }
.sentence-list { margin-top: 1.3rem; display: grid; gap: .35rem; }
.sentence-row {
  display: flex; align-items: flex-start; gap: .8rem; padding: .6rem .9rem;
  border-left: 2px solid transparent; border-radius: var(--r-sm); transition: background var(--t-fast);
}
.sentence-row:hover { background: var(--surface-2); }
.sentence-row.active { border-left-color: var(--gold); background: var(--gold-50); }
.sentence-play {
  flex: 0 0 30px; width: 30px; height: 30px; margin-top: .15rem;
  border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--muted); font-size: .7rem; display: grid; place-items: center;
}
.sentence-row.active .sentence-play { background: var(--gold); border-color: var(--gold); color: var(--navy-900); }
.sentence-en { margin: 0; font-size: 1.1rem; line-height: 1.6; color: var(--ink); }
.sentence-row.active .sentence-en { font-weight: 600; }
.sentence-bn { margin: .2rem 0 0; color: var(--muted); font-size: .98rem; }

.phrases { margin-top: 1.6rem; border-top: 1px solid var(--line); padding-top: 1.1rem; }
.phrases-head { font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.phrases-list { list-style: none; margin: .8rem 0 0; padding: 0; display: grid; gap: .7rem; }
.phrase-chip { background: var(--gold-50); border-color: var(--gold-300); color: var(--gold-700); text-transform: none; }
.phrase-bn { display: block; margin-top: .2rem; padding-left: .2rem; color: var(--muted); font-size: .95rem; }

/* ── Chorus pane ────────────────────────────────────────────────────────── */
.chorus-card { margin-top: 1rem; padding: 1.6rem; }
.chorus-meta { display: flex; justify-content: space-between; gap: 1rem; font-size: .74rem;
  font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.chorus-status.listening { color: var(--navy-700); }
.chorus-status.repeating { color: var(--gold-700); }
.chorus-sentence { margin: 1rem 0 0; font-size: 1.4rem; line-height: 1.6; color: var(--ink); }
.chunk-active { background: var(--gold-100); border-radius: 6px; padding: 0 .15em;
  box-shadow: 0 0 0 1px var(--gold-300); font-weight: 600; color: var(--navy-900);
  -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.chunk-spoken { color: var(--muted); opacity: .65; }
.chunk-todo { color: var(--text); }
.chorus-bn { margin: .6rem 0 0; color: var(--muted); }
.chorus-bar { margin-top: 1.2rem; height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.chorus-bar-fill { height: 100%; width: 0; border-radius: 999px; background: var(--navy-300, #9db4d0);
  transition: width .1s linear; }
.chorus-bar-fill.listening { background: var(--navy); }
.chorus-bar-fill.repeating { background: var(--gold); }
.chorus-controls { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: 1.1rem; }

.q-nav { display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  border-top: 1px solid var(--line); margin-top: 2.5rem; padding-top: 1.3rem; }

/* ── Progress page ──────────────────────────────────────────────────────── */
.cols { display: grid; gap: 1.6rem; grid-template-columns: 1fr; margin-top: 1.8rem; }
@media (min-width: 780px) { .cols { grid-template-columns: 1fr 1fr; } }
.col h2 { font-size: 1.3rem; }
.leaderboard, .recent-list { padding: .6rem; display: grid; gap: .1rem; }
.lb-row, .recent-row { display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border-radius: var(--r-sm); }
.lb-row.lb-me { background: var(--gold-50); }
.lb-rank { flex: 0 0 26px; font-family: var(--font-display); font-weight: 700; color: var(--navy-700); }
.lb-name { flex: 1; font-weight: 600; color: var(--ink); }
.lb-xp { font-weight: 700; color: var(--gold-700); }
.recent-id { flex: 1; color: var(--muted); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-xp { font-weight: 700; color: var(--gold-700); }

/* ── Admin ──────────────────────────────────────────────────────────────── */
.admin-wrap { padding: 1.4rem 0 3rem; }

@media (max-width: 560px) {
  .hide-sm { display: none; }
  .q-head-row { flex-direction: column; }
}

/* ── Listening test player ──────────────────────────────────────────────── */
.pcard-desc { margin: .1rem 0 0; font-size: .9rem; line-height: 1.45; }
.lt-wrap { padding: 0 0 3rem; max-width: 760px; }
.lt-root { margin-top: .4rem; }

.lt-setup { padding: 2rem; }
.lt-ico { width: 48px; height: 48px; border-radius: 12px; background: var(--surface-2);
  display: grid; place-items: center; font-size: 1.4rem; }
.lt-title { margin: 1rem 0 .2rem; font-size: clamp(1.6rem, 4vw, 2.2rem); }
.lt-chips { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .8rem; }
.lt-sub { font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin-top: 1.6rem; }
.lt-modes { display: grid; gap: .8rem; margin-top: .6rem; }
@media (min-width: 620px) { .lt-modes { grid-template-columns: 1fr 1fr; } }
.lt-mode { text-align: left; border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--surface); padding: 1rem; }
.lt-mode.sel { border-color: var(--gold); background: var(--gold-50); }
.lt-mode-t { font-weight: 700; color: var(--ink); }
.lt-mode-d { font-size: .88rem; margin-top: .2rem; }
.lt-accents { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .6rem; }
.lt-accent { border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted);
  border-radius: 999px; padding: .5rem 1.2rem; font-weight: 600; }
.lt-accent.sel { border-color: var(--gold); background: var(--gold-50); color: var(--gold-700); }
.lt-start { margin-top: 1.8rem; }

.lt-topbar { display: flex; justify-content: flex-end; margin-bottom: .8rem; }
.lt-audio { position: sticky; top: 72px; z-index: 20; padding: .9rem 1rem; }
.lt-audio-el { width: 100%; }
.lt-audio-row { display: flex; align-items: center; gap: .8rem; }
.lt-audio-status { font-weight: 600; color: var(--navy-700); white-space: nowrap; }
.lt-audio-bar { flex: 1; height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.lt-audio-fill { height: 100%; width: 0; background: var(--navy); border-radius: 999px; transition: width .2s; }

.lt-questions { display: grid; gap: 1rem; margin-top: 1.2rem; }
.lt-q { padding: 1.2rem; }
.lt-q-head { display: flex; gap: .8rem; align-items: flex-start; }
.lt-q-num { flex: 0 0 30px; width: 30px; height: 30px; border-radius: 999px; background: var(--surface-2);
  color: var(--navy-700); font-weight: 700; display: grid; place-items: center; font-size: .9rem; }
.lt-q-body { flex: 1; min-width: 0; }
.lt-q-prompt { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; font-weight: 600; color: var(--ink); }
.lt-badge { display: inline-flex; padding: .1rem .55rem; border-radius: 999px; font-size: .74rem; font-weight: 700; }
.lt-badge.ok { background: var(--correct-bg); color: var(--correct); border: 1px solid #bfe8d2; }
.lt-badge.no { background: var(--wrong-bg); color: var(--wrong); border: 1px solid #f2c9c9; }
.lt-expected { margin: .5rem 0 0; font-size: .85rem; font-weight: 700; color: var(--correct); }

.lt-opts { display: grid; gap: .5rem; margin-top: .8rem; }
.lt-opt { display: flex; align-items: center; gap: .7rem; text-align: left; border: 1px solid var(--line-strong);
  border-radius: var(--r-sm); padding: .6rem .9rem; background: var(--surface); font-weight: 500; color: var(--ink); }
.lt-opt.sel { border-color: var(--gold); background: var(--gold-50); }
.lt-opt.right { border-color: var(--correct) !important; background: var(--correct-bg) !important; }
.lt-opt-key { font-weight: 700; color: var(--navy-700); }
.lt-box { flex: 0 0 20px; width: 20px; height: 20px; border-radius: 5px; border: 1px solid var(--line-strong);
  display: grid; place-items: center; font-size: .8rem; color: var(--navy-900); }
.lt-opt.sel .lt-box { background: var(--gold); border-color: var(--gold); }

.lt-gap { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: .8rem; font-weight: 500; }
.input { font: inherit; border: 1.5px solid var(--line-strong); border-radius: var(--r-sm);
  padding: .5rem .7rem; background: var(--surface); color: var(--ink); }
.input:focus-visible { border-color: var(--gold-600); box-shadow: var(--glow-gold); outline: none; }
.lt-blank { width: 150px; text-align: center; }
.lt-short { width: 100%; margin-top: .8rem; }
.lt-select { min-width: 150px; }

.lt-match { display: grid; gap: .55rem; margin-top: .8rem; }
.lt-match-row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.lt-match-item { min-width: 160px; font-weight: 500; }
.lt-mark { font-size: .85rem; font-weight: 700; }
.lt-mark.ok { color: var(--correct); }
.lt-mark.no { color: var(--wrong); }
.lt-map { margin-top: .8rem; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); padding: .6rem; overflow-x: auto; }

.lt-table-scroll { overflow-x: auto; margin-top: .8rem; }
.lt-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.lt-table th { text-align: left; padding: .5rem .7rem; border-bottom: 1px solid var(--line);
  font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.lt-table td { padding: .5rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.lt-cell { width: 130px; text-align: center; }
.lt-cell-v { font-weight: 700; font-size: .82rem; }
.lt-cell-v.ok { color: var(--correct); }
.lt-cell-v.no { color: var(--correct); }

.lt-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.4rem; }
.lt-summary { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; padding: 1.3rem; margin-top: 1rem; }
.lt-score-n { font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; color: var(--ink); display: block; }
.lt-score-sub { display: block; font-size: .9rem; }
.lt-summary .btn { margin-left: auto; }

.lt-transcript { margin-top: 1.4rem; padding: 1.1rem 1.3rem; }
.lt-transcript-toggle { background: none; border: none; font: inherit; font-weight: 700; color: var(--ink); width: 100%; text-align: left; }
.lt-transcript-body { margin-top: .8rem; border-top: 1px solid var(--line); padding-top: .8rem; display: grid; gap: .5rem; }
.lt-line { margin: 0; font-weight: 500; }
.lt-speaker { font-weight: 700; color: var(--navy-700); }
.lt-speaker.narrator { color: var(--muted); }
