/* GS Car — Design System */
:root {
  --bg-0: #08080a;
  --bg-1: #0e0e11;
  --bg-2: #15151a;
  --bg-3: #1d1d24;
  --bg-4: #26262f;
  --line: #2a2a33;
  --line-soft: #1f1f27;
  --ink-0: #f5f5f7;
  --ink-1: #d6d6db;
  --ink-2: #9a9aa3;
  --ink-3: #6a6a73;
  --ink-4: #44444c;
  --accent: #e10a17;
  --accent-bright: #ff2230;
  --accent-soft: rgba(225, 10, 23, 0.12);
  --accent-glow: rgba(225, 10, 23, 0.35);
  --gold: #c9a96a;
  --gold-soft: rgba(201, 169, 106, 0.14);
  --green: #2dbb6e;
  --blue: #4a9eff;
  --warn: #ffb547;

  --font-sans: 'Helvetica Neue', Helvetica, 'PingFang HK', 'PingFang TC', -apple-system, sans-serif;
  --font-mono: 'SF Mono', 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --font-display: 'Helvetica Neue', Helvetica, 'PingFang HK', sans-serif;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --shadow-card: 0 1px 0 rgba(255,255,255,0.04) inset, 0 8px 24px rgba(0,0,0,0.4);
  --shadow-pop: 0 20px 48px rgba(0,0,0,0.6), 0 0 0 1px var(--line);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  background: #000;
  color: var(--ink-0);
  font-family: var(--font-sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  height: 100%;
  overflow: hidden;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea { font-family: inherit; color: inherit; background: transparent; border: none; outline: none; }

/* ============ STAGE ============ */
.stage {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse 80% 60% at 50% 30%, rgba(225, 10, 23, 0.08), transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 90%, rgba(201, 169, 106, 0.04), transparent 60%),
    #050507;
  overflow: hidden;
}
.stage::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.015) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.015) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}

.viewport {
  position: relative;
  width: 390px; height: 844px;
  background: var(--bg-0);
  border-radius: 44px;
  overflow: hidden;
  box-shadow:
    0 0 0 11px #16161a,
    0 0 0 12px #2a2a33,
    0 60px 120px rgba(225, 10, 23, 0.12),
    0 40px 80px rgba(0,0,0,0.7);
  flex-shrink: 0;
}

/* AI agent mode — inner red vignette glow */
.viewport.ai-mode {
  box-shadow:
    0 0 0 11px #16161a,
    0 0 0 12px #2a2a33,
    0 60px 120px rgba(225, 10, 23, 0.12),
    0 40px 80px rgba(0,0,0,0.7);
}

.viewport.ai-mode::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 100;
  box-shadow:
    inset 0 0 18px 1px rgba(167, 139, 250, 0.18),
    inset 0 0 48px 6px rgba(167, 139, 250, 0.10),
    inset 0 0 100px 16px rgba(167, 139, 250, 0.06);
  animation: ai-halo-pulse 4s ease-in-out infinite;
}

@keyframes ai-halo-pulse {
  0%, 100% {
    box-shadow:
      inset 0 0 18px 1px rgba(167, 139, 250, 0.18),
      inset 0 0 48px 6px rgba(167, 139, 250, 0.10),
      inset 0 0 100px 16px rgba(167, 139, 250, 0.06);
  }
  50% {
    box-shadow:
      inset 0 0 22px 2px rgba(167, 139, 250, 0.26),
      inset 0 0 60px 10px rgba(167, 139, 250, 0.14),
      inset 0 0 130px 24px rgba(167, 139, 250, 0.09);
  }
}

.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  background: var(--bg-0);
  overflow: hidden;
}

/* ============ STATUS BAR ============ */
.status-bar {
  height: 50px; flex-shrink: 0;
  display: flex; justify-content: space-between; align-items: flex-end;
  padding: 0 28px 8px;
  font-size: 15px; font-weight: 600;
  color: var(--ink-0);
  letter-spacing: -0.01em;
  z-index: 10;
}
.status-bar-right { display: flex; gap: 6px; align-items: center; }

