/* ============================================================
   MikuOS — AAA gate + chat (aligned with nucleus-tokens / corp)
   ============================================================ */

:root {
  --bg: #000000;
  --bg-card: #060608;
  --bg-sidebar: #060608;
  --bg-input: #0c0c10;
  --bg-hover: #100e14;
  --purple: #9a3aa0;
  --purple-dim: rgba(154, 58, 160, 0.12);
  --purple-glow: rgba(154, 58, 160, 0.18);
  --blue: #00c4eb;
  --green: #39d98a;
  --green-dim: rgba(57, 217, 138, 0.12);
  --green-glow: rgba(57, 217, 138, 0.22);
  --cyan: #00c4eb;
  --violet: #9a3aa0;
  --magenta: #c048a8;
  --text: #f4f0f8;
  --text-dim: rgba(244, 240, 248, 0.62);
  --text-muted: rgba(244, 240, 248, 0.32);
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.14);
  --danger: #ff4d6d;
  --radius: 2px;
  --font: 'Space Mono', ui-monospace, monospace;
  --mono: 'Space Mono', ui-monospace, monospace;
  --display: 'Syne', system-ui, sans-serif;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  overflow: hidden;
}

/* Kill native UA chrome — Safari/Chrome paint white button faces otherwise */
button {
  cursor: pointer;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  font-family: var(--font);
  appearance: none;
  -webkit-appearance: none;
}
button:focus { outline: none; }
button:focus-visible {
  outline: 1px solid rgba(0, 196, 235, 0.45);
  outline-offset: 2px;
}
input, textarea, select {
  font-family: var(--font);
  appearance: none;
  -webkit-appearance: none;
}

/* Ambient background */
.ambient-grid {
  position: fixed; inset: 0; z-index: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 72px 72px;
  pointer-events: none;
  opacity: 0.7;
}

.ambient-glow {
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse 65% 45% at 50% -8%, rgba(154, 58, 160, 0.07), transparent 58%),
    radial-gradient(ellipse 45% 35% at 80% 18%, rgba(0, 196, 235, 0.05), transparent 52%);
  pointer-events: none;
}

.hidden { display: none !important; }

/* ============================================================
   GATE — brand-first single composition (ad landing)
   ============================================================ */
.onboard {
  position: fixed; inset: 0; z-index: 100;
  display: flex;
  background: var(--bg);
  overflow: auto;
}

.gate-hero {
  position: relative;
  width: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 24px 48px;
}

.gate-nav {
  width: 100%;
  max-width: 920px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 0 8px;
  z-index: 2;
}

.gate-nav-brand {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--text);
}

.gate-nav-links {
  display: flex;
  gap: 8px;
}

.gate-nav-link {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 8px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  transition: color 0.15s, border-color 0.15s;
}
.gate-nav-link:hover {
  color: var(--cyan);
  border-color: rgba(0, 196, 235, 0.22);
}

.gate-stage {
  flex: 1;
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 0 24px;
  animation: gateIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes gateIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.gate-mark {
  position: relative;
  width: 56px;
  height: 56px;
  margin-bottom: 28px;
}
/* Soft ambient pulse only — no hard cyan “debug” outline */
.gate-mark-ring {
  position: absolute; inset: -6px;
  border: none;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(57, 217, 138, 0.18) 0%, transparent 70%);
  animation: ring-pulse 3.2s ease-in-out infinite;
  pointer-events: none;
}
.gate-mark-core {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--green);
  color: #000;
  border-radius: 2px;
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 800;
  border-radius: 50%;
}

.gate-kicker {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.gate-brand {
  font-family: var(--display);
  font-size: clamp(3.2rem, 10vw, 5.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 0.95;
  color: var(--text);
  margin-bottom: 18px;
}

.gate-lead {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-dim);
  max-width: 420px;
  margin-bottom: 36px;
}

.gate-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 340px;
}

.gate-cta-primary,
.gate-cta-secondary,
.gate-cta-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 20px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-radius: var(--radius);
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
}

.gate-cta-primary {
  background: var(--violet);
  color: #fff;
  border: 1px solid transparent;
}
.gate-cta-primary:hover { background: #b04ab6; }
.gate-cta-primary.loading .btn-text { display: none; }
.gate-cta-primary .btn-spinner {
  display: none; width: 14px; height: 14px;
  border: 2px solid transparent; border-top-color: #fff; border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.gate-cta-primary.loading .btn-spinner { display: block; }

.gate-cta-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(0, 196, 235, 0.35);
}
.gate-cta-secondary:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.gate-cta-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.gate-cta-ghost:hover {
  color: var(--text);
  border-color: var(--border-hover);
}

.gate-note {
  margin-top: 28px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  line-height: 1.5;
}

.gate-signup {
  margin-top: 14px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--cyan);
  text-decoration: none;
}
.gate-signup:hover { text-decoration: underline; }

.gate-auth-toggle {
  margin-top: 20px;
  padding: 6px 10px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-bottom: 1px solid transparent;
  border-radius: 0;
}
.gate-auth-toggle:hover {
  color: var(--text-dim);
  border-bottom-color: var(--border);
}

.gate-auth-panel {
  width: 100%;
  max-width: 340px;
  margin-top: 8px;
  padding: 20px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  text-align: left;
}

/* Legacy login card bits still used by auth panel */
.onboard-card {
  text-align: center;
  padding: 40px 36px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 380px; width: 100%;
}

