/* ========================================================================== 
   Variables
   ========================================================================== */

:root {
  /* Colors */
  --color-bg: #050711; /* deep charcoal / night */
  --color-surface: #111321;
  --color-surface-soft: #181a2a;
  --color-text: #ffffff;
  --color-text-muted: #cfd3ff;
  --color-primary: #1f7bff; /* electric blue */
  --color-primary-soft: rgba(31, 123, 255, 0.12);
  --color-accent-yellow: #ffe047;
  --color-accent-coral: #ff4f7b;
  --color-success: #3ad27a;
  --color-warning: #ffb347;
  --color-danger: #ff4242;

  /* Neutral grays */
  --color-gray-50: #f9fafb;
  --color-gray-100: #f3f4f6;
  --color-gray-200: #e5e7eb;
  --color-gray-300: #d1d5db;
  --color-gray-400: #9ca3af;
  --color-gray-500: #6b7280;
  --color-gray-600: #4b5563;
  --color-gray-700: #374151;
  --color-gray-800: #1f2933;
  --color-gray-900: #111827;

  /* Typography */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Baloo 2", "Fredoka", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --font-size-xs: 0.75rem;   /* 12px */
  --font-size-sm: 0.875rem;  /* 14px */
  --font-size-md: 1rem;      /* 16px */
  --font-size-lg: 1.125rem;  /* 18px */
  --font-size-xl: 1.25rem;   /* 20px */
  --font-size-2xl: 1.5rem;   /* 24px */
  --font-size-3xl: 1.875rem; /* 30px */
  --font-size-4xl: 2.25rem;  /* 36px */
  --font-size-5xl: 3rem;     /* 48px */

  --line-height-tight: 1.1;
  --line-height-snug: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.7;

  /* Spacing scale (px) */
  --space-0: 0;
  --space-1: 2px;
  --space-2: 4px;
  --space-3: 6px;
  --space-4: 8px;
  --space-5: 10px;
  --space-6: 12px;
  --space-7: 14px;
  --space-8: 16px;
  --space-9: 20px;
  --space-10: 24px;
  --space-11: 28px;
  --space-12: 32px;
  --space-16: 40px;
  --space-20: 48px;
  --space-24: 56px;
  --space-28: 64px;
  --space-32: 72px;
  --space-36: 80px;
  --space-40: 96px;

  /* Radius */
  --radius-none: 0;
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-pill: 999px;

  /* Shadows - energetic, card-deck style */
  --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.25);
  --shadow-sm: 0 6px 14px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 14px 30px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);
  --shadow-glow-primary: 0 0 0 1px rgba(31, 123, 255, 0.5), 0 0 25px rgba(31, 123, 255, 0.7);
  --shadow-glow-accent: 0 0 0 1px rgba(255, 224, 71, 0.4), 0 0 30px rgba(255, 79, 123, 0.6);

  /* Transitions */
  --transition-fast: 120ms ease-out;
  --transition-normal: 200ms ease-out;
  --transition-slow: 320ms ease-out;

  /* Layout */
  --container-max-width: 1120px;
  --container-padding-x: 20px;
}

/* Respect prefers-reduced-motion early */
@media (prefers-reduced-motion: reduce) {
  :root {
    scroll-behavior: auto;
  }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ========================================================================== 
   Reset / Normalize
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
}

h1,
h2,
h3,
h4,
h5,
h6,
p,
figure,
blockquote,
ol,
ul,
dl {
  margin: 0;
}

ol,
ul {
  padding: 0;
  list-style: none;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  margin: 0;
  font: inherit;
  color: inherit;
  background: none;
  border-radius: 0;
}

button {
  border: none;
  padding: 0;
  cursor: pointer;
}

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

table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* ========================================================================== 
   Base Styles
   ========================================================================== */

