/* ============================================
   MahatTalentSearch — Main Stylesheet
   Kid-friendly, colorful, responsive
   ============================================ */

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

:root {
  --red:    #e74c3c;
  --orange: #f39c12;
  --yellow: #f1c40f;
  --green:  #2ecc71;
  --teal:   #1abc9c;
  --blue:   #3498db;
  --purple: #9b59b6;
  --pink:   #e91e63;
  --white:  #ffffff;
  --gray-light: #f5f5f5;
  --gray:   #95a5a6;
  --gray-dark: #555;
  --font:   'Segoe UI', 'Comic Sans MS', Tahoma, sans-serif;
  --radius: 16px;
  --shadow: 0 4px 12px rgba(0,0,0,0.10);
  --shadow-hover: 0 8px 24px rgba(0,0,0,0.15);
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: #f0f4ff;
  color: #333;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; height: auto; display: block; }

/* ---------- Language Switcher ---------- */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
}
.lang-btn {
  padding: 4px 10px;
  border-radius: 14px;
  color: rgba(255,255,255,0.7);
  font-weight: 600;
  transition: background 0.2s, color 0.2s;
}
.lang-btn:hover { color: #fff; background: rgba(255,255,255,0.15); }
.lang-btn.active { color: #fff; background: rgba(255,255,255,0.3); }

/* ---------- Currency Buttons ---------- */
.cc-coin, .cc-note {
  background: none; border: none; padding: 2px; cursor: pointer;
  transition: transform 0.15s; border-radius: 8px;
}
.cc-coin:hover, .cc-note:hover { transform: scale(1.12); }
.cc-coin:active, .cc-note:active { transform: scale(0.94); }
.cc-coin:focus, .cc-note:focus { outline: 3px solid #6c5ce7; border-radius: 10px; }

/* ---------- Header ---------- */
.site-header {
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(108,92,231,0.3);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-img {
  width: 48px; height: 48px;
  background: var(--white);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
}
.logo-text {
  color: var(--white);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

/* ---------- Category Nav ---------- */
.cat-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cat-nav a {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.2);
  color: #fff;
  padding: 8px 14px;
  border-radius: 24px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.2s, transform 0.2s;
  backdrop-filter: blur(4px);
}
.cat-nav a:hover,
.cat-nav a.active {
  background: rgba(255,255,255,0.40);
  transform: scale(1.05);
}
.cat-icon {
  font-size: 1.2rem;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.3);
  border-radius: 50%;
  flex-shrink: 0;
}

/* ---------- Main Content ---------- */
.site-main {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px 20px;
  width: 100%;
}

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  margin-bottom: 40px;
}
.hero h1 {
  font-size: 2.2rem;
  font-weight: 800;
  color: #6c5ce7;
  margin-bottom: 8px;
}
.hero p {
  color: var(--gray-dark);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto;
}

/* ---------- Game Grid ---------- */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 24px;
  margin-bottom: 48px;
}

.game-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.25s, box-shadow 0.25s;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px 16px;
  text-align: center;
  cursor: pointer;
}
.game-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
}

.game-card-thumb {
  width: 120px; height: 120px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  margin-bottom: 12px;
}

.game-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: #333;
}

