* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: #f7f2ec; color: #2b2118; }
.app-shell { max-width: 920px; margin: 0 auto; padding: 20px; }
.topbar { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 16px; }
.topbar h1 { margin: 6px 0 4px; font-size: 2rem; }
.brand-link { text-decoration: none; display: inline-block; }
.brand { color: #df7a2e; font-weight: 700; letter-spacing: .02em; }
.badge { background: #fff0e1; color: #a94f0e; border-radius: 999px; padding: 4px 10px; font-size: .9rem; vertical-align: middle; }
.muted { color: #78685d; margin: 0; }
.card { background: #fffdfb; border: 1px solid #eddccf; border-radius: 20px; padding: 18px; box-shadow: 0 8px 26px rgba(77, 49, 27, 0.07); }
.goal-card, .mission-card, .challenge-card, .trainer, .filters, .stats, .stats-page { margin-bottom: 16px; }
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.grid.secondary { margin-top: 12px; }
label span { display: block; font-size: .92rem; margin-bottom: 6px; color: #5c4a3f; }
select, input[type="number"], input[type="text"], input[type="search"] { width: 100%; padding: 12px 14px; border-radius: 14px; border: 1px solid #d9c5b4; background: #fff; font-size: 1rem; }
.stats { display: grid; gap: 12px; }
.stat span { display: block; color: #78685d; margin-bottom: 8px; }
.stat strong { font-size: 1.8rem; }
.goal-head { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 12px; }
.goal-title { font-size: 1.1rem; font-weight: 700; }
.goal-subtitle { color: #78685d; font-size: .92rem; }
.goal-controls { display: flex; align-items: center; gap: 10px; }
.goal-controls input { width: 92px; }
.goal-progress-row { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; color: #6f4728; font-weight: 600; }
.goal-bar { width: 100%; height: 14px; background: #f1e3d6; border-radius: 999px; overflow: hidden; }
.goal-bar-fill { width: 0%; height: 100%; background: linear-gradient(90deg, #df7a2e, #f1a766); transition: width .25s ease; }
@media (prefers-reduced-motion: reduce) {
  .goal-bar-fill { transition: none; }
}
.goal-success { margin-top: 12px; border-radius: 14px; padding: 12px 14px; background: #ecf8ef; color: #1f6a34; font-weight: 700; }
.feature-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 14px; }
.feature-head h2 { margin: 0 0 6px; font-size: 1.15rem; }
.feature-head button { flex-shrink: 0; }
.feature-note { margin: 10px 0 0; color: #78685d; font-size: .9rem; line-height: 1.45; }
.mission-card { border-color: #e9be93; background: #fffaf5; }
.challenge-card { border-color: #d9d0ee; background: #fbf9ff; }
.text-btn { border: 0; background: transparent; color: #7f4d28; padding: 4px 0; text-decoration: underline; cursor: pointer; font-size: .95rem; }
.insight-block { border-top: 1px solid #eddccf; margin-top: 22px; padding-top: 18px; }
.insight-block h3 { font-size: 1.05rem; margin: 0 0 12px; }
.mastery-overview, .weekly-summary, .milestone-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.mastery-item, .weekly-item, .milestone-item { background: #fcf6ef; border-radius: 14px; padding: 12px; min-width: 0; }
.mastery-item strong, .weekly-item strong { display: block; font-size: 1.35rem; margin-top: 5px; }
.mastery-item span, .weekly-item span { color: #5c4a3f; font-size: .88rem; }
.milestone-item { border: 1px solid #eddccf; }
.milestone-item.achieved { background: #ecf8ef; border-color: #b3d9bb; }
.milestone-item.locked { color: #78685d; }
.milestone-item strong, .milestone-item span { display: block; }
.milestone-item span { font-size: .84rem; margin-top: 5px; }
.weekly-chart { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); align-items: end; gap: 8px; min-height: 130px; margin-top: 16px; }
.weekly-day { text-align: center; font-size: .8rem; color: #5c4a3f; }
.weekly-bar-track { display: flex; align-items: end; height: 90px; background: #f1e3d6; border-radius: 8px 8px 3px 3px; overflow: hidden; }
.weekly-bar-fill { width: 100%; min-height: 0; background: #df7a2e; border-radius: 8px 8px 3px 3px; }
.weekly-day strong { display: block; margin: 4px 0; }
.backup-card { margin-bottom: 16px; }
.backup-card h2 { margin: 0 0 8px; font-size: 1.1rem; }
.backup-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.import-preview { margin-top: 14px; padding: 14px; border-radius: 14px; background: #fcf6ef; border: 1px solid #eddccf; }
.import-preview p { margin: 8px 0 0; line-height: 1.5; }
.backup-status { margin: 10px 0 0; color: #5c4a3f; }
.backup-status:empty { display: none; }
.backup-status.error { color: #9b3228; }
.hidden { display: none !important; }
.section-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 14px; }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.mini-card, .chapter-card { background: #fcf6ef; border-radius: 16px; padding: 14px; }
.mini-label { color: #78685d; font-size: .92rem; margin-bottom: 6px; }
.mini-value { font-size: 1.6rem; font-weight: 700; }
.chapter-blocks { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.chapter-list { color: #5c4a3f; line-height: 1.5; }
.trainer-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.pill { display: inline-block; padding: 6px 10px; border-radius: 999px; background: #f7ede2; color: #7f4d28; font-size: .92rem; }
.streak-pill { background: #fff0e1; color: #a94f0e; font-weight: 700; }
.next-ruhm-hint { margin-left: .45em; font-size: .88em; font-weight: 500; opacity: .8; }
.trainer.answered .next-ruhm-hint { display: none; }
.character { font-size: clamp(5rem, 16vw, 8rem); text-align: center; line-height: 1.1; margin: 16px 0 14px; min-height: 1.2em; }
.font-system { font-family: "Hiragino Sans", "Noto Sans JP", "Yu Gothic", sans-serif; }
.font-mincho { font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif; }
.font-gothic { font-family: "Yu Gothic", "Hiragino Sans", "Noto Sans JP", sans-serif; }
.font-rounded { font-family: "Hiragino Maru Gothic ProN", "Arial Rounded MT Bold", "Noto Sans JP", sans-serif; }
.font-calligraphy { font-family: "Klee One", "Hiragino Mincho ProN", "Yu Mincho", serif; font-weight: 500; letter-spacing: .03em; transform: rotate(-2deg); }
.hint-row { display: flex; justify-content: center; margin-bottom: 12px; }
.elements-box { background: #fcf6ef; border: 1px solid #eddccf; border-radius: 16px; padding: 14px; margin-bottom: 14px; }
.elements-title { font-weight: 700; color: #7f4d28; margin-bottom: 6px; }
.elements-text { font-size: 1rem; color: #5c4a3f; }
.answer-form label { display: block; margin-bottom: 8px; font-weight: 600; }
.answer-form { margin-bottom: 14px; }
.primary-btn, .ghost-btn { border: 0; border-radius: 14px; padding: 12px 16px; font-size: 1rem; cursor: pointer; }
.primary-btn { background: #df7a2e; color: #fff; }
.ghost-btn { background: #f1e3d6; color: #6f4728; }
#actionBtn { margin-top: 10px; width: 100%; }
.result-box, .typo-box { border-radius: 16px; padding: 14px; margin: 14px 0; }
.result-box.ok { background: #ecf8ef; color: #1f6a34; }
.result-box.bad { background: #fff0ef; color: #9b3228; }
.typo-box { background: #fff3df; color: #8a5600; border: 1px solid #f0d3a2; }
.typo-title { font-weight: 700; margin-bottom: 6px; }
.details { display: grid; gap: 10px; background: #fcf6ef; border-radius: 16px; padding: 14px; margin-top: 14px; }
.actions { display: flex; gap: 10px; margin-top: 14px; }
.actions button { flex: 1; }
.status-banner { border-radius: 14px; padding: 12px 14px; margin-bottom: 16px; font-size: .95rem; }
.status-banner.info { background: #eef5ff; color: #214b84; }
.status-banner.ok { background: #ecf8ef; color: #1f6a34; }
.status-banner.warn { background: #fff3df; color: #8a5600; }
.empty-state { text-align: center; margin-bottom: 16px; }
code { background: #f5ede6; padding: 2px 6px; border-radius: 6px; }
@media (max-width: 760px) { .topbar, .goal-head, .feature-head { flex-direction: column; align-items: stretch; } .grid, .stats, .stats-grid, .mastery-overview, .weekly-summary, .milestone-list { grid-template-columns: 1fr 1fr; } .chapter-blocks { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .grid, .stats, .stats-grid { grid-template-columns: 1fr; } .actions, .goal-controls { flex-direction: column; } .weekly-chart { gap: 4px; } }


/* v24: Statistik pro Kanji nach der Auflösung */
.card-result-stats {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #eddccf;
  border-radius: 16px;
  background: #fffaf5;
}
.card-result-stats-title {
  margin-bottom: 10px;
  font-weight: 700;
  color: #6f4728;
}
.card-result-stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}
.card-result-stat {
  padding: 10px;
  border-radius: 12px;
  background: #fcf1e6;
  text-align: center;
}
.card-result-stat span {
  display: block;
  margin-bottom: 4px;
  color: #78685d;
  font-size: .84rem;
}
.card-result-stat strong {
  font-size: 1.18rem;
}
@media (max-width: 520px) {
  .card-result-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* v24.5: Den Trainer in den Mittelpunkt stellen */
.app-shell { max-width: 1180px; padding: clamp(16px, 3vw, 32px); }
.topbar { margin-bottom: 12px; }
.topbar h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
.status-banner.ok { padding: 8px 12px; font-size: .86rem; }
.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(270px, .9fr);
  grid-template-areas:
    "trainer sidebar"
    "filters sidebar";
  gap: 16px 20px;
  align-items: start;
  margin-bottom: 20px;
}
.workspace-grid > .trainer,
.workspace-grid > .empty-state { grid-area: trainer; }
.workspace-grid > .sidebar-stack { grid-area: sidebar; display: grid; gap: 16px; }
.workspace-grid > .filters { grid-area: filters; }
.workspace-grid > .card,
.workspace-grid > .filters,
.sidebar-stack > .card { margin-bottom: 0; }
.workspace-grid .feature-head,
.workspace-grid .goal-head { flex-direction: column; align-items: stretch; gap: 10px; }
.workspace-grid .feature-head button { width: 100%; }
.workspace-grid .feature-head h2 { margin: 0; }
.workspace-grid .goal-controls input { flex: 1; min-width: 0; width: auto; }
.workspace-grid .goal-controls button { white-space: nowrap; }
.trainer { padding: clamp(18px, 3vw, 28px); }
.trainer-meta { margin-bottom: 6px; }
.character { margin: 10px 0 8px; }
.answer-form { margin-bottom: 8px; }
.answer-form input { min-height: 50px; }
.primary-btn:hover:not(:disabled) { background: #bd621f; }
.ghost-btn:hover:not(:disabled) { background: #e6d2bf; }
button:disabled { opacity: .55; cursor: not-allowed; }
button:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid #a94f0e;
  outline-offset: 2px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.filters summary, .stats-page summary, .backup-card summary {
  cursor: pointer;
  font-weight: 700;
  color: #6f4728;
  font-size: 1.05rem;
  list-style-position: inside;
}
.filter-body, .stats-body, .backup-body { padding-top: 16px; }
.filter-reset { display: block; margin: 0 0 12px auto; }
.stats { gap: 10px; }
.stats .card { padding: 14px; border-radius: 16px; }
.stats .stat span { font-size: .84rem; line-height: 1.25; min-height: 2.5em; }
.stats .stat strong { font-size: clamp(1.25rem, 2vw, 1.65rem); }
.stats-page, .backup-card { margin-bottom: 16px; }
.backup-card { margin-bottom: 0; }

.answer-history-heading { margin: 16px 0 8px; color: #6f4728; font-weight: 700; }
.answer-history { max-height: 280px; overflow-y: auto; border-top: 1px solid #eddccf; }
.answer-history-row { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 9px 2px; border-bottom: 1px solid #eddccf; font-size: .9rem; }
.answer-history-result { font-weight: 700; }
.answer-history-row.correct .answer-history-result { color: #1f6a34; }
.answer-history-row.wrong .answer-history-result { color: #9b3228; }
.answer-history-value { white-space: pre-wrap; overflow-wrap: anywhere; }
.answer-history-date { color: #78685d; white-space: nowrap; font-size: .82rem; }
.search-label { display: block; color: #5c4a3f; font-weight: 600; margin-bottom: 8px; }
.card-search-results { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; color: #78685d; }
.card-search-result { border: 1px solid #d9c5b4; border-radius: 10px; background: #fff; color: #4d3b2e; padding: 8px 10px; cursor: pointer; text-align: left; }
.card-search-result:hover { background: #fff0e1; }
.selected-card-stats { margin-top: 16px; }
.selected-card-stats:empty { display: none; }
.selected-card-stats h4 { font-size: 1.05rem; margin: 0 0 10px; }
.selected-card-counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }

@media (max-width: 860px) {
  .workspace-grid { display: flex; flex-direction: column; align-items: stretch; }
  .workspace-grid > .sidebar-stack { display: contents; }
  .workspace-grid > .trainer, .workspace-grid > .empty-state { order: 0; }
  .workspace-grid > .filters { order: 1; }
  .workspace-grid .mission-card { order: 2; }
  .workspace-grid .goal-card { order: 3; }
  .workspace-grid .challenge-card { order: 4; }
  .workspace-grid .feature-head { flex-direction: row; align-items: center; }
  .workspace-grid .feature-head button { width: auto; }

}
@media (max-width: 520px) {
  .workspace-grid .feature-head { flex-direction: column; align-items: stretch; }
  .workspace-grid .feature-head button { width: 100%; }

  .stats .stat span { min-height: 0; }
  .goal-controls { flex-direction: row; }
  .backup-actions > button { flex: 1 1 100%; }
  .answer-history-row { grid-template-columns: 72px minmax(0, 1fr); gap: 4px 8px; }
  .answer-history-date { grid-column: 2; }
}

/* v24.7: Wochenquests, Lernhilfen und anpassbare Startseite */
.weekly-quests, .home-settings { margin-bottom: 16px; }
.weekly-quests .feature-head { margin-bottom: 10px; }
.weekly-quest-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.weekly-quest { background: #fcf6ef; border: 1px solid #eddccf; border-radius: 14px; padding: 12px; }
.weekly-quest.completed { background: #ecf8ef; border-color: #b3d9bb; }
.weekly-quest strong, .weekly-quest span { display: block; }
.weekly-quest span { color: #5c4a3f; margin: 5px 0 9px; font-size: .9rem; }
.weekly-quest .goal-bar { height: 9px; }
.home-settings summary { cursor: pointer; font-weight: 700; color: #6f4728; }
.home-settings-body { padding-top: 10px; }
.home-section-controls { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 14px; }
.home-section-controls label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.hint-row { gap: 10px; flex-wrap: wrap; }
.hint-box { white-space: pre-line; background: #eef5ff; color: #214b84; border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; line-height: 1.5; }
.confidence-box { background: #fcf6ef; border: 1px solid #eddccf; border-radius: 14px; padding: 14px; margin: 12px 0; }
.confidence-box .feature-note { margin-top: 4px; }
.confidence-actions { display: flex; gap: 10px; margin-top: 12px; }
.error-analysis { margin-top: 12px; line-height: 1.5; }
.error-analysis:empty { display: none; }
.error-analysis p { margin: 5px 0; overflow-wrap: anywhere; }
.error-overview { margin-bottom: 12px; }
.error-overview-row { padding: 8px 0; border-bottom: 1px solid #eddccf; overflow-wrap: anywhere; }
@media (max-width: 760px) { .weekly-quest-list { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .confidence-actions { flex-direction: column; } }

.selected-card-counts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 520px) { .selected-card-counts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.study-settings { border-top: 1px solid #eddccf; margin-top: 16px; padding-top: 14px; }
.study-settings strong { display: block; margin-bottom: 10px; }
.study-settings label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }

/* v24.8: Punkte, Lernkalender, dunkles Design und Handy-Fokus */
.scoreboard { display: grid; grid-template-columns: repeat(2, minmax(110px, 1fr)); gap: 10px; min-width: min(100%, 270px); }
.score-chip { background: #fffdfb; border: 1px solid #eddccf; border-radius: 14px; padding: 10px 14px; }
.score-chip span { display: block; color: #78685d; font-size: .82rem; }
.score-chip strong { display: block; font-size: 1.45rem; line-height: 1.2; margin-top: 3px; font-variant-numeric: tabular-nums; }
.ruhmes-title { display: block; margin-top: 5px; color: #70376f; font-size: .79rem; font-weight: 750; line-height: 1.25; overflow-wrap: anywhere; }
.ruhmes-title.unlocked { animation: ruhmes-title-unlock .6s ease-out both; }
.ruhmes-title-notice { display: block; min-height: 1.1em; margin-top: 2px; color: #8a4a20; font-size: .72rem; line-height: 1.2; }
.ruhmes-progress { height: 6px; margin-top: 8px; overflow: hidden; border-radius: 999px; background: #eee0d6; }
.ruhmes-progress > span { display: block; width: 0; height: 100%; border-radius: inherit; background: #b36ab1; transition: width .35s ease; }
.ruhmes-next { display: block; margin-top: 5px; color: #78685d; font-size: .72rem; line-height: 1.25; overflow-wrap: anywhere; }
body.theme-dark .ruhmes-title { color: #d9a5e3; }
body.theme-dark .ruhmes-title-notice { color: #ffbd82; }
body.theme-dark .ruhmes-progress { background: #514655; }
body.theme-dark .ruhmes-progress > span { background: #d9a5e3; }
body.theme-dark .ruhmes-next { color: #b9b1c1; }
@keyframes ruhmes-title-unlock { 0% { transform: scale(.96); opacity: .55; } 65% { transform: scale(1.04); opacity: 1; } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .ruhmes-title.unlocked { animation: none; } .ruhmes-progress > span { transition: none; } }
.ruhmes-path > summary { cursor: pointer; font-weight: 700; }
.ruhmes-path .feature-note { margin: 10px 0 14px; }
.ruhmes-path-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 8px; }
.ruhmes-path-item { display: grid; gap: 3px; padding: 10px 12px; border: 1px solid #eddccf; border-radius: 12px; background: #fffdfb; }
.ruhmes-path-item strong { font-size: .9rem; line-height: 1.3; }
.ruhmes-path-threshold, .ruhmes-path-status { font-size: .74rem; color: #78685d; }
.ruhmes-path-item.unlocked { border-color: #dcb7dc; background: #fcf4fc; }
.ruhmes-path-item.current { outline: 2px solid #b36ab1; outline-offset: -2px; }
.ruhmes-path-item.locked { opacity: .72; }
body.theme-dark .ruhmes-path-item { border-color: #514655; background: #2a2831; }
body.theme-dark .ruhmes-path-item.unlocked { border-color: #9a699e; background: #392b3e; }
body.theme-dark .ruhmes-path-item.current { outline-color: #d9a5e3; }
body.theme-dark .ruhmes-path-threshold, body.theme-dark .ruhmes-path-status { color: #b9b1c1; }
.score-delta { display: block; min-height: 1.1em; margin-top: 2px; font-size: .78rem; font-weight: 800; font-variant-numeric: tabular-nums; opacity: 0; }
.score-delta.positive { color: #1f6a34; }
.score-delta.negative { color: #9b3228; }
.score-delta.active { opacity: 1; animation: score-delta-appear .35s ease-out both; }
body.theme-dark .score-delta.positive { color: #92deb0; }
body.theme-dark .score-delta.negative { color: #ffaaa5; }
@keyframes score-delta-appear { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .score-delta.active { animation: none; } }
.mobile-score-wrap { display: flex; flex-direction: column; align-items: flex-end; min-width: 0; }
.mobile-score-wrap .score-delta { text-align: right; }
.mobile-study-bar { display: none; }
.study-settings .theme-setting { display: grid; gap: 5px; margin-top: 16px; max-width: 270px; }
.study-settings .theme-setting span { margin: 0; }
.calendar-card { margin-bottom: 16px; }
.calendar-head { display: flex; justify-content: space-between; align-items: start; gap: 14px; margin-bottom: 14px; }
.calendar-head h2 { margin: 0; font-size: 1.15rem; }
.calendar-head .feature-note { margin-top: 5px; }
.calendar-navigation { display: flex; align-items: center; justify-content: flex-end; gap: 8px; white-space: nowrap; }
.calendar-navigation strong { min-width: 130px; text-align: center; text-transform: capitalize; }
.calendar-navigation button { min-width: 44px; min-height: 44px; padding: 8px 10px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; max-width: 470px; }
.calendar-weekday { text-align: center; color: #78685d; font-size: .8rem; padding-bottom: 3px; }
.calendar-day, .calendar-blank { min-height: 44px; }
.calendar-day { border: 1px solid #e5d6c7; border-radius: 9px; background: #f8f3ed; color: #4d3b2e; cursor: pointer; font: inherit; font-size: .9rem; font-variant-numeric: tabular-nums; }
.calendar-day.activity-1 { background: #f8ddb9; }
.calendar-day.activity-2 { background: #f2b371; }
.calendar-day.activity-3 { background: #e4843c; color: #23160d; }
.calendar-day.activity-4 { background: #a94f0e; color: white; }
.calendar-day.selected { outline: 3px solid #6f4728; outline-offset: 1px; }
.calendar-day.today { font-weight: 800; }
.calendar-day:disabled { opacity: .35; cursor: default; }
.calendar-detail { margin: 14px 0 0; line-height: 1.4; color: #5c4a3f; }

body.theme-dark { background: #151a20; color: #eef2f7; color-scheme: dark; }
body.theme-dark .site-header, body.theme-dark .card, body.theme-dark .score-chip, body.theme-dark .streak-gif-box { background: #202731; border-color: #3b4652; box-shadow: none; }
body.theme-dark .mission-card { background: #2b281f; border-color: #705135; }
body.theme-dark .challenge-card { background: #292536; border-color: #5d5170; }
body.theme-dark .muted, body.theme-dark .feature-note, body.theme-dark .stat span, body.theme-dark .mini-label,
body.theme-dark .goal-subtitle, body.theme-dark .score-chip span, body.theme-dark .calendar-weekday,
body.theme-dark .calendar-detail, body.theme-dark label span, body.theme-dark .weekly-item span,
body.theme-dark .mastery-item span, body.theme-dark .weekly-day, body.theme-dark .answer-history-date { color: #adbac8; }
body.theme-dark .main-nav a { color: #d5dfeb; }
body.theme-dark .main-nav a.active, body.theme-dark .main-nav a:hover, body.theme-dark .logo-text { color: #ffaf6c; }
body.theme-dark .badge, body.theme-dark .pill, body.theme-dark .streak-pill { background: #463425; color: #ffbd82; }
body.theme-dark .primary-btn { background: #ffaf6c; color: #24170e; }
body.theme-dark .primary-btn:hover:not(:disabled) { background: #ffca99; }
body.theme-dark .ghost-btn, body.theme-dark .card-search-result { background: #344151; color: #eef2f7; border-color: #536274; }
body.theme-dark .ghost-btn:hover:not(:disabled), body.theme-dark .card-search-result:hover { background: #43556a; }
body.theme-dark select, body.theme-dark input[type="number"], body.theme-dark input[type="text"], body.theme-dark input[type="search"] { background: #18212b; color: #eef2f7; border-color: #667689; }
body.theme-dark .text-btn, body.theme-dark .filters summary, body.theme-dark .stats-page summary,
body.theme-dark .backup-card summary, body.theme-dark .home-settings summary, body.theme-dark .card-result-stats-title,
body.theme-dark .answer-history-heading, body.theme-dark .elements-title, body.theme-dark .media-toggle { color: #ffbd82; }
body.theme-dark .mastery-item, body.theme-dark .weekly-item, body.theme-dark .milestone-item,
body.theme-dark .mini-card, body.theme-dark .chapter-card, body.theme-dark .details,
body.theme-dark .elements-box, body.theme-dark .card-result-stats, body.theme-dark .card-result-stat,
body.theme-dark .weekly-quest, body.theme-dark .confidence-box, body.theme-dark .import-preview { background: #2a3440; border-color: #495767; }
body.theme-dark .milestone-item.achieved, body.theme-dark .weekly-quest.completed, body.theme-dark .goal-success { background: #203b31; border-color: #4a8b6b; color: #c5efd7; }
body.theme-dark .goal-bar, body.theme-dark .weekly-bar-track { background: #46505a; }
body.theme-dark .goal-bar-fill { background: linear-gradient(90deg, #ff9a4f, #ffd09e); }
body.theme-dark .weekly-bar-fill { background: #ffaf6c; }
body.theme-dark .result-box.ok, body.theme-dark .status-banner.ok { background: #203b31; color: #c5efd7; }
body.theme-dark .result-box.bad { background: #4a2b30; color: #ffd0d0; }
body.theme-dark .typo-box, body.theme-dark .status-banner.warn { background: #493a20; color: #ffe0a6; border-color: #8e6a34; }
body.theme-dark .status-banner.info, body.theme-dark .hint-box { background: #253a55; color: #d2e4ff; }
body.theme-dark .answer-history, body.theme-dark .answer-history-row, body.theme-dark .error-overview-row,
body.theme-dark .insight-block, body.theme-dark .study-settings { border-color: #495767; }
body.theme-dark .answer-history-row.correct .answer-history-result { color: #92deb0; }
body.theme-dark .answer-history-row.wrong .answer-history-result { color: #ffaaa5; }
body.theme-dark .calendar-day { background: #2d3743; color: #e6eef7; border-color: #536171; }
body.theme-dark .calendar-day.activity-1 { background: #51432f; }
body.theme-dark .calendar-day.activity-2 { background: #815535; }
body.theme-dark .calendar-day.activity-3 { background: #ad693b; }
body.theme-dark .calendar-day.activity-4 { background: #ed9b55; color: #24170e; }
body.theme-dark .calendar-day.selected { outline-color: #ffca99; }
body.theme-dark .streak-gif-close { background: #344151; color: #eef2f7; }
body.theme-dark .streak-gif-title { color: #ffbd82; }
body.theme-dark .streak-gif-subtitle { color: #d5dfeb; }

@media (max-width: 760px) {
  .scoreboard { width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mobile-study-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: sticky; top: 0; z-index: 30; padding: 9px 0; background: #f7f2ec; }
  .mobile-study-bar button { min-height: 48px; }
  .mobile-study-bar span { font-weight: 700; font-size: .9rem; text-align: right; }
  body.theme-dark .mobile-study-bar { background: #151a20; }
  .trainer .answer-form { position: sticky; bottom: 0; z-index: 10; padding: 12px; margin: 0 -12px 10px; border-radius: 14px; background: #fffdfb; box-shadow: 0 -5px 20px rgba(43, 33, 24, .09); }
body.theme-dark .trainer .answer-form { background: #202731; box-shadow: 0 -5px 20px rgba(0, 0, 0, .25); }
  .trainer .answer-form input, .trainer .answer-form button, .trainer .hint-row button { min-height: 48px; }
  body.mobile-study .site-header, body.mobile-study .topbar, body.mobile-study .workspace-grid > .sidebar-stack,
  body.mobile-study .workspace-grid > .filters, body.mobile-study .weekly-quests, body.mobile-study .home-settings,
  body.mobile-study .progress-overview, body.mobile-study .stats, body.mobile-study .stats-page, body.mobile-study .calendar-card, body.mobile-study .backup-card { display: none !important; }
  body.mobile-study .status-banner.ok { display: none; }
  body.mobile-study .workspace-grid { margin-bottom: 0; }
  body.mobile-study .trainer { padding: 16px; }
  body.mobile-study .character { margin: 6px 0; }
}
@media (max-width: 520px) {
  .calendar-head { flex-direction: column; }
  .calendar-navigation { width: 100%; justify-content: space-between; }
  .calendar-grid { gap: 4px; }
  .calendar-day, .calendar-blank { min-height: 44px; }
}
body.theme-dark .goal-progress-row, body.theme-dark .elements-text, body.theme-dark .chapter-list,
body.theme-dark .backup-status, body.theme-dark .search-label, body.theme-dark .card-search-results,
body.theme-dark .weekly-quest span, body.theme-dark .card-result-stat span { color: #c2ceda; }
body.theme-dark .milestone-item.locked { color: #aebaca; }
body.theme-dark .weekly-quest.completed span { color: #c5efd7; }
body.theme-dark .backup-status.error { color: #ffaaa5; }
body.theme-dark code { background: #344151; color: #eef2f7; }

/* v24.8.1: Kanji und Eingabe im sichtbaren Handybereich halten */
@media (max-width: 760px) {
  .trainer .character {
    position: sticky;
    top: 58px;
    z-index: 5;
    background: #fffdfb;
    border-radius: 12px;
  }
  body.theme-dark .trainer .character { background: #202731; }
  body.mobile-study { overflow: hidden; }
  body.mobile-study .app-shell {
    position: fixed;
    top: var(--focus-top, 0px);
    left: 0;
    right: 0;
    width: 100%;
    max-width: none;
    height: var(--focus-height, 100dvh);
    padding: 4px 10px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  body.mobile-study .mobile-study-bar {
    flex: none;
    position: relative;
    top: auto;
    padding: 0 0 4px;
  }
  body.mobile-study .workspace-grid {
    flex: 1 1 auto;
    min-height: 0;
    gap: 0;
  }
  body.mobile-study .trainer {
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 8px 12px;
  }
  body.mobile-study .study-stage {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
  }
  body.mobile-study .trainer-meta { order: 0; flex: none; flex-wrap: nowrap; overflow: hidden; margin: 0; gap: 4px; }
  body.mobile-study #typePill,
  body.mobile-study #chapterPill,
  body.mobile-study #masteryPill { display: none; }
  body.mobile-study .trainer-meta .pill { padding: 3px 8px; font-size: .8rem; white-space: nowrap; }
  body.mobile-study .character {
    order: 1;
    flex: 1 1 auto;
    min-height: 42px;
    position: static;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    font-size: clamp(3rem, calc(var(--focus-height, 100dvh) * .18), 6rem);
  }
  body.mobile-study .hint-row { order: 2; flex: none; gap: 4px; margin: 0; flex-wrap: nowrap; }
  body.mobile-study .hint-row button { flex: 1; min-height: 40px; padding: 6px 8px; font-size: .82rem; }
  body.mobile-study .hint-box,
  body.mobile-study .elements-box {
    flex: 0 1 auto;
    min-height: 0;
    max-height: 38px;
    overflow-y: auto;
    padding: 5px 8px;
    margin: 0;
    font-size: .82rem;
    line-height: 1.2;
  }
  body.mobile-study .hint-box { order: 3; }
  body.mobile-study .elements-box { order: 4; }
  body.mobile-study .elements-title { display: none; }
  body.mobile-study .result-box,
  body.mobile-study .typo-box {
    order: 5;
    flex: 0 1 auto;
    min-height: 0;
    max-height: 70px;
    overflow-y: auto;
    margin: 0;
    padding: 6px 8px;
    font-size: .9rem;
    line-height: 1.25;
  }
  body.mobile-study .confidence-box {
    order: 6;
    flex: 0 1 auto;
    min-height: 0;
    max-height: 78px;
    overflow-y: auto;
    margin: 0;
    padding: 6px 8px;
    font-size: .85rem;
  }
  body.mobile-study .confidence-box .feature-note { display: none; }
  body.mobile-study .confidence-actions { margin-top: 4px; }
  body.mobile-study .confidence-actions button { min-height: 36px; padding: 4px 8px; font-size: .85rem; }
  body.mobile-study .answer-form {
    order: 7;
    flex: none;
    position: static;
    margin: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
  }
  body.mobile-study .answer-form label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  body.mobile-study .answer-form input,
  body.mobile-study .answer-form button { min-height: 44px; }
  body.mobile-study #actionBtn { margin-top: 4px; padding: 8px; }
  body.mobile-study .trainer.answered .hint-row,
  body.mobile-study .trainer.answered .hint-box,
  body.mobile-study .trainer.answered .elements-box { display: none !important; }
  body.mobile-study.focus-compact .mobile-study-bar span,
  body.mobile-study.focus-compact .trainer-meta { display: none; }
  body.mobile-study.focus-compact .character { min-height: 36px; font-size: clamp(2.5rem, calc(var(--focus-height, 100dvh) * .16), 4.5rem); }
  body.mobile-study.focus-compact .mobile-study-bar button,
  body.mobile-study.focus-compact .hint-row button,
  body.mobile-study.focus-compact .answer-form input,
  body.mobile-study.focus-compact .answer-form button { min-height: 38px; }
  body.mobile-study.focus-tiny .hint-row { display: none; }
}

/* v24.8.7: Apuan-Farben und markantere Bereiche rund um den Trainer */
body { background: #f7f6f5; color: #30262d; }
.topbar {
  position: relative;
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid #e77b39;
  border-radius: 22px;
  background: radial-gradient(circle at 78% -35%, rgba(255, 255, 255, .23) 0 140px, transparent 141px), #fb914e;
  box-shadow: 0 8px 24px rgba(96, 45, 32, .11);
  color: #301a2f;
}
.topbar-intro { min-width: 0; }
.topbar-kicker {
  margin: 0 0 5px;
  color: #55205e;
  font-size: .72rem;
  font-weight: 850;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.topbar h1 {
  margin: 0 0 5px;
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", sans-serif;
  font-size: clamp(1.75rem, 3.4vw, 2.6rem);
  font-weight: 900;
  letter-spacing: -.05em;
  line-height: 1.1;
  text-transform: uppercase;
}
.topbar .muted { color: #593b42; font-size: .84rem; }
.topbar .badge { display: inline-block; margin: 4px 0 0 5px; vertical-align: middle; background: #55205e; color: #fff5ee; font: 800 .72rem/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; letter-spacing: .05em; text-transform: none; }
.scoreboard { align-self: stretch; min-width: min(100%, 340px); }
.score-chip { border-color: rgba(48, 26, 47, .19); box-shadow: 0 3px 0 rgba(48, 26, 47, .10); }
.score-chip-total { background: #512459; color: #fff8f1; border-color: #512459; }
.score-chip-total > span, .score-chip-total .ruhmes-next { color: #f3d9ec; }
.score-chip-total .ruhmes-title { color: #ffd89b; }
.score-chip-total .ruhmes-title-notice { color: #ffe4bf; }
.score-chip-total .ruhmes-progress { background: #744c7a; }
.score-chip-total .ruhmes-progress > span { background: #ffae67; }
.score-chip:not(.score-chip-total) { background: #fff8f1; }
.mission-card, .goal-card, .challenge-card, .weekly-quests, .calendar-card, .stats-page { position: relative; overflow: hidden; }
.mission-card { border-color: #f1b07d; background: #fff7ef; border-top: 5px solid #f38a43; }
.goal-card { border-top: 5px solid #55205e; }
.challenge-card { border-color: #d6bddb; background: #fbf6fc; border-top: 5px solid #885095; }
.weekly-quests { border-top: 5px solid #f38a43; }
.calendar-card { border-top: 5px solid #885095; }
.feature-head h2, .calendar-head h2, .goal-title, .stats-page > summary, .ruhmes-path > summary, .insight-block h3 {
  color: #422448;
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", sans-serif;
  font-weight: 900;
  letter-spacing: .025em;
}
.feature-head h2, .calendar-head h2, .goal-title { text-transform: uppercase; }
.stats .card { border-bottom: 3px solid #f0a36d; }
.stats .stat strong { color: #55205e; font-variant-numeric: tabular-nums; }
.stats .stat span, .mini-label { letter-spacing: .035em; }
.weekly-quest { border-color: #edc9ae; background: #fff8f2; }
.weekly-quest.completed, .milestone-item.achieved { background: #fff0df; border-color: #edab70; color: #442034; }
.weekly-quest.completed strong, .milestone-item.achieved strong { color: #55205e; }
.milestone-item.achieved { border-left: 4px solid #f38a43; }
.milestone-item.locked { background: #f5f2f3; }
.ruhmes-path-item { border-color: #e6dce5; background: #f8f6f8; }
.ruhmes-path-item.unlocked { border-color: #e7b180; background: #fff1e2; }
.ruhmes-path-item.unlocked .ruhmes-path-status { color: #69314d; font-weight: 750; }
.ruhmes-path-item.current { outline: 2px solid #55205e; outline-offset: -2px; background: #f8e9f5; }
.ruhmes-path-item.current strong { color: #55205e; }
.goal-bar-fill { background: linear-gradient(90deg, #f3863c, #fcb372); }
.ruhmes-path .feature-note { max-width: 70ch; }

body.theme-dark { background: #17141b; color: #f4edf3; }
body.theme-dark .site-header { background: #39233e; border-color: #613568; }
body.theme-dark .topbar { background: radial-gradient(circle at 78% -35%, rgba(255, 255, 255, .08) 0 140px, transparent 141px), #65385b; border-color: #845176; color: #fff1e6; }
body.theme-dark .topbar-kicker, body.theme-dark .topbar .muted { color: #ffd2aa; }
body.theme-dark .topbar .badge { background: #ffb576; color: #39233e; }
body.theme-dark .score-chip-total { background: #47254e; border-color: #9a6b9d; }
body.theme-dark .score-chip-total > span, body.theme-dark .score-chip-total .ruhmes-next { color: #f1d5e9; }
body.theme-dark .score-chip-total .ruhmes-title { color: #ffd89b; }
body.theme-dark .score-chip-total .ruhmes-title-notice { color: #ffe4bf; }
body.theme-dark .score-chip-total .ruhmes-progress { background: #79567d; }
body.theme-dark .score-chip-total .ruhmes-progress > span { background: #ffb576; }
body.theme-dark .mission-card { background: #302820; border-color: #a76b41; }
body.theme-dark .goal-card { border-top-color: #bf85c5; }
body.theme-dark .challenge-card { background: #302535; border-color: #956c9d; }
body.theme-dark .weekly-quests { border-top-color: #f39a57; }
body.theme-dark .calendar-card { border-top-color: #b785c2; }
body.theme-dark .feature-head h2, body.theme-dark .calendar-head h2, body.theme-dark .goal-title,
body.theme-dark .stats-page > summary, body.theme-dark .ruhmes-path > summary, body.theme-dark .insight-block h3,
body.theme-dark .stats .stat strong { color: #f3c6ec; }
body.theme-dark .weekly-quest { background: #322a2b; border-color: #705349; }
body.theme-dark .weekly-quest.completed, body.theme-dark .milestone-item.achieved { background: #453022; border-color: #af7448; color: #ffe5cf; }
body.theme-dark .weekly-quest.completed strong, body.theme-dark .milestone-item.achieved strong { color: #ffd1a7; }
body.theme-dark .milestone-item.locked { background: #2a2930; }
body.theme-dark .ruhmes-path-item { background: #292630; border-color: #59455f; }
body.theme-dark .ruhmes-path-item.unlocked { background: #3a2d29; border-color: #9b6945; }
body.theme-dark .ruhmes-path-item.current { background: #442d4a; outline-color: #dda8de; }
body.theme-dark .ruhmes-path-item.current strong, body.theme-dark .ruhmes-path-item.unlocked .ruhmes-path-status { color: #ffd1a7; }

@media (max-width: 760px) {
  .topbar { padding: 18px; }
  .scoreboard { min-width: 0; }
  .mobile-study-bar { background: #f7f6f5; }
  body.theme-dark .mobile-study-bar { background: #17141b; }
}


/* Gemeinsame Seitenelemente, zuvor direkt in index.html */
.site-header {
  background: #fb914e;
  border-bottom: 1px solid #e67a37;
  box-shadow: 0 4px 14px rgba(77, 49, 27, 0.08);
}
.nav-container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.logo-wrap {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  min-width: 0;
}
.logo {
  height: 58px;
  width: auto;
  display: block;
}
.logo-text {
  color: #301a2f;
  font-weight: 800;
  letter-spacing: .02em;
  white-space: nowrap;
}
.main-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 14px;
}
.main-nav a {
  color: #301a2f;
  text-decoration: none;
  font-size: .96rem;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
}
.main-nav a:hover {
  color: #55205e;
}
.main-nav a.active {
  color: #55205e;
  font-weight: 700;
  border-bottom-color: #55205e;
}
@media (max-width: 900px) {
  .nav-container {
    flex-direction: column;
    align-items: stretch;
  }
  .main-nav {
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 4px;
  }
}
@media (max-width: 520px) {
  .logo {
    height: 52px;
  }
  .logo-text {
    font-size: .95rem;
  }
  .main-nav {
    gap: 6px 12px;
  }
  .main-nav a {
    font-size: .92rem;
  }
}

.streak-gif-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(43, 33, 24, 0.72);
  backdrop-filter: blur(2px);
}
.streak-gif-box {
  width: min(92vw, 420px);
  background: #fffdfb;
  border: 1px solid #eddccf;
  border-radius: 24px;
  box-shadow: 0 22px 60px rgba(43, 33, 24, 0.28);
  overflow: hidden;
  text-align: center;
  position: relative;
}
.streak-gif-close {
  position: absolute;
  top: 10px;
  right: 10px;
  border: 0;
  background: rgba(255,255,255,0.88);
  color: #5c4a3f;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  font-size: 1.15rem;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(43, 33, 24, 0.16);
}
.streak-gif-close:focus-visible {
  outline: 3px solid #a94f0e;
  outline-offset: 3px;
}
.streak-gif-image {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  background: linear-gradient(135deg, #fff0e1, #fcf6ef);
}
/* Show every part of an Apuan meme, including text near its edges. */
.streak-gif-overlay.meme-mode .streak-gif-box {
  width: min(94vw, 640px);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
}
.streak-gif-overlay.meme-mode .streak-gif-image {
  height: auto;
  max-height: min(70dvh, 700px);
  object-fit: contain;
}
.streak-gif-copy {
  padding: 18px 18px 20px;
}
.streak-gif-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: #a94f0e;
  margin-bottom: 6px;
}
.streak-gif-subtitle {
  color: #5c4a3f;
  line-height: 1.45;
}


.media-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  color: #6f4728;
  font-weight: 650;
  user-select: none;
}
.media-toggle input {
  width: 18px;
  height: 18px;
  accent-color: #df7a2e;
}


/* v24.8.8: Lernkarte zuerst, kompakter Kopf und gestaffelte Kennzahlen */
.site-menu-toggle { display: none; border: 1px solid #55205e; border-radius: 12px; background: #55205e; color: #fff8f1; padding: 9px 14px; min-height: 44px; font: 700 .9rem/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; cursor: pointer; }
.site-menu-toggle[hidden] { display: none; }
.site-menu-toggle:focus-visible { outline: 3px solid #301a2f; outline-offset: 3px; }
body.theme-dark .site-menu-toggle { border-color: #ffb576; background: #ffb576; color: #39233e; }

.trainer { border-color: #e9c9b3; box-shadow: 0 12px 32px rgba(77, 49, 27, .10); }
.trainer .character { color: #301a2f; }
body.theme-dark .trainer .character { color: #fff1e6; }
.card-review-details { margin-top: 14px; border: 1px solid #eddccf; border-radius: 14px; background: #fffaf5; }
.card-review-details > summary { cursor: pointer; padding: 12px 14px; color: #6f4728; font-weight: 750; }
.card-review-details[open] > summary { border-bottom: 1px solid #eddccf; }
.card-review-details .details { margin: 12px; }
.card-review-details .card-result-stats { margin: 12px; }
body.theme-dark .card-review-details { background: #2a2930; border-color: #59455f; }
body.theme-dark .card-review-details > summary { color: #ffd1a7; }
body.theme-dark .card-review-details[open] > summary { border-color: #59455f; }

.progress-overview { margin: 2px 0 16px; }
.progress-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.progress-heading h2 { margin: 0; color: #422448; font: 900 1.15rem/1.25 "Trebuchet MS", "Arial Rounded MT Bold", sans-serif; text-transform: uppercase; }
.progress-heading .feature-note { margin: 0; }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stats .stat-primary { grid-column: span 2; background: #fff8f1; border-bottom-color: #55205e; }
.stats .stat-primary strong { font-size: clamp(1.5rem, 2.5vw, 2rem); }
body.theme-dark .progress-heading h2 { color: #f3c6ec; }
body.theme-dark .stats .stat-primary { background: #302535; border-bottom-color: #bf85c5; }

@media (max-width: 760px) {
  .nav-container { flex-direction: row; align-items: center; flex-wrap: wrap; padding: 8px 14px; gap: 8px; }
  .logo { height: 38px; }
  .logo-text { font-size: .9rem; white-space: normal; line-height: 1.1; }
  .logo-wrap { flex: 1 1 auto; }
  .site-menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .site-header.nav-ready .main-nav { display: none; }
  .site-header.nav-ready.nav-open .main-nav { display: grid; flex: 1 0 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 10px; overflow: visible; white-space: normal; padding: 8px 0; }
  .site-header.nav-open .main-nav a { padding: 9px 6px; min-height: 40px; }
  .app-shell { padding: 12px; }
  .topbar { display: grid; gap: 10px; padding: 14px; margin-bottom: 8px; }
  .topbar h1 { font-size: clamp(1.35rem, 5vw, 1.8rem); margin-bottom: 0; }
  .topbar .badge { margin-top: 0; }
  .topbar-kicker, .topbar .muted { display: none; }
  .scoreboard { width: 100%; min-width: 0; }
  .score-chip { padding: 8px 10px; }
  .score-chip strong { font-size: 1.3rem; }
  .score-chip-total .ruhmes-next { display: none; }
  .ruhmes-progress { margin-top: 5px; }
  .status-banner.ok { display: none; }
  .mobile-study-bar { padding: 6px 0; }
  .mobile-study-bar button { min-height: 44px; padding: 9px 12px; }
  .workspace-grid { gap: 12px; }
  .trainer { padding: 16px; }
  .trainer .hint-row { flex-wrap: nowrap; gap: 6px; }
  .trainer .hint-row button { flex: 1 1 0; min-width: 0; padding: 8px 6px; font-size: .82rem; }
  .trainer.answered .hint-row, .trainer.answered .hint-box, .trainer.answered .elements-box { display: none !important; }
  .workspace-grid .mission-card { padding: 12px 14px; border-top-width: 3px; }
  .workspace-grid .mission-card .feature-head { flex-direction: row; align-items: center; gap: 10px; margin-bottom: 8px; }
  .workspace-grid .mission-card .feature-head h2 { font-size: .94rem; }
  .workspace-grid .mission-card .feature-head button { width: auto; max-width: 42%; min-height: 44px; padding: 8px 10px; font-size: .86rem; }
  .workspace-grid .mission-card .goal-bar { height: 8px; }
  .workspace-grid .mission-card .feature-note { margin-top: 5px; font-size: .8rem; }
  .progress-heading { flex-direction: column; align-items: flex-start; gap: 2px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats .stat-primary { grid-column: span 1; }
  .stats .stat-primary strong { font-size: 1.45rem; }
}
@media (max-width: 520px) {
  .logo-text { font-size: .78rem; }
  .topbar { gap: 8px; }
  .score-chip-total .ruhmes-title { font-size: .72rem; }
  .workspace-grid .mission-card .feature-head { align-items: flex-start; }
  .workspace-grid .mission-card .feature-head button { max-width: 44%; }
  .stats .card { padding: 12px; }
  .stats .stat span { font-size: .8rem; }
}

/* v24.8.9: feste Apuan-Tastatur in der mobilen Fokusansicht */
.apuan-keyboard { display: none; }
@media (max-width: 760px) {
  body.mobile-study .apuan-keyboard {
    order: 8;
    flex: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 2px;
    padding: 5px 4px 3px;
    border: 1px solid #e9c9b3;
    border-radius: 13px;
    background: #f8eee6;
  }
  body.mobile-study .apuan-keyboard-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: #55205e;
    font-size: .78rem;
    line-height: 1.2;
  }
  body.mobile-study .apuan-keyboard-head .text-btn {
    padding: 4px 2px;
    font-size: .78rem;
    font-weight: 750;
    text-decoration: none;
  }
  body.mobile-study .apuan-keyboard-keys { display: grid; gap: 3px; }
  body.mobile-study .apuan-keyboard-row { display: flex; gap: 3px; }
  body.mobile-study .apuan-symbol-row { display: none; }
  body.mobile-study .apuan-keyboard.symbols-open .apuan-letter-row { display: none; }
  body.mobile-study .apuan-keyboard.symbols-open .apuan-symbol-row { display: flex; }

  body.mobile-study .apuan-key {
    flex: 1 1 0;
    min-width: 0;
    height: clamp(42px, calc(var(--focus-height, 100dvh) * .075), 64px);
    padding: 0 2px;
    border: 1px solid #e3d1c3;
    border-bottom-width: 2px;
    border-radius: 7px;
    background: #fffdfb;
    color: #301a2f;
    font: 750 clamp(1rem, 4.2vw, 1.2rem)/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    touch-action: manipulation;
    user-select: none;
    cursor: pointer;
  }
  body.mobile-study .apuan-key:active { background: #f5d4bb; transform: translateY(1px); }
  body.mobile-study .apuan-key:disabled { opacity: .52; }
  body.mobile-study .apuan-key-delete { flex: 1.5 1 0; background: #ead8e9; }
  body.mobile-study .apuan-key-symbols { flex: 1.2 1 0; background: #ead8e9; font-size: .72rem; }
  body.mobile-study .apuan-key-space { flex: 2.4 1 0; font-size: .8rem; }
  body.mobile-study .apuan-key-action { flex: 2.8 1 0; background: #df7a2e; border-color: #bd621f; color: #fff; font-size: .88rem; }
  body.mobile-study .apuan-key-action:active { background: #bd621f; }
  body.mobile-study.apuan-keyboard-mode #actionBtn { display: none; }
  body.mobile-study.apuan-keyboard-mode .character { font-size: clamp(3rem, calc(var(--focus-height, 100dvh) * .17), 6.5rem); }
  body.mobile-study.system-keyboard-mode .apuan-keyboard { padding: 1px 4px; background: transparent; border: 0; }
  body.mobile-study.system-keyboard-mode .apuan-keyboard-head { justify-content: flex-end; }
  body.mobile-study.system-keyboard-mode .apuan-keyboard-head strong,
  body.mobile-study.system-keyboard-mode .apuan-keyboard-keys { display: none; }
  body.mobile-study.focus-keyboard-short.apuan-keyboard-mode .trainer-meta,
  body.mobile-study.focus-keyboard-short.apuan-keyboard-mode .hint-row { display: none; }
  body.mobile-study.focus-keyboard-short.apuan-keyboard-mode .apuan-keyboard-head strong { display: none; }
  body.mobile-study.focus-keyboard-short.apuan-keyboard-mode .apuan-key { height: clamp(29px, calc(var(--focus-height, 100dvh) * .075), 36px); }
  body.mobile-study.focus-keyboard-short.apuan-keyboard-mode .result-box,
  body.mobile-study.focus-keyboard-short.apuan-keyboard-mode .typo-box { max-height: 52px; }
  body.theme-dark.mobile-study .apuan-keyboard { background: #302535; border-color: #705576; }
  body.theme-dark.mobile-study .apuan-keyboard-head { color: #ffd1a7; }
  body.theme-dark.mobile-study .apuan-key { background: #3b3242; border-color: #6a5872; color: #fff1e6; }
  body.theme-dark.mobile-study .apuan-key:active { background: #5b4765; }
  body.theme-dark.mobile-study .apuan-key-delete,
  body.theme-dark.mobile-study .apuan-key-symbols { background: #51415b; }
  body.theme-dark.mobile-study .apuan-key-action { background: #ffaf6c; border-color: #d6894b; color: #24170e; }
  body.theme-dark.mobile-study.system-keyboard-mode .apuan-keyboard { background: transparent; border: 0; }
}

/* v24.8.11: Typografie aus dem Apuan-Universum */
body { font-family: "Kodchasan", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select, textarea { font-family: inherit; }
.topbar h1, .logo-text, .feature-head h2, .calendar-head h2,
.progress-heading h2, .insight-block h3, .goal-title, .section-title,
.stats-page > summary, .ruhmes-path > summary, .streak-gif-title,
h2, h3, h4 {
  font-family: "Bruno Ace SC", "Trebuchet MS", sans-serif;
  font-weight: 400;
  letter-spacing: .01em;
}
.topbar .badge, .site-menu-toggle { font-family: "Kodchasan", sans-serif; }
@media (max-width: 760px) {
  body.mobile-study .apuan-key { font-family: "Kodchasan", -apple-system, BlinkMacSystemFont, sans-serif; }
}
@media (max-width: 420px) {
  .nav-container { gap: 6px; }
  .logo-wrap { flex: 1 1 0; }
  .logo { height: 34px; }
  .logo-text { font-size: .72rem; line-height: 1.08; }
  .site-menu-toggle { padding: 8px 10px; }
}

/* Persönliche Rekorde, Ruhm-Bilanz und Verwechslungsduelle */
.personal-records { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.personal-records .mini-value { font-size: 1.15rem; }
.ruhm-breakdown-head, .ruhm-breakdown-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px 90px; gap: 8px; padding: 6px 0; }
.ruhm-breakdown-head { color: #78685d; font-size: .8rem; border-bottom: 1px solid #eddccf; }
.ruhm-breakdown-head span:not(:first-child), .ruhm-breakdown-row strong, .ruhm-breakdown-row span:last-child { text-align: right; }
.ruhm-breakdown-row { border-bottom: 1px solid #eddccf; font-size: .9rem; }
.ruhm-breakdown-row.total { font-weight: 700; border-bottom: 0; border-top: 2px solid #eddccf; }
.confusion-pairs { display: grid; gap: 8px; margin: 10px 0; }
.confusion-pair { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid #eddccf; border-radius: 12px; }
.confusion-pair .ghost-btn { flex: none; padding: 8px 10px; font-size: .84rem; }
.confusion-comparison { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 16px 0; }
.confusion-comparison-card { display: grid; gap: 4px; padding: 12px; border-radius: 12px; background: #fcf6ef; }
.confusion-comparison-card strong { font-size: 2.4rem; line-height: 1.2; }
body.theme-dark .confusion-pair { border-color: #495767; }
body.theme-dark .confusion-comparison-card { background: #2b3440; }
body.theme-dark .ruhm-breakdown-head, body.theme-dark .ruhm-breakdown-row { border-color: #495767; }
body.theme-dark .ruhm-breakdown-head { color: #c2ceda; }
@media (max-width: 520px) {
  .personal-records { grid-template-columns: 1fr; }
  .ruhm-breakdown-head, .ruhm-breakdown-row { grid-template-columns: minmax(0, 1fr) 64px 64px; }
}

/* v24.8.14: Schriftwahl an der Lernkarte und kurze Tastaturbeschriftungen */
.character-stage { position: relative; }
.kanji-font-control { position: absolute; z-index: 1; top: 0; right: 0; display: flex; flex-direction: column; gap: 2px; color: #6f4728; font-size: .7rem; font-weight: 700; }
.kanji-font-control select { max-width: 112px; min-height: 34px; padding: 4px 20px 4px 7px; border: 1px solid #e3d1c3; border-radius: 8px; background: #fffdfb; color: #301a2f; font-size: .76rem; }
body.theme-dark .kanji-font-control { color: #ffd1a7; }
body.theme-dark .kanji-font-control select { background: #3b3242; border-color: #6a5872; color: #fff1e6; }
@media (max-width: 760px) {
  body.mobile-study .character-stage { order: 1; flex: 1 1 auto; min-height: 42px; display: flex; }
  body.mobile-study .character-stage .character { flex: 1 1 auto; }
  body.mobile-study .kanji-font-control { top: 2px; right: 0; }
  body.mobile-study .kanji-font-control span { display: none; }
  body.mobile-study .kanji-font-control select { min-height: 32px; }
  body.mobile-study .apuan-key-space, body.mobile-study .apuan-key-action { white-space: nowrap; overflow: hidden; text-overflow: clip; }
}

/* v24.8.15: Beispielwörter nach der Antwort */
.example-words { border-top: 1px solid #ead6c7; padding-top: 10px; }
.example-words > strong { display: block; margin-bottom: 7px; color: #6f4728; }
.example-words ul { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 7px; }
.example-words li { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; }
.example-words li strong { font-family: "Hiragino Sans", "Noto Sans JP", sans-serif; font-size: 1.2rem; }
.example-words li span:last-child { color: #5c4a3f; }
.example-words small { color: #78685d; line-height: 1.35; }
.example-words a { color: #7a3b81; }
body.theme-dark .example-words { border-color: #59455f; }
body.theme-dark .example-words > strong, body.theme-dark .example-words li span:last-child, body.theme-dark .example-words small { color: #e7d5ce; }
body.theme-dark .example-words a { color: #efb9ef; }

/* v24.8.17: Beispielwort im Blickfeld der aufgelösten Karte */
@media (min-width: 761px) {
  .character-stage.has-example {
    display: grid;
    grid-template-columns: minmax(140px, 42%) minmax(0, 1fr);
    align-items: center;
    gap: 20px;
    padding: 44px 4px 12px;
  }
  .character-stage.has-example .character { min-width: 0; margin: 0; }
}
.character-stage .example-words {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid #ead6c7;
  border-radius: 14px;
  background: #fcf6ef;
}
.character-stage .example-words li strong { font-size: 1.45rem; }
.character-stage .example-words li span:last-child { flex-basis: 100%; }
.character-stage .example-words small { display: block; font-size: .68rem; }
body.theme-dark .character-stage .example-words { background: #2b3440; border-color: #59455f; }
@media (max-width: 760px) {
  .character-stage.has-example { display: flex; flex-direction: column; min-width: 0; }
  .character-stage.has-example .character { width: 100%; }
  .character-stage .example-words { width: 100%; padding: 7px 10px; }
  .character-stage .example-words > strong { margin-bottom: 2px; font-size: .8rem; }
  .character-stage .example-words ul { margin-bottom: 3px; gap: 2px; }
  .character-stage .example-words li { gap: 2px 6px; font-size: .83rem; line-height: 1.2; }
  .character-stage .example-words li strong { font-size: 1.15rem; }
  .character-stage .example-words small { font-size: .6rem; }
  body.mobile-study .character-stage.has-example { min-height: 0; }
  body.mobile-study .character-stage.has-example .character { min-height: 36px; }
  body.mobile-study .character-stage .example-words { flex: none; max-height: 100px; overflow-y: auto; }
  body.mobile-study.focus-compact .character-stage .example-words,
  body.mobile-study.focus-keyboard-short .character-stage .example-words { max-height: 72px; }
}

/* v24.8.18: eigenständiger Verbmodus */
.mode-switch { display: inline-flex; gap: 4px; margin-top: 10px; padding: 4px; border-radius: 999px; background: rgba(255,255,255,.19); }
.mode-switch a { display: inline-block; padding: 8px 14px; border-radius: 999px; color: inherit; text-decoration: none; font: 700 .9rem/1.2 "Kodchasan", sans-serif; }
.mode-switch a.active { background: #fff9f3; color: #8b410e; }
.mode-switch a:focus-visible { outline: 3px solid #df7a2e; outline-offset: 2px; }
.verb-page { font-family: "Kodchasan", sans-serif; }
.verb-page h1, .verb-page h2 { font-family: "Bruno Ace SC", sans-serif; }
.verb-page .topbar { align-items: center; }
.verb-page .mode-switch { align-self: center; }
.verb-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(260px, 1fr); gap: 16px; align-items: start; }
.verb-main, .verb-stats { min-width: 0; }
.verb-main h2, .verb-stats h2 { margin: 0 0 8px; font-size: 1.25rem; }
.verb-intro p { margin: 0 0 18px; line-height: 1.5; }
.verb-intro label { display: block; margin-bottom: 7px; }
.verb-intro select { max-width: 340px; }
.verb-primary { display: inline-block; margin-top: 14px; border: 0; border-radius: 14px; padding: 12px 18px; background: #df7a2e; color: #fff; font: 700 1rem/1.2 "Kodchasan", sans-serif; cursor: pointer; }
.verb-primary:disabled { opacity: .55; cursor: not-allowed; }
.verb-primary:focus-visible, .verb-option:focus-visible { outline: 3px solid #55205e; outline-offset: 2px; }
.verb-training, .verb-finish { margin-top: 22px; padding-top: 18px; border-top: 1px solid #ead6c7; }
.verb-topline { display: flex; align-items: center; gap: 12px; color: #6f4728; font-weight: 700; }
.verb-prompt { min-height: 145px; display: grid; place-items: center; margin: 14px 0; padding: 18px; border-radius: 18px; background: #fcf6ef; color: #301a2f; font-size: clamp(2rem, 7vw, 4rem); font-weight: 700; text-align: center; overflow-wrap: anywhere; }
.verb-prompt[lang="ja"] { font-family: "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif; }
.verb-input-form label { display: block; margin-bottom: 6px; }
.verb-input-form input { width: 100%; }
.verb-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.verb-option { min-height: 64px; border: 1px solid #e4cab4; border-radius: 14px; background: #fffaf5; color: #301a2f; font: 700 1.5rem/1.3 "Hiragino Sans", "Yu Gothic", sans-serif; cursor: pointer; }
.verb-option:disabled { cursor: default; }
.verb-option.correct { background: #e4f4e6; border-color: #6dad79; }
.verb-option.incorrect { background: #fff0ef; border-color: #d48078; }
.verb-result { margin-top: 16px; padding: 14px; border-radius: 14px; line-height: 1.45; }
.verb-result.ok { background: #eaf6ec; color: #205d31; }
.verb-result.bad { background: #fff0ef; color: #832b25; }
.verb-result p { margin: 7px 0 0; }
.verb-result p:nth-of-type(1) { font-weight: 700; font-size: 1.2rem; }
.verb-result p:nth-of-type(2) { font-family: "Hiragino Sans", "Yu Gothic", sans-serif; }
.verb-stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.verb-stats-grid div { padding: 12px; border-radius: 12px; background: #fcf6ef; }
.verb-stats-grid span, .verb-stats-grid strong { display: block; }
.verb-stats-grid span { font-size: .85rem; color: #5c4a3f; }
.verb-stats-grid strong { margin-top: 3px; font-size: 1.4rem; }
.verb-stats details { margin-top: 18px; }
.verb-stats summary { cursor: pointer; font-weight: 700; }
.verb-stats ol { padding-left: 22px; max-height: 320px; overflow-y: auto; line-height: 1.6; }
@media (max-width: 760px) {
  .verb-layout { grid-template-columns: 1fr; }
  .verb-page .topbar { display: block; }
  .verb-page .topbar .muted { display: block; }
  .verb-page .mode-switch { margin-top: 10px; }
  .verb-prompt { min-height: 118px; }
  .verb-option { min-height: 60px; }
}

.verb-backup { display: grid; gap: 7px; margin-top: 20px; padding-top: 16px; border-top: 1px solid #ead6c7; }
.verb-backup .ghost-btn { justify-self: start; }
.verb-backup label { margin-top: 5px; font-weight: 700; }
.verb-backup input { max-width: 100%; }
.verb-backup small { color: #6b5b50; }

body.theme-dark.verb-page .mode-switch a.active { background: #fff1e6; color: #39233e; }
body.theme-dark.verb-page .verb-training, body.theme-dark.verb-page .verb-backup { border-color: #59455f; }
body.theme-dark.verb-page .verb-prompt, body.theme-dark.verb-page .verb-stats-grid div { background: #302535; color: #fff1e6; }
body.theme-dark.verb-page .verb-stats-grid span, body.theme-dark.verb-page .verb-backup small { color: #e7d5ce; }
body.theme-dark.verb-page .verb-option { background: #3b3242; color: #fff1e6; border-color: #6a5872; }
body.theme-dark.verb-page .verb-option.correct { background: #244a32; border-color: #72c28b; }
body.theme-dark.verb-page .verb-option.incorrect { background: #653036; border-color: #d48078; }
body.theme-dark.verb-page .verb-result.ok { background: #244a32; color: #e1f6e6; }
body.theme-dark.verb-page .verb-result.bad { background: #653036; color: #ffe4e2; }

/* v24.8.19: Verb-Auswahl */
.verb-intro select + label { margin-top: 14px; }

.verb-topic { display: block; margin-top: 4px; font-size: .9rem; opacity: .8; }

/* v24.8.20: optionaler Apuan-Kontostatus ohne Änderung am Lernstand */
.apuan-account { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; width: fit-content; max-width: 100%; margin-top: 12px; padding: 9px 11px; border: 1px solid rgba(48,26,47,.2); border-radius: 13px; background: rgba(255,249,243,.7); }
.apuan-account-copy { display: grid; gap: 2px; min-width: 0; }
.apuan-account strong { font-size: .83rem; line-height: 1.25; }
.apuan-account small { font-size: .75rem; line-height: 1.3; overflow-wrap: anywhere; }
.apuan-account a { color: #55205e; font-size: .78rem; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.apuan-account a:focus-visible { outline: 3px solid #55205e; outline-offset: 3px; }
body.theme-dark .apuan-account { border-color: rgba(255,244,230,.35); background: rgba(48,26,47,.25); }
body.theme-dark .apuan-account a { color: #fff1e6; }
@media (max-width: 760px) { .apuan-account { margin-top: 8px; padding: 7px 9px; } }
.cloud-backup { margin-top: 18px; padding-top: 16px; border-top: 1px solid #ead6c7; }
.cloud-backup > strong { display: block; margin-bottom: 6px; }
.cloud-backup .muted { margin: 0 0 11px; }
.cloud-backup .backup-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.cloud-backup .backup-status { margin: 10px 0 0; overflow-wrap: anywhere; }
body.theme-dark .cloud-backup { border-color: #59455f; }

.cloud-backup .backup-actions [hidden] { display: none; }
