/* ===========================================
   Super Maths Hero - Main CSS
   Variables, Reset, Base Styles
   =========================================== */

/* Google Fonts - Fredoka */
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@300;400;500;600;700&display=swap');

/* ===== CSS Variables ===== */
:root {
  /* Primary Colors */
  --color-primary: #FFD600;
  --color-primary-dark: #FFC000;
  --color-primary-light: #FFEB3B;

  /* Secondary Colors */
  --color-secondary: #FF4444;
  --color-secondary-dark: #D32F2F;

  /* Hero Colors */
  --color-hero-blue: #2196F3;
  --color-hero-blue-dark: #1976D2;
  --color-hero-red: #F44336;

  /* Feedback Colors */
  --color-success: #4CAF50;
  --color-success-light: #81C784;
  --color-error: #F44336;
  --color-error-light: #E57373;

  /* Background Colors */
  --color-bg: #FFF8E1;
  --color-bg-light: #FFFDE7;
  --color-bg-dark: #FFE082;

  /* Text Colors */
  --color-text: #333333;
  --color-text-light: #666666;
  --color-text-white: #FFFFFF;

  /* Comic Style */
  --border-comic: 3px solid #333333;
  --shadow-comic: 4px 4px 0 #333333;
  --shadow-comic-sm: 2px 2px 0 #333333;
  --shadow-comic-lg: 6px 6px 0 #333333;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-round: 50%;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-xxl: 48px;

  /* Typography */
  --font-family: 'Fredoka', sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-md: 1rem;
  --font-size-lg: 1.25rem;
  --font-size-xl: 1.5rem;
  --font-size-xxl: 2rem;
  --font-size-xxxl: 3rem;
  --font-size-hero: 4rem;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;

  /* Z-index layers */
  --z-base: 1;
  --z-overlay: 100;
  --z-modal: 200;
  --z-toast: 300;
}

/* ===== CSS Reset ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-md);
  font-weight: 400;
  line-height: 1.5;
  color: var(--color-text);
  background-color: var(--color-bg);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== Base Typography ===== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: var(--space-md);
}

h1 { font-size: var(--font-size-hero); }
h2 { font-size: var(--font-size-xxxl); }
h3 { font-size: var(--font-size-xxl); }
h4 { font-size: var(--font-size-xl); }
h5 { font-size: var(--font-size-lg); }
h6 { font-size: var(--font-size-md); }

p {
  margin-bottom: var(--space-md);
}

a {
  color: var(--color-hero-blue);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-hero-blue-dark);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, select {
  font-family: inherit;
  font-size: inherit;
}

ul, ol {
  list-style: none;
}

/* ===== App Container ===== */
#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== Screen System ===== */
.screen {
  display: none;
  flex-direction: column;
  min-height: 100vh;
  padding: var(--space-lg);
  animation: fadeIn var(--transition-normal);
}

.screen.active {
  display: flex;
}

/* ===== Background Pattern ===== */
.bg-pattern {
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255, 214, 0, 0.3) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(33, 150, 243, 0.2) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(255, 68, 68, 0.1) 0%, transparent 70%);
}

/* ===== Hero Background ===== */
.hero-bg {
  background-image: url('../images/hero-background.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* ===== Utility Classes ===== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--color-primary); }
.text-secondary { color: var(--color-secondary); }
.text-success { color: var(--color-success); }
.text-error { color: var(--color-error); }
.text-white { color: var(--color-text-white); }

.bg-primary { background-color: var(--color-primary); }
.bg-secondary { background-color: var(--color-secondary); }
.bg-success { background-color: var(--color-success); }
.bg-error { background-color: var(--color-error); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-center { justify-content: center; align-items: center; }
.flex-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

.w-full { width: 100%; }
.h-full { height: 100%; }

.mt-auto { margin-top: auto; }
.mb-auto { margin-bottom: auto; }
.mx-auto { margin-left: auto; margin-right: auto; }

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

.hidden { display: none !important; }
.visible { visibility: visible; }
.invisible { visibility: hidden; }

/* ===== Comic Text Effects ===== */
.comic-text {
  text-shadow:
    2px 2px 0 #333,
    -1px -1px 0 #333,
    1px -1px 0 #333,
    -1px 1px 0 #333;
  color: var(--color-text-white);
}

.comic-title {
  font-size: var(--font-size-hero);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* ===== Selection ===== */
::selection {
  background-color: var(--color-primary);
  color: var(--color-text);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg-dark);
  border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb {
  background: var(--color-primary);
  border-radius: var(--radius-sm);
  border: var(--border-comic);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary-dark);
}

/* ===== Focus States ===== */
:focus-visible {
  outline: 3px solid var(--color-hero-blue);
  outline-offset: 2px;
}

/* ===== Safe Area for Mobile ===== */
@supports (padding: env(safe-area-inset-bottom)) {
  .screen {
    padding-bottom: calc(var(--space-lg) + env(safe-area-inset-bottom));
  }
}