/* ============ NAV BAR ============ */
.nav-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 20px 14px;
  flex-shrink: 0;
}
.nav-title { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.nav-icons { display: flex; gap: 14px; align-items: center; }
.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--bg-2);
  color: var(--ink-1);
  transition: all 0.15s;
}
.icon-btn:hover { background: var(--bg-3); color: var(--ink-0); }
.icon-btn.accent { background: var(--accent); color: #fff; }

/* ============ TAB BAR ============ */
.tab-bar {
  position: absolute; left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: flex; justify-content: space-around; align-items: stretch;
  padding: 8px 6px 22px;
  background: color-mix(in srgb, var(--bg-0) 88%, transparent);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border-top: 0.5px solid var(--line-soft);
}
.tab-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 0;
  color: var(--ink-3);
  font-size: 10px; font-weight: 500;
  letter-spacing: 0.02em;
  transition: color 0.15s;
  position: relative;
}
.tab-item.active { color: var(--accent); }
.tab-item.active::before {
  content: '';
  position: absolute; top: -8px; left: 50%; transform: translateX(-50%);
  width: 24px; height: 2px;
  background: var(--accent); border-radius: 2px;
}
.tab-item svg { width: 22px; height: 22px; }

/* ============ COMMON ============ */
.scroll {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}
.scroll::-webkit-scrollbar { display: none; }

.hscroll {
  flex: 0 0 auto;
  overflow-x: auto; overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  white-space: nowrap;
}
.hscroll::-webkit-scrollbar { display: none; }

.btn-primary {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 20px;
  background: var(--accent);
  color: #fff;
  border-radius: 12px;
  font-size: 15px; font-weight: 600;
  letter-spacing: -0.01em;
  transition: transform 0.1s, background 0.15s;
}
.btn-primary:hover { background: var(--accent-bright); }
.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 20px;
  background: var(--bg-3);
  color: var(--ink-0);
  border-radius: 12px;
  font-size: 15px; font-weight: 500;
  border: 1px solid var(--line);
}
.btn-secondary:hover { background: var(--bg-4); }

.btn-ghost {
  padding: 10px 14px;
  color: var(--ink-1);
  font-size: 14px; font-weight: 500;
}

.chip {
  padding: 7px 14px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px; font-weight: 500;
  color: var(--ink-1);
  white-space: nowrap;
  transition: all 0.15s;
}
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip:hover { border-color: var(--ink-3); }

.divider { height: 0.5px; background: var(--line); margin: 0; }

.meta { font-size: 11px; color: var(--ink-3); letter-spacing: 0.02em; text-transform: uppercase; font-weight: 500; }
.label { font-size: 12px; color: var(--ink-2); font-weight: 500; }

/* ============ PLACEHOLDER IMAGE ============ */
.ph {
  position: relative;
  background:
    repeating-linear-gradient(45deg, var(--bg-2), var(--bg-2) 8px, var(--bg-3) 8px, var(--bg-3) 16px);
  display: grid; place-items: center;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.1em;
  overflow: hidden;
}
.ph-car {
  background:
    radial-gradient(ellipse at 50% 70%, #2a2a35 0%, #15151c 60%, #08080a 100%);
}
.ph-car::after {
  content: '';
  position: absolute;
  width: 70%; height: 35%;
  bottom: 18%;
  left: 15%;
  background:
    linear-gradient(180deg, transparent 0%, rgba(255,255,255,0.03) 40%, transparent 60%),
    linear-gradient(90deg, transparent, rgba(225,10,23,0.18), transparent);
  border-radius: 50% 50% 30% 30% / 80% 80% 20% 20%;
  filter: blur(8px);
}

/* ============ SCREEN TRANSITIONS ============ */
.screen-enter {
  animation: screenIn 0.28s ease-out;
}
@keyframes screenIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.modal-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn 0.2s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.sheet {
  background: var(--bg-1);
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-height: 90%;
  padding: 8px 0 28px;
  animation: slideUp 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex; flex-direction: column;
  border-top: 0.5px solid var(--line);
}
.sheet-handle {
  width: 36px; height: 4px;
  background: var(--ink-4);
  border-radius: 2px;
  margin: 6px auto 12px;
}

/* ============ BADGES ============ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px; font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-verified { background: var(--accent-soft); color: var(--accent-bright); }
.badge-gold { background: var(--gold-soft); color: var(--gold); }
.badge-active { background: rgba(45, 187, 110, 0.12); color: var(--green); }

/* ============ STAGE LABEL ============ */
.stage-label {
  position: absolute;
  top: 24px; left: 24px;
  display: flex; align-items: center; gap: 12px;
  z-index: 5;
}
.stage-label-mark {
  display: flex; align-items: baseline; gap: 4px;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.04em;
}
.stage-label-mark .gs { font-size: 24px; color: var(--ink-0); }
.stage-label-mark .car { font-size: 24px; color: var(--accent); }
.stage-label-mark .dot { color: var(--accent); font-size: 24px; }
.stage-label-meta {
  font-family: var(--font-mono);
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.15em;
  color: var(--ink-3);
  border-left: 1px solid var(--line);
  padding-left: 12px;
}

.screens-overview {
  position: absolute;
  top: 24px; right: 24px;
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 0.1em;
  color: var(--ink-3);
  text-transform: uppercase;
  z-index: 5;
  text-align: right;
}
.screens-overview .name { color: var(--ink-0); font-weight: 600; margin-top: 4px; font-size: 12px; }

/* small visual touches */
.ring-pulse {
  position: relative;
}
.ring-pulse::before {
  content: '';
  position: absolute; inset: -4px;
  border-radius: inherit;
  border: 2px solid var(--accent);
  opacity: 0;
  animation: ringPulse 2s infinite;
}
@keyframes ringPulse {
  0% { opacity: 0.6; transform: scale(0.95); }
  100% { opacity: 0; transform: scale(1.15); }
}


/* ============ AI PILL BUTTON ============ */
.ai-pill-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px 6px 9px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.22), rgba(124, 58, 237, 0.18));
  color: #fff;
  font-family: var(--font-mono);
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  box-shadow:
    0 0 0 1px rgba(167, 139, 250, 0.5) inset,
    0 0 14px rgba(167, 139, 250, 0.25),
    0 4px 12px rgba(0, 0, 0, 0.35);
}

