/* Seven of Nine — Borg-inspiriertes Interface */
:root {
  --bg: #04080a;
  --bg2: #0a1412;
  --panel: rgba(10, 24, 20, 0.82);
  --line: rgba(61, 255, 154, 0.18);
  --green: #3dff9a;
  --green2: #19b86d;
  --cyan: #4ad6ff;
  --amber: #ffc46b;
  --red: #ff5f6d;
  --text: #d9e6df;
  --muted: #7f9a8d;
  --glow: 0 0 24px rgba(61, 255, 154, 0.35), 0 0 64px rgba(61, 255, 154, 0.12);
  --font-head: 'Orbitron', 'Segoe UI', system-ui, sans-serif;
  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.45;
  background-image:
    radial-gradient(ellipse at 50% -10%, rgba(61, 255, 154, 0.14), transparent 55%),
    radial-gradient(ellipse at 100% 100%, rgba(74, 214, 255, 0.07), transparent 50%),
    linear-gradient(rgba(61,255,154,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(61,255,154,0.035) 1px, transparent 1px);
  background-size: auto, auto, 34px 34px, 34px 34px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--cyan); }
h1 { font-family: var(--font-head); font-weight: 700; letter-spacing: 0.22em; font-size: 1.15rem; margin: 0; color: var(--green); text-shadow: 0 0 18px rgba(61,255,154,.45); }
.sub { margin: 4px 0 0; color: var(--muted); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; }
code { background: rgba(255,255,255,.06); padding: 1px 5px; border-radius: 4px; }

