@font-face { font-family: "Bricolage"; src: url(/fonts/bricolage.woff2) format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url(/fonts/newsreader.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url(/fonts/newsreader-italic.woff2) format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }

:root {
  --paper: #ECEEF4;     /* kühles Tagebuchpapier */
  --sheet: #F8F9FC;
  --ink: #22264B;       /* Tinte */
  --ink-soft: #5D628A;
  --line: #CDD1E2;
  --sun: #F4B63F;       /* Tageslicht – nur für den Auslöser */
  --sun-deep: #D9921A;
  --danger: #B3334A;
  --ui: "Bricolage", ui-sans-serif, system-ui, sans-serif;
  --text: "Newsreader", Georgia, "Times New Roman", serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14172E; --sheet: #1D2140; --ink: #E7E8F3; --ink-soft: #A3A7C6; --line: #343A63;
    --danger: #F07A8E; color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--paper); color: var(--ink);
  font: 400 1rem/1.45 var(--ui);
  padding: env(safe-area-inset-top, 0) max(18px, env(safe-area-inset-right, 0)) calc(32px + env(safe-area-inset-bottom, 0)) max(18px, env(safe-area-inset-left, 0));
}
body.dark-stage { background: #000; padding: 0; }
main { max-width: 34rem; margin: 0 auto; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 3px; border-radius: 6px; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.bar { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; height: 60px; }
.bar .brand { text-align: center; }
.bar > .brand:first-child { grid-column: 1 / 3; text-align: left; font-size: 1.5rem; font-weight: 700; letter-spacing: -0.03em; font-variation-settings: "opsz" 96; }
.brand { font-weight: 600; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  background: none; border: 0; color: var(--ink); cursor: pointer; text-decoration: none;
}
.icon-btn:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }

.date {
  font-weight: 650; font-size: clamp(2.1rem, 9vw, 3rem); line-height: 1; letter-spacing: -0.035em;
  font-variation-settings: "opsz" 96; margin: 12px 0 22px; text-wrap: balance;
}

/* Auslöser auf der Startseite – das eine laute Element */
.shutter-card {
  display: flex; align-items: center; gap: 20px; padding: 22px; text-decoration: none;
  background: var(--sheet); border: 1px solid var(--line); border-radius: 28px;
}
.sun {
  flex: none; width: 96px; height: 96px; border-radius: 50%;
  background: radial-gradient(circle at 38% 34%, #FFE29A 0 18%, var(--sun) 52%, var(--sun-deep) 100%);
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--sun) 22%, transparent);
  transition: transform .2s ease;
}
.shutter-card:hover .sun, .shutter-card:active .sun { transform: scale(.95); }
.shutter-text { display: grid; gap: 4px; }
.shutter-text strong { font-size: 1.3rem; letter-spacing: -0.02em; }
.shutter-text span { color: var(--ink-soft); font-size: .95rem; }

/* Dual-Foto */
.dual { position: relative; aspect-ratio: 3 / 4; border-radius: 22px; overflow: hidden; background: #000; }
.dual-main { width: 100%; height: 100%; object-fit: cover; display: block; }
.dual-inset {
  position: absolute; top: 12px; left: 12px; width: 31%; aspect-ratio: 3 / 4; padding: 0;
  border: 3px solid #fff; border-radius: 15px; overflow: hidden; background: #000; cursor: pointer;
  box-shadow: 0 6px 18px rgba(10, 12, 40, .35);
}
.dual-inset img { width: 100%; height: 100%; object-fit: cover; display: block; }

.today-done { display: grid; gap: 14px; }
.note-preview {
  display: block; text-decoration: none; font: 400 1.2rem/1.5 var(--text); margin: 0; padding: 0 4px;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.note-preview.empty { font-style: italic; color: var(--ink-soft); }

.hint {
  display: block; margin-top: 16px; padding: 12px 16px; border-radius: 16px; text-decoration: none;
  color: var(--ink-soft); border: 1px dashed var(--line); font-size: .95rem;
}

/* Monat */
.month { margin-top: 34px; }
.month-head { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; margin-bottom: 8px; }
.month-head h2 { margin: 0; text-align: center; font-size: 1.15rem; font-weight: 600; }
.weekdays, .grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.weekdays span { text-align: center; font-size: .75rem; color: var(--ink-soft); padding-bottom: 4px; }
.cell {
  position: relative; aspect-ratio: 3 / 4; border-radius: 9px; background: var(--sheet) center / cover no-repeat;
  border: 1px solid var(--line); text-decoration: none; display: block;
}
.cell .num { position: absolute; left: 0; right: 0; bottom: 4px; text-align: center; font-size: .78rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.cell.has-entry { border-color: transparent; }
.cell.has-entry .num { color: #fff; font-weight: 600; text-shadow: 0 1px 3px rgba(0, 0, 0, .7); }
.cell.is-today { border: 2px solid var(--sun); }
.cell.is-future { opacity: .35; }
.count { text-align: center; color: var(--ink-soft); font-size: .9rem; margin: 14px 0 0; }

/* Kamera */
.cam { position: fixed; inset: 0; background: #000; color: #fff; overflow: hidden; }
.cam video { width: 100%; height: 100%; object-fit: cover; }
.cam video.mirror { transform: scaleX(-1); }
.cam-first {
  position: absolute; top: calc(env(safe-area-inset-top, 0) + 70px); left: 16px; width: 28%; aspect-ratio: 3 / 4;
  object-fit: cover; border: 3px solid #fff; border-radius: 14px;
}
.cam-close { position: absolute; top: calc(env(safe-area-inset-top, 0) + 12px); left: 12px; color: #fff; background: rgba(0, 0, 0, .35); }
.cam-hint {
  position: absolute; top: calc(env(safe-area-inset-top, 0) + 14px); left: 64px; right: 64px; margin: 0;
  text-align: center; font-weight: 600; font-size: 1.1rem; line-height: 40px; text-shadow: 0 1px 6px rgba(0, 0, 0, .6);
}
.cam-count {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
  font-size: 9rem; font-weight: 700; text-shadow: 0 4px 30px rgba(0, 0, 0, .5); font-variant-numeric: tabular-nums;
}
.shutter {
  position: absolute; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0) + 34px); translate: -50% 0;
  width: 84px; height: 84px; border-radius: 50%; cursor: pointer;
  background: var(--sun); border: 5px solid #fff; box-shadow: 0 0 0 3px rgba(0, 0, 0, .25);
}
.shutter:active { scale: .94; }
.shutter:disabled { opacity: .5; }
.cam-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.cam-flash.go { animation: flash .35s ease-out; }
@keyframes flash { from { opacity: .85; } to { opacity: 0; } }

/* Ersatz ohne Live-Kamera */
.lead { font-size: 1.02rem; color: var(--ink-soft); }
.picks { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pick {
  aspect-ratio: 3 / 4; border-radius: 20px; border: 1.5px dashed var(--line); background: var(--sheet) center / cover no-repeat;
  display: grid; place-items: end center; padding: 14px; cursor: pointer; text-align: center; font-weight: 600;
}
.pick input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.pick:focus-within { outline: 3px solid var(--sun); outline-offset: 3px; }
.pick.picked { border-style: solid; border-color: transparent; color: #fff; text-shadow: 0 1px 4px rgba(0, 0, 0, .8); }

/* Prüfen & Tag */
.review-photo { margin: 6px 0 22px; }
.note-label { display: block; font-weight: 600; margin-bottom: 8px; }
.note {
  width: 100%; resize: vertical; min-height: 8rem; padding: 14px 16px; border-radius: 18px;
  border: 1px solid var(--line); background: var(--sheet); color: var(--ink);
  font: 400 1.2rem/1.55 var(--text);
}
.note::placeholder { color: var(--ink-soft); font-style: italic; }
.note:focus { outline: none; border-color: var(--ink-soft); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 20px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--sheet); color: var(--ink);
  font: 600 1rem var(--ui); cursor: pointer; text-decoration: none;
}
.btn.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); flex: 1 1 100%; }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .45; cursor: default; }
.small { color: var(--ink-soft); font-size: .9rem; margin: 8px 0; }
.date + .small { margin-top: -12px; margin-bottom: 18px; }
.saved { min-height: 1.3em; }
.confirm { margin-top: 18px; padding: 16px; border-radius: 18px; border: 1px solid var(--danger); }
.confirm p { margin: 0; }

/* Einstellungen */
.group { padding: 20px 0; border-bottom: 1px solid var(--line); }
.group h2 { margin: 0 0 4px; font-size: 1.2rem; letter-spacing: -0.01em; }
.switch { display: flex; align-items: center; gap: 12px; margin: 16px 0; font-weight: 600; cursor: pointer; }
.switch input { width: 22px; height: 22px; accent-color: var(--ink); }
.window { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.window label { display: grid; gap: 4px; font-size: .9rem; color: var(--ink-soft); }
.window input {
  font: 500 1.05rem var(--ui); padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--sheet); color: var(--ink);
}
.foot { display: flex; flex-wrap: wrap; gap: 6px 18px; padding-top: 22px; color: var(--ink-soft); font-size: .9rem; }
.foot p { margin: 0; flex-basis: 100%; }

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

/* TEMPORÄR: Wünsche an Claude */
body:has(.wunsch-fab) { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0)); }
body.dark-stage .wunsch-fab { display: none; }
.wunsch-fab {
  position: fixed; right: max(16px, env(safe-area-inset-right, 0)); bottom: calc(16px + env(safe-area-inset-bottom, 0)); z-index: 20;
  min-height: 48px; padding: 0 20px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--ink); color: var(--paper); font: 600 1rem var(--ui); box-shadow: 0 8px 24px rgba(20, 23, 46, .28);
}
.wunsch-fab.busy::before {
  content: ""; display: inline-block; width: 14px; height: 14px; margin-right: 10px; vertical-align: -2px;
  border: 2px solid var(--sun); border-right-color: transparent; border-radius: 50%; animation: spin 1s linear infinite;
}
.wunsch-dialog {
  width: min(34rem, calc(100vw - 24px)); max-height: calc(100dvh - 40px); padding: 22px; border: 0; border-radius: 26px;
  background: var(--paper); color: var(--ink);
}
.wunsch-dialog::backdrop { background: rgba(20, 23, 46, .5); }
.wunsch-dialog h2, .wunsch-box h2 { margin: 0 0 6px; font-size: 1.4rem; letter-spacing: -0.02em; line-height: 1.15; }
.wunsch-history h3 { font-size: 1rem; margin: 24px 0 8px; }
.wunsch-history ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.wunsch-history li { font: 400 1.02rem/1.45 var(--text); }
.wunsch-history em { display: block; color: var(--ink-soft); }
.wunsch-tag { font: 600 .75rem var(--ui); padding: 2px 8px; border-radius: 999px; background: var(--sheet); border: 1px solid var(--line); margin-right: 4px; }
.wunsch-tag.s-fertig { background: var(--sun); color: #22264B; border-color: transparent; }
.wunsch-error { color: var(--danger); }
.wunsch-overlay {
  position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; overflow: auto;
  padding: calc(24px + env(safe-area-inset-top, 0)) 20px calc(24px + env(safe-area-inset-bottom, 0));
  background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(6px);
}
.wunsch-box { width: min(30rem, 100%); text-align: center; }
.wunsch-box .actions { justify-content: center; }
.wunsch-box .note { text-align: left; margin-top: 12px; }
.wunsch-box blockquote {
  margin: 16px 0; padding: 14px 16px; border-radius: 16px; background: var(--sheet); border: 1px solid var(--line);
  font: italic 400 1.1rem/1.5 var(--text); text-align: left;
}
.wunsch-reply { font: 400 1.1rem/1.5 var(--text); }
.wunsch-spinner {
  width: 72px; height: 72px; margin: 0 auto 22px; border-radius: 50%;
  background: radial-gradient(circle, var(--sun) 0 46%, transparent 47%);
  border: 4px solid color-mix(in srgb, var(--sun) 25%, transparent); border-top-color: var(--sun-deep);
  animation: spin 1.1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.wunsch-toast {
  position: fixed; left: 50%; translate: -50% 0; top: calc(16px + env(safe-area-inset-top, 0)); z-index: 40;
  width: min(30rem, calc(100vw - 32px)); padding: 14px 18px; border-radius: 18px; cursor: pointer;
  background: var(--ink); color: var(--paper); font: 400 1.05rem/1.45 var(--text); box-shadow: 0 10px 30px rgba(20, 23, 46, .3);
}
