:root {
  --paper: #faf6eb;
  --page: #f1ebdd;
  --ink: #244c67;
  --muted: #627680;
  --line: #ccd4ce;
  --red: #a34531;
  --green: #286b55;
  --serif: "Yu Mincho", "Hiragino Mincho ProN", "Songti SC", serif;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--page);
  font-size: 15px;
  line-height: 1.7;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button,
select {
  cursor: pointer;
}
button,
a,
input,
select,
textarea {
  touch-action: manipulation;
}
button {
  min-height: 42px;
  border: 1px solid #a8babf;
  background: transparent;
  border-radius: 6px;
  padding: 7px 13px;
  transition: background 0.15s;
}
button:hover:not(:disabled) {
  background: #e3eae4;
}
button:disabled {
  opacity: 0.42;
  cursor: default;
}
a {
  color: inherit;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #ba6248;
  outline-offset: 3px;
}
/* Native selectors may retain :focus-visible after a pointer popup closes. */
[data-pointer-focus]:focus,
[data-pointer-focus]:focus-visible {
  outline: none;
}
[hidden] {
  display: none !important;
}
h1,
h2,
h3,
p {
  margin: 0;
}
select {
  height: 43px;
  border: 1px solid #b6c3c1;
  background: var(--paper);
  border-radius: 6px;
  padding: 6px 30px 6px 10px;
  width: 100%;
}
label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
label select {
  display: block;
  margin-top: 5px;
  font-size: 14px;
  font-weight: 400;
}
main,
.masthead {
  max-width: 1250px;
  margin: auto;
  padding-left: 36px;
  padding-right: 36px;
}
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 22px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--ink);
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  font: 700 28px/1.3 var(--serif);
  letter-spacing: 4px;
}
.brand small {
  font: 10px/1.7 sans-serif;
  letter-spacing: 2px;
  display: block;
  margin-top: 5px;
}
.seal {
  display: grid;
  place-items: center;
  background: var(--red);
  color: var(--paper);
  width: 43px;
  height: 48px;
  border-radius: 3px;
  transform: rotate(-4deg);
  letter-spacing: 0;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 13px;
}
.test-badge {
  background: #e6e9dc;
  border: 1px solid #b8c5b5;
  padding: 4px 12px;
  border-radius: 30px;
  font-size: 12px;
}
.intro {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 30px 0 26px;
}
.eyebrow {
  color: var(--red);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.7px;
}
h1 {
  font: 600 clamp(28px, 3vw, 37px)/1.5 var(--serif);
  margin: 6px 0;
}
.intro p:last-child {
  color: var(--muted);
  font-size: 14px;
}
.intro-note {
  font: 16px var(--serif);
  letter-spacing: 3px;
  color: var(--muted);
}
.library-picker {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  border: 1px solid #b3c3c2;
  background: #e5ebe3;
  padding: 17px 20px;
  border-radius: 8px;
  margin-bottom: 24px;
}
.library-picker > label {
  width: 110px;
}
.library-picker .set-picker {
  flex: 1;
  max-width: 430px;
}
.library-picker > p {
  margin-left: auto;
  padding-bottom: 8px;
  font-size: 12px;
  color: var(--muted);
}
.workspace {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 26px;
  align-items: start;
}
.question-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 18px 15px;
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 36px);
  overflow: auto;
  scrollbar-width: thin;
}
.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 13px;
}
.panel-heading h2,
.panel-heading h3 {
  font-size: 16px;
}
.panel-heading span {
  font-size: 12px;
}
.filter-label {
  display: block;
  margin: 12px 0;
}
.muted {
  font-size: 12px;
  color: var(--muted);
}
#summary {
  margin: 12px 0;
}
.question-group h3 {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: var(--muted);
  padding: 16px 6px 7px;
}
.question-link {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
  border: 1px solid transparent;
  margin: 2px 0;
  padding: 9px 10px;
  font-size: 14px;
}
.question-link small {
  font-size: 11px;
  color: var(--muted);
}
.question-link[aria-current="true"] {
  background: #dfe9e7;
  border-color: #b7cbc8;
  color: #174d55;
  font-weight: 600;
}
.question-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 4px 0 17px;
}
.question-heading h2 {
  font: 600 28px/1.5 var(--serif);
  margin: 4px 0;
}
.question-heading .eyebrow {
  letter-spacing: 1px;
}
.position {
  padding: 6px 12px;
  border: 1px solid #bcc7bf;
  border-radius: 30px;
  font-size: 12px;
  white-space: nowrap;
}
.paper {
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
  margin-bottom: 16px;
}
.transport {
  display: flex;
  align-items: center;
  gap: 19px;
}
.play {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  border: 0;
  font-size: 24px;
  flex: none;
}
.play:hover:not(:disabled) {
  background: #376d87;
}
.timeline {
  flex: 1;
  min-width: 0;
}
.timeline-heading {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}
.timeline-heading strong {
  font-size: 14px;
}
#seek {
  width: 100%;
  margin: 13px 0 0;
  accent-color: var(--ink);
  height: 20px;
  cursor: pointer;
}
.transport-secondary {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 22px 0;
}
.transport-secondary > div {
  display: flex;
  gap: 7px;
}
.transport-secondary button {
  font-size: 12px;
  padding: 6px 10px;
}
.playback-settings {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 14px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
#repeat-status {
  margin-top: 12px;
}
.keyboard-hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 5px;
}
#answers h3 {
  font-size: 16px;
  margin-bottom: 14px;
}
.answer-image {
  display: block;
  max-width: 100%;
  max-height: 620px;
  object-fit: contain;
  margin: 0 auto 18px;
  border-radius: 4px;
  background: white;
}
.option-group {
  border: 0;
  padding: 0;
  margin: 0 0 22px;
  min-width: 0;
}
.option-group:last-child {
  margin-bottom: 0;
}
.option-group legend {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 10px;
}
.option-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f5f3e9;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  letter-spacing: 0;
}
.option-row input {
  margin-top: 6px;
  accent-color: var(--ink);
}
.option-row:has(input:checked) {
  border-color: #6c9da3;
  background: #e7eeea;
}
.option-row.correct {
  border-color: #52826c;
  background: #e5efe5;
}
.option-row.incorrect {
  border-color: #bb7b65;
  background: #f7e8df;
}
.option-row b {
  font-weight: 600;
  min-width: 13px;
}
.check-answer {
  background: var(--ink);
  color: white;
  font-size: 13px;
}
.check-answer:hover:not(:disabled) {
  background: #376d87;
}
.answer-feedback {
  margin-top: 10px;
  font-size: 14px;
}
.answer-feedback.correct {
  color: var(--green);
}
.answer-feedback.incorrect {
  color: var(--red);
}
.answer-explanation {
  font-size: 13px;
  white-space: pre-wrap;
  margin-top: 6px;
  color: var(--muted);
}
details summary {
  cursor: pointer;
  font-weight: 600;
}
details p {
  white-space: pre-wrap;
  margin-top: 12px;
}
#transcript {
  white-space: pre-wrap;
  font-size: 16px;
  line-height: 2.1;
  overflow-wrap: anywhere;
  padding-top: 4px;
}
#transcript .supplement {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.review-actions {
  display: flex;
  gap: 10px;
  margin: 15px 0;
}
.review-actions button[aria-pressed="true"] {
  background: #e0eadd;
  border-color: #719080;
}
.note-label {
  display: block;
  margin: 12px 0 6px;
}
textarea {
  width: 100%;
  resize: vertical;
  min-height: 110px;
  padding: 12px;
  border: 1px solid #c4cdc7;
  border-radius: 6px;
  background: #fffdf7;
  font-size: 14px;
}
#save-status {
  margin-top: 7px;
}
footer {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  border-top: 1px solid #bdc9c2;
  margin-top: 30px;
  padding: 20px 0 30px;
  font-size: 11px;
  color: var(--muted);
}
#notice {
  padding: 12px 16px;
  border: 1px solid #b98461;
  background: #faeddb;
  border-radius: 7px;
  margin-bottom: 16px;
  font-size: 14px;
}
.loading {
  padding: 35px;
}
.skip-link {
  position: absolute;
  top: -100px;
  left: 20px;
  background: var(--paper);
  padding: 8px;
  z-index: 30;
}
.skip-link:focus {
  top: 5px;
}
.empty {
  padding: 18px 8px;
  font-size: 13px;
  color: var(--muted);
}
@media (max-width: 850px) {
  main,
  .masthead {
    padding-left: 20px;
    padding-right: 20px;
  }
  .workspace {
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 16px;
  }
  .paper {
    padding: 18px;
  }
  .intro-note {
    display: none;
  }
  .library-picker > p {
    display: none;
  }
  .transport-secondary {
    flex-wrap: wrap;
    gap: 12px;
  }
  .transport-secondary > div:last-child {
    margin-left: auto;
  }
  .timeline-heading {
    flex-wrap: wrap;
  }
  .header-right {
    gap: 10px;
  }
  .question-heading h2 {
    font-size: 25px;
  }
}
@media (max-width: 620px) {
  main,
  .masthead {
    padding-left: 16px;
    padding-right: 16px;
  }
  .masthead {
    padding-top: 15px;
    padding-bottom: 15px;
  }
  .brand {
    font-size: 24px;
    gap: 10px;
  }
  .seal {
    width: 34px;
    height: 39px;
  }
  .header-right {
    flex-direction: column;
    gap: 5px;
    align-items: flex-end;
    font-size: 11px;
  }
  .test-badge {
    font-size: 10px;
    padding: 2px 8px;
  }
  .intro {
    padding: 22px 0;
  }
  .intro h1 {
    font-size: 28px;
  }
  .intro .eyebrow {
    font-size: 9px;
  }
  .library-picker {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 13px;
    margin-bottom: 16px;
  }
  .library-picker > label {
    width: auto;
  }
  .library-picker .set-picker {
    grid-column: 1/-1;
    max-width: none;
  }
  .workspace {
    display: block;
  }
  .question-panel {
    position: static;
    max-height: 260px;
    padding: 13px;
    margin-bottom: 20px;
  }
  .question-panel .panel-heading {
    margin-bottom: 8px;
  }
  .filter-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 4px 0;
  }
  .filter-label select {
    width: 150px;
    margin: 0;
    height: 36px;
  }
  .question-group h3 {
    padding-top: 8px;
  }
  .question-group .question-rows {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
  }
  .question-link {
    width: auto;
    min-width: 83px;
    gap: 7px;
    font-size: 12px;
    background: #f4f0e3;
    padding: 7px;
  }
  .question-link small {
    font-size: 10px;
  }
  #summary {
    margin: 6px 0;
  }
  .question-heading {
    padding: 0 0 14px;
  }
  .question-heading h2 {
    font-size: 25px;
  }
  .paper {
    padding: 17px 15px;
  }
  .transport {
    gap: 12px;
  }
  .play {
    width: 52px;
    height: 52px;
  }
  .timeline-heading strong {
    font-size: 13px;
  }
  .transport-secondary {
    margin: 17px 0;
  }
  .transport-secondary button {
    min-height: 44px;
    padding: 6px 9px;
  }
  .playback-settings {
    gap: 9px;
    grid-template-columns: 1.3fr 1fr 1fr;
  }
  .playback-settings select {
    padding-left: 7px;
    padding-right: 18px;
    font-size: 13px;
  }
  .keyboard-hint {
    display: none;
  }
  .position {
    font-size: 11px;
    padding: 5px 9px;
  }
  .option-row {
    font-size: 14px;
  }
  footer {
    flex-direction: column;
    gap: 5px;
  }
  .panel-heading button {
    font-size: 12px;
  }
  #transcript {
    font-size: 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* Compact introduction in the masthead leaves room for practice content. */
