:root {
  --bg-deep: #070512;
  --bg-mid: #0d0921;
  --bg-teal: #071419;
  --surface-header: rgba(10, 7, 23, 0.92);
  --surface-card: rgba(10, 7, 23, 0.78);
  --border-purple: rgba(153, 69, 255, 0.3);
  --border-cyan: rgba(3, 225, 255, 0.25);
  --border-subtle: rgba(255, 255, 255, 0.14);
  --text-primary: #f8fafc;
  --text-secondary: #e2e8f0;
  --text-muted: #94a3b8;
  --accent-gold: #f59e0b;
  --accent-gold-bright: #fbbf24;
  --accent-cyan: #03e1ff;
  --accent-mint: #14f195;
  --font-display: 'Outfit', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-body: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 10px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html,
body {
  position: fixed;
  inset: 0;
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  background-color: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(70% 55% at 15% 15%, rgba(153, 69, 255, 0.24) 0%, transparent 65%),
    radial-gradient(65% 50% at 85% 25%, rgba(3, 225, 255, 0.18) 0%, transparent 62%),
    radial-gradient(70% 55% at 55% 88%, rgba(20, 241, 149, 0.18) 0%, transparent 65%),
    linear-gradient(160deg, #070512 0%, #0d0921 48%, #071419 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
}

/* Full-Viewport 3D Stage */
#canvas-stage {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: auto;
}

#canvas-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
}

.canvas-fallback {
  position: absolute;
  inset: 0;
  display: none;
}

.canvas-fallback.visible {
  display: block;
}

/* Loading Veil */
.intro-veil {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(60% 50% at 50% 45%, rgba(153, 69, 255, 0.22), transparent 70%),
    #070512;
  transition: opacity 0.4s var(--ease-out), visibility 0.4s var(--ease-out);
}

.intro-veil.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro-card {
  width: min(380px, 100%);
  padding: 28px 24px;
  border-radius: var(--radius-lg);
  background: rgba(13, 10, 30, 0.94);
  border: 1px solid var(--border-purple);
  text-align: center;
}

.intro-brand {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
}

.intro-brand span {
  color: var(--accent-cyan);
}

.intro-progress-track {
  height: 5px;
  width: 100%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin: 18px 0 10px;
}

.intro-progress-fill {
  height: 100%;
  width: 30%;
  border-radius: 999px;
  background: linear-gradient(90deg, #9945ff, #03e1ff, #14f195);
  transition: width 0.25s ease;
}

.intro-meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.skip-btn {
  min-height: 36px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

/* Single-Screen Zero-Scroll Landing Stage */
.landing-stage {
  position: relative;
  z-index: 10;
  width: 100%;
  height: 100dvh;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.landing-center {
  width: min(720px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}

/* Exact kavian.ai Centered Frosted Dark Card */
.kavian-message-card {
  pointer-events: auto;
  width: 100%;
  padding: 22px 28px;
  border-radius: var(--radius-lg);
  background: var(--surface-card);
  border: 1px solid var(--border-purple);
  text-align: center;
}

.kavian-message-text {
  margin: 0;
  font-size: clamp(0.98rem, 1.55vw, 1.12rem);
  line-height: 1.65;
  color: var(--text-secondary);
}

@media (max-width: 639px) {
  .landing-stage {
    padding: 18px 14px;
  }

  .kavian-message-card {
    padding: 16px 16px;
  }

  .kavian-message-text {
    font-size: 0.94rem;
    line-height: 1.55;
  }
}

html body thinkstack-chat-window.tcw-chat-window,
html body thinkstack-chat-window.tcw-chat-window.tcw-minimized {
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  margin-left: auto !important;
  margin-right: auto !important;
  margin-bottom: 0 !important;
  touch-action: manipulation;
}

html body thinkstack-chat-window.tcw-chat-window #tcw-chat-input-wrapper #tcw-chat-input,
html body thinkstack-chat-window.tcw-chat-window textarea,
html body thinkstack-chat-window.tcw-chat-window input {
  font-size: 16px !important;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
  }
}
