/* ══════════════════════════════════════════════════════════
   gaanit.css — Gaanit Math game styles
   ══════════════════════════════════════════════════════════ */

:root {
  --add:  #11998e; --add2:  #38ef7d;
  --sub:  #f7971e; --sub2:  #ffd200;
  --mul:  #8e2de2; --mul2:  #4a00e0;
  --card-r: 22px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  /* UI chrome vars */
  --pill-bg: rgba(0,0,0,0.06); --pill-border: rgba(0,0,0,0.12); --pill-color: #444;
  --tab-inactive-bg: rgba(0,0,0,0.05); --tab-inactive-color: rgba(0,0,0,0.4);
  --nav-btn-bg: rgba(0,0,0,0.05); --nav-btn-border: rgba(0,0,0,0.1); --nav-btn-color: rgba(0,0,0,0.5);
  --lvl-btn-active-color: #222; --lvl-btn-active-bg: rgba(0,0,0,0.1); --lvl-btn-active-border: rgba(0,0,0,0.3);
  --settings-btn-bg: rgba(0,0,0,0.06); --settings-btn-border: rgba(0,0,0,0.1); --settings-btn-color: rgba(0,0,0,0.5);
  --lvl-btn-color: rgba(0,0,0,.45); --lvl-btn-border: rgba(0,0,0,.12); --lvl-btn-bg: rgba(0,0,0,.04);
}

/* ── Sky (dark starry) theme — default for game pages ── */
:root {
  --bg: var(--sky-bg);
  --bg2: var(--sky-surface);
  --pill-bg: rgba(255,255,255,0.1); --pill-border: rgba(255,255,255,0.2); --pill-color: rgba(255,255,255,0.85);
  --tab-inactive-bg: var(--sky-surface); --tab-inactive-color: var(--sky-text-soft);
  --nav-btn-bg: var(--sky-surface); --nav-btn-border: var(--sky-border); --nav-btn-color: var(--sky-text-soft);
  --lvl-btn-active-color: #fff; --lvl-btn-active-bg: rgba(255,255,255,0.18); --lvl-btn-active-border: rgba(255,255,255,0.5);
  --settings-btn-bg: rgba(255,255,255,0.1); --settings-btn-border: rgba(255,255,255,0.2); --settings-btn-color: rgba(255,255,255,0.7);
  --lvl-btn-color: rgba(255,255,255,.45); --lvl-btn-border: rgba(255,255,255,.2); --lvl-btn-bg: rgba(255,255,255,.07);
}