.masthead {
  gap: 24px;
}
.header-intro {
  flex: 1;
  text-align: center;
  min-width: 0;
}
.header-intro h1 {
  font: 600 23px/1.4 var(--serif);
  margin: 0 0 4px;
}
.header-intro p {
  font-size: 11px;
  color: var(--muted);
}
.library-picker {
  margin-top: 22px;
}
@media (max-width: 850px) {
  .masthead {
    gap: 16px;
  }
  .header-intro h1 {
    font-size: 18px;
  }
  .header-intro p {
    font-size: 10px;
  }
  .header-right {
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
  }
}
@media (max-width: 620px) {
  .masthead {
    flex-wrap: wrap;
    gap: 12px;
  }
  .brand {
    order: 0;
  }
  .header-right {
    order: 1;
    margin-left: auto;
  }
  .header-intro {
    order: 2;
    flex-basis: 100%;
    text-align: left;
    border-top: 1px solid var(--line);
    padding-top: 9px;
  }
  .header-intro h1 {
    font-size: 18px;
    margin: 0;
  }
  .header-intro p {
    display: none;
  }
  .library-picker {
    margin-top: 16px;
  }
}

/* Sentence-follow pilot: only the original-text pane scrolls. */
#transcript:has(#sentence-scroll) {
  white-space: normal;
}
.sentence-toolbar {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin: 0 0 8px;
  font-size: 11px;
  color: var(--muted);
}
.sentence-badge {
  background: #e5ece0;
  color: #41674f;
  border-radius: 20px;
  padding: 3px 9px;
}
#sentence-position {
  margin-right: auto;
  white-space: nowrap;
}
.sentence-toolbar button {
  font-size: 11px;
  min-height: 34px;
  padding: 4px 9px;
}
.sentence-toolbar button[aria-pressed="true"] {
  background: #e4ece3;
  border-color: #819d8b;
}
.sentence-help {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 12px;
  line-height: 1.6;
}
#sentence-scroll {
  max-height: min(52vh, 440px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  position: relative;
  padding: 6px 5px 40px 0;
  scroll-padding: 20px;
  overflow-anchor: none;
}
.sentence-line {
  display: flex;
  align-items: baseline;
  gap: 13px;
  width: 100%;
  border: 1px solid transparent;
  border-left: 3px solid transparent;
  border-radius: 5px;
  text-align: left;
  padding: 11px 12px;
  margin: 2px 0;
  line-height: 1.95;
  font-size: 16px;
  white-space: pre-wrap;
  color: #506b79;
  background: transparent;
}
.sentence-line time {
  font:
    11px/1.8 ui-monospace,
    monospace;
  flex: none;
  white-space: nowrap;
  color: #80918f;
}
.sentence-line span {
  overflow-wrap: anywhere;
  min-width: 0;
}
.sentence-line.is-current {
  background: #e1ebe3;
  color: #173f51;
  border-left-color: #a34531;
  font-weight: 600;
}
.sentence-line.is-current time {
  color: #a34531;
}
.sentence-line:hover:not(:disabled) {
  background: #edf0e5;
}
.sentence-line.is-current:hover:not(:disabled) {
  background: #dce8df;
}
.sentence-section {
  font-size: 13px;
  font-weight: 600;
  padding: 15px 12px 5px;
  border-top: 1px solid var(--line);
  margin-top: 10px;
}
.sentence-unmatched {
  font-size: 13px;
  color: var(--muted);
  padding: 12px;
  white-space: pre-wrap;
}
.sentence-unmatched small {
  display: block;
  font-size: 10px;
  line-height: 1.5;
}
@media (max-width: 620px) {
  #sentence-scroll {
    max-height: 48vh;
  }
  .sentence-line {
    font-size: 16px;
    padding: 10px 7px;
    gap: 8px;
  }
  .sentence-line time {
    font-size: 10px;
  }
  .sentence-toolbar {
    gap: 6px;
  }
  .sentence-toolbar button {
    min-height: 40px;
  }
  .sentence-toolbar #sentence-current {
    margin-left: auto;
  }
}

