:root {
  --bg: #08080a;
  --surface: #111114;
  --surface-2: #18181d;
  --border: #24242b;
  --text: #ededf0;
  --muted: #8b8b96;
  --accent: #c6fb4d;
  --accent-ink: #08080a;
  --danger: #ff6b6b;
  --warn: #ffc05c;
  --radius: 16px;
  --tap: 52px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
[hidden] { display: none !important; }

.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--safe-top) + 10px) 16px 10px;
  background: rgba(8, 8, 10, 0.88);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; letter-spacing: 0.01em; display: flex; align-items: center; gap: 10px; }
.brand-mark {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: var(--accent); color: var(--accent-ink); font: 800 14px/1 var(--mono);
}
.top-right { display: flex; align-items: center; gap: 12px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.dot.off { background: var(--danger); box-shadow: 0 0 10px var(--danger); }

main { padding: 16px 16px calc(var(--composer-h, 0px) + var(--safe-bottom) + 24px); max-width: 760px; margin: 0 auto; }
.view.center {
  min-height: calc(100dvh - 140px);
  display: flex; flex-direction: column; justify-content: center; gap: 36px;
}
.hero { text-align: center; }
.hero-mark {
  width: 84px; height: 84px; margin: 0 auto 18px; border-radius: 24px;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); font: 800 34px/1 var(--mono);
  box-shadow: 0 10px 40px rgba(198, 251, 77, 0.18);
}
h1 { font-size: 28px; margin: 0 0 6px; }
h2 { font-size: 15px; margin: 0; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
label { font-size: 14px; color: var(--muted); margin-bottom: -4px; }

button {
  font: inherit; color: inherit; border: 0; cursor: pointer;
  min-height: var(--tap); border-radius: var(--radius); padding: 0 20px;
  touch-action: manipulation;
}
button:disabled { opacity: 0.45; cursor: default; }
.primary { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.primary:active:not(:disabled) { transform: scale(0.98); }
.big { min-height: 60px; font-size: 18px; }
.ghost { background: transparent; color: var(--muted); }
.ghost:active { color: var(--text); }
.small-btn { min-height: 40px; padding: 0 10px; font-size: 14px; }

.field, textarea {
  width: 100%; font: inherit; font-size: 17px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; min-height: var(--tap); outline: none;
}
.field:focus, textarea:focus { border-color: var(--accent); }
.mono { font-family: var(--mono); letter-spacing: 0.06em; }
.msg { min-height: 1.5em; margin: 0; text-align: center; font-size: 15px; }
.msg.error { color: var(--danger); }
.msg.ok { color: var(--accent); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  padding: 16px; margin-bottom: 28px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.prompt { margin: 0 0 12px; font-weight: 600; white-space: pre-wrap; overflow-wrap: anywhere; }
.output {
  margin: 0; max-height: 52vh; overflow: auto;
  background: #0b0b0e; border: 1px solid var(--border); border-radius: 12px;
  padding: 12px; font: 13px/1.55 var(--mono); color: #c9c9d2;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.output:empty::before { content: "Noch keine Ausgabe …"; color: var(--muted); }
.label { margin: 14px 0 6px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.result { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.pill.running { background: rgba(198, 251, 77, 0.14); color: var(--accent); }
.pill.running::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  animation: pulse 1.2s ease-in-out infinite;
}
.pill.done { color: var(--accent); }
.pill.error, .pill.interrupted { color: var(--danger); }
.pill.timeout { color: var(--warn); }
@keyframes pulse { 50% { opacity: 0.25; } }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 4px 2px 12px; }
.history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.history li {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; cursor: pointer; min-height: var(--tap);
}
.history li:active { background: var(--surface-2); }
.history li.selected { border-color: var(--accent); }
.h-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }
.h-prompt {
  margin: 0; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.h-result {
  margin: 6px 0 0; color: var(--muted); font-size: 14px; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.composer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 10px 12px calc(var(--safe-bottom) + 10px);
  background: rgba(8, 8, 10, 0.92);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
}
.composer .msg { font-size: 14px; min-height: 0; margin-bottom: 6px; }
.composer .msg:empty { display: none; }
.composer-row { display: flex; gap: 10px; align-items: flex-end; max-width: 760px; margin: 0 auto; }
.composer textarea { resize: none; max-height: 40vh; line-height: 1.4; }
.send { min-width: 92px; min-height: 52px; }
