/* =============================================
   theme.css — YASH'S KINGDOM VISUAL THEME
   =============================================
   All colors, fonts, animations and layout.
   To restyle the site, only edit this file.
   theme_color in Google Sheet config tab
   overrides --teal at runtime.
   ============================================= */

/* ── Color palette ────────────────────────── */
:root {
  --dark:       #0a1628;
  --navy:       #0d2040;
  --blue:       #1a4a7a;
  --teal:       #0e7c7b;
  --green:      #1db954;
  --light-teal: #4ecdc4;
  --white:      #f0f8ff;
  --gold:       #ffd700;
}

/* ── Reset ────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Nunito', sans-serif;
  background: var(--dark);
  color: var(--white);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Chess board background ───────────────── */
.chess-bg {
  background-image: repeating-conic-gradient(
    rgba(255,255,255,0.03) 0% 25%, transparent 0% 50%
  );
  background-size: 60px 60px;
}

/* ── Loading screen ───────────────────────── */
#loadingScreen {
  position: fixed;
  inset: 0;
  background: var(--dark);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.loading-inner { text-align: center; }
.loading-king {
  font-size: 5rem;
  display: block;
  animation: float 1.2s ease-in-out infinite;
}
.loading-text {
  font-family: 'Bangers', cursive;
  font-size: 1.8rem;
  color: var(--gold);
  letter-spacing: 2px;
  margin-top: 16px;
}

/* ── Pages ────────────────────────────────── */
.page { display: none; min-height: 100vh; }
.page.active { display: block; }

/* ── Header ───────────────────────────────── */
header {
  background: linear-gradient(135deg, var(--navy), var(--blue));
  border-bottom: 4px solid var(--gold);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
header h1 {
  font-family: 'Bangers', cursive;
  font-size: 2rem;
  color: var(--gold);
  letter-spacing: 2px;
  text-shadow: 2px 2px 0 #000;
}
.back-btn {
  font-family: 'Bangers', cursive;
  font-size: 1.1rem;
  background: var(--teal);
  color: white;
  border: 3px solid var(--gold);
  padding: 8px 18px;
  border-radius: 50px;
  cursor: pointer;
  letter-spacing: 1px;
  transition: all 0.2s;
  display: none;
}
.back-btn:hover  { background: var(--gold); color: var(--dark); transform: scale(1.05); }
.back-btn.visible { display: block; }

/* ── Hero ─────────────────────────────────── */
#home { background: var(--dark); }
.hero {
  text-align: center;
  padding: 50px 20px 30px;
  background: linear-gradient(180deg, var(--navy) 0%, var(--dark) 100%);
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '♔ ♕ ♖ ♗ ♘ ♙';
  position: absolute;
  top: 10px; left: 50%;
  transform: translateX(-50%);
  font-size: 1.5rem;
  opacity: 0.15;
  white-space: nowrap;
  letter-spacing: 20px;
}
.king-emoji {
  font-size: 5rem;
  display: block;
  margin: 20px auto;
  animation: float 3s ease-in-out infinite;
}
.hero-title {
  font-family: 'Bangers', cursive;
  font-size: clamp(3rem, 10vw, 6rem);
  color: var(--gold);
  text-shadow: 4px 4px 0 #000, 6px 6px 0 var(--teal);
  letter-spacing: 3px;
  line-height: 1;
  animation: titlePop 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}
.hero-sub {
  font-size: 1.3rem;
  color: var(--light-teal);
  font-weight: 900;
  margin-top: 10px;
  animation: fadeUp 0.8s ease 0.3s both;
}

/* ── Home buttons ─────────────────────────── */
.buttons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  padding: 40px 30px;
  max-width: 1100px;
  margin: 0 auto;
}
.big-btn {
  background: linear-gradient(135deg, var(--navy), var(--blue));
  border: 4px solid var(--teal);
  border-radius: 20px;
  padding: 36px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}
.big-btn::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
  transition: left 0.4s;
}
.big-btn:hover::before { left: 100%; }
.big-btn:hover {
  transform: translateY(-8px) scale(1.03);
  border-color: var(--gold);
  box-shadow: 0 16px 40px rgba(0,0,0,0.5), 0 0 20px rgba(255,215,0,0.2);
}
.big-btn .icon  { font-size: 3.5rem; display: block; margin-bottom: 14px; }
.big-btn h2 {
  font-family: 'Bangers', cursive;
  font-size: 2rem;
  color: var(--gold);
  letter-spacing: 2px;
  text-shadow: 2px 2px 0 #000;
}
.big-btn p { color: var(--light-teal); font-size: 0.95rem; margin-top: 8px; font-weight: 700; }