/* Karaoke color advances through each character, never the entire active line. */
.sentence-line.is-current {
  background: transparent;
  border-left-color: transparent;
  font-weight: 400;
  color: #506b79;
}
.sentence-line.is-current:hover:not(:disabled) {
  background: #edf0e5;
}
.sentence-line.is-current time {
  color: #80918f;
}
.karaoke-char {
  color: inherit;
}
.sentence-line.is-past .karaoke-char {
  color: #a34531;
  opacity: 0.72;
}
.karaoke-char.is-read {
  color: #a34531;
}
.karaoke-char.is-singing {
  color: transparent;
  background: linear-gradient(
    90deg,
    #a34531 var(--karaoke-fill, 0%),
    #506b79 var(--karaoke-fill, 0%)
  );
  -webkit-background-clip: text;
  background-clip: text;
}

/* Keep the current sentence located while its characters fill with the voice. */
.sentence-line.is-current {
  background: #e4ece3;
  border-left-color: #a34531;
  font-weight: 400;
  color: #244c67;
}
.sentence-line.is-current:hover:not(:disabled) {
  background: #dce8df;
}
.sentence-line.is-current time {
  color: #a34531;
}
.sentence-line.is-current .karaoke-char.is-read {
  color: #a34531;
  font-weight: 600;
}
.sentence-line.is-current .karaoke-char.is-singing {
  background: linear-gradient(
    90deg,
    #a34531 var(--karaoke-fill, 0%),
    #244c67 var(--karaoke-fill, 0%)
  );
  -webkit-background-clip: text;
  background-clip: text;
}

