:root {
  --bg: #060a12;
  --panel: #0c1420;
  --line: #1b2a3d;
  --text: #dbe7f5;
  --muted: #7d92ab;
  --accent: #4fd8ff;
  --accent-soft: rgba(79, 216, 255, 0.16);
  --warn: #ffb454;
  --danger: #ff6b7a;
  --orb: 132px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(900px 500px at 50% -10%, rgba(79, 216, 255, 0.10), transparent 70%),
    var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; cursor: pointer; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Anmeldung ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: min(360px, 100%); padding: 32px 28px; text-align: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
}
.login-card h1 { margin: 14px 0 2px; font-size: 20px; letter-spacing: 0.4em; text-indent: 0.4em; font-weight: 600; }
.login-card p { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.login-card input, .login-card button {
  width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); font-size: 16px;
}
.login-card input { background: var(--bg); color: var(--text); margin-bottom: 10px; }
.login-card input:focus { outline: none; border-color: var(--accent); }
.login-card button { background: var(--accent); color: #04121a; border-color: transparent; font-weight: 600; }
.login-card .error { margin: 12px 0 0; min-height: 1.4em; color: var(--danger); }
.mini-orb {
  width: 54px; height: 54px; margin: 0 auto; border-radius: 50%;
  background: radial-gradient(circle, #e9fbff 0 12%, var(--accent) 30%, transparent 62%);
  box-shadow: 0 0 34px rgba(79, 216, 255, 0.5);
}

/* ---------- App ---------- */
.app {
  height: 100dvh; max-width: 780px; margin: 0 auto;
  display: flex; flex-direction: column;
  padding: 0 14px env(safe-area-inset-bottom);
}

.bar { display: flex; align-items: center; gap: 12px; padding: 12px 2px 6px; }
.brand { font-size: 13px; font-weight: 600; letter-spacing: 0.38em; color: var(--accent); }
.status { flex: 1; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.actions { display: flex; gap: 4px; }
.actions button {
  width: 38px; height: 38px; display: grid; place-items: center;
  background: transparent; border: 1px solid transparent; border-radius: 10px; color: var(--muted);
}
.actions button:hover { color: var(--text); border-color: var(--line); }
#btnTts[aria-pressed="false"] .wave { display: none; }
#btnTts[aria-pressed="true"], #btnBell.on { color: var(--accent); }

.banner {
  margin: 6px 0; padding: 10px 14px; font-size: 14px;
  border: 1px solid rgba(255, 180, 84, 0.4); background: rgba(255, 180, 84, 0.08); color: var(--warn); border-radius: 10px;
}

.reminders { display: grid; gap: 8px; }
.reminder {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 14px; margin-top: 6px;
  background: var(--accent-soft); border: 1px solid rgba(79, 216, 255, 0.45); border-radius: 12px;
}
.reminder div { flex: 1; }
.reminder small { display: block; color: var(--muted); }
.reminder button { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--accent); background: transparent; color: var(--accent); }

/* ---------- Kern ---------- */
.stage { flex: none; display: grid; justify-items: center; padding: 10px 0 4px; }
.orb {
  position: relative; width: var(--orb); height: var(--orb);
  border: 0; border-radius: 50%; background: transparent; padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.orb:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; }
.ring, .core { position: absolute; border-radius: 50%; }
.ring { inset: 0; border: 2px solid transparent; }
.ring-a { border-top-color: var(--accent); border-bottom-color: rgba(79, 216, 255, 0.35); animation: spin 14s linear infinite; }
.ring-b { inset: 13%; border-left-color: rgba(79, 216, 255, 0.75); border-right-color: rgba(79, 216, 255, 0.2); animation: spin 9s linear infinite reverse; }
.ring-c { inset: 26%; border: 1px dashed rgba(79, 216, 255, 0.4); animation: spin 22s linear infinite; }
.core {
  inset: 36%;
  background: radial-gradient(circle, #f1fdff 0 18%, var(--accent) 48%, rgba(79, 216, 255, 0.25) 72%, transparent 78%);
  box-shadow: 0 0 34px rgba(79, 216, 255, 0.55);
  animation: breathe 4.5s ease-in-out infinite;
}
.hint { margin: 8px 0 0; font-size: 13px; color: var(--muted); min-height: 1.5em; text-align: center; }

body[data-mode="listening"] .core { animation: pulse 0.9s ease-in-out infinite; box-shadow: 0 0 60px rgba(79, 216, 255, 0.9); }
body[data-mode="listening"] .ring-a { animation-duration: 3s; }
body[data-mode="thinking"] .ring-a { animation-duration: 1.6s; }
body[data-mode="thinking"] .ring-b { animation-duration: 1.1s; }
body[data-mode="thinking"] .core { animation-duration: 1.4s; }
body[data-mode="speaking"] .core { animation: pulse 0.55s ease-in-out infinite; }
body[data-mode="speaking"] .ring-b { border-left-color: #fff; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 0%, 100% { transform: scale(0.94); opacity: 0.85; } 50% { transform: scale(1.04); opacity: 1; } }
@keyframes pulse { 0%, 100% { transform: scale(0.9); } 50% { transform: scale(1.18); } }

/* ---------- Verlauf ---------- */
.chat { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 2px 14px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.msg { max-width: 88%; padding: 10px 14px; border-radius: 14px; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: #14304a; border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.error { border-color: rgba(255, 107, 122, 0.5); color: var(--danger); }
.msg.pending:empty::after { content: "…"; color: var(--muted); animation: breathe 1.2s ease-in-out infinite; display: inline-block; }
.msg a { color: var(--accent); }
.msg code { font: 0.9em ui-monospace, SFMono-Regular, Consolas, monospace; background: rgba(255, 255, 255, 0.07); padding: 1px 5px; border-radius: 5px; }
.msg pre { margin: 8px 0 2px; padding: 10px; overflow-x: auto; background: #04070d; border: 1px solid var(--line); border-radius: 8px; }
.msg pre code { background: none; padding: 0; }
.divider { align-self: center; font-size: 12px; color: var(--muted); letter-spacing: 0.08em; padding: 6px 0; }
.empty { margin: auto; text-align: center; color: var(--muted); font-size: 14px; max-width: 30ch; }

/* ---------- Eingabe ---------- */
.composer { flex: none; display: flex; align-items: flex-end; gap: 8px; padding: 8px 0 14px; }
.composer textarea {
  flex: 1; resize: none; max-height: 160px; padding: 12px 14px; overflow-y: hidden;
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 14px;
  font: inherit;
}
.composer textarea:focus { outline: none; border-color: var(--accent); }
.composer button {
  width: 46px; height: 46px; flex: none; display: grid; place-items: center;
  border-radius: 14px; border: 0; background: var(--accent); color: #04121a;
}
.composer button:disabled { opacity: 0.4; cursor: default; }

@media (max-height: 620px) { :root { --orb: 84px; } .hint { display: none; } }
@media (min-width: 700px) { :root { --orb: 156px; } }

@media (prefers-reduced-motion: reduce) {
  .ring, .core, .msg.pending:empty::after { animation: none !important; }
}