/* Buttons */
.btn { appearance: none; border: 1px solid var(--line); background: rgba(61,255,154,0.06); color: var(--text); padding: 9px 14px; border-radius: 10px; font: inherit; font-size: 0.9rem; cursor: pointer; transition: .15s; white-space: nowrap; }
.btn:hover { background: rgba(61,255,154,0.14); border-color: rgba(61,255,154,.45); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: linear-gradient(135deg, rgba(61,255,154,.28), rgba(25,184,109,.35)); border-color: rgba(61,255,154,.55); color: #eafff3; font-weight: 600; box-shadow: var(--glow); }
.btn.ghost { background: transparent; }
.btn.danger { border-color: rgba(255,95,109,.4); color: #ffb3b9; }
.btn.active { background: rgba(61,255,154,.22); border-color: var(--green); color: #fff; }
.btn.small { padding: 6px 10px; font-size: .8rem; border-radius: 8px; }
.icon-btn { width: 44px; height: 44px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; font-size: 1.15rem; }

/* Orb */
.orb { position: relative; width: 150px; height: 150px; margin: 0 auto; display: grid; place-items: center; }
.orb-small { width: 96px; height: 96px; }
.orb-core { width: 42%; height: 42%; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #c9ffe4, var(--green) 40%, #0b6b3f 75%, #052616); box-shadow: 0 0 30px rgba(61,255,154,.7), 0 0 80px rgba(61,255,154,.35), inset 0 0 18px rgba(0,0,0,.35); animation: breathe 3.6s ease-in-out infinite; transition: transform .08s; }
.orb-ring { position: absolute; inset: 0; border-radius: 50%; border: 1px solid rgba(61,255,154,.35); border-top-color: rgba(61,255,154,.9); border-bottom-color: transparent; animation: spin 9s linear infinite; }
.orb-ring.r2 { inset: 14%; border-color: rgba(74,214,255,.25); border-left-color: rgba(74,214,255,.85); border-right-color: transparent; animation: spin 6s linear infinite reverse; }
.orb-ring.r3 { inset: 27%; border-style: dashed; border-color: rgba(61,255,154,.25); animation: spin 14s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.orb.listening .orb-core { background: radial-gradient(circle at 35% 35%, #e6fff2, #5affb0 40%, #0f8a52 75%, #063b23); animation: breathe 1.1s ease-in-out infinite; box-shadow: 0 0 40px rgba(61,255,154,.95), 0 0 110px rgba(61,255,154,.45); }
.orb.listening .orb-ring { animation-duration: 2.2s; }
.orb.thinking .orb-core { background: radial-gradient(circle at 35% 35%, #dff6ff, var(--cyan) 40%, #0c5e80 75%, #04222f); box-shadow: 0 0 34px rgba(74,214,255,.8), 0 0 90px rgba(74,214,255,.35); animation: breathe .9s ease-in-out infinite; }
.orb.thinking .orb-ring { animation-duration: 1.4s; border-top-color: var(--cyan); }
.orb.speaking .orb-core { animation: none; }
.orb.speaking .orb-ring { animation-duration: 3s; }
.orb.error .orb-core { background: radial-gradient(circle at 35% 35%, #ffe3e5, var(--red) 40%, #7a1f27 75%, #2a0a0d); box-shadow: 0 0 30px rgba(255,95,109,.7); }

/* Auth / Setup */
.auth-page, .setup-page { display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 40px; min-height: 100%; }
.auth-card, .setup-card { width: 100%; max-width: 440px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 28px 26px; backdrop-filter: blur(10px); box-shadow: 0 20px 60px rgba(0,0,0,.5); text-align: center; }
.setup-card { max-width: 760px; text-align: left; }
.auth-card h1 { margin-top: 18px; }
.auth-card form { margin-top: 22px; display: grid; gap: 10px; text-align: left; }
label { display: block; font-size: .82rem; color: var(--muted); letter-spacing: .04em; }
input[type=text], input[type=password], input:not([type]), select, textarea { width: 100%; margin-top: 5px; padding: 11px 12px; background: rgba(0,0,0,.35); border: 1px solid var(--line); border-radius: 10px; color: var(--text); font: inherit; font-size: .95rem; outline: none; }
input:focus, select:focus, textarea:focus { border-color: rgba(61,255,154,.6); box-shadow: 0 0 0 3px rgba(61,255,154,.12); }
select option { background: #0b1a15; }
textarea { resize: vertical; }
.error { background: rgba(255,95,109,.12); border: 1px solid rgba(255,95,109,.4); color: #ffc7cb; padding: 10px 12px; border-radius: 10px; font-size: .9rem; }
.hint { color: var(--muted); font-size: .78rem; margin: 10px 0 0; }
.ok { color: var(--green); font-weight: 600; font-size: .75rem; margin-left: 6px; }
.setup-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.setup-card section { border-top: 1px solid var(--line); padding: 18px 0 8px; display: grid; gap: 12px; }
.setup-card h2 { font-family: var(--font-head); font-size: .85rem; letter-spacing: .14em; color: var(--green); margin: 0 0 4px; font-weight: 600; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .grid2 { grid-template-columns: 1fr; } }
.row { display: flex; gap: 8px; align-items: center; margin-top: 5px; }
.row input { margin-top: 0; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: .88rem; cursor: pointer; padding-top: 22px; }
label.check input { width: auto; margin: 0; }
.testres { font-size: .82rem; color: var(--muted); margin-left: 8px; }
.testres.good { color: var(--green); } .testres.bad { color: #ffb3b9; }
.actions { padding: 22px 0 4px; display: flex; justify-content: flex-end; }
.voicelist { display: grid; gap: 6px; max-height: 260px; overflow: auto; }
.voice { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; font-size: .85rem; }
.voice.sel { border-color: var(--green); background: rgba(61,255,154,.1); }
.voice .vn { font-weight: 600; min-width: 90px; } .voice .vi { color: var(--muted); font-size: .76rem; }
.voice .pv { background: none; border: 1px solid var(--line); color: var(--green); border-radius: 6px; cursor: pointer; padding: 2px 8px; }

/* App layout */
.app { display: grid; grid-template-rows: auto 1fr auto; height: 100dvh; max-width: 980px; margin: 0 auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px 6px; }
.topbar .title { display: flex; align-items: center; gap: 12px; }
.topbar .orb { width: 44px; height: 44px; margin: 0; }
.topbar .orb .orb-ring.r3 { display: none; }
.topbar h1 { font-size: .95rem; }
.topbar .sub { font-size: .66rem; }
.topbar .tools { display: flex; gap: 6px; }
.stage { display: grid; grid-template-rows: auto 1fr; min-height: 0; padding: 0 12px; }
.hero { text-align: center; padding: 8px 0 4px; }
.hero .orb { transition: width .3s, height .3s; }
.status { margin: 10px 0 0; color: var(--muted); font-size: .82rem; letter-spacing: .06em; text-transform: uppercase; min-height: 1.2em; }
.status.live { color: var(--green); }
.status.err { color: #ffb3b9; text-transform: none; letter-spacing: 0; }
.log { overflow-y: auto; padding: 10px 4px 12px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.msg { max-width: 82%; padding: 11px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); white-space: pre-wrap; word-wrap: break-word; animation: fadein .25s ease; }
.msg.user { align-self: flex-end; background: rgba(74,214,255,.09); border-color: rgba(74,214,255,.28); border-bottom-right-radius: 4px; }
.msg.seven { align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.seven::before { content: 'SEVEN'; display: block; font-family: var(--font-head); font-size: .6rem; letter-spacing: .2em; color: var(--green); margin-bottom: 4px; }
.msg.user::before { content: attr(data-who); display: block; font-family: var(--font-head); font-size: .6rem; letter-spacing: .2em; color: var(--cyan); margin-bottom: 4px; text-align: right; }
.msg.sys { align-self: center; max-width: 92%; font-size: .82rem; color: var(--muted); background: transparent; border-style: dashed; text-align: center; }
.msg.err { border-color: rgba(255,95,109,.45); color: #ffc7cb; }
.msg img { max-width: 100%; border-radius: 10px; display: block; margin-top: 6px; border: 1px solid var(--line); }
.msg .card { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; padding: 8px 12px; border: 1px solid rgba(74,214,255,.4); border-radius: 10px; color: var(--cyan); text-decoration: none; font-size: .88rem; }
.msg .actionbtn { margin-top: 8px; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.quick { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 4px 0 2px; }
.quick a { font-size: .8rem; padding: 6px 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--text); text-decoration: none; background: rgba(61,255,154,.05); }
.quick a:hover { border-color: var(--green); }

.dock { padding: 8px 12px calc(10px + var(--safe-b)); border-top: 1px solid var(--line); background: linear-gradient(180deg, rgba(4,8,10,0), rgba(4,8,10,.9) 30%); display: grid; gap: 8px; }
.dock .inputrow { display: flex; gap: 8px; align-items: center; }
.dock input { margin: 0; flex: 1; border-radius: 14px; padding: 12px 14px; }
.mic { width: 58px; height: 58px; border-radius: 50%; border: 2px solid rgba(61,255,154,.55); background: radial-gradient(circle at 40% 35%, rgba(61,255,154,.35), rgba(61,255,154,.08)); color: var(--green); font-size: 1.5rem; display: grid; place-items: center; cursor: pointer; transition: .15s; flex-shrink: 0; box-shadow: var(--glow); }
.mic.on { background: radial-gradient(circle at 40% 35%, rgba(61,255,154,.85), rgba(61,255,154,.4)); color: #04120a; border-color: #eafff3; animation: pulse 1.2s ease-in-out infinite; }
.mic:disabled { opacity: .5; box-shadow: none; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(61,255,154,.5); } 50% { box-shadow: 0 0 0 14px rgba(61,255,154,0); } }
.dock .actionsrow { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.dock .actionsrow .btn { font-size: .8rem; padding: 7px 11px; }

/* Drawer */
.drawer { position: fixed; top: 0; right: 0; height: 100%; width: min(420px, 100%); background: #071210; border-left: 1px solid var(--line); transform: translateX(105%); transition: transform .25s ease; z-index: 30; overflow-y: auto; padding: 16px 16px calc(24px + var(--safe-b)); box-shadow: -20px 0 60px rgba(0,0,0,.5); }
.drawer.open { transform: none; }
.drawer h2 { font-family: var(--font-head); font-size: .8rem; letter-spacing: .16em; color: var(--green); margin: 18px 0 8px; font-weight: 600; }
.drawer .head { display: flex; justify-content: space-between; align-items: center; }
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 25; display: none; }
.backdrop.show { display: block; }
.list { display: grid; gap: 6px; }
.item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; font-size: .9rem; }
.item.done { opacity: .5; text-decoration: line-through; }
.item input[type=checkbox] { width: 18px; height: 18px; margin: 0; accent-color: var(--green); }
.item .t { flex: 1; }
.item .x { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1rem; padding: 2px 6px; }
.item .x:hover { color: #ffb3b9; }
.addrow { display: flex; gap: 6px; margin-top: 8px; }
.addrow input { margin: 0; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(61,255,154,.08); font-size: .9rem; }
.toggle small { display: block; color: var(--muted); font-size: .75rem; }
.switch { position: relative; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: rgba(255,255,255,.12); border-radius: 24px; cursor: pointer; transition: .2s; }
.switch span::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--green2); }
.switch input:checked + span::before { transform: translateX(20px); }
.links { display: grid; gap: 6px; margin-top: 12px; }
.links a, .links button { text-align: left; }
.badge { display: inline-block; font-size: .68rem; padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); margin-left: 6px; vertical-align: middle; }
.badge.on { color: var(--green); border-color: rgba(61,255,154,.5); }
.hidden { display: none !important; }

@media (max-width: 640px) {
  .hero .orb { width: 118px; height: 118px; }
  .msg { max-width: 92%; }
  .topbar { padding: 10px 12px 4px; }
  .topbar .tools .btn.small span.lbl { display: none; }
}
@media (min-width: 900px) {
  .app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}