body {
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: var(--font-size-md);
  line-height: var(--line-height-normal);
  background: radial-gradient(circle at top left, #1f7bff 0, transparent 55%),
              radial-gradient(circle at bottom right, #ff4f7b 0, transparent 55%),
              var(--color-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main {
  display: block;
}

/* Headings - playful, bold, scalable */

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--color-text);
}

h1 {
  font-size: clamp(var(--font-size-3xl), 4vw, var(--font-size-5xl));
  line-height: var(--line-height-tight);
  margin-bottom: var(--space-6);
}

h2 {
  font-size: clamp(var(--font-size-2xl), 3vw, var(--font-size-4xl));
  line-height: var(--line-height-snug);
  margin-bottom: var(--space-5);
}

h3 {
  font-size: var(--font-size-2xl);
  line-height: var(--line-height-snug);
  margin-bottom: var(--space-4);
}

h4 {
  font-size: var(--font-size-xl);
  margin-bottom: var(--space-3);
}

h5 {
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-2);
}

h6 {
  font-size: var(--font-size-md);
  margin-bottom: var(--space-1);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

p {
  margin-bottom: var(--space-4);
  color: var(--color-text-muted);
}

strong,
b {
  font-weight: 600;
}

small {
  font-size: var(--font-size-sm);
}

code,
pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* Links - animated underline, bright colors */

a {
  position: relative;
  color: var(--color-accent-yellow);
  text-decoration: none;
  transition: color var(--transition-fast), transform var(--transition-fast);
}

a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent-coral));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-normal);
}

a:hover::after,
a:focus-visible::after {
  transform: scaleX(1);
}

a:hover {
  color: var(--color-accent-coral);
}

/* Form basics */

label {
  display: inline-block;
  margin-bottom: var(--space-2);
  font-weight: 500;
}

::placeholder {
  color: var(--color-gray-400);
}

/* ========================================================================== 
   Accessibility / Focus
   ========================================================================== */

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--color-accent-yellow);
  outline-offset: 3px;
}

@supports selector(:focus-visible) {
  :focus:not(:focus-visible) {
    outline: none;
  }
}

/* Screen reader only */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sr-only-focusable:active,
.sr-only-focusable:focus {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* ========================================================================== 
   Utilities
   ========================================================================== */

/* Container */

.container {
  width: 100%;
  max-width: var(--container-max-width);
  margin-inline: auto;
  padding-inline: var(--container-padding-x);
}

.section {
  padding-block: var(--space-24);
}

.section--tight {
  padding-block: var(--space-16);
}

/* Layout helpers */

.flex {
  display: flex;
}

.inline-flex {
  display: inline-flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-col {
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.gap-xs {
  gap: var(--space-3);
}

.gap-sm {
  gap: var(--space-4);
}

.gap-md {
  gap: var(--space-6);
}

.gap-lg {
  gap: var(--space-10);
}

.grid {
  display: grid;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-8);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-8);
}

@media (max-width: 768px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: minmax(0, 1fr);
  }
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.mt-0 { margin-top: 0; }
.mt-xs { margin-top: var(--space-3); }
.mt-sm { margin-top: var(--space-6); }
.mt-md { margin-top: var(--space-10); }
.mt-lg { margin-top: var(--space-16); }

.mb-0 { margin-bottom: 0; }
.mb-xs { margin-bottom: var(--space-3); }
.mb-sm { margin-bottom: var(--space-6); }
.mb-md { margin-bottom: var(--space-10); }
.mb-lg { margin-bottom: var(--space-16); }

.p-sm { padding: var(--space-6); }
.p-md { padding: var(--space-10); }
.p-lg { padding: var(--space-16); }

.badge-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(17, 19, 33, 0.8);
}

.badge-pill--primary {
  background: var(--color-primary-soft);
  color: var(--color-accent-yellow);
}

/* Utility color classes */

.text-muted { color: var(--color-text-muted); }
.text-primary { color: var(--color-primary); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-danger { color: var(--color-danger); }

.bg-surface { background-color: var(--color-surface); }
.bg-surface-soft { background-color: var(--color-surface-soft); }

.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-pill { border-radius: var(--radius-pill); }

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

/* ========================================================================== 
   Components
   ========================================================================== */

/* Buttons - vibrant, pill-shaped, animated */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: 10px 24px;
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--font-size-md);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 0;
  cursor: pointer;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent-coral));
  color: #050711;
  box-shadow: var(--shadow-md);
  transform: translateY(0);
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    filter var(--transition-fast),
    background var(--transition-slow);
}

.button:hover {
  transform: translateY(-1px) scale(1.02);
  filter: brightness(1.05);
  box-shadow: var(--shadow-glow-accent);
}

.button:active {
  transform: translateY(1px) scale(0.99);
  box-shadow: var(--shadow-sm);
}

