/* Nghe chép chính tả. Structure and colour both live here — the page is
   small enough that a separate skin layer would be ceremony. */

.wrap { max-width: var(--page-width); margin: 0 auto;
  padding: 0 var(--page-gutter) 80px; }
.view { display: none; }
.view.active { display: block; }
button { font: inherit; color: inherit; cursor: pointer; }

.page-head { padding: 30px 0 18px; border-bottom: 1px solid var(--line); }
.page-head .eyebrow { font-family: var(--font-mono); font-size: 12px;
  letter-spacing: .12em; text-transform: uppercase; color: var(--accent);
  margin-bottom: 8px; }
.page-head h1 { font-family: var(--font-display); font-size: 26px; margin: 0 0 8px; }
.page-head .sub { margin: 0; color: var(--ink-soft); font-size: 14.5px;
  max-width: 54ch; line-height: 1.7; }

/* ------------------------------------------------------------- picking */

.pick-head { display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin: 26px 0 14px; }
.pick-head h2 { font-family: var(--font-display); font-size: 19px; margin: 0; }
.lang-tabs { display: flex; gap: 6px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.lang-tab { border: none; background: none; border-radius: 999px;
  padding: 7px 16px; font-size: 13.5px; font-weight: 600; color: var(--ink-soft); }
.lang-tab.is-on { background: var(--accent); color: var(--ink-inverse); }

.lesson-list { display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.lesson-card { display: flex; flex-direction: column; gap: 5px; text-align: left;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 16px;
  transition: border-color .15s ease, transform .1s ease; }
.lesson-card:hover { border-color: var(--accent-line); }
.lesson-card:active { transform: translateY(1px); }
.lesson-title { font-size: 14.5px; font-weight: 600; line-height: 1.45; }
.lesson-meta { font-family: var(--font-mono); font-size: 12px; color: var(--ink-soft); }

/* ----------------------------------------------------------- practising */

.practice-top { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin: 22px 0 14px; }
.back-link { background: none; border: none; font-size: 14px; font-weight: 600;
  color: var(--ink-soft); padding: 6px 0; }
.back-link:hover { color: var(--ink); }
.progress { font-size: 13px; color: var(--ink-soft);
  font-variant-numeric: tabular-nums; }

.player-frame { position: relative; padding-top: 56.25%; border-radius: 12px;
  overflow: hidden; background: var(--video-bg); }
.player-frame iframe, .player-frame > div { position: absolute; inset: 0;
  width: 100%; height: 100%; border: 0; }

.controls { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 18px; }
.btn-play { display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent); color: var(--ink-inverse); border: none;
  border-radius: 999px; padding: 11px 20px; font-size: 14.5px; font-weight: 700; }
.btn-play svg { width: 17px; height: 17px; }
.btn-play:hover { filter: brightness(1.07); }
.btn-ghost { background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 10px 16px; font-size: 13.5px; font-weight: 600;
  color: var(--ink-soft); }
.btn-ghost:hover { border-color: var(--line-strong); color: var(--ink); }

.type-area { background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px 18px; }
.type-label { display: block; font-size: 12.5px; font-weight: 600;
  color: var(--ink-soft); margin-bottom: 8px; }

/* Easy / hard switch */
.mode-row { display: flex; gap: 4px; background: var(--surface-2);
  border-radius: 999px; padding: 4px; margin-bottom: 14px;
  width: fit-content; max-width: 100%; flex-wrap: wrap; }
.mode-btn { border: none; background: none; border-radius: 999px;
  padding: 7px 15px; font-size: 13px; font-weight: 600; color: var(--ink-soft);
  white-space: nowrap; }
.mode-btn.is-on { background: var(--accent); color: var(--ink-inverse); }

/* The sentence with holes in it.

   The line box has to be taller than the input, not merely generous: the
   input is 41px (16px text + padding + the 2px underline) and the line was
   37px, so every blank leaned into the line above it, and once a blank was
   marked right or wrong its coloured background overlapped the words up
   there. 2.6 x 17px = 44px clears the input with room to spare.

   The horizontal margin is the other half: without it the word before the
   blank touched the box, and the full stop after it was glued to the right
   edge. */
.cloze { font-size: 17px; line-height: 2.6; color: var(--ink); }
.cloze.ja { font-family: var(--font-jp); }
.blank { font: inherit; font-size: 16px; line-height: 1.4; color: var(--ink);
  background: var(--bg); border: none; border-bottom: 2px solid var(--accent);
  border-radius: 4px 4px 0 0; padding: 2px 10px; margin: 0 5px;
  min-width: 70px; text-align: center; vertical-align: baseline; }
.blank:focus { outline: 2px solid var(--accent-line); outline-offset: 1px; }
.blank.right { border-bottom-color: var(--ok); color: var(--ok);
  background: var(--ok-soft); font-weight: 600; }
.blank.wrong { border-bottom-color: var(--flag); color: var(--flag);
  background: var(--flag-soft); }
.blank.shown { border-bottom-color: var(--ink-faint); color: var(--ink-soft);
  background: var(--surface-2); font-style: italic; }
#answer { width: 100%; font: inherit; font-size: 17px; line-height: 1.6;
  background: var(--bg); color: var(--ink); border: 1px solid var(--line-strong);
  border-radius: 8px; padding: 11px 13px; resize: vertical; }