/* Animated spectrum border */
.ai-pill-btn::before {
  content: "";
  position: absolute;
  inset: -1.5px;
  border-radius: 999px;
  background: conic-gradient(
    from 0deg,
    #a78bfa,
    #f0a3e0,
    #f7c08a,
    #7dd3fc,
    #c4b5fd,
    #a78bfa
  );
  filter: blur(4px);
  opacity: 0.7;
  z-index: -1;
  animation: ai-spectrum-spin 4s linear infinite;
}

/* Inner mask so only edge shows the spectrum */
.ai-pill-btn::after {
  content: "";
  position: absolute;
  inset: 1.5px;
  border-radius: 999px;
  background: linear-gradient(135deg, #1a1525, #0f0820);
  z-index: -1;
}

.ai-pill-glow {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 50%, rgba(167, 139, 250, 0.4), transparent 70%);
  animation: ai-pill-breathe 2.4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes ai-spectrum-spin {
  to { transform: rotate(360deg); }
}

@keyframes ai-pill-breathe {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}


/* ============ AI HERO CARD (Inbox) ============ */
.ai-hero-card {
  overflow: hidden;
  cursor: pointer;
  background: transparent;
  box-shadow: 0 8px 28px rgba(167, 139, 250, 0.18);
}

/* Spectrum animated border */
.ai-hero-card::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 20px;
  background: conic-gradient(
    from 0deg,
    #a78bfa,
    #f0a3e0,
    #f7c08a,
    #7dd3fc,
    #c4b5fd,
    #a78bfa
  );
  filter: blur(6px);
  opacity: 0.55;
  z-index: -2;
  animation: ai-spectrum-spin 5s linear infinite;
}

/* Inner mask — gradient fill on top of the rotating spectrum */
.ai-hero-card::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 17px;
  background:
    radial-gradient(circle at 85% 0%, rgba(167, 139, 250, 0.30), transparent 55%),
    linear-gradient(135deg, rgba(167, 139, 250, 0.16), rgba(124, 58, 237, 0.06) 60%, var(--bg-1));
  z-index: -1;
}

.ai-hero-glow {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(ellipse at 80% 50%, rgba(167, 139, 250, 0.35), transparent 60%);
  animation: ai-pill-breathe 3s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}


/* ============ MOBILE: full-bleed, no fake phone frame ============ */
@media (max-width: 600px) {
  /* IMPORTANT: 100vh first as fallback, then 100dvh overrides on modern
     browsers. iOS Safari's 100vh is the larger "no URL bar" value, which
     makes content overflow past the visible area; 100dvh is the dynamic
     viewport that matches what's actually on screen. */
  html, body { height: 100vh; height: 100dvh; }

  .stage {
    display: block;
    background: var(--bg-0);
  }
  .stage::before { display: none; }

  .viewport {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    box-shadow: none;
  }
  .viewport.ai-mode {
    box-shadow: none;
  }
  .viewport.ai-mode::after {
    border-radius: 0;
  }

  /* Replace the fake iOS status bar (time/signal/battery) with a real
     safe-area spacer so content sits below the notch / Dynamic Island. */
  .status-bar {
    height: env(safe-area-inset-top, 12px);
    min-height: 12px;
    padding: 0;
    flex-shrink: 0;
  }
  .status-bar > * { display: none; }

  /* Tab bar respects the iOS home indicator safe area. */
  .tab-bar {
    padding-bottom: max(12px, env(safe-area-inset-bottom, 12px));
    padding-top: 8px;
  }
}
