:root {
  --bg: #f5f5f7;
  --card: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --faint: #aeaeb2;
  --line: rgba(0, 0, 0, 0.08);
  --accent: #0071e3;
  --heart: #ff375f;
  --danger: #d70015;
  --radius: 22px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 10px 30px rgba(0, 0, 0, 0.05);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue",
    "Segoe UI", Roboto, system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #1c1c1e;
    --text: #f5f5f7;
    --muted: #98989d;
    --faint: #636366;
    --line: rgba(255, 255, 255, 0.12);
    --accent: #0a84ff;
    --heart: #ff4d73;
    --danger: #ff6961;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.47 var(--font);
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 28px) 20px calc(env(safe-area-inset-bottom) + 48px);
}
.wrap.narrow { max-width: 400px; }

.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }

/* ---------- Kopfbereich ---------- */
.top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}
.title {
  margin: 0;
  font-size: 34px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.022em;
}
.date { margin: 4px 0 0; color: var(--muted); font-size: 15px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 980px;
  background: var(--card);
  box-shadow: var(--shadow);
  font-weight: 600;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pill.pending { opacity: 0.55; }

/* ---------- Karten ---------- */
.card {
  margin: 16px 0 0;
  padding: 20px 22px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.entry {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.entry .body { flex: 1; min-width: 0; }
.entry + .entry {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.entry-text {
  margin: 0;
  font-size: 22px;
  line-height: 1.32;
  font-weight: 500;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.entry-text.empty { color: var(--faint); font-weight: 400; }

/* ---------- Eingabe ---------- */
textarea {
  display: block;
  width: 100%;
  min-height: 84px;
  padding: 0;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: var(--text);
  font: 500 22px/1.32 var(--font);
  letter-spacing: -0.01em;
}
textarea::placeholder { color: var(--faint); }

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}
.row.end { justify-content: flex-end; }
.hint { flex: 1; color: var(--muted); font-size: 13px; }
.count { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

.btn {
  appearance: none;
  border: 0;
  border-radius: 980px;
  padding: 10px 20px;
  font: 600 15px var(--font);
  cursor: pointer;
  transition: opacity 0.15s, filter 0.15s;
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.primary:disabled { opacity: 0.35; cursor: not-allowed; filter: none; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.ghost:hover { opacity: 0.7; }
.btn.block { width: 100%; padding: 13px 20px; margin-top: 14px; font-size: 16px; }
.btn:focus-visible, .heart:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.error { margin: 10px 0 0; color: var(--danger); font-size: 14px; }
.error:empty { display: none; }

/* ---------- Verborgener Satz der anderen Person ---------- */
.skeleton {
  display: grid;
  gap: 10px;
  margin: 12px 0 14px;
  filter: blur(7px);
  opacity: 0.6;
  user-select: none;
  pointer-events: none;
}
.skeleton i { display: block; height: 16px; border-radius: 8px; background: var(--text); opacity: 0.25; }
.skeleton i:nth-child(2) { width: 72%; }

/* ---------- Herz ---------- */
.heart {
  appearance: none;
  flex: none;
  margin: -6px;
  padding: 6px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--faint);
  line-height: 0;
  cursor: pointer;
}
.heart svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
  transition: transform 0.15s;
}
.heart[aria-pressed="true"] { color: var(--heart); }
.heart[aria-pressed="true"] svg { fill: currentColor; }
.heart:active svg { transform: scale(0.82); }
.heart.static { cursor: default; pointer-events: none; }
.heart.static svg { width: 20px; height: 20px; fill: currentColor; stroke: none; }

/* ---------- Verlauf ---------- */
.section-title {
  margin: 44px 4px 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.day-title { margin: 0 0 12px; color: var(--muted); font-size: 13px; font-weight: 600; }
#history .entry-text { font-size: 17px; font-weight: 400; line-height: 1.4; letter-spacing: 0; }
#history .more { display: block; margin: 12px auto 0; }

.foot { margin-top: 40px; color: var(--muted); font-size: 13px; text-align: center; }
.foot .btn { padding: 4px 6px; font-size: 13px; font-weight: 500; }

/* ---------- Login ---------- */
.login { margin-top: 16vh; }
.login-title { margin: 0 0 4px; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.login p { margin: 0 0 14px; }
.login input {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: 17px var(--font);
}

/* ---------- Bestätigungsdialog ---------- */
dialog {
  width: 100%;
  max-width: min(420px, calc(100vw - 40px));
  padding: 24px;
  border: 0;
  border-radius: 26px;
  background: var(--card);
  color: var(--text);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.3);
}
dialog::backdrop {
  background: rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
dialog h2 { margin: 0 0 12px; font-size: 22px; letter-spacing: -0.01em; }
.quote {
  margin: 0 0 12px;
  padding-left: 14px;
  border-left: 3px solid var(--line);
  font-size: 19px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
dialog .muted { margin: 0; }
