/* Paper study, 2026-10-24. One removable presentation layer.
   No reading/ruby metrics, storage, audio, scroll handling or control hooks change. */
:root, #view-listening {
  --paper: #f3f0e9;
  --surface: #fffdf8;
  --surface-muted: #ebe7de;
  --ink: #242e36;
  --muted: #61665f;
  --muted-text: var(--muted);
  --line: #dedbd2;
  --accent: #294b60;
  --accent-soft: #e4ebed;
  --error: #a63d30;
  --study-vermilion: #b7402d;
  --study-dark: #232d36;
  --study-serif: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", "Songti SC", "SimSun", serif;
  --study-shadow: 0 8px 24px -20px #39362c66;
  --radius-control: 8px;
  --radius-surface: 18px;
  --color-primary: var(--accent);
  --color-primary-hover: #213e50;
  --color-primary-active: #193240;
  --color-primary-shadow: transparent;
  --color-secondary: var(--surface);
  --color-on-secondary: var(--ink);
  --color-secondary-border: var(--line);
  --color-secondary-shadow: transparent;
  --color-secondary-hover: #eeebe3;
  --color-secondary-active: #e5e1d7;
  --color-neutral: var(--surface-muted);
  --color-on-neutral: var(--ink);
  --color-neutral-border: var(--line);
  --color-neutral-shadow: transparent;
  --color-neutral-hover: #e4e0d6;
  --color-neutral-active: #dcd7cb;
  --color-button-disabled-bg: #ebe8e0;
  --color-button-disabled-text: #686d69;
  --color-button-disabled-border: var(--line);
}
body, html[data-journey-view='listening'] body { background: var(--paper); color: var(--ink); }
/* A very quiet paper grain lives only behind work surfaces. */
body { background-image: radial-gradient(#7d72510a .65px, transparent .65px); background-size: 7px 7px; }
.product-identity { display: flex; align-items: center; gap: 10px; color: var(--ink); letter-spacing: -.02em; }
.product-identity::before { display: none; }
.brand-seal { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px; border-radius: 11px 9px 12px 9px; background: var(--study-vermilion); color: #fffdf8; font: 700 23px/1 var(--study-serif); }
.nav-glyph { display: none; }
.product-bar { border-color: var(--line); }
.product-navigation button { border-radius: 8px; }
.product-navigation button[aria-current="page"] { border-bottom-color: transparent; border-radius: 8px; color: var(--accent); }
.product-navigation button:hover { transform: none; }
.product-bar > a { color: var(--accent); font-size: 13px; }
.creation-header h1, .shell-view h1, #view-listening #listening-question-title,
.material-row-title, .materials-detail h2 { font-family: var(--study-serif); font-weight: 600; }
.material-row-title { font-size: 1.17rem; }
/* Reading text keeps its existing sans face, width, line spacing and pagination. */
.app-shell > .shadowing-panel { border-radius: 18px; box-shadow: var(--study-shadow); }
.creation-workspace .article-panel, .study-sidebar .article-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: none; }
.shadowing-panel > .section-heading { border-bottom-style: dashed; }
.shadowing-panel > .section-heading h2 { color: var(--ink); font-weight: 600; }
.sentence-counter { color: var(--muted); }
.subtitle-sentence:hover { background: #edeae2; }
.subtitle-sentence.is-selected { background: var(--accent-soft); }
ruby rt { color: #697266; }
textarea, select, #recent-search { border-color: #c7c5ba; }
/* Recovery belongs to the editor's helper row, not a separate heading band. */
.article-panel #input-hint { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 2px 8px; min-height: 28px; margin-block: 8px 0; font-size: 13px; line-height: 1.5; }
.article-panel .article-input-help { min-width: 0; }
.article-panel #restore-input { min-height: 28px; padding: 3px 4px; margin-left: auto; border: 0; border-radius: 5px; background: transparent; color: var(--accent); font-size: 13px; font-weight: 500; line-height: 1.5; box-shadow: none; white-space: nowrap; }
.article-panel #restore-input:hover { background: var(--accent-soft); }
.article-panel #restore-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.creation-columns .ocr-drop-zone { background: #f8f6ef; border-color: #a9afa7; }
.ocr-mode-option:has(input:checked) { background: var(--accent-soft); border-color: #829ba8; }
/* Base tray styling; floating-playback.css docks it while the lesson is open. */
.playback-panel .playback-actions { padding: 10px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-muted); }
#play-speech, #start-learning { --button-background: var(--study-vermilion); --button-background-hover: #a13727; --button-background-active: #8e3023; --button-text: #fff; --button-border: transparent; --button-shadow: transparent; }
.app-shell:has(.shadowing-panel:not([hidden])) .actions #start-learning { --button-background: var(--study-vermilion); --button-background-hover: #a13727; --button-background-active: #8e3023; --button-border: transparent; --button-text: #fff; color: #fff; }
.playback-panel .control-disclosure-toggle { background: #f5f2eb; }
.playback-panel .control-disclosure-toggle:hover { background: var(--accent-soft); border-color: #829ba8; }
.material-row { background: var(--surface); border: 1px solid #e7e3da; border-radius: 16px; box-shadow: none; }
.material-row:hover { background: #fffefa; box-shadow: var(--study-shadow); border-color: #a1afb1; }
.material-row-description { font-size: 14px; color: var(--muted); }
.material-tag { background: #eeece5; color: #5c645f; font-size: 13px; }
.material-row-action { color: var(--accent); }
.material-preview-info { background: var(--surface-muted); border-radius: 16px; }
.material-preview-text { background: var(--surface); border-radius: 18px; }
#view-my-learning .recent-learning-open { background: var(--surface); box-shadow: none; border: 1px solid var(--line); border-radius: 14px; }
#view-my-learning .recent-learning-open:hover { background: #fffefa; box-shadow: var(--study-shadow); }
#view-my-learning .recent-learning-time, #view-my-learning .recent-learning-count,
#view-my-learning .recent-pagination span, #view-my-learning .learning-library-summary { font-size: 13px; }
/* Settings uses the same work surface and a return control on its left edge. */
.shell-view-host:has(> #view-settings:not([hidden])) > .shell-session-links { width: 100%; max-width: 880px; margin-inline: auto; }
#view-settings { padding: clamp(20px, 3vw, 32px); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; }
#view-settings > h1 { font-size: 24px; margin-bottom: 12px; }
#view-settings > p { margin: 0 0 20px; font-size: 15px; }
#view-settings #settings-study-note { margin-top: 12px; font-size: 14px; }
#view-settings button[data-workspace-target] { min-height: 44px; padding: 10px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-muted); color: var(--ink); }
#view-settings button[data-workspace-target]:hover { background: var(--accent-soft); border-color: #aebdc2; }
#view-settings .shell-advanced { margin-top: 24px; padding-top: 12px; border-top: 1px solid var(--line); }
#view-settings .shell-advanced summary { border-radius: 8px; font-size: 14px; font-weight: 600; }
#view-settings .shell-advanced summary:hover { color: var(--accent); background: var(--surface-muted); }
/* Listening: preserve the original fitted answer rail and footer clearance. */
#view-listening .listening-sheet { border-radius: 18px; border-color: #e4dfd4; box-shadow: var(--study-shadow); }
#view-listening .listening-player { background: var(--study-dark); border: 0; border-radius: 13px; padding: 10px 14px; color: #f7f4ed; }
#view-listening .listening-timeline-caption, #view-listening .listening-audio-tools { color: #d9dfe1; }
#view-listening #listening-play { background: var(--study-vermilion); color: #fff; border-color: transparent; }
#view-listening #listening-play:hover { background: #c44b36; }
#view-listening .listening-audio-tools > button, #view-listening #listening-rate-choices button { color: #e6e9e9; }
#view-listening #listening-rate-choices { background: transparent; }
#view-listening .listening-audio-tools > button:hover, #view-listening #listening-rate-choices button:hover { background: #35434e; color: #fff; }
#view-listening #listening-rate-choices button[aria-pressed="true"] { background: #faf8f2; color: #242e36; }
#view-listening .listening-player :focus-visible { outline-color: #fff8df; }
#view-listening #listening-seek { accent-color: #dfe8e9; }
#view-listening #listening-seek::-webkit-slider-thumb { background: #f7f5ed; border-color: #232d36; box-shadow: 0 0 0 1px #e1e6e7; }
#view-listening #listening-options label { border-radius: 10px; }
#view-listening .listening-task.has-figure { column-gap: 24px; }
#view-listening .listening-answer-state { flex-shrink: 0; }
#view-listening .listening-level > summary { background: var(--surface); border-color: var(--line); }
#view-listening .listening-level[data-current="true"] > summary { background: var(--accent-soft); border-color: var(--accent); }
#view-listening .listening-choice-segments { background: var(--surface-muted); }
#view-listening .listening-choice-control:not(#listening-rate-choices) button[aria-pressed="true"] { color: var(--ink); }
/* Don't recolor grading states: green/red/amber retain their existing meaning. */
#dictionary-panel { background: var(--surface); color: var(--ink); border-color: var(--line); }
#dictionary-panel .dictionary-heading { background: var(--surface); }
#dictionary-panel .dictionary-ai-examples th { background: var(--surface-muted); }
#dictionary-panel .dictionary-ai-examples th, #dictionary-panel .dictionary-ai-examples td { border-color: var(--line); }
.dictionary-ai-note { background: var(--surface-muted); }
#dictionary-toggle { background: var(--surface); border-color: var(--line); }
/* Complete the shared control palette, including previously hard-coded blues. */
.btn-secondary, .playback-panel #reset-speech { --button-border: var(--line); }
#dictionary-close, #dictionary-query, #dictionary-panel .dictionary-suggestion { background: var(--surface); border-color: var(--line); color: var(--ink); }
#dictionary-form button, #dictionary-panel #dictionary-ai-search { background: var(--accent-soft); color: var(--accent); border-color: #aebdc2; }
#dictionary-panel button:hover:not(:disabled), #dictionary-toggle:hover, #dictionary-selection:hover { background: #d7e2e5; color: var(--accent); }
#dictionary-panel :focus-visible, #dictionary-toggle:focus-visible, #dictionary-selection:focus-visible { outline-color: var(--accent); }
#dictionary-panel .dictionary-footer, #dictionary-panel .dictionary-entry, #dictionary-ai { border-color: var(--line); }
#dictionary-panel .dictionary-match, #dictionary-panel .dictionary-footer a { color: var(--accent); }
#dictionary-panel .dictionary-ai-basics dt, #dictionary-panel .dictionary-label,
#dictionary-panel .dictionary-reading, #dictionary-panel .dictionary-heading p,
#dictionary-input-hint, #dictionary-ai-hint, #dictionary-status:not([data-error="true"]) { color: var(--muted); }
#view-listening .listening-pack-panel, #view-listening .listening-about-panel { box-shadow: 0 12px 32px #39362c1f; }
#view-listening #listening-review { border-color: var(--line); }
#view-listening #listening-review > summary { color: var(--ink); border-radius: 6px; padding-block: 4px; }
#view-listening #listening-review > summary:hover { color: var(--accent); background: var(--surface-muted); }
#view-listening .listening-review-body h3 { font-weight: 600; color: var(--muted); }
#view-listening .listening-paper-context, .material-page, #dictionary-count { font-variant-numeric: tabular-nums; }
#view-listening { min-height: var(--listening-playback-min-height, 0px); }
@media (min-width: 801px) {
  #view-listening .listening-sidebar {
    position: sticky;
    top: var(--listening-sidebar-top, 33px);
    align-self: start;
  }
}
.account-notice { max-width: 1420px; margin-inline: auto; }
/* Rail only where there is enough horizontal room. On smaller windows the
   original flowing top nav cannot collide with the fixed exercise footer. */
@media (min-width: 1200px) {
  body { padding-left: 88px; }
  .product-bar { position: fixed; inset: 0 auto 0 0; width: 88px; height: 100dvh; min-height: 0; margin: 0; padding: 20px 8px 16px; flex-direction: column; gap: 22px; background: #faf8f1; border: 0; border-right: 1px solid var(--line); z-index: 20; }
  .product-identity { justify-content: center; }
  .brand-seal { width: 42px; height: 42px; flex-basis: 42px; }
  .brand-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .product-navigation { flex-direction: column; width: 100%; gap: 8px; flex: 1; min-height: 0; }
  .product-navigation button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; min-height: 66px; padding: 5px 2px; font-size: 13px; }
  .product-navigation button:last-child { margin-left: 0; margin-top: auto; }
  .nav-glyph { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; font: 600 19px/1 var(--study-serif); color: inherit; }
  .product-navigation button,
  .product-navigation button:is(:hover, :active, [aria-current="page"]) { background: transparent; border-bottom-color: transparent; box-shadow: none; }
  .product-navigation button:is(:hover, :active, :focus-visible, [aria-current="page"]) { color: var(--accent); }
  .product-navigation button:is(:hover, :active, :focus-visible, [aria-current="page"]) .nav-glyph { background: var(--accent); color: var(--surface); }
  .product-bar > a { flex-shrink: 0; display: grid; place-items: center; min-height: 36px; font-size: 13px; text-decoration: none; }
  .app-shell, .creation-workspace { padding-top: 24px; }
  .shell-view-host { padding-top: 16px; }
  /* Keep the level bar close to the top, aligned with its return action. */
  .shell-view-host:has(> #view-listening:not([hidden])) { padding-top: 4px; }
  #view-listening { max-width: 1240px; }
  #view-listening .listening-layout { grid-template-columns: 256px minmax(0, 1fr); }
  #view-listening .listening-sidebar { padding: 8px; background: var(--surface); border: 0; border-radius: 14px; }
  .shell-view-host:has(> #view-listening:not([hidden])) > .shell-session-links { top: 8px; left: max(0px, calc((100% - 1240px) / 2)); }
  /* Dictionary measures the paper when open; keep its existing alignment. */
  .materials-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1680px) { .materials-list { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (max-width: 700px) {
  .product-bar { gap: 8px; padding-top: 8px; }
  .product-identity { font-size: 14px; }
  .brand-seal { width: 30px; height: 30px; flex-basis: 30px; font-size: 20px; }
  .product-navigation { flex-wrap: wrap; }
  .product-navigation button { padding-inline: 7px; font-size: 13px; }
  .product-bar > a { margin-left: auto; }
  .playback-panel .playback-actions { padding: 8px; }
  #view-listening .listening-player { padding: 10px; }
}
@media (min-width: 1200px) and (max-height: 560px) {
  .product-bar { gap: 10px; padding-block: 10px; }
  .product-navigation { gap: 2px; }
  .product-navigation button { min-height: 52px; gap: 2px; }
}
@media (prefers-reduced-motion: no-preference) {
  .brand-seal, .nav-glyph, .product-navigation button { transition: background-color 140ms, color 140ms; }
  .material-row { transition: border-color 160ms, box-shadow 160ms, background-color 160ms; }
}
