/* Jarvis-Web – dunkles HUD-Design, für Handys gebaut */
:root {
  --bg: #05080d;
  --bg-2: #0a111a;
  --panel: rgba(14, 24, 36, .72);
  --line: rgba(79, 209, 255, .18);
  --line-strong: rgba(79, 209, 255, .45);
  --cyan: #4fd1ff;
  --cyan-soft: #9be6ff;
  --amber: #ffb547;
  --red: #ff6b6b;
  --text: #e6f4ff;
  --muted: #7f9bb3;
  --radius: 18px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(79, 209, 255, .14), transparent 60%),
    radial-gradient(80% 50% at 50% 120%, rgba(79, 209, 255, .08), transparent 60%),
    linear-gradient(var(--bg), var(--bg-2));
  background-attachment: fixed;
  color: var(--text);
  font: 16px/1.5 Roboto, system-ui, -apple-system, "Segoe UI", "Noto Sans", "DejaVu Sans", sans-serif;
  overscroll-behavior: none;
}
/* feines HUD-Raster */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .35;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(70% 50% at 50% 30%, #000 0%, transparent 75%);
}
button { font: inherit; color: inherit; cursor: pointer; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.wordmark { font-weight: 600; letter-spacing: .32em; color: var(--cyan-soft); text-shadow: 0 0 18px rgba(79, 209, 255, .45); }
.wordmark--small { font-size: 13px; letter-spacing: .28em; }

/* ---------- Arc Reactor ---------- */
.reactor { position: relative; border-radius: 50%; display: grid; place-items: center; }
.reactor i, .reactor b { position: absolute; border-radius: 50%; }
.reactor i:nth-child(1) { inset: 0; border: 2px solid var(--cyan); box-shadow: 0 0 22px rgba(79, 209, 255, .55), inset 0 0 18px rgba(79, 209, 255, .35); }
.reactor i:nth-child(2) { inset: 14%; border: 2px dashed rgba(79, 209, 255, .65); animation: spin 14s linear infinite; }
.reactor i:nth-child(3) { inset: 26%; border: 1px solid rgba(79, 209, 255, .4); animation: spin 9s linear infinite reverse; }
.reactor b { inset: 36%; background: radial-gradient(circle, #e9fbff 0%, var(--cyan) 45%, rgba(79, 209, 255, .2) 75%); box-shadow: 0 0 30px var(--cyan); animation: breathe 3.2s ease-in-out infinite; }
.reactor--big { width: 132px; height: 132px; margin-bottom: 26px; }
.reactor--hero { width: 150px; height: 150px; margin: 0 auto 26px; }
.reactor--mini { width: 34px; height: 34px; }
.reactor--mini i:nth-child(1) { border-width: 1.5px; box-shadow: 0 0 10px rgba(79, 209, 255, .5); }
.reactor--mini i:nth-child(2) { border-width: 1.5px; }

/* Zustände */
.is-listening .reactor b { animation: listen .7s ease-in-out infinite; background: radial-gradient(circle, #fff 0%, var(--cyan) 50%, transparent 75%); }
.is-listening .reactor i:nth-child(2) { animation-duration: 2.5s; }
.is-thinking .reactor i:nth-child(2) { animation-duration: 1.6s; }
.is-thinking .reactor i:nth-child(3) { animation-duration: 1.1s; }
.is-speaking .reactor b { animation: speak .45s ease-in-out infinite alternate; }
.is-error .reactor i:nth-child(1) { border-color: var(--red); box-shadow: 0 0 22px rgba(255, 107, 107, .5); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 50% { transform: scale(.88); opacity: .85; } }
@keyframes listen { 50% { transform: scale(1.18); } }
@keyframes speak { from { transform: scale(.85); } to { transform: scale(1.12); } }

/* ---------- Anmeldung ---------- */
.login { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; }
.login .wordmark { font-size: 26px; margin: 0; }
.login__hint { color: var(--muted); margin: 6px 0 30px; letter-spacing: .08em; }
.login__form { display: flex; flex-direction: column; gap: 12px; width: min(340px, 100%); }
.login__form input {
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: 14px; color: var(--text);
  padding: 14px 16px; font-size: 16px; text-align: center; letter-spacing: .1em; outline: none;
}
.login__form input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(79, 209, 255, .18); }
.login__form button, .chip {
  background: linear-gradient(180deg, rgba(79, 209, 255, .22), rgba(79, 209, 255, .08));
  border: 1px solid var(--line-strong); border-radius: 14px; padding: 13px 16px; font-weight: 600; letter-spacing: .06em;
}
.login__error { color: var(--red); min-height: 1.5em; margin-top: 14px; }

/* ---------- App ---------- */
.app { height: 100dvh; display: flex; flex-direction: column; }
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + var(--safe-t)) 16px 10px; border-bottom: 1px solid var(--line);
  background: rgba(5, 8, 13, .7); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.top__id { display: flex; align-items: center; gap: 12px; }
.status { font-size: 12px; color: var(--muted); letter-spacing: .06em; }
.status::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #3ddc97; margin-right: 6px; box-shadow: 0 0 8px #3ddc97; vertical-align: 1px; }
.is-thinking .status::before, .is-listening .status::before { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.is-error .status::before { background: var(--red); box-shadow: 0 0 8px var(--red); }
.top__actions { display: flex; gap: 6px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid transparent; background: transparent; color: var(--muted); display: grid; place-items: center; }
.icon-btn:active, .icon-btn:hover { border-color: var(--line); color: var(--cyan-soft); }
.icon-btn[aria-pressed="true"] { color: var(--cyan); border-color: var(--line-strong); background: rgba(79, 209, 255, .1); }
.icon-btn[aria-pressed="false"] .wave { opacity: .25; }

.scroller { flex: 1; overflow-y: auto; padding: 18px 16px 8px; scroll-behavior: smooth; }
.empty { text-align: center; padding-top: 6vh; }
.empty__greet { font-size: 24px; margin: 0; font-weight: 600; }
.empty__sub { color: var(--muted); margin: 4px 0 26px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.chip { font-weight: 500; font-size: 14px; padding: 10px 14px; border-radius: 999px; }

.messages { list-style: none; margin: 0 auto; padding: 0; display: flex; flex-direction: column; gap: 14px; max-width: 760px; }
.msg { max-width: 88%; padding: 11px 15px; border-radius: var(--radius); word-wrap: break-word; overflow-wrap: anywhere; animation: rise .25s ease-out; }
.msg--user { align-self: flex-end; background: linear-gradient(180deg, rgba(79, 209, 255, .26), rgba(79, 209, 255, .14)); border: 1px solid rgba(79, 209, 255, .35); border-bottom-right-radius: 6px; }
.msg--assistant { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); border-bottom-left-radius: 6px; box-shadow: inset 2px 0 0 var(--cyan); backdrop-filter: blur(6px); }
.msg--notice { align-self: center; color: var(--muted); font-size: 13px; padding: 4px 10px; }
.msg--error { align-self: center; color: var(--red); font-size: 14px; border: 1px solid rgba(255, 107, 107, .35); background: rgba(255, 107, 107, .08); }
.msg p { margin: 0 0 .6em; } .msg p:last-child { margin-bottom: 0; }
.msg ul, .msg ol { margin: .3em 0 .6em; padding-left: 1.3em; }
.msg code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .88em; background: rgba(79, 209, 255, .1); padding: 1px 5px; border-radius: 6px; }
.msg pre { background: rgba(0, 0, 0, .45); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; overflow-x: auto; margin: .4em 0 .7em; }
.msg pre code { background: none; padding: 0; font-size: 13px; }
.msg a { color: var(--cyan); }
.msg strong { color: #fff; }
.tools { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tool { font-size: 12px; color: var(--amber); border: 1px solid rgba(255, 181, 71, .35); background: rgba(255, 181, 71, .08); border-radius: 999px; padding: 2px 9px; letter-spacing: .03em; }
.typing { display: inline-flex; gap: 5px; padding: 4px 0; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); opacity: .4; animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 50% { opacity: 1; transform: translateY(-2px); } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

/* ---------- Eingabe ---------- */
.composer {
  display: flex; align-items: flex-end; gap: 10px; padding: 10px 12px calc(12px + var(--safe-b));
  border-top: 1px solid var(--line); background: rgba(5, 8, 13, .82); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.composer textarea {
  flex: 1; resize: none; max-height: 140px; min-height: 48px; background: var(--panel); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: 24px; padding: 12px 16px; font: inherit; outline: none;
}
.composer textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(79, 209, 255, .15); }
.send, .mic { flex: none; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; position: relative; }
.send { background: var(--cyan); color: #04121c; border: none; }
.send svg { fill: currentColor; stroke: none; }
.mic { background: radial-gradient(circle at 50% 40%, rgba(79, 209, 255, .35), rgba(79, 209, 255, .08)); border: 1.5px solid var(--cyan); color: var(--cyan-soft); box-shadow: 0 0 18px rgba(79, 209, 255, .35); }
.mic__ring { position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--cyan); opacity: 0; }
.is-listening .mic { background: var(--cyan); color: #04121c; }
.is-listening .mic__ring { animation: ring 1.2s ease-out infinite; }
@keyframes ring { from { opacity: .8; transform: scale(.9); } to { opacity: 0; transform: scale(1.35); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; }
}
@media (min-width: 900px) { .scroller { padding: 26px 24px 10px; } }
