/* =========================================================
   TablasMágicas — style.css
   ========================================================= */

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

:root {
  --ff: 'Nunito', sans-serif;
  --ff2: 'Fredoka One', cursive;

  /* palette */
  --purple:  #7c3aed;
  --purple2: #a855f7;
  --blue:    #2563eb;
  --blue2:   #38bdf8;
  --pink:    #ec4899;
  --pink2:   #f9a8d4;
  --orange:  #f97316;
  --orange2: #fed7aa;
  --green:   #16a34a;
  --green2:  #bbf7d0;
  --yellow:  #eab308;
  --yellow2: #fef9c3;
  --red:     #dc2626;

  --bg-dark: #0f0c29;
  --bg-mid:  #1a1040;
  --white:   #ffffff;
  --text:    #1e1b4b;

  --radius: 20px;
  --shadow: 0 8px 32px rgba(0,0,0,.35);
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  font-family: var(--ff);
  background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
  color: var(--white);
}

/* ---------- BACKGROUND STARS ---------- */
#bg-stars {
  position: fixed; inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.star {
  position: absolute;
  border-radius: 50%;
  background: #fff;
  animation: twinkle var(--d, 3s) ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity:.1; transform:scale(.7); } to { opacity:.9; transform:scale(1.2); } }

/* ---------- CONFETTI CANVAS ---------- */
#confetti-canvas {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 9999;
}