.sentence-line.is-current .karaoke-char.is-read {
  font-weight: inherit;
}

/* Compact synchronized text without shrinking the Japanese type. */
.sentence-line {
  line-height: 1.65;
  padding: 6px 10px;
  margin: 0;
  min-height: 0;
  gap: 10px;
}
#sentence-scroll {
  padding-bottom: 20px;
}
.sentence-section {
  padding: 10px 10px 4px;
  margin-top: 6px;
}
@media (max-width: 620px) {
  .sentence-line {
    line-height: 1.65;
    padding: 5px 7px;
    gap: 8px;
    min-height: 0;
  }
}

/* Compact player and answer cards, keeping readable type and touch targets. */
#exercise > .paper {
  padding: 15px 18px;
  margin-bottom: 12px;
}
.transport {
  gap: 13px;
}
.play {
  width: 48px;
  height: 48px;
  font-size: 21px;
}
#seek {
  margin-top: 6px;
  height: 18px;
}
.transport-secondary {
  margin: 12px 0;
  gap: 8px;
}
.transport-secondary > div {
  gap: 6px;
}
.transport-secondary button {
  min-height: 34px;
  padding: 4px 10px;
}
.playback-settings {
  padding-top: 11px;
  gap: 12px;
}
.playback-settings select {
  height: 35px;
  margin-top: 3px;
  padding-top: 4px;
  padding-bottom: 4px;
}
#repeat-status {
  display: inline-block;
  margin-top: 8px;
  margin-right: 16px;
}
.keyboard-hint {
  display: inline-block;
  margin-top: 8px;
  font-size: 10px;
}
#answers h3 {
  margin-bottom: 8px;
}
.option-group {
  margin-bottom: 14px;
}
.option-group legend {
  font-size: 12px;
  margin-bottom: 5px;
}
.option-group legend:only-child {
  margin-bottom: 0;
}
.option-row {
  padding: 7px 10px;
  margin-bottom: 5px;
  line-height: 1.55;
  min-height: 37px;
  gap: 8px;
}
.option-row input {
  margin-top: 4px;
}
.check-answer {
  min-height: 34px;
  padding: 5px 12px;
}
.answer-feedback {
  margin-top: 7px;
  font-size: 13px;
}
.answer-explanation {
  margin-top: 4px;
}
.answer-image {
  margin-bottom: 12px;
}
#exercise .panel-heading {
  margin-bottom: 9px;
}
@media (max-width: 620px) {
  #exercise > .paper {
    padding: 13px 14px;
    margin-bottom: 10px;
  }
  .play {
    width: 46px;
    height: 46px;
  }
  .transport-secondary {
    margin: 10px 0;
    gap: 6px;
    flex-wrap: nowrap;
  }
  .transport-secondary > div {
    gap: 4px;
  }
  .transport-secondary button {
    min-height: 40px;
    padding: 4px 6px;
    font-size: 11px;
  }
  .playback-settings {
    padding-top: 9px;
    gap: 8px;
  }
  .playback-settings select {
    height: 40px;
  }
  .keyboard-hint {
    display: none;
  }
  #repeat-status {
    margin-top: 6px;
  }
  .option-row {
    min-height: 42px;
    padding: 8px 9px;
    margin-bottom: 4px;
    font-size: 14px;
  }
  .check-answer {
    min-height: 40px;
  }
}
@media (max-width: 360px) {
  .transport-secondary {
    flex-wrap: wrap;
  }
}