.onboard-logo {
  position: relative;
  width: 64px; height: 64px;
  margin: 0 auto 20px;
}

.logo-ring {
  position: absolute; inset: 0;
  border: 2px solid var(--purple);
  border-radius: 50%;
  animation: ring-pulse 3s ease-in-out infinite;
}

@keyframes ring-pulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.08); opacity: 1; }
}

.logo-core {
  position: absolute; inset: 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--green);
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 24px; font-weight: 700;
  color: var(--bg);
  text-shadow: 0 0 20px rgba(255,255,255,0.3);
}

.onboard-card h1 {
  font-family: var(--mono);
  font-size: 1.6rem; font-weight: 700;
  margin-bottom: 4px;
  color: var(--green);
}

.onboard-sub {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 28px;
}

.onboard-form {
  display: flex; flex-direction: column; gap: 14px;
}

.field-group {
  display: flex; flex-direction: column; gap: 5px; text-align: left;
}
.field-label {
  font-family: var(--mono); font-size: 0.65rem; font-weight: 700;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-muted);
}

.onboard-form input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 0;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.onboard-form input:focus {
  border-color: #39d98a;
  box-shadow: 0 0 12px rgba(57, 217, 138, 0.1);
}

.onboard-form input::placeholder {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.btn-sso-login {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  padding: 12px 20px;
  background: var(--violet);
  border: none; border-radius: var(--radius);
  color: #fff;
  font-family: var(--mono);
  font-size: 0.8rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.2s, background 0.15s;
}
.btn-sso-login:hover {
  background: #b04ab6;
}
.btn-sso-login:active { transform: translateY(0); }
.btn-sso-login.loading .btn-text { display: none; }
.btn-sso-login .btn-spinner {
  display: none; width: 16px; height: 16px;
  border: 2px solid transparent; border-top-color: #000; border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.btn-sso-login.loading .btn-spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

.sso-divider {
  display: flex; align-items: center; gap: 12px;
}
.sso-divider::before, .sso-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.sso-divider span {
  font-family: var(--mono); font-size: 0.65rem; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted);
}

.btn-register-toggle {
  background: none; border: 1px solid var(--border);
  border-radius: 0; padding: 10px 16px;
  color: var(--text-dim); font-family: var(--mono);
  font-size: 0.78rem; cursor: pointer;
  transition: all 0.15s;
}
.btn-register-toggle:hover {
  border-color: var(--green); color: var(--text);
}

.onboard-error {
  font-family: var(--mono); font-size: 0.75rem; color: var(--danger);
  display: none;
  padding: 8px 12px; border-radius: 0;
  border: 1px solid rgba(255, 71, 87, 0.2);
  background: rgba(255, 71, 87, 0.05);
  text-align: left;
}
.onboard-error.visible { display: block; }

.onboard-divider {
  height: 1px; background: var(--border); margin: 20px 0;
}

.btn-guest {
  width: 100%;
  padding: 10px 16px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 0;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-guest:hover {
  border-color: var(--green); color: var(--text);
}

.onboard-note {
  margin-top: 16px;
  font-family: var(--mono); font-size: 0.65rem;
  color: var(--text-muted); line-height: 1.5;
}

/* Right panel — terminal feed */
.onboard-right {
  flex: 1; display: flex; flex-direction: column;
  background: #020204;
  border-left: 1px solid var(--border);
  padding: 0; overflow: hidden;
}
.terminal-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: #040408;
}
.terminal-dots {
  display: flex; gap: 6px;
}
.terminal-dots span {
  width: 8px; height: 8px; border-radius: 50%;
}
.terminal-dots span:nth-child(1) { background: #ff5f57; }
.terminal-dots span:nth-child(2) { background: #febc2e; }
.terminal-dots span:nth-child(3) { background: #28c840; }
.terminal-title {
  font-family: var(--mono); font-size: 0.7rem;
  color: var(--text-muted); letter-spacing: 0.08em;
}
.terminal-feed {
  flex: 1; padding: 20px;
  display: flex; flex-direction: column; gap: 8px;
  overflow-y: auto;
}
.terminal-line {
  font-family: var(--mono); font-size: 0.75rem;
  color: var(--text-dim); line-height: 1.6;
  opacity: 0; animation: termFadeIn 0.4s ease forwards;
}
.terminal-line:nth-child(1) { animation-delay: 0.3s; }
.terminal-line:nth-child(2) { animation-delay: 0.8s; }
.terminal-line:nth-child(3) { animation-delay: 1.3s; }
.terminal-line:nth-child(4) { animation-delay: 1.8s; }
@keyframes termFadeIn { to { opacity: 1; } }
.t-time { color: var(--text-muted); }
.t-ok { color: #39d98a; }
.t-info { color: #B026FF; }
.t-warn { color: #febc2e; }
.terminal-status {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  font-family: var(--mono); font-size: 0.7rem;
  color: var(--text-muted);
}
.status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #39d98a;
  box-shadow: 0 0 8px rgba(57, 217, 138, 0.5);
  animation: statusPulse 2s ease-in-out infinite;
}
@keyframes statusPulse {
  0%, 100% { opacity: 0.6; } 50% { opacity: 1; }
}

/* ============================================================
   APP LAYOUT
   ============================================================ */
.app {
  display: flex;
  height: 100vh;
  position: relative; z-index: 1;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  flex-shrink: 0;
  transition: width 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.3s ease;
  overflow: hidden;
}

.sidebar.collapsed {
  width: 0 !important;
  min-width: 0 !important;
  opacity: 0;
  pointer-events: none;
  border-right: none;
}

.sidebar > * {
  min-width: 260px;
}

/* Floating Expand Button */
.toggle-sidebar-floating {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 1000;
  background: rgba(8, 8, 16, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transform: scale(0.9);
}

.toggle-sidebar-floating:hover {
  color: var(--green);
  border-color: var(--green);
  box-shadow: 0 0 10px rgba(57, 217, 138, 0.35);
  transform: scale(1.05);
}

.sidebar.collapsed ~ .toggle-sidebar-floating {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.sidebar-header {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
}

.logo-sm {
  position: relative;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
}

.logo-ring-sm {
  position: absolute; inset: 0;
  border: 1.5px solid var(--purple);
  border-radius: 50%;
  opacity: 0.5;
}

.logo-sm span {
  font-family: var(--mono);
  font-size: 12px; font-weight: 700;
  color: var(--green);
}

.sidebar-title {
  flex: 1;
  font-weight: 600;
  font-size: 0.95rem;
}

.btn-icon {
  background: none; border: none;
  color: var(--text-dim);
  cursor: pointer; padding: 6px;
  border-radius: 0;
  transition: all 0.15s;
}
.btn-icon:hover { color: var(--text); background: var(--bg-hover); }

.sidebar-nav {
  padding: 8px;
  border-bottom: 1px solid var(--border);
}

.nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border-radius: 0;
  color: var(--text-dim);
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.15s;
}
.nav-item:hover { color: var(--text); background: var(--bg-hover); }
.nav-item.active { color: var(--green); background: var(--green-dim); }

.sidebar-history {
  flex: 1; overflow-y: auto;
  padding: 8px;
}

.sidebar-history::-webkit-scrollbar { width: 4px; }
.sidebar-history::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.history-item {
  padding: 10px 12px;
  border-radius: 0;
  color: var(--text-dim);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.history-item:hover { color: var(--text); background: var(--bg-hover); }
.history-item.active { color: var(--purple); background: rgba(196, 141, 232, 0.06); }
.history-item-title { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.history-delete {
  opacity: 0; background: none; border: none; color: var(--text-dim);
  cursor: pointer; padding: 2px; flex-shrink: 0; transition: all 0.15s;
}
.history-item:hover .history-delete { opacity: 0.6; }
.history-delete:hover { opacity: 1 !important; color: #ff5555; }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 8px;
}

.sidebar-footer-actions {
  display: flex; align-items: center; justify-content: space-between;
}

.user-badge {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.82rem;
}

.avatar-dot {
  width: 8px; height: 8px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--green-glow);
}

.btn-logout {
  display: flex; align-items: center; gap: 6px;
  background: none; border: 1px solid var(--border);
  border-radius: 0; padding: 4px 10px;
  color: var(--text-muted); font-family: var(--mono);
  font-size: 0.7rem; cursor: pointer;
  transition: all 0.15s;
}
.btn-logout:hover {
  border-color: var(--danger); color: var(--danger);
  background: rgba(255, 71, 87, 0.05);
}

.version-tag {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  background: var(--bg-hover);
  padding: 2px 8px;
  border-radius: 0;
}

/* ============================================================
   CHAT AREA
   ============================================================ */
.chat-area {
  flex: 1;
  display: flex; flex-direction: column;
  min-width: 0;
}

/* Empty state */
.empty-state {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px;
}

.empty-logo {
  position: relative;
  width: 64px; height: 64px;
  margin-bottom: 24px;
}

.logo-ring-lg {
  position: absolute; inset: 0;
  border: 2px solid var(--purple);
  border-radius: 50%;
  animation: ring-pulse 3s ease-in-out infinite;
}

.logo-core-lg {
  position: absolute; inset: 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--green);
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 24px; font-weight: 700;
  color: var(--bg);
}

.empty-state h2 {
  font-size: 1.4rem; font-weight: 600;
  margin-bottom: 24px;
  color: var(--text);
}

.suggestion-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  max-width: 520px; width: 100%;
}

.suggestion {
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
}
.suggestion:hover {
  border-color: var(--purple-dim);
  color: var(--text);
  background: var(--bg-hover);
}

/* Messages */
.messages {
  flex: 1; overflow-y: auto;
  padding: 24px 0;
  max-width: 768px;
  width: 100%;
  margin: 0 auto;
  background: #000000;
}

.messages::-webkit-scrollbar { width: 6px; }
.messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.message {
  padding: 20px 24px;
  animation: msg-in 0.25s ease-out;
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.message.user { background: #111111; }
.message.assistant { background: rgba(57, 217, 138, 0.02); }
.message.assistant .msg-body { color: #39d98a; font-family: var(--mono); }
.message.assistant .msg-body::before { content: '> '; color: #39d98a; opacity: 0.7; }

.msg-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
}

.msg-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono);
  font-size: 11px; font-weight: 700;
  flex-shrink: 0;
}

.msg-avatar.user-avatar {
  background: var(--bg-hover);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.msg-avatar.ai-avatar {
  background: linear-gradient(135deg, var(--purple), var(--purple-dim));
  color: var(--bg);
}

.msg-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-dim);
}

.msg-name.ai-name { color: var(--purple); }

.msg-body {
  padding-left: 36px;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text);
  font-family: var(--mono);
}

.msg-body p { margin-bottom: 12px; }
.msg-body p:last-child { margin-bottom: 0; }

.msg-body code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: rgba(196, 141, 232, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--purple);
}

.msg-body pre {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 14px 16px;
  overflow-x: auto;
  margin: 12px 0;
}

.msg-body pre code {
  background: none;
  padding: 0;
  color: var(--text);
}

.msg-body strong { color: var(--text); font-weight: 600; }
.msg-body em { color: var(--purple-dim); }

.msg-body ul, .msg-body ol {
  padding-left: 20px;
  margin: 8px 0;
}

.msg-body li { margin-bottom: 4px; }

.msg-image {
  margin-top: 12px;
  padding-left: 36px;
  position: relative;
  display: inline-block;
}

.msg-image img {
  max-width: 100%;
  max-height: 512px;
  border-radius: 0;
  border: 1px solid var(--border);
  box-shadow: 0 4px 24px rgba(196, 141, 232, 0.08);
  cursor: pointer;
  transition: transform 0.2s;
}

.msg-image img:hover {
  transform: scale(1.02);
}

.img-dl-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 2, 4, 0.75);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 0;
  color: var(--text-dim);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, color 0.15s, background 0.15s;
}

.msg-image:hover .img-dl-btn {
  opacity: 1;
}

.img-dl-btn:hover {
  color: var(--purple);
  background: rgba(196, 141, 232, 0.12);
  border-color: var(--purple-dim);
}

/* Typing indicator */
.typing-indicator {
  display: flex; gap: 4px; padding: 8px 0;
}
.typing-indicator span {
  width: 6px; height: 6px;
  background: var(--purple-dim);
  border-radius: 50%;
  animation: typing-bounce 1.4s ease-in-out infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* ── Attach / upload bar ───────────────────────────────────── */
.attach-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.attach-btn:hover {
  color: var(--purple);
  background: rgba(176, 38, 255, 0.08);
}
.attach-btn.has-file {
  color: var(--green);
}

.mic-btn {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  padding: 0;
}
.mic-btn:hover:not(.locked):not(:disabled) {
  color: var(--green);
  background: rgba(57, 217, 138, 0.08);
}
.mic-btn.recording {
  color: #ff4d6d;
  border-color: #ff4d6d;
  animation: micPulse 1s ease-in-out infinite;
}
.mic-btn.locked {
  opacity: 0.35;
  cursor: not-allowed;
}
.mic-btn:disabled {
  opacity: 0.4;
  cursor: wait;
}
@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 77, 109, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(255, 77, 109, 0); }
}
.voice-hint {
  margin: 6px 0 0;
  font-size: 0.7rem;
  font-family: var(--mono);
  color: var(--text-muted);
  letter-spacing: 0.04em;
  min-height: 1em;
}
.voice-hint.warn { color: #f0c040; }
.voice-hint.err { color: #ff4d6d; }
.msg-speak-btn {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid #444;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.msg-speak-btn:hover:not(:disabled) {
  color: var(--green);
  border-color: var(--green);
}
.msg-speak-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.msg-speak-btn.playing {
  color: var(--purple);
  border-color: var(--purple);
}
.msg-speak-btn.locked {
  opacity: 0.35;
}

.attach-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  padding: 10px 12px;
  border: 1px solid #333;
  border-bottom: none;
  background: rgba(0, 0, 0, 0.35);
}
.attach-bar.hidden { display: none; }

.attach-file-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.attach-filename {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attach-clear {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}
.attach-clear:hover { color: #ff5a5a; }

.attach-modes {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.attach-mode-chip {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 10px;
  border: 1px solid #444;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.attach-mode-chip:hover:not(:disabled) {
  border-color: var(--purple);
  color: var(--text);
}
.attach-mode-chip.active {
  border-color: var(--green);
  color: var(--green);
  background: rgba(57, 217, 138, 0.08);
}
.attach-mode-chip:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.attach-mode-chip.locked::after {
  content: ' ⌃';
  opacity: 0.7;
}

.attach-run-btn {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 6px 14px;
  border: none;
  background: var(--purple);
  color: #000;
  cursor: pointer;
}
.attach-run-btn:disabled {
  background: var(--bg-hover);
  color: var(--text-muted);
  cursor: not-allowed;
}
.attach-run-btn:not(:disabled):hover { opacity: 0.9; }

.msg-attach-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--green);
  border: 1px solid rgba(57, 217, 138, 0.35);
  padding: 2px 8px;
  margin-bottom: 8px;
}


.input-wrapper {
  display: flex; align-items: flex-end;
  background: var(--bg-input);
  border: none;
  border-top: 1px solid #333;
  border-radius: 0;
  padding: 8px 12px;
  transition: border-color 0.2s;
}

.input-wrapper:focus-within {
  border-color: var(--green);
}

#chat-input {
  flex: 1;
  background: none; border: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.95rem;
  line-height: 1.5;
  resize: none;
  outline: none;
  max-height: 200px;
  padding: 6px 4px;
}

#chat-input::placeholder { color: var(--text-muted); }

.send-btn {
  width: auto; height: auto;
  background: var(--purple);
  border: none; border-radius: 0;
  color: #000;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 8px 16px;
}

.send-btn:disabled {
  background: var(--bg-hover);
  color: var(--text-muted);
  cursor: not-allowed;
}

.send-btn:not(:disabled):hover {
  opacity: 0.9;
  transform: scale(1.05);
}

/* ── Spider (Web Search) Toggle ────────────────────────────── */
.spider-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #000;
  border: 1px solid #555;
  border-radius: 0;
  color: #555;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.spider-toggle svg {
  stroke: #555;
  transition: stroke 0.2s;
}

.spider-toggle:hover {
  border-color: #39d98a;
  color: #39d98a;
}

.spider-toggle:hover svg {
  stroke: #39d98a;
}

.spider-toggle.active {
  background: rgba(57, 217, 138, 0.08);
  border-color: #39d98a;
  color: #39d98a;
  box-shadow: 0 0 12px rgba(57, 217, 138, 0.2);
}

.spider-toggle.active svg {
  stroke: #39d98a;
}

.spider-toggle.active .spider-label {
  text-shadow: 0 0 8px rgba(57, 217, 138, 0.4);
}

.spider-label {
  line-height: 1;
}

.input-disclaimer {
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ── Mode Toggle (TEXT / VIDEO) ──────────────────────────────── */
.input-mode-bar {
  display: flex; gap: 0; margin-bottom: 8px;
  border: 1px solid var(--border);
}

.mode-btn {
  flex: 1;
  padding: 6px 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s;
}

.mode-btn + .mode-btn {
  border-left: 1px solid var(--border);
}

.mode-btn.active {
  background: var(--green-dim);
  color: var(--green);
  border-bottom: 2px solid var(--green);
  font-weight: 700;
}

.mode-btn:not(.active):hover {
  background: var(--bg-hover);
  color: var(--text-dim);
}

/* ── Video Message ───────────────────────────────────────────── */
.msg-video {
  border: 2px solid var(--purple);
  max-width: 480px;
  margin: 8px 0;
}

.msg-video video {
  width: 100%; display: block;
}

.msg-video-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
}

.msg-video-footer span {
  font-size: 11px; color: var(--text-muted);
}

.msg-video-footer a,
.msg-video-footer button {
  font-size: 11px;
  color: var(--purple);
  background: none; border: none;
  cursor: pointer;
  font-family: var(--mono);
  text-decoration: none;
}

.msg-video-footer a:hover,
.msg-video-footer button:hover {
  text-decoration: underline;
}

/* ============================================================
   GALLERY VIEW
   ============================================================ */
.gallery-view {
  padding: 32px;
  overflow-y: auto;
}

.gallery-header {
  text-align: center;
  margin-bottom: 32px;
}

.gallery-header h2 {
  font-size: 1.4rem;
  font-weight: 600;
}

.gallery-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  max-width: 900px;
  margin: 0 auto;
}

.gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

.gallery-empty p {
  margin-top: 12px;
  font-size: 0.88rem;
}

.gallery-item {
  position: relative;
  border-radius: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
  aspect-ratio: 1;
}

.gallery-item:hover {
  border-color: var(--purple-dim);
  transform: scale(1.02);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-item-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 8px 10px;
  background: linear-gradient(transparent, rgba(2,2,4,0.85));
  font-size: 0.72rem;
  color: var(--text-dim);
  opacity: 0;
  transition: opacity 0.2s;
}

.gallery-item:hover .gallery-item-overlay {
  opacity: 1;
}

.gallery-item-video {
  position: relative;
}

.gallery-item-video video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-item-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--purple, #B026FF);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 2px 6px;
  font-family: 'JetBrains Mono', monospace;
  z-index: 1;
}

/* ============================================================
   ABOUT VIEW
   ============================================================ */
.about-view {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.about-content {
  text-align: center;
  max-width: 480px;
}

.about-content h2 {
  font-size: 1.4rem;
  font-weight: 600;
  margin: 20px 0 8px;
}

.about-desc {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

.about-features {
  text-align: left;
  margin-bottom: 24px;
}

.about-feat {
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.about-feat strong {
  color: var(--purple);
}

.about-note {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ============================================================
   LIGHTBOX
   ============================================================ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 2, 4, 0.92);
  backdrop-filter: blur(12px);
  animation: lb-in 0.2s ease-out;
}

@keyframes lb-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lightbox.hidden {
  display: none;
}

.lightbox-inner {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-close {
  position: absolute;
  top: -40px;
  right: 0;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 28px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 0;
  transition: color 0.15s;
  z-index: 10;
}

.lightbox-close:hover {
  color: var(--text);
}

.lightbox-img-wrap {
  border-radius: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 8px 60px rgba(196, 141, 232, 0.1);
}

.lightbox-img-wrap img {
  display: block;
  max-width: 80vw;
  max-height: 70vh;
  object-fit: contain;
}

.lightbox-toolbar {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.lightbox-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s;
}

.lightbox-btn:hover {
  color: var(--purple);
  border-color: var(--purple-dim);
  background: rgba(196, 141, 232, 0.06);
}

.lightbox-prompt-bar {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  width: 100%;
  max-width: 500px;
}

.lightbox-prompt-bar input {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s;
}

.lightbox-prompt-bar input:focus {
  border-color: var(--green);
}

.lightbox-prompt-bar input::placeholder {
  color: var(--text-muted);
}

.lightbox-prompt-bar .send-btn {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}

/* ============================================================
   MOBILE RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .gate-brand { font-size: clamp(2.8rem, 12vw, 4rem); }
  .onboard-left, .onboard-right { display: none; }
  .onboard-center { flex: 1; }
}
@media (max-width: 768px) {
  .sidebar { display: none; }
  .suggestion-grid { grid-template-columns: 1fr; }
  .message { padding: 16px; }
  .msg-body { padding-left: 0; margin-top: 8px; }
  .input-area { padding: 0 12px 12px; }
  .tier-cards { grid-template-columns: 1fr !important; }
  .onboard-center { padding: 20px; }
  .onboard-card { padding: 32px 24px; }
}

/* ============================================================
   TIER BADGE (sidebar)
   ============================================================ */
.tier-badge {
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 0;
  line-height: 1.4;
}

.tier-free {
  color: var(--text-muted);
  background: var(--bg-hover);
}

.tier-pro {
  color: #f0c040;
  background: rgba(240, 192, 64, 0.1);
  border: 1px solid rgba(240, 192, 64, 0.2);
}

.tier-admin {
  color: var(--purple);
  background: rgba(196, 141, 232, 0.12);
  border: 1px solid rgba(196, 141, 232, 0.25);
}

.user-badge {
  cursor: pointer;
  transition: opacity 0.15s;
}

.user-badge:hover { opacity: 0.8; }

/* ============================================================
   USAGE BAR (empty state)
   ============================================================ */
.usage-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 20px;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  text-align: center;
  max-width: 400px;
  width: 100%;
}

.usage-bar .usage-count { color: var(--purple); font-weight: 600; }

/* ============================================================
   UPGRADE VIEW
   ============================================================ */
.upgrade-view {
  padding: 40px 32px;
  overflow-y: auto;
}

.upgrade-content {
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}

.upgrade-header {
  margin-bottom: 36px;
}

.upgrade-header h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 20px 0 6px;
  background: linear-gradient(135deg, var(--text), var(--purple));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

.upgrade-sub {
  font-size: 0.9rem;
  color: var(--text-dim);
}

.tier-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.tier-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 28px 20px;
  text-align: left;
  position: relative;
  transition: border-color 0.2s;
}

.tier-card:hover {
  border-color: var(--border-hover);
}

.tier-card-pro {
  border-color: var(--green-dim);
  background: linear-gradient(180deg, rgba(57, 217, 138, 0.04) 0%, var(--bg-card) 100%);
}

.tier-card-pro:hover {
  border-color: var(--green);
}

.tier-card-sysop {
  opacity: 0.7;
}

.tier-card-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--green);
  color: var(--bg);
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 12px;
  border-radius: 10px;
  white-space: nowrap;
}

