@import "tailwindcss";
@import "katex/dist/katex.min.css";

:root {
  --background: #f4f8ff;
  --foreground: #10223f;
  --muted: #4f6588;
  --border: #cbdaef;
  --surface: #FFFFFF;
  --surface-raised: #FFFFFF;

  --unit-1: #2563eb;
  --unit-1-light: #e8f1ff;
  --unit-1-dark: #1d4ed8;

  --unit-2: #0ea5a4;
  --unit-2-light: #e6fffb;
  --unit-2-dark: #0f766e;

  --unit-3: #f97316;
  --unit-3-light: #fff1e7;
  --unit-3-dark: #c2410c;

  --unit-4: #e11d48;
  --unit-4-light: #ffe8ef;
  --unit-4-dark: #be123c;

  --unit-5: #7c3aed;
  --unit-5-light: #f0e7ff;
  --unit-5-dark: #5b21b6;

  --unit-6: #4f46e5;
  --unit-6-light: #eef2ff;
  --unit-6-dark: #3730a3;

  --unit-7: #16a34a;
  --unit-7-light: #dcfce7;
  --unit-7-dark: #15803d;

  --unit-8: #e11d48;
  --unit-8-light: #ffe4e9;
  --unit-8-dark: #be123c;

  --correct: #16a34a;
  --correct-light: #dcfce7;
  --incorrect: #dc2626;
  --incorrect-light: #fee2e2;
  --hint: #d97706;
  --hint-light: #ffedd5;

  --shadow-sm: 0 1px 2px rgb(16 34 63 / 0.06), 0 2px 8px rgb(37 99 235 / 0.04);
  --shadow-md: 0 8px 18px rgb(16 34 63 / 0.09), 0 2px 8px rgb(37 99 235 / 0.08);
  --shadow-lg: 0 16px 30px rgb(16 34 63 / 0.11), 0 6px 20px rgb(37 99 235 / 0.1);
  --shadow-xl: 0 24px 44px rgb(16 34 63 / 0.14), 0 12px 28px rgb(37 99 235 / 0.12);
  --shadow-glow: 0 0 24px rgb(37 99 235 / 0.18);
}

@theme inline {
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --color-muted: var(--muted);
  --color-border: var(--border);
  --color-surface: var(--surface);
  --color-surface-raised: var(--surface-raised);

  --color-unit-1: var(--unit-1);
  --color-unit-1-light: var(--unit-1-light);
  --color-unit-1-dark: var(--unit-1-dark);
  --color-unit-2: var(--unit-2);
  --color-unit-2-light: var(--unit-2-light);
  --color-unit-2-dark: var(--unit-2-dark);
  --color-unit-3: var(--unit-3);
  --color-unit-3-light: var(--unit-3-light);
  --color-unit-3-dark: var(--unit-3-dark);
  --color-unit-4: var(--unit-4);
  --color-unit-4-light: var(--unit-4-light);
  --color-unit-4-dark: var(--unit-4-dark);
  --color-unit-5: var(--unit-5);
  --color-unit-5-light: var(--unit-5-light);
  --color-unit-5-dark: var(--unit-5-dark);
  --color-unit-6: var(--unit-6);
  --color-unit-6-light: var(--unit-6-light);
  --color-unit-6-dark: var(--unit-6-dark);
  --color-unit-7: var(--unit-7);
  --color-unit-7-light: var(--unit-7-light);
  --color-unit-7-dark: var(--unit-7-dark);
  --color-unit-8: var(--unit-8);
  --color-unit-8-light: var(--unit-8-light);
  --color-unit-8-dark: var(--unit-8-dark);

  --color-correct: var(--correct);
  --color-correct-light: var(--correct-light);
  --color-incorrect: var(--incorrect);
  --color-incorrect-light: var(--incorrect-light);
  --color-hint: var(--hint);
  --color-hint-light: var(--hint-light);

  --font-sans: "Nunito", "Trebuchet MS", "Segoe UI", sans-serif;
  --font-display: "Avenir Next", "Poppins", "Trebuchet MS", sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "Consolas", monospace;
}

html {
  scroll-behavior: smooth;
}

body {
  background:
    radial-gradient(circle at 15% 0%, color-mix(in srgb, var(--unit-1) 9%, transparent), transparent 46%),
    radial-gradient(circle at 90% 8%, color-mix(in srgb, var(--unit-3) 9%, transparent), transparent 34%),
    radial-gradient(circle at 85% 88%, color-mix(in srgb, var(--unit-2) 7%, transparent), transparent 40%),
    linear-gradient(180deg, #f7fbff 0%, var(--background) 100%);
  color: var(--foreground);
  font-family: var(--font-sans);
  text-wrap: pretty;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

::selection {
  background: color-mix(in srgb, var(--unit-1) 20%, transparent);
}

/* Subtle gradient background pattern */
.hero-gradient {
  background:
    radial-gradient(ellipse 100% 70% at 55% -15%, color-mix(in srgb, var(--unit-1) 14%, transparent), transparent),
    radial-gradient(ellipse 70% 40% at 95% 45%, color-mix(in srgb, var(--unit-3) 12%, transparent), transparent),
    radial-gradient(ellipse 70% 50% at 10% 75%, color-mix(in srgb, var(--unit-2) 10%, transparent), transparent),
    linear-gradient(180deg, rgb(255 255 255 / 0.94), rgb(255 255 255 / 0.82));
}

/* Dot pattern overlay */
.dot-pattern {
  background-image:
    linear-gradient(to right, rgb(203 218 239 / 0.45) 1px, transparent 1px),
    linear-gradient(to bottom, rgb(203 218 239 / 0.45) 1px, transparent 1px);
  background-size: 22px 22px;
}

@keyframes float-card {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

.float-card {
  animation: float-card 3.2s ease-in-out infinite;
}

.playground-bg {
  background: linear-gradient(180deg, #2f65e8 0%, #2a5fdc 100%);
}

.playground-frame {
  border-left: 4px solid #1e4fc6;
  border-right: 4px solid #1e4fc6;
  background: #ffffff;
  box-shadow: 0 16px 40px rgb(15 35 86 / 0.22);
}

.section-ribbon {
  border: 2px solid #1f4fbe;
  background: linear-gradient(180deg, #2f65e8 0%, #2051c3 100%);
  color: white;
}

/* Grid lines layered over the tile's Tailwind gradient. The from/to utilities
   set the stop variables; this rule must draw the gradient itself because its
   background-image overrides the bg-gradient utility. */
.game-thumb-grid {
  background-image:
    linear-gradient(90deg, rgb(255 255 255 / 0.22) 1px, transparent 1px),
    linear-gradient(0deg, rgb(255 255 255 / 0.22) 1px, transparent 1px),
    linear-gradient(var(--tw-gradient-stops, 135deg, #4e95ff, #1f63ea));
  background-size: 14px 14px, 14px 14px, 100% 100%;
}

/* Smooth scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* Focus ring utility */
.focus-ring {
  outline: 2px solid transparent;
  outline-offset: 2px;
}

.focus-ring:focus-visible {
  outline-color: var(--unit-1);
}
