/* Constrain the dialog itself: document.scrollWidth does not expose fixed-layer overflow. */
.modal-backdrop {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  bottom: auto;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  overflow: hidden;
}
.modal {
  --dialog-pad: 30px;
  width: min(640px, 100%);
  min-width: 0;
  max-width: 100%;
  max-height: 100%;
  padding: var(--dialog-pad);
  justify-self: center;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.modal-top {
  position: sticky;
  top: calc(-1 * var(--dialog-pad));
  z-index: 5;
  gap: 12px;
  background: var(--paper);
  padding: 8px 0;
  margin-top: -8px;
}
.modal-top span { min-width: 0; overflow-wrap: anywhere; line-height: 1.8; }
.close { flex: 0 0 44px; width: 44px; height: 44px; display: grid; place-items: center; }
#modal-body, .study-card, .study-card > *, .choices, .choice, .explain, .feedback { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.study-card .big-jp, .study-card .reading, .study-card .meaning { max-width: 100%; overflow-wrap: anywhere; }
.study-head .progress { min-width: 0; }
.study-head small { flex-shrink: 0; }
.study-actions { min-width: 0; }
.study-actions button { min-width: 0; overflow-wrap: anywhere; }
body.modal-open { position: fixed; left: 0; right: 0; width: 100%; overflow: hidden; }
.grid > *, .cards > *, .library > *, .statsrow > *, .book-grid > *, .section-grid > *, .intro-branch-grid > *, .badge-grid > * { min-width: 0; }
.book-card > div, .course-home > div, .section-card > div, .unit-hero > div, .intro-banner > span, .intro-branch-hero > div { min-width: 0; }
.word-row .kanji { min-width: 0; flex: 0 1 40%; overflow-wrap: anywhere; line-height: 1.8; }
.word-row > div { min-width: 0; overflow-wrap: anywhere; }
.word-row .sound { flex-shrink: 0; }
.hero:after, .hero-cat, .spark { pointer-events: none; }
.hero .primary { position: relative; z-index: 3; }
.section-head { gap: 12px; flex-wrap: wrap; }
#toast { max-width: calc(100% - 32px); width: max-content; text-align: center; line-height: 1.8; overflow-wrap: anywhere; }
@media (max-width: 650px) {
  .modal-backdrop { padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
  .modal { --dialog-pad: 20px; border-radius: 18px; }
  .modal-top { margin-bottom: 16px; }
  .modal-top span { font-size: 9px; letter-spacing: 1px; }
  .study-card { padding: 24px 15px; min-height: 200px; }
  .study-card .pill { white-space: normal; text-align: center; line-height: 1.8; }
  .study-card .reading { font-size: 15px; line-height: 1.9; }
  .study-card .hint { font-size: 12px; line-height: 1.9; }
  .study-actions { flex-wrap: wrap; gap: 10px; }
  .study-actions button { flex: 1 1 calc(50% - 10px); min-height: 48px; }
  .study-actions > button:only-child { flex-basis: 100%; }
  .choice { width: 100%; min-height: 48px; line-height: 1.8; }
  .setting-line { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .setting-line input, .setting-line select { width: 100%; max-width: 100%; min-width: 0; min-height: 44px; }
  input, select, textarea, .search, .course-search input, .intro-search-label input, .course-toolbar select { font-size: 16px; }
  .course-toolbar { flex-wrap: wrap; }
  .course-search { min-width: 0; flex-basis: 100%; }
  .course-toolbar select { max-width: 100%; min-height: 44px; }
  .intro-search-label input { font-size: 16px; }
  .sidebar { height: calc(69px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  .main { padding-bottom: calc(85px + env(safe-area-inset-bottom)); }
  .nav button { flex: 1 1 0; min-width: 0; min-height: 60px; }
  .topbar { height: auto; min-height: 65px; gap: 10px; padding: 12px max(18px, env(safe-area-inset-right)) 12px max(18px, env(safe-area-inset-left)); }
  .mobile-brand { flex-shrink: 0; }
  .topstats { min-width: 0; flex-wrap: wrap; justify-content: flex-end; gap: 8px 10px; }
  .topstats span { white-space: nowrap; }
  .topstats .level { max-width: 100%; line-height: 1.6; }
  .content { padding-left: max(18px, env(safe-area-inset-left)); padding-right: max(18px, env(safe-area-inset-right)); }
  .word-row { display: grid; grid-template-columns: minmax(0, 1fr) 44px 44px; gap: 10px; }
  .word-row .kanji { grid-column: 1 / -1; width: 100%; }
  .word-row > div { grid-column: 1; }
  .word-row > .sound { grid-column: 2; width: 44px; height: 44px; }
  .word-row > button:not(.sound) { grid-column: 3; width: 44px; height: 44px; }
  .word-row > span:last-child:not(.kanji) { grid-column: 1 / -1; margin-left: 0 !important; }
  .word-row .pill { display: none; }
  .footer { gap: 15px; flex-wrap: wrap; }
  #toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .kanji-study { flex-wrap: wrap; }
  .kanji-study > div:not(.kanji-square) { min-width: 0; flex: 1 1 110px; }
  .course-bottom { flex-wrap: wrap; }
  .course-bottom .source-link { flex: 1 1 100%; order: 3; }
}
@media (max-width: 360px) {
  .content { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
  .modal { --dialog-pad: 16px; }
  .hero h2 { font-size: 24px; }
  .hero-cat { width: 96px; right: 0; top: 77px; }
  .hero p { max-width: 185px; }
  .hero .tag { max-width: 205px; line-height: 1.9; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .cards .lesson-body h3, .cards .lesson-body p { min-height: 0; }
  .library { grid-template-columns: minmax(0, 1fr); }
  .course-unit-grid { grid-template-columns: minmax(0, 1fr); }
  .intro-hero h1 { font-size: 23px; }
  .intro-mascot { width: 84px; right: 2px; }
}
@media (max-height: 500px) and (max-width: 950px) {
  .modal-backdrop { padding-top: max(8px, env(safe-area-inset-top)); padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  .study-card { min-height: 150px; padding-top: 18px; padding-bottom: 18px; }
}
.nav .nav-more { display: none; }
.mobile-menu { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 10px 0; }
.mobile-menu .chip { display: flex; align-items: center; gap: 12px; min-height: 52px; text-align: left; font-size: 13px; }
@media (max-width: 650px) { .nav button.nav-more { display: flex; } }
/* On a short landscape viewport the desktop side menu must remain scrollable. */
.sidebar { overflow-y: auto; overscroll-behavior: contain; }
.sidebar > .brand, .sidebar > .nav, .sidebar > .side-bottom { flex-shrink: 0; }
/* Flashcards reserve space for rating controls; only the learning content scrolls. */
.flashcard-modal { display: flex; flex-direction: column; overflow: hidden; }
.flashcard-modal .modal-top { position: static; flex: 0 0 auto; margin-bottom: 12px; }
.flashcard-modal #modal-body { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.flashcard-modal .study-head { flex: 0 0 auto; margin-bottom: 12px; }
.flashcard-scroll { flex: 1 1 auto; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.flashcard-actions { flex: 0 0 auto; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); background: var(--paper); }
.flashcard-scroll .explain { margin: 12px 0 0; }
@media (max-width: 650px) {
  .flashcard-backdrop { align-items: center; }
  .modal.flashcard-modal { --dialog-pad: 16px; height: auto; }
  .flashcard-modal .modal-top { margin-bottom: 8px; padding-top: 0; padding-bottom: 0; }
  .flashcard-modal .study-head { margin-bottom: 10px; }
  .flashcard-scroll .study-card { min-height: 0; padding: 16px 14px; }
  .flashcard-scroll .big-jp { font-size: 36px; margin: 10px 0; }
  .flashcard-scroll .big-jp.intro-jp { font-size: 23px; line-height: 1.8; }
  .flashcard-scroll .meaning { margin: 9px 0; font-size: 17px; }
  .flashcard-scroll .reading { font-size: 14px; line-height: 1.8; }
  .flashcard-scroll .hint { margin-bottom: 4px; }
  .flashcard-scroll .explain { padding: 12px 14px; font-size: 11px; line-height: 1.9; }
  .flashcard-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; padding-top: 10px; }
  .flashcard-actions > button { min-height: 54px; padding: 10px 6px; box-shadow: none; }
  .flashcard-actions > button:only-child { grid-column: 1 / -1; }
}
@media (max-height: 500px) {
  .modal.flashcard-modal { --dialog-pad: 12px; height: 100%; }
  .flashcard-modal .modal-top { margin-bottom: 4px; padding: 0; }
  .flashcard-modal .study-head { margin-bottom: 6px; }
  .flashcard-actions { margin-top: 8px; padding-top: 8px; }
}
.lesson-picker { border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin: 22px 0; background: #fffefa; }
.lesson-picker > div { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.lesson-picker strong { font-size: 13px; }
.lesson-picker small { color: #929b85; font-size: 10px; }
.lesson-picker nav { display: grid; grid-template-columns: repeat(13,minmax(0,1fr)); gap: 7px; }
.lesson-picker button { border: 1px solid #e0e5d5; background: #f5f5eb; border-radius: 7px; min-height: 42px; color: #7c8c6b; font-size: 12px; }
.lesson-picker button:hover, .lesson-picker button[aria-current='page'] { background: #768c63; color: #fff; border-color: #768c63; }
.lesson-source { display: flex; align-items: center; justify-content: space-between; gap: 22px; border: 1px solid #dfe5d3; border-radius: 14px; padding: 22px; margin: 23px 0; background: #eef2e5; }
.lesson-source strong { display: block; margin: 12px 0 8px; font-size: 16px; }
.lesson-source p { color: #869477; font-size: 10px; line-height: 1.9; margin: 0; max-width: 500px; }
.lesson-source a { text-decoration: none; white-space: nowrap; }
.vocab-toolbar { display: flex; flex-wrap: wrap; gap: 12px; margin: 20px 0; }
.vocab-batches { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 9px; }
.vocab-batches button { font-size: 11px; padding: 12px 8px; }
.vocab-batches small { display: block; font-size: 9px; color: #9aa58c; margin-top: 6px; }
.course-vocab-row { display: flex; gap: 15px; align-items: center; justify-content: space-between; border: 1px solid var(--line); background: #fffefa; border-radius: 11px; padding: 15px; margin-bottom: 10px; }
.course-vocab-row > div { min-width: 0; }
.course-vocab-row > div:last-child { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.course-vocab-row b { font: 500 19px 'Noto Sans JP',sans-serif; display: block; line-height: 1.9; overflow-wrap: anywhere; }
.course-vocab-row small { font: 400 12px 'Noto Sans JP',sans-serif; color: #9b9f87; }
.course-vocab-row p { font-size: 11px; color: #839172; line-height: 1.8; margin: 5px 0 0; }
.course-vocab-row .chip { font-size: 10px; padding: 10px; min-height: 40px; }
.extra-grammar { border-top: 1px solid var(--line); margin: 24px 0 8px; padding-top: 22px; }
.extra-grammar h3 { font: 500 19px 'Noto Sans JP',sans-serif; line-height: 1.9; }
.extra-grammar p { font-size: 12px; line-height: 2; color: #869177; }
/* Reading aids and illustrations share the existing cream / sage palette. */
ruby { ruby-align: center; ruby-position: over; }
rt { font-size: .5em; font-weight: 400; color: #64745d; letter-spacing: .02em; line-height: 1.35; }
.jp-sentence, .reading-passage { line-height: 2.4; }
.choice { line-height: 2.15; text-align: left; }
.scene-figure { margin: 18px 0 22px; border: 1px solid #e1dfca; border-radius: 16px; overflow: hidden; background: #efefdf; }
.scene-figure img { display: block; width: 100%; height: auto; aspect-ratio: 3/2; object-fit: cover; }
.scene-figure figcaption { padding: 12px 15px; font-size: 11px; color: #5e6c53; line-height: 1.8; }
.scene-figure.compact img { max-height: 240px; }
.vocab-picture { display: block; width: 112px; max-width: 100%; margin: 15px auto; flex-shrink: 0; }
.vocab-picture svg { display: block; width: 100%; height: auto; }
.vocab-picture.small { width: 64px; margin: 0; }
.vocab-word { display: flex; align-items: center; gap: 16px; flex: 1; }
.vocab-word > div { min-width: 0; }
.vocab-word .vocab-picture { flex: 0 0 64px; }
.flashcard-modal .vocab-picture { width: 88px; margin: 10px auto; }
.flashcard-modal ruby rt { font-size: .3em; }
.flashcard-modal .big-jp { line-height: 1.85; }
.flashcard-modal .intro-jp ruby { white-space: normal; }
.lesson-art { position: relative; overflow: hidden; }
.lesson-art .lesson-scene { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.lesson-art:has(.lesson-scene) .lesson-type { position: relative; z-index: 1; background: #fff9e9; border-radius: 5px; padding: 5px 8px; }
.lesson-art:has(.lesson-scene) .mini { display: none; }
.word-row .kanji { display: block; line-height: 2.1; }
.word-row .kanji .vocab-picture { display: inline-block; width: 52px; margin-right: 12px; vertical-align: middle; }
.vocab-auto-start { padding: 18px; margin: 18px 0; background: #eef2e5; border: 1px solid #dbe2ce; border-radius: 13px; }
.vocab-auto-start p { font-size: 12px; line-height: 1.8; color: #65755a; margin: 7px 0 14px; }
.vocab-auto-start > div:last-child { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.vocab-auto-start button { min-height: 46px; background: #fffdf5; font-size: 12px; }
.auto-modes { flex: 0 0 auto; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin-bottom: 12px; }
.auto-modes button { min-height: 44px; border: 1px solid #d8dfc9; border-radius: 9px; background: #fffdf5; color: #66785b; font-size: 12px; line-height: 1.6; }
.auto-modes button[aria-pressed='true'] { background: #768c63; border-color: #768c63; color: white; }
.vocab-auto-modal .course-modal-label { margin: 0 0 10px; line-height: 1.7; font-size: 10px; }
.auto-content .study-card { padding: 20px 14px; min-height: 0; }
.auto-content .big-jp { font-size: 36px; margin: 12px 0; }
.auto-content .reading { font-size: 16px; margin-top: 6px; }
.auto-content .meaning { font-size: 19px; margin-top: 12px; }
.auto-content .vocab-picture { width: 72px; margin: 12px auto 0; }
.auto-example { padding: 17px; font-size: 12px; margin-top: 14px; line-height: 1.9; }
.auto-example .jp-sentence { font-size: 18px; margin: 14px 0; }
.vocab-cue { width: min(220px, 100%); }
.vocab-cue .cue-art { font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; }
.vocab-word .vocab-cue.small { width: 86px; flex: 0 0 86px; }
.word-row .kanji .vocab-cue.small { width: 76px; }
.flashcard-modal .vocab-cue, .auto-content .vocab-cue { width: min(178px, 100%); }
.intro-scene-panel { margin: 18px 0 24px; }
.intro-scene-panel h2 { margin: 6px 0 10px; }
.phrase-context { display: flex; align-items: center; gap: 16px; margin: 12px 0; padding: 12px; border-radius: 12px; background: #eef2e6; }
.phrase-context .vocab-cue { flex: 0 0 136px; width: 136px; margin: 0; }
.phrase-context figcaption { min-width: 0; line-height: 1.65; color: #4a5c48; font-size: 13px; }
.phrase-context figcaption p { margin: 4px 0 0; }
.learning-video { margin: 12px 0 16px; border: 1px solid #dbe2ce; border-radius: 12px; background: #f1f4e9; overflow: hidden; }
.learning-video > summary, .video-transcript summary { padding: 12px; cursor: pointer; font-weight: 650; color: #43563d; line-height: 1.6; }
.learning-video > summary { min-height: 44px; list-style: none; }
.learning-video > summary::-webkit-details-marker { display: none; }
.learning-video video { display: block; width: 100%; aspect-ratio: 16/9; background: #243224; }
.video-transcript ol { margin: 0 12px 14px; padding-inline-start: 24px; line-height: 1.8; font-size: 13px; }
.practice-topics { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 22px; }
.practice-topics .chip { min-height: 44px; }
.practice-topics .chip[aria-pressed='true'] { background: #536d4d; color: white; border-color: #536d4d; }
.lesson-video-tag { display: inline-block; margin: 0 0 10px; padding: 3px 8px; border-radius: 6px; background: #e8eedc; color: #405538; font-size: 11px; }
.scenario-context { font-size: 13px; color: #4b5d44; line-height: 1.75; margin: 10px 0; }
@media(max-width:430px){
 .vocab-word .vocab-cue.small { width: 64px; flex-basis: 64px; }
 .phrase-context { gap: 10px; }
 .phrase-context .vocab-cue { flex-basis: 84px; width: 84px; }
}
.auto-content .is-speaking { box-shadow: inset 0 0 0 2px #96a77f; }
.auto-controls { flex: 0 0 auto; border-top: 1px solid #dfe2d4; margin-top: 10px; padding-top: 8px; }
#auto-status { font-size: 11px; line-height: 1.7; color: #65755b; margin: 0 0 9px; }
.auto-transport { display: grid; grid-template-columns: 1fr 1.5fr 1fr; gap: 8px; }
.auto-transport button { min-height: 44px; padding: 10px 5px; font-size: 12px; line-height: 1.5; }
.auto-transport button:disabled { opacity: .45; cursor: default; }
.auto-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; margin-top: 10px; }
.auto-options > label { min-width: 0; font-size: 11px; color: #65755a; }
.auto-options select { display: block; width: 100%; min-height: 44px; border: 1px solid #d8dfc9; border-radius: 8px; background: #fffdf5; color: #53634a; margin-top: 5px; padding: 5px 8px; font-size: 14px; }
.auto-loop { display: flex; align-items: center; gap: 7px; min-height: 44px; line-height: 1.7; }
.auto-loop input { width: 18px; height: 18px; accent-color: #768c63; flex-shrink: 0; }
.auto-back { display: block; width: 100%; min-height: 36px; padding: 8px; margin-top: 5px; font-size: 11px; text-align: center; }
@media(max-width:650px){
 .modal.vocab-auto-modal { height: 100%; }
 .vocab-auto-modal .course-modal-label { margin-bottom: 6px; }
 .vocab-auto-modal .auto-content .big-jp { font-size: 34px; }
 .vocab-auto-modal .auto-content .intro-jp { font-size: 23px; }
 .auto-modes { margin-bottom: 8px; }
 .auto-options select { font-size: 16px; }
 .vocab-auto-start { padding: 15px; }
}
@media(max-height:500px){
 .vocab-auto-modal .course-modal-label { display: none; }
 .vocab-auto-modal .auto-modes { margin-bottom: 5px; }
 .auto-controls { margin-top: 5px; padding-top: 5px; }
 .auto-options { margin-top: 5px; }
 #auto-status { margin-bottom: 5px; }
}
@media(min-width:651px) and (max-height:500px){
 .modal.vocab-auto-modal { width: min(920px,100%); }
 .vocab-auto-modal #modal-body { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); grid-template-rows: auto auto minmax(0,1fr); column-gap: 16px; }
 .vocab-auto-modal .study-head { grid-column: 1 / -1; grid-row: 1; }
 .vocab-auto-modal .auto-modes { grid-column: 1 / -1; grid-row: 2; }
 .vocab-auto-modal .auto-content { grid-column: 1; grid-row: 3; height: 100%; min-height: 0; }
 .vocab-auto-modal .auto-controls { grid-column: 2; grid-row: 3; margin: 0; padding: 0; border: 0; min-height: 0; overflow-y: auto; }
}
@media(max-width:650px){
 .scene-figure { border-radius: 12px; margin: 15px 0 18px; }
 .scene-figure figcaption { font-size: 11px; padding: 10px 12px; }
 .vocab-word { gap: 10px; }
 .vocab-word .vocab-picture { flex-basis: 44px; width: 44px; }
 .course-vocab-row b { font-size: 17px; line-height: 2.2; }
 .choice { font-size: 15px; line-height: 2.25; }
 .jp-heading { line-height: 2.2; }
}
@media(max-width:650px){
 .lesson-picker { padding: 16px; }
 .lesson-picker nav { grid-template-columns: repeat(5,minmax(0,1fr)); gap: 8px; }
 .lesson-picker button { min-height: 44px; }
 .lesson-source { display: block; padding: 19px; }
 .lesson-source .primary { margin-top: 17px; font-size: 10px; white-space: normal; line-height: 1.8; }
 .vocab-batches { grid-template-columns: repeat(2,minmax(0,1fr)); }
 .course-vocab-row { gap: 10px; padding: 12px; }
 .course-vocab-row > div:last-child { flex-direction: column; gap: 8px; }
 .course-vocab-row b { font-size: 18px; }
 .course-vocab-row .sound { width: 44px; height: 44px; }
 .course-vocab-row .chip { min-height: 44px; }
}
.course-grammar-launch {
 display: flex;
 align-items: center;
 justify-content: space-between;
 flex-wrap: wrap;
 gap: 10px 16px;
 margin: 12px 0;
 padding: 14px;
 border: 1px solid var(--line);
 border-radius: 12px;
 background: #edf0e5;
}
.course-grammar-launch div { min-width: 0; }
.course-grammar-launch small { display: block; margin-top: 4px; color: #5c6859; }
.course-grammar-launch button { min-height: 44px; }
.course-grammar-notes { margin-top: 22px; }
.course-grammar-notes h3 { margin-bottom: 10px; }
.course-grammar-notes .translation { margin: 8px 0; }
.course-grammar-notes .translation summary { padding: 5px 0; }
.course-grammar-notes .reading-passage { margin: 8px 0; }

.course-goal,.course-material,.course-kanji-focus>div {
 background:#fcfcf6; border:1px solid var(--line); border-radius:14px; padding:14px;
}
.course-goal { margin:0 0 16px; background:#edf0e5; }
.course-goal p,.course-stage-title p,.course-material p,.course-glossary-row p { margin:4px 0; line-height:1.7; }
.course-stage { margin-bottom:20px; }
.course-stage-title { display:flex; align-items:center; gap:10px; margin:0 0 10px; }
.course-stage-title>span { display:grid; place-items:center; flex:0 0 34px; height:34px; border-radius:10px; background:#e9eedf; color:#3f6049; font-weight:700; }
.course-stage-title h3,.course-material h3 { margin:0; }
.course-stage-title p { color:#576657; }
.course-inline-actions { display:flex; flex-wrap:wrap; gap:6px; margin:8px 0; }
.course-inline-actions .chip,.course-glossary-row .chip,.course-write-form .chip { min-height:44px; }
.course-inline-actions .chip[aria-pressed=true] { background:#e9eedf; border-color:#7c906e; color:#385843; }
.course-material { margin:0 0 12px; }
.course-material .translation { margin:8px 0 0; }
.course-write-form { display:flex; flex-wrap:wrap; gap:8px; }
.course-write-form input,.course-material textarea { width:100%; min-width:0; padding:9px; border:1px solid #bac5b2; border-radius:8px; background:#fff; color:var(--ink); font:inherit; font-size:16px; }
.course-write-form input { flex:1 1 170px; }
.course-material textarea { resize:vertical; }
.course-write-feedback { color:#42624b; }
.course-glossary-row { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:10px 0; border-bottom:1px solid var(--line); }
.course-glossary-row div { min-width:0; overflow-wrap:anywhere; }
.course-glossary-row b { font-size:18px; line-height:1.8; }
.course-glossary-row small { display:block; color:#576657; }
.course-glossary-row .chip { flex-shrink:0; }
.course-kanji-focus { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; margin:10px 0; }
.course-kanji-focus>div { padding:8px 5px; text-align:center; overflow-wrap:anywhere; }
.course-kanji-focus span { display:block; color:#42624b; font-size:26px; }
.course-kanji-focus p { margin:8px 0 0; line-height:1.9; }
.course-test-clock { text-align:right; font-variant-numeric:tabular-nums; color:#814432; }

.minna-skill-notes { margin:14px 0; }
.minna-skill-notes h3 { margin:0 0 6px; }
.minna-skill-notes .translation { margin:6px 0; }
.minna-skill-contrast { display:grid; gap:8px; margin-bottom:4px; }
.minna-skill-contrast>div { padding:8px 10px; border-radius:8px; background:#f4ede3; }
.minna-skill-contrast>div+div,.minna-skill-tray { background:#edf0e5; }
.minna-skill-contrast dt { font-weight:600; }
.minna-skill-contrast dd { margin:4px 0 0; line-height:1.8; }
.minna-skill-tray { min-height:62px; display:flex; align-items:center; flex-wrap:wrap; gap:6px; padding:8px; border:1px dashed #84957a; border-radius:10px; }
.minna-skill-tray .chip { min-height:44px; }
.minna-skill-choices .choice[aria-pressed=true] { background:#e9eedf; border-color:#729263; color:var(--ink); }
.minna-skill-word { width:100%; min-height:46px; padding:10px; border:1px solid #bac5b2; border-radius:8px; background:#fff; color:var(--ink); font:inherit; font-size:16px; }
#minna-skill-check[hidden] { display:none; }
