@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg-deep: #06080f;
  --bg-base: #0a0e17;
  --bg-card: #0c101a;
  --bg-elevated: #0f1424;
  --border: #1e3a5f22;
  --border-hover: #4a90d944;
  --primary: #1e3a5f;
  --accent: #4a90d9;
  --cta: #e67e22;
  --success: #22c55e;
  --danger: #ef4444;
  --purple: #8b5cf6;
  --text: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #475569;
  --text-dim: #334155;
}

body {
  font-family: 'Inter', -apple-system, system-ui, sans-serif;
  background: var(--bg-deep);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

.app { height: 100vh; display: flex; flex-direction: column; }

.topbar {
  background: linear-gradient(180deg, #0c1020, var(--bg-base));
  border-bottom: 1px solid var(--border);
  padding: 8px 16px; display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0; z-index: 10;
}

.logo-group { display: flex; align-items: center; gap: 10px; }
.logo-box { width: 34px; height: 34px; border-radius: 8px; background: linear-gradient(135deg, var(--primary), var(--accent)); display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 900; color: #fff; letter-spacing: -0.5px; }
.logo-text h1 { font-size: 13px; font-weight: 900; color: #fff; letter-spacing: 0.5px; }
.logo-text span { font-size: 9px; color: var(--accent); letter-spacing: 1.5px; font-weight: 700; }

.controls { display: flex; align-items: center; gap: 8px; }
.badge { padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; display: flex; align-items: center; gap: 4px; transition: all 0.3s; }
.sens-group { display: flex; gap: 2px; }
.sens-btn { width: 20px; height: 20px; border-radius: 4px; border: none; font-size: 9px; font-weight: 700; cursor: pointer; transition: all 0.15s; }
.sens-btn.active { background: var(--accent); color: #fff; }
.sens-btn.inactive { background: #1e293b; color: var(--text-dim); }
.toggle-btn { padding: 4px 12px; border-radius: 6px; border: 1px solid; font-size: 10px; font-weight: 700; cursor: pointer; transition: all 0.2s; background: transparent; }
.toggle-btn.on { border-color: #4a90d944; color: var(--accent); background: #4a90d915; }
.toggle-btn.off { border-color: #47556944; color: var(--text-muted); }
.icon-btn { width: 26px; height: 26px; border-radius: 6px; border: 1px solid #47556944; background: transparent; color: var(--text-muted); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 13px; transition: all 0.2s; }
.icon-btn:hover { border-color: var(--border-hover); color: var(--accent); background: #4a90d915; }

.phases { display: flex; padding: 6px 16px; gap: 4px; border-bottom: 1px solid var(--border); background: rgba(10,14,23,0.6); flex-shrink: 0; }
.phase-btn { flex: 1; padding: 6px 8px; border-radius: 6px; border: 1px solid transparent; background: transparent; color: var(--text-muted); font-size: 10px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 4px; transition: all 0.2s; font-family: inherit; }
.phase-btn.active { border-color: var(--phase-color, var(--accent)); background: color-mix(in srgb, var(--phase-color, var(--accent)) 8%, transparent); color: var(--phase-color, var(--accent)); }
.phase-arrow { color: #1e293b; margin-left: 4px; }

.main { flex: 1; display: flex; overflow: hidden; }
.left { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.mic-bar { padding: 8px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; transition: background 0.3s; }
.mic-bar.listening { background: #0a1a0a; border-color: #22c55e15; }
.mic-btn { padding: 10px 22px; border-radius: 8px; border: none; color: #fff; font-size: 12px; font-weight: 800; cursor: pointer; display: flex; align-items: center; gap: 8px; font-family: inherit; transition: all 0.3s; }
.mic-btn.start { background: linear-gradient(135deg, var(--primary), var(--accent)); box-shadow: 0 0 24px #4a90d922; }
.mic-btn.stop { background: linear-gradient(135deg, #b91c1c, #dc2626); box-shadow: 0 0 24px #dc262633; animation: pulse 2s infinite; }

.live-indicator { display: flex; align-items: center; gap: 6px; }
.wave-bars { display: flex; gap: 2px; align-items: center; }
.wave-bar { width: 3px; border-radius: 2px; background: var(--success); animation: wave 1.2s ease-in-out infinite; }
.live-label { font-size: 10px; color: var(--success); font-weight: 700; }
.interim-text { font-size: 10px; color: var(--text-muted); font-style: italic; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 350px; }

.transcript-bar { margin: 0 16px; padding: 6px 10px; border-radius: 4px; background: var(--bg-card); border: 1px solid #1e3a5f15; max-height: 44px; overflow-y: auto; font-size: 10px; color: var(--text-muted); line-height: 1.5; }
.transcript-label { color: var(--primary); font-weight: 700; }

.feed { flex: 1; overflow-y: auto; padding: 10px 16px; display: flex; flex-direction: column; gap: 8px; }
.empty-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #1e293b; text-align: center; gap: 8px; }
.empty-icon { font-size: 56px; opacity: 0.2; }
.empty-title { font-size: 15px; font-weight: 800; color: var(--text-dim); }
.empty-desc { font-size: 11px; max-width: 300px; line-height: 1.7; color: var(--text-muted); }

.response-card { background: linear-gradient(135deg, var(--bg-card), var(--bg-elevated)); border: 1px solid var(--border); border-left: 3px solid var(--card-accent, var(--accent)); border-radius: 8px; padding: 12px; animation: fadeSlide 0.25s ease-out; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.card-meta { display: flex; align-items: center; gap: 6px; font-size: 10px; }
.card-category { font-weight: 700; }
.card-badge { padding: 1px 5px; border-radius: 3px; font-size: 9px; font-weight: 700; }
.card-time { color: var(--text-dim); }
.card-actions { display: flex; gap: 4px; }
.card-action-btn { background: none; border: none; cursor: pointer; font-size: 12px; opacity: 0.4; transition: opacity 0.2s; }
.card-action-btn:hover { opacity: 1; }

.card-trigger { font-size: 10px; color: var(--text-muted); margin-bottom: 8px; padding: 3px 8px; background: rgba(6,8,15,0.5); border-radius: 3px; border-left: 2px solid #1e293b; }
.card-response { font-size: 12.5px; color: var(--text); line-height: 1.75; white-space: pre-wrap; }
.power-move { margin-top: 8px; padding: 8px 12px; background: linear-gradient(135deg, #1e3a5f15, #4a90d910); border: 1px solid #4a90d933; border-radius: 6px; }
.power-move-label { font-size: 9px; color: var(--accent); font-weight: 800; letter-spacing: 1px; margin-bottom: 3px; }
.power-move-text { font-size: 13px; color: var(--accent); font-weight: 600; line-height: 1.5; }

.processing { padding: 12px; display: flex; align-items: center; gap: 8px; }
.dots { display: flex; gap: 3px; }
.dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); animation: bounce 1.4s infinite; }
.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }
.processing-text { font-size: 11px; color: var(--accent); }
.error-msg { background: #dc262611; border: 1px solid #dc262622; border-radius: 6px; padding: 8px; font-size: 11px; color: #f87171; }

.input-bar { padding: 8px 16px 10px; border-top: 1px solid #1e3a5f15; display: flex; gap: 6px; }
.input-field { flex: 1; padding: 9px 12px; border-radius: 6px; border: 1px solid #1e3a5f33; background: var(--bg-card); color: var(--text); font-size: 12px; outline: none; font-family: inherit; transition: border-color 0.2s; }
.input-field:focus { border-color: var(--accent); }
.input-field::placeholder { color: #293548; }
.send-btn { padding: 9px 18px; border-radius: 6px; border: none; font-size: 13px; font-weight: 800; cursor: pointer; font-family: inherit; transition: all 0.2s; }
.send-btn.active { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; }
.send-btn.disabled { background: #1e293b; color: var(--text-dim); cursor: not-allowed; }

.right { width: 330px; border-left: 1px solid var(--border); display: flex; flex-direction: column; background: #080c14; flex-shrink: 0; }
.panel-tabs { display: flex; border-bottom: 1px solid var(--border); }
.panel-tab { flex: 1; padding: 8px 4px; border: none; border-bottom: 2px solid transparent; background: transparent; color: var(--text-muted); font-size: 10px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 3px; font-family: inherit; transition: all 0.2s; }
.panel-tab.active { border-bottom-color: var(--accent); background: #4a90d908; color: var(--accent); }
.panel-content { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.panel-header { font-size: 9px; color: var(--text-dim); letter-spacing: 1px; font-weight: 700; margin-bottom: 4px; padding-left: 4px; }
.battle-card { padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-card); cursor: pointer; transition: all 0.15s; display: flex; align-items: center; gap: 8px; text-align: left; font-family: inherit; color: var(--text-secondary); }
.battle-card:hover { background: #1e3a5f22; border-color: var(--border-hover); }
.battle-emoji { font-size: 16px; flex-shrink: 0; }
.battle-title { font-size: 12px; font-weight: 600; color: #cbd5e1; }
.battle-triggers { font-size: 9px; color: var(--text-muted); font-weight: 400; margin-top: 2px; }
.closing-card { padding: 10px 12px; border-radius: 8px; border: 1px solid #22c55e15; background: var(--bg-card); cursor: pointer; transition: all 0.15s; text-align: left; font-family: inherit; }
.closing-card:hover { background: #22c55e0a; border-color: #22c55e33; }
.closing-name { font-size: 12px; font-weight: 700; color: var(--success); margin-bottom: 3px; }
.closing-when { font-size: 10px; color: var(--text-muted); line-height: 1.4; }
.discovery-card { padding: 10px 12px; border-radius: 8px; border: 1px solid #8b5cf615; background: var(--bg-card); cursor: pointer; transition: all 0.15s; text-align: left; font-size: 11.5px; color: var(--text-secondary); line-height: 1.5; font-family: inherit; }
.discovery-card:hover { background: #8b5cf60a; border-color: #8b5cf633; }
.discovery-num { color: var(--purple); font-weight: 700; margin-right: 6px; }
.info-box { margin-top: 10px; padding: 10px 12px; border-radius: 8px; }
.info-box-title { font-size: 10px; font-weight: 700; margin-bottom: 4px; }
.info-box-text { font-size: 11px; line-height: 1.5; }
.info-box-text div { margin-bottom: 1px; }
.pinned-card { padding: 8px 10px; border-radius: 6px; border: 1px solid #e67e2222; background: var(--bg-card); font-size: 11px; line-height: 1.5; }
.pinned-header { display: flex; justify-content: space-between; margin-bottom: 4px; }
.pinned-label { font-size: 9px; color: var(--cta); font-weight: 700; }
.pinned-remove { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 10px; }
.empty-pinned { text-align: center; color: var(--text-dim); padding: 40px 20px; font-size: 12px; }

.setup-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(6,8,15,0.95); display: flex; align-items: center; justify-content: center; backdrop-filter: blur(8px); }
.setup-box { position: relative; background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 40px; max-width: 460px; width: 90%; text-align: center; }
.setup-close { position: absolute; top: 14px; right: 14px; background: none; border: none; color: var(--text-muted); font-size: 16px; cursor: pointer; line-height: 1; }
.setup-close:hover { color: var(--text); }
.setup-logo { width: 56px; height: 56px; border-radius: 14px; background: linear-gradient(135deg, var(--primary), var(--accent)); display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 900; color: #fff; margin: 0 auto 16px; }
.setup-title { font-size: 20px; font-weight: 900; margin-bottom: 6px; }
.setup-sub { font-size: 12px; color: var(--text-muted); margin-bottom: 24px; line-height: 1.6; }
.setup-label { font-size: 11px; font-weight: 700; color: var(--text-secondary); text-align: left; display: block; margin-bottom: 6px; }
.setup-input { width: 100%; padding: 12px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-deep); color: var(--text); font-size: 13px; font-family: monospace; outline: none; margin-bottom: 16px; transition: border 0.2s; }
.setup-input:focus { border-color: var(--accent); }
.setup-input::placeholder { color: #293548; }
.setup-start { width: 100%; padding: 14px; border-radius: 10px; border: none; background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; font-size: 14px; font-weight: 800; cursor: pointer; font-family: inherit; transition: transform 0.15s, box-shadow 0.3s; box-shadow: 0 4px 24px #4a90d933; }
.setup-start:hover { transform: translateY(-1px); box-shadow: 0 6px 30px #4a90d944; }
.setup-hint { font-size: 10px; color: var(--text-dim); margin-top: 12px; line-height: 1.5; }
.setup-link { background: none; border: none; color: var(--text-muted); font-size: 11px; cursor: pointer; margin-top: 14px; text-decoration: underline; font-family: inherit; }

@keyframes pulse { 0%,100%{box-shadow:0 0 20px #dc262633} 50%{box-shadow:0 0 30px #dc262655} }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.3} }
@keyframes wave { 0%,100%{height:4px} 50%{height:14px} }
@keyframes bounce { 0%,80%,100%{transform:scale(0)} 40%{transform:scale(1)} }
@keyframes fadeSlide { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:translateY(0)} }

::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #1e3a5f33; border-radius: 3px; }

@media (max-width: 900px) { .right { width: 260px; } .interim-text { max-width: 200px; } }

/* ── Settings Wizard ────────────────────────────────────────────────── */
.wizard-overlay { position: fixed; inset: 0; z-index: 200; background: rgba(6,8,15,0.85); display: flex; align-items: center; justify-content: center; backdrop-filter: blur(6px); }
.wizard-box { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; width: 720px; max-width: 94vw; height: 640px; max-height: 88vh; display: flex; flex-direction: column; overflow: hidden; }
.wizard-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.wizard-title { font-size: 14px; font-weight: 800; }
.wizard-close { background: none; border: none; color: var(--text-muted); font-size: 18px; cursor: pointer; line-height: 1; }
.wizard-tabs { display: flex; gap: 2px; padding: 8px 12px 0; border-bottom: 1px solid var(--border); flex-shrink: 0; overflow-x: auto; }
.wizard-tab { padding: 8px 12px; border: none; background: transparent; color: var(--text-muted); font-size: 11px; font-weight: 700; cursor: pointer; border-bottom: 2px solid transparent; font-family: inherit; white-space: nowrap; }
.wizard-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.wizard-body { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.wizard-footer { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: space-between; flex-shrink: 0; }
.wizard-field { display: flex; flex-direction: column; gap: 5px; }
.wizard-field label { font-size: 10.5px; font-weight: 700; color: var(--text-secondary); }
.wizard-field input[type=text], .wizard-field input[type=color], .wizard-field textarea {
  width: 100%; padding: 8px 10px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--bg-deep); color: var(--text); font-size: 12px; font-family: inherit; outline: none;
}
.wizard-field textarea { resize: vertical; min-height: 70px; line-height: 1.5; }
.wizard-field input[type=color] { padding: 2px; height: 32px; cursor: pointer; }
.wizard-row { display: flex; gap: 10px; }
.wizard-row > .wizard-field { flex: 1; }
.wizard-btn { padding: 7px 14px; border-radius: 6px; border: 1px solid var(--border-hover); background: #4a90d915; color: var(--accent); font-size: 11px; font-weight: 700; cursor: pointer; font-family: inherit; }
.wizard-btn.danger { border-color: #ef444444; background: #ef444415; color: #f87171; }
.wizard-btn.primary { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; border: none; }
.wizard-item { border: 1px solid var(--border); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.wizard-item-head { display: flex; justify-content: space-between; align-items: center; }
.wizard-item-title { font-size: 11px; font-weight: 700; color: var(--text-secondary); }
.wizard-remove { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 12px; }
.wizard-remove:hover { color: #f87171; }
.wizard-hint { font-size: 10px; color: var(--text-dim); line-height: 1.5; }
.wizard-file-input { display: none; }

/* ── Onboarding-Assistent ───────────────────────────────────────────── */
.onboarding-box { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; width: 640px; max-width: 94vw; max-height: 88vh; display: flex; flex-direction: column; overflow: hidden; }
.onboarding-body { flex: 1; overflow-y: auto; padding: 22px 26px 26px; display: flex; flex-direction: column; gap: 16px; }
.ob-header { display: flex; flex-direction: column; gap: 6px; }
.ob-title { font-size: 17px; font-weight: 800; }
.ob-sub { font-size: 12px; color: var(--text-muted); line-height: 1.6; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice-card { text-align: left; padding: 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-elevated); cursor: pointer; font-family: inherit; color: var(--text); transition: all 0.15s; display: flex; flex-direction: column; gap: 4px; }
.choice-card:hover { border-color: var(--border-hover); background: #4a90d90f; transform: translateY(-1px); }
.choice-icon { font-size: 24px; }
.choice-title { font-size: 13px; font-weight: 800; }
.choice-desc { font-size: 11px; color: var(--text-muted); line-height: 1.5; }
.upload-zone { border: 2px dashed var(--border-hover); border-radius: 10px; padding: 28px 16px; text-align: center; cursor: pointer; transition: all 0.15s; background: var(--bg-elevated); }
.upload-zone:hover { background: #4a90d90f; }
.ob-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; }
@media (max-width: 640px) { .choice-grid { grid-template-columns: 1fr; } }