.tier-card-header {
  margin-bottom: 16px;
}

.tier-card-name {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.tier-card-price {
  display: block;
  font-family: var(--mono);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
}

.tier-card-period {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-dim);
}

.tier-card-features {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
}

.tier-card-features li {
  padding: 6px 0;
  font-size: 0.85rem;
  color: var(--text-dim);
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.tier-card-features li:last-child { border-bottom: none; }

.tier-card-features li::before {
  content: '✓ ';
  color: var(--green);
  font-weight: 600;
}

.tier-card-btn {
  display: block;
  width: 100%;
  padding: 12px;
  background: var(--green);
  border: none;
  border-radius: 0;
  color: var(--bg);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
}

.tier-card-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.tier-card-btn:active { transform: translateY(0); }
.tier-card-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.tier-card-status {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  padding: 10px;
}

.tier-card-status-sysop {
  color: var(--green);
}

.upgrade-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  max-width: 500px;
  margin: 0 auto;
}

.upgrade-current-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 4px 12px;
  margin-top: 12px;
}

.upgrade-action {
  margin-top: 24px;
  text-align: center;
}

/* ═══ Plan Cards (3-tier) ═══ */
.plan-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}
.plan-option {
  background: var(--bg-card);
  padding: 24px 20px;
  text-align: center;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
}
.plan-option:hover { border-color: var(--border-hover); }
.plan-option.active { border-color: var(--purple); background: rgba(168, 130, 255, 0.06); }
.plan-option .plan-tier {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 8px;
}
.plan-option .plan-price {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.plan-option .plan-price span {
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 400;
}
.plan-option .plan-tokens {
  font-size: 10px;
  color: var(--text-dim);
  margin-bottom: 12px;
}
.plan-option .plan-features {
  text-align: left;
  font-size: 10px;
  color: var(--text-dim);
  line-height: 2;
  list-style: none;
  padding: 0;
  margin: 0;
}
.plan-option .plan-features li {
  list-style: none;
  padding-left: 14px;
  position: relative;
}
.plan-option .plan-features li::before {
  content: '>';
  position: absolute;
  left: 0;
  color: var(--green);
  font-weight: 700;
}

/* ============================================================
   MODS STORE VIEW — Dark Matrix
   ============================================================ */
.mods-view {
  padding: 40px 32px;
  overflow-y: auto;
}

.mods-content {
  max-width: 960px;
  margin: 0 auto;
}

.mods-header {
  text-align: center;
  margin-bottom: 40px;
}

.mods-n27-hex {
  margin-bottom: 16px;
  filter: drop-shadow(0 0 12px rgba(176, 38, 255, 0.3));
}

.mods-header h2 {
  font-family: var(--mono);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 8px;
}

.mods-sub {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: #888;
}

/* Category section */
.mods-category {
  margin-bottom: 28px;
}

.mods-category-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px dashed #1A1A1A;
}

