/* ═══════════════════════════════════════════════════
   TOKENS
═══════════════════════════════════════════════════ */
:root {
  --bg:          #0a0a0f;
  --surface:     #111118;
  --surface-2:   #1a1a24;
  --surface-3:   #232330;
  --border:      #2a2a3a;
  --border-soft: #1e1e2a;

  --accent:      #7c6aff;
  --accent-dim:  #4a3fad;
  --accent-glow: rgba(124, 106, 255, 0.25);

  --green:       #2ecc71;
  --red:         #e74c3c;
  --amber:       #f39c12;

  --text:        #e8e8f0;
  --text-sub:    #8888a8;
  --text-muted:  #55556a;

  --radius-sm:   8px;
  --radius-md:   14px;
  --radius-lg:   22px;
  --radius-pill: 999px;

  --font-sans:   'Space Grotesk', system-ui, sans-serif;
  --font-mono:   'JetBrains Mono', monospace;

  --shadow-pop:  0 8px 40px rgba(0,0,0,0.6);
  --shadow-glow: 0 0 40px rgba(124,106,255,0.15);
}

/* ═══════════════════════════════════════════════════
   RESET & BASE
═══════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

/* ═══════════════════════════════════════════════════
   SCREENS
═══════════════════════════════════════════════════ */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.screen.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
}

.screen.active {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

/* ═══════════════════════════════════════════════════
   SCREEN 1 — LANDING
═══════════════════════════════════════════════════ */
.landing-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.noise-overlay {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  opacity: 0.4;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
}

.orb-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(124,106,255,0.18), transparent 70%);
  top: -100px;
  right: -100px;
  animation: drift 12s ease-in-out infinite alternate;
}

.orb-2 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(46,204,113,0.1), transparent 70%);
  bottom: -80px;
  left: -80px;
  animation: drift 15s ease-in-out infinite alternate-reverse;
}

@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(30px, 20px) scale(1.08); }
}

.landing-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
  padding: 40px 24px;
}

/* ── Logo mark ── */
.logo-mark {
  position: relative;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-mark.sm {
  width: 36px;
  height: 36px;
}

.logo-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0.6;
  animation: spin-ring 8s linear infinite;
}

.logo-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 20px var(--accent);
}

.logo-mark.sm .logo-dot { width: 8px; height: 8px; }

@keyframes spin-ring {
  from { transform: rotate(0deg) scale(1); }
  50%  { transform: rotate(180deg) scale(1.1); }
  to   { transform: rotate(360deg) scale(1); }
}

h1.brand {
  font-size: 3.2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #fff 40%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  color: var(--text-sub);
  font-weight: 300;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}

.stat-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 8px 20px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-sub);
}

.stat-bar .stat span { color: var(--green); font-weight: 500; }
.stat-sep { color: var(--border); }

/* ═══════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════ */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-pill);
  padding: 14px 36px;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
  box-shadow: 0 0 0 0 var(--accent-glow);
}

.btn-primary:hover {
  background: #8f7dff;
  box-shadow: 0 0 28px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary.wide { width: 100%; }

.btn-secondary {
  background: transparent;
  color: var(--text-sub);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 13px 28px;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.btn-secondary:hover { background: var(--surface-2); color: var(--text); border-color: var(--text-muted); }

.btn-back {
  background: none;
  border: none;
  color: var(--text-sub);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: color 0.2s, background 0.2s;
}

.btn-back:hover { background: var(--surface-2); color: var(--text); }
.btn-back.sm { font-size: 0.8rem; }

/* ═══════════════════════════════════════════════════
   MODAL — DISCLAIMER
═══════════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  transition: opacity 0.3s;
}

.modal-backdrop.hidden { opacity: 0; pointer-events: none; }

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  max-width: 520px;
  width: 100%;
  box-shadow: var(--shadow-pop);
}

.modal-icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.modal-body {
  color: var(--text-sub);
  font-size: 0.88rem;
  line-height: 1.7;
}

.modal-body p { margin-bottom: 12px; }
.modal-body strong { color: var(--text); }

.modal-body ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.modal-body ul li::before {
  content: '—  ';
  color: var(--accent);
}

.modal-warning {
  background: rgba(231,76,60,0.08);
  border: 1px solid rgba(231,76,60,0.25);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: #e07060 !important;
  font-size: 0.82rem !important;
  margin-bottom: 0 !important;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  justify-content: flex-end;
}

/* ═══════════════════════════════════════════════════
   SCREEN 2 — PROFILE
═══════════════════════════════════════════════════ */
#screen-profile {
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}

.profile-wrap {
  width: 100%;
  max-width: 420px;
  padding: 32px 0;
}

.profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  margin-bottom: 36px;
}

