:root {
  --bg: #fff6f9;
  --surface: #ffffff;
  --text: #3b2f36;
  --muted: #a3929b;
  --line: #f7e8ee;
  --line-strong: #f0d6e0;
  --accent: #f06a9b;
  --accent-strong: #e04f86;
  --accent-soft: #fde6ef;
  --warn-bg: #fff3d4;
  --warn-text: #8a6100;
  --bad-bg: #ffe4e4;
  --bad-text: #c23a3a;
  --ok-bg: #dff5e9;
  --ok-text: #24764c;
  --subject: #a3929b;
  --subject-soft: #f6eff2;
  --radius: 24px;
  --radius-small: 16px;
  --shadow-small: 0 4px 16px rgba(240, 106, 155, 0.08);
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Nunito", ui-rounded, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }

h1 { font-size: 30px; line-height: 1.15; font-weight: 800; letter-spacing: -0.01em; }
h2 { font-size: 18px; font-weight: 800; }
h3 { font-size: 17px; font-weight: 800; }

small { display: block; font-size: 13px; font-weight: 600; color: var(--muted); }

button, input, select, textarea { font: inherit; color: inherit; }

.app {
  max-width: 520px;
  margin: 0 auto;
  padding: 44px 20px 140px;
}

.view-enter { animation: view-in 360ms var(--ease); }

@keyframes view-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.muted { color: var(--muted); font-weight: 600; }

.eyebrow { font-size: 14px; font-weight: 800; color: var(--accent); margin-bottom: 2px; }

.page-header { margin-bottom: 24px; }
.page-header-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }

.dot {
  display: inline-block;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--subject);
}

.section { margin-top: 30px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head .muted { font-size: 14px; }
.section-hint { margin: -6px 0 12px; font-size: 13px; color: var(--muted); }

/* ---------- Begrüßung ---------- */

.hello { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.hello-actions { flex: none; display: flex; gap: 8px; }
.hello-gear { flex: none; display: grid; place-items: center; color: var(--muted); }
.hello-gear svg { width: 21px; height: 21px; }

.page-header-back { display: flex; align-items: flex-end; gap: 14px; }

/* ---------- Streak ---------- */

.streak {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--accent-soft);
}
.streak-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 18px;
  background: #ffffff;
  color: #ff8a5c;
}
.streak-icon svg { width: 26px; height: 26px; }
.streak-title { font-weight: 700; }
.streak-title strong { margin-right: 2px; font-size: 26px; font-weight: 800; color: var(--accent-strong); }
.streak-sub { font-size: 14px; color: var(--muted); }

/* ---------- Lern-Ringe ---------- */