.mods-category-header h3 {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #B026FF;
  margin: 0;
}

.mods-category-cursor {
  display: inline-block;
  color: #B026FF;
  font-family: var(--mono);
  font-size: 0.75rem;
  animation: cursorBlink 1s step-end infinite;
}

@keyframes cursorBlink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* Grid layout */
.mods-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.mods-loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: #888;
  font-family: var(--mono);
  font-size: 0.85rem;
}

.mods-loading-cursor {
  color: #B026FF;
  animation: cursorBlink 1s step-end infinite;
}

/* Module card — Dark Matrix */
.mod-card {
  background: #0a0a0a;
  border: 1px dashed #1A1A1A;
  border-radius: 0;
  padding: 24px 20px;
  position: relative;
  transition: border-color 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.mod-card:hover {
  border-color: #39d98a;
  box-shadow: 0 0 20px rgba(57, 217, 138, 0.08);
}

.mod-card.subscribed {
  border-color: #39d98a;
  border-style: solid;
}

/* Icon — SVG-based, 32px */
.mod-card-icon {
  width: 32px;
  height: 32px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mod-card-icon svg {
  width: 28px;
  height: 28px;
}

/* Category badge on card */
.mod-card-category {
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #B026FF;
  margin-bottom: 6px;
}

/* Module name */
.mod-card-name {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.mod-card-name.name-cyan { color: #39d98a; }
.mod-card-name.name-green { color: #39d98a; }
.mod-card-name.name-purple { color: #B026FF; }
.mod-card-name.name-magenta { color: #e040c0; }
.mod-card-name.name-amber { color: #f0c040; }

/* Description */
.mod-card-desc {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: #888;
  line-height: 1.6;
  margin-bottom: 16px;
  flex: 1;
}

/* Feature list — terminal style */
.mod-card-features {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
}

.mod-card-features li {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: #aaa;
  padding: 3px 0;
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.mod-card-features li::before {
  content: '▸';
  color: #39d98a;
  font-weight: 700;
  flex-shrink: 0;
  line-height: 1.3;
}

/* Price */
.mod-card-price {
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: #39d98a;
  margin-bottom: 14px;
}

/* Subscribe button — solid Neon Green, sharp corners */
.mod-card-btn {
  display: block;
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 0;
  background: #39d98a;
  color: #0a0a14;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.mod-card-btn:hover {
  background: #0a0a14;
  border: 1px solid #39d98a;
  color: #39d98a;
}

.mod-card-btn:active {
  transform: scale(0.98);
}

.mod-card-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* Active/Installed state */
.mod-card-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 0;
  background: transparent;
  color: #39d98a;
  border: 1px solid #39d98a;
}

/* Subscribed button style */
.mod-card-btn.subscribed-btn {
  border: 1px solid #39d98a;
  background: transparent;
  color: #39d98a;
}

.mod-card-btn.subscribed-btn:hover {
  border-color: #ff4757;
  color: #ff4757;
  background: rgba(255, 71, 87, 0.06);
  box-shadow: 0 0 16px rgba(255, 71, 87, 0.1);
}

/* Manage link for subscribed mods */
.mod-card-manage {
  display: inline-block;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: #888;
  text-decoration: underline;
  cursor: pointer;
  transition: color 0.15s;
}

.mod-card-manage:hover {
  color: #39d98a;
}

/* Footer */
.mods-footer {
  text-align: center;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: #888;
  max-width: 500px;
  margin: 0 auto;
}

/* Responsive — 1 column on mobile */
@media (max-width: 740px) {
  .mods-grid, .mods-grid-inner {
    grid-template-columns: 1fr;
  }
  .mods-view {
    padding: 24px 16px;
  }
  .mods-header h2 {
    font-size: 1.1rem;
  }
}

/* Inner grid for category grouping */
.mods-grid-inner {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

/* ============================================================
   DARK MATRIX TERMINAL AESTHETIC
   ============================================================ */

/* CRT Scanline Overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 1px,
    rgba(0, 0, 0, 0.03) 1px,
    rgba(0, 0, 0, 0.03) 2px
  );
  pointer-events: none;
  z-index: 9999;
}

/* Blinking Cursor Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 8px 0;
}

.typing-indicator span {
  width: 8px;
  height: 16px;
  background: #39d98a;
  animation: blink 1s step-end infinite;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* Sharp Corners (Ensure All Elements) */
* {
  border-radius: 0 !important;
}

/* ============================================================
   SETTINGS VIEW
   ============================================================ */
.settings-view {
  overflow-y: auto;
  padding: 40px 60px;
}

.settings-content {
  max-width: 700px;
  margin: 0 auto;
}

.settings-content h2 {
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}

.settings-sub {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 32px;
  letter-spacing: 0.5px;
}

.settings-section {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.settings-section:last-of-type {
  border-bottom: none;
}

.settings-section-title {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--purple);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 16px;
}

.settings-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.settings-label {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text);
  font-weight: 500;
}

.settings-input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.85rem;
  padding: 10px 14px;
  width: 100%;
  max-width: 400px;
}

.settings-input:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: 0 0 0 1px var(--purple-dim);
}

.settings-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.settings-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.85rem;
  padding: 10px 14px;
  width: 100%;
  max-width: 400px;
  cursor: pointer;
}

.settings-select:focus {
  outline: none;
  border-color: var(--purple);
}

.settings-note {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Toggle Switch */
.settings-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-checkbox {
  display: none;
}

.settings-toggle-label {
  width: 44px;
  height: 24px;
  background: var(--border);
  cursor: pointer;
  position: relative;
  transition: background 0.2s;
}

.settings-toggle-label::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: var(--text-muted);
  top: 3px;
  left: 3px;
  transition: all 0.2s;
}

.settings-checkbox:checked + .settings-toggle-label {
  background: var(--purple);
}

.settings-checkbox:checked + .settings-toggle-label::after {
  left: 23px;
  background: #fff;
}

.settings-toggle-text {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Buttons */
.settings-btn {
  background: var(--purple);
  color: #fff;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 8px 20px;
  border: none;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 1px;
  width: fit-content;
  margin-top: 8px;
}

.settings-btn:hover {
  opacity: 0.9;
}

.settings-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.settings-btn-secondary {
  background: transparent;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.75rem;
  padding: 8px 16px;
  border: 1px solid var(--border);
  cursor: pointer;
}

.settings-btn-secondary:hover {
  border-color: var(--purple);
  color: var(--purple);
}

.settings-btn-danger {
  background: transparent;
  color: var(--danger);
  font-family: var(--mono);
  font-size: 0.75rem;
  padding: 8px 16px;
  border: 1px solid rgba(255, 71, 87, 0.3);
  cursor: pointer;
}

.settings-btn-danger:hover {
  background: rgba(255, 71, 87, 0.1);
  border-color: var(--danger);
}

.settings-actions {
  display: flex;
  gap: 12px;
}

/* Account Info */
.settings-account-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.settings-tier-badge {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 4px 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.settings-tier-badge.tier-free {
  background: rgba(136, 136, 160, 0.15);
  color: #8888a0;
  border: 1px solid rgba(136, 136, 160, 0.3);
}

.settings-tier-badge.tier-pro {
  background: rgba(240, 192, 64, 0.15);
  color: #f0c040;
  border: 1px solid rgba(240, 192, 64, 0.3);
}

.settings-tier-badge.tier-admin {
  background: rgba(176, 38, 255, 0.15);
  color: var(--purple);
  border: 1px solid rgba(176, 38, 255, 0.3);
}

.settings-link {
  color: var(--purple);
  font-family: var(--mono);
  font-size: 0.75rem;
  text-decoration: none;
}

.settings-link:hover {
  text-decoration: underline;
}

.settings-footer {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 32px;
}

/* ElevenLabs Creative Suite */
.elevenlabs-view {
  padding: 32px;
  overflow-y: auto;
  height: 100%;
}
.el-content {
  max-width: 720px;
  margin: 0 auto;
}
.el-header h2 {
  font-family: var(--display);
  font-size: 1.5rem;
  margin-bottom: 4px;
}
.el-sub {
  color: var(--text-dim);
  font-size: 0.8rem;
  margin-bottom: 24px;
}
.el-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.el-tab {
  padding: 8px 16px;
  font-size: 0.75rem;
  color: var(--text-dim);
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.el-tab.active {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
}
.el-panel { display: none; }
.el-panel.active { display: block; }
.el-panel-header { margin-bottom: 20px; }
.el-panel-header h3 {
  font-family: var(--display);
  font-size: 1.1rem;
  margin-bottom: 4px;
}
.el-panel-header p {
  color: var(--text-dim);
  font-size: 0.75rem;
}
.el-field { margin-bottom: 16px; }
.el-field-row {
  display: flex; gap: 16px;
  flex-wrap: wrap;
}
.el-field-row .el-field { flex: 1; min-width: 160px; }
.el-label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.el-input, .el-select, .el-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius);
  transition: border-color 0.15s;
}
.el-input:focus, .el-select:focus, .el-textarea:focus {
  outline: none;
  border-color: var(--cyan);
}
.el-textarea { resize: vertical; min-height: 60px; }
.el-select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23f4f0f842' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  -webkit-appearance: none;
  appearance: none;
}
.el-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.el-status {
  font-size: 0.7rem;
  color: var(--text-dim);
}
.el-result {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 16px;
  margin-top: 8px;
}
.el-result-label {
  font-size: 0.7rem;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.el-audio {
  width: 100%;
  margin-bottom: 8px;
}
.el-dl-link {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--cyan);
  text-decoration: none;
  border: 1px solid var(--cyan);
  padding: 6px 12px;
  transition: background 0.15s;
}
.el-dl-link:hover {
  background: rgba(0, 196, 235, 0.1);
}
.el-file-drop {
  border: 1px dashed var(--border);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s;
}
.el-file-drop:hover {
  border-color: var(--cyan);
}
.el-file-drop p {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 8px;
}
.el-file-name {
  display: block;
  font-size: 0.7rem;
  color: var(--green);
  margin-top: 4px;
}
.el-transcript {
  font-size: 0.85rem;
  line-height: 1.7;
  white-space: pre-wrap;
  color: var(--text);
}
.el-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.75rem;
  color: var(--text-dim);
}
#el-voice-previews {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}
.el-voice-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
}
.el-voice-preview audio { flex: 1; min-width: 0; }
.el-voice-preview .el-vp-id {
  font-size: 0.65rem;
  color: var(--text-muted);
}
.el-dub-project-info {
  font-size: 0.8rem;
  line-height: 1.6;
}
.el-dub-project-info strong {
  color: var(--cyan);
}

@media (max-width: 740px) {
  .settings-view {
    padding: 24px 16px;
  }
  .settings-content h2 {
    font-size: 1.2rem;
  }
}

.msg-toolbar {
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
