:root {
  --paper: #f2f5f4;
  --paper-deep: #e8eeec;
  --panel: #fbfcfb;
  --ink: #1b2026;
  --muted: #667078;
  --line: #d7dfdc;
  --line-strong: #b9c6c1;
  --indigo: #245a73;
  --indigo-dark: #173d50;
  --cinnabar: #d94f38;
  --leaf: #68a357;
  --gold: #c69c45;
  --shadow: 0 18px 50px rgba(27, 32, 38, .08);
  --radius: 20px;
  font-family: "BIZ UDPGothic", "Yu Gothic UI", "Meiryo", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 70% -20%, rgba(36, 90, 115, .09), transparent 32rem),
    linear-gradient(90deg, rgba(27, 32, 38, .018) 1px, transparent 1px),
    var(--paper);
  background-size: auto, 28px 28px, auto;
  overflow-x: hidden;
}

button, input, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(217, 79, 56, .32);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  left: 1rem;
  top: -4rem;
  padding: .7rem 1rem;
  color: white;
  background: var(--ink);
  border-radius: 8px;
}
.skip-link:focus { top: 1rem; }

.app-shell { min-height: 100vh; }

.site-header {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 clamp(1rem, 3vw, 2.75rem);
  border-bottom: 1px solid var(--line);
  background: rgba(242, 245, 244, .9);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  text-decoration: none;
  color: var(--ink);
}
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: white;
  border-radius: 50% 50% 50% 10%;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: 1.35rem;
  box-shadow: inset -6px -6px 0 rgba(255,255,255,.08);
}
.brand b { display: block; letter-spacing: .08em; font-size: 1.05rem; }
.brand small { display: block; color: var(--muted); font-size: .68rem; margin-top: .12rem; letter-spacing: .08em; }

.header-actions { display: flex; align-items: center; gap: .7rem; }
.profile-switcher {
  display: flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,.68);
}
.profile-switcher label { padding-left: .25rem; color: var(--muted); font-size: .61rem; font-weight: 900; }
.profile-switcher select {
  max-width: 126px;
  border: 0;
  border-left: 1px solid var(--line);
  padding: .25rem .35rem;
  color: var(--ink);
  background: transparent;
  font-size: .7rem;
  font-weight: 800;
}
.profile-switcher button {
  border: 0;
  border-radius: 7px;
  padding: .36rem .48rem;
  color: white;
  background: var(--indigo);
  cursor: pointer;
  font-size: .61rem;
  font-weight: 900;
}
.profile-switcher .delete-profile-button {
  border: 1px solid rgba(217, 79, 56, .42);
  color: #a73b2b;
  background: transparent;
}
.profile-switcher .delete-profile-button:hover:not(:disabled) { background: rgba(217, 79, 56, .08); }
.profile-switcher .delete-profile-button:disabled {
  border-color: var(--line);
  color: var(--muted);
  opacity: .48;
  cursor: not-allowed;
}
.offline-badge {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 700;
}
.offline-badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--leaf); box-shadow: 0 0 0 4px rgba(104,163,87,.12); }
.icon-button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: transparent;
  font-weight: 800;
  cursor: pointer;
}

.main-layout { display: grid; grid-template-columns: 282px minmax(0, 1fr); min-height: calc(100vh - 76px); }
.study-rail {
  padding: 1.35rem 1.2rem 2rem;
  border-right: 1px solid var(--line);
  background: rgba(251,252,251,.55);
  min-width: 0;
}

.progress-card { display: grid; grid-template-columns: 72px 1fr; align-items: center; gap: .9rem; padding: .4rem .15rem 1.35rem; }
.progress-ring {
  width: 72px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--cinnabar) var(--progress), var(--line) 0);
  position: relative;
}
.progress-ring::after { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--paper); }
.progress-ring span { position: relative; z-index: 1; text-align: center; line-height: 1; }
.progress-ring strong { font-size: 1.15rem; }
.progress-ring small { display: block; margin-top: .25rem; color: var(--muted); font-size: .58rem; }
.eyebrow { margin: 0 0 .3rem; color: var(--indigo); font-size: .65rem; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.progress-card h2, .section-heading h2 { margin: 0; font-size: .95rem; }
.progress-card > div:last-child > p:last-child { margin: .3rem 0 0; color: var(--muted); font-size: .71rem; line-height: 1.45; }

.mode-nav { display: grid; gap: .4rem; padding-bottom: 1.3rem; border-bottom: 1px solid var(--line); }
.mode-button {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  align-items: center;
  gap: .55rem;
  width: 100%;
  padding: .68rem .72rem;
  border: 0;
  border-radius: 12px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-size: .82rem;
  font-weight: 800;
  min-width: 0;
}
.mode-button > span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; background: var(--paper-deep); font-family: "Yu Mincho", serif; }
.mode-button small { color: var(--muted); font-weight: 600; font-size: .62rem; }
.mode-button > b { min-width: 0; font-size: inherit; white-space: nowrap; }
.mode-button:hover { background: white; }
.mode-button.is-active { background: var(--ink); color: white; box-shadow: 0 8px 22px rgba(27,32,38,.12); }
.mode-button.is-active > span { color: var(--ink); background: white; }
.mode-button.is-active small { color: #c7cfcc; }

.cycle-settings { padding: 1rem 0 1.15rem; border-bottom: 1px solid var(--line); }
.cycle-settings summary { display: flex; align-items: center; justify-content: space-between; gap: .75rem; cursor: pointer; list-style: none; }
.cycle-settings summary::-webkit-details-marker { display: none; }
.cycle-settings summary span { display: flex; align-items: baseline; gap: .45rem; }
.cycle-settings summary b { font-size: .78rem; }
.cycle-settings summary small { color: var(--indigo); font-size: .6rem; font-weight: 900; }
.cycle-settings summary i { color: var(--muted); font-style: normal; transition: transform .2s ease; }
.cycle-settings[open] summary i { transform: rotate(180deg); }
.cycle-body { display: grid; gap: .65rem; margin-top: .75rem; }
.cycle-status { padding: .72rem; border-left: 3px solid var(--cinnabar); border-radius: 4px 10px 10px 4px; background: white; }
.cycle-status span { color: var(--indigo); font-size: .6rem; font-weight: 900; }
.cycle-status strong { float: right; font: 800 .64rem "Cascadia Code", monospace; }
.cycle-status p { clear: both; margin: .3rem 0 0; color: var(--muted); font-size: .62rem; line-height: 1.5; }
.cycle-meter { height: 4px; margin-top: .55rem; overflow: hidden; border-radius: 999px; background: var(--paper-deep); }
.cycle-meter i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--leaf); transition: width .25s ease; }
.cycle-status > small { display: block; margin-top: .25rem; color: var(--muted); font-size: .52rem; text-align: right; }
.setup-button {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .12rem .45rem;
  width: 100%;
  border: 1px solid rgba(36,90,115,.22);
  border-radius: 10px;
  padding: .62rem .7rem;
  background: rgba(36,90,115,.07);
  text-align: left;
  cursor: pointer;
}
.setup-button span { grid-column: 1; color: var(--indigo); font-size: .54rem; font-weight: 900; }
.setup-button b { grid-column: 1; font-size: .7rem; }
.setup-button i { grid-column: 2; grid-row: 1 / span 2; align-self: center; color: var(--indigo); font-size: .58rem; font-style: normal; font-weight: 900; }
.setup-button:hover { border-color: var(--indigo); background: white; }
.cycle-settings fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.cycle-settings legend { margin-bottom: .28rem; color: var(--muted); font-size: .56rem; font-weight: 800; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 9px; background: var(--paper-deep); }
.segmented button { min-width: 0; border: 0; border-radius: 7px; padding: .42rem .25rem; color: var(--muted); background: transparent; cursor: pointer; font-size: .61rem; font-weight: 900; }
.segmented button.is-active { color: var(--ink); background: white; box-shadow: 0 2px 7px rgba(27,32,38,.08); }

