:root {
  --paper: #F7F5EF;
  --dot: #CBC6B8;
  --ink: #1F2430;
  --ink2: #3D4350;
  --muted: #5B6170;
  --line: #EFECE4;
  --card: #FFFFFF;
  --chip: #F0EEE8;
  --accent: #2457D6;
  --warn: #8F4300;
  --warn-bg: #FFE7CF;
  --hand: #1F2A44;
  --shadow: 0 1px 2px rgba(31, 36, 48, 0.06), 0 12px 32px rgba(31, 36, 48, 0.10);
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  background-color: var(--paper);
  background-image: radial-gradient(circle, var(--dot) 1.3px, transparent 1.7px);
  background-size: 22px 22px;
  font-family: 'Figtree', system-ui, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

button:focus-visible, summary:focus-visible, input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Grundbausteine ---------- */

.screen {
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: calc(env(safe-area-inset-top) + 24px) 16px 130px;
}

.card { background: var(--card); border-radius: 24px; box-shadow: var(--shadow); }
.label { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; }
.muted { color: var(--muted); }
.warn { color: var(--warn); }
.grow { flex: 1; min-width: 0; }
.hand { font-family: 'Caveat', cursive; font-weight: 600; font-size: 26px; line-height: 1; color: var(--accent); }

h1 { margin: 4px 0 0; font-size: 24px; letter-spacing: -0.01em; }
p { margin: 2px 0 0; font-size: 14px; }

.clock { text-align: center; margin-top: 24px; }
.clock .date { font-size: 17px; font-weight: 500; color: var(--ink2); }
.clock .time {
  font-size: clamp(72px, 22vw, 140px);
  font-weight: 300;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 999px;
  background: var(--chip); font-size: 13px; font-weight: 600;
}
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.accent { color: var(--accent); }

.thumb {
  width: 36px; height: 44px; flex-shrink: 0;
  border-radius: 5px 11px 11px 5px;
  display: flex; align-items: center; justify-content: center;
}
.thumb svg { width: 20px; height: 20px; }
.thumb.sm { width: 28px; height: 34px; border-radius: 4px 9px 9px 4px; }
.thumb.sm svg { width: 16px; height: 16px; }

/* ---------- Morgens: Tagesüberblick ---------- */

.day { max-width: 560px; margin: 28px auto 0; padding: 18px 20px 10px; }

.lessons { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.times {
  width: 44px; flex-shrink: 0;
  display: flex; flex-direction: column;
  font-size: 12px; line-height: 1.35; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.times strong { font-size: 14px; color: var(--ink); }
.info { flex: 1; min-width: 0; }
.name { font-size: 16px; font-weight: 600; }
.sub { font-size: 13px; color: var(--muted); }
.sub.warn { color: var(--warn); }
.hw-dot {
  width: 30px; height: 30px; flex-shrink: 0; border-radius: 50%;
  background: var(--chip); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.hw-text {
  display: none; max-width: 180px;
  font-family: 'Caveat', cursive; font-size: 20px; line-height: 1.05; color: var(--hand);
}
.small-hand { font-family: 'Caveat', cursive; font-size: 20px; color: var(--hand); }
.pause {
  display: flex; align-items: center; gap: 8px;
  padding: 0 0 6px 56px;
  font-family: 'Caveat', cursive; font-size: 18px; color: #6B7180;
}
.pause span { flex: 1; border-top: 1.5px dashed #D9D4C8; }

/* ---------- Im Unterricht ---------- */

.now-pill {
  position: absolute; left: 16px; top: calc(env(safe-area-inset-top) + 16px);
  width: 212px; padding: 10px 12px; border-radius: 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.now-pill .label { font-size: 10px; color: var(--accent); }
.pill-top { display: flex; align-items: center; gap: 10px; }
.pill-name { font-size: 15px; font-weight: 700; line-height: 1.15; }
.pill-sub { font-size: 12px; color: var(--muted); }
.progress { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 600; color: var(--muted); }
.bar { flex: 1; height: 4px; border-radius: 2px; background: #ECE8DF; overflow: hidden; }
.bar div { height: 100%; border-radius: 2px; }

.school .clock { margin-top: 124px; }

.next { max-width: 560px; margin: 28px auto 0; border-radius: 28px; overflow: hidden; }
.cover { padding: 20px 22px 22px; }
.cover-top { display: flex; justify-content: space-between; align-items: center; }
.in {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.7); font-size: 13px; font-weight: 700;
}
.cover-name {
  display: flex; align-items: center; gap: 12px; margin-top: 10px;
  font-size: clamp(38px, 11vw, 56px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.05;
}
.cover-name svg { width: 0.7em; height: 0.7em; flex-shrink: 0; }
.cover-time { margin-top: 6px; font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cover-time span { font-size: 15px; }

.body { padding: 6px 22px 20px; }
.line { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.circle {
  width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%;
  background: var(--chip); color: var(--ink2);
  display: flex; align-items: center; justify-content: center;
}
.strong { font-size: 17px; font-weight: 600; }
.small { font-size: 13px; font-weight: 600; }
.badge { padding: 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--warn-bg); color: var(--warn); }
.hw { padding-top: 14px; }
.hw-head { display: flex; justify-content: space-between; align-items: center; }
.lined {
  margin-top: 6px; font-size: 26px; font-weight: 500; line-height: 32px; color: var(--hand);
  background-image: repeating-linear-gradient(to bottom, transparent 0 31px, #DCE3EE 31px 32px);
}
.next.last .body { padding: 22px; }
.big { font-size: 40px; font-weight: 700; margin-top: 4px; }

.after {
  display: flex; align-items: center; gap: 8px;
  width: fit-content; margin: 20px auto 0; padding: 8px 14px;
  border-radius: 999px; background: rgba(255, 255, 255, 0.85);
  font-size: 13px; color: var(--ink2);
}
.after .dot { width: 10px; height: 10px; border-radius: 3px; }

/* ---------- Tablet / breite Bildschirme ---------- */

@media (min-width: 900px) {
  .morning {
    display: grid; grid-template-columns: minmax(0, 1fr) 560px;
    gap: 48px; align-items: center; min-height: calc(100dvh - 180px);
  }
  .morning .clock { text-align: left; margin: 0; }
  .morning .day { margin: 0; }
  .hw-text { display: block; }

  .now-pill { left: 32px; top: 32px; width: 260px; }
  .school .clock { margin-top: 24px; }
  .next { display: flex; max-width: 820px; }
  .cover { width: 320px; flex-shrink: 0; padding: 32px; }
  .cover-top { flex-direction: column; align-items: flex-start; gap: 10px; }
  .body { flex: 1; padding: 18px 32px 28px; }
}

/* ---------- Demo-Leiste ---------- */

.demobar {
  position: fixed; z-index: 10; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + 12px);
  width: min(560px, calc(100% - 24px));
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 18px;
  background: rgba(255, 255, 255, 0.94); box-shadow: var(--shadow);
}
.slider { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.slider label { font-size: 12px; font-weight: 600; color: var(--muted); }
.slider output { color: var(--ink); font-variant-numeric: tabular-nums; }
.slider input { width: 100%; height: 28px; margin: 0; accent-color: var(--accent); }

.btn {
  min-height: 44px; padding: 0 14px; border: 0; border-radius: 12px;
  background: var(--chip); color: var(--ink);
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.btn[aria-pressed="true"] { background: var(--accent); color: #FFFFFF; }
.icon-btn {
  width: 44px; height: 44px; flex-shrink: 0; border: 0; border-radius: 12px;
  background: var(--chip); color: var(--ink);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}

/* ---------- Einstellungen ---------- */

dialog {
  width: min(520px, calc(100% - 24px)); max-height: 85dvh;
  padding: 0; border: 0; border-radius: 24px;
  background: var(--paper); color: var(--ink); box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(31, 36, 48, 0.35); }
.dlg-head {
  position: sticky; top: 0; z-index: 1;
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 20px 8px; background: var(--paper);
}
.dlg-head h2 { margin: 0; font-size: 26px; }
.group { padding: 8px 20px 12px; }
.group h3 { margin: 0 0 8px 4px; }
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 12px; background: var(--chip); }
.seg button {
  min-height: 40px; border: 0; border-radius: 9px; background: transparent;
  font: inherit; font-weight: 600; color: var(--ink); cursor: pointer;
}
.seg button[aria-pressed="true"] { background: #FFFFFF; box-shadow: 0 1px 3px rgba(31, 36, 48, 0.15); }
.list { border-radius: 18px; overflow: hidden; }
details + details { border-top: 1px solid var(--line); }
summary {
  display: flex; align-items: center; gap: 12px;
  min-height: 58px; padding: 10px 16px; cursor: pointer; list-style: none;
}
summary::-webkit-details-marker { display: none; }
summary .name, summary .sub { display: block; }
.editor { display: flex; flex-direction: column; gap: 14px; padding: 4px 16px 16px; }
.swatches { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; justify-items: center; }
.swatch { width: 34px; height: 34px; padding: 0; border-radius: 50%; border: 1px solid rgba(31, 36, 48, 0.12); cursor: pointer; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px #FFFFFF, 0 0 0 5px var(--ink); }
.custom { display: flex; justify-content: space-between; align-items: center; font-size: 15px; font-weight: 600; }
.custom input { width: 56px; height: 36px; padding: 0; border: 0; background: none; cursor: pointer; }
.icons { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.icon-choice {
  height: 46px; border-radius: 12px; border: 2px solid transparent;
  background: #F3F1EA; color: var(--ink2);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.reset {
  display: block; min-height: 44px; margin: 4px auto 24px; border: 0; background: none;
  font: inherit; font-weight: 600; color: #B42318; cursor: pointer;
}
