/* FELINA – HUD-Oberfläche: Graphit, Glas, eine Akzentfarbe (im Menü wählbar). */
:root {
  --bg: #0b0f15;
  --bg-2: #111821;
  --surface: rgba(18, 25, 34, .74);
  --surface-solid: #121a24;
  --surface-2: rgba(255, 255, 255, .045);
  --line: rgba(148, 163, 184, .16);
  --line-strong: rgba(148, 163, 184, .3);
  --text: #e7edf4;
  --muted: #93a1b3;
  --dim: #5d6a7b;
  --bad: #ff8a65;
  --acc-rgb: 92, 200, 255;
  --acc: rgb(var(--acc-rgb));
  --acc-soft: rgba(var(--acc-rgb), .14);
  --acc-ink: #06131c;
  --radius: 14px;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
  color-scheme: dark;
}
/* Akzentfarben */
[data-accent="eis"]     { --acc-rgb: 92, 200, 255;  --acc-ink: #06131c; }
[data-accent="machine"] { --acc-rgb: 245, 190, 70;  --acc-ink: #1d1503; }
[data-accent="violett"] { --acc-rgb: 167, 139, 250; --acc-ink: #120a26; }
[data-accent="mint"]    { --acc-rgb: 74, 222, 154;  --acc-ink: #04170e; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15.5px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
::selection { background: var(--acc); color: var(--acc-ink); }

.label {
  font-family: var(--mono); text-transform: uppercase; letter-spacing: .16em;
  font-size: 11px; font-weight: 400; color: var(--muted);
}

/* --- Hintergrund --- */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden;
  background:
    radial-gradient(ellipse at 50% -10%, var(--bg-2), transparent 60%),
    linear-gradient(var(--bg), var(--bg));
}
.bg::before { /* Raster */
  content: ""; position: absolute; inset: -50%;
  background-image:
    linear-gradient(rgba(148, 163, 184, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, .05) 1px, transparent 1px);
  background-size: 36px 36px;
  -webkit-mask: radial-gradient(circle at 50% 40%, #000 0, transparent 70%);
  mask: radial-gradient(circle at 50% 40%, #000 0, transparent 70%);
  animation: grid-drift 60s linear infinite;
}
@keyframes grid-drift { to { transform: translate(36px, 36px); } }
.bg__glow { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; filter: blur(60px); opacity: .15; }
.bg__glow--a { background: radial-gradient(circle, rgba(var(--acc-rgb), .55), transparent 65%); top: -25vmax; left: -15vmax; animation: drift-a 26s ease-in-out infinite alternate; }
.bg__glow--b { background: radial-gradient(circle, rgba(120, 140, 255, .35), transparent 65%); bottom: -30vmax; right: -20vmax; animation: drift-b 32s ease-in-out infinite alternate; }
@keyframes drift-a { to { transform: translate(18vmax, 10vmax); } }
@keyframes drift-b { to { transform: translate(-14vmax, -12vmax); } }
.bg__scan {
  position: absolute; left: 0; right: 0; height: 120px; top: -120px;
  background: linear-gradient(transparent, rgba(var(--acc-rgb), .05), transparent);
  animation: scanline 9s linear infinite;
}
@keyframes scanline { to { transform: translateY(calc(100vh + 240px)); } }

/* --- Kern (animierte Ringe) --- */
.core { position: relative; flex: none; }
.core svg { width: 100%; height: 100%; display: block; overflow: visible; }
.core .r { transform-box: fill-box; transform-origin: center; fill: none; }
.core .r-ticks { stroke: var(--line-strong); animation: spin 40s linear infinite; }
.core .r-arc { stroke: var(--acc); animation: spin 14s linear infinite reverse; filter: drop-shadow(0 0 4px rgba(var(--acc-rgb), .6)); }
.core .r-dash { stroke: rgba(var(--acc-rgb), .45); animation: spin 22s linear infinite; }
.core .r-glow { stroke: none; animation: pulse 3.2s ease-in-out infinite; }
.core stop { stop-color: var(--acc); }
.core .r-tri { fill: var(--acc); filter: drop-shadow(0 0 6px rgba(var(--acc-rgb), .8)); }
.core.busy .r-arc { animation-duration: 1.6s; }
.core.busy .r-dash { animation-duration: 2.8s; }
.core.busy .r-glow { animation-duration: .9s; }
.core.offline .r-arc, .core.offline .r-tri { stroke: var(--dim); fill: var(--dim); filter: none; }
.core.offline .r-arc { fill: none; animation-play-state: paused; }
.core.offline .r-glow { opacity: .15; animation: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: .55; transform: scale(.92); } 50% { opacity: 1; transform: scale(1.05); } }
.core--mini { width: 38px; height: 38px; }
.core--login { width: 150px; height: 150px; }
.core--hero { width: min(220px, 52vw); height: min(220px, 52vw); }

/* --- Karten & Knöpfe --- */
.card {
  position: relative; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.btn {
  position: relative; overflow: hidden;
  height: 42px; padding: 0 16px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 10px;
  font: 11.5px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase;
  transition: border-color .2s, background .2s, transform .1s;
}
.btn:hover:not(:disabled) { border-color: var(--acc); }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; }
.btn::after { /* Lichtstreifen beim Drüberfahren */
  content: ""; position: absolute; inset: 0; transform: translateX(-120%);
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .18) 50%, transparent 70%);
}
.btn:hover::after { transition: transform .6s; transform: translateX(120%); }
.btn--primary { background: var(--acc); border-color: var(--acc); color: var(--acc-ink); font-weight: 600; height: 46px; }
.btn--primary:hover:not(:disabled) { box-shadow: 0 0 24px rgba(var(--acc-rgb), .45); }
.btn--quiet { background: transparent; color: var(--muted); }
.notice { margin: 2px 0 0; font: 11.5px/1.4 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--bad); text-align: center; }
.notice.granted { color: var(--acc); }

/* --- Login --- */
.login {
  height: 100%; overflow-y: auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: calc(24px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
  text-align: center;
}
.login__title { margin: 22px 0 0; font: 400 28px/1 var(--mono); letter-spacing: .55em; padding-left: .55em; }
.login__card { width: min(340px, 100%); display: grid; gap: 16px; margin-top: 26px; text-align: left; }
.field { display: grid; gap: 8px; }
.field input {
  height: 46px; padding: 0 14px; border-radius: 10px; outline: none;
  background: rgba(0, 0, 0, .25); border: 1px solid var(--line-strong);
  font: 16px var(--mono); letter-spacing: .2em; transition: border-color .2s, box-shadow .2s;
}
.field input:focus { border-color: var(--acc); box-shadow: 0 0 0 3px rgba(var(--acc-rgb), .15); }

/* --- App-Layout --- */
/* dvh: auf dem iPhone die wirklich sichtbare Höhe, sonst bleibt unten eine Lücke */
.app { height: 100%; height: 100dvh; display: flex; flex-direction: column; max-width: 1240px; margin: 0 auto; }
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: calc(12px + env(safe-area-inset-top)) 18px 10px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.brand > div:last-child { min-width: 0; }
.brand__name { font: 500 15px/1 var(--mono); letter-spacing: .48em; }
.brain {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 7px; white-space: nowrap;
  background: none; border: 0; padding: 0; cursor: pointer;
  font: 10.5px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
  max-width: 100%;
}
#brain-label { overflow: hidden; text-overflow: ellipsis; }
.brain.offline { color: var(--bad); }
.hud { display: none; gap: 28px; margin-left: auto; }
.hud__item { display: grid; gap: 4px; text-align: right; }
.hud__value { font: 13px/1 var(--mono); letter-spacing: .1em; color: var(--text); font-variant-numeric: tabular-nums; }
.icon-btn {
  width: 42px; height: 42px; display: grid; place-items: center; cursor: pointer; flex: none;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px;
  transition: border-color .2s;
}
.icon-btn:hover, .icon-btn[aria-expanded="true"] { border-color: var(--acc); color: var(--acc); }

/* Signalbalken */
.signal { display: inline-flex; align-items: flex-end; gap: 2px; height: 10px; }
.signal i { width: 3px; background: var(--dim); border-radius: 1px; height: 30%; }
.signal i:nth-child(2) { height: 55%; } .signal i:nth-child(3) { height: 80%; } .signal i:nth-child(4) { height: 100%; }
.online .signal i, .stat.online .signal i { background: var(--acc); animation: bars 1.6s ease-in-out infinite; }
.signal i:nth-child(2) { animation-delay: .15s !important; } .signal i:nth-child(3) { animation-delay: .3s !important; }
.signal i:nth-child(4) { animation-delay: .45s !important; } .signal i:nth-child(5) { animation-delay: .6s !important; }
@keyframes bars { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.signal--big { height: 28px; gap: 3px; }
.signal--big i { width: 5px; }
.signal--big i:nth-child(1) { height: 20%; } .signal--big i:nth-child(2) { height: 40%; } .signal--big i:nth-child(3) { height: 60%; }
.signal--big i:nth-child(4) { height: 80%; } .signal--big i:nth-child(5) { height: 100%; }

/* Lineal mit laufendem Kopf */
.ticks {
  position: relative; height: 8px; margin: 0 18px; flex: none;
  border-top: 1px solid var(--line);
  background: repeating-linear-gradient(90deg, var(--line-strong) 0 1px, transparent 1px 24px);
  -webkit-mask: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  mask: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  transform-origin: center; animation: grow .8s cubic-bezier(.2, .8, .2, 1) both;
}
.ticks__head {
  position: absolute; top: -1px; left: 0; width: 80px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--acc), transparent);
  animation: playhead 6s ease-in-out infinite alternate;
}
@keyframes playhead { to { left: calc(100% - 80px); } }
@keyframes grow { from { transform: scaleX(0); } }

.main { flex: 1; min-height: 0; display: flex; gap: 18px; padding: 12px 18px 0; position: relative; }
.chat { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* --- Seitenleiste / Schublade --- */
.panel {
  display: flex; flex-direction: column; gap: 12px; overflow-y: auto;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}
.panel h2 { margin: 0 0 12px; display: flex; justify-content: space-between; }
.count { color: var(--acc); letter-spacing: .1em; }
.stat { display: flex; align-items: center; gap: 14px; }
.stat__value { font: 13px/1.3 var(--mono); letter-spacing: .14em; text-transform: uppercase; }
.stat__sub { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.stat.offline .stat__value { color: var(--bad); }
.meter { height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; margin: -4px 0 10px; }
.meter i { display: block; height: 100%; width: 0; background: var(--acc); transition: width .8s cubic-bezier(.2, .8, .2, 1); box-shadow: 0 0 8px var(--acc); }
.integrations { list-style: none; margin: 0; padding: 0; }
.integrations li {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px;
  animation: row-in .35s ease-out both; animation-delay: calc(var(--i, 0) * 35ms);
}
.integrations li:last-child { border-bottom: 0; }
.integrations small { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.35; }
.state { display: inline-flex; align-items: center; gap: 6px; font: 10px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--dim); white-space: nowrap; }
.state::before { content: ""; width: 6px; height: 6px; border-radius: 50%; border: 1px solid currentColor; }
.state--verbunden, .state--abrufbar, .state--überprüft { color: var(--acc); }
.state--abrufbar::before, .state--überprüft::before { background: currentColor; box-shadow: 0 0 6px currentColor; }
@keyframes row-in { from { opacity: 0; transform: translateX(-8px); } }
.models { display: grid; gap: 8px; }
.model {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  width: 100%; padding: 10px 12px; cursor: pointer; text-align: left;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
  transition: border-color .2s, background .2s;
}
.model:hover:not(:disabled) { border-color: var(--line-strong); }
.model__name { font: 12px/1.3 var(--mono); letter-spacing: .14em; text-transform: uppercase; }
.model small { display: block; color: var(--muted); font: 10.5px/1.4 var(--mono); overflow-wrap: anywhere; margin-top: 3px; }
.model__dot { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--dim); flex: none; transition: all .2s; }
.model[aria-checked="true"] { border-color: var(--acc); background: var(--acc-soft); }
.model[aria-checked="true"] .model__dot { border-color: var(--acc); background: radial-gradient(circle, var(--acc) 40%, transparent 46%); box-shadow: 0 0 8px rgba(var(--acc-rgb), .6); }
.model:disabled { opacity: .45; cursor: default; }
.accents { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch {
  display: grid; justify-items: center; gap: 6px; cursor: pointer;
  background: none; border: 0; padding: 0; font: 9.5px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}
.swatch i { width: 30px; height: 30px; border-radius: 50%; background: var(--c); border: 2px solid transparent; box-shadow: inset 0 0 0 3px var(--surface-solid); transition: transform .2s, box-shadow .2s; }
.swatch:hover i { transform: scale(1.08); }
.swatch[aria-checked="true"] { color: var(--text); }
.swatch[aria-checked="true"] i { border-color: var(--c); box-shadow: inset 0 0 0 3px var(--surface-solid), 0 0 14px var(--c); }
.panel__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.panel__actions .btn { flex: 1; }
.scrim { display: none; }

/* Handy & Tablet: Schublade von rechts */
@media (max-width: 999px) {
  .panel {
    position: fixed; z-index: 5; top: 0; right: 0; bottom: 0; width: min(360px, 88vw);
    padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
    background: rgba(11, 15, 21, .94); border-left: 1px solid var(--line);
    -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
    transform: translateX(105%); transition: transform .35s cubic-bezier(.2, .8, .2, 1);
  }
  .app.drawer-open .panel { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 4; background: rgba(0, 0, 0, .45); opacity: 0; pointer-events: none; transition: opacity .3s; }
  .app.drawer-open .scrim { opacity: 1; pointer-events: auto; }
}
/* Desktop: einklappbare Seitenleiste, HUD oben */
@media (min-width: 1000px) {
  .panel {
    width: 320px; flex: none;
    transition: width .4s cubic-bezier(.2, .8, .2, 1), margin .4s cubic-bezier(.2, .8, .2, 1), opacity .25s, transform .4s cubic-bezier(.2, .8, .2, 1);
  }
  .panel > * { min-width: 320px; }
  .app.sidebar-collapsed .panel { width: 0; margin-left: -18px; opacity: 0; transform: translateX(24px); overflow: hidden; pointer-events: none; }
  .hud { display: flex; }
}

/* --- Nachrichten --- */
.messages {
  flex: 1; min-height: 0; overflow-y: auto; padding: 8px 4px 16px;
  display: flex; flex-direction: column; gap: 16px;
  overscroll-behavior: contain;
}
.empty { margin: auto; display: grid; justify-items: center; gap: 22px; text-align: center; padding: 16px 0; }
.empty__words { font: 14px/1 var(--mono); letter-spacing: .32em; text-transform: uppercase; }
.w-step { display: inline-block; opacity: 0; animation: flicker .5s steps(1) forwards; animation-delay: calc(var(--i) * 380ms + 500ms); }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 520px; }
.chip {
  padding: 8px 12px; border-radius: 999px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); font-size: 13px; color: var(--muted);
  opacity: 0; animation: rise .5s ease-out forwards; animation-delay: calc(var(--i) * 90ms + 1.6s);
  transition: border-color .2s, color .2s;
}
.chip:hover { border-color: var(--acc); color: var(--text); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.msg { max-width: min(680px, 92%); overflow-wrap: anywhere; position: relative; animation: rise .35s ease-out both; }
.msg__who { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.msg__who .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--acc); box-shadow: 0 0 8px var(--acc); }
.msg__meta { margin-left: auto; padding-left: 12px; color: var(--dim); }
.msg--assistant { align-self: flex-start; }
.msg--assistant .msg__card { padding: 14px 16px; }
.msg--assistant .msg__card::before, .msg--assistant .msg__card::after { /* kleine Eckmarken */
  content: ""; position: absolute; width: 8px; height: 8px; border: 1px solid rgba(var(--acc-rgb), .6);
}
.msg--assistant .msg__card::before { top: 6px; left: 6px; border-right: 0; border-bottom: 0; }
.msg--assistant .msg__card::after { bottom: 6px; right: 6px; border-left: 0; border-top: 0; }
.msg--user { align-self: flex-end; }
.msg--user .msg__who { justify-content: flex-end; }
.msg--user .msg__card {
  padding: 10px 14px; white-space: pre-wrap;
  background: rgba(var(--acc-rgb), .1); border-color: rgba(var(--acc-rgb), .28);
  border-bottom-right-radius: 4px;
}
.msg__body p { margin: 0 0 10px; }
.msg__body p:last-child { margin-bottom: 0; }
.msg__body ul, .msg__body ol { margin: 0 0 10px; padding-left: 20px; }
.msg__body li::marker { color: var(--acc); }
.msg__body strong { color: #fff; font-weight: 600; }
.msg__body code { font: 13.5px var(--mono); background: rgba(0, 0, 0, .3); padding: 1px 6px; border-radius: 5px; }
.msg__body pre { background: rgba(0, 0, 0, .3); border: 1px solid var(--line); border-radius: 10px; padding: 12px; overflow-x: auto; margin: 0 0 10px; }
.msg__body pre code { background: none; padding: 0; }
.math { font: 14.5px/1.5 var(--mono); color: #fff; background: rgba(var(--acc-rgb), .08); padding: 0 5px; border-radius: 5px; white-space: nowrap; }
.math--block { display: block; width: fit-content; max-width: 100%; margin: 4px auto; padding: 8px 14px; white-space: normal; text-align: center; border: 1px solid rgba(var(--acc-rgb), .2); }
.msg__body h3 { font: 12px/1.4 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--acc); margin: 8px 0; }
.msg--system { align-self: center; max-width: 100%; }
.msg--system .msg__body { font: 11.5px/1.5 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--bad); text-align: center; padding: 8px 14px; border: 1px solid rgba(255, 138, 101, .35); border-radius: 10px; }
.tools { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tools span { font: 10px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 5px 8px; border: 1px solid var(--line); border-radius: 999px; }

/* Nachdenken */
.thinking { align-self: flex-start; display: flex; align-items: center; gap: 14px; padding: 12px 16px; min-width: min(320px, 85%); }
.thinking .core { width: 36px; height: 36px; }
.thinking__text { display: grid; gap: 8px; flex: 1; }
.thinking__head { display: flex; justify-content: space-between; gap: 12px; }
.thinking__time { color: var(--acc); font-variant-numeric: tabular-nums; }
.scan { height: 2px; background: var(--line); position: relative; overflow: hidden; border-radius: 2px; }
.scan::after {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 35%;
  background: linear-gradient(90deg, transparent, var(--acc), transparent);
  animation: scan 1.1s linear infinite;
}
@keyframes scan { from { transform: translateX(-100%); } to { transform: translateX(300%); } }

/* --- Eingabe --- */
@property --ang { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
.composer {
  display: flex; gap: 10px; align-items: flex-end; flex: none;
  margin: 0 0 calc(14px + env(safe-area-inset-bottom)); padding: 6px 6px 6px 14px;
  border-radius: 16px; border: 1px solid transparent;
  background:
    linear-gradient(var(--surface-solid), var(--surface-solid)) padding-box,
    linear-gradient(var(--line-strong), var(--line-strong)) border-box;
  transition: box-shadow .3s;
}
.composer:focus-within {
  background:
    linear-gradient(var(--surface-solid), var(--surface-solid)) padding-box,
    conic-gradient(from var(--ang), var(--line-strong) 0 55%, var(--acc) 75%, var(--line-strong) 95%) border-box;
  animation: ang 3.5s linear infinite;
  box-shadow: 0 0 30px rgba(var(--acc-rgb), .12);
}
@keyframes ang { to { --ang: 360deg; } }
.composer__prompt { font: 20px/44px var(--mono); color: var(--acc); }
.attach + input + .composer__prompt { display: none; } /* mit Büroklammer kein Prompt-Zeichen */
.attach {
  width: 40px; height: 44px; flex: none; display: grid; place-items: center; cursor: pointer;
  background: none; border: 0; color: var(--muted); transition: color .2s, transform .2s;
}
.attach:hover { color: var(--acc); transform: rotate(-12deg); }
/* Mikrofon */
.mic {
  position: relative; height: 44px; min-width: 40px; flex: none; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 0 8px; cursor: pointer; background: none; border: 0; border-radius: 11px; color: var(--muted);
  transition: color .2s, background .2s;
}
.mic:hover { color: var(--acc); }
.mic__time { font: 11px var(--mono); letter-spacing: .08em; font-variant-numeric: tabular-nums; }
.mic__time:empty { display: none; }
.mic.recording { color: var(--acc-ink); background: var(--acc); box-shadow: 0 0 0 calc(var(--lvl, 0) * 10px + 2px) rgba(var(--acc-rgb), .25); }
.mic.recording svg { animation: blink 1s steps(1) infinite; }
.mic.busy { color: var(--acc); }
.mic.busy svg { animation: spin 1s linear infinite; }

/* Stimmen-Auswahl */
.voices { display: grid; gap: 6px; margin-bottom: 12px; }
.voice-row { display: flex; gap: 6px; align-items: stretch; }
.voice-row .model { flex: 1; padding: 8px 10px; }
.play {
  width: 40px; flex: none; display: grid; place-items: center; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; color: var(--muted);
  transition: color .2s, border-color .2s;
}
.play:hover { color: var(--acc); border-color: var(--acc); }
.play.playing { color: var(--acc); border-color: var(--acc); box-shadow: 0 0 10px rgba(var(--acc-rgb), .35); }
.field-row { display: grid; gap: 6px; margin-bottom: 12px; }
.field-row b { color: var(--text); font-weight: 400; }
.field-row select {
  height: 38px; padding: 0 10px; border-radius: 10px; background: var(--surface-solid); border: 1px solid var(--line-strong);
  font-size: 14px;
}
input[type="range"] { width: 100%; accent-color: var(--acc); }
.toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle__track { width: 38px; height: 22px; border-radius: 11px; background: var(--line-strong); position: relative; flex: none; transition: background .2s; }
.toggle__track i { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--text); transition: transform .2s; }
.toggle input:checked + .toggle__track { background: var(--acc); }
.toggle input:checked + .toggle__track i { transform: translateX(16px); background: var(--acc-ink); }
.toggle input:focus-visible + .toggle__track { outline: 2px solid var(--acc); outline-offset: 2px; }
.speak-btn {
  margin-left: 8px; padding: 2px 6px; display: inline-flex; align-items: center; gap: 4px; cursor: pointer;
  background: none; border: 1px solid transparent; border-radius: 6px; color: var(--dim);
  font: 10px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase;
}
.speak-btn:hover, .speak-btn.playing { color: var(--acc); border-color: rgba(var(--acc-rgb), .4); }

.attachments { display: flex; gap: 10px; padding: 0 4px 10px; flex-wrap: wrap; }
.thumb {
  position: relative; width: 72px; height: 72px; border-radius: 10px; overflow: hidden;
  border: 1px solid rgba(var(--acc-rgb), .45); box-shadow: 0 0 14px rgba(var(--acc-rgb), .2);
  animation: rise .3s ease-out both;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb::after { /* Scan über dem Vorschaubild */
  content: ""; position: absolute; left: 0; right: 0; height: 30%; top: -30%;
  background: linear-gradient(transparent, rgba(var(--acc-rgb), .35), transparent);
  animation: thumb-scan 1.4s ease-in-out 2;
}
@keyframes thumb-scan { to { top: 100%; } }
.thumb button {
  position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; cursor: pointer;
  background: rgba(0, 0, 0, .65); border: 0; color: #fff; font-size: 14px; line-height: 22px; padding: 0;
}
.chat.dragging .messages { outline: 1px dashed var(--acc); outline-offset: -6px; border-radius: var(--radius); }
.msg__images { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-bottom: 8px; }
.msg__images img { width: 140px; max-width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; border: 1px solid var(--line-strong); }
.sources { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); display: grid; gap: 4px; }
.sources a {
  display: flex; gap: 8px; align-items: baseline; color: var(--muted); text-decoration: none; font-size: 13px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.sources a:hover { color: var(--acc); }
.sources a span { font: 10px var(--mono); color: var(--acc); flex: none; }
.composer textarea {
  flex: 1; resize: none; max-height: 160px;
  padding: 11px 0; background: transparent; border: 0; outline: none;
  font: 16px/1.4 var(--sans); /* 16px verhindert Zoom auf iOS */
}
.composer textarea::placeholder { color: var(--dim); }
.send {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center; cursor: pointer;
  background: var(--acc); color: var(--acc-ink); border: 0; border-radius: 11px;
  transition: transform .15s, box-shadow .2s, opacity .2s;
}
.send:hover:not(:disabled) { box-shadow: 0 0 18px rgba(var(--acc-rgb), .55); }
.send:active:not(:disabled) { transform: scale(.94); }
.send:disabled { opacity: .4; cursor: default; }

/* ===== Effekte ============================================================ */

/* Wort flackert beim Erscheinen kurz in der Akzentfarbe */
.w { opacity: 0; }
.w--in { animation: flicker .32s steps(1) forwards; }
.msg__body code:has(.w:not(.w--in)) { background: transparent; }
@keyframes flicker {
  0%   { opacity: 1; color: var(--acc); }
  25%  { opacity: .15; }
  45%  { opacity: 1; color: var(--acc); }
  70%, 100% { opacity: 1; color: inherit; }
}
.cursor { display: inline-block; width: 8px; height: 14px; margin-left: 3px; vertical-align: -2px; background: var(--acc); box-shadow: 0 0 8px var(--acc); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* Ziel erfasst: große Eckklammern rasten um die neue Antwort ein */
.lock-frame { position: absolute; inset: 0; pointer-events: none; }
.lock-frame i { position: absolute; width: 16px; height: 16px; border: 2px solid var(--acc); filter: drop-shadow(0 0 4px var(--acc)); animation: lock 1.1s cubic-bezier(.2, .8, .2, 1) forwards; }
.lock-frame i:nth-child(1) { top: -7px; left: -7px; border-right: 0; border-bottom: 0; --dx: -26px; --dy: -26px; }
.lock-frame i:nth-child(2) { top: -7px; right: -7px; border-left: 0; border-bottom: 0; --dx: 26px; --dy: -26px; }
.lock-frame i:nth-child(3) { bottom: -7px; left: -7px; border-right: 0; border-top: 0; --dx: -26px; --dy: 26px; }
.lock-frame i:nth-child(4) { bottom: -7px; right: -7px; border-left: 0; border-top: 0; --dx: 26px; --dy: 26px; }
@keyframes lock {
  0% { transform: translate(var(--dx), var(--dy)); opacity: 0; }
  35% { transform: none; opacity: 1; }
  50% { opacity: .2; } 62% { opacity: 1; }
  100% { transform: none; opacity: 0; }
}

/* Login */
.shake { animation: shake .4s; }
@keyframes shake { 15%, 55% { transform: translateX(-6px); } 35%, 75% { transform: translateX(6px); } }

/* Start-Sequenz */
.boot {
  position: fixed; inset: 0; z-index: 10; background: rgba(11, 15, 21, .97);
  display: flex; flex-direction: column; justify-content: center; gap: 22px;
  padding: 24px max(24px, calc(50% - 230px));
  font: 12px/1.9 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
  transition: opacity .35s;
}
.boot--out { opacity: 0; }
.boot__line { display: flex; justify-content: space-between; gap: 16px; animation: row-in .2s ease-out both; }
.boot__line:first-child { color: var(--text); margin-bottom: 8px; }
.boot__ok { color: var(--acc); }
.boot__bad { color: var(--bad); }
.boot__bar { height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; }
.boot__bar i { display: block; height: 100%; width: var(--p, 0%); background: var(--acc); box-shadow: 0 0 10px var(--acc); transition: width .25s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .w, .w-step, .chip { opacity: 1; }
}