.grade-filter, .daily-list { padding-top: 1.2rem; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: .75rem; }
.section-heading.compact { align-items: center; }
.section-heading > span { color: var(--muted); font-size: .68rem; }
.text-button { border: 0; padding: .25rem; background: none; color: var(--indigo); cursor: pointer; font-size: .68rem; font-weight: 800; }
.grade-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; margin-top: .8rem; }
.grade-grid button { border: 1px solid var(--line); background: rgba(255,255,255,.5); border-radius: 9px; padding: .5rem .25rem; cursor: pointer; font-weight: 800; font-size: .75rem; }
.grade-grid button span { display: block; color: var(--muted); font-size: .56rem; font-weight: 600; margin-top: .16rem; }
.grade-grid button:hover, .grade-grid button.is-active { border-color: var(--indigo); color: var(--indigo); background: white; }
.grade-grid button[data-grade="7"] { grid-column: 1 / -1; min-height: 58px; border-color: rgba(36,90,115,.38); color: var(--indigo-dark); background: rgba(36,90,115,.07); }
.grade-grid button[data-grade="7"] span { color: var(--indigo); }
.grade-grid button[data-grade="7"].is-auto-expand { border-style: dashed; }
.grade-grid button[data-grade="7"].is-active { color: white; border-style: solid; border-color: var(--indigo); background: var(--indigo); }
.grade-grid button[data-grade="7"].is-active span { color: #d9e7ec; }

.status-filters { display: grid; grid-template-columns: repeat(4, 1fr); gap: .28rem; margin-top: .65rem; }
.status-filters button { display: grid; gap: .08rem; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: .35rem .1rem; background: rgba(255,255,255,.55); cursor: pointer; }
.status-filters span { color: var(--muted); font-size: .5rem; font-weight: 800; }
.status-filters b { font: 800 .62rem "Cascadia Code", monospace; }
.status-filters button.is-active { color: white; border-color: var(--indigo); background: var(--indigo); }
.status-filters button.is-active span { color: #d9e7ec; }

.kanji-queue { display: grid; grid-template-columns: repeat(3, 1fr); gap: .45rem; margin-top: .8rem; max-height: 370px; overflow: auto; padding-right: .2rem; }
.kanji-pick {
  position: relative;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.62);
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: 1.6rem;
  cursor: pointer;
}
.kanji-pick:hover { transform: translateY(-1px); border-color: var(--indigo); }
.kanji-pick.is-active { color: white; background: var(--indigo); border-color: var(--indigo); }
.kanji-pick small { position: absolute; right: .32rem; bottom: .25rem; font-family: sans-serif; font-size: .5rem; opacity: .7; }
.kanji-pick .dot { position: absolute; width: 6px; height: 6px; left: .35rem; top: .35rem; border-radius: 50%; background: var(--leaf); }
.kanji-pick .status-mark { position: absolute; left: .27rem; top: .25rem; min-width: 17px; border-radius: 999px; padding: .08rem .15rem; color: var(--muted); background: var(--paper-deep); font: 900 .43rem "BIZ UDPGothic", sans-serif; text-align: center; }
.kanji-pick[data-status="learning"] .status-mark { color: var(--indigo); background: #dceaf0; }
.kanji-pick[data-status="mastered"] .status-mark { color: white; background: var(--leaf); }
.kanji-pick.is-active .status-mark { color: var(--indigo); background: white; }
.empty-list { grid-column: 1 / -1; color: var(--muted); font-size: .74rem; line-height: 1.7; padding: 1rem .2rem; }

.study-area { min-width: 0; padding: 1.35rem clamp(1rem, 2.5vw, 2.4rem) 2.5rem; }
.search-row { display: flex; gap: 1rem; align-items: stretch; max-width: 1240px; margin: 0 auto 1.1rem; }
.search-box { flex: 1; min-width: 0; display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: .65rem; min-height: 46px; border: 1px solid var(--line); background: rgba(255,255,255,.7); border-radius: 12px; padding: 0 .9rem; }
.search-box > span { color: var(--indigo); font-size: 1.35rem; line-height: 1; }
.search-box input { min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: .82rem; }
.search-box kbd { color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: .2rem .35rem; background: var(--paper); font-size: .56rem; }
.session-score { min-width: 100px; display: flex; align-items: baseline; justify-content: center; gap: .2rem; border-left: 3px solid var(--cinnabar); background: white; padding: .75rem; border-radius: 5px 12px 12px 5px; box-shadow: 0 6px 20px rgba(27,32,38,.04); }
.session-score span { color: var(--muted); font-size: .6rem; margin-right: .25rem; }
.session-score strong { font-family: "Cascadia Code", monospace; font-size: 1.15rem; }
.session-score small { font-size: .55rem; }

.review-hub {
  max-width: 1240px;
  margin: 0 auto 1.1rem;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto auto;
  align-items: center;
  gap: 1rem;
  padding: .9rem 1rem .9rem 1.15rem;
  border: 1px solid #c9d8d3;
  border-left: 6px solid var(--cinnabar);
  border-radius: 8px 16px 16px 8px;
  background: rgba(251,252,251,.96);
  box-shadow: 0 9px 28px rgba(27,32,38,.05);
}
.review-hub-copy h2 { margin: 0; font-size: 1rem; }
.review-hub-copy > p:last-child { margin: .3rem 0 0; color: var(--muted); font-size: .66rem; line-height: 1.5; }
.study-rewards { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .5rem; }
.study-rewards span { padding: .22rem .42rem; border-radius: 999px; color: var(--muted); background: var(--paper); font-size: .5rem; font-weight: 800; }
.study-rewards b { color: var(--indigo); }
.review-schedule { display: grid; grid-template-columns: repeat(4, minmax(54px,1fr)); border: 1px solid var(--line); border-radius: 11px; overflow: hidden; background: var(--paper); }
.review-schedule span { min-width: 58px; display: grid; place-items: center; gap: .1rem; padding: .48rem .55rem; border-right: 1px solid var(--line); }
.review-schedule span:last-child { border-right: 0; }
.review-schedule small { color: var(--muted); font-size: .49rem; font-weight: 900; }
.review-schedule b { color: var(--indigo); font: 900 .9rem "Cascadia Code", monospace; }
.review-schedule span:first-child b { color: var(--cinnabar); }
.review-hub-actions { min-width: 245px; display: grid; gap: .45rem; }
.review-hub-actions button { width: 100%; border-radius: 13px; cursor: pointer; font-weight: 900; }
.review-start-button { display: grid; grid-template-columns: 1fr auto; gap: .2rem .8rem; align-items: center; padding: .85rem 1rem; border: 2px solid var(--ink); color: white; background: var(--ink); text-align: left; box-shadow: 0 8px 18px rgba(27,32,38,.16); }
.review-start-button span { font-size: .95rem; }
.review-start-button b { grid-column: 1; color: #cbd8d3; font-size: .56rem; }
.review-start-button i { grid-column: 2; grid-row: 1 / span 2; font-size: 1.3rem; font-style: normal; }
.review-start-button:hover { background: var(--indigo-dark); transform: translateY(-1px); }
.review-start-button:disabled { cursor: default; color: var(--muted); border-color: var(--line); background: var(--paper-deep); }
.review-start-button:disabled b { color: var(--muted); }
.review-writing-button { display: flex; align-items: center; justify-content: space-between; gap: .7rem; padding: .58rem .75rem; border: 1px solid var(--line-strong); color: var(--indigo); background: white; text-align: left; }
.review-writing-button b { font-size: .68rem; }
.review-writing-button span { color: var(--muted); font-size: .5rem; }
.review-writing-button:hover { border-color: var(--indigo); background: #f5f9f7; }
.review-writing-button:disabled { cursor: default; opacity: .55; }

.learning-grid { display: grid; grid-template-columns: minmax(390px, .92fr) minmax(430px, 1.08fr); gap: 1.1rem; max-width: 1240px; margin: 0 auto; align-items: start; }
.panel { min-width: 0; background: rgba(251,252,251,.94); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.25rem 1.35rem .9rem; }
.panel-header h1, .panel-header h2 { margin: 0; font-size: 1.1rem; letter-spacing: .03em; }
.kanji-meta { display: flex; gap: .38rem; }
.kanji-meta span { border: 1px solid var(--line); border-radius: 999px; padding: .32rem .55rem; color: var(--muted); font-size: .61rem; font-weight: 800; }

.target-line { display: grid; grid-template-columns: 68px 1fr; align-items: center; gap: .9rem; padding: .2rem 1.35rem 1rem; }
.target-kanji { font-family: "Yu Mincho", "Hiragino Mincho ProN", serif; font-size: 3.4rem; line-height: 1; color: var(--indigo); text-align: center; }
.target-meaning { margin: 0 0 .25rem; font-size: .92rem; font-weight: 900; }
.target-note { margin: 0; color: var(--muted); font-size: .7rem; line-height: 1.55; }

.recall-gate {
  display: grid;
  grid-template-columns: 44px minmax(0,1fr) auto;
  gap: .65rem;
  align-items: center;
  margin: 0 1.35rem 1rem;
  padding: .8rem;
  border: 1px solid #cad9d4;
  border-radius: 14px;
  background: linear-gradient(120deg, #edf4f1, #f9fbfa);
}
.recall-symbol { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50% 50% 50% 12%; color: white; background: var(--indigo-dark); font-family: "Yu Mincho", serif; font-size: 1.25rem; }
.recall-copy h2 { margin: 0; font-size: .76rem; }
.recall-copy > p:last-child { margin: .28rem 0 0; color: var(--muted); font-size: .56rem; line-height: 1.5; }
.recall-actions { display: grid; gap: .3rem; }
.recall-actions > small { color: var(--cinnabar); font-size: .49rem; font-weight: 900; text-align: center; }
.recall-actions button { border-radius: 8px; padding: .48rem .62rem; cursor: pointer; font-size: .59rem; font-weight: 900; }
.recall-reveal { border: 1px solid var(--ink); color: white; background: var(--ink); }
.manual-status-button { border: 1px solid var(--line-strong); color: var(--indigo); background: white; }
.manual-status-button.is-mastered { color: #3f7533; border-color: rgba(104,163,87,.45); background: rgba(104,163,87,.1); }
.manual-status-button:disabled { cursor: default; opacity: .75; }
.confidence-row { grid-column: 2 / -1; display: flex; align-items: center; justify-content: flex-end; gap: .32rem; padding-top: .42rem; border-top: 1px dashed var(--line-strong); }
.confidence-row[hidden] { display: none; }
.confidence-row span { margin-right: auto; color: var(--muted); font-size: .58rem; font-weight: 800; }
.confidence-row button { border: 1px solid var(--line-strong); border-radius: 999px; padding: .35rem .58rem; background: white; cursor: pointer; font-size: .56rem; font-weight: 900; }
.confidence-row button.is-active { color: white; border-color: var(--indigo); background: var(--indigo); }
.recall-answer {
  grid-column: 1 / -1;
  padding: .85rem .95rem;
  border: 2px solid var(--indigo);
  border-radius: 12px;
  background: white;
  box-shadow: 0 8px 22px rgba(36,90,115,.08);
}
.recall-answer[hidden] { display: none; }
.recall-answer-head { display: flex; align-items: baseline; justify-content: space-between; gap: .7rem; padding-bottom: .55rem; border-bottom: 1px solid var(--line); }
.recall-answer-head span { color: var(--cinnabar); font-size: .56rem; font-weight: 900; }
.recall-answer-head strong { color: var(--indigo-dark); font-size: .77rem; }
.recall-answer-words { display: grid; grid-template-columns: repeat(3,1fr); gap: .38rem; margin-top: .55rem; }
.recall-answer-words p { margin: 0; padding: .48rem; border-radius: 8px; background: var(--paper); }
.recall-answer-words b, .recall-answer-words small { display: block; }
.recall-answer-words b { font-size: .7rem; }
.recall-answer-words small { margin-top: .16rem; color: var(--muted); font-size: .52rem; }
.recall-answer-words em { display: block; margin-top: .3rem; color: var(--ink); font-size: .52rem; font-style: normal; line-height: 1.45; }
.recall-more-button { width: 100%; margin-top: .55rem; border: 0; padding: .45rem; color: var(--indigo); background: transparent; cursor: pointer; font-size: .56rem; font-weight: 900; }
.maturity-line { grid-column: 1 / -1; display: grid; grid-template-columns: auto minmax(70px,1fr) auto; gap: .3rem .55rem; align-items: center; padding-top: .42rem; border-top: 1px dashed var(--line-strong); }
.maturity-line > span { color: var(--muted); font-size: .54rem; font-weight: 900; }
.maturity-line > i { height: 6px; overflow: hidden; border-radius: 999px; background: white; }
.maturity-line > i b { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gold), var(--leaf)); transition: width .25s ease; }
.maturity-line > strong { color: var(--indigo); font-size: .6rem; }
.maturity-line > small { color: var(--muted); font-size: .51rem; }
.maturity-line > small:first-of-type { grid-column: 1 / 3; font-weight: 800; }
.maturity-line > small:last-of-type { grid-column: 3; text-align: right; }

.knowledge-card { position: relative; }
.pad-workbench { display: grid; grid-template-columns: minmax(112px,.72fr) minmax(190px,1.28fr); gap: .8rem; align-items: end; padding: 0 1.35rem; }
.model-pad-wrap, .write-pad-column { min-width: 0; }
.model-pad-wrap > strong, .write-pad-column > strong { display: block; margin-bottom: .38rem; color: var(--indigo); font-size: .61rem; }
.model-pad { display: block; width: 100%; aspect-ratio: 1; border: 1px solid var(--indigo); border-radius: 9px; color: #cfd8d4; background: #f8fbfa; }
.model-layer { fill: none; stroke: var(--ink); stroke-width: 3.1; stroke-linecap: round; stroke-linejoin: round; }
.model-layer path.is-animating { animation: draw-stroke .65s ease-out both; }
.model-layer text { fill: var(--cinnabar); stroke: white; stroke-width: .7; paint-order: stroke; font: 700 4.3px "Cascadia Code", monospace; opacity: 0; }
.model-layer.show-numbers text { opacity: .95; }
.model-pad-wrap > small { display: block; margin-top: .35rem; color: var(--muted); font-size: .49rem; line-height: 1.4; }
.pad-wrap { position: relative; width: 100%; margin: 0; }
.writing-pad { display: block; width: 100%; aspect-ratio: 1; border: 1px solid var(--line-strong); border-radius: 8px; color: #cfd8d4; background: #fff; touch-action: none; cursor: crosshair; box-shadow: inset 0 0 28px rgba(36,90,115,.035); }
.grid-fill { color: #e7ecea; }
.cross-line { stroke: #cfd8d4; stroke-width: .45; stroke-dasharray: 2 2; fill: none; }
.reference-layer { fill: none; stroke: var(--indigo); stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; opacity: .16; pointer-events: none; }
.reference-layer.is-hidden { opacity: 0; }
.reference-layer path.is-animating { animation: draw-stroke .65s ease-out both; }
.reference-layer text { fill: var(--cinnabar); stroke: white; stroke-width: .7; paint-order: stroke; font: 700 4.3px "Cascadia Code", monospace; opacity: 0; }
.reference-layer.show-numbers text { opacity: .9; }
.user-layer { fill: none; stroke: var(--ink); stroke-width: 3.25; stroke-linecap: round; stroke-linejoin: round; }
.user-layer polyline.is-current { stroke: var(--cinnabar); }
@keyframes draw-stroke { from { stroke-dashoffset: var(--stroke-length); } to { stroke-dashoffset: 0; } }
.pad-label { display: flex; justify-content: space-between; margin-top: .35rem; color: #98a39e; font-size: .52rem; }
.score-seal { position: absolute; right: -14px; bottom: 8px; width: 68px; aspect-ratio: 1; display: grid; place-content: center; text-align: center; border-radius: 50%; color: white; background: var(--cinnabar); border: 3px double rgba(255,255,255,.7); box-shadow: 0 8px 24px rgba(217,79,56,.28); transform: rotate(-8deg) scale(0); transition: transform .3s cubic-bezier(.2,.8,.2,1.2); }
.score-seal.is-visible { transform: rotate(-8deg) scale(1); }
.score-seal strong { font: 800 1.45rem/1 "Cascadia Code", monospace; }
.score-seal small { font-size: .55rem; }

.guide-switches { display: flex; justify-content: center; flex-wrap: wrap; gap: .45rem; padding: .9rem 1rem .7rem; }
.chip-button { border: 1px solid var(--line); background: transparent; padding: .43rem .7rem; border-radius: 999px; cursor: pointer; color: var(--muted); font-size: .65rem; font-weight: 800; }
.chip-button.is-active { color: var(--indigo); border-color: rgba(36,90,115,.35); background: rgba(36,90,115,.07); }

.feedback { display: grid; grid-template-columns: 42px 1fr; gap: .75rem; align-items: center; margin: 0 1.35rem .9rem; padding: .72rem .8rem; border-radius: 11px; background: var(--paper-deep); }
.feedback-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--indigo); font-size: .68rem; font-weight: 900; }
.feedback strong { display: block; font-size: .76rem; }
.feedback p { margin: .18rem 0 0; color: var(--muted); font-size: .64rem; line-height: 1.5; }
.feedback.is-good { background: rgba(104,163,87,.12); }
.feedback.is-good .feedback-icon { background: var(--leaf); }
.feedback.is-warn { background: rgba(217,79,56,.1); }
.feedback.is-warn .feedback-icon { background: var(--cinnabar); }

.pad-actions { display: grid; grid-template-columns: auto auto 1fr; gap: .55rem; padding: 0 1.35rem 1.35rem; }
.secondary-button, .primary-button, .small-primary { border-radius: 10px; padding: .72rem .8rem; font-size: .7rem; font-weight: 900; cursor: pointer; }
.secondary-button { border: 1px solid var(--line); background: white; }
.secondary-button:hover { border-color: var(--ink); }
.primary-button { display: flex; align-items: center; justify-content: space-between; gap: 1rem; border: 1px solid var(--ink); background: var(--ink); color: white; padding-inline: 1rem; }
.primary-button:hover { background: var(--indigo-dark); }
.primary-button span { color: #b8cac1; }
.primary-button.full { width: 100%; }

.knowledge-header { padding-bottom: .8rem; }
.knowledge-header > div:first-child { min-width: 0; }
.vocabulary-badge { display: inline-block; margin-top: .3rem; border-radius: 999px; padding: .2rem .45rem; color: var(--indigo); background: rgba(36,90,115,.09); font-size: .52rem; font-weight: 900; }
.knowledge-tools { display: grid; justify-items: end; gap: .5rem; }
.flash-test-button { border: 1px solid var(--indigo); border-radius: 999px; padding: .38rem .65rem; color: var(--indigo); background: white; cursor: pointer; font-size: .58rem; font-weight: 900; }
.flash-test-button:hover { color: white; background: var(--indigo); }
.mastery-dots { display: flex; gap: .28rem; }
.mastery-dots span { width: 27px; height: 27px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); font-size: .57rem; font-weight: 900; }
.mastery-dots span.is-done { color: white; background: var(--leaf); border-color: var(--leaf); }

.tab-list { display: grid; grid-template-columns: repeat(3, 1fr); padding: 0 1.35rem; border-bottom: 1px solid var(--line); }
.tab-list button { border: 0; border-bottom: 2px solid transparent; background: none; padding: .72rem .4rem; color: var(--muted); cursor: pointer; font-size: .7rem; font-weight: 900; }
.tab-list button.is-active { color: var(--ink); border-bottom-color: var(--cinnabar); }
.tab-panel { padding: 1rem 1.35rem 1.35rem; }

.constellation { position: relative; min-height: 290px; border-radius: 16px; overflow: hidden; background: linear-gradient(145deg, #eef3f2, #f9fbfa); border: 1px solid var(--line); }
.constellation::before { content: ""; position: absolute; inset: 0; opacity: .6; background-image: radial-gradient(circle, rgba(36,90,115,.22) 1px, transparent 1px); background-size: 24px 24px; }
.constellation svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.constellation line { stroke: #a9b9b3; stroke-width: 1; stroke-dasharray: 4 5; }
.constellation-center { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); width: 88px; height: 88px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: white; font-family: "Yu Mincho", serif; font-size: 3.35rem; box-shadow: 0 12px 35px rgba(27,32,38,.2); z-index: 2; }
.word-node { position: absolute; transform: translate(-50%,-50%); min-width: 76px; border: 1px solid var(--line-strong); border-radius: 999px; padding: .46rem .65rem; background: rgba(255,255,255,.96); cursor: pointer; font-weight: 900; font-size: .71rem; box-shadow: 0 5px 14px rgba(27,32,38,.06); z-index: 3; }
.word-node:hover, .word-node.is-active { color: white; background: var(--indigo); border-color: var(--indigo); }
.word-node small { display: block; margin-top: .12rem; opacity: .68; font-size: .5rem; font-weight: 600; }

.word-detail { margin-top: .75rem; border-left: 3px solid var(--cinnabar); padding: .3rem .2rem .3rem .85rem; }
.word-detail > div { display: flex; gap: .6rem; align-items: baseline; }
.word-detail h3 { margin: 0; font-family: "Yu Mincho", serif; font-size: 1.4rem; }
.word-reading { color: var(--indigo); font-size: .65rem; font-weight: 900; }
.word-quality { margin-left: auto; border-radius: 999px; padding: .2rem .45rem; color: #805e27; background: #fff3cf; font-size: .5rem; font-weight: 900; }
.word-quality.is-verified { color: #315d42; background: #e3f0e7; }
.word-section-label { display: block; margin-top: .55rem; color: var(--indigo); font-size: .56rem; letter-spacing: .04em; }
.word-meaning { margin: .35rem 0 .55rem; font-size: .72rem; line-height: 1.55; }
.word-detail blockquote { margin: 0; color: var(--muted); font-size: .67rem; line-height: 1.65; }
.word-detail blockquote span { color: var(--cinnabar); font-weight: 900; }
.word-source { display: inline-block; margin-top: .45rem; color: var(--muted); font-size: .49rem; }
.word-detail.is-unverified { border-left-color: #d1a44d; background: linear-gradient(90deg, rgba(255,243,207,.45), transparent 70%); }
.constellation-empty { position: absolute; z-index: 3; left: 50%; bottom: 12%; width: 76%; transform: translateX(-50%); color: var(--muted); font-size: .65rem; line-height: 1.6; text-align: center; }

.phrase-box { margin-top: .85rem; padding: .8rem; border-radius: 12px; background: #eef3f2; }
.phrase-box[hidden] { display: none; }
.phrase-heading { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.phrase-heading span { color: var(--cinnabar); font-size: .56rem; font-weight: 900; letter-spacing: .08em; }
.phrase-heading h3 { margin: 0; font-size: .7rem; }
.phrase-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .55rem; }
.phrase-chips button { border: 1px solid var(--line-strong); border-radius: 999px; padding: .4rem .62rem; background: white; cursor: pointer; font-family: "Yu Mincho", serif; font-size: .68rem; font-weight: 800; }
.phrase-chips button.is-active { color: white; border-color: var(--cinnabar); background: var(--cinnabar); }
.phrase-detail { margin-top: .55rem; font-size: .64rem; line-height: 1.6; }
.phrase-detail b { color: var(--indigo); }
.phrase-detail p { margin: .2rem 0 0; color: var(--muted); }

.my-word-box { margin-top: .85rem; border-top: 1px solid var(--line); padding-top: .75rem; }
.my-word-box summary { color: var(--indigo); cursor: pointer; font-size: .67rem; font-weight: 900; }
.custom-word-help { margin: .45rem 0 0; color: var(--muted); font-size: .56rem; }
.my-word-box form { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; margin-top: .7rem; }
.my-word-box label { color: var(--muted); font-size: .57rem; font-weight: 800; }
.my-word-box label.wide { grid-column: 1 / -1; }
.my-word-box input { display: block; width: 100%; margin-top: .2rem; border: 1px solid var(--line); border-radius: 8px; padding: .55rem; background: white; font-size: .7rem; }
.small-primary { justify-self: start; border: 0; color: white; background: var(--indigo); padding: .55rem .8rem; }
.my-word-box ul { list-style: none; margin: .6rem 0 0; padding: 0; display: grid; gap: .3rem; }
.my-word-box li { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .45rem .55rem; border-radius: 8px; background: var(--paper-deep); font-size: .65rem; }
.my-word-box li button { flex: 0 0 auto; border: 1px solid rgba(217,79,56,.28); border-radius: 999px; padding: .24rem .45rem; color: var(--cinnabar); background: white; cursor: pointer; font-size: .52rem; font-weight: 900; }

.reading-groups { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.reading-group { border: 1px solid var(--line); border-radius: 14px; padding: .85rem; background: white; }
.reading-group > span { display: inline-block; color: white; background: var(--indigo); border-radius: 5px; padding: .22rem .38rem; font-size: .54rem; font-weight: 900; }
.reading-group.kun > span { background: var(--cinnabar); }
.reading-group h3 { margin: .65rem 0; font-family: "Yu Mincho", serif; font-size: 1.2rem; }
.reading-group ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.reading-group li { padding-top: .45rem; border-top: 1px dashed var(--line); font-size: .67rem; line-height: 1.5; }
.reading-group li b { display: block; color: var(--indigo); }
.reading-challenge { margin-top: .85rem; padding: 1rem; border-radius: 14px; background: var(--paper-deep); }
.reading-challenge > p:nth-child(2) { margin: .55rem 0; font-family: "Yu Mincho", serif; font-size: 1.08rem; }
.choice-grid { display: flex; gap: .45rem; flex-wrap: wrap; }
.choice-grid button { border: 1px solid var(--line-strong); border-radius: 8px; background: white; padding: .5rem .8rem; cursor: pointer; font-size: .68rem; font-weight: 800; }
.choice-grid button.is-correct { color: white; border-color: var(--leaf); background: var(--leaf); }
.choice-grid button.is-wrong { color: white; border-color: var(--cinnabar); background: var(--cinnabar); }
.mini-feedback { min-height: 1.4em; color: var(--muted); font-size: .64rem; }

.prompt-card { padding: 1rem; border-radius: 14px; color: white; background: var(--indigo-dark); }
.prompt-card > span { color: #a8c8d4; font-size: .58rem; font-weight: 900; letter-spacing: .1em; }
.prompt-card h3 { margin: .45rem 0 .6rem; font-family: "Yu Mincho", serif; font-size: 1rem; line-height: 1.65; }
.prompt-card p { margin: 0; color: #d3e1e6; font-size: .64rem; }
.writing-field { display: block; margin-top: .9rem; position: relative; }
.writing-field > span { display: block; margin-bottom: .35rem; font-size: .64rem; font-weight: 900; }
.writing-field textarea { width: 100%; resize: vertical; border: 1px solid var(--line); border-radius: 12px; background: white; padding: .85rem; line-height: 1.8; font-size: .78rem; }
.writing-field small { position: absolute; right: .55rem; bottom: .45rem; color: var(--muted); background: white; padding-left: .3rem; font-size: .56rem; }
.rubric { display: grid; grid-template-columns: 1fr 1fr; gap: .38rem; margin: .7rem 0; }
.rubric span { color: var(--muted); font-size: .61rem; }
.rubric span.is-done { color: var(--leaf); font-weight: 900; }
.saved-writing { margin-top: .75rem; }
.saved-writing article { padding: .75rem; border: 1px solid var(--line); border-radius: 10px; background: white; font-size: .68rem; line-height: 1.7; }
.saved-writing time { display: block; color: var(--muted); font-size: .54rem; }
.saved-writing button { border: 0; border-radius: 999px; padding: .3rem .55rem; color: var(--cinnabar); background: rgba(217,79,56,.08); cursor: pointer; font-size: .53rem; font-weight: 900; }

.source-note { max-width: 1240px; margin: 1rem auto 0; display: flex; align-items: center; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: .61rem; }
.source-note p { margin: 0; }

dialog { width: min(92vw, 570px); border: 1px solid var(--line); border-radius: 20px; color: var(--ink); background: var(--panel); padding: 0; box-shadow: 0 30px 100px rgba(27,32,38,.25); }
dialog::backdrop { background: rgba(23, 30, 34, .62); backdrop-filter: blur(3px); }
dialog form { position: relative; padding: 2rem; }
dialog h2 { margin: .25rem 0 1rem; font-family: "Yu Mincho", serif; font-size: 1.45rem; }
dialog ol { padding-left: 1.3rem; color: var(--muted); font-size: .75rem; line-height: 1.75; }
dialog li + li { margin-top: .45rem; }
.dialog-close { position: absolute; right: 1rem; top: 1rem; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; background: white; cursor: pointer; }
.caution { padding: .75rem; border-radius: 10px; background: var(--paper-deep); color: var(--muted); font-size: .67rem; line-height: 1.6; }
.dialog-lead { margin: -.45rem 0 1.15rem; color: var(--muted); font-size: .7rem; line-height: 1.65; }
.setup-select-label { display: grid; gap: .4rem; color: var(--muted); font-size: .65rem; font-weight: 900; }
.setup-select-label select { width: 100%; border: 1px solid var(--line-strong); border-radius: 10px; padding: .75rem; color: var(--ink); background: white; font-size: .78rem; font-weight: 800; }
.prior-learning-fieldset { margin: 1rem 0; padding: 0; border: 0; }
.prior-learning-fieldset legend { margin-bottom: .45rem; color: var(--muted); font-size: .65rem; font-weight: 900; }
.prior-learning-fieldset label { display: flex; align-items: center; gap: .65rem; padding: .72rem; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.prior-learning-fieldset label + label { margin-top: .45rem; }
.prior-learning-fieldset input { accent-color: var(--indigo); }
.prior-learning-fieldset b, .prior-learning-fieldset small { display: block; }
.prior-learning-fieldset b { font-size: .72rem; }
.prior-learning-fieldset small { margin-top: .18rem; color: var(--muted); font-size: .59rem; font-weight: 600; }
.setup-preview { margin: 0 0 .85rem; padding: .7rem; border-left: 3px solid var(--cinnabar); border-radius: 4px 9px 9px 4px; color: var(--muted); background: var(--paper-deep); font-size: .65rem; line-height: 1.6; }

.flash-dialog { width: min(94vw, 560px); max-height: calc(100dvh - 20px); overflow: auto; }
.flash-shell { position: relative; padding: 1.55rem; }
.flash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; padding-right: 2.4rem; }
.flash-head h2 { margin: 0; font-size: 1.15rem; }
.flash-head > strong { color: var(--indigo); font: 800 .72rem "Cascadia Code", monospace; }
.flash-progress-track { height: 5px; margin: .85rem 0; overflow: hidden; border-radius: 999px; background: var(--paper-deep); }
.flash-progress-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--cinnabar); transition: width .25s ease; }
.flash-reward-strip { display: flex; justify-content: center; gap: .45rem; margin: -.25rem 0 .55rem; }
.flash-reward-strip span { padding: .22rem .45rem; border-radius: 999px; color: var(--muted); background: var(--paper-deep); font-size: .52rem; font-weight: 800; }
.flash-reward-strip b { color: var(--indigo); }
.flash-star-track { display: grid; grid-template-columns: repeat(15, 1fr); gap: 3px; margin: 0 0 .65rem; }
.flash-star-track i { height: 4px; border-radius: 999px; background: var(--line); transition: background .2s ease, transform .2s ease; }
.flash-star-track i.is-lit { background: var(--gold); transform: scaleY(1.65); }
.flash-star-track i.is-strong { background: var(--leaf); }
.flash-star-track i.is-tried { background: rgba(217,79,56,.35); }
.flash-card { min-height: 300px; display: grid; place-items: center; align-content: center; gap: .7rem; padding: 1.2rem; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(145deg, #eef3f2, #fbfcfb); text-align: center; }
.flash-card > span { border-radius: 999px; padding: .25rem .55rem; color: var(--indigo); background: white; font-size: .55rem; font-weight: 900; }
.flash-card > strong { font-family: "Yu Mincho", serif; font-size: 5.4rem; line-height: 1; }
.flash-card > strong.is-word { max-width: 100%; font-size: clamp(1.2rem, 4vw, 2.2rem); line-height: 1.5; }
.flash-card > p { margin: 0; color: var(--muted); font-size: .72rem; line-height: 1.65; }
.quick-recall-cue { width: min(100%, 330px); display: grid; gap: .35rem; color: var(--indigo); font-size: .6rem; font-weight: 900; }
.quick-recall-cue[hidden] { display: none; }
.quick-recall-cue i { height: 6px; overflow: hidden; border-radius: 999px; background: var(--line); }
.quick-recall-cue i::after { content: ""; display: block; width: 100%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gold), var(--cinnabar)); transform-origin: left; animation: quick-recall 1.5s linear both; }
.quick-recall-cue.is-revealed i::after { animation: none; transform: scaleX(1); }
@keyframes quick-recall { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.flash-writing-area { width: 100%; padding-top: .7rem; border-top: 1px dashed var(--line-strong); }
.flash-writing-area[hidden] { display: none; }
.flash-writing-area > p { margin: 0 0 .55rem; color: var(--ink); font-size: .62rem; font-weight: 900; }
.flash-writing-pads { display: flex; justify-content: center; flex-wrap: wrap; gap: .45rem; }
.flash-write-cell { position: relative; width: min(19vw, 88px); min-width: 66px; }
.flash-write-pad { display: block; width: 100%; aspect-ratio: 1; border: 2px solid var(--line-strong); border-radius: 9px; color: #d9e0dd; background: white; touch-action: none; cursor: crosshair; }
.flash-write-grid { fill: none; stroke: currentColor; stroke-width: .4; stroke-dasharray: 2 2; }
.flash-write-reference { fill: none; stroke: var(--leaf); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; opacity: 0; pointer-events: none; }
.flash-write-cell.is-judged .flash-write-reference { opacity: .15; }
.flash-write-user { fill: none; stroke: var(--ink); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.flash-write-user polyline.is-current { stroke: var(--cinnabar); }
.flash-write-cell > small { display: block; margin-top: .2rem; color: var(--muted); font-size: .48rem; }
.flash-write-score { position: absolute; right: -4px; top: -5px; min-width: 32px; padding: .18rem .25rem; border-radius: 999px; color: white; background: var(--cinnabar); font: 900 .54rem "Cascadia Code", monospace; opacity: 0; transform: scale(.8); }
.flash-write-cell.is-judged .flash-write-score { opacity: 1; transform: scale(1); }
.flash-write-cell.is-pass .flash-write-score { background: var(--leaf); }
.flash-writing-clear, .flash-writing-judge { margin-top: .55rem; border-radius: 8px; padding: .48rem .65rem; cursor: pointer; font-size: .56rem; font-weight: 900; }
.flash-writing-clear { border: 1px solid var(--line-strong); color: var(--muted); background: white; }
.flash-writing-judge { border: 1px solid var(--ink); color: white; background: var(--ink); }
.flash-writing-area output { display: block; margin-top: .45rem; color: var(--muted); font-size: .55rem; line-height: 1.5; }
.flash-answer { width: 100%; display: grid; gap: .38rem; margin-top: .2rem; }
.flash-answer[hidden] { display: none; }
.flash-answer p { display: grid; grid-template-columns: auto 1fr; gap: .55rem; align-items: baseline; margin: 0; padding: .45rem .55rem; border-radius: 9px; background: white; text-align: left; }
.flash-answer b { font-family: "Yu Mincho", serif; font-size: .88rem; }
.flash-answer span { color: var(--indigo); font-size: .6rem; font-weight: 900; }
.flash-answer small { grid-column: 1 / -1; color: var(--muted); font-size: .57rem; line-height: 1.5; }
.flash-dialog .primary-button { margin-top: .7rem; }
.flash-dialog #revealFlashAnswer[hidden] { display: none; }
.flash-grade { display: grid; grid-template-columns: repeat(3, 1fr); gap: .45rem; margin-top: .7rem; }
.flash-grade[hidden] { display: none; }
.flash-grade p { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: .62rem; text-align: center; }
.flash-grade button { border: 1px solid var(--line-strong); border-radius: 10px; padding: .55rem .3rem; background: white; cursor: pointer; }
.flash-grade button:hover { border-color: var(--indigo); }
.flash-grade b, .flash-grade small { display: block; }
.flash-grade b { font-size: .68rem; }
.flash-grade small { margin-top: .15rem; color: var(--muted); font-size: .5rem; }
.flash-grade .flash-auto-next { grid-column: 1 / -1; color: white; border-color: var(--ink); background: var(--ink); font-size: .65rem; font-weight: 900; }
.flash-grade .flash-auto-next[hidden] { display: none; }

@media (max-width: 1120px) {
  .main-layout { grid-template-columns: 230px minmax(0,1fr); }
  .study-rail { padding-inline: .9rem; }
  .learning-grid { grid-template-columns: 1fr; }
  .dojo-card { display: grid; grid-template-columns: minmax(300px,.9fr) minmax(300px,1.1fr); }
  .dojo-card .panel-header, .dojo-card .target-line { grid-column: 1 / -1; }
  .dojo-card .pad-workbench { grid-column: 1; grid-row: 3 / span 4; align-self: center; }
  .dojo-card .pad-workbench { grid-template-columns: 88px minmax(0,1fr); gap: .5rem; padding-inline: .75rem; }
  .dojo-card .model-pad-wrap > small { display: none; }
  .dojo-card .recall-gate, .dojo-card .guide-switches, .dojo-card .feedback, .dojo-card .pad-actions { grid-column: 2; align-self: center; }
  .dojo-card .recall-gate { grid-row: 3; margin-left: 0; }
  .dojo-card .guide-switches { padding-top: 2rem; }
  .dojo-card .pad-actions { grid-template-columns: 1fr 1fr; padding-left: 0; }
  .dojo-card .pad-actions .primary-button { grid-column: 1 / -1; }
  .review-hub { grid-template-columns: 1fr auto; }
  .review-hub-actions { grid-column: 1 / -1; }
}

@media (max-width: 800px) {
  .site-header { height: 66px; }
  .main-layout { display: block; }
  .study-rail { border-right: 0; border-bottom: 1px solid var(--line); padding-bottom: 1rem; }
  .progress-card, .grade-filter { display: none; }
  .mode-nav { grid-template-columns: repeat(4, 1fr); border: 0; padding-bottom: .75rem; }
  .mode-button { grid-template-columns: 1fr; place-items: center; text-align: center; gap: .22rem; padding: .5rem .2rem; }
  .mode-button > span { width: 25px; height: 25px; }
  .mode-button small { display: none; }
  .mode-button #reviewModeMeta { display: block; font-size: .48rem; }
  .cycle-settings { padding: .75rem 0; }
  .cycle-body { grid-template-columns: 1.2fr repeat(4, 1fr); align-items: end; }
  .cycle-status { align-self: stretch; }
  .setup-button { grid-column: 1 / -1; }
  .daily-list { padding: .75rem 0 0; }
  .daily-list .section-heading { display: none; }
  .kanji-queue { grid-template-columns: repeat(6, 1fr); max-height: 230px; overflow: auto; }
  .kanji-pick { font-size: 1.35rem; }
  .study-area { padding-top: 1rem; }
  .review-hub { grid-template-columns: 1fr; }
  .review-hub-actions { grid-column: auto; }
  .dojo-card { display: block; }
  .dojo-card .recall-gate { margin-left: 1.35rem; }
  .dojo-card .pad-actions { display: grid; grid-template-columns: auto auto 1fr; padding-left: 1.35rem; }
  .dojo-card .pad-actions .primary-button { grid-column: auto; }
  .source-note { align-items: flex-start; }
}

@media (max-width: 560px) {
  .brand small, .offline-badge { display: none; }
  .brand > span:last-child { display: none; }
  .site-header { padding-inline: .85rem; }
  .profile-switcher label { display: none; }
  .profile-switcher select { max-width: 92px; border-left: 0; }
  .profile-switcher button { padding-inline: .4rem; }
  .study-rail { padding: .65rem .8rem .85rem; }
  .mode-button { font-size: .66rem; }
  .cycle-body { grid-template-columns: 1fr 1fr; }
  .cycle-status { grid-column: 1 / -1; }
  .study-area { padding-inline: .7rem; }
  .learning-grid, .panel, .dojo-card, .knowledge-card { width: 100%; min-width: 0; max-width: 100%; }
  .search-row { gap: .5rem; }
  .search-box kbd { display: none; }
  .session-score { display: none; }
  .review-hub { padding: .85rem; border-left-width: 5px; }
  .review-schedule { width: 100%; }
  .review-schedule span { min-width: 0; padding-inline: .18rem; }
  .review-hub-actions { grid-template-columns: 1fr; }
  .learning-grid { gap: .75rem; }
  .panel { border-radius: 16px; }
  .panel-header, .target-line, .tab-panel { padding-inline: .9rem; }
  .target-line { grid-template-columns: 58px 1fr; }
  .target-kanji { font-size: 2.9rem; }
  .pad-workbench { grid-template-columns: 110px minmax(0,1fr); gap: .62rem; padding-inline: .9rem; }
  .pad-wrap { width: 100%; }
  .model-pad-wrap > small { display: none; }
  .feedback { margin-inline: .9rem; }
  .recall-gate { grid-template-columns: 38px 1fr; margin-inline: .9rem; padding: .7rem; }
  .recall-symbol { width: 36px; height: 36px; font-size: 1.05rem; }
  .recall-actions { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; }
  .confidence-row { grid-column: 1 / -1; }
  .recall-answer-words { grid-template-columns: 1fr; }
  .knowledge-tools { gap: .35rem; }
  .flash-test-button { padding-inline: .52rem; }
  .flash-shell { padding: 1.15rem; }
  .flash-card { min-height: 270px; }
  .flash-card > strong { font-size: 4.7rem; }
  .flash-card > strong.is-word { font-size: 1.35rem; }
  .pad-actions { padding-inline: .9rem; grid-template-columns: 1fr 1fr !important; }
  .pad-actions .primary-button { grid-column: 1 / -1 !important; }
  .tab-list { padding-inline: .9rem; }
  .constellation { min-height: 265px; }
  .word-node { min-width: 65px; padding-inline: .42rem; font-size: .64rem; }
  .reading-groups { grid-template-columns: 1fr; }
  .rubric { grid-template-columns: 1fr; }
  .source-note { display: block; line-height: 1.6; }
  .source-note button { margin-top: .5rem; }
  dialog form { padding: 1.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