/* Theme overrides (legacy themes still work) */
body.ocean  { --bg:#071e3d; --bg2:#0d3060; --add:#00b4d8; --add2:#48cae4; --mul:#7209b7; --mul2:#560bad; }
body.jungle { --bg:#0d1f0a; --bg2:#1a3a10; --add:#2d9e4f; --add2:#6bcb77; --mul:#7b2d8b; --mul2:#a855d4; }
body.sunshine {
  --bg: var(--gs-bg); --bg2: #EDE9FF;
  --pill-bg: rgba(0,0,0,.06); --pill-border: rgba(0,0,0,.12); --pill-color: #444;
  --tab-inactive-bg: rgba(0,0,0,.05); --tab-inactive-color: rgba(0,0,0,.4);
  --nav-btn-bg: rgba(0,0,0,.05); --nav-btn-border: rgba(0,0,0,.1); --nav-btn-color: rgba(0,0,0,.5);
  --lvl-btn-color: rgba(0,0,0,.45); --lvl-btn-border: rgba(0,0,0,.12); --lvl-btn-bg: rgba(0,0,0,.04);
  --lvl-btn-active-color: #222; --lvl-btn-active-bg: rgba(0,0,0,.1); --lvl-btn-active-border: rgba(0,0,0,.3);
  --settings-btn-bg: rgba(0,0,0,.06); --settings-btn-border: rgba(0,0,0,.1); --settings-btn-color: rgba(0,0,0,.5);
}

html, body { overflow: hidden; background: var(--bg, var(--sky-bg)); color: var(--sky-text); transition: background 0.4s; }

/* ── Stars ── */
#stars { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.star { position: absolute; width: 2.5px; height: 2.5px; background: white; border-radius: 50%; animation: twinkle 2s infinite alternate; }
@keyframes twinkle { from{opacity:0.08} to{opacity:0.7} }

/* ── Level bar - dark sky style ── */
.lp-circle { border-color: rgba(255,255,255,.2); background: rgba(255,255,255,.05); }
.lp-node.done   .lp-circle { background: rgba(76,175,80,.2); border-color: #6bcb77; }
.lp-node.active .lp-circle { background: rgba(0,206,201,.15); border-color: var(--sky-gaanit); }
.lp-node.locked .lp-circle { background: rgba(255,255,255,.03); border-color: rgba(255,255,255,.08); }
.lp-line        { background: rgba(255,255,255,.12); }
.lp-line.done   { background: #6bcb77; }

/* ── Root layout ── */
#app {
  position: relative; z-index: 1;
  height: calc(100vh - 56px); /* subtract gs-game-header height */
  display: flex; flex-direction: column;
  padding: 6px 10px calc(68px + var(--safe-b)); gap: 4px;
  max-width: 520px; margin: 0 auto;
  overflow: hidden;
}

/* ── Top bar ── */
#top-bar { display: flex; align-items: center; gap: 5px; flex-shrink: 0; overflow: hidden; }
.pill {
  border-radius: 50px; padding: 5px 11px;
  font-size: 0.78rem; font-weight: 800; flex-shrink: 0;
  display: flex; align-items: center; gap: 4px;
  transition: transform 0.15s;
}
#score-pill  { background: var(--pill-bg); border: 1.5px solid var(--pill-border); color: var(--pill-color); }
@keyframes scorePilFlash { 0%{background:rgba(108,92,231,0.4);transform:scale(1.3)} 100%{background:var(--pill-bg);transform:scale(1)} }
.score-flash { animation: scorePilFlash 0.6s ease-out forwards; }
#streak-pill { background: rgba(255,160,0,0.22); border: 1.5px solid rgba(255,160,0,0.45); color: #c0851e; opacity: 0; transition: opacity 0.3s; max-width: 110px; overflow: hidden; }

/* ── Top bar stats row ── */
#top-bar { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ── Op tabs — inline segmented track ── */
#op-tabs {
  flex: 1;
  display: flex;
  border-radius: 12px;
  overflow: hidden;
  border: 1.5px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
}
.op-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 5px 2px;
  border: none;
  cursor: pointer;
  background: transparent;
  transition: all 0.15s;
  border-right: 1px solid rgba(255,255,255,0.08);
  white-space: nowrap;
}
.op-tab:last-child { border-right: none; }
.op-icon { font-size: 17px; line-height: 1; }
.op-lbl  { font-size: 10px; font-family: 'Fredoka One', cursive; letter-spacing: 0.2px; }

/* Unselected — each op gets its own tinted color */
.op-tab.add:not(.active) { color: var(--add); background: rgba(17,153,142,0.18); }
.op-tab.sub:not(.active) { color: var(--sub); background: rgba(247,151,30,0.18); }
.op-tab.mul:not(.active) { color: var(--mul); background: rgba(142,45,226,0.18); }

/* Active — full gradient fill */
.op-tab.add.active { background: linear-gradient(135deg,var(--add),var(--add2)); color:#fff; box-shadow: inset 0 1px 0 rgba(255,255,255,0.2); }
.op-tab.sub.active { background: linear-gradient(135deg,var(--sub),var(--sub2)); color:#fff; box-shadow: inset 0 1px 0 rgba(255,255,255,0.2); }
.op-tab.mul.active { background: linear-gradient(135deg,var(--mul),var(--mul2)); color:#fff; box-shadow: inset 0 1px 0 rgba(255,255,255,0.2); }
.op-tab.active .op-icon { filter: drop-shadow(0 1px 3px rgba(0,0,0,0.3)); }

/* ── Level bar ── */
#level-bar { display:flex; align-items:center; gap:0; flex-shrink:0; overflow-x:auto; padding:4px 4px 6px; scrollbar-width:none; }
#level-bar::-webkit-scrollbar{display:none}
@keyframes lvlPulse { 0%,100%{box-shadow:0 0 0 0 rgba(108,92,231,0)} 50%{box-shadow:0 0 0 5px rgba(108,92,231,.35)} }
.lp-node { display:flex; flex-direction:column; align-items:center; gap:2px; flex-shrink:0; cursor:pointer; }
.lp-circle { width:46px; height:46px; border-radius:50%; border:2.5px solid rgba(0,0,0,.12); background:rgba(0,0,0,.04); display:flex; align-items:center; justify-content:center; font-size:1.3rem; transition:transform .2s; }
.lp-circle:active { transform:scale(.9); }
.lp-node.done   .lp-circle { background:rgba(76,175,80,.15); border-color:#4CAF50; }
.lp-node.active .lp-circle { background:rgba(108,92,231,.15); border-color:var(--gs-primary); animation:lvlPulse 2s ease-in-out infinite; }
.lp-node.locked .lp-circle { background:rgba(0,0,0,.03); border-color:rgba(0,0,0,.08); font-size:1rem; }
.lp-stars { font-size:.5rem; letter-spacing:1px; height:10px; line-height:10px; }
.lp-line { flex-shrink:0; width:18px; height:3px; margin-bottom:12px; border-radius:2px; background:rgba(0,0,0,.1); }
.lp-line.done { background:#4CAF50; }

/* ── Game card ── */
#game-card {
  flex: 1; min-height: 0;
  background: #fff; border-radius: var(--card-r);
  display: flex; flex-direction: column; align-items: center;
  padding: 10px 14px 8px;
  box-shadow: 0 8px 32px rgba(108,92,231,0.15);
  overflow: hidden;
  border: 3px solid transparent;
  position: relative;
}
#game-card.add { border-color: var(--add); }
#game-card.sub { border-color: var(--sub); }
#game-card.mul { border-color: var(--mul); }

/* progress */
#prog-wrap { width: 100%; height: 5px; background: #eee; border-radius: 4px; margin-bottom: 8px; flex-shrink: 0; }
#prog-bar  { height: 5px; border-radius: 4px; width: 0%; transition: width .4s ease; }
.add #prog-bar { background: linear-gradient(90deg,var(--add),var(--add2)); }
.sub #prog-bar { background: linear-gradient(90deg,var(--sub),var(--sub2)); }
.mul #prog-bar { background: linear-gradient(90deg,var(--mul),var(--mul2)); }

#game-title { font-size: 1.1rem; font-weight: 900; color: #1a1a1a; text-align: center; flex-shrink: 0; margin-bottom: 5px; font-family: 'Fredoka One', cursive; }
#speech-bub {
  background: #fff3c4; border: 2.5px solid #f59e0b;
  border-radius: 12px; padding: 7px 16px;
  font-size: .92rem; font-weight: 800; color: #78350f;
  text-align: center; flex-shrink: 0; margin-bottom: 6px;
  animation: fadeIn .3s;
}
@keyframes fadeIn{from{opacity:0;transform:scale(.93)}to{opacity:1;transform:scale(1)}}
@keyframes chomp{
  0%  {transform:scale(1) rotate(0deg) translateY(0)}
  18% {transform:scale(1.75) rotate(-20deg) translateY(-14px)}
  36% {transform:scale(1.85) rotate(15deg) translateY(-9px)}
  54% {transform:scale(1.55) rotate(-8deg) translateY(-4px)}
  72% {transform:scale(1.3) rotate(4deg) translateY(-2px)}
  100%{transform:scale(1) rotate(0deg) translateY(0)}
}
.monster-chomping{animation:chomp 0.44s cubic-bezier(.175,.885,.32,1.275) forwards!important}

#game-area {
  flex: 1; min-height: 0; width: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; overflow: hidden;
}

/* ── Nav games ── */
#nav-games {
  display: flex; flex-shrink: 0;
  border-radius: 12px; overflow: hidden;
  border: 1.5px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
}
#nav-games::-webkit-scrollbar { display: none; }
.nav-btn {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: transparent; border: none;
  border-right: 1px solid rgba(255,255,255,0.08);
  padding: 5px 2px;
  color: var(--nav-btn-color); font-size: .72rem; font-weight: 800;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.nav-btn:last-child { border-right: none; }
.nav-icon { font-size: 17px; line-height: 1; }
.nav-lbl  { font-size: 9px; font-family: 'Fredoka One', cursive; letter-spacing: 0.2px; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.nav-btn.active, .nav-btn:active {
  background: var(--lvl-btn-active-bg); color: var(--lvl-btn-active-color);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2);
}
.nav-btn.active .nav-icon { filter: drop-shadow(0 1px 3px rgba(0,0,0,0.3)); }

/* ── Shared game components ── */
.emoji-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; align-items: center; min-height: 50px; }
.emoji-item { font-size: clamp(2.6rem,10vw,3.4rem); line-height: 1; cursor: pointer; transition: transform .15s; filter: drop-shadow(0 3px 4px rgba(0,0,0,.18)); }
.emoji-item:active { transform: scale(1.4); }
@keyframes bounce    { 0%{transform:scale(1.45)} 55%{transform:scale(.88)} 100%{transform:scale(1)} }
@keyframes hint-wag  { 0%,100%{transform:rotate(0) scale(1)} 25%{transform:rotate(-12deg) scale(1.15)} 75%{transform:rotate(12deg) scale(1.15)} }
@keyframes pulse-ring{ 0%{box-shadow:0 0 0 0 rgba(108,92,231,.5)} 70%{box-shadow:0 0 0 14px rgba(108,92,231,0)} 100%{box-shadow:0 0 0 0 rgba(108,92,231,0)} }
.placing  { animation: bounce .35s ease; }
.hint-tap { animation: hint-wag 0.7s ease infinite; }

.drop-zone {
  min-width: 140px; min-height: 66px;
  border: 3px solid #c5cef9; border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  flex-wrap: wrap; gap: 5px; padding: 10px 12px;
  transition: all .25s; font-size: 2rem;
  background: linear-gradient(135deg, #f0f4ff, #e8eeff);
  box-shadow: inset 0 2px 6px rgba(108,92,231,.1);
}
.drop-zone.active  { border-color: var(--gs-primary); background: linear-gradient(135deg,#eef0ff,#e0e4ff); animation: pulse-ring 1s infinite; }
.drop-zone.correct { border-color: #4CAF50; background: linear-gradient(135deg,#f0fff4,#e0ffe8); animation: none; }

.ans-row { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.answer-btn {
  width: clamp(80px,22vw,96px); height: clamp(72px,19vw,86px);
  border-radius: 20px; border: none; cursor: pointer;
  font-size: clamp(1.6rem,5.5vw,2rem); font-weight: 900; color: #fff;
  font-family: 'Fredoka One', cursive;
  box-shadow: 0 7px 0 rgba(0,0,0,.25), 0 10px 18px rgba(0,0,0,.18);
  transition: transform .12s cubic-bezier(.175,.885,.32,1.275), box-shadow .12s;
  position: relative;
  background: linear-gradient(135deg,#a29bfe,#6c5ce7);
}
.answer-btn[data-ci="0"] { background: linear-gradient(135deg,#FF6B6B,#ee5a24); }
.answer-btn[data-ci="1"] { background: linear-gradient(135deg,#1dd1a1,#10ac84); }
.answer-btn[data-ci="2"] { background: linear-gradient(135deg,#feca57,#f39c12); color: #333; }
.answer-btn[data-ci="3"] { background: linear-gradient(135deg,#a29bfe,#6c5ce7); }
.answer-btn:active { transform: scale(1.08) translateY(3px); box-shadow: 0 3px 0 rgba(0,0,0,.22), 0 4px 8px rgba(0,0,0,.15); }
.answer-btn.correct-flash { background: linear-gradient(135deg,#4CAF50,#2e7d32) !important; color: #fff !important; animation: pop .4s; }
.answer-btn.wrong-flash   { background: linear-gradient(135deg,#FF9800,#e67e22) !important; color: #fff !important; animation: shk .35s; }
@keyframes pop { 0%{transform:scale(1)} 50%{transform:scale(1.28)} 100%{transform:scale(1)} }
@keyframes shk { 20%{transform:translateX(-10px)} 80%{transform:translateX(10px)} }
@keyframes cardShake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-8px)} 40%{transform:translateX(8px)} 60%{transform:translateX(-6px)} 80%{transform:translateX(6px)} }
#game-card.wrong-shake { animation: cardShake .4s ease; }

.drag-pool { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; padding: 10px 14px; background: #f0f0ff; border-radius: 18px; border: 2px dashed #c5cef9; min-height: 58px; align-items: center; width: 100%; }
.drag-item { font-size: clamp(2.2rem,8vw,2.8rem); cursor: pointer; transition: transform .12s; filter: drop-shadow(0 2px 2px rgba(0,0,0,.12)); }
.drag-item:active { transform: scale(1.25); }
.drag-item.used   { opacity: .2; pointer-events: none; }

.mul-groups { display:flex; flex-wrap:wrap; gap:12px; justify-content:center; width:100%; }
.mul-group  { background:#f0f4ff; border:2px solid #c5cef9; border-radius:14px; padding:10px 12px; display:flex; flex-wrap:wrap; gap:4px; justify-content:center; align-items:center; min-width:58px; }
.num-badge  { background: linear-gradient(135deg,var(--gs-primary),#764ba2); color: #fff; border-radius: 10px; padding: 4px 13px; font-size: 1.5rem; font-weight: 900; }
.eq-row     { display: flex; align-items: center; gap: 7px; font-size: 1.2rem; font-weight: 900; color: #999; flex-wrap: wrap; justify-content: center; }

/* ── Tens Blocks ── */
.tens-area { display:flex; flex-direction:column; align-items:center; gap:10px; width:100%; }
.tens-label { font-size:.75rem; font-weight:800; color:#aaa; text-transform:uppercase; letter-spacing:.4px; }
.blocks-row { display:flex; flex-wrap:wrap; gap:5px; justify-content:center; }
.ten-block { width:36px; height:36px; border-radius:8px; background:linear-gradient(135deg,var(--gs-primary),#764ba2); display:flex; align-items:center; justify-content:center; font-size:.72rem; font-weight:900; color:#fff; cursor:pointer; transition:transform .15s,opacity .2s; box-shadow:0 3px 8px rgba(108,92,231,.35); flex-shrink:0; }
.ten-block:active { transform:scale(1.15); }
.ten-block.removed { opacity:.15; pointer-events:none; transform:scale(.7); }
.one-block { width:22px; height:22px; border-radius:5px; background:linear-gradient(135deg,#f7971e,#ffd200); cursor:pointer; transition:transform .15s,opacity .2s; box-shadow:0 2px 5px rgba(247,151,30,.3); flex-shrink:0; }
.one-block:active { transform:scale(1.2); }
.one-block.removed { opacity:.15; pointer-events:none; transform:scale(.6); }

/* ── Chalkboard ── */
.chalkboard { background:#1e3a2e; border-radius:20px; padding:20px 28px; width:100%; display:flex; flex-direction:column; align-items:center; gap:12px; box-shadow:inset 0 2px 8px rgba(0,0,0,.4); border:3px solid #2d5a40; }
.chalk-num  { font-size:clamp(2.4rem,14vw,3.6rem); font-weight:900; color:#f0f0e0; text-shadow:1px 1px 0 rgba(255,255,255,.15); letter-spacing:2px; line-height:1; }
.chalk-op   { font-size:clamp(1.8rem,9vw,2.6rem); font-weight:900; color:#7ec8a0; line-height:1; }
.chalk-line { width:80%; height:3px; background:rgba(255,255,255,.2); border-radius:2px; }
.chalk-q    { font-size:clamp(2rem,11vw,3rem); font-weight:900; color:#ffd200; line-height:1; }
.chalk-hint { font-size:.78rem; color:rgba(255,255,255,.4); font-weight:700; }

/* ── Confetti ── */
.cp { position: fixed; width: 9px; height: 12px; top: -20px; border-radius: 2px; animation: fall linear forwards; z-index: 999; pointer-events: none; }
@keyframes fall { to{transform:translateY(110vh) rotate(720deg);opacity:0} }

/* ── Reward overlay ── */
#reward-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 900; flex-direction: column; align-items: center; justify-content: center; }
#reward-overlay.show { display: flex; }
#reward-card { background: #fff; border-radius: 26px; width: 92vw; max-width: 440px; padding: 40px 32px 36px; text-align: center; box-shadow: 0 24px 60px rgba(0,0,0,.45); animation: gs-card-pop .38s cubic-bezier(.175,.885,.32,1.275) forwards; position: relative; overflow: visible; transition: background .3s; }
#reward-card.op-add { background: linear-gradient(135deg,#0a7a70,#11998e); }
#reward-card.op-sub { background: linear-gradient(135deg,#c0640a,#f7971e); }
#reward-card.op-mul { background: linear-gradient(135deg,#6a1fad,#8e2de2); }
#reward-card.op-add #rew-text,#reward-card.op-sub #rew-text,#reward-card.op-mul #rew-text { color: #fff; }
#reward-card.op-add #rew-sub,#reward-card.op-sub #rew-sub,#reward-card.op-mul #rew-sub { color: rgba(255,255,255,.8); }
#reward-card.op-add #next-btn,#reward-card.op-sub #next-btn,#reward-card.op-mul #next-btn { background: rgba(255,255,255,.25); box-shadow: none; border: 2px solid rgba(255,255,255,.4); }
.rew-star { position: absolute; font-size: 1.6rem; animation: starBurst .8s cubic-bezier(.175,.885,.32,1.275) forwards; pointer-events: none; z-index: 5; }
@keyframes starBurst { 0% { transform: translate(0,0) scale(0); opacity: 1; } 60% { opacity: 1; } 100% { transform: var(--tx,0) var(--ty,0) scale(1.2); opacity: 0; } }
@keyframes starFloat { from{transform:translateY(0) scale(1);opacity:1} to{transform:translateY(-80px) scale(1.5);opacity:0} }
#rew-emoji { font-size: 7rem; margin-bottom: 12px; animation: rewSpin .5s cubic-bezier(.175,.885,.32,1.275) forwards; }
@keyframes rewSpin { from{transform:scale(0) rotate(-30deg);opacity:0} to{transform:scale(1) rotate(0);opacity:1} }
#rew-text  { font-size: 2.4rem; font-weight: 900; color: #1a1a1a; margin-bottom: 4px; font-family:'Fredoka One',cursive; }
#rew-sub   { font-size: 1.1rem; font-weight: 800; color: #888; margin-bottom: 18px; }
#next-btn  { background: linear-gradient(135deg,var(--gs-primary),#764ba2); color: #fff; border: none; border-radius: 50px; padding: 11px 34px; font-size: 1rem; font-weight: 800; cursor: pointer; box-shadow: 0 6px 20px rgba(108,92,231,.4); }
#next-btn:active { transform: scale(.95); }

/* ── Level-complete banner ── */
#lv-banner { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.65); z-index: 950; flex-direction: column; align-items: center; justify-content: center; padding: 16px; }
#lv-banner.show { display: flex; }
#lv-card { background: #fff; border-radius: 26px; width: 100%; max-width: 380px; padding: 32px 28px; text-align: center; box-shadow: 0 24px 60px rgba(0,0,0,.5); animation: gs-card-pop .38s cubic-bezier(.175,.885,.32,1.275) forwards; transition: background .3s; position: relative; overflow: hidden; }
#lv-card.op-add { background: linear-gradient(160deg,#065f54,#11998e); }
#lv-card.op-sub { background: linear-gradient(160deg,#9a4e08,#f7971e); }
#lv-card.op-mul { background: linear-gradient(160deg,#4a1299,#8e2de2); }
#lv-card.op-add #lv-title,#lv-card.op-sub #lv-title,#lv-card.op-mul #lv-title { color: #fff; }
#lv-card.op-add #lv-sub,  #lv-card.op-sub #lv-sub,  #lv-card.op-mul #lv-sub   { color: rgba(255,255,255,.8); }
#lv-emoji { font-size: 5rem; margin-bottom: 10px; display: block; }
#lv-title { font-size: 1.5rem; font-weight: 900; color: #1a1a1a; margin-bottom: 6px; font-family: 'Fredoka One',cursive; }
#lv-sub   { font-size: .9rem; color: #888; margin-bottom: 22px; }
.lv-btns  { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.lv-btn { padding: 12px 28px; border-radius: 50px; border: none; font-size: .95rem; font-weight: 800; cursor: pointer; }
.lv-btn.pri { background: rgba(255,255,255,.25); color: #fff; border: 2px solid rgba(255,255,255,.4); }
.lv-btn.sec { background: rgba(255,255,255,.15); color: #fff; }

/* ── Settings panel ── */
#settings-panel { display:none; position:fixed; inset:0; background:rgba(0,0,0,.65); z-index:800; align-items:flex-end; justify-content:center; }
#settings-panel.show { display:flex; }
#settings-card { background:#fff; border-radius:26px 26px 0 0; width:100%; max-width:520px; max-height:88vh; overflow-y:auto; padding:20px 18px calc(20px + var(--safe-b)); animation:slideUpSheet .35s cubic-bezier(.175,.885,.32,1.275) forwards; }
#settings-card::-webkit-scrollbar { display:none; }
@keyframes slideUpSheet { from{transform:translateY(100%)}to{transform:translateY(0)} }
.sh { display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; }
.sh-title { font-size:1.05rem; font-weight:900; color:#222; }
.sh-close { width:32px; height:32px; border-radius:50%; border:none; background:#f0f0f0; color:#666; font-size:1rem; cursor:pointer; display:flex; align-items:center; justify-content:center; }
.s-sec { margin-bottom:14px; }
.s-lbl { font-size:.68rem; font-weight:800; color:#bbb; text-transform:uppercase; letter-spacing:.5px; margin-bottom:7px; }
.theme-row { display:flex; gap:6px; flex-wrap:wrap; }
.t-chip { flex:1; min-width:0; padding:9px 4px; border-radius:12px; border:2px solid transparent; cursor:pointer; text-align:center; font-size:.74rem; font-weight:800; transition:all .2s; white-space:nowrap; }
.t-chip.sunshine { background:#F0EDFF; color:var(--gs-primary); border:2px solid var(--gs-primary); }
.t-chip.space    { background:#1a1a3e; color:#ccc; }
.t-chip.ocean    { background:#071e3d; color:#90e0ef; }
.t-chip.jungle   { background:#0d1f0a; color:#6bcb77; }
.t-chip.active   { box-shadow:0 0 0 2.5px var(--gs-primary); }
.tog-row { display:flex; align-items:center; justify-content:space-between; padding:6px 0; }
.tog-lbl { font-size:.88rem; font-weight:700; color:#444; }
.tog { width:42px; height:24px; border-radius:12px; background:#e0e0e0; position:relative; cursor:pointer; transition:background .2s; flex-shrink:0; }
.tog.on { background:var(--gs-primary); }
.tog-k { width:20px; height:20px; border-radius:50%; background:#fff; position:absolute; top:2px; left:2px; transition:left .2s; box-shadow:0 1px 4px rgba(0,0,0,.2); }
.tog.on .tog-k { left:20px; }
.badge-grid { display:flex; flex-wrap:wrap; gap:6px; }
.b-chip { padding:5px 10px; border-radius:50px; font-size:.7rem; font-weight:800; border:1.5px solid; }
.b-chip.earned { background:#f0fff4; color:#2e7d32; border-color:#4CAF50; }
.b-chip.locked { background:#f5f5f5; color:#ccc; border-color:#e0e0e0; }
.mastery-row { display:flex; flex-wrap:wrap; gap:5px; margin-bottom:6px; }
.mastery-chip { padding:4px 10px; border-radius:50px; font-size:.72rem; font-weight:800; border:1.5px solid; }
.mastery-chip.done { background:#f0fff4; color:#2e7d32; border-color:#4CAF50; }
.mastery-chip.todo { background:#f5f5f5; color:#bbb; border-color:#ddd; }
.hist-list { display:flex; flex-direction:column; gap:5px; }
.hist-item { display:flex; align-items:center; gap:8px; background:#f9f9f9; border-radius:10px; padding:7px 10px; font-size:.8rem; }
.hist-op { font-size:1rem; flex-shrink:0; }
.hist-eq { font-weight:800; color:#333; flex:1; }
.hist-res { font-weight:800; }
.hist-res.ok  { color:#4CAF50; }
.hist-res.bad { color:#f44336; }
.hist-time { font-size:.65rem; color:#bbb; flex-shrink:0; }
.rec-stats { display:grid; grid-template-columns:1fr 1fr 1fr; gap:8px; margin-bottom:16px; }
.stat-box { background:#f9f9f9; border-radius:14px; padding:12px 8px; text-align:center; }
.stat-val { font-size:1.6rem; font-weight:900; color:#333; }
.stat-lbl { font-size:.68rem; font-weight:700; color:#aaa; margin-top:2px; }
.parent-btn { width:100%; padding:9px; border-radius:12px; border:none; font-size:.82rem; font-weight:800; cursor:pointer; margin-top:5px; }
.p-danger  { background:#fff0f0; color:#f44336; }
.p-primary { background:linear-gradient(135deg,var(--gs-primary),#764ba2); color:#fff; }

/* ── Speed mode bar ── */
#speed-wrap { width:100%; height:6px; background:rgba(0,0,0,.06); border-radius:3px; flex-shrink:0; display:none; }
#speed-wrap.show { display:block; }
#speed-bar { height:6px; border-radius:3px; width:100%; background:linear-gradient(90deg,#f44336,#ff9800,#4CAF50); transition:width .2s linear; }

/* ── Badge toast ── */
#badge-toast { position:fixed; top:70px; left:50%; transform:translateX(-50%) translateY(-140px); background:#fff; border-radius:18px; padding:10px 18px; display:flex; align-items:center; gap:10px; box-shadow:0 8px 32px rgba(0,0,0,.25); z-index:1000; transition:transform .4s cubic-bezier(.175,.885,.32,1.275); min-width:220px; max-width:90vw; }
#badge-toast.show { transform:translateX(-50%) translateY(0); }
#bt-emoji { font-size:1.8rem; }
#bt-title { font-size:.68rem; font-weight:700; color:#aaa; }
#bt-name  { font-size:.88rem; font-weight:900; color:#333; }

/* ── Pet panel ── */
#pet-panel { display:none; position:fixed; inset:0; background:rgba(0,0,0,.6); z-index:800; align-items:center; justify-content:center; padding:16px; }
#pet-panel.show { display:flex; }
#pet-card { background:linear-gradient(160deg,#1a0533,#2d1b69,#0f3460); border-radius:26px; width:100%; max-width:320px; padding:28px 22px; text-align:center; box-shadow:0 24px 60px rgba(0,0,0,.5); animation:gs-card-pop .35s cubic-bezier(.175,.885,.32,1.275) forwards; }
.pet-big   { font-size:6rem; margin-bottom:10px; display:block; filter:drop-shadow(0 6px 16px rgba(0,0,0,.4)); animation:gs-owl-bob 2.5s ease-in-out infinite; }
.pet-name  { font-size:1.4rem; font-weight:900; color:#fff; margin-bottom:3px; font-family:'Fredoka One',cursive; }
.pet-stage { font-size:.8rem; color:rgba(255,255,255,.55); font-weight:700; margin-bottom:14px; }
.xp-wrap   { width:100%; height:12px; background:rgba(255,255,255,.12); border-radius:6px; overflow:hidden; margin-bottom:6px; }
.xp-bar    { height:12px; border-radius:6px; background:linear-gradient(90deg,#a29bfe,#fd79a8); transition:width .6s cubic-bezier(.175,.885,.32,1.275); }
.xp-txt    { font-size:.75rem; color:rgba(255,255,255,.5); font-weight:700; margin-bottom:18px; }
.pet-close { width:100%; padding:12px; border-radius:50px; border:1.5px solid rgba(255,255,255,.3); background:rgba(255,255,255,.15); color:#fff; font-size:.95rem; font-weight:800; cursor:pointer; }

/* ── Garden panel ── */
#garden-panel { display:none; position:fixed; inset:0; background:rgba(0,0,0,.6); z-index:800; align-items:center; justify-content:center; padding:16px; }
#garden-panel.show { display:flex; }
#garden-card { background:linear-gradient(160deg,#0d1f0a,#1a3a10); border-radius:26px; width:100%; max-width:360px; padding:24px 20px; box-shadow:0 24px 60px rgba(0,0,0,.5); animation:gs-card-pop .35s cubic-bezier(.175,.885,.32,1.275) forwards; }
.garden-title { font-size:1.1rem; font-weight:900; color:#a8d8a8; margin-bottom:4px; text-align:center; }
.garden-sub   { font-size:.78rem; color:rgba(255,255,255,.4); text-align:center; margin-bottom:16px; }
.garden-grid  { display:grid; grid-template-columns:repeat(5,1fr); gap:8px; margin-bottom:16px; }
.garden-plot  { aspect-ratio:1; border-radius:10px; background:rgba(255,255,255,.05); display:flex; align-items:center; justify-content:center; font-size:1.6rem; border:1.5px solid rgba(255,255,255,.1); transition:transform .2s; }
.garden-plot.planted { background:rgba(107,203,119,.15); border-color:rgba(107,203,119,.4); }
.garden-close { width:100%; padding:10px; border-radius:50px; border:none; background:rgba(107,203,119,.2); color:#6bcb77; font-size:.9rem; font-weight:800; cursor:pointer; }

/* ── Daily streak pill ── */
#daily-pill { background:rgba(76,175,80,.12); border:1.5px solid rgba(76,175,80,.3); color:#4CAF50; font-size:.75rem; display:none; }
#daily-pill.show { display:flex; }

/* ── Pet button / Settings button ── */
#pet-btn { background: var(--settings-btn-bg); border: 1.5px solid var(--settings-btn-border); border-radius:50px; padding:4px 10px; cursor:pointer; font-size:1.3rem; line-height:1; transition:transform .2s; margin-left:auto; }
#pet-btn:active { transform:scale(1.2); }
#settings-btn { background: var(--settings-btn-bg); border: 1.5px solid var(--settings-btn-border); border-radius:50%; width:34px; height:34px; cursor:pointer; color: var(--settings-btn-color); font-size:1rem; display:flex; align-items:center; justify-content:center; flex-shrink:0; }

/* ── Onboarding ── */
#onboard-overlay { display:none; position:fixed; inset:0; z-index:1600; background:linear-gradient(160deg,#F0EDFF,#E8E3FF); flex-direction:column; align-items:center; justify-content:center; padding:32px 28px; text-align:center; }
#onboard-overlay.show { display:flex; }
.ob-skip { position:absolute; top:20px; right:20px; background:none; border:none; color:rgba(0,0,0,.3); font-size:.85rem; font-weight:700; cursor:pointer; }
.ob-frame { display:none; flex-direction:column; align-items:center; animation:fadeIn .4s; }
.ob-frame.active { display:flex; }
.ob-icon { font-size:7rem; margin-bottom:16px; filter:drop-shadow(0 8px 20px rgba(0,0,0,.12)); }
.ob-word { font-size:3.5rem; font-weight:900; color:var(--gs-text); font-family:'Fredoka One',cursive; margin-bottom:8px; }
.ob-hint { font-size:.95rem; color:var(--gs-text-soft); font-weight:700; margin-bottom:32px; }
.ob-dots { display:flex; gap:8px; margin-bottom:24px; }
.ob-dot { width:10px; height:10px; border-radius:50%; background:rgba(0,0,0,.15); transition:background .3s; }
.ob-dot.active { background:var(--gs-primary); }
.ob-btn { padding:16px 48px; border-radius:50px; border:none; background:linear-gradient(135deg,var(--gs-primary),#a29bfe); color:#fff; font-size:1.2rem; font-weight:900; cursor:pointer; box-shadow:0 8px 0 var(--gs-primary-dk); font-family:'Fredoka One',cursive; transition:transform .12s; }
.ob-btn:active { transform:translateY(3px); box-shadow:0 4px 0 var(--gs-primary-dk); }

/* ── PWA Install banner ── */
#pwa-banner { position: fixed; bottom: 0; left: 0; right: 0; z-index: 1800; background: #fff; border-radius: 24px 24px 0 0; padding: 20px 20px calc(20px + var(--safe-b)); box-shadow: 0 -8px 40px rgba(0,0,0,.18); transform: translateY(100%); transition: transform .4s cubic-bezier(.175,.885,.32,1.275); display: flex; flex-direction: column; align-items: center; gap: 10px; }
#pwa-banner.show { transform: translateY(0); }
.pwa-row { display: flex; align-items: center; gap: 12px; width: 100%; }
.pwa-icon { font-size: 2.8rem; flex-shrink: 0; }
.pwa-title { font-size: 1rem; font-weight: 900; color: #222; }
.pwa-sub   { font-size: .82rem; color: #888; margin-top: 2px; }
.pwa-steps { width: 100%; background: #f9f9f9; border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.pwa-step  { display: flex; align-items: center; gap: 10px; font-size: .85rem; font-weight: 700; color: #444; }
.pwa-step-num { width: 24px; height: 24px; border-radius: 50%; background: linear-gradient(135deg,var(--gs-primary),#764ba2); color: #fff; font-size: .72rem; font-weight: 900; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pwa-close { position: absolute; top: 14px; right: 16px; background: none; border: none; font-size: 1.2rem; color: #bbb; cursor: pointer; }
#android-install { position: fixed; bottom: calc(70px + var(--safe-b)); right: 16px; z-index: 1800; background: linear-gradient(135deg,var(--gs-primary),#764ba2); color: #fff; border: none; border-radius: 50px; padding: 10px 18px; font-size: .85rem; font-weight: 800; cursor: pointer; box-shadow: 0 4px 16px rgba(108,92,231,.4); display: none; }
#android-install.show { display: flex; align-items: center; gap: 6px; }

/* ── Auth overlay (game-level, shows before hub session check) ── */
#auth-overlay { display: flex; position: fixed; inset: 0; z-index: 2000; background: linear-gradient(160deg,#0f0f2a,#1a1a3e); flex-direction: column; align-items: center; justify-content: center; padding: 24px; }
.auth-logo { font-size: 5rem; margin-bottom: 6px; animation: gs-logo-pop .7s cubic-bezier(.175,.885,.32,1.275) forwards, gs-owl-bob 2.4s .7s ease-in-out infinite; }
.auth-title   { font-size: 2rem; font-weight: 900; color: #fff; letter-spacing: -1px; }
.auth-sub     { font-size: 1rem; color: rgba(255,255,255,.4); margin-bottom: 32px; }
.auth-box     { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 10px; }
.auth-btn { width: 100%; padding: 15px; border-radius: 14px; border: none; font-size: 1rem; font-weight: 800; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px; transition: transform .12s; }
.auth-btn:active { transform: scale(.97); }
.auth-btn.google { background: #fff; color: #333; }
.auth-btn.phone  { background: linear-gradient(135deg,var(--gs-primary),#764ba2); color: #fff; }
.auth-btn.guest  { background: rgba(255,255,255,.08); color: rgba(255,255,255,.6); border: 1.5px solid rgba(255,255,255,.15); }
.auth-btn.guest.primary { background: linear-gradient(135deg,var(--gs-primary),#a29bfe); color:#fff; border:none; font-size:1.1rem; }
.auth-input { width: 100%; padding: 14px; border-radius: 12px; border: none; font-size: 1rem; font-weight: 700; background: rgba(255,255,255,.95); }
.auth-back { background: none; border: none; color: rgba(255,255,255,.4); cursor: pointer; font-size: .85rem; padding: 6px; }
#auth-error { font-size: .8rem; color: #ff6b6b; text-align: center; min-height: 18px; opacity: 0; transition: opacity .3s; }

/* ── Kid overlay ── */
#kid-overlay { display: none; position: fixed; inset: 0; z-index: 1900; background: linear-gradient(160deg,#0f0f2a,#1a1a3e); flex-direction: column; align-items: center; justify-content: center; padding: 24px; }
.kid-heading  { font-size: 1.4rem; font-weight: 900; color: #fff; margin-bottom: 6px; }
.kid-subhead  { font-size: .85rem; color: rgba(255,255,255,.4); margin-bottom: 24px; }
#kid-grid     { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; max-width: 360px; }
.kid-card     { background: rgba(255,255,255,.1); border: 2px solid rgba(255,255,255,.18); border-radius: 20px; padding: 18px 20px; cursor: pointer; text-align: center; transition: all .15s; min-width: 90px; }
.kid-card:active { transform: scale(.94); background: rgba(255,255,255,.18); }
.kid-card.kid-add { border-style: dashed; }
.kid-av  { font-size: 2.8rem; margin-bottom: 6px; }
.kid-nm  { font-size: .82rem; font-weight: 800; color: #fff; }
.signout-btn { margin-top: 24px; padding: 9px 22px; border-radius: 50px; border: 1.5px solid rgba(255,255,255,.15); background: none; color: rgba(255,255,255,.35); font-size: .8rem; cursor: pointer; }

/* ── Add kid modal ── */
#add-kid-overlay { display: none; position: fixed; inset: 0; z-index: 2100; background: rgba(0,0,0,.75); align-items: center; justify-content: center; padding: 20px; }
#add-kid-card { background: #fff; border-radius: 24px; padding: 26px 22px; width: 100%; max-width: 320px; text-align: center; animation: gs-card-pop .35s cubic-bezier(.175,.885,.32,1.275); }
.add-kid-title { font-size: 1.1rem; font-weight: 900; color: #222; margin-bottom: 14px; }
#kid-name-input { width: 100%; padding: 12px; border-radius: 12px; border: 2px solid #e0e0e0; font-size: 1rem; font-weight: 700; text-align: center; margin-bottom: 12px; }
#avatar-picker  { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 14px; }
.av-btn { font-size: 1.8rem; background: none; border: 2.5px solid transparent; border-radius: 10px; padding: 3px 5px; cursor: pointer; transition: border-color .12s; }
.av-btn.selected { border-color: var(--gs-primary); }
#confirm-add-kid { width: 100%; padding: 12px; border-radius: 50px; border: none; background: linear-gradient(135deg,var(--gs-primary),#764ba2); color: #fff; font-size: .95rem; font-weight: 800; cursor: pointer; margin-bottom: 8px; }
#cancel-add-kid  { width: 100%; padding: 8px; border-radius: 50px; border: none; background: #f5f5f5; color: #888; font-size: .85rem; font-weight: 700; cursor: pointer; }

/* ── Kid badge in top bar ── */
#kid-pill { background: rgba(0,0,0,.07); border: 1.5px solid rgba(0,0,0,.12); border-radius: 50px; padding: 4px 10px; font-size: .72rem; font-weight: 800; color: var(--gs-text); cursor: pointer; white-space: nowrap; display: none; }
#kid-pill.show { display: flex; align-items: center; gap: 4px; }

/* ── Hub link button ── */
#hub-btn { background:var(--settings-btn-bg); border:1.5px solid var(--settings-btn-border); border-radius:50%; width:34px; height:34px; cursor:pointer; color:var(--settings-btn-color); font-size:1rem; display:flex; align-items:center; justify-content:center; flex-shrink:0; text-decoration:none; }

/* ── Dice ── */
.dice-wrap { display:flex; gap:16px; justify-content:center; align-items:center; }
.die { width:clamp(62px,18vw,80px); height:clamp(62px,18vw,80px); background:#fff; border-radius:14px; box-shadow:0 6px 20px rgba(0,0,0,.18); border:2px solid #e0e0e0; display:grid; grid-template-areas:'a b c' 'd e f' 'g h i'; grid-template-columns:1fr 1fr 1fr; grid-template-rows:1fr 1fr 1fr; padding:7px; gap:2px; }
.die.rolling { animation:droll .6s ease; }
@keyframes droll { 0%{transform:rotate(0)scale(1)} 30%{transform:rotate(14deg)scale(1.1)} 60%{transform:rotate(-9deg)scale(.92)} 100%{transform:rotate(0)scale(1)} }
.dot { width:clamp(8px,2.5vw,13px); height:clamp(8px,2.5vw,13px); background:#2d2d2d; border-radius:50%; visibility:hidden; margin:auto; }
.dot.show { visibility:visible; }

/* ── Balance Scale ── */
.scale-wrap { display:flex; flex-direction:column; align-items:center; gap:6px; width:100%; }
.scale-top  { display:flex; align-items:flex-end; gap:0; justify-content:center; width:100%; }
.s-pan { display:flex; flex-direction:column; align-items:center; }
.pan-tray { width:clamp(78px,22vw,96px); min-height:42px; background:#f0f4ff; border:2.5px solid #c5cef9; border-radius:12px; display:flex; flex-wrap:wrap; gap:4px; justify-content:center; align-items:center; padding:6px; transition:background .3s; }
.pan-tray.balanced { background:#f0fff4; border-color:#4CAF50; animation:pulse-green .4s; }
@keyframes pulse-green { 50%{box-shadow:0 0 14px #4CAF5055} }
.pan-chain { width:2px; height:22px; background:#bbb; }
.scale-beam { height:7px; background:linear-gradient(135deg,#e0e0e0,#bdbdbd); border-radius:4px; width:clamp(160px,46vw,220px); transition:transform .5s cubic-bezier(.175,.885,.32,1.275); transform-origin:center; box-shadow:0 2px 5px rgba(0,0,0,.12); }
.scale-pivot { width:14px; height:30px; background:linear-gradient(135deg,#bdbdbd,#9e9e9e); border-radius:4px; margin:0 auto; }
.scale-base  { width:54px; height:7px; background:#bdbdbd; border-radius:4px; }

/* ── Number Line ── */
.nl-wrap  { width:100%; display:flex; flex-direction:column; align-items:center; gap:8px; }
.nl-track { position:relative; width:100%; height:46px; }
.nl-rail  { position:absolute; top:50%; left:4px; right:4px; height:4px; background:#e0e0e0; border-radius:2px; transform:translateY(-50%); }
.nl-fill  { position:absolute; top:50%; left:4px; height:4px; background:linear-gradient(90deg,var(--add),var(--add2)); border-radius:2px; transform:translateY(-50%); width:0; transition:width .6s ease; }
.nl-ticks { display:flex; justify-content:space-between; padding:0 4px; }
.nl-tick  { display:flex; flex-direction:column; align-items:center; gap:1px; }
.nl-tick-line { width:2px; height:7px; background:#ccc; border-radius:1px; }
.nl-tick-num  { font-size:clamp(.52rem,1.8vw,.68rem); font-weight:800; color:#bbb; }
.nl-tick.hi .nl-tick-line { background:var(--gs-primary); height:11px; }
.nl-tick.hi .nl-tick-num  { color:var(--gs-primary); }
.nl-frog { position:absolute; top:-6px; font-size:1.3rem; transition:left .6s cubic-bezier(.175,.885,.32,1.275); }

/* ── Shop ── */
.shop-items { display:flex; gap:9px; justify-content:center; flex-wrap:wrap; width:100%; }
.s-item { background:#f9f9f9; border:2px solid #e0e0e0; border-radius:14px; padding:10px; display:flex; flex-direction:column; align-items:center; gap:3px; cursor:pointer; transition:all .15s; min-width:72px; max-width:90px; }
.s-item:active { transform:scale(.95); }
.s-item.selected { border-color:var(--gs-primary); background:#f0f0ff; }
.s-item-emoji { font-size:1.9rem; }
.s-item-price { font-size:.78rem; font-weight:900; color:var(--gs-primary); }
.wallet-row { display:flex; align-items:center; gap:6px; background:#fff8e1; border:2px solid #ffc107; border-radius:50px; padding:5px 14px; font-size:.88rem; font-weight:900; color:#555; }

/* ── Card flip (Number Match) ── */
.cards-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:8px; width:100%; }
.flip-card { aspect-ratio:1; border-radius:12px; cursor:pointer; perspective:600px; }
.flip-inner { width:100%; height:100%; position:relative; transform-style:preserve-3d; transition:transform .35s; }
.flip-card.flipped .flip-inner { transform:rotateY(180deg); }
.flip-front,.flip-back { position:absolute; inset:0; border-radius:12px; display:flex; align-items:center; justify-content:center; font-weight:900; backface-visibility:hidden; -webkit-backface-visibility:hidden; }
.flip-front { background:linear-gradient(135deg,var(--gs-primary),#764ba2); color:transparent; font-size:1.4rem; }
.flip-back  { background:#fff; border:2.5px solid #e0e0e0; color:#333; font-size:1.3rem; transform:rotateY(180deg); }
.flip-card.matched .flip-front { background:linear-gradient(135deg,#4CAF50,#2e7d32); }
.flip-card.matched .flip-back  { border-color:#4CAF50; background:#f0fff4; }
