/* einfachfelix Deck – Handy. Gleiche Farben wie das Deck, kein backdrop-filter. */

:root {
  --bg: #070404;
  --panel: #0d0808;
  --card: #140c0c;
  --card-hi: #1b1010;
  --line: rgba(255, 232, 232, 0.07);
  --line-2: rgba(255, 232, 232, 0.13);
  --text: #f1eaea;
  --muted: #a88c8c;
  --faint: #6e5858;
  --red: #ff0000;
  --live: #58ee88;
  --warn: #ffd747;
  --sans: Bahnschrift, "DIN Alternate", "Barlow", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Code", "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --tint: var(--red);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}

[data-shell="cmd"] { --tint: var(--red); }
[data-shell="ps"] { --tint: #4f8bff; }
[data-shell="claude"] { --tint: #e0835f; }
[data-shell="grok"] { --tint: #e8e8e8; }
[data-shell="codex"] { --tint: #58ee88; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  overscroll-behavior: none;
}

body {
  background:
    radial-gradient(circle, rgba(255, 220, 220, 0.05) 1px, transparent 1.2px) 0 0 / 22px 22px,
    var(--bg);
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.view {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-t);
}

/* ---------- Wortmarke ---------- */
.mark { font-weight: 700; letter-spacing: 0.04em; font-size: 18px; display: flex; align-items: baseline; gap: 0; }
.mark b { color: #fff; font-weight: 700; }
.mark span { color: var(--red); }
.mark em {
  font-style: normal;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--muted);
  border: 1px solid var(--line-2);
  border-radius: 5px;
  padding: 2px 6px;
  margin-left: 10px;
  align-self: center;
}

/* ---------- Koppeln ---------- */
.pair { margin: auto; padding: 28px 24px calc(28px + var(--safe-b)); max-width: 440px; }
.pair .mark { font-size: 24px; margin-bottom: 34px; }
.pair h1 { font-size: 26px; margin: 0 0 18px; font-weight: 600; }
.pair ol { margin: 0 0 22px; padding-left: 22px; line-height: 1.7; }
.pair ol b { color: #fff; }
.pair p { line-height: 1.5; }

/* ---------- Kopfzeile ---------- */
.top {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #120a0a, #0c0707);
  flex: 0 0 auto;
}
.top .mark { flex: 1; }

.state {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 6px 11px;
}
.state i { width: 7px; height: 7px; border-radius: 99px; background: var(--faint); }
.state.on { color: var(--live); border-color: color-mix(in srgb, var(--live) 35%, transparent); }
.state.on i { background: var(--live); box-shadow: 0 0 8px rgba(88, 238, 136, 0.7); }
.state.off i { background: var(--red); }

/* ---------- Liste ---------- */
.list-scroll { flex: 1; overflow-y: auto; padding: 14px 14px calc(100px + var(--safe-b)); -webkit-overflow-scrolling: touch; }
.deck-name { margin: 2px 2px 12px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); }
.cards { display: flex; flex-direction: column; gap: 10px; }

.card {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 13px 14px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--line-2);
  transition: transform 140ms var(--ease), border-color 140ms ease;
}
.card:active { transform: scale(0.985); }
.card.fragt { border-color: color-mix(in srgb, var(--warn) 55%, transparent); }
.card.fertig { border-color: color-mix(in srgb, var(--live) 45%, transparent); }

.glyph {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 13px;
  color: var(--tint);
  background: color-mix(in srgb, var(--tint) 14%, transparent);
  flex: 0 0 auto;
}
.card .meta { min-width: 0; }
.card .meta b { display: block; font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .meta small { display: block; margin-top: 3px; font-family: var(--mono); font-size: 11px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; padding: 4px 8px; border-radius: 999px; color: var(--faint); border: 1px solid var(--line-2); }
.badge.aktiv { color: var(--text); border-color: var(--line-2); }
.badge.aktiv::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 99px; background: var(--red); margin-right: 6px; animation: pulse 1.2s ease-in-out infinite; vertical-align: 1px; }
.badge.fertig { color: var(--live); border-color: color-mix(in srgb, var(--live) 40%, transparent); }
.badge.fragt { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }

@keyframes pulse { 50% { opacity: 0.25; } }

.empty { text-align: center; padding: 50px 20px; line-height: 1.5; }
.empty p:first-child { font-size: 18px; color: #fff; }

.fab {
  position: fixed;
  right: 18px;
  bottom: calc(22px + var(--safe-b));
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: var(--red);
  color: #fff;
  font-size: 30px;
  line-height: 1;
  box-shadow: 0 14px 34px -10px rgba(255, 0, 0, 0.6);
  transition: transform 140ms var(--ease);
}
.fab:active { transform: scale(0.94); }

/* ---------- Sitzung ---------- */
.sess-top { gap: 8px; padding-left: 6px; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; font-size: 22px; color: var(--muted); flex: 0 0 auto; display: grid; place-items: center; }
.icon-btn:active { background: var(--card-hi); }
#back { font-size: 32px; padding-bottom: 4px; }
#s-zoom { font-size: 13px; font-family: var(--mono); }
.icon-btn.danger:active { background: var(--red); color: #fff; }
.sess-top .glyph { width: 34px; height: 34px; border-radius: 9px; font-size: 11px; }
.s-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.s-title b { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-title small { font-family: var(--mono); font-size: 10.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tabs { display: flex; gap: 6px; padding: 8px 14px; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.tabs button { flex: 1; padding: 8px; border-radius: 9px; font-size: 14px; color: var(--muted); border: 1px solid var(--line); }
.tabs button.on { color: #fff; background: var(--card-hi); border-color: color-mix(in srgb, var(--red) 45%, transparent); }

.s-body { flex: 1; min-height: 0; position: relative; }

.term-wrap { position: absolute; inset: 0; overflow: auto; background: #0a0606; padding: 8px 6px; -webkit-overflow-scrolling: touch; }
.term-wrap .xterm { padding: 0; }
.term-wrap .xterm-viewport { overflow-y: hidden !important; }

/* ---------- Chat ---------- */
.chat { position: absolute; inset: 0; overflow-y: auto; padding: 14px 12px 18px; display: flex; flex-direction: column; gap: 10px; -webkit-overflow-scrolling: touch; }
.chat > * { flex-shrink: 0; }
.msg { max-width: 88%; padding: 10px 13px; border-radius: 16px; line-height: 1.45; font-size: 15px; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: color-mix(in srgb, var(--red) 22%, #1a0c0c); border: 1px solid color-mix(in srgb, var(--red) 35%, transparent); border-bottom-right-radius: 5px; white-space: pre-wrap; }
.msg.assistant { align-self: flex-start; background: var(--card); border: 1px solid var(--line-2); border-bottom-left-radius: 5px; }
.msg.assistant p { margin: 0 0 8px; }
.msg.assistant p:last-child { margin-bottom: 0; }
.msg.assistant h4 { margin: 4px 0 6px; font-size: 15px; color: #fff; }
.msg.assistant ul { margin: 0 0 8px; padding-left: 18px; }
.msg code { font-family: var(--mono); font-size: 0.88em; background: rgba(255, 255, 255, 0.07); border-radius: 5px; padding: 1px 5px; }
.msg pre { margin: 6px 0 8px; padding: 9px 10px; background: #0a0606; border: 1px solid var(--line); border-radius: 9px; overflow-x: auto; font-family: var(--mono); font-size: 12px; line-height: 1.4; }
.msg pre code { background: none; padding: 0; }
.tool { align-self: flex-start; max-width: 92%; line-height: 1.5; font-family: var(--mono); font-size: 11.5px; color: var(--muted); padding: 5px 10px; border-left: 2px solid color-mix(in srgb, var(--tint) 60%, transparent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat > .tool + .tool { margin-top: -7px; }
.tool b { color: var(--text); font-weight: 600; margin-right: 6px; }
.chat-note { align-self: center; font-family: var(--mono); font-size: 11px; color: var(--faint); padding: 6px; }
.typing { align-self: flex-start; display: flex; gap: 4px; padding: 10px 14px; }
.typing i { width: 6px; height: 6px; border-radius: 99px; background: var(--muted); animation: pulse 1s ease-in-out infinite; }
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }

/* ---------- Eingabe ---------- */
.dock { flex: 0 0 auto; border-top: 1px solid var(--line); background: #0c0707; padding: 8px 10px calc(8px + var(--safe-b)); }
.keys { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.keys::-webkit-scrollbar { display: none; }
.keys button { flex: 0 0 auto; min-width: 42px; height: 34px; padding: 0 11px; border-radius: 9px; font-family: var(--mono); font-size: 12.5px; color: var(--text); background: var(--card); border: 1px solid var(--line-2); }
.keys button:active { background: var(--red); border-color: var(--red); }
.input { display: flex; gap: 8px; align-items: flex-end; }
.input textarea {
  flex: 1;
  min-height: 42px;
  max-height: 140px;
  resize: none;
  padding: 10px 13px;
  border-radius: 13px;
  border: 1px solid var(--line-2);
  background: var(--card);
  color: var(--text);
  font: 16px/1.35 var(--sans);
  outline: none;
  overflow-y: auto;
  scrollbar-width: none;
}
.input textarea:focus { border-color: color-mix(in srgb, var(--red) 60%, transparent); }
.input button { width: 44px; height: 42px; border-radius: 13px; background: var(--red); color: #fff; font-size: 17px; flex: 0 0 auto; }
.input button:active { transform: scale(0.94); }

/* ---------- Blätter ---------- */
.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, 0.66); display: flex; align-items: flex-end; animation: fade 160ms ease; }
.sheet-box { width: 100%; background: var(--panel); border-top: 1px solid var(--line-2); border-radius: 20px 20px 0 0; padding: 10px 18px calc(20px + var(--safe-b)); animation: rise 240ms var(--ease); max-height: 86vh; overflow-y: auto; }
.grab { width: 40px; height: 4px; border-radius: 9px; background: var(--line-2); margin: 0 auto 14px; }
.sheet h2 { margin: 4px 0 14px; font-size: 20px; font-weight: 600; }
.label { margin: 14px 0 8px; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 9px 13px; border-radius: 11px; background: var(--card); border: 1px solid var(--line-2); font-size: 14px; display: flex; align-items: center; gap: 8px; max-width: 100%; }
.chip i { font-style: normal; font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--tint); }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.on { border-color: var(--red); background: color-mix(in srgb, var(--red) 16%, var(--card)); }
.btn { display: block; width: 100%; margin-top: 20px; height: 50px; border-radius: 14px; background: var(--red); color: #fff; font-size: 16px; font-weight: 600; }
.btn.ghost { background: transparent; border: 1px solid var(--line-2); color: var(--text); }
.btn.danger { background: var(--red); }
.row { display: flex; gap: 10px; }
.row .btn { margin-top: 16px; }

.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%); z-index: 30; max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 12px; background: var(--card-hi); border: 1px solid var(--red); font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6); animation: fade 160ms ease; }

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(40px); opacity: 0.4; } }

/* ---------- Spracheingabe ---------- */
.input .mic { width: 42px; height: 42px; border-radius: 13px; background: var(--card); border: 1px solid var(--line-2); color: var(--muted); display: grid; place-items: center; flex: 0 0 auto; }
.input .mic svg { width: 20px; height: 20px; fill: currentColor; }
.input .mic.rec { background: var(--red); border-color: var(--red); color: #fff; animation: rec 1.1s ease-in-out infinite; }
.input textarea.rec { border-color: var(--red); }
@keyframes rec { 50% { box-shadow: 0 0 0 7px rgba(255, 0, 0, 0.18); } }
