@font-face { font-family: "Atkinson"; src: url("../fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url("../fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Bricolage"; src: url("../fonts/bricolage-grotesque-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --bg: #ECF0ED;
  --surface: #FAFCFA;
  --ink: #17202B;
  --muted: #56626F;
  --line: #D2D9D4;
  --green: #1F6B57;
  --green-soft: #DCEBE4;
  --gold: #B07D22;
  --rose: #A9504C;
  --night: #1B2440;
  --dawn: #6E8FC0;
  --noon: #CFE3EE;
  --dusk: #D9946A;
  --body: "Atkinson", system-ui, sans-serif;
  --display: "Bricolage", "Atkinson", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F141D;
    --surface: #171F2D;
    --ink: #E9EDEF;
    --muted: #9AA5B1;
    --line: #2B3547;
    --green: #63C2A2;
    --green-soft: #1C3A33;
    --gold: #DDB161;
    --rose: #E08E86;
    --noon: #8FB4CC;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 1.0625rem/1.5 var(--body);
  padding-bottom: calc(6rem + env(safe-area-inset-bottom));
}
main { max-width: 34rem; margin: 0 auto; padding: 1.25rem 1.125rem 2rem; outline: none; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.3125rem; margin: 2.25rem 0 0.75rem; }
h3 { font-size: 1.0625rem; }
p { margin: 0 0 0.75rem; max-width: 62ch; }
.muted { color: var(--muted); }
.small { font-size: 0.9375rem; }
a { color: var(--green); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }

button, select, input, textarea { font: inherit; color: inherit; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 2.875rem;
  padding: 0.5rem 1.125rem; border-radius: 0.625rem; border: 1.5px solid var(--ink);
  background: transparent; font-weight: 700; cursor: pointer;
}
.btn.primary { background: var(--ink); color: var(--bg); }
.btn.quiet { border-color: var(--line); font-weight: 400; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.625rem; margin: 0.75rem 0; }

/* ---- Kopf des Tages ---- */
.dayhead { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.dayhead .date { font-size: 0.9375rem; color: var(--muted); }
.daynav { display: flex; gap: 0.375rem; }
.daynav button {
  width: 2.75rem; height: 2.75rem; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; font-size: 1.125rem; line-height: 1;
}
.chip { display: inline-block; padding: 0.125rem 0.625rem; border-radius: 1rem; font-size: 0.875rem; font-weight: 700; }
.chip.F, .cell.F { background: #F1DFB5; color: #4A3608; }
.chip.S, .cell.S { background: #EFCFC6; color: #5A1F1B; }
.chip.N, .cell.N { background: var(--night); color: #E6EAF5; }
.chip.X, .cell.X { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1.5px var(--line); }

/* ---- Tagesband: 24 Stunden mit Himmel, Schicht, Schlaf und Gebeten ---- */
.band { position: relative; margin: 1.25rem 0 0.5rem; padding-top: 1.375rem; }
.band .sky { height: 2.25rem; border-radius: 0.5rem; }
.band .lane { position: relative; height: 0.875rem; margin-top: 0.375rem; }
.band .blk { position: absolute; top: 0; bottom: 0; border-radius: 0.25rem; }
.band .blk.work { background: var(--ink); }
.band .blk.way { background: var(--ink); opacity: 0.35; }
.band .blk.sleep, .band .blk.nap {
  background: repeating-linear-gradient(135deg, var(--dawn) 0 4px, transparent 4px 8px);
  box-shadow: inset 0 0 0 1px var(--dawn);
}
.band .tick { position: absolute; top: 0; transform: translateX(-50%); font-size: 0.75rem; font-weight: 700; text-align: center; }
.band .tick::after { content: ""; display: block; width: 2px; height: 2.75rem; margin: 0.125rem auto 0; background: var(--surface); box-shadow: 0 0 0 1px rgba(0,0,0,.25); }
.band .tick.done { color: var(--green); }
.band .nowline { position: absolute; top: 1rem; bottom: -0.125rem; width: 2px; background: var(--rose); }
.band .nowline::before { content: ""; position: absolute; top: -4px; left: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--rose); }
.hours { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--muted); margin-top: 0.25rem; }
.legend { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; font-size: 0.8125rem; color: var(--muted); margin: 0.375rem 0 0; }
.legend i { display: inline-block; width: 1rem; height: 0.625rem; border-radius: 2px; margin-right: 0.375rem; vertical-align: baseline; }
.legend .work { background: var(--ink); }
.legend .sleep { background: repeating-linear-gradient(135deg, var(--dawn) 0 3px, transparent 3px 6px); box-shadow: inset 0 0 0 1px var(--dawn); }

/* ---- Listen zum Abhaken ---- */
.rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.rows li { display: grid; grid-template-columns: 4.25rem 1fr auto; gap: 0.75rem; align-items: center; padding: 0.75rem 0; border-bottom: 1px solid var(--line); }
.rows.habits li { grid-template-columns: 1fr auto; }
.rows .t { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.1875rem; }
.rows .t small { display: block; font-weight: 400; font-size: 0.8125rem; color: var(--muted); }
.rows .n { font-weight: 700; }
.rows .a { display: block; font-size: 0.9375rem; color: var(--muted); }
.rows li.is-now .n::after { content: "jetzt"; margin-left: 0.5rem; font-size: 0.75rem; font-weight: 700; color: var(--bg); background: var(--rose); border-radius: 1rem; padding: 0.0625rem 0.5rem; }
.rows li.done .n, .rows li.done .a { color: var(--muted); }
.rows li.warn .a { color: var(--gold); }
@media (prefers-color-scheme: light) { .rows li.warn .a { color: #7A5510; } }
.check {
  width: 2.875rem; height: 2.875rem; border-radius: 50%; border: 2px solid var(--line);
  background: var(--surface); cursor: pointer; display: grid; place-items: center; padding: 0;
  transition: background-color .15s, border-color .15s;
}
.check svg { width: 1.375rem; height: 1.375rem; stroke: transparent; fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.check[aria-pressed="true"] { background: var(--green); border-color: var(--green); }
.check[aria-pressed="true"] svg { stroke: var(--surface); }

.tonight { background: var(--surface); border-left: 4px solid var(--dawn); padding: 0.75rem 1rem; border-radius: 0 0.5rem 0.5rem 0; margin-top: 1rem; }
.tonight p { margin: 0; }

/* ---- Vers ---- */
.verse { margin: 2.25rem 0 0; padding: 1.25rem 0 0; border-top: 3px double var(--line); }
.verse .ar { font-size: 1.5rem; line-height: 2; direction: rtl; text-align: right; margin-bottom: 0.75rem; font-family: "Amiri", "Scheherazade New", "Noto Naskh Arabic", "Geeza Pro", serif; }
.verse .de { font-size: 1.125rem; line-height: 1.55; }
.verse cite { display: block; font-style: normal; color: var(--muted); font-size: 0.9375rem; margin-top: 0.5rem; }

/* ---- Schichtplan ---- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.3125rem; }
.cal .wd { text-align: center; font-size: 0.8125rem; color: var(--muted); padding-bottom: 0.125rem; }
.cell {
  aspect-ratio: 1 / 1.1; border: 0; border-radius: 0.5rem; cursor: pointer; padding: 0.25rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1;
}
.cell b { font-family: var(--display); font-size: 1.125rem; }
.cell span { font-size: 0.75rem; opacity: 0.8; }
.cell.today { outline: 2.5px solid var(--rose); outline-offset: 1px; }
.cell.fixed::after { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; margin-top: 2px; }

/* ---- Formulare ---- */
.field { display: block; margin: 0 0 1rem; }
.field > span { display: block; font-weight: 700; margin-bottom: 0.25rem; }
.field small { display: block; color: var(--muted); margin-top: 0.25rem; }
input[type="text"], input[type="number"], input[type="time"], input[type="date"], select, textarea {
  width: 100%; min-height: 2.875rem; padding: 0.5rem 0.75rem; background: var(--surface);
  border: 1.5px solid var(--line); border-radius: 0.5rem;
}
textarea { min-height: 5.5rem; resize: vertical; }
.pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.75rem; }
.times { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr); gap: 0.5rem 0.75rem; align-items: center; margin-bottom: 1rem; }
.toggle { display: flex; align-items: center; gap: 0.75rem; padding: 0.625rem 0; border-bottom: 1px solid var(--line); }
.toggle input { width: 1.5rem; height: 1.5rem; accent-color: var(--green); flex: none; }
.notice { background: var(--green-soft); border-radius: 0.5rem; padding: 0.875rem 1rem; margin: 1rem 0; }
.notice p:last-child { margin-bottom: 0; }

/* ---- Woche ---- */
.grid { width: 100%; border-collapse: collapse; }
.grid th { font-weight: 400; font-size: 0.8125rem; color: var(--muted); padding: 0.25rem 0; }
.grid th[scope="row"] { text-align: left; font-size: 0.9375rem; color: var(--ink); padding-right: 0.5rem; max-width: 9rem; }
.grid td { text-align: center; padding: 0.3125rem 0; }
.grid .dot { display: inline-block; width: 1.125rem; height: 1.125rem; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--line); }
.grid .dot.on { background: var(--green); box-shadow: none; }
.grid tr.sep th, .grid tr.sep td { border-top: 1px solid var(--line); padding-top: 0.625rem; }
.score { font-family: var(--display); font-size: 2.375rem; line-height: 1; }

/* ---- Rat ---- */
details { border-bottom: 1px solid var(--line); }
details summary { cursor: pointer; padding: 0.875rem 0; font-family: var(--display); font-weight: 700; font-size: 1.125rem; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
details summary::-webkit-details-marker { display: none; }
details summary::after { content: "+"; color: var(--muted); }
details[open] summary::after { content: "–"; }
details .body { padding: 0 0 1rem; }
details .body ul { padding-left: 1.125rem; margin: 0 0 0.75rem; }
details .body li { margin-bottom: 0.375rem; }
.src { font-size: 0.875rem; color: var(--muted); }



[hidden] { display: none !important; }
.lead { margin-top: 0.5rem; }
.center { text-align: center; justify-content: center; margin-left: auto; margin-right: auto; }
.btn[disabled] { opacity: 0.45; cursor: default; }
.btn.light { background: #fff; color: #17202B; border-color: #fff; text-decoration: none; }

/* ---- Navigation: schwebende Leiste aus Milchglas ---- */
#tabs {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 5;
  bottom: calc(0.75rem + env(safe-area-inset-bottom)); width: min(calc(100% - 1.5rem), 31rem);
  display: flex; padding: 0.3125rem; border-radius: 1.5rem;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid color-mix(in srgb, var(--ink) 12%, transparent);
  box-shadow: 0 10px 30px -12px rgba(15, 20, 29, 0.45);
}
#tabs a {
  flex: 1; text-align: center; padding: 0.6875rem 0.125rem; border-radius: 1.125rem; min-height: 2.75rem;
  color: var(--muted); text-decoration: none; font-size: 0.9375rem;
  transition: background-color .2s ease, color .2s ease;
}
#tabs a[aria-current="page"] { background: var(--ink); color: var(--bg); font-weight: 700; }
#tabs a:active { transform: scale(0.96); }

/* ---- Kopf: der Himmel zur jetzigen Tageszeit ---- */
.hero {
  position: relative; overflow: hidden; margin: 0.875rem 0 0; padding: 1.25rem 1.125rem 0.875rem;
  border-radius: 1.5rem; color: #fff; --sky-a: #0E1530; --sky-b: #1E2B55;
  background: linear-gradient(170deg, var(--sky-a), var(--sky-b));
}
.hero.dawn { --sky-a: #1E2B55; --sky-b: #8A5A78; }
.hero.day { --sky-a: #174E82; --sky-b: #2E73AB; }
.hero.dusk { --sky-a: #3A2A5C; --sky-b: #A2543F; }
.hero.night::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.75;
  background-image: radial-gradient(1.2px 1.2px at 12% 18%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 31% 42%, #fff 50%, transparent 51%),
    radial-gradient(1.4px 1.4px at 58% 12%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 74% 33%, #fff 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 89% 20%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 45% 27%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 8% 48%, #fff 50%, transparent 51%), radial-gradient(1.3px 1.3px at 95% 46%, #fff 50%, transparent 51%);
  animation: twinkle 5s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: 0.35; } to { opacity: 0.85; } }
.hero > * { position: relative; }
.hero-main { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.hero h1 { font-size: 2.75rem; letter-spacing: -0.02em; }
.hero .sub { margin: 0.25rem 0 0; font-size: 1.0625rem; color: rgba(255,255,255,.88); }
.hero .sub a, .hero a:not(.btn) { color: #fff; }
.hero .push { margin: 1rem 0 0; font-family: var(--display); font-size: 1.25rem; line-height: 1.25; }
.hero .open { margin: 0.875rem 0 0; padding: 0.5rem 0.75rem; border-radius: 0.625rem; background: rgba(0,0,0,.28); font-size: 0.9375rem; }
.hero .btn-row { margin-bottom: 0; }
.ring { width: 5rem; height: 5rem; flex: none; }
.ring circle { fill: none; stroke-width: 7; }
.ring .track { stroke: rgba(255,255,255,.22); }
.ring .bar { stroke: #fff; stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.hero .band .sky { box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); }
.hero .band .blk.work { background: #fff; }
.hero .band .blk.way { background: #fff; opacity: 0.45; }
.hero .band .blk.sleep, .hero .band .blk.nap { background: repeating-linear-gradient(135deg, rgba(255,255,255,.75) 0 4px, transparent 4px 8px); box-shadow: inset 0 0 0 1px rgba(255,255,255,.75); }
.hero .band .tick { color: #fff; }
.hero .band .tick.done { color: #8FE3C4; }
.hero .band .tick::after { background: #fff; box-shadow: none; opacity: 0.9; }
.hero .band .nowline, .hero .band .nowline::before { background: #FFD27A; }
.hero .hours, .hero .legend { color: rgba(255,255,255,.75); }
.hero .legend .work { background: #fff; }
.hero .legend .sleep { background: repeating-linear-gradient(135deg, rgba(255,255,255,.75) 0 3px, transparent 3px 6px); box-shadow: inset 0 0 0 1px rgba(255,255,255,.75); }

/* ---- Abhaken ---- */
.check:active { transform: scale(0.92); }
.check[disabled] { opacity: 0.4; cursor: default; }
.check.pop { animation: pop .38s cubic-bezier(.3, 1.6, .5, 1); }
.check.pop svg path { stroke-dasharray: 24; animation: draw .3s .08s ease-out backwards; }
@keyframes pop { 0% { transform: scale(0.7); } 100% { transform: scale(1); } }
@keyframes draw { from { stroke-dashoffset: 24; } to { stroke-dashoffset: 0; } }
.rows li.missed .a { color: var(--rose); font-weight: 700; }
.rows li.missed .check { border-color: var(--rose); }
.rows li.late .check[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); }
.grid .dot.late { background: var(--gold); box-shadow: none; }
.legend .dot { display: inline-block; width: 0.75rem; height: 0.75rem; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--line); vertical-align: -1px; }
.legend .dot.on { background: var(--green); box-shadow: none; }
.legend .dot.late { background: var(--gold); box-shadow: none; }

/* ---- Wechsel zwischen Bereichen ---- */
#view.enter { animation: enter .22s ease-out; }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---- Qibla ---- */
.compass { width: min(100%, 20rem); margin: 1.25rem auto 0.75rem; }
.compass svg { width: 100%; height: auto; display: block; overflow: visible; }
#rose { transform-origin: 150px 150px; transition: transform .25s ease-out; }
.compass .face { fill: var(--surface); stroke: var(--line); stroke-width: 2; transition: stroke .2s; }
.compass .m { stroke: var(--line); stroke-width: 2; }
.compass .M { stroke: var(--muted); stroke-width: 3; }
.compass text { font-family: var(--display); font-size: 20px; fill: var(--muted); text-anchor: middle; }
.compass text.north { fill: var(--rose); }
.compass .qline { stroke: var(--green); stroke-width: 4; stroke-linecap: round; }
.compass .kaaba { fill: #17202B; stroke: #E9EDEF; stroke-width: 1.5; }
.compass .kaaba-band { fill: var(--gold); }
.compass .hub { fill: var(--ink); }
.compass .pointer { fill: var(--ink); }
.compass.aligned .face { stroke: var(--green); stroke-width: 6; fill: var(--green-soft); }
.compass.aligned .pointer { fill: var(--green); }
#qtext { font-family: var(--display); font-size: 1.3125rem; line-height: 1.25; color: var(--ink); min-height: 3.25rem; }

/* ---- Fragen ---- */
.chat { display: flex; flex-direction: column; gap: 0.625rem; margin: 1.25rem 0 1rem; }
.msg { max-width: 92%; padding: 0.75rem 1rem; border-radius: 1.125rem; scroll-margin-top: 1rem; }
.msg.me { align-self: flex-end; background: var(--ink); color: var(--bg); border-bottom-right-radius: 0.375rem; }
.msg.app { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 0.375rem; }
.msg p:last-child, .msg ul:last-child, .msg ol:last-child { margin-bottom: 0; }
.msg ul, .msg ol { padding-left: 1.25rem; margin: 0 0 0.75rem; }
.msg li { margin-bottom: 0.25rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.msg .chips { margin-top: 0.75rem; }
.chips button {
  min-height: 2.75rem; padding: 0.375rem 0.875rem; border-radius: 1.375rem; cursor: pointer; text-align: left;
  background: transparent; border: 1.5px solid var(--green); color: var(--green); font-weight: 700; font-size: 0.9375rem;
}
.composer { position: sticky; bottom: calc(5rem + env(safe-area-inset-bottom)); display: flex; gap: 0.5rem; padding: 0.5rem; border-radius: 1.25rem;
  background: color-mix(in srgb, var(--bg) 85%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.composer input { flex: 1; border-radius: 0.875rem; }
.composer .btn { border-radius: 0.875rem; }

/* ---- Mehr ---- */
.menu { margin-top: 1.25rem; border-top: 1px solid var(--line); }
.menu a { display: block; padding: 1rem 0; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.menu a b { display: block; font-family: var(--display); font-size: 1.3125rem; }
.menu a span { color: var(--muted); font-size: 0.9375rem; }

/* ---- Abgleich ---- */
.adjust { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.375rem; margin-bottom: 0.5rem; }
.adjust label span { display: block; font-size: 0.75rem; color: var(--muted); margin-bottom: 0.125rem; overflow: hidden; text-overflow: ellipsis; }
.adjust input { padding: 0.5rem 0.25rem; text-align: center; }
h3 { margin: 1.25rem 0 0.375rem; }

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

input, select, textarea { min-width: 0; max-width: 100%; }
.adjust { grid-template-columns: repeat(5, minmax(0, 1fr)); }

/* ---- Start ---- */
.pick { display: flex; align-items: center; gap: 0.875rem; padding: 0.75rem 0.875rem; margin-bottom: 0.5rem; border: 1.5px solid var(--line); border-radius: 0.75rem; background: var(--surface); cursor: pointer; }
.pick input { width: 1.375rem; height: 1.375rem; accent-color: var(--green); flex: none; }
.pick b { display: block; }
.pick small { display: block; color: var(--muted); font-size: 0.875rem; }
.pick:has(input:checked) { border-color: var(--green); background: var(--green-soft); }
.btn[aria-pressed="true"] { border-color: var(--gold); }
a.btn { text-decoration: none; color: inherit; }
a.btn.primary { color: var(--bg); }
