/* ============================================================
   MikuOS Public Chat — Cyberpunk GPT Layout
   ============================================================ */

:root {
  --bg: #0a0a14;
  --bg-card: #0e0e1a;
  --bg-sidebar: #080810;
  --bg-input: #0c0c18;
  --bg-hover: #141422;
  --purple: #B026FF;
  --purple-dim: rgba(176, 38, 255, 0.12);
  --purple-glow: rgba(176, 38, 255, 0.25);
  --blue: #39d98a;
  --green: #39d98a;
  --green-dim: rgba(57, 217, 138, 0.12);
  --green-glow: rgba(57, 217, 138, 0.3);
  --cyan: #39d98a;
  --violet: #B026FF;
  --magenta: #ff4757;
  --text: #e0e0e8;
  --text-dim: #8888a0;
  --text-muted: #555570;
  --border: #1a1a2e;
  --border-hover: #252540;
  --danger: #ff4757;
  --radius: 0;
  --font: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  --mono: 'JetBrains Mono', 'SF Mono', monospace;
  --display: 'JetBrains Mono', 'SF Mono', monospace;
}

*, *::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;
}

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

.ambient-glow {
  position: fixed; inset: 0; z-index: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(176, 38, 255, 0.03) 0%, transparent 60%);
  pointer-events: none;
}

.hidden { display: none !important; }

/* ============================================================
   ONBOARDING — 3-column layout
   ============================================================ */
.onboard {
  position: fixed; inset: 0; z-index: 100;
  display: flex;
  background: var(--bg);
}

/* Left panel — branding */
.onboard-left {
  flex: 1; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #020204 0%, #0a0818 100%);
  border-right: 1px solid var(--border);
  padding: 40px;
}
.onboard-left-inner {
  max-width: 320px; text-align: left;
}
.onboard-brand-icon {
  position: relative; width: 64px; height: 64px; margin-bottom: 20px;
}
.brand-orbit {
  position: absolute; inset: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #00d4ff, #b744bc, #e040c0, #00d4ff) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  animation: brandOrbitSpin 8s linear infinite;
}
@keyframes brandOrbitSpin { to { transform: rotate(360deg); } }
.brand-core {
  position: absolute; inset: 6px;
  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);
}
.onboard-brand-title {
  font-family: var(--mono);
  font-size: 2rem; font-weight: 800;
  color: var(--green);
  margin-bottom: 4px;
}
.onboard-brand-tagline {
  font-family: var(--mono); font-size: 0.7rem;
  color: var(--text-muted); letter-spacing: 0.15em; text-transform: uppercase;
  margin-bottom: 32px;
}
.onboard-features {
  display: flex; flex-direction: column; gap: 14px;
  margin-bottom: 40px;
}
.feature-row {
  display: flex; align-items: center; gap: 12px;
  font-size: 0.85rem; color: var(--text-dim);
}
.onboard-powered {
  display: flex; align-items: center; gap: 10px;
  padding-top: 20px; border-top: 1px solid var(--border);
}
.powered-badge-login {
  position: relative; width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.powered-ring-sm {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, #00d4ff, #b744bc, #e040c0, #00d4ff) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  animation: brandOrbitSpin 6s linear infinite;
}
.powered-num-sm {
  font-family: var(--mono); font-size: 9px; font-weight: 700;
  color: #39d98a; position: relative; z-index: 1;
  text-shadow: 0 0 8px rgba(0,212,255,0.4);
}
.powered-text-sm {
  display: flex; flex-direction: column; gap: 1px;
}
.powered-by-sm {
  font-size: 6px; font-weight: 700; letter-spacing: 0.3em;
  text-transform: uppercase; color: var(--text-muted); line-height: 1;
}
.powered-name-sm {
  font-family: var(--mono);
  font-size: 11px; font-weight: 800; letter-spacing: 0.06em; line-height: 1.2;
  color: var(--green);
}

/* Center panel — login card */
.onboard-center {
  flex: 0 0 420px; display: flex; align-items: center; justify-content: center;
  padding: 40px;
}

.onboard-card {
  text-align: center;
  padding: 40px 36px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0;
  box-shadow: 0 0 80px rgba(176, 38, 255, 0.06);
  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(--green);
  border: none; border-radius: 0;
  color: var(--bg);
  font-family: var(--mono);
  font-size: 0.8rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
}
.btn-sso-login:hover {
  opacity: 0.9; transform: translateY(-1px);
}
.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;
}

.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;
}
.history-item:hover { color: var(--text); background: var(--bg-hover); }
.history-item.active { color: var(--purple); background: rgba(196, 141, 232, 0.06); }

.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; }
}

/* ============================================================
   INPUT AREA
   ============================================================ */
.input-area {
  padding: 0 24px 20px;
  max-width: 768px;
  width: 100%;
  margin: 0 auto;
}

.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) {
  .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;
}

/* ============================================================
   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;
}