.button:focus-visible {
  outline: 2px solid var(--color-accent-yellow);
  outline-offset: 3px;
}

.button--primary {
  background: linear-gradient(135deg, var(--color-primary), #66a3ff);
  color: #050711;
}

.button--secondary {
  background: rgba(17, 19, 33, 0.9);
  color: var(--color-accent-yellow);
  border: 1px solid rgba(255, 224, 71, 0.4);
}

.button--ghost {
  background: transparent;
  color: var(--color-text);
  border: 1px dashed rgba(255, 255, 255, 0.35);
  box-shadow: none;
}

.button--icon-only {
  padding-inline: 12px;
}

.button[disabled],
.button--disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* Inputs & textareas */

.input,
.textarea,
.select {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.11);
  background-color: rgba(5, 7, 17, 0.9);
  color: var(--color-text);
  font-size: var(--font-size-md);
  transition:
    border-color var(--transition-normal),
    box-shadow var(--transition-normal),
    background-color var(--transition-normal),
    transform var(--transition-fast);
}

.input:hover,
.textarea:hover,
.select:hover {
  border-color: rgba(255, 224, 71, 0.5);
}

.input:focus-visible,
.textarea:focus-visible,
.select:focus-visible {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px rgba(31, 123, 255, 0.5);
  background-color: rgba(5, 7, 17, 0.98);
  transform: translateY(-1px);
}

.textarea {
  min-height: 120px;
  resize: vertical;
}

.select {
  appearance: none;
  -moz-appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--color-accent-yellow) 50%),
    linear-gradient(135deg, var(--color-accent-yellow) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

.field-error {
  margin-top: var(--space-1);
  font-size: var(--font-size-xs);
  color: var(--color-danger);
}

/* Card - playful, deck-like */

.card {
  position: relative;
  background: radial-gradient(circle at top left, rgba(255, 224, 71, 0.06), transparent 60%),
              radial-gradient(circle at bottom right, rgba(31, 123, 255, 0.1), transparent 60%),
              var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-10);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: -40%;
  background: conic-gradient(from 140deg, rgba(255, 224, 71, 0.32), rgba(255, 79, 123, 0.2), rgba(31, 123, 255, 0.22), transparent 60%);
  opacity: 0;
  mix-blend-mode: screen;
  transition: opacity var(--transition-slow);
}

.card:hover::before {
  opacity: 1;
}

.card__content {
  position: relative;
  z-index: 1;
}

.card--deck {
  border-radius: 20px;
  transform: rotate(-1deg);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.card--deck:hover {
  transform: translateY(-6px) rotate(0deg) scale(1.01);
  box-shadow: var(--shadow-glow-primary);
}

.card--soft {
  background: var(--color-surface-soft);
  box-shadow: var(--shadow-sm);
}

.card-header {
  margin-bottom: var(--space-6);
}

.card-title {
  font-size: var(--font-size-xl);
  margin-bottom: var(--space-2);
}

.card-meta {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

/* Chip / Tag for deck categories */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(5, 7, 17, 0.85);
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
}

.chip--hot {
  background: linear-gradient(135deg, rgba(255, 79, 123, 0.8), rgba(255, 224, 71, 0.9));
  color: #050711;
}

.chip--family {
  background: rgba(58, 210, 122, 0.25);
  color: var(--color-success);
}

/* Media wrapper for responsive videos */

.media-responsive {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.media-responsive iframe,
.media-responsive video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Playful animated pulse ring (for active games, live status, etc.) */

.pulse-ring {
  position: relative;
}

.pulse-ring::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: inherit;
  border: 2px solid rgba(255, 224, 71, 0.6);
  opacity: 0;
  animation: pulse-ring 1.6s infinite;
}

@keyframes pulse-ring {
  0% {
    transform: scale(0.85);
    opacity: 0.8;
  }
  100% {
    transform: scale(1.15);
    opacity: 0;
  }
}

/* Preference-aware: soften some animations if user prefers less motion */

@media (prefers-reduced-motion: reduce) {
  .button,
  .card,
  .card--deck,
  .pulse-ring::after {
    transition-duration: 0.01ms !important;
    animation: none !important;
  }
}

/* ========================================================================== 
   End base.css
   ========================================================================== */
