/* Shared stationery palette. Existing variable aliases keep every screen in sync. */
:root {
  --ui-font:'Noto Sans JP','Yu Gothic',sans-serif;
  --page-gutter:40px;
  --ink:#401c3d;
  --purple: #a975d3;
  --purple-dark: #8e5bb4;
  --purple-line:#c29bdd;
  --purple-soft:#f1e6fc;
  --pink:#ffdae8;
  --pink-line:#ec9fc2;
  --yellow: #fde9a9;
  --paper:#fffcf7;
  --line:#e3d2ed;
  --muted:#786577;
  --green:var(--purple);
  --accent:var(--purple-line);
  --white:#fff;
  --red:#aa405c;
  font-family:var(--ui-font);
}
body { background:var(--paper);font-size:14px;line-height:1.8; }
h1,h2,h3,.serif { font-family:var(--ui-font);font-weight:800;letter-spacing:.015em; }
h1 { font-size:28px;line-height:1.5;text-align:center; }
h2 { font-size:22px; }
button,input,select,textarea { font-family:inherit; }
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,summary:focus-visible {
  outline:3px solid var(--purple-dark);outline-offset:3px;
}
button:disabled { cursor:default; }
.main { padding-right:var(--page-gutter);padding-left:var(--page-gutter);max-width:1360px; }
.eyebrow { display:none; }
.page-heading { padding:28px 0 24px;align-items:center;flex-direction:column;gap:15px; }
.page-heading>div { flex:none;width:100%;min-width:0; }
.page-heading h1 { display:block;padding:5px 0 7px;background:transparent;border-radius:0; }
.muted,.quiz-note { color:var(--muted); }
.card,.modal { border:1.5px solid var(--line);border-radius:20px;background:var(--white); }
.card { padding:25px; }
.btn { border:1.5px solid var(--line);border-radius:12px;font-size:13px;font-weight:700;min-height:44px;padding:10px 18px;color:var(--ink); }
.btn:hover { background:var(--purple-soft);transform:none;border-color:var(--purple-line); }
.btn.primary { background:var(--purple);border-color:var(--purple);color:#fff;box-shadow:0 3px 0 var(--purple-dark); }
.btn.primary:hover {background: #a059cb;border-color:#8244a8;}
.btn.primary:active { box-shadow:0 1px 0 var(--purple-dark);transform:translateY(2px); }
.btn.soft { background:var(--purple-soft);border-color:var(--purple-line); }
.btn.danger { background:#fff5f7;border-color:#e4a6ba;color:#9c354e; }
.btn.danger:hover { background:#ffe6ed; }
.btn.small { min-height:44px;font-size:12px; }
.btn.large { min-height:56px;font-size:17px; }
.field { gap:8px;font-size:13px;font-weight:500; }
.field input,.field select,.field textarea,.search { border:1.5px solid var(--line);border-radius:11px;background:#fff;min-height:46px; }
.field input[type=checkbox] { min-height:18px; }
input[type=checkbox],input[type=radio] { accent-color:var(--purple); }
.check { font-size:13px;min-height:44px; }
.tag { background:var(--purple-soft);color:var(--purple-dark);border-radius:7px;padding:4px 9px; }
.tag.warm { background:#fff1b6;color:#785219; }
.tag.gray { background:#f1ecf3;color:var(--muted); }
.notice { background:#fff7d8;border-color:#ead895;color:#725125;border-radius:13px; }
.error { background:#fff0f4;border-color:#e7adc0;color:#9c354e;border-radius:12px; }
.divider,.footer { border-color:var(--line); }
.footer { color:var(--muted);font-size:11px; }
#toast { background:var(--purple-dark);border-radius:14px;box-shadow:0 5px 20px #401c3d1a; }
.link { color:var(--purple-dark); }
.tabs { gap:8px; }
.tabs .btn.active { background:var(--purple);border-color:var(--purple);color:white; }
.pagination { gap:12px; }

/* Navigation: the same four illustrations are used at both breakpoints. */
.sidebar { background:#fffafc;border-color:var(--line); }
.brand-mark { background:transparent;border-radius:0;object-fit:contain;flex-shrink:0; }
.brand-name { font-family:var(--ui-font);color:var(--ink);font-weight:800; }
.brand-mini { color:var(--purple-dark); }
.welcome .welcome-title { margin-top:28px;font-size:clamp(22px,3vw,30px);line-height:1.7;letter-spacing:0; }
.welcome-title span { display:inline-block; }
.welcome .welcome-subtitle { margin:14px 0 24px;font-size:clamp(13px,1.6vw,16px);font-weight:700;line-height:1.8; }
.brand small,.nav-label,.side-note { color:var(--muted); }
.nav button { color:var(--ink);font-weight:700;border-radius:14px; }
.nav button.active { background:#eee0fb;color:var(--ink); }
.nav button:hover { background:#f5ecfc; }
.nav .ui-icon { color:var(--ink);width:26px;height:26px; }

/* The child and level controls stay unboxed; only Settings has a button outline. */
.child-header { background:#f6effc;border:0;border-bottom:1px solid var(--line);min-height:88px;margin-inline:calc(-1 * var(--page-gutter));padding:14px var(--page-gutter);gap:14px; }
.child-selection-controls { max-width:610px;gap:18px; }
.child-picker { max-width:340px;gap:10px; }
.child-picker-icon { width:46px;height:46px;padding:0;border:1px solid var(--line);border-radius:12px;background:#fff;font-size:27px; }
.child-picker select { font-family:var(--ui-font);font-size:20px;font-weight:800;color:var(--ink);background:transparent; }
.picker-chevron { color:var(--ink); }
.header-level { gap:8px;padding:4px 0;border-radius:0; }
.header-level:hover { background:transparent; }
.header-level-label { color:var(--ink);font-size:11px;font-weight:700;line-height:1.35; }
.header-level strong { font-family:var(--ui-font);font-size:34px;font-weight:800;color:var(--ink); }
.child-settings.btn { flex-direction:column;border:0;border-radius:8px;background:transparent;min-width:56px;min-height:48px;padding:4px 8px;gap:3px;font-size:12px;line-height:1.3; }
.child-settings.btn:hover { background:transparent;border-color:transparent; }
.child-settings .ui-icon { width:19px;height:19px; }

/* Home: a CSS ring binding, with small decorative SVG stationery. */
.child-home { max-width:640px;margin:24px auto 40px; }
.child-home h1 { display:table;margin:0 auto 30px;padding:7px 0 9px;background:transparent;border-radius:0;font-size:28px; }
.home-practice {position:relative;margin-top:0;padding:48px 28px 24px;border:2px solid var(--purple-line);border-radius:23px;background:linear-gradient(to bottom,#faf4ff 0 25px,#fff 25px);box-shadow: 0 6px 0 #e3d2ed;}
.notebook-binding { display:flex;justify-content:space-between;position:absolute;left:28px;right:28px;top:-19px;height:38px;pointer-events:none; }
.notebook-binding>span { position:relative;width:22px;height:38px; }
/* Punched holes sit in the paper; the open oval wire curls down into each hole. */
.notebook-binding>span:before { content:'';position:absolute;bottom:0;left:2px;width:12px;height:12px;border:1px solid #d8c2e7;border-radius:50%;background:#806093;box-shadow:inset 0 2px 2px #583c6b33,0 1px 0 #fff; }
.notebook-binding>span:after {content:'';position:absolute;top: 7px;left: -2px;width: 18px;height: 18px;border:4px solid #b88bd1;border-right-color:#d5b6e8;border-bottom-color:transparent;border-radius:50%;transform: rotate(-50deg);/* box-shadow:-1px 0 0 #f4e8fc; */}
.home-practice>.home-instruction { font-size:18px;font-weight:800;color:var(--ink);margin:0 0 10px; }
.home-stationery-row { display:flex;align-items:center;justify-content:space-between;gap:14px;max-width:460px;margin:0 auto 14px; }
.stationery-art { display:block;width:100px;height:110px;flex-shrink:0; }
.practice-count { display:flex;flex-direction:column;align-items:center;justify-content:center;min-width:126px;min-height:48px;padding:7px 16px;background:var(--yellow);border-radius:999px;color:var(--ink);font-size:21px;font-weight:800;line-height:1.5;white-space:nowrap; }
.practice-count small { font-size:11px;font-weight:700; }
.home-practice .actions { margin-top:10px; }
.home-practice .btn.primary { position:relative;min-height:64px;border-radius:20px;font-size:21px;padding:12px 34px 12px 22px;box-shadow:0 5px 0 var(--purple-dark); }
.home-button-arrow {position:absolute;right:16px;top:50%;transform: translateY(-58%);font-size:32px;line-height:1;}
.home-practice .home-review {display:inline-flex;justify-content:center;width:auto;max-width:100%;margin-top:17px;padding: 5px 5px;border:0;border-bottom:2px solid var(--purple-line);border-radius:0;min-height: 36px;font-size:15px;color:var(--purple-dark);background:transparent;}
.home-review:hover { color:var(--ink);background:transparent; }
.home-week {position:relative;border:2px solid var(--pink-line);border-radius:21px;background: #fffcf7;margin-top:44px;padding:30px 20px 14px;}
.home-week h2 {position:absolute;left:50%;top:-21px;transform:translateX(-50%);width:max-content;max-width:95%;padding:5px 20px 7px;background: #fffcf7;font-size:20px;font-weight:800;color: #de5589;}
.home-week .week-days { gap:8px;margin-top:0; }
.home-week .day-label { color:var(--ink);font-size:16px;font-weight:800; }
.home-week .day-dot {width:40px;height:40px;border: 2px solid var(--pink-line);color:var(--muted);font-size:13px;margin:8px auto 0;}
.home-week .day-dot.done {background:#de5589;border-color:#de5589;color:white;font-size:23px;font-weight:800;}
.home-week .day-dot.current {box-shadow:0 0 0 3px #ffe88e;border-color: var(--pink-line);}

/* Study, quiz, forms and management share the same surface and type scale. */
.stat-icon { background:var(--purple-soft);color:var(--purple-dark);border-radius:12px; }
.progress-track { background:#f1e5f9; }
.progress-fill { background:#b384d2; }
.spot-level { border-color:var(--line); }
.spot-level.has-progress { background:var(--purple-soft);border-color:var(--purple-line); }
.spot-level strong { font-family:var(--ui-font);font-weight:800; }
.spot-learning { border-color:var(--pink-line); }
.quiz { margin:24px auto; }
.quiz .card { border:2px solid var(--purple-line);border-radius:22px;margin-top:22px; }
.quiz-writing-card>.quiz-instruction { color:var(--muted);font-size:14px; }
.quiz-toolbar>.btn { border-radius:16px; }
.quiz-toolbar>.wrong { background:#fff0f4;color:#9c354e;border-color:#e4a6ba; }
.quiz-writing-body,.question,.answer-kanji,.catalog-character,.record-character,td.character { font-family:'Noto Serif JP',serif; }
.writing-target { text-decoration-color:var(--purple-line); }
.inline-assess { color:var(--ink);border-bottom-color:var(--purple-line); }
.inline-assess:hover { background:var(--purple-soft); }
.inline-assess.wrong { background:#fff0f4;border-bottom-color:#d77b9c; }
.inline-mark { color:#b73f62; }
.score-circle { border-color:var(--purple-line);background:#faf6fe;color:var(--purple-dark);font-family:var(--ui-font);font-weight:800; }
.score-stats strong { color:var(--purple-dark); }
.result-characters .result-kanji { background:var(--purple-soft);border-color:var(--purple-line);color:var(--purple-dark); }
.result-characters .result-kanji:hover { background:#e8d5f8; }
.coverage-summary { background:#fff5cc;padding:14px 18px;border-radius:13px;gap:12px 22px; }
.review-row { border-color:var(--line); }
.review-row .q-char { color:var(--purple-dark); }
#assessment-preview { background:#faf5ff;border-color:var(--line);border-radius:12px; }
.kanji-option { background:#fff;border-radius:11px; }
.kanji-option:has(input:checked) { background:var(--purple-soft);border-color:var(--purple);color:var(--purple-dark); }
.range-selection-summary { background:#faf5ff;border-color:var(--line); }
.range-selected-character { background:var(--purple-soft);border-color:var(--purple-line);color:var(--purple-dark); }
.range-selected-character:hover { background:#e7d4f6; }
.range-manual summary { color:var(--purple-dark); }
.icon-picker .icon-radio label { border-radius:12px; }
.icon-picker .icon-radio label:has(input:checked) { background:var(--purple-soft);border-color:var(--purple); }
.icon-picker .icon-radio label:focus-within { outline-color:var(--purple-dark); }
.learner-icon { background:var(--pink);border-radius:50%; }
.practice-sheet { background:#fffdf8; }
.sheet-top { color:var(--muted);border-color:var(--line); }
.sheet-grid span { color:var(--purple-dark);border-color:var(--purple-line);background:#faf5ff; }
.pencil { background:#a3c572;box-shadow:3px 0 #c4df9a inset; }
.stamp { background:var(--yellow);color:var(--ink); }
.range-bulk-message { color:var(--purple-dark); }
.range-bulk-message.is-error { color:var(--red); }
.modal-backdrop { background:#32152b66; }
.modal { padding:28px;box-shadow:0 18px 60px #401c3d24; }
.modal h2 { font-size:22px; }
.modal .actions { gap:10px; }
.settings-menu-heading { display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:20px; }
.settings-menu-heading h2 { margin:0; }
.settings-menu-close.btn { flex-shrink:0;min-width:44px;min-height:44px;padding:0;border:0;background:transparent;font-size:30px;line-height:1; }
.settings-menu-close.btn:hover { background:var(--purple-soft); }
table th { color:var(--muted);font-weight:700; }
table td { border-color:var(--line); }
.kanji-history-table thead { background:#fcf7ff; }
.record-character { color:var(--ink);border-color:var(--line);border-radius:10px; }
.record-character:hover { background:var(--purple-soft); }
.history-level-filter select { background:#fff; }

/* Semantic status colors are shared by the level grid, history and popup. */
.legend-item.mastered,.child-catalog .catalog-kanji.mastered { background:#eaf6e9;color:#356241;border-color:#b7d7b5; }
.legend-item.learning,.child-catalog .catalog-kanji.learning { background:#f1e8fc;color:#6e3c8c;border-color:#d1b3e4; }
.legend-item.weak,.child-catalog .catalog-kanji.weak { background:#fff0e6;color:#994a31;border-color:#eabca8; }
.legend-item.unseen,.child-catalog .catalog-kanji.unseen { background:#fff;color:#7a697b;border-color:var(--line); }
button.legend-item[aria-pressed=true] { outline-color:var(--purple-dark); }
button.legend-item:hover { box-shadow:0 0 0 2px #c29bdd66; }
.child-catalog .catalog-kanji.selected { outline-color:var(--purple-dark); }
.level-option.active { background:var(--purple-soft);border-color:var(--purple); }
.level-option.active>span { color:var(--purple-dark); }
.catalog-level-heading { top:88px;border-color:var(--line); }
.level-change-note { background:#fff6d5;color:#765525; }
.kanji-example-list li { background:#f7f0fc; }
.kanji-example-list strong { color:var(--ink); }
.kanji-okurigana-detail { background:#fff5cf; }
.kanji-detail-counts>span:last-child b { color:#aa405c; }
.kanji-readings { color:var(--purple-dark); }
.history-day-stats>div { background:#f7f0fc; }
.calendar-day { background:#fff; }
.calendar-day.has-study { background:#f4e8fc;border-color:#d6b8e8; }
.calendar-day.is-today { box-shadow:inset 0 0 0 2px #f4b9d1; }
.calendar-day:hover { border-color:var(--purple); }
.calendar-day[aria-pressed=true] { background:var(--purple);border-color:var(--purple);color:#fff; }
.calendar-day[aria-pressed=true].is-today { box-shadow:inset 0 0 0 2px #f6d78a; }
.history-month-heading h2 { font-weight:800; }

@media(max-width:760px) {
  :root { --page-gutter:18px; }
  .main { padding:0 var(--page-gutter) calc(104px + env(safe-area-inset-bottom)); }
  .sidebar { background:#fffdfd;border-top:2px solid var(--purple-line);height:calc(78px + env(safe-area-inset-bottom));padding:5px 8px calc(5px + env(safe-area-inset-bottom));backdrop-filter:none; }
  .nav { gap:5px; }
  .nav button { min-height:62px;padding:4px 2px;gap:3px;font-size:11px;border-radius:17px; }
  .nav .ui-icon { width:27px;height:27px; }
  .child-header { min-height:76px;padding:10px var(--page-gutter);gap:10px; }
  .child-selection-controls { gap:10px; }
  .child-picker { gap:8px; }
  .child-picker-icon { font-size:25px; }
  .child-picker select { font-size:17px;padding-left:0; }
  .header-level { gap:6px;padding:3px 0;min-height:48px; }
  .header-level-label { font-size:10px; }
  .header-level strong { font-size:30px; }
  .child-settings.btn { min-width:48px;min-height:48px;padding:4px 6px;font-size:11px;gap:3px; }
  .child-settings .ui-icon { width:17px;height:17px; }
  .page-heading { padding:22px 0 20px;gap:15px; }
  .page-heading h1 { font-size:24px;padding:6px 0 8px; }
  .card { padding:21px 18px; }
  .child-home { margin:22px auto 28px; }
  .child-home h1 { font-size:25px;padding:7px 0 9px;margin-bottom:29px; }
  .home-practice { padding:42px 14px 22px;border-radius:21px; }
  .notebook-binding { left:19px;right:19px; }
  .home-practice>.home-instruction {font-size: 18px;line-height:1.8;white-space:normal;margin-bottom:6px;border-bottom: 3px dotted #deb4f2;display: inline-block;}
  .home-stationery-row { gap:5px;margin-bottom:10px; }
  .stationery-art { width:74px;height:87px; }
  .practice-count { min-width:112px;min-height:43px;padding:6px 12px;font-size:18px; }
  .practice-count small { font-size:10px; }
  .home-practice .btn.primary {min-height:58px;font-size: 24px;padding: 12px 22px 12px 13px;border-radius: 100px;}
  .home-button-arrow {right: 16px;font-size: 38px;}
  .home-practice .home-review {margin-top:13px;font-size: 15px;gap:6px;}
  .home-week {margin-top:37px;padding: 22px 12px 15px;border-radius:20px;}
  .home-week h2 { top:-19px;font-size:17px;padding:5px 17px 7px; }
  .home-week .week-days { gap:3px; }
  .home-week .day-label { font-size:14px; }
  .home-week .day-dot { width:31px;height:31px;font-size:10px;margin-top:7px; }
  .home-week .day-dot.done {font-size: 16px;}
  .quiz .card { padding:28px 18px;min-height:330px;margin-top:22px; }
  .quiz-writing-card>.quiz-instruction { font-size:13px; }
  .quiz-writing-body { font-size:28px; }
  .quiz-toolbar>.btn { font-size:16px; }
  .modal { padding:23px 20px;border-radius:19px;max-height:calc(100dvh - 28px); }
  .modal h2 { font-size:20px; }
  .modal-backdrop { padding:14px; }
  .catalog-level-heading { top:76px; }
  .child-catalog .catalog-kanji { border-radius:13px; }
  .child-catalog .page-heading { padding:22px 0 20px; }
  .history-day-stats { gap:7px; }
  .history-day-stats>div { padding:13px 7px; }
  .history-day-heading h2 { font-size:17px; }
  .coverage-summary { padding:12px;gap:8px 14px;font-size:11px; }
  .filter-row .field { min-width:100%; }
  .review-row .review-text { min-width:0; }
  .footer { font-size:10px; }
}
@media(max-width:350px) {
  :root { --page-gutter:13px; }
  .child-picker-icon { font-size:22px; }
  .child-picker { gap:5px; }
  .child-selection-controls { gap:7px; }
  .child-picker select { font-size:15px; }
  .header-level strong { font-size:27px; }
  .header-level { gap:4px; }
  .child-settings.btn { min-width:44px;padding:4px; }
  .stationery-art { width:63px;height:78px; }
  .practice-count { min-width:99px;font-size:17px;padding:6px 9px; }
  .home-practice .btn.primary { font-size:15px; }
  .home-week .day-dot { width:28px;height:28px; }
  .nav button { font-size:10px; }
}