.profile-header h2 {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

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

.profile-form { display: flex; flex-direction: column; gap: 28px; }

.field-group { display: flex; flex-direction: column; gap: 10px; }

.field-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.toggle-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.toggle-btn {
  flex: 1;
  min-width: 80px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-sub);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 12px 10px;
  cursor: pointer;
  transition: all 0.18s;
  text-align: center;
}

.toggle-btn:hover { border-color: var(--accent-dim); color: var(--text); }

.toggle-btn.selected {
  background: rgba(124,106,255,0.15);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 16px var(--accent-glow);
}

.location-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 10px 16px;
  font-size: 0.83rem;
  color: var(--text-sub);
  font-family: var(--font-mono);
}

.location-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
  flex-shrink: 0;
  animation: pulse-dot 1.5s ease-in-out infinite;
}

.location-dot.ready { background: var(--green); animation: none; }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

/* ═══════════════════════════════════════════════════
   SCREEN 3 — CHAT
═══════════════════════════════════════════════════ */
#screen-chat {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 0;
}

/* ── Topbar ── */
.chat-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface);
  flex-shrink: 0;
  z-index: 10;
}

.partner-badge {
  flex: 1;
  text-align: center;
}

.partner-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-sub);
}

.pulse-ring {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  position: relative;
  flex-shrink: 0;
}

.pulse-ring::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  animation: pulse-out 1.4s ease-out infinite;
}

@keyframes pulse-out {
  0%   { opacity: 0.8; transform: scale(1); }
  100% { opacity: 0; transform: scale(2.5); }
}

.partner-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pi-item {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
}

.pi-sep { color: var(--text-muted); font-size: 0.8rem; }

.btn-skip {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-sub);
  border-radius: var(--radius-pill);
  padding: 7px 16px;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-skip:hover {
  background: var(--surface-2);
  border-color: var(--accent-dim);
  color: var(--text);
}

/* ── Tier banner ── */
.tier-banner {
  background: rgba(124,106,255,0.08);
  border-bottom: 1px solid rgba(124,106,255,0.15);
  text-align: center;
  padding: 6px 16px;
  font-size: 0.75rem;
  color: var(--accent);
  font-family: var(--font-mono);
  flex-shrink: 0;
}

/* ── Messages area ── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.chat-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.searching-anim {
  display: flex;
  gap: 6px;
}

.searching-anim span,
.typing-indicator span {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: bounce-dot 1.2s ease-in-out infinite;
}

.searching-anim span:nth-child(2),
.typing-indicator span:nth-child(2) { animation-delay: 0.15s; }
.searching-anim span:nth-child(3),
.typing-indicator span:nth-child(3) { animation-delay: 0.3s; }

@keyframes bounce-dot {
  0%, 100% { opacity: 0.3; transform: scale(0.7); }
  50% { opacity: 1; transform: scale(1); }
}

/* ── Message bubbles ── */
.message {
  max-width: 70%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  line-height: 1.5;
  word-break: break-word;
  animation: msg-in 0.2s ease;
}

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

.message.mine {
  background: var(--accent);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.message.theirs {
  background: var(--surface-3);
  color: var(--text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.message.system {
  align-self: center;
  background: none;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-family: var(--font-mono);
  padding: 4px 0;
  max-width: 100%;
  text-align: center;
}

/* ── Typing indicator ── */
.typing-indicator {
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  flex-shrink: 0;
}

.typing-indicator.hidden { opacity: 0; pointer-events: none; }

/* ── Input bar ── */
.chat-inputbar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-soft);
  background: var(--surface);
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  padding: 11px 14px;
  resize: none;
  outline: none;
  line-height: 1.5;
  max-height: 140px;
  transition: border-color 0.2s;
}

.chat-input:focus { border-color: var(--accent-dim); }
.chat-input::placeholder { color: var(--text-muted); }
.chat-input:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-send {
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  color: #fff;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.btn-send:hover { background: #8f7dff; box-shadow: 0 0 20px var(--accent-glow); transform: scale(1.05); }
.btn-send:active { transform: scale(0.96); }
.btn-send:disabled { opacity: 0.3; cursor: not-allowed; transform: none; box-shadow: none; }

/* ═══════════════════════════════════════════════════
   UTILITY
═══════════════════════════════════════════════════ */
.hidden { display: none !important; }

/* ═══════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════ */
@media (max-width: 480px) {
  h1.brand { font-size: 2.4rem; }
  .modal-box { padding: 28px 20px; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions button { width: 100%; }
  .message { max-width: 85%; }
  .chat-topbar { padding: 10px 12px; gap: 8px; }
  .btn-skip { padding: 6px 12px; font-size: 0.78rem; }
}