/* Thumb colour themes */
.thumb-math    { background: #ffeaa7; }
.thumb-read    { background: #dfe6e9; }
.thumb-art     { background: #fab1a0; }
.thumb-music   { background: #81ecec; }
.thumb-puzzle  { background: #a29bfe; }
.thumb-game    { background: #55efc4; }
.thumb-tool    { background: #74b9ff; }

/* ---------- Section Headings ---------- */
.section-heading {
  font-size: 1.6rem;
  font-weight: 800;
  color: #6c5ce7;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-heading .section-icon {
  font-size: 2rem;
}

/* ---------- Category Banner ---------- */
.cat-banner {
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  border-radius: var(--radius);
  padding: 30px;
  color: var(--white);
  margin-bottom: 32px;
  text-align: center;
}
.cat-banner h2 { font-size: 2rem; margin-bottom: 6px; }
.cat-banner p  { opacity: 0.9; font-size: 1.05rem; }

/* ---------- Footer ---------- */
.site-footer {
  background: #2d3436;
  color: #b2bec3;
  text-align: center;
  padding: 24px 20px;
  font-size: 0.85rem;
  margin-top: auto;
}
.site-footer a { color: #dfe6e9; text-decoration: underline; }
.footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 8px;
}

/* ---------- Game Page (full-screen tool) ---------- */
.game-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
}

.game-container {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px;
  max-width: 700px;
  width: 100%;
  text-align: center;
}

.game-title {
  font-size: 1.8rem;
  font-weight: 800;
  color: #6c5ce7;
  margin-bottom: 24px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #6c5ce7;
  font-weight: 600;
  margin-bottom: 20px;
  font-size: 0.95rem;
}
.back-link:hover { text-decoration: underline; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  padding: 12px 24px;
  border-radius: 28px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  font-family: var(--font);
}
.btn:hover { transform: scale(1.04); }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: #6c5ce7;
  color: #fff;
  box-shadow: 0 4px 12px rgba(108,92,231,0.35);
}
.btn-danger  { background: var(--red); color: #fff; }
.btn-success { background: var(--green); color: #fff; }
.btn-outline {
  background: #fff;
  color: #6c5ce7;
  border: 2px solid #6c5ce7;
}

/* ---------- Timer ---------- */
.timer-display {
  font-size: 6rem;
  font-weight: 800;
  color: #2d3436;
  margin: 20px 0;
  font-variant-numeric: tabular-nums;
  letter-spacing: 4px;
}

.timer-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 20px;
}

.timer-presets {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.preset-btn {
  padding: 8px 18px;
  border: 2px solid #ddd;
  border-radius: 20px;
  background: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font);
  font-size: 0.9rem;
}
.preset-btn:hover {
  border-color: #6c5ce7;
  color: #6c5ce7;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .header-inner { justify-content: center; }
  .cat-nav { justify-content: center; gap: 4px; }
  .cat-nav a { padding: 6px 10px; font-size: 0.75rem; }
  .cat-icon { font-size: 1rem; width: 24px; height: 24px; }
  .logo-text { font-size: 1.1rem; }
  .hero h1 { font-size: 1.5rem; }
  .hero p { font-size: 0.9rem; }
  .site-main { padding: 16px 10px; }
  .game-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
  .game-card { padding: 14px 10px 12px; }
  .game-card-thumb { width: 80px; height: 80px; font-size: 36px; }
  .game-card-title { font-size: 0.85rem; }
  .game-container { padding: 16px 10px; }
  .game-title { font-size: 1.3rem; }
  .timer-display { font-size: 3.5rem; }
  .btn { padding: 10px 18px; font-size: 0.9rem; }
  .cat-banner { padding: 20px 16px; }
  .cat-banner h2 { font-size: 1.4rem; }
  .section-heading { font-size: 1.2rem; }
  table { font-size: 0.75rem; }
  select { font-size: 0.85rem; padding: 8px 10px; }
  canvas { max-width: 100% !important; height: auto !important; }
}

@media (max-width: 480px) {
  .cat-nav { gap: 2px; }
  .cat-nav a { padding: 4px 7px; font-size: 0.65rem; border-radius: 16px; }
  .cat-icon { font-size: 0.8rem; width: 20px; height: 20px; }
  .logo-text { font-size: 0.95rem; }
  .logo-img { width: 36px; height: 36px; font-size: 20px; }
  .hero h1 { font-size: 1.2rem; }
  .hero p { font-size: 0.8rem; }
  .game-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
  .game-card { padding: 10px 6px 8px; }
  .game-card-thumb { width: 60px; height: 60px; font-size: 28px; border-radius: 12px; }
  .game-card-title { font-size: 0.7rem; }
  .game-title { font-size: 1.1rem; }
  .timer-display { font-size: 2.5rem; }
  .btn { padding: 8px 14px; font-size: 0.8rem; }
  .cat-banner h2 { font-size: 1.1rem; }
  .section-heading { font-size: 1rem; }
  .preset-btn { padding: 6px 12px; font-size: 0.75rem; }
  .game-page { padding: 8px; }
  .game-container { padding: 12px 8px; }
}