/* ── Score bar ────────────────────────────── */
.score-bar {
  background: linear-gradient(135deg, var(--navy), var(--blue));
  border-bottom: 3px solid var(--teal);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: 'Bangers', cursive;
  font-size: 1.3rem;
  color: var(--gold);
  letter-spacing: 1px;
}
.score-bar span { color: white; font-size: 1rem; font-family: 'Nunito', sans-serif; font-weight: 900; }

/* ── Section wrapper ──────────────────────── */
.section-content { max-width: 900px; margin: 0 auto; padding: 40px 24px; }
.section-title {
  font-family: 'Bangers', cursive;
  font-size: 3rem;
  color: var(--gold);
  text-shadow: 3px 3px 0 #000;
  letter-spacing: 3px;
  margin-bottom: 30px;
  text-align: center;
}
.page-hint  { text-align: center; color: var(--light-teal); font-weight: 900; margin-bottom: 24px; }
.no-data    { text-align: center; color: var(--light-teal); font-weight: 700; padding: 40px; font-size: 1.1rem; }

/* ── About Me ─────────────────────────────── */
.about-card {
  background: linear-gradient(135deg, var(--navy), var(--blue));
  border: 4px solid var(--teal);
  border-radius: 20px;
  padding: 36px;
  margin-bottom: 24px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}
.about-card h3 {
  font-family: 'Bangers', cursive;
  font-size: 1.8rem;
  color: var(--light-teal);
  letter-spacing: 2px;
  margin-bottom: 16px;
}
.fact-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 2px dashed rgba(255,255,255,0.1);
  font-size: 1.1rem;
  font-weight: 700;
}
.fact-row:last-child { border-bottom: none; }
.fact-icon  { font-size: 1.8rem; min-width: 40px; }
.fact-label { color: var(--light-teal); min-width: 120px; }
.fact-value { color: white; }

/* ── Jokes ────────────────────────────────── */
.joke-card {
  background: linear-gradient(135deg, var(--navy), #0d2a1e);
  border: 4px solid var(--teal);
  border-radius: 20px;
  padding: 28px;
  margin-bottom: 20px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}
.joke-card:hover { transform: scale(1.02); border-color: var(--gold); }
.joke-q { font-family: 'Bangers', cursive; font-size: 1.5rem; color: var(--gold); letter-spacing: 1px; }
.joke-a {
  margin-top: 16px;
  font-size: 1.2rem;
  color: var(--light-teal);
  font-weight: 900;
  display: none;
  animation: fadeUp 0.3s ease;
}
.joke-a.shown { display: block; }
.tap-hint { font-size: 0.85rem; color: rgba(255,255,255,0.4); margin-top: 10px; }

/* ── Math Quiz ────────────────────────────── */
.math-box {
  background: linear-gradient(135deg, var(--navy), var(--blue));
  border: 4px solid var(--teal);
  border-radius: 20px;
  padding: 36px;
  text-align: center;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}
.math-subtitle { color: var(--light-teal); font-weight: 900; font-size: 1.1rem; }
.math-question {
  font-family: 'Bangers', cursive;
  font-size: 4rem;
  color: var(--gold);
  letter-spacing: 4px;
  text-shadow: 3px 3px 0 #000;
  margin: 20px 0;
  animation: fadeUp 0.3s ease;
}
.math-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 24px; }
.choice-btn {
  font-family: 'Bangers', cursive;
  font-size: 2rem;
  letter-spacing: 2px;
  padding: 20px;
  border-radius: 14px;
  border: 4px solid var(--teal);
  background: var(--dark);
  color: white;
  cursor: pointer;
  transition: all 0.2s;
}
.choice-btn:hover   { transform: scale(1.08); border-color: var(--gold); }
.choice-btn.correct { background: var(--teal);  border-color: var(--green); animation: correctPop 0.4s ease; }
.choice-btn.wrong   { background: #7f1d1d; border-color: #ef4444;      animation: shake 0.4s ease; }
.math-feedback {
  font-family: 'Bangers', cursive;
  font-size: 2rem;
  margin-top: 20px;
  letter-spacing: 2px;
  min-height: 50px;
  text-align: center;
}
.next-btn {
  font-family: 'Bangers', cursive;
  font-size: 1.5rem;
  letter-spacing: 2px;
  padding: 14px 40px;
  background: var(--teal);
  color: white;
  border: 4px solid var(--gold);
  border-radius: 50px;
  cursor: pointer;
  margin-top: 20px;
  transition: all 0.2s;
  display: none;
}
.next-btn:hover    { background: var(--gold); color: var(--dark); transform: scale(1.05); }
.next-btn.visible  { display: inline-block; }

/* ── Sudoku ───────────────────────────────── */
.sudoku-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  max-width: 320px;
  margin: 0 auto 30px;
  background: var(--gold);
  padding: 6px;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}