/* Show only essential controls and keep group labels accessible. */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.transport-secondary {
  justify-content: flex-end;
  margin: 8px 0;
}
#repeat-status[hidden],
.keyboard-hint[hidden] {
  display: none !important;
}

/* Navigation belongs to the question; shortcuts belong to the audio timeline. */
.question-navigation {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.question-nav-buttons {
  display: flex;
  gap: 6px;
}
.question-nav-buttons button {
  font-size: 12px;
  min-height: 34px;
  padding: 5px 10px;
}
.playback-shortcuts {
  font-size: 11px;
  color: var(--muted);
  margin: 6px 0 10px 61px;
  line-height: 1.7;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.playback-shortcuts span {
  white-space: nowrap;
}
.playback-shortcuts kbd {
  font: inherit;
  color: var(--ink);
}
@media (max-width: 850px) {
  .question-navigation {
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
  }
  .question-heading {
    gap: 10px;
  }
}
@media (max-width: 620px) {
  .question-heading h2 {
    font-size: 23px;
  }
  .question-nav-buttons {
    gap: 5px;
  }
  .question-nav-buttons button {
    font-size: 11px;
    padding: 5px 8px;
    min-height: 38px;
  }
  .question-navigation .position {
    padding: 2px 8px;
  }
  .playback-shortcuts {
    margin: 6px 0 9px;
    font-size: 10px;
    gap: 3px 10px;
  }
  .question-heading .eyebrow {
    font-size: 10px;
  }
}

/* Let expanded transcripts use the document scroll, at every viewport size. */
#sentence-scroll {
  height: auto;
  max-height: none;
  overflow: visible;
  overscroll-behavior: auto;
  padding-bottom: 0;
}

/* The practice section is a shortcut/skip-link target, not a control. */
#practice:focus,
#practice:focus-visible {
  outline: none;
}

