:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #687389;
  --line: #dfe5ef;
  --surface: #ffffff;
  --canvas: #f4f7fb;
  --blue: #246bfd;
  --blue-dark: #1554d1;
  --blue-soft: #eaf2ff;
  --mint: #30b97a;
  --mint-soft: #e8fbf2;
  --amber: #efaa2f;
  --amber-soft: #fff6d8;
  --navy: #0d172c;
  --shadow: 0 18px 50px rgba(24, 45, 84, 0.09);
  --radius: 24px;
}

* { box-sizing: border-box; }
html { background: var(--canvas); }
body { margin: 0; color: var(--ink); background: radial-gradient(circle at 15% -5%, #eaf3ff 0, transparent 25rem), var(--canvas); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Noto Sans JP", sans-serif; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .52; }
.app-shell { min-height: 100vh; padding-bottom: 40px; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 88px; padding: 16px max(24px, calc((100vw - 1320px) / 2)); border-bottom: 1px solid rgba(208, 217, 232, 0.8); background: rgba(247, 249, 253, 0.88); backdrop-filter: blur(18px); }
.brand, .top-actions, .player-heading, .player-title-wrap, .transport-row, .practice-controls, .sentence-toolbar, .filter-row, .words-toolbar, .card-heading, .goal-legend { display: flex; align-items: center; }
.brand { gap: 13px; }
.brand-mark { display: grid; width: 52px; height: 52px; place-items: center; border-radius: 16px; color: white; background: linear-gradient(145deg, #1977f4, #24a7e7); box-shadow: 0 12px 24px rgba(36,107,253,.22); font-size: 31px; }
.brand h1 { margin: 0; font-size: 20px; letter-spacing: -.03em; }
.brand p { margin: 3px 0 0; color: var(--muted); font-size: 12px; letter-spacing: .08em; }
.top-actions { gap: 10px; }
.language-switch { display: flex; align-items: center; gap: 8px; padding: 7px 10px 7px 14px; border: 1px solid var(--line); border-radius: 14px; background: white; color: var(--muted); font-size: 13px; }
.language-switch select { border: 0; outline: 0; color: var(--ink); font-weight: 700; background: transparent; }
.sync-pill { border: 1px solid #cce0fb; border-radius: 999px; padding: 10px 15px; background: #edf6ff; color: #2770cb; }
.sync-pill i { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: #2770cb; }
.icon-button, .close-button { border: 1px solid var(--line); background: white; }
.icon-button { width: 42px; height: 42px; border-radius: 13px; font-size: 19px; }
main { width: min(1320px, calc(100% - 48px)); margin: 0 auto; padding: 44px 0; }
.view { display: none; }
.view.active { display: block; animation: enter .25s ease; }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; margin-bottom: 28px; }
.section-heading.compact { align-items: center; }
.eyebrow { color: var(--blue); font-size: 12px; font-weight: 800; letter-spacing: .14em; }
.section-heading h2, .player-heading h2 { margin: 7px 0 5px; font-size: clamp(28px, 4vw, 45px); line-height: 1.1; letter-spacing: -.045em; }
.section-heading p, .player-heading p { margin: 0; color: var(--muted); font-size: 16px; }
.player-heading-actions { display: flex; gap: 10px; margin-left: auto; }
.bookmark-button.saved { border-color: #edc46d; color: #916000; background: #fff8dc; }
.primary-button, .outline-button, .soft-button, .record-button, .text-button, .transport-main { border-radius: 14px; padding: 12px 18px; border: 0; font-weight: 750; transition: .18s ease; }
.primary-button { color: white; background: var(--blue); box-shadow: 0 10px 22px rgba(36, 107, 253, .18); }
.primary-button:hover { background: var(--blue-dark); transform: translateY(-1px); }
.outline-button { border: 1px solid #bfd1ef; background: white; color: #175ac4; }
.soft-button { background: #eef2f8; color: #536078; }
.soft-button.active { background: var(--blue-soft); color: var(--blue); }
.text-button { padding-left: 0; background: transparent; color: var(--blue); }
.upload-callout { width: 100%; display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; text-align: left; padding: 23px 28px; border: 1px solid #bad6ff; border-radius: var(--radius); background: linear-gradient(105deg, #edf7ff, #f0f5ff 58%, #e9fbf5); box-shadow: var(--shadow); }
.upload-callout:hover { border-color: var(--blue); transform: translateY(-1px); }
.upload-callout .upload-icon { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 17px; color: white; background: var(--blue); font-size: 28px; }
.upload-callout strong, .upload-callout small { display: block; }
.upload-callout strong { margin-bottom: 5px; font-size: 18px; }
.upload-callout small { color: var(--muted); font-size: 14px; }
.upload-callout b { color: var(--blue); font-size: 32px; }
.filter-row, .words-toolbar { justify-content: space-between; margin: 25px 0 18px; color: var(--muted); }
.segmented-control { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 13px; background: white; }
.segmented-control button { padding: 8px 14px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); }
.segmented-control button.active { background: var(--blue-soft); color: var(--blue); font-weight: 750; }
.material-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.material-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: var(--shadow); }
.material-cover { position: relative; height: 190px; background: linear-gradient(140deg, #166ee9, #5b64ed 55%, #a45ce7); background-position: center; background-size: cover; }
.material-cover:after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(10,18,38,.72), transparent 70%); }
.material-cover .material-state, .material-cover .material-language { position: absolute; z-index: 1; top: 14px; border-radius: 999px; padding: 7px 10px; color: white; font-size: 12px; font-weight: 800; backdrop-filter: blur(12px); }
.material-cover .material-state { right: 14px; background: rgba(36,107,253,.88); }
.material-cover .material-language { left: 14px; background: rgba(10,18,38,.55); }
.material-cover .cover-title { position: absolute; z-index: 1; left: 18px; right: 18px; bottom: 17px; color: white; font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.material-body { padding: 18px; }
.material-body h3 { margin: 0 0 10px; font-size: 20px; }
.tags { display: flex; gap: 7px; flex-wrap: wrap; }
.tag { padding: 5px 9px; border-radius: 999px; color: #1f67c9; background: var(--blue-soft); font-size: 12px; }
.tag.amber { color: #a66a06; background: var(--amber-soft); }
.material-meta { margin: 15px 0; color: var(--muted); font-size: 13px; }
.material-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.delete-button { width: 45px; border: 1px solid var(--line); border-radius: 13px; background: white; color: #8b96a8; }
.empty-state { text-align: center; padding: 70px 24px; color: var(--muted); }
.empty-state span { display: block; color: #a7b7cf; font-size: 56px; }
.empty-state h3 { color: var(--ink); margin: 12px 0 7px; font-size: 22px; }
.empty-state p { margin: 0 auto 22px; max-width: 520px; }
.player-heading { justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.player-title-wrap { gap: 14px; flex: 1; }
.language-badge { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; color: white; background: var(--blue); font-weight: 800; }
.player-heading h2 { font-size: 26px; margin: 0; }
.practice-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(340px, .6fr); gap: 22px; align-items: start; }
.video-panel, .sentence-panel, .word-card, .today-card, .metric-grid article, .goal-card, .heatmap-card { border: 1px solid var(--line); background: white; box-shadow: var(--shadow); }
.video-panel, .sentence-panel { border-radius: var(--radius); overflow: hidden; }
.video-frame { position: relative; background: #091326; aspect-ratio: 16/9; }
.video-frame video { width: 100%; height: 100%; object-fit: contain; }
.video-caption { position: absolute; left: 6%; right: 6%; bottom: 6%; color: white; font-size: clamp(17px, 2.2vw, 28px); font-weight: 800; text-align: center; text-shadow: 0 2px 8px black; }
.timeline-panel { padding: 13px 18px 10px; background: var(--navy); }
.timeline-panel input[type="range"] { --timeline-progress: 0%; display: block; width: 100%; height: 18px; margin: 0; appearance: none; background: transparent; cursor: pointer; }
.timeline-panel input[type="range"]::-webkit-slider-runnable-track { height: 5px; border-radius: 999px; background: linear-gradient(to right, var(--blue) 0 var(--timeline-progress), #465269 var(--timeline-progress) 100%); }
.timeline-panel input[type="range"]::-webkit-slider-thumb { width: 16px; height: 16px; margin-top: -5.5px; appearance: none; border: 3px solid white; border-radius: 50%; background: var(--blue); box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.timeline-panel input[type="range"]::-moz-range-track { height: 5px; border-radius: 999px; background: #465269; }
.timeline-panel input[type="range"]::-moz-range-progress { height: 5px; border-radius: 999px; background: var(--blue); }
.timeline-panel input[type="range"]::-moz-range-thumb { width: 11px; height: 11px; border: 3px solid white; border-radius: 50%; background: var(--blue); box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.timeline-panel input[type="range"]:focus-visible { outline: 2px solid #8bb4ff; outline-offset: 3px; border-radius: 999px; }
.timeline-meta { display: grid; grid-template-columns: 86px 1fr 86px; align-items: center; gap: 10px; margin-top: 3px; color: #aeb9ca; font-size: 11px; }
.timeline-meta output, .timeline-meta span:last-child { color: #f5f7fb; font-variant-numeric: tabular-nums; font-weight: 700; }
.timeline-meta span:nth-child(2) { text-align: center; }
.timeline-meta span:last-child { text-align: right; }
.transport-row { gap: 14px; padding: 15px 18px; background: var(--navy); }
.transport-main { min-width: 120px; color: white; background: #28344a; }
.speed-options { display: flex; gap: 7px; flex-wrap: wrap; }
.speed-options button { min-width: 55px; padding: 10px; border: 0; border-radius: 10px; color: #e8edf7; background: #243047; font-weight: 700; }
.speed-options button.active { background: var(--blue); color: white; }
.caption-toggle { margin-left: auto; padding: 10px 13px; border: 1px solid #46546b; border-radius: 10px; color: #c1cad8; background: #1c283d; font-weight: 700; white-space: nowrap; }
.caption-toggle.active { border-color: #6b9cff; color: white; background: #24447a; }
.practice-controls { gap: 9px; justify-content: center; flex-wrap: wrap; padding: 18px; }
.record-button { color: white; background: #16233a; }
.record-button.recording { background: #e74855; }
.record-button i { display: inline-block; width: 9px; height: 9px; margin-right: 7px; border-radius: 50%; background: #f0525e; }
.record-button.recording i { background: white; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
#recordingPlayback { display: block; width: calc(100% - 36px); margin: 0 18px 18px; }
#recordingPlayback[hidden] { display: none; }
.practice-hint { margin: 0; padding: 0 18px 20px; color: var(--muted); text-align: center; font-size: 13px; }
.sentence-panel { max-height: calc(100vh - 180px); position: sticky; top: 110px; }
.sentence-toolbar { justify-content: space-between; padding: 17px 18px; border-bottom: 1px solid var(--line); }
.sentence-toolbar span { color: var(--muted); font-size: 13px; }
.sentence-toolbar-actions { display: flex; align-items: center; gap: 9px; }
.sentence-add-button { padding: 6px 9px; border: 1px solid #bfd1ef; border-radius: 9px; color: #175ac4; background: white; font-size: 12px; font-weight: 750; }
.sentence-add-button:hover { border-color: var(--blue); background: var(--blue-soft); }
.sentence-list { max-height: calc(100vh - 250px); overflow: auto; padding: 10px; }
.sentence-card { width: 100%; margin-bottom: 9px; padding: 14px; text-align: left; border: 1px solid transparent; border-radius: 15px; background: #f7f9fc; cursor: pointer; }
.sentence-card:hover { border-color: #bfd5fa; }
.sentence-card:focus-visible { outline: 2px solid #78a1e5; outline-offset: 2px; }
.sentence-card.active { border-color: #edb54a; background: #fff8dc; box-shadow: inset 3px 0 0 #efaa2f; }
.sentence-time-row { display: flex; align-items: center; min-height: 28px; }
.sentence-card .timecode { color: #748097; font-size: 12px; font-variant-numeric: tabular-nums; }
.sentence-bookmark { margin-left: auto; padding: 3px 7px; border-radius: 999px; color: #916000; background: #fff0b8; font-size: 10px; font-weight: 800; }
.sentence-bookmark[hidden] { display: none; }
.sentence-actions { display: flex; gap: 2px; margin-left: auto; opacity: 0; transition: opacity .15s ease; }
.sentence-bookmark:not([hidden]) + .sentence-actions { margin-left: 7px; }
.sentence-card:hover .sentence-actions, .sentence-card.active .sentence-actions, .sentence-actions:focus-within { opacity: 1; }
.sentence-action-button { width: 28px; height: 28px; padding: 0; border: 1px solid transparent; border-radius: 8px; color: #617089; background: transparent; }
.sentence-action-button:hover { border-color: #bfd5fa; background: white; }
.sentence-action-button.delete:hover { border-color: #f2c4c9; color: #b83e4c; background: #fff0f1; }
.sentence-card.editing { cursor: default; }
.inline-time-editor { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) 28px 28px; align-items: center; gap: 5px; width: 100%; }
.inline-time-editor label { display: flex; align-items: center; gap: 4px; color: #68758b; font-size: 10px; font-weight: 750; }
.inline-time-editor input { min-width: 0; width: 100%; height: 28px; padding: 3px 5px; border: 1px solid #b7c8e2; border-radius: 7px; background: white; color: var(--ink); font: inherit; font-variant-numeric: tabular-nums; }
.inline-time-editor input:focus { border-color: var(--blue); outline: 0; box-shadow: 0 0 0 2px rgba(36,107,253,.12); }
.inline-time-editor button { width: 28px; height: 28px; padding: 0; border: 0; border-radius: 8px; font-weight: 900; }
.inline-time-save { color: white; background: var(--blue); }
.inline-time-cancel { color: #9a4c55; background: #fff0f1; }
.inline-content-editor { display: grid; gap: 8px; margin-top: 8px; }
.inline-content-editor label { display: grid; gap: 4px; color: #68758b; font-size: 11px; font-weight: 750; }
.inline-content-editor textarea { width: 100%; min-height: 42px; padding: 8px 9px; resize: vertical; border: 1px solid #b7c8e2; border-radius: 9px; color: var(--ink); background: white; line-height: 1.45; }
.inline-content-editor textarea:focus { border-color: var(--blue); outline: 0; box-shadow: 0 0 0 2px rgba(36,107,253,.12); }
.inline-content-editor small { color: #8490a3; font-size: 10px; font-weight: 500; }
.sentence-card .tokens { margin: 4px 0 5px; line-height: 1.65; }
.token-button { padding: 1px 3px; border: 0; border-bottom: 1px dashed #78a1e5; background: transparent; color: #175ac4; font-weight: 750; }
.sentence-card .token-button { padding-right: 0; padding-left: 0; }
.sentence-card .translation { color: var(--muted); font-size: 13px; }
.words-toolbar { padding: 0 3px; }
.toolbar-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.word-list { display: grid; gap: 14px; }
.word-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px; padding: 22px; border-radius: 20px; }
.word-check { display: grid; place-items: center; width: 43px; height: 43px; border-radius: 13px; background: #eef2f7; color: #8994a8; }
.word-check.synced { color: white; background: var(--mint); }
.word-content h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 7px; }
.word-content p { margin: 4px 0; color: var(--muted); }
.word-content em { color: #2b9bad; }
.word-source { color: #2b9bad !important; font-size: 13px; }
.word-actions { display: flex; gap: 8px; }
.word-actions button { min-width: 42px; height: 42px; padding: 0 11px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.today-card { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 28px; border-radius: var(--radius); background: linear-gradient(115deg, #eff8ff, #f0fbf6); }
.today-card span, .today-card strong, .today-card small { display: block; }
.today-card strong { margin: 7px 0; font-size: 36px; }
.today-card strong b { color: var(--blue); }
.today-card small { color: var(--muted); }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 18px 0; }
.metric-grid article { padding: 25px; text-align: center; border-radius: 19px; }
.metric-grid strong, .metric-grid span { display: block; }
.metric-grid strong { color: var(--blue); font-size: 34px; }
.metric-grid article:first-child strong { color: var(--amber); }
.metric-grid article:nth-child(3) strong { color: var(--mint); }
.metric-grid .anki-metric strong { color: #835bd8; }
.metric-grid span { margin-top: 6px; color: var(--muted); }
.anki-progress-card { margin-bottom: 18px; padding: 24px 26px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(120deg, #fbf9ff, #f5f1ff); box-shadow: var(--shadow); }
.anki-progress-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.anki-progress-heading h3 { margin: 5px 0; font-size: 21px; }
.anki-progress-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.anki-progress-heading > strong { color: #835bd8; font-size: 34px; }
.anki-progress-track { height: 10px; margin: 18px 0 13px; overflow: hidden; border-radius: 99px; background: #e8e1f5; }
.anki-progress-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #a886e8, #7650ca); transition: width .35s ease; }
.anki-progress-details { display: flex; gap: 24px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.anki-progress-details b { margin-left: 4px; color: var(--ink); }
.goal-card { display: flex; align-items: center; gap: 36px; padding: 28px; border-radius: var(--radius); }
.goal-ring { --progress: 0deg; display: grid; place-items: center; align-content: center; width: 160px; height: 160px; flex: 0 0 auto; border-radius: 50%; background: radial-gradient(circle at center, white 57%, transparent 59%), conic-gradient(var(--blue) var(--progress), #e9eef5 0); }
.goal-ring strong, .goal-ring span { display: block; text-align: center; }
.goal-ring strong { font-size: 32px; }
.goal-ring span { color: var(--muted); font-size: 12px; }
.goal-card h3 { margin: 0 0 7px; font-size: 25px; }
.goal-card p { margin: 0 0 18px; color: var(--muted); }
.goal-legend { gap: 7px; color: var(--muted); font-size: 12px; }
.goal-legend i { width: 9px; height: 9px; margin-left: 9px; border-radius: 3px; }
.local-dot { background: var(--blue); }
.anki-dot { background: #a886e8; }
.heatmap-card { margin-top: 18px; padding: 26px; border-radius: var(--radius); }
.card-heading { justify-content: space-between; }
.card-heading h3 { margin: 0 0 5px; }
.card-heading p { margin: 0; color: var(--muted); }
.card-heading > span { padding: 7px 10px; border-radius: 999px; color: #8162bc; background: #f0eafd; font-size: 12px; }
.heatmap { display: grid; grid-template-rows: repeat(7, 15px); grid-auto-flow: column; grid-auto-columns: 15px; gap: 5px; margin-top: 22px; overflow-x: auto; padding-bottom: 5px; }
.heat-cell { width: 15px; height: 15px; border-radius: 4px; background: #e9eef5; }
.heat-cell.level-1 { background: #cce0ff; }
.heat-cell.level-2 { background: #85b4ff; }
.heat-cell.level-3 { background: #3d7ff0; }
.heat-cell.level-4 { background: #1758c7; }
.heat-cell.has-anki { box-shadow: inset 0 0 0 2px #a27be2; }
.heatmap-legend { display: flex; align-items: center; justify-content: flex-end; gap: 5px; margin-top: 10px; color: var(--muted); font-size: 11px; }
.heatmap-legend i { width: 12px; height: 12px; border-radius: 3px; background: #e9eef5; }
.heatmap-legend i:nth-of-type(2) { background: #cce0ff; }
.heatmap-legend i:nth-of-type(3) { background: #85b4ff; }
.heatmap-legend i:nth-of-type(4) { background: #1758c7; }
.primary-nav { position: relative; z-index: 1; width: fit-content; margin: 16px auto 0; display: flex; gap: 5px; padding: 6px; border: 1px solid rgba(212,220,232,.9); border-radius: 20px; background: rgba(255,255,255,.92); box-shadow: 0 12px 32px rgba(25,44,80,.13); backdrop-filter: blur(18px); }
.primary-nav button { min-width: 128px; padding: 9px 18px; border: 0; border-radius: 14px; background: transparent; color: var(--muted); font-weight: 700; }
.primary-nav button span { display: block; margin-bottom: 3px; font-size: 20px; }
.primary-nav button.active { color: var(--blue); background: var(--blue-soft); }
.modal { width: min(680px, calc(100vw - 28px)); max-height: calc(100vh - 40px); overflow: auto; padding: 0; border: 0; border-radius: 26px; box-shadow: 0 30px 90px rgba(16,29,53,.28); }
.modal.wide { width: min(960px, calc(100vw - 28px)); }
.modal.small { width: min(440px, calc(100vw - 28px)); }
.modal::backdrop { background: rgba(12,23,44,.52); backdrop-filter: blur(5px); }
.modal form { padding: 28px; }
.modal-heading { display: flex; justify-content: space-between; align-items: start; margin-bottom: 22px; }
.modal-heading h2 { margin: 5px 0 0; font-size: 28px; }
.close-button { width: 39px; height: 39px; border-radius: 12px; font-size: 24px; }
.modal label { display: block; margin-bottom: 15px; color: #4e5b70; font-size: 13px; font-weight: 750; }
.modal input, .modal select, .modal textarea { width: 100%; margin-top: 7px; padding: 12px 13px; border: 1px solid #d5deeb; border-radius: 12px; outline: 0; background: white; color: var(--ink); }
.modal input:focus, .modal select:focus, .modal textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(36,107,253,.1); }
.two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.drop-zone { display: grid !important; place-items: center; min-height: 140px; padding: 20px; border: 1.5px dashed #aec7ee; border-radius: 18px; text-align: center; background: #f8fbff; }
.drop-zone.secondary { min-height: 108px; background: #fbfcfe; }
.drop-zone input { display: none; }
.drop-zone span { color: var(--blue); font-size: 34px; }
.drop-zone strong, .drop-zone small { display: block; }
.drop-zone small { margin-top: 6px; color: var(--muted); font-weight: 400; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.inline-notice { padding: 12px 14px; border-radius: 12px; color: #5d6c82; background: #f0f4f9; font-size: 13px; }
.voice-setting-row { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 0 10px; margin-top: 18px; }
.modal .voice-setting-row label { margin: 0; }
.voice-preview-button { min-height: 44px; padding: 10px 15px; }
.voice-setting-row small { grid-column: 1 / -1; margin-top: 7px; color: var(--muted); }
.segment-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.segment-shift-panel { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; padding: 13px 14px; border: 1px solid #cfe0f8; border-radius: 14px; background: #f5f9ff; }
.segment-shift-panel strong { color: #274d84; font-size: 13px; }
.modal .segment-shift-panel label { display: flex; align-items: center; gap: 6px; margin: 0; white-space: nowrap; }
.modal .segment-shift-panel input { width: 82px; margin: 0; padding: 9px 10px; font-variant-numeric: tabular-nums; }
.segment-shift-panel .outline-button { padding: 10px 14px; }
.segment-shift-panel small { flex: 1 1 100%; color: #61718a; line-height: 1.45; }
.segment-editor-list { margin-top: 16px; max-height: 48vh; overflow: auto; }
.segment-edit-row { display: grid; grid-template-columns: 32px 78px 78px 1fr 1fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.segment-row-index { color: #748097; text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; }
.segment-edit-row input { margin: 0; }
.segment-edit-row button { width: 38px; height: 38px; border: 0; border-radius: 10px; color: #c34d59; background: #fff0f1; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 24px; transform: translate(-50%, 20px); padding: 11px 16px; border-radius: 12px; color: white; background: #142039; box-shadow: 0 12px 30px rgba(10,20,40,.25); opacity: 0; pointer-events: none; transition: .25s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 980px) {
  .material-grid { grid-template-columns: repeat(2, 1fr); }
  .practice-layout { grid-template-columns: 1fr; }
  .sentence-panel { position: static; max-height: none; }
  .sentence-list { max-height: 520px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 680px) {
  main { width: min(100% - 24px, 1320px); padding-top: 24px; }
  .topbar { padding: 11px 12px; min-height: 72px; }
  .brand-mark { width: 43px; height: 43px; border-radius: 13px; font-size: 25px; }
  .brand h1 { max-width: 150px; font-size: 16px; }
  .brand p, .language-switch span, .sync-pill { display: none; }
  .language-switch { padding: 7px; }
  .section-heading { display: block; }
  .section-heading .primary-button { width: 100%; margin-top: 18px; }
  .upload-callout { padding: 18px; }
  .upload-callout .upload-icon { width: 46px; height: 46px; }
  .upload-callout small { display: none; }
  .material-grid { grid-template-columns: 1fr; }
  .player-heading { flex-wrap: wrap; }
  .player-title-wrap { order: -1; width: 100%; }
  .player-heading-actions { width: 100%; margin-left: 0; }
  .player-heading-actions button { flex: 1; }
  .transport-row { display: block; }
  .transport-main { width: 100%; margin-bottom: 10px; }
  .speed-options { justify-content: center; }
  .caption-toggle { width: 100%; margin: 10px 0 0; }
  .timeline-meta { grid-template-columns: 72px 1fr 72px; }
  .timeline-meta span:nth-child(2) { font-size: 10px; }
  .sentence-actions { opacity: 1; }
  .inline-time-editor { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) 26px 26px; gap: 3px; }
  .inline-time-editor label { font-size: 0; }
  .inline-time-editor input { height: 28px; font-size: 12px; }
  .inline-time-editor button { width: 26px; height: 28px; }
  .primary-nav { width: calc(100% - 24px); margin-top: 12px; }
  .primary-nav button { min-width: 0; flex: 1; padding: 8px 6px; }
  .metric-grid { gap: 8px; }
  .metric-grid article { padding: 18px 8px; }
  .anki-progress-card { padding: 20px; }
  .anki-progress-heading { align-items: start; }
  .anki-progress-heading > strong { font-size: 28px; }
  .anki-progress-details { gap: 12px 18px; }
  .goal-card { gap: 18px; padding: 19px; }
  .goal-ring { width: 120px; height: 120px; }
  .today-card { display: block; }
  .today-card button { width: 100%; margin-top: 18px; }
  .two-cols { grid-template-columns: 1fr; gap: 0; }
  .segment-shift-panel { align-items: stretch; }
  .segment-shift-panel strong, .segment-shift-panel label, .segment-shift-panel .outline-button { flex: 1 1 100%; }
  .modal .segment-shift-panel input { flex: 1; }
  .segment-edit-row { grid-template-columns: 28px 1fr 1fr 38px; }
  .segment-edit-row .segment-row-index { grid-column: 1; grid-row: 1; }
  .segment-edit-row .start-input { grid-column: 2; grid-row: 1; }
  .segment-edit-row .end-input { grid-column: 3; grid-row: 1; }
  .segment-edit-row button { grid-column: 4; grid-row: 1; }
  .segment-edit-row .text-input { grid-column: 2 / 5; grid-row: 2; }
  .segment-edit-row .translation-input { grid-column: 2 / 5; grid-row: 3; }
  .word-card { grid-template-columns: auto 1fr; }
  .word-actions { grid-column: 1 / 3; justify-content: flex-end; }
  .words-toolbar { align-items: flex-start; gap: 12px; }
  .toolbar-actions { justify-content: flex-end; }
}