.rings-card {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 14px;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-small);
}
.rings { flex: none; width: 112px; height: 112px; }
.ring-track, .ring-progress { fill: none; stroke-width: 14; stroke-linecap: round; }
.ring-progress { stroke-dasharray: 100; transition: stroke-dashoffset 600ms var(--ease); }
.ring-track.ring-tasks { stroke: #fde3ec; }
.ring-progress.ring-tasks { stroke: #f59ebd; }
.ring-track.ring-time { stroke: #ece8fe; }
.ring-progress.ring-time { stroke: #a99cf3; }
.view-enter .ring-progress { animation: ring-fill 1000ms var(--ease) 150ms both; }
@keyframes ring-fill {
  from { stroke-dashoffset: 100; }
  to { stroke-dashoffset: var(--offset); }
}

.rings-legend { flex: 1 1 0; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ring-row { display: flex; align-items: center; gap: 10px; }
.ring-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; }
.ring-dot-tasks { background: #f59ebd; }
.ring-dot-time { background: #a99cf3; }
.ring-label { font-size: 13px; color: var(--muted); }
.ring-value { font-size: 15px; font-weight: 700; color: var(--muted); }
.ring-value strong { font-size: 20px; font-weight: 800; color: var(--text); }
.ring-row-done .ring-value strong::after { content: " ✓"; color: #3fb67f; }
.rings-card { flex-wrap: wrap; }
.ring-goal {
  appearance: none;
  padding: 1px 8px;
  border: none;
  border-radius: 999px;
  background: #f1eefe;
  color: #7f6fe0;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}
.goal-editor {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 12px;
  width: 100%;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.goal-editor-label { flex: 1; min-width: 120px; font-size: 14px; font-weight: 800; }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper-button {
  appearance: none;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 12px;
  background: #f1eefe;
  color: #7f6fe0;
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  transition: transform 150ms var(--ease);
}
.stepper-button:active { transform: scale(0.92); }
.stepper-button:disabled { opacity: 0.4; cursor: default; }
.stepper-value { min-width: 82px; text-align: center; font-size: 16px; font-weight: 800; }

/* ---------- Timer auf der Plan-Karte ---------- */

.hero-timer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 14px; }
.hero-timer .hero-button { margin-top: 0; }
.hero-button svg { width: 14px; height: 14px; }
.hero-button-stop { background: rgba(255, 255, 255, 0.92); }
.hero-timer-text { font-size: 13px; font-weight: 700; }
.hero-timer-text strong { display: block; font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------- Eier ---------- */

.egg-banner { align-items: center; background: #fff3dd; color: #8a5a00; }
.egg-banner-icon { flex: none; width: 34px; height: 34px; }
.egg-banner-icon svg { width: 100%; height: 100%; }
.egg-banner .banner-button { color: #8a5a00; }

.egg-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #fff3dd 0%, #ffe6ef 100%);
}
.egg-card-empty { background: var(--surface); box-shadow: var(--shadow-small); }
.egg-wrap { flex: none; width: 72px; height: 72px; padding: 0; border: none; background: transparent; cursor: pointer; }
.egg-wrap svg { width: 100%; height: 100%; }
.egg-card-empty .egg-wrap { cursor: default; }
.egg-wobble { animation: wobble 2.4s ease-in-out infinite; transform-origin: 50% 90%; }
.egg-text { flex: 1; min-width: 0; }
.egg-title { font-size: 17px; font-weight: 800; }
.egg-sub { font-size: 14px; color: var(--muted); }

@keyframes wobble {
  0%, 60%, 100% { transform: rotate(0); }
  68% { transform: rotate(-8deg); }
  76% { transform: rotate(7deg); }
  84% { transform: rotate(-5deg); }
  92% { transform: rotate(3deg); }
}

/* ---------- Sammlung ---------- */

.collection-count { padding: 6px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-size: 14px; font-weight: 800; }

.pet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pet-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 6px 12px;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-small);
  text-align: center;
}
.pet-art { display: block; width: 76px; height: 76px; }
.pet-art svg, .pet-svg { width: 100%; height: 100%; }
.pet-name { margin-top: 2px; font-size: 14px; font-weight: 800; }
.pet-kind { font-size: 11px; color: var(--muted); }
.pet-count { position: absolute; top: 8px; right: 8px; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-size: 11px; font-weight: 800; }
.pet-missing { background: #fbf7f9; box-shadow: none; }
.pet-missing .pet-art { opacity: 0.55; filter: saturate(0.6); }
.pet-missing .pet-name { color: var(--muted); }
.pet-missing .pet-kind { color: #cdbcc4; }
.pet-found-badge { position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #dff5e9; color: #24764c; font-size: 11px; font-weight: 800; }
.album-empty { padding: 28px 4px; }
.egg-card + .section { margin-top: 24px; }
.rarity-selten { box-shadow: var(--shadow-small), inset 0 0 0 2px #d9ceff; }
.rarity-super { box-shadow: 0 6px 20px rgba(255, 196, 61, 0.35), inset 0 0 0 2px #ffd66b; background: linear-gradient(180deg, #fffaf0 0%, #ffffff 100%); }

.rarity-dot { display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%; vertical-align: 1px; }
.rarity-dot-normal { background: #f0c9d7; }
.rarity-dot-selten { background: #a996f5; }
.rarity-dot-super { background: #ffc43d; }

.pet-spark { animation: twinkle 1.8s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.pet-spark-late { animation-delay: 0.6s; }

/* ---------- Ei öffnen ---------- */

/* Die Kachel springt aus der getippten Stelle auf (transform-origin setzt app.js). */
dialog.hatch-dialog {
  width: min(360px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  margin: auto;
  padding: 26px 22px 22px;
  border-radius: 30px;
  text-align: center;
  overflow: visible;
}
dialog.hatch-dialog[open] { animation: hatch-open 520ms cubic-bezier(0.2, 1.25, 0.35, 1) both; }

@keyframes hatch-open {
  from { opacity: 0; transform: scale(0.25); }
  40% { opacity: 1; }
  to { opacity: 1; transform: scale(1); }
}

.hatch-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 12px;
  background: var(--bg);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.hatch-eyebrow { font-size: 13px; font-weight: 800; color: var(--accent-strong); }

.hatch-stage { position: relative; width: 190px; height: 190px; margin: 6px auto 0; }
.hatch-egg-button {
  position: absolute;
  inset: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  transform-origin: 50% 88%;
  -webkit-tap-highlight-color: transparent;
}
.hatch-egg { width: 100%; height: 100%; overflow: visible; }
.hatch[data-stage="0"] .hatch-egg-button { animation: wobble 2.4s ease-in-out infinite; }
.hatch-egg-button.shake { animation: egg-shake 520ms ease-in-out; }
.hatch[data-stage="2"] .hatch-egg-button.shake { animation: egg-shake-strong 600ms ease-in-out; }

/* Risse zeichnen sich ein */
.crack { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 420ms ease-out 120ms; }
.hatch[data-stage="1"] .crack-1,
.hatch[data-stage="2"] .crack-1,
.hatch[data-stage="2"] .crack-2,
.hatch[data-stage="2"] .crack-3 { stroke-dashoffset: 0; }
.hatch[data-stage="3"] .hatch-cracks { opacity: 0; transition: opacity 120ms; }

/* Aufbrechen: obere Hälfte fliegt weg, untere fällt */
.hatch-top, .hatch-bottom { transform-box: fill-box; transform-origin: center; transition: transform 700ms cubic-bezier(0.2, 0.8, 0.3, 1) 80ms, opacity 600ms ease 160ms; }
.hatch-shadow { transition: opacity 400ms ease; }
.hatch[data-stage="3"] .hatch-top { transform: translate(-26px, -54px) rotate(-32deg); opacity: 0; }
.hatch[data-stage="3"] .hatch-bottom { transform: translate(8px, 30px) rotate(6deg) scale(0.9); opacity: 0; }
.hatch[data-stage="3"] .hatch-shadow { opacity: 0; }
.hatch[data-stage="3"] .hatch-egg-button { pointer-events: none; animation: none; }

.hatch-pet { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.hatch-pet svg { width: 100%; height: 100%; }
.hatch[data-stage="3"] .hatch-pet { animation: pet-pop 650ms var(--ease) 260ms both; }

.hatch-burst span { position: absolute; left: 50%; top: 52%; width: 11px; height: 11px; margin: -5.5px; border-radius: 50%; background: var(--c); opacity: 0; }
.hatch[data-stage="3"] .hatch-burst span { animation: burst 800ms ease-out 200ms both; }

.hatch-rarity-super .hatch-stage::before {
  content: "";
  position: absolute;
  inset: -16px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 214, 107, 0.6) 0%, rgba(255, 214, 107, 0) 70%);
  animation: fade-up 600ms ease 300ms both;
}
.hatch-rarity-selten .hatch-stage::before {
  content: "";
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 184, 255, 0.5) 0%, rgba(201, 184, 255, 0) 70%);
  animation: fade-up 600ms ease 300ms both;
}

.hatch-hint { min-height: 22px; margin-top: 10px; font-size: 15px; font-weight: 800; color: var(--muted); }
.hatch[data-stage="3"] .hatch-hint { display: none; }
.hatch-result:empty { display: none; }
.hatch-result { animation: fade-up 420ms var(--ease) 700ms both; }
.hatch-new { margin-top: 8px; font-size: 13px; font-weight: 800; color: var(--accent-strong); }
.hatch-again { color: var(--muted); }
.hatch-name { margin-top: 2px; font-size: 26px; font-weight: 800; }
.hatch-kind { margin-bottom: 18px; font-size: 14px; color: var(--muted); }
.hatch-actions { display: flex; flex-direction: column; gap: 8px; }

.rarity-label { font-weight: 800; }
.rarity-label-normal { color: #c9879f; }
.rarity-label-selten { color: #8f7cf0; }
.rarity-label-super { color: #e0a100; }

@keyframes egg-shake {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-9deg); }
  40% { transform: rotate(8deg); }
  60% { transform: rotate(-6deg); }
  80% { transform: rotate(4deg); }
}
@keyframes egg-shake-strong {
  0%, 100% { transform: rotate(0) translateY(0); }
  12% { transform: rotate(-14deg) translateY(-4px); }
  28% { transform: rotate(13deg) translateY(0); }
  44% { transform: rotate(-12deg) translateY(-3px); }
  60% { transform: rotate(10deg) translateY(0); }
  78% { transform: rotate(-5deg); }
}
@keyframes burst {
  0% { opacity: 1; transform: rotate(var(--angle)) translateY(0) scale(1); }
  100% { opacity: 0; transform: rotate(var(--angle)) translateY(-100px) scale(0.3); }
}
@keyframes pet-pop {
  from { opacity: 0; transform: scale(0.3) translateY(20px); }
  70% { opacity: 1; transform: scale(1.08) translateY(0); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Kalender: Monat / Liste ---------- */

.view-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: -8px 0 16px; padding: 4px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-small); }
.view-toggle-button { appearance: none; padding: 8px 0; border: none; border-radius: 12px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 800; cursor: pointer; transition: background 150ms ease, color 150ms ease; }
.view-toggle-active { background: var(--accent-soft); color: var(--accent-strong); }

/* ---------- Noten ---------- */

.grade-card {
  margin-bottom: 10px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-small);
}
.grade-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grade-head-right { display: flex; align-items: center; gap: 8px; }
.grade-row { margin-top: 10px; }
.grade-picker { margin-top: 10px; flex-wrap: wrap; }
.grade-picker-label { width: 100%; font-size: 13px; color: var(--muted); }
.grade-subject { display: inline-flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 800; }
.grade-average { flex: none; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 800; }
.grade-average-empty { padding: 0; font-weight: 600; color: var(--muted); }
.grade-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

.grade-chip {
  appearance: none;
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border: none;
  border-radius: 13px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 150ms var(--ease), box-shadow 150ms ease;
}
.grade-chip:active { transform: scale(0.93); }
.grade-chip-armed { box-shadow: inset 0 0 0 2px currentColor; }
.grade-add {
  appearance: none;
  flex: none;
  width: 34px;
  height: 34px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--bg);
  color: var(--accent-strong);
  font-size: 19px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  transition: transform 150ms var(--ease);
}
.grade-add:active { transform: scale(0.92); }
.grade-picker { display: flex; align-items: center; gap: 6px; }
.grade-cancel { appearance: none; width: 32px; height: 38px; border: none; background: transparent; color: var(--muted); font-size: 20px; cursor: pointer; }

.grade-1 { background: #dff5e9; color: #24764c; }
.grade-2 { background: #e8f4d6; color: #4f7a1d; }
.grade-3 { background: #fdf2d2; color: #8a6100; }
.grade-4 { background: #fde5d9; color: #a8481c; }
.grade-5 { background: #ffe4e4; color: #c23a3a; }
.hello-name { color: var(--accent); }
.hello-date { margin-top: 6px; font-size: 15px; color: var(--muted); }

/* ---------- Plan-Karte ---------- */

.hero {
  position: relative;
  overflow: hidden;
  min-height: 160px;
  margin-bottom: 14px;
  padding: 22px 22px 24px;
  border-radius: 30px;
  background: linear-gradient(135deg, #ff8fb8 0%, #ffaac8 50%, #ffc9b5 100%);
  color: #ffffff;
  box-shadow: 0 16px 36px rgba(240, 106, 155, 0.28);
}
.hero::before,
.hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
}
.hero::before { width: 190px; height: 190px; right: -60px; top: -70px; }
.hero::after { width: 90px; height: 90px; left: -30px; bottom: -40px; }

.hero-text { position: relative; z-index: 1; max-width: 62%; }
.hero-eyebrow { font-size: 13px; font-weight: 700; opacity: 0.92; }
.hero-title { margin-top: 4px; font-size: 26px; font-weight: 800; line-height: 1.15; }
.hero-sub { margin-top: 6px; font-size: 14px; font-weight: 700; opacity: 0.95; }

.hero-progress {
  height: 9px;
  margin-top: 16px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.4);
  overflow: hidden;
}
.hero-progress span {
  display: block;
  height: 100%;
  border-radius: 9px;
  background: #ffffff;
  transition: width 500ms var(--ease);
}

.hero-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 10px 16px;
  border: none;
  border-radius: 999px;
  background: #ffffff;
  color: var(--accent-strong);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(224, 79, 134, 0.2);
  transition: transform 150ms var(--ease);
}
.hero-button svg { width: 16px; height: 16px; }
.hero-button:active { transform: scale(0.97); }

.mascot {
  position: absolute;
  right: 4px;
  bottom: 4px;
  z-index: 1;
  width: 122px;
  height: 122px;
  animation: float 4s ease-in-out infinite;
}
.mascot-spark { animation: twinkle 1.8s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.mascot-spark-late { animation-delay: 0.6s; }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes twinkle {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}

/* ---------- Hinweise ---------- */

.banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
  padding: 13px 16px;
  border-radius: 18px;
  font-size: 14px;
  font-weight: 600;
}
.banner > svg { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.warning { background: var(--warn-bg); color: var(--warn-text); }
.exam-today { align-items: center; background: var(--subject-soft); }
.banner-star { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #ffffff; color: var(--subject); }
.banner-star svg { width: 15px; height: 15px; }
.missing { align-items: center; background: var(--warn-bg); color: var(--warn-text); }
.banner-text { flex: 1; min-width: 0; }
.banner-button {
  flex: none;
  padding: 7px 12px;
  border: none;
  border-radius: 999px;
  background: #ffffff;
  color: var(--warn-text);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 150ms var(--ease);
}
.banner-button:active { transform: scale(0.96); }
.exam-today .banner-button { color: var(--text); }

.empty { padding: 32px 0; }
.empty-title { margin-bottom: 4px; font-size: 17px; font-weight: 800; }

.note { margin-top: 32px; font-size: 13px; color: var(--muted); }

/* ---------- Aufgaben ---------- */

.group {
  margin-bottom: 12px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--subject-soft);
}
.group-header { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; padding: 4px 6px 10px; }
.group-subject { display: inline-flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 800; }
.group-meta { font-size: 13px; color: var(--muted); }

.task-list { border-radius: var(--radius-small); background: var(--surface); overflow: hidden; }

.task {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-top: 1px solid var(--line);
  cursor: pointer;
  transition: background 150ms ease;
}
.task:first-child { border-top: none; }
.task:active { background: var(--bg); }

.task input { position: absolute; opacity: 0; pointer-events: none; }

.task-check {
  flex: none;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 2px solid var(--subject);
  border-radius: 50%;
  transition: background 200ms var(--ease), border-color 200ms var(--ease), transform 200ms var(--ease);
}
.task-check::after {
  content: "";
  width: 10px;
  height: 6px;
  border-left: 2.5px solid color-mix(in srgb, var(--subject) 30%, #3b2f36);
  border-bottom: 2.5px solid color-mix(in srgb, var(--subject) 30%, #3b2f36);
  transform: rotate(-45deg) translate(1px, -1px) scale(0);
  transition: transform 200ms var(--ease);
}
.task input:checked + .task-check { background: var(--subject); border-color: var(--subject); }
.task input:checked + .task-check::after { transform: rotate(-45deg) translate(1px, -1px) scale(1); }
.task input:focus-visible + .task-check { outline: 2px solid var(--subject); outline-offset: 2px; }
.task:active .task-check { transform: scale(0.9); }

.task-title { flex: 1; min-width: 0; font-weight: 700; overflow-wrap: anywhere; }
.task-done .task-title { color: var(--muted); text-decoration: line-through; }

/* ---------- Bald dran ---------- */

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.tile {
  appearance: none;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 16px;
  border: none;
  border-radius: var(--radius);
  background: var(--subject-soft);
  text-align: left;
  cursor: pointer;
  transition: transform 150ms var(--ease);
}
.tile:active { transform: scale(0.97); }
.tile-count { display: flex; align-items: baseline; gap: 5px; }
.tile-count strong { font-size: 36px; font-weight: 800; line-height: 1; }
.tile-count span { font-size: 14px; font-weight: 700; color: var(--muted); }
.tile-subject { display: flex; align-items: center; gap: 7px; margin-top: 14px; font-size: 16px; font-weight: 800; overflow-wrap: anywhere; }
.tile-meta { font-size: 13px; color: var(--muted); }
.tile-progress { display: block; height: 6px; margin-top: 12px; border-radius: 6px; background: rgba(255, 255, 255, 0.8); overflow: hidden; }
.tile-progress span { display: block; height: 100%; border-radius: 6px; background: var(--subject); }

/* ---------- Listen ---------- */

.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  font-size: 15px;
  font-weight: 700;
}
.plain-list li:first-child { border-top: none; }
.list-card { padding: 4px 16px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-small); }
.row-between { justify-content: space-between; }

/* ---------- Buttons ---------- */

.button {
  appearance: none;
  padding: 10px 16px;
  border: none;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1.5px var(--line-strong);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 150ms var(--ease), background 150ms ease;
}
.button:hover { background: var(--bg); }
.button:active { transform: scale(0.97); }
.button-primary { background: var(--accent); box-shadow: 0 8px 18px rgba(240, 106, 155, 0.3); color: #ffffff; }
.button-primary:hover { background: var(--accent-strong); }
.button-quiet { background: transparent; box-shadow: none; color: var(--muted); }
.button-danger { background: var(--bad-bg); box-shadow: none; color: var(--bad-text); }
.button-danger:hover { background: var(--bad-bg); }

.icon-button {
  appearance: none;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 15px;
  background: var(--surface);
  box-shadow: var(--shadow-small);
  color: var(--accent);
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  transition: transform 150ms var(--ease);
}
.icon-button:active { transform: scale(0.93); }
.month-nav { display: flex; gap: 8px; }

/* ---------- Kalender ---------- */

.cal-panel { padding: 14px 10px 12px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-small); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-weekdays { margin-bottom: 6px; font-size: 12px; font-weight: 700; color: var(--muted); text-align: center; }

.cal-day {
  appearance: none;
  position: relative;
  min-width: 0;
  aspect-ratio: 1 / 1.05;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 2px;
  border: none;
  border-radius: 14px;
  background: transparent;
  cursor: pointer;
  transition: background 150ms ease, transform 150ms var(--ease);
}
.cal-day:hover { background: var(--bg); }
.cal-day:active { transform: scale(0.94); }
.cal-number { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cal-past .cal-number { color: var(--muted); font-weight: 600; }
.cal-today { background: var(--accent-soft); }
.cal-today .cal-number { color: var(--accent-strong); font-weight: 800; }
.cal-selected, .cal-selected:hover { background: var(--accent); box-shadow: 0 6px 14px rgba(240, 106, 155, 0.3); }
.cal-selected .cal-number { color: #ffffff; }
.cal-selected .dot { box-shadow: 0 0 0 1.5px #ffffff; }
.cal-blocked:not(.cal-selected) { background: repeating-linear-gradient(135deg, transparent 0 5px, var(--line) 5px 7px); }
.cal-dots { display: flex; gap: 3px; height: 7px; }
.cal-dots .dot { width: 6px; height: 6px; }

.cal-tasks { display: flex; gap: 2px; height: 4px; margin-top: auto; }
.cal-tasks span { display: block; width: 7px; height: 4px; border-radius: 4px; background: var(--accent); }
.cal-selected .cal-tasks span { background: #ffffff; }

.legend { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 0 6px; font-size: 12px; color: var(--muted); }
.legend-dot { background: var(--muted); }
.legend-tasks { margin: 0 0 0 12px; }

.day-detail .button { margin-top: 6px; }
.day-detail > .muted { margin-bottom: 8px; }

/* ---------- Test-Karten ---------- */

.card {
  margin-bottom: 12px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-small);
}
.card-top { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.badge {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: var(--subject-soft);
  line-height: 1;
}
.badge strong { font-size: 21px; font-weight: 800; }
.badge span { margin-top: 3px; font-size: 11px; font-weight: 700; color: var(--muted); }
.card-title { flex: 1; min-width: 0; }
.card-title h3 { overflow-wrap: anywhere; }
.card-title .muted { font-size: 13px; }

.progress { height: 7px; border-radius: 7px; background: var(--subject-soft); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 7px; background: var(--subject); transition: width 400ms var(--ease); }
.card-line { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; margin-top: 10px; font-size: 14px; }
.card-actions { display: flex; gap: 8px; margin-top: 14px; }

.chip { flex: none; padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.chip-ok { background: var(--ok-bg); color: var(--ok-text); }
.chip-warn { background: var(--warn-bg); color: var(--warn-text); }
.chip-bad { background: var(--bad-bg); color: var(--bad-text); }

/* ---------- Formular ---------- */

dialog {
  width: min(480px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 24px;
  border: none;
  border-radius: 30px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 60px rgba(59, 47, 54, 0.2);
  overflow-y: auto;
}
dialog[open] { animation: dialog-in 280ms var(--ease); }
dialog::backdrop { background: rgba(59, 47, 54, 0.35); animation: fade-in 200ms ease; }

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes sheet-in {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.sheet-handle { display: none; }

/* Am Handy kommt das Formular als Blatt von unten. */
@media (max-width: 560px) {
  dialog {
    width: 100%;
    max-width: 100%;
    max-height: 92dvh;
    margin: auto 0 0;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
    border-radius: 30px 30px 0 0;
  }
  dialog[open] { animation: sheet-in 340ms var(--ease); }
  .sheet-handle { display: block; width: 42px; height: 5px; margin: -10px auto 16px; border-radius: 5px; background: var(--line-strong); }
}

.form h2 { margin-bottom: 20px; font-size: 22px; }
.field { display: block; min-width: 0; margin: 0 0 16px; padding: 0; border: none; }
.field > span { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 800; }
.field > span small { display: inline; margin-left: 6px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

input[type="text"], input[type="date"], input[type="number"], select, textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: 14px;
  background: #fffafc;
  font-size: 16px;
  font-weight: 600;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
::placeholder { color: #cdbcc4; }

.segments { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.segment input { position: absolute; opacity: 0; pointer-events: none; }
.segment span {
  display: block;
  padding: 9px 4px;
  border: 1.5px solid var(--line-strong);
  border-radius: 14px;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease;
}
.segment input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }
.segment input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }

/* Fach-Knöpfe */
.subject-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-subject {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  background: #ffffff;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 150ms var(--ease), background 150ms ease, border-color 150ms ease;
}
.chip-subject:active { transform: scale(0.96); }
.chip-subject-selected { border-color: var(--subject); background: var(--subject-soft); }
.chip-subject-add { border-style: dashed; color: var(--muted); }
.add-subject { display: flex; gap: 8px; margin-top: 10px; }
.add-subject[hidden] { display: none; }
.add-subject .add-subject-input { flex: 1; min-width: 0; }
.add-subject .button { flex: none; }

/* Stoff: nur das gewählte Feld zeigen */
.panel { display: none; }
#exam-form[data-material="topics"] .panel-topics,
#exam-form[data-material="pages"] .panel-pages,
#exam-form[data-material="unknown"] .panel-unknown { display: block; }
.panel-note { margin: 0 0 16px; padding: 12px 14px; border-radius: 14px; background: var(--bg); font-size: 14px; color: var(--muted); }

.ranges { display: flex; flex-direction: column; gap: 8px; }
.range-row { display: flex; align-items: center; gap: 8px; }
.range-row input { flex: 1; min-width: 0; text-align: center; }
.range-label { flex: none; font-size: 14px; color: var(--muted); }
.range-remove {
  flex: none;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 12px;
  background: var(--bg);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.button-add-range { margin-top: 6px; padding-left: 4px; color: var(--accent-strong); }

/* Vorschau der Aufteilung */
.preview { margin-top: 4px; padding: 14px 16px; border-radius: 18px; background: var(--accent-soft); }
.preview-title { margin-bottom: 8px; font-size: 13px; font-weight: 800; color: var(--accent-strong); }
.preview-hint { font-size: 14px; color: var(--muted); }
.preview-list { list-style: none; margin: 0; padding: 0; max-height: 220px; overflow-y: auto; }
.preview-list li { display: flex; gap: 12px; padding: 7px 0; border-top: 1px solid rgba(255, 255, 255, 0.8); font-size: 14px; }
.preview-list li:first-child { border-top: none; }
.preview-date { flex: none; width: 72px; font-weight: 800; }
.preview-items { flex: 1; min-width: 0; overflow-wrap: anywhere; }

.form-error { margin: 14px 0 0; padding: 10px 14px; border-radius: 14px; background: var(--bad-bg); color: var(--bad-text); font-size: 14px; font-weight: 700; }
.form-error[hidden] { display: none; }

/* Feedback */
.feedback-images { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.feedback-images:empty { display: none; }
.feedback-thumb { position: relative; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--line); }
.feedback-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.feedback-thumb-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: rgba(59, 47, 54, 0.7);
  color: #ffffff;
  font: inherit;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.feedback-add {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 10px 16px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 999px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.feedback-add svg { width: 18px; height: 18px; color: var(--accent); }
.feedback-add-full { opacity: 0.45; pointer-events: none; }
.feedback-hint { margin-top: 8px; font-size: 13px; }
.feedback-saved { margin-top: 14px; font-size: 13px; }
.feedback-thanks { text-align: center; }
.feedback-thanks .mascot { position: static; display: block; width: 110px; height: 110px; margin: 8px auto 4px; }
.feedback-thanks h2 { margin-bottom: 6px; font-size: 22px; }
.feedback-thanks .form-actions { justify-content: center; }

.subject-row { display: inline-flex; align-items: center; gap: 12px; }
.subject-color {
  appearance: none;
  flex: none;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 3px solid var(--subject-soft);
  border-radius: 50%;
  background: var(--subject);
  box-shadow: 0 0 0 1.5px var(--subject);
  cursor: pointer;
  transition: transform 150ms var(--ease);
}
.subject-color:active { transform: scale(0.9); }
.plain-list li.color-picker-row { display: block; padding: 4px 0 14px; border-top: none; }
.color-swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
.color-swatch {
  appearance: none;
  aspect-ratio: 1;
  padding: 0;
  border: 3px solid var(--subject-soft);
  border-radius: 50%;
  background: var(--subject);
  cursor: pointer;
  transition: transform 150ms var(--ease);
}
.color-swatch:active { transform: scale(0.88); }

/* ---------- Profil ---------- */

.settings { border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-small); }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px; border-top: 1px solid var(--line); }
.setting:first-child { border-top: none; }
.setting > span:first-child { font-size: 15px; font-weight: 800; }
.setting-input { flex: none; display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.setting-input input { width: 80px; text-align: right; color: var(--text); }
.setting-input .input-name { width: 140px; }

/* ---------- Navigation ---------- */

.nav {
  position: fixed;
  left: 50%;
  bottom: calc(14px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(400px, calc(100% - 24px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 12px 34px rgba(240, 106, 155, 0.18);
}

.nav-item {
  appearance: none;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  border: none;
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: color 150ms ease, transform 150ms var(--ease);
}
.nav-item svg { width: 23px; height: 23px; }
.nav-item:active { transform: scale(0.94); }
.nav-item-active { color: var(--accent); }

.nav-add {
  appearance: none;
  flex: none;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin: 0 6px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(240, 106, 155, 0.42);
  cursor: pointer;
  transition: transform 150ms var(--ease), background 150ms ease;
}
.nav-add svg { width: 26px; height: 26px; }
.nav-add:hover { background: var(--accent-strong); }
.nav-add:active { transform: scale(0.92); }

@media (max-width: 380px) {
  .app { padding-top: 32px; }
  .hero-title { font-size: 23px; }
  .mascot { width: 104px; height: 104px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