#answer:focus { outline: 2px solid var(--accent-line); outline-offset: 1px; }
.type-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  margin-top: 11px; }
.btn-check { background: var(--accent); color: var(--ink-inverse); border: none;
  border-radius: 999px; padding: 10px 22px; font-size: 14px; font-weight: 700; }
.btn-check:hover { filter: brightness(1.07); }
.hint { font-size: 12.5px; color: var(--ok); margin-left: auto; }

/* -------------------------------------------------------------- result */

.result { margin-top: 16px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.verdict { font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.verdict.right { color: var(--ok); }
.verdict.wrong { color: var(--flag); }
.verdict.shown { color: var(--ink-soft); }

.diff { font-size: 18px; line-height: 2; }
.diff.ja { font-family: var(--font-jp); }
.tok { border-radius: 4px; padding: 1px 3px; }
.tok.ok { color: var(--ink); }
.tok.miss { background: var(--flag-soft); color: var(--flag);
  text-decoration: underline; text-decoration-style: wavy; }
.tok.extra { background: var(--surface-2); color: var(--ink-faint);
  text-decoration: line-through; }

.legend { display: flex; gap: 10px; margin-top: 12px; font-size: 11.5px; }
.legend .tok { padding: 2px 8px; }

/* Names the word or pattern the sentence was chosen for — the link back to
   the vocabulary and grammar tabs the learner just came from. */
.term-note:not(:empty) { margin-top: 12px; padding-top: 10px;
  border-top: 1px dashed var(--line); font-size: 12.5px; color: var(--accent);
  font-weight: 600; }

@media (max-width: 560px) {
  .controls { gap: 6px; }
  .btn-ghost { padding: 9px 12px; font-size: 12.5px; }
  .diff { font-size: 16px; }
}

/* Câu trước / câu sau, đặt cuối bài tập thay vì trên hàng phát lại: sau khi
   trả lời xong thì tay đã ở đây rồi, không phải đi ngược lên qua khung video. */
.seg-nav { display: flex; justify-content: space-between; gap: 10px;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
/* Trả lời đúng rồi thì "Câu sau" là việc hiển nhiên tiếp theo — cho nó nổi
   lên để mắt khỏi phải tìm. */
.seg-nav .btn-ghost.is-next { background: var(--accent); color: var(--ink-inverse);
  border-color: var(--accent); font-weight: 700; }
.seg-nav .btn-ghost.is-next:hover { filter: brightness(1.07); color: var(--ink-inverse); }

@media (max-width: 560px) {
  .seg-nav .btn-ghost { flex: 1; text-align: center; }
}

/* ---------- results after the last sentence ---------- */
.summary { margin-top: 18px; display: grid; gap: 16px; scroll-margin-top: 80px; }
.sum-head { display: grid; gap: 4px; }
.sum-score { font-family: var(--font-display); font-size: 28px; font-weight: 700; color: var(--ink); }
.sum-sub { font-size: 13.5px; color: var(--ink-soft); }
.sum-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: sum; }
.sum-row { counter-increment: sum; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; display: grid; gap: 6px; }
.sum-row.wrong { border-color: var(--flag); }
.sum-top { display: flex; align-items: center; gap: 10px; }
.sum-top::before { content: "Câu " counter(sum); font-size: 12.5px; color: var(--ink-faint);
  font-variant-numeric: tabular-nums; }
.sum-tag { font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-soft); }
.sum-tag.right { background: var(--ok-soft); color: var(--ok); }
.sum-tag.wrong { background: var(--flag-soft); color: var(--flag); }
.sum-go { margin-left: auto; padding: 6px 10px; font-size: 12.5px; }
.sum-text { font-size: 15px; color: var(--ink); line-height: 1.55; }
.sum-yours { font-size: 13.5px; color: var(--flag); line-height: 1.5; }
.sum-text.ja, .sum-yours.ja { font-family: var(--font-jp); }
.sum-actions { display: flex; gap: 10px; flex-wrap: wrap; }