.sentence-line.is-looping {
  box-shadow: inset 0 0 0 1px #286b55;
}
.sentence-line.is-looping time::after {
  content: " ↻";
  color: #286b55;
}
#sentence-loop[aria-pressed="true"] {
  background: #e0eadd;
  border-color: #719080;
}

/* Paper-toned dock, visually shared with the listening page. */
body {
  padding-bottom: calc(140px + env(safe-area-inset-bottom, 0px));
}
.mobile-player {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  position: fixed;
  z-index: 30;
  left: 0;
  top: 0;
  width: min(336px, calc(100vw - 20px));
  padding: 0 12px 10px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid #bbc9c3;
  border-radius: 12px;
  box-shadow: 0 2px 10px #244c6714;
}
.mobile-player[hidden],
.mobile-loop-row[hidden] {
  display: none !important;
}
#mobile-drag {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
#mobile-drag::after {
  content: "";
  width: 26px;
  height: 3px;
  border-radius: 4px;
  background: #b6c2bc;
}
#mobile-drag:hover::after,
.dragging #mobile-drag::after {
  background: var(--muted);
}
.dragging #mobile-drag {
  cursor: grabbing;
}
.mobile-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  line-height: 1.3;
  color: var(--muted);
  margin: 0 1px 7px;
}
#mobile-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#mobile-time {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.mobile-buttons {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.mobile-buttons button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  width: 68px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
  touch-action: manipulation;
}
.mobile-buttons button:hover:not(:disabled) {
  background: #e8ede3;
}
.mobile-buttons button:active:not(:disabled) {
  background: #dce5d9;
}
#mobile-play,
#mobile-play:hover:not(:disabled),
#mobile-play:focus {
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  -webkit-text-fill-color: var(--paper);
  font-size: 21px;
  line-height: 1;
}
#mobile-play:active:not(:disabled) {
  background: #18394d;
  transform: scale(0.95);
}
.mobile-loop-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  border-top: 1px solid var(--line);
  margin-top: 8px;
  padding-top: 5px;
  font-size: 11px;
  color: var(--green);
}
.mobile-loop-row button {
  min-height: 44px;
  padding: 2px 5px;
  border: 0;
  color: var(--green);
  font-size: 11px;
}
.mobile-player[data-edge="left"],
.mobile-player[data-edge="right"] {
  width: 84px;
  padding: 0 7px 10px;
  border-radius: 0 12px 12px 0;
}
.mobile-player[data-edge="right"] {
  border-radius: 12px 0 0 12px;
}
.mobile-player[data-edge="left"] .mobile-buttons,
.mobile-player[data-edge="right"] .mobile-buttons {
  flex-direction: column;
  gap: 20px;
}
.mobile-player[data-edge="left"] .mobile-meta,
.mobile-player[data-edge="right"] .mobile-meta {
  display: none;
}
.mobile-player[data-edge="left"] #mobile-drag::after,
.mobile-player[data-edge="right"] #mobile-drag::after {
  width: 18px;
}
.mobile-player[data-edge="left"] .mobile-loop-row,
.mobile-player[data-edge="right"] .mobile-loop-row {
  flex-direction: column;
  gap: 0;
  font-size: 10px;
  padding-top: 3px;
}
.mobile-player[data-edge="left"] .mobile-loop-row span,
.mobile-player[data-edge="right"] .mobile-loop-row span {
  font-size: 0;
}
.mobile-player[data-edge="left"] .mobile-loop-row span::after,
.mobile-player[data-edge="right"] .mobile-loop-row span::after {
  content: "↻ 循环中";
  font-size: 10px;
}
.mobile-player[data-edge="left"] #mobile-loop-off,
.mobile-player[data-edge="right"] #mobile-loop-off {
  font-size: 10px;
  padding: 2px 0;
}
.mobile-player[data-edge="top"] {
  border-radius: 0 0 12px 12px;
  padding-top: env(safe-area-inset-top, 0px);
}
.mobile-player[data-edge="bottom"] {
  border-radius: 12px 12px 0 0;
  padding-bottom: max(10px, env(safe-area-inset-bottom, 0px));
}
@media (pointer: coarse) {
  .playback-shortcuts {
    display: none;
  }
}