.sudoku-cell {
  background: var(--navy);
  border-radius: 6px;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bangers', cursive;
  font-size: 2rem;
  color: var(--gold);
  border: 3px solid transparent;
  transition: all 0.2s;
}
.sudoku-cell.given    { color: var(--light-teal); }
.sudoku-cell.editable { cursor: pointer; color: white; }
.sudoku-cell.editable:hover { border-color: var(--gold); background: var(--blue); }
.sudoku-cell.selected { border-color: var(--gold); background: var(--blue); box-shadow: 0 0 10px rgba(255,215,0,0.4); }
.number-pad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  max-width: 320px;
  margin: 0 auto 20px;
}
.num-btn {
  font-family: 'Bangers', cursive;
  font-size: 1.8rem;
  padding: 16px;
  background: var(--navy);
  border: 3px solid var(--teal);
  border-radius: 10px;
  color: var(--gold);
  cursor: pointer;
  transition: all 0.2s;
}
.num-btn:hover  { background: var(--teal); transform: scale(1.1); }
.clear-btn      { grid-column: span 4; font-size: 1.3rem; }
.sudoku-controls { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.ctrl-btn {
  font-family: 'Bangers', cursive;
  font-size: 1.2rem;
  letter-spacing: 1px;
  padding: 12px 28px;
  border-radius: 50px;
  border: 3px solid var(--gold);
  cursor: pointer;
  transition: all 0.2s;
}
.ctrl-btn.check { background: var(--teal); color: white; }
.ctrl-btn.reset { background: var(--blue); color: white; }
.ctrl-btn:hover { transform: scale(1.05); opacity: 0.9; }

/* ── Memory Game ──────────────────────────── */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  max-width: 400px;
  margin: 0 auto 24px;
}
.mem-card {
  aspect-ratio: 1;
  border-radius: 12px;
  cursor: pointer;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.4s;
}
.mem-card.flipped { transform: rotateY(180deg); }
.mem-card.matched { opacity: 0.6; pointer-events: none; }
.mem-front, .mem-back {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  backface-visibility: hidden;
  border: 4px solid var(--teal);
}
.mem-front { background: linear-gradient(135deg, var(--blue), var(--navy)); }
.mem-back  { background: linear-gradient(135deg, var(--navy), var(--teal)); transform: rotateY(180deg); border-color: var(--gold); }

/* ── Toast ────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 30px; left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--teal);
  color: white;
  font-family: 'Bangers', cursive;
  font-size: 1.8rem;
  letter-spacing: 2px;
  padding: 16px 40px;
  border-radius: 50px;
  border: 4px solid var(--gold);
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
  z-index: 999;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ── Chess piece footer row ───────────────── */
.chess-row {
  text-align: center;
  font-size: 2.5rem;
  padding: 20px;
  opacity: 0.15;
  letter-spacing: 10px;
  pointer-events: none;
}

/* ── Animations ───────────────────────────── */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-15px); }
}
@keyframes titlePop {
  0%   { transform: scale(0.5) rotate(-5deg); opacity: 0; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes correctPop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25%       { transform: translateX(-8px); }
  75%       { transform: translateX(8px); }
}

/* ── Responsive ───────────────────────────── */
@media (max-width: 480px) {
  .hero-title      { font-size: 3rem; }
  .buttons-grid    { grid-template-columns: 1fr 1fr; gap: 14px; padding: 20px 14px; }
  .big-btn         { padding: 24px 12px; }
  .big-btn h2      { font-size: 1.4rem; }
  .big-btn .icon   { font-size: 2.5rem; }
  .section-content { padding: 24px 14px; }
  .section-title   { font-size: 2.2rem; }
  .math-question   { font-size: 2.8rem; }
}
