:root {
  --bg: #ffffff;
  --ink: #1f1f1e;
  --muted: #8d8d8a;
  --rule: #ececea;
  --card: #f5f5f3;
  --card-line: #e4e4e1;
  --pill: #e9e9e6;
  --accent: #d4593a;
  --accent-ink: #ffffff;
  --font: ui-sans-serif, -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1f1f1e;
    --ink: #ecebe7;
    --muted: #8f8e89;
    --rule: #2f2f2d;
    --card: #2c2c2a;
    --card-line: #3a3a37;
    --pill: #3a3a37;
    --accent: #c9603f;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; overflow: hidden; }
body {
  background: var(--bg); color: var(--ink);
  font: 400 17px/1.45 var(--font);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* Gesamtlayout: Log füllt den Platz, Eingabe klebt unten (auch über der Tastatur) */
.app {
  height: var(--app-h, 100dvh);
  display: flex; flex-direction: column;
  max-width: 680px; margin: 0 auto;
  padding: env(safe-area-inset-top) 12px 0;
}
.log { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 8px 8px 16px; overscroll-behavior: contain; display: flex; flex-direction: column; }
.log .inner { margin-top: auto; } /* wenige Einträge stehen unten über der Eingabe */

/* Einträge */
.entries { list-style: none; padding: 0; }
.day { font-size: 13px; font-weight: 600; color: var(--muted); padding: 18px 0 4px; }
.day:first-child { padding-top: 4px; }
.entry { display: grid; grid-template-columns: 46px 1fr; gap: 0 10px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.entry:last-child, .entry:has(+ .day) { border-bottom: 0; }
.entry time { font-size: 13px; color: var(--muted); padding-top: 2px; font-variant-numeric: tabular-nums; }
.entry .body { min-width: 0; display: grid; gap: 8px; }
.entry p { white-space: pre-wrap; overflow-wrap: anywhere; }
.entry p.pending { color: var(--muted); font-size: 15px; animation: pulse 1.6s ease-in-out infinite; }
.entry img { max-width: 100%; max-height: 280px; border-radius: 12px; display: block; cursor: zoom-in; justify-self: start; }
.entry.editing { background: var(--card); margin: 0 -8px; padding: 10px 8px; border-radius: 14px; border-bottom-color: transparent; }
.entry textarea.edit { display: block; width: 100%; border: 0; outline: none; resize: none; background: none; font: inherit; color: inherit; caret-color: var(--accent); padding: 0; overflow: hidden; }
.entry .actions { grid-column: 2; display: flex; gap: 18px; margin-top: 10px; }
.entry .actions button { font: inherit; font-size: 15px; background: none; border: 0; padding: 0; cursor: pointer; }
.entry .actions .save { color: var(--accent); font-weight: 600; }
.entry .actions .del { color: var(--muted); }
.entry.new { animation: fadein .4s ease-out; }
@keyframes fadein { from { opacity: 0; transform: translateY(-6px); } }
.play { display: inline-flex; align-items: center; gap: 8px; justify-self: start; font: inherit; font-size: 15px; color: var(--ink); background: var(--pill); border: 0; border-radius: 999px; padding: 6px 14px 6px 10px; cursor: pointer; font-variant-numeric: tabular-nums; }
.play svg { width: 16px; height: 16px; }
.play.on { color: var(--accent); }
.more { height: 1px; }

/* Eingabe (Karte mit Textfeld und Leiste) */
.composer {
  background: var(--card); border: 1px solid var(--card-line); border-radius: 26px;
  padding: 14px 12px 10px 16px; margin-bottom: max(10px, env(safe-area-inset-bottom));
}
textarea {
  display: block; width: 100%; border: 0; outline: none; resize: none; background: none;
  font: inherit; font-size: 18px; color: inherit; caret-color: var(--accent);
  min-height: 28px; max-height: 40vh; padding: 0 4px 0 0; overflow-y: auto;
}
textarea::placeholder { color: var(--muted); }

/* Eingeklappt (beim Öffnen): eine Zeile wie in Claude */
.composer.compact { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 20px; border-radius: 999px; }
.composer.compact textarea { flex: 1; height: 28px; overflow: hidden; white-space: nowrap; }
.composer.compact .row { margin-top: 0; }
.composer.compact .pill, .composer.compact .grow { display: none; }

.row { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.grow { flex: 1; }
.pill {
  background: var(--pill); border-radius: 999px; padding: 7px 14px; font-size: 15px;
  font-variant-numeric: tabular-nums; white-space: nowrap; margin-left: -4px;
}
.pill .sub { color: var(--muted); margin-left: 6px; }
.pill.rec, .pill.err { color: var(--accent); }
.round {
  width: 42px; height: 42px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: var(--pill); color: var(--ink); cursor: pointer; padding: 0; flex: none;
}
.round.active { background: var(--accent); color: var(--accent-ink); }
.round.active svg { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.send { background: var(--accent); color: var(--accent-ink); transition: opacity .15s; }
.send:disabled { opacity: .45; cursor: default; }
.send .tick { display: none; }
.send.done .arrow { display: none; }
.send.done .tick { display: block; }
.send.done { opacity: 1; }

dialog { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; }
dialog::backdrop { background: color-mix(in srgb, var(--bg) 95%, transparent); }
dialog img { max-width: 94vw; max-height: 92vh; display: block; border-radius: 12px; }

/* Login: gleiche Eingabekarte unten */
.login-page .app { justify-content: flex-end; }
.login input {
  display: block; width: 100%; border: 0; outline: none; background: none;
  font: inherit; font-size: 18px; color: inherit; caret-color: var(--accent); height: 28px;
}
