:root {
  --background: 218 45% 97%;
  --foreground: 222 48% 11%;
  --primary: 166 84% 34%;
  --primary-foreground: 0 0% 100%;
  --secondary: 223 62% 18%;
  --secondary-foreground: 0 0% 100%;
  --muted: 218 18% 88%;
  --muted-foreground: 220 12% 42%;
  --destructive: 0 74% 54%;
  --destructive-foreground: 0 0% 100%;
  --border: 218 20% 82%;
  --card: 0 0% 100%;
  --accent: 43 94% 55%;
  --shadow-sm: 0 6px 18px rgba(6, 17, 31, 0.08);
  --shadow-md: 0 14px 38px rgba(6, 17, 31, 0.12);
  --shadow-lg: 0 24px 70px rgba(6, 17, 31, 0.18);
  --transition-fast: 150ms ease;
  --transition-smooth: 280ms cubic-bezier(0.2, 0.8, 0.2, 1);
  --radius-sm: 0.75rem;
  --radius-md: 1rem;
  --radius-lg: 1.5rem;
}

.dark {
  --background: 221 48% 7%;
  --foreground: 210 32% 96%;
  --primary: 166 78% 48%;
  --primary-foreground: 222 48% 9%;
  --secondary: 218 42% 14%;
  --secondary-foreground: 210 32% 96%;
  --muted: 219 32% 17%;
  --muted-foreground: 217 16% 70%;
  --destructive: 0 78% 62%;
  --destructive-foreground: 0 0% 100%;
  --border: 218 28% 22%;
  --card: 220 43% 11%;
  --accent: 43 94% 58%;
  --shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 14px 38px rgba(0, 0, 0, 0.32);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.42);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: hsl(var(--background)); }
body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: hsl(var(--foreground));
  background:
    radial-gradient(circle at top left, hsl(var(--primary) / 0.16), transparent 34rem),
    radial-gradient(circle at top right, hsl(var(--accent) / 0.12), transparent 30rem),
    hsl(var(--background));
}

button, a, input, select { -webkit-tap-highlight-color: transparent; }
input, select, textarea { font-size: max(16px, 1rem); }

.bg-1 { background: hsl(var(--background)); }
.bg-2 { background: hsl(var(--card)); }
.bg-3 { background: hsl(var(--muted)); }
.bg-4 { background: hsl(var(--secondary)); }
.text-primary { color: hsl(var(--foreground)); }
.text-secondary { color: hsl(var(--muted-foreground)); }
.text-tertiary { color: hsl(var(--muted-foreground) / 0.78); }
.accent { color: hsl(var(--primary)); }

.card-glow {
  box-shadow: var(--shadow-md);
  border: 1px solid hsl(var(--border));
}

.terminal-grid {
  position: relative;
}
.terminal-grid::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.15;
  background-image: linear-gradient(rgba(255,255,255,0.18) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.18) 1px, transparent 1px);
  background-size: 34px 34px;
}
.terminal-grid > * { position: relative; }

.safe-bottom { padding-bottom: calc(5.25rem + env(safe-area-inset-bottom)); }
.bottom-safe { padding-bottom: env(safe-area-inset-bottom); }

.scrollbar-thin::-webkit-scrollbar { height: 8px; width: 8px; }
.scrollbar-thin::-webkit-scrollbar-thumb { background: hsl(var(--border)); border-radius: 999px; }

.ticker-track {
  display: inline-flex;
  min-width: max-content;
  animation: ticker-scroll 42s linear infinite;
}
.ticker-track:hover { animation-play-state: paused; }

@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@keyframes pulse-soft {
  0%, 100% { opacity: 0.58; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.04); }
}
.ai-pulse { animation: pulse-soft 2.2s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  .ticker-track, .ai-pulse { animation: none; }
}

@media (min-width: 768px) {
  .safe-bottom { padding-bottom: 2rem; }
}
