:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --secondary: #8b5cf6;
  --success: #10b981;

  --light-bg: #f8fafc;
  --light-card: #ffffff;
  --light-text: #0f172a;
  --light-text-secondary: #64748b;
  --light-border: #e2e8f0;

  --dark-bg: #0f172a;
  --dark-card: #1e293b;
  --dark-text: #f1f5f9;
  --dark-text-secondary: #94a3b8;
  --dark-border: #334155;

  --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);

  /* Layout tokens */
  --navbar-h: 60px;
  --radius-sm: .5rem;
  --radius-md: .75rem;
  --radius-lg: 1rem;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .06);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, .08);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, .12);

  /* Typography scale */
  --fs-100: .75rem;
  --fs-200: .875rem;
  --fs-300: .95rem;
  --fs-400: 1rem;
  --fs-500: 1.125rem;
  --fs-600: 1.25rem;
  --fs-700: 1.5rem;
  --fs-800: 1.75rem;
  --fs-900: 2rem;
}

/* Better mobile viewport height handling */
@supports (height: 100dvh) {
  :root {
    --vh: 1dvh;
  }
}

@supports not (height: 100dvh) {
  :root {
    --vh: 1vh;
  }
}

/* Reset / Base */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", sans-serif;
  line-height: 1.5;
  transition: background-color .3s ease, color .3s ease;
  overflow-x: hidden;
  min-height: calc(var(--vh, 1vh) * 100);
  color-scheme: light dark;
}

body.light-mode {
  background-color: var(--light-bg);
  color: var(--light-text);
}

body.dark-mode {
  background-color: var(--dark-bg);
  color: var(--dark-text);
}

/* Smooth focus */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Navbar */
.navbar {
  backdrop-filter: blur(10px);
  transition: all .3s ease;
  padding: .5rem 0;
  border-bottom: 1px solid;
  z-index: 1030;
  min-height: var(--navbar-h);
}

body.light-mode .navbar {
  background-color: rgba(255, 255, 255, .9);
  border-bottom-color: var(--light-border);
}

body.dark-mode .navbar {
  background-color: rgba(30, 41, 59, .9);
  border-bottom-color: var(--dark-border);
}

.navbar-brand {
  font-size: var(--fs-700);
  font-weight: 800;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .3s ease;
  font-size: 1.1rem;
  box-shadow: var(--shadow-sm);
}

body.light-mode .theme-toggle {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
}

body.dark-mode .theme-toggle {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: #fff;
}

.theme-toggle:hover {
  transform: rotate(180deg) scale(1.05);
}

/* Containers */
.main-container {
  width: 100%;
  max-width: 1440px;
  margin-inline: auto;
  padding-inline: clamp(.5rem, 2vw, 1rem);
}

/* Images & media */
img,
svg,
video,
canvas,
audio,
iframe,
embed,
object {
  display: block;
  max-width: 100%;
}

/* Buttons */
button {
  font: inherit;
}

/* Inputs */
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

/* Scrollbar (WebKit) */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, .35);
  border-radius: 8px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, .55);
}

/* Utilities */
.hide {
  display: none !important;
}

/* Responsive type & navbar height adjustments */
@media (max-width: 992px) {
  :root {
    --navbar-h: 56px;
  }

  .navbar-brand {
    font-size: 1.25rem;
  }
}

@media (max-width: 576px) {
  :root {
    --navbar-h: 52px;
  }

  body {
    line-height: 1.55;
  }
}

/* Motion preferences */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