/* Touch feedback lasts only while pressing; no sticky hover tint. */
#mobile-back,
#mobile-forward,
#mobile-back:hover:not(:disabled),
#mobile-forward:hover:not(:disabled),
#mobile-back:focus,
#mobile-forward:focus {
  background: transparent;
  color: var(--ink);
  border-radius: 10px;
  flex-direction: column;
  gap: 2px;
}
#mobile-back:active:not(:disabled),
#mobile-forward:active:not(:disabled) {
  background: #dfe7db;
  transform: scale(0.96);
}
#mobile-back svg,
#mobile-forward svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#mobile-back span,
#mobile-forward span {
  font-size: 12px;
  line-height: 1.3;
}
/* Phone layout stays compact while preserving 48px touch targets. */
@media (max-width: 600px) {
  .mobile-player {
    width: min(260px, calc(100vw - 16px));
    padding: 0 10px 8px;
  }
  .mobile-player[data-edge="left"],
  .mobile-player[data-edge="right"] {
    width: 64px;
    padding: 0 7px 8px;
  }
  #mobile-drag {
    height: 28px;
    min-height: 28px;
  }
  .mobile-buttons button {
    width: 48px;
    min-height: 48px;
  }
  #mobile-play,
  #mobile-play:hover:not(:disabled),
  #mobile-play:focus {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
    font-size: 18px;
  }
  .mobile-player[data-edge="left"] .mobile-buttons,
  .mobile-player[data-edge="right"] .mobile-buttons {
    gap: 8px;
  }
  #mobile-back svg,
  #mobile-forward svg {
    width: 22px;
    height: 22px;
  }
  .mobile-meta {
    margin-bottom: 5px;
  }
}

@media not all and (any-pointer: coarse) {
  body {
    padding-bottom: 0;
  }
  #mobile-player {
    display: none !important;
  }
}

/* The transcript region receives playback keys without a page-sized focus frame. */
#sentence-scroll:focus,
#sentence-scroll:focus-visible {
  outline: none;
}

/* Printed paragraphs and embedded original material. */
.question-prompt {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-weight: 400;
  line-height: 1.95;
  margin: 0 0 22px;
}
.option-row > span[lang="ja"] {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  min-width: 0;
}
.answer-image.embedded-material {
  max-height: none;
  height: auto;
}
