/* KanjiDou: papel claro ou verde profundo, mantendo o mesmo ritmo visual. */
:root {
  color-scheme: light;
  --writing-ink: #284d41;
  --writing-grid: #e5e7dc;
  --writing-diagonal: #eef0e7;
  --writing-model: #e5e9dc;
  --writing-demo: #b9c9ab;
  --writing-next: #bcc9ad;
  --writing-hint: #dca477;
  --writing-start: #7f9c6d;
  --writing-error: #c37856;
}
.theme-icon-sun { display: none; }
:root[data-theme="dark"] .theme-icon-moon { display: none; }
:root[data-theme="dark"] .theme-icon-sun { display: block; }
.theme-toggle { flex-shrink: 0; }
.appearance-settings { padding: 18px; background: var(--green-light); border-radius: 16px; margin: 22px 0; }
.appearance-settings h3 { font-size: 13px; margin: 0 0 12px; }
.theme-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.theme-choice { border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--muted); padding: 11px 5px; min-height: 44px; font-size: 12px; }
.theme-choice[aria-pressed="true"] { background: var(--white); border-color: var(--line); color: var(--ink); box-shadow: 0 2px 5px #00000008; }
.appearance-settings p { color: var(--muted); font-size: 11px; margin: 12px 0 0; line-height: 1.6; }
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #121c18;
  --white: #1b2822;
  --ink: #e3ece1;
  --muted: #a4b4a7;
  --green: #abd0b1;
  --green-light: #283e31;
  --orange: #dfaa88;
  --orange-light: #49382e;
  --line: #34483b;
  --writing-ink: #e3ece1;
  --writing-grid: #3b5142;
  --writing-diagonal: #2c3e32;
  --writing-model: #344b3c;
  --writing-demo: #759977;
  --writing-next: #88ad88;
  --writing-hint: #dfaa88;
  --writing-start: #bdd4a5;
  --writing-error: #e9a188;
}
:root[data-theme="dark"] .sidebar { background: #17231d; border-color: var(--line); }
:root[data-theme="dark"] .topbar { background: #121c18ed; border-color: var(--line); }
:root[data-theme="dark"] .mobile-nav { background: #17231df5; border-color: var(--line); }
:root[data-theme="dark"] :is(.nav-link, .mobile-nav a, .mobile-nav button) { color: var(--muted); }
:root[data-theme="dark"] :is(.nav-link.active, .mobile-nav .active) { color: #d2e7ca; background: #2c4434; box-shadow: inset 0 0 0 1px #3c5742; }
:root[data-theme="dark"] .nav-link:not(.active):hover { background: #22362a; }
:root[data-theme="dark"] :is(.brand-signature, .brand-signature strong, .footer-brand strong, .quiet-stats strong, .quiet-stats a) { color: #bacfba; }
:root[data-theme="dark"] :is(.nav-group-label, .topbar-caption, .connection, .eyebrow, .mobile-brand small, .lesson-top, .lesson-card small, .quiet-stats, .goal-ring small, .goal-ring strong span, .study-card p, .learning-steps, .action-meta, .action-content>span:last-child, .more-signature) { color: var(--muted); }
:root[data-theme="dark"] :is(.icon-button, .secondary, .tabs, .pill, .action-icon, .learning-steps li span, .level-badge, .review-emblem, .stroke-counter, .practice-mode-switch) { background: var(--green-light); color: var(--green); }
:root[data-theme="dark"] .icon-button:hover { background: #36513d; }
:root[data-theme="dark"] .primary { background: #abcda7; color: #152719; }
:root[data-theme="dark"] .primary:hover { background: #c0ddb8; }
:root[data-theme="dark"] .secondary:hover { background: #35503c; }
:root[data-theme="dark"] :is(.study-action, .study-card, .progress-goal, .memory-section, .filter-select, .kanji-info, .writing-card, .goal-ring>div) { background: var(--white); border-color: var(--line); }
:root[data-theme="dark"] :is(.today-goal, .lesson-card, .path-card, .activity-card, .course-summary, dialog, .memory-stat) { border-color: var(--line); box-shadow: none; }
:root[data-theme="dark"] .lesson-card:hover { background: #24372b; border-color: #769276; }
:root[data-theme="dark"] .learn-action { background: #284d3c; color: #eaf3e7; border-color: #3e674c; }
:root[data-theme="dark"] .learn-action .action-icon { background: #ffffff12; color: #d4e6c9; }
:root[data-theme="dark"] .learn-action :is(.action-meta, .action-content>span:last-child) { color: #c0d3bf; }
:root[data-theme="dark"] .goal-ring { background: conic-gradient(var(--green) var(--goal-progress), #304735 0); }
:root[data-theme="dark"] :is(.progress-line, .daily-goal) { background: #304735; }
:root[data-theme="dark"] .path-card.current { border-color: #8eaf86; }
:root[data-theme="dark"] .path-card.current .level-badge { background: #abcda7; color: #152719; }
:root[data-theme="dark"] :is(.form-field input, .form-field select, .more-menu a, .more-menu button) { background: #203228; color: var(--ink); border-color: var(--line); }
:root[data-theme="dark"] input::placeholder { color: #a4b4a7; opacity: 1; }
:root[data-theme="dark"] dialog::backdrop { background: #060c09b3; }
:root[data-theme="dark"] :is(.component, .memory-kanji) { background: #22372a; border-color: var(--line); }
:root[data-theme="dark"] .component.main { background: #304b36; border-color: #58784e; }
:root[data-theme="dark"] :is(.info-section h3, .component-role, .example .example-credit, ruby rt, .practice-kind, .canvas-status) { color: var(--muted); }
:root[data-theme="dark"] .canvas-wrap { background: #142219; border-color: #496045; }
:root[data-theme="dark"] .canvas-complete { background: #abcda7; color: #152719; }
:root[data-theme="dark"] :is(.writing-feedback.error, .rating-button.again) { color: #e9a188; }
:root[data-theme="dark"] .rating-button.good { border-color: #63815a; }
:root[data-theme="dark"] .danger-button { background: #49312a; color: #f0b7a0; }
:root[data-theme="dark"] .toast { background: #abcda7; color: #152719; }
:root[data-theme="dark"] .toast.error { background: #864b38; color: #fff3e9; }
:root[data-theme="dark"] :is(.memory-stat>small, .studied-total>div>small, .progress-goal p, .path-goal>small, .annual-total, .year-card .calendar-guide, .activity-weekdays, .activity-months, .year-card #activity-day-detail, .memory-description, .memory-kanji small, .memory-explanation, .memory-empty) { color: var(--muted); }
:root[data-theme="dark"] :is(.memory-stat.internalized strong, .memory-stat.recent strong, .memory-stat.unseen strong) { color: #bad4ab; }
:root[data-theme="dark"] .memory-stat.selected { background: #2b432f; border-color: #83a874; box-shadow: inset 0 0 0 1px #638753; }
:root[data-theme="dark"] .memory-stat:hover { background: #2b432f; }
:root[data-theme="dark"] .memory-grid.internalized .memory-kanji { background: #314f34; border-color: #5c7b4f; color: #d5eac6; }
:root[data-theme="dark"] .memory-grid.recent .memory-kanji { background: #263e29; color: #c1d7af; }
:root[data-theme="dark"] .memory-grid.unseen .memory-kanji { background: #202e24; color: #a3b69a; }
:root[data-theme="dark"] .memory-kanji:hover { background: #375339; border-color: #83a874; }
:root[data-theme="dark"] :is(.annual-calendar .activity-day, .activity-legend i) { background: #2c3d2e; }
:root[data-theme="dark"] .annual-calendar .activity-day[data-count="1"] { background: #4a6c40; }
:root[data-theme="dark"] .annual-calendar .activity-day[data-count="2"] { background: #799c65; }
:root[data-theme="dark"] :is(.annual-calendar .activity-day[data-count="3"], .activity-legend i:last-child) { background: #b1cb93; }
:root[data-theme="dark"] .annual-calendar .activity-day[aria-pressed="true"] { outline-color: #c6deb0; }
:root[data-theme="dark"] .memory-empty { border-color: var(--line); }
@media(max-width:650px) {
  .topbar-right { gap: 9px; }
  .theme-toggle { width: 36px; height: 36px; }
}