/* ---------- SCREENS ---------- */
.screen {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transform: translateY(30px);
  transition: opacity .4s ease, transform .4s ease;
  z-index: 10;
}
.screen.active {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

/* =========================================================
   HOME SCREEN
   ========================================================= */
.home-container {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 28px; padding: 32px 16px;
}

/* logo */
.logo-wrap { text-align: center; }
.logo-icon { font-size: 3.5rem; animation: bounce 2s ease-in-out infinite; }
@keyframes bounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-14px)} }
.logo-title {
  font-family: var(--ff2);
  font-size: clamp(2.2rem, 6vw, 3.8rem);
  background: linear-gradient(90deg, #f9d835, #ff7eb3, #9b5de5);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,.5));
}
.logo-sub { font-size: 1.1rem; color: #c4b5fd; margin-top: 4px; }

/* mascot */
.mascot-area { position: relative; text-align: center; }
.mascot { font-size: 5rem; animation: mascot-float 3s ease-in-out infinite; display: inline-block; }
@keyframes mascot-float { 0%,100%{transform:translateY(0) rotate(-3deg)} 50%{transform:translateY(-10px) rotate(3deg)} }
.home-container, .game-container, .lesson-container, .test-container {
  width: 90%; max-width: 800px;
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 32px;
  padding: 40px;
  box-shadow: var(--shadow);
  text-align: center;
  position: relative;
  z-index: 10;
  display: flex; flex-direction: column; align-items: center;
  overflow-y: auto; max-height: 90vh;
}

.logo-title {
  font-family: var(--ff2); font-size: 3.5rem; color: #fff;
  margin-bottom: 5px; text-shadow: 4px 4px 0px rgba(0,0,0,0.2);
}
.logo-sub { font-weight: 700; color: #fff; opacity: .8; }

.mascot-area { margin: 20px 0; display: flex; flex-direction: column; align-items: center; }
.mascot { font-size: 5rem; animation: mascot-float 3s infinite ease-in-out; }
.speech-bubble {
  position: absolute; top: -60px; left: 50%; transform: translateX(-50%);
  background: #fff; color: var(--text); border-radius: 16px;
  padding: 10px 16px; font-size: .9rem; font-weight: 700;
  white-space: nowrap; box-shadow: var(--shadow);
  animation: bubble-in .6s .5s both;
}
.speech-bubble::after {
  content: ''; position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%);
  border: 10px solid transparent; border-top-color: #fff; border-bottom: none;
}
@keyframes bubble-in { from{opacity:0;transform:translateX(-50%) scale(.7)} to{opacity:1;transform:translateX(-50%) scale(1)} }

/* cards */
.home-cards { display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; }
.home-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 28px 32px; border-radius: 24px; border: none; cursor: pointer;
  font-family: var(--ff); transition: transform .2s, box-shadow .2s;
  min-width: 150px; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.home-card::before {
  content: ''; position: absolute; inset: 0;
  background: rgba(255,255,255,.08);
  transform: translateY(100%); transition: transform .3s;
}
.home-card:hover::before { transform: translateY(0); }
.home-card:hover { transform: translateY(-6px) scale(1.04); }
.card-learn  { background: linear-gradient(135deg, #7c3aed, #a855f7); }
.card-game   { background: linear-gradient(135deg, #f97316, #fbbf24); }
.card-test   { background: linear-gradient(135deg, #0ea5e9, #6366f1); }
.card-multi  { background: linear-gradient(135deg, #10b981, #059669); }
.card-icon   { font-size: 2.6rem; }
.card-label  { font-family: var(--ff2); font-size: 1.4rem; color: #fff; }
.card-hint   { font-size: .78rem; color: rgba(255,255,255,.8); }

/* score */
.score-display {
  background: rgba(255,255,255,.1); border-radius: 50px;
  padding: 10px 28px; font-size: 1.1rem; font-weight: 700;
  backdrop-filter: blur(8px);
}

/* ---------- SHARED BACK BUTTON ---------- */
.btn-back {
  background: rgba(255,255,255,.15); border: 2px solid rgba(255,255,255,.3);
  color: #fff; border-radius: 12px; padding: 8px 18px;
  font-family: var(--ff); font-weight: 700; cursor: pointer;
  transition: background .2s;
}
.btn-back:hover { background: rgba(255,255,255,.28); }

/* =========================================================
   LESSON SCREEN
   ========================================================= */
.lesson-container {
  min-height: 100vh; display: flex; flex-direction: column;
  padding: 20px 16px; gap: 16px; max-width: 900px; margin: 0 auto;
}
.lesson-header { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

/* table selector pills */
.selector-label { font-weight: 700; color: #c4b5fd; }
.table-selector { display: flex; flex-wrap: wrap; gap: 8px; }
.tbl-pill {
  padding: 6px 14px; border-radius: 50px; border: 2px solid rgba(255,255,255,.3);
  background: rgba(255,255,255,.1); color: #fff; cursor: pointer;
  font-family: var(--ff); font-weight: 700; font-size: .85rem; transition: all .2s;
}
.tbl-pill:hover { border-color: #a78bfa; background: rgba(167,139,250,.2); }
.tbl-pill.active {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  border-color: transparent; transform: scale(1.1);
}

.lesson-body { display: flex; gap: 20px; flex-wrap: wrap; flex: 1; }

/* grid */
.lesson-grid-wrap { flex: 1; min-width: 260px; }
.lesson-title-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.lesson-table-badge {
  font-family: var(--ff2); font-size: 1.6rem;
  background: linear-gradient(90deg, #f9d835, #ff7eb3);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.lesson-mascot { font-size: 2rem; animation: mascot-float 3s infinite ease-in-out; }
.lesson-grid { display: flex; flex-direction: column; gap: 8px; }

.lesson-row {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,.07); border-radius: 14px;
  padding: 10px 16px; border: 2px solid transparent;
  transition: all .3s; cursor: default; position: relative;
}
.lesson-row.highlighted {
  background: rgba(167,139,250,.25);
  border-color: #a78bfa;
  transform: translateX(6px);
}
.lesson-row.highlighted .lr-result {
  color: #f9d835; font-size: 1.3rem;
}
.lr-mult { font-size: 1.05rem; font-weight: 700; color: #c4b5fd; min-width: 110px; }
.lr-eq   { font-size: 1rem; color: #6b7280; }
.lr-result { font-family: var(--ff2); font-size: 1.2rem; color: #fff; transition: all .3s; }

/* visual blocks */
.lesson-visual {
  flex: 1; min-width: 240px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px;
}
.visual-title { font-weight: 700; color: #c4b5fd; text-align: center; }
.visual-groups { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.visual-group {
  display: flex; flex-wrap: wrap; gap: 4px;
  background: rgba(255,255,255,.07); border-radius: 12px; padding: 8px;
  border: 2px solid rgba(255,255,255,.15);
}
.visual-dot {
  width: 22px; height: 22px; border-radius: 50%;
  animation: pop-in .3s ease both;
}
@keyframes pop-in { from{transform:scale(0)} to{transform:scale(1)} }

/* nav */
.lesson-nav { display: flex; align-items: center; gap: 12px; }
.lesson-btn {
  background: linear-gradient(135deg, #7c3aed, #a855f7); color: #fff;
  border: none; border-radius: 14px; padding: 10px 24px;
  font-family: var(--ff); font-weight: 800; font-size: 1rem; cursor: pointer;
  transition: transform .2s, opacity .2s;
}
.lesson-btn:hover { transform: scale(1.05); }
.lesson-btn:disabled { opacity: .4; cursor: default; transform: none; }
.lesson-progress { flex: 1; text-align: center; }
.lesson-progress-bar { height: 8px; background: rgba(255,255,255,.15); border-radius: 99px; margin-top: 6px; overflow: hidden; }
.lesson-progress-fill { height: 100%; background: linear-gradient(90deg, #a855f7, #f9d835); border-radius: 99px; transition: width .4s; }

/* fact box */
.lesson-fact-box {
  background: rgba(255,255,255,.08); border-left: 4px solid #f9d835;
  border-radius: 12px; padding: 12px 16px;
  font-size: .9rem; color: #fef9c3; font-weight: 600; min-height: 44px;
}

/* =========================================================
   GAME SCREEN
   ========================================================= */
.game-container {
  min-height: 100vh; display: flex; flex-direction: column;
  padding: 20px 16px; gap: 16px; max-width: 700px; margin: 0 auto;
}
.game-header { display: flex; align-items: center; gap: 16px; }
.game-hud { display: flex; gap: 20px; margin-left: auto; }
.hud-item {
  display: flex; flex-direction: column; align-items: center;
  background: rgba(255,255,255,.1); border-radius: 14px;
  padding: 6px 18px; font-family: var(--ff2); font-size: 1.4rem;
  min-width: 70px;
}
.hud-item span:first-child { font-size: .9rem; }

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

/* start panel */
.game-start-panel {
  text-align: center; display: flex; flex-direction: column; align-items: center; gap: 20px;
  background: rgba(255,255,255,.07); border-radius: 28px; padding: 40px 32px;
  backdrop-filter: blur(8px); border: 2px solid rgba(255,255,255,.15);
  max-width: 480px; width: 100%;
}
.gs-mascot { font-size: 4rem; animation: mascot-float 3s infinite; }
.gs-title { font-family: var(--ff2); font-size: 2rem; }
.gs-desc { font-size: 1rem; color: #c4b5fd; }
.gs-table-pick { display: flex; align-items: center; gap: 12px; font-weight: 700; }
.gs-table-pick select {
  background: rgba(255,255,255,.15); color: #fff; border: 2px solid rgba(255,255,255,.3);
  border-radius: 12px; padding: 8px 14px; font-family: var(--ff); font-size: 1rem; cursor: pointer;
}
.gs-table-pick select option { background: #1a1040; }
.btn-start-game {
  background: linear-gradient(135deg, #f97316, #fbbf24); color: #fff;
  border: none; border-radius: 16px; padding: 14px 44px;
  font-family: var(--ff2); font-size: 1.5rem; cursor: pointer;
  box-shadow: 0 6px 20px rgba(249,115,22,.5);
  transition: transform .2s, box-shadow .2s;
}
.btn-start-game:hover { transform: scale(1.07); box-shadow: 0 10px 30px rgba(249,115,22,.7); }

/* play panel */
.game-play-panel {
  text-align: center; width: 100%; max-width: 560px;
  display: flex; flex-direction: column; align-items: center; gap: 28px;
}
.game-table-label { font-size: 1.1rem; color: #c4b5fd; font-weight: 700; }
.game-equation {
  font-family: var(--ff2); font-size: clamp(2.8rem, 9vw, 5rem);
  background: linear-gradient(90deg, #f9d835, #ff7eb3);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,.4));
  animation: eq-in .3s ease both;
}
@keyframes eq-in { from{transform:scale(.6) rotate(-5deg); opacity:0} to{transform:scale(1) rotate(0); opacity:1} }

.game-options {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: 100%;
}
.opt-btn {
  padding: 18px; border-radius: 18px; border: 3px solid rgba(255,255,255,.2);
  background: rgba(255,255,255,.1); color: #fff;
  font-family: var(--ff2); font-size: 1.8rem; cursor: pointer;
  transition: transform .15s, background .15s, border-color .15s;
  backdrop-filter: blur(6px);
}
.opt-btn:hover { transform: scale(1.06); background: rgba(255,255,255,.22); border-color: #a78bfa; }
.opt-btn.correct { background: linear-gradient(135deg,#16a34a,#4ade80); border-color: #4ade80; }
.opt-btn.wrong   { background: linear-gradient(135deg,#dc2626,#f87171); border-color: #f87171; }

.game-feedback { font-family: var(--ff2); font-size: 1.4rem; min-height: 36px; }

/* result panel */
.game-result-panel {
  text-align: center; display: flex; flex-direction: column; align-items: center; gap: 20px;
  background: rgba(255,255,255,.07); border-radius: 28px; padding: 40px 32px;
  backdrop-filter: blur(8px); border: 2px solid rgba(255,255,255,.15);
  max-width: 480px; width: 100%;
}
.gr-mascot { font-size: 4rem; animation: bounce 2s infinite; }
.gr-title { font-family: var(--ff2); font-size: 2rem; }
.gr-stats { display: flex; gap: 24px; }
.gr-stat { display: flex; flex-direction: column; align-items: center; }
.gr-stat-val { font-family: var(--ff2); font-size: 2.5rem; }
.gr-stat-lbl { font-size: .8rem; color: #c4b5fd; }
.gr-badge { font-size: 1.2rem; font-weight: 700; color: #f9d835; }
.gr-btns { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.btn-retry, .btn-home-gr, .btn-retry-test, .btn-home-tr {
  padding: 12px 28px; border-radius: 14px; border: none; cursor: pointer;
  font-family: var(--ff); font-weight: 800; font-size: 1rem; transition: transform .2s;
}
.btn-retry, .btn-retry-test { background: linear-gradient(135deg,#f97316,#fbbf24); color:#fff; }
.btn-home-gr, .btn-home-tr { background: rgba(255,255,255,.15); color:#fff; border:2px solid rgba(255,255,255,.3); }
.btn-retry:hover, .btn-retry-test:hover { transform:scale(1.06); }

/* =========================================================
   TEST SCREEN
   ========================================================= */
.test-container {
  min-height: 100vh; display: flex; flex-direction: column;
  padding: 20px 16px; gap: 16px; max-width: 700px; margin: 0 auto;
}
.test-header { display: flex; align-items: center; gap: 16px; }
.test-hud { flex: 1; }
.test-progress-label { font-size: .9rem; color: #c4b5fd; font-weight: 700; }
.test-progress-bar { height: 10px; background: rgba(255,255,255,.15); border-radius: 99px; margin-top: 6px; overflow: hidden; }
.test-progress-fill { height: 100%; background: linear-gradient(90deg,#f97316,#fbbf24); border-radius: 99px; transition: width .4s; }

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

/* intro */
.test-intro-panel {
  text-align: center; display: flex; flex-direction: column; align-items: center; gap: 20px;
  background: rgba(255,255,255,.07); border-radius: 28px; padding: 40px 28px;
  backdrop-filter: blur(8px); border: 2px solid rgba(255,255,255,.15);
  max-width: 480px; width: 100%;
}
.ti-mascot { font-size: 4rem; animation: mascot-float 3s infinite; }
.ti-title { font-family: var(--ff2); font-size: 2.2rem; }
.ti-desc { font-size: 1rem; color: #c4b5fd; }
.ti-rewards { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.ti-reward {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,.06); border-radius: 12px; padding: 10px 14px;
  font-size: .9rem; font-weight: 700;
}
.btn-start-test {
  background: linear-gradient(135deg,#0ea5e9,#6366f1); color:#fff;
  border:none; border-radius:16px; padding:14px 44px;
  font-family: var(--ff2); font-size: 1.5rem; cursor:pointer;
  box-shadow: 0 6px 20px rgba(99,102,241,.5); transition: transform .2s;
}
.btn-start-test:hover { transform:scale(1.07); }

/* play */
.test-play-panel {
  text-align:center; width:100%; max-width:560px;
  display:flex; flex-direction:column; align-items:center; gap:24px;
}
.test-equation {
  font-family: var(--ff2); font-size: clamp(2.8rem,9vw,5rem);
  background: linear-gradient(90deg,#38bdf8,#a855f7);
  -webkit-background-clip:text; -webkit-text-fill-color:transparent;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,.4));
  animation: eq-in .3s ease both;
}
.test-options {
  display:grid; grid-template-columns:1fr 1fr; gap:14px; width:100%;
}
.test-opt {
  padding:18px; border-radius:18px; border:3px solid rgba(255,255,255,.2);
  background:rgba(255,255,255,.1); color:#fff;
  font-family:var(--ff2); font-size:1.8rem; cursor:pointer;
  transition:transform .15s, background .15s, border-color .15s;
}
.test-opt:hover { transform:scale(1.06); background:rgba(255,255,255,.22); border-color:#38bdf8; }
.test-opt.correct { background:linear-gradient(135deg,#16a34a,#4ade80); border-color:#4ade80; }
.test-opt.wrong   { background:linear-gradient(135deg,#dc2626,#f87171); border-color:#f87171; }

.test-feedback { font-family:var(--ff2); font-size:1.4rem; min-height:36px; }
.test-lives { font-size:1.5rem; }

/* result */
.test-result-panel {
  text-align:center; display:flex; flex-direction:column; align-items:center; gap:18px;
  background:rgba(255,255,255,.07); border-radius:28px; padding:40px 28px;
  backdrop-filter:blur(8px); border:2px solid rgba(255,255,255,.15);
  max-width:480px; width:100%;
}
.tr-trophy { font-size:5rem; animation: bounce 2s infinite; }
.tr-title { font-family:var(--ff2); font-size:2rem; }
.tr-stars { font-size:2.5rem; letter-spacing:4px; }
.tr-score { font-size:1.2rem; font-weight:700; }
.tr-stats { display:flex; gap:24px; }
.tr-stat { display:flex; flex-direction:column; align-items:center; }
.tr-stat span:first-child { font-family:var(--ff2); font-size:2.2rem; }
.tr-stat small { color:#c4b5fd; font-size:.8rem; }
.tr-badge-label { font-family:var(--ff2); font-size:1.4rem; color:#f9d835; }
.tr-btns { display:flex; gap:14px; flex-wrap:wrap; justify-content:center; }

/* =========================================================
   OVERLAYS / POPUPS
   ========================================================= */
.overlay {
  position:fixed; inset:0; z-index:2000;
  display:flex; align-items:center; justify-content:center;
  pointer-events:none;
}
.overlay.hidden { display:none; }

.popup-correct, .popup-wrong {
  display:flex; flex-direction:column; align-items:center; gap:10px;
  border-radius:24px; padding:28px 40px;
  animation: pop-in .25s ease both;
  font-family: var(--ff2); font-size:1.4rem;
  box-shadow: var(--shadow);
}
.popup-correct { background: linear-gradient(135deg,#16a34a,#4ade80); color:#fff; }
.popup-wrong   { background: linear-gradient(135deg,#dc2626,#f87171); color:#fff; }
.popup-icon   { font-size:3rem; }
.popup-answer { font-size:1rem; font-family:var(--ff); font-weight:700; opacity:.9; }

/* =========================================================
   UTILITIES
   ========================================================= */
.hidden { display:none !important; }

/* =========================================================
   LEADERBOARD & PLAYER NAME
   ========================================================= */
.player-profile-wrap {
  display: flex; align-items: center; gap: 15px; margin-bottom: 20px;
  background: rgba(255,255,255,0.05); padding: 10px 20px; border-radius: 24px;
  border: 1px solid rgba(255,255,255,0.1); width: 100%; max-width: 450px;
}
.avatar-wrap { position: relative; }
.selected-emoji {
  font-size: 3rem; width: 65px; height: 65px; background: rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center; border-radius: 18px;
  cursor: pointer; transition: transform 0.2s, background 0.2s;
  border: 2px solid rgba(255,255,255,0.2);
}
.selected-emoji:hover { transform: scale(1.05); background: rgba(255,255,255,0.2); }

.emoji-picker {
  position: absolute; top: 100%; left: 0; margin-top: 10px;
  background: #1a1040; border: 2px solid rgba(255,255,255,0.2);
  border-radius: 16px; padding: 10px; display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 8px; z-index: 100; box-shadow: var(--shadow);
}
.emoji-picker span {
  font-size: 2rem; cursor: pointer; transition: transform 0.1s;
}
.emoji-picker span:hover { transform: scale(1.2); }

.player-input-wrap { flex: 1; text-align: center; }
#player-name {
  width: 100%; padding: 14px 20px; border-radius: 16px;
  border: 2px solid rgba(255,255,255,0.3); background: rgba(255,255,255,0.15);
  color: #fff; font-family: var(--ff); font-size: 1.1rem; font-weight: 700;
  text-align: center; outline: none; transition: border-color 0.2s, background 0.2s;
}
#player-name::placeholder { color: rgba(255,255,255,0.6); }
#player-name:focus { border-color: #a855f7; background: rgba(255,255,255,0.25); }

.leaderboard-wrap {
  background: rgba(0,0,0,0.2); border-radius: 16px; padding: 16px;
  width: 100%; margin-top: 10px;
}
.lb-title {
  font-family: var(--ff2); font-size: 1.2rem; color: #f9d835; margin-bottom: 12px;
}
.lb-list {
  list-style: none; display: flex; flex-direction: column; gap: 8px;
}
.lb-item {
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(255,255,255,0.1); padding: 8px 16px; border-radius: 12px;
  font-weight: 700; font-size: 1rem;
}
.lb-item:nth-child(1) { background: linear-gradient(90deg, #f9d835, #fbbf24); color: #000; }
.lb-item:nth-child(2) { background: linear-gradient(90deg, #d1d5db, #9ca3af); color: #000; }
.lb-item:nth-child(3) { background: linear-gradient(90deg, #d97706, #b45309); color: #fff; }

/* =========================================================
   SETTINGS SELECTORS
   ========================================================= */
.gs-settings, .ti-settings {
  width: 100%; display: flex; flex-direction: column; gap: 16px;
  margin: 10px 0; background: rgba(255,255,255,0.05);
  padding: 15px; border-radius: 20px; border: 1px solid rgba(255,255,255,0.1);
}
.gs-setting-item, .ti-setting-item {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.gs-setting-item label, .ti-setting-item label {
  font-weight: 800; color: #c4b5fd; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 1px;
}

.op-selector {
  display: flex; gap: 8px; justify-content: center;
}
.op-btn {
  width: 45px; height: 45px; border-radius: 12px; border: 2px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.1); color: #fff; font-size: 1.2rem; cursor: pointer;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.op-btn:hover { transform: scale(1.1); background: rgba(255,255,255,0.2); }
.op-btn.active {
  background: linear-gradient(135deg, #a855f7, #7c3aed);
  border-color: #fff; transform: scale(1.15); box-shadow: 0 0 15px rgba(168, 85, 247, 0.5);
}

select#game-grade-select, select#test-grade-select {
  width: 100%; max-width: 200px; padding: 10px 15px; border-radius: 12px;
  border: 2px solid rgba(255,255,255,0.2); background: rgba(255,255,255,0.1);
  color: #fff; font-family: var(--ff); font-weight: 700; outline: none; cursor: pointer;
}
select option { background: #1a1040; color: #fff; }


/* Responsive tweaks */
@media(max-width:520px) {
  .home-cards { flex-direction:column; }
  .home-card  { min-width:unset; width:100%; flex-direction:row; justify-content:flex-start; }
  .game-options, .test-options { grid-template-columns:1fr 1fr; }
  .lesson-body { flex-direction:column; }
}

/* =========================================================
   MULTIPLAYER
   ========================================================= */
.multi-setup-panel {
  text-align: center; display: flex; flex-direction: column; align-items: center; gap: 20px;
  background: rgba(255,255,255,.07); border-radius: 28px; padding: 30px;
  backdrop-filter: blur(8px); border: 2px solid rgba(255,255,255,.15);
  max-width: 520px; width: 100%;
}
.multi-players-setup {
  width: 100%; display: flex; flex-direction: column; gap: 10px; align-items: center;
  background: rgba(255,255,255,.05); padding: 16px; border-radius: 18px;
  border: 1px solid rgba(255,255,255,.1);
}
#multi-player-inputs { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.multi-player-row {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,.08); border-radius: 14px; padding: 10px 14px;
}
.multi-player-emoji {
  font-size: 2rem; cursor: pointer; background: rgba(255,255,255,.1);
  border-radius: 10px; padding: 4px 10px;
  border: 2px solid rgba(255,255,255,.2); transition: all 0.2s;
}
.multi-player-emoji:hover { background: rgba(255,255,255,.2); }
.multi-player-name {
  flex: 1; padding: 10px 14px; border-radius: 12px;
  border: 2px solid rgba(255,255,255,.2); background: rgba(255,255,255,.1);
  color: #fff; font-family: var(--ff); font-weight: 700; font-size: 1rem;
  outline: none;
}
.multi-player-name::placeholder { color: rgba(255,255,255,.5); }
.multi-player-grade {
  padding: 8px 10px; border-radius: 10px;
  border: 2px solid rgba(255,255,255,.2); background: rgba(255,255,255,.12);
  color: #fff; font-family: var(--ff); font-weight: 700; font-size: 0.85rem;
  cursor: pointer; outline: none; min-width: 52px;
}
.btn-rm-player {
  background: rgba(220,38,38,.4); border: none; color: #fff; border-radius: 10px;
  padding: 8px 12px; cursor: pointer; font-size: 1rem; font-weight: 700;
  transition: background 0.2s;
}
.btn-rm-player:hover { background: rgba(220,38,38,.7); }
.btn-add-player {
  background: rgba(255,255,255,.12); border: 2px dashed rgba(255,255,255,.3);
  color: #fff; border-radius: 14px; padding: 10px 28px;
  font-family: var(--ff); font-weight: 800; cursor: pointer; font-size: 1rem;
  transition: all 0.2s;
}
.btn-add-player:hover { background: rgba(255,255,255,.22); border-color: rgba(255,255,255,.6); }

/* turn announce */
.multi-turn-panel {
  width: 100%; display: flex; flex-direction: column; align-items: center;
}
.multi-turn-announce {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  background: rgba(255,255,255,.07); border-radius: 28px; padding: 50px 40px;
  max-width: 420px; width: 100%; border: 2px solid rgba(255,255,255,.15);
  animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.mta-emoji { font-size: 5rem; }
.mta-name { font-family: var(--ff2); font-size: 2.2rem; color: #f9d835; }
.mta-sub { font-size: 1.1rem; color: rgba(255,255,255,.7); font-weight: 700; }
@keyframes popIn { from { opacity:0; transform:scale(0.7); } to { opacity:1; transform:scale(1); } }

.multi-play-area {
  width: 100%; display: flex; flex-direction: column; align-items: center; gap: 22px;
}

/* results / podium */
.multi-result-panel {
  width: 100%; display: flex; flex-direction: column; align-items: center; gap: 20px;
  background: rgba(255,255,255,.07); border-radius: 28px; padding: 30px;
  border: 2px solid rgba(255,255,255,.15);
}
.mr-title {
  font-family: var(--ff2); font-size: 2.5rem; color: #f9d835;
  text-shadow: 2px 2px 0 rgba(0,0,0,.3);
}
.podium-wrap {
  display: flex; align-items: flex-end; justify-content: center; gap: 10px;
  width: 100%;
}
.podium-block {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  border-radius: 16px 16px 0 0; min-width: 90px; padding: 14px 10px;
  font-family: var(--ff2); color: #fff; transition: all 0.5s;
}
.podium-block .pb-emoji { font-size: 2.5rem; }
.podium-block .pb-name { font-size: 1rem; text-align: center; word-break: break-word; }
.podium-block .pb-score { font-size: 1.3rem; }
.podium-block .pb-rank { font-size: 2rem; }
.podium-1 { background: linear-gradient(180deg,#f9d835,#f59e0b); color: #000; height: 160px; justify-content: flex-start; }
.podium-2 { background: linear-gradient(180deg,#e5e7eb,#9ca3af); color: #000; height: 120px; justify-content: flex-start; }
.podium-3 { background: linear-gradient(180deg,#d97706,#b45309); height: 90px; justify-content: flex-start; }

.mr-scorelist {
  width: 100%; display: flex; flex-direction: column; gap: 8px;
}
.mr-score-row {
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(255,255,255,.08); padding: 10px 16px; border-radius: 14px;
  font-weight: 700; font-size: 1rem;
}

select#multi-grade-select {
  width: 100%; max-width: 200px; padding: 10px 15px; border-radius: 12px;
  border: 2px solid rgba(255,255,255,0.2); background: rgba(255,255,255,0.1);
  color: #fff; font-family: var(--ff); font-weight: 700; outline: none; cursor: pointer;
}
