/* ===== Stanley's Maths Corner - shared styles ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root { --font-face: "Fredoka", "Baloo 2", system-ui, sans-serif; --font-title: "Baloo 2", "Fredoka", system-ui, sans-serif; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-face); min-height: 100vh; overflow-x: hidden; color: #3b2b4f;
  background: linear-gradient(135deg, #d8f5ff 0%, #e7fbef 45%, #fff9e6 100%);
  background-size: 300% 300%; animation: gradientShift 18s ease infinite; position: relative;
}
@keyframes gradientShift { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }

.sky { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.cloud { position: absolute; background: rgba(255,255,255,.85); border-radius: 999px; filter: blur(2px); box-shadow: 0 6px 20px rgba(255,255,255,.4); }
.cloud::before, .cloud::after { content: ""; position: absolute; background: rgba(255,255,255,.85); border-radius: 50%; }
.cloud::before { width: 55%; height: 100%; top: -45%; left: 15%; }
.cloud::after { width: 40%; height: 90%; top: -30%; right: 12%; }
.c1 { width: 120px; height: 46px; top: 12%; left: 6%; animation: floaty 9s ease-in-out infinite; }
.c2 { width: 90px; height: 36px; top: 22%; right: 8%; animation: floaty 11s ease-in-out 2s infinite; }
.star { position: absolute; font-size: 32px; color: #fff3b0; text-shadow: 0 0 14px #ffe97a; animation: twinkle 3.5s ease-in-out infinite; }
.s1 { top: 18%; right: 22%; }
.s2 { top: 70%; left: 18%; animation-delay: 1.2s; }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-20px); } }
@keyframes twinkle { 0%,100% { opacity: .5; transform: scale(.9); } 50% { opacity: 1; transform: scale(1.2); } }

.hero { position: relative; z-index: 1; padding: 40px 20px 10px; text-align: center; max-width: 1000px; margin: 0 auto; }
.back { display: inline-block; font-weight: 700; color: #059669; text-decoration: none; background: #fff; padding: 8px 18px; border-radius: 999px; box-shadow: 0 4px 10px rgba(0,0,0,.08); margin-bottom: 18px; transition: transform .15s ease; }
.back:hover { transform: translateY(-2px); }
.mascot { font-size: 90px; display: inline-block; animation: bob 2.2s ease-in-out infinite; filter: drop-shadow(0 8px 16px rgba(0,0,0,.15)); }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-14px) rotate(6deg); } }
.title { font-family: var(--font-title); font-size: clamp(2.4rem, 7vw, 4.2rem); font-weight: 800; color: #2c4a3b; text-shadow: 0 4px 0 rgba(255,255,255,.5); margin: 8px 0 6px; }
.name { background: linear-gradient(90deg,#059669,#0ea5e9,#7c3aed,#ff5d8f); background-size: 300% auto; -webkit-background-clip: text; background-clip: text; color: transparent; animation: rainbowText 5s linear infinite; padding: 0 6px; }
@keyframes rainbowText { 0% { background-position: 0% center; } 100% { background-position: 300% center; } }
.tagline { font-size: clamp(1.1rem, 3vw, 1.4rem); font-weight: 500; color: #5f7280; }

.games { position: relative; z-index: 1; max-width: 1000px; margin: 0 auto; padding: 30px 24px 60px; }
.section-title { font-family: var(--font-title); font-size: clamp(1.8rem, 5vw, 2.6rem); font-weight: 800; text-align: center; color: #2c4a3b; margin-bottom: 26px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 24px; }
.card { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; padding: 30px 20px; background: #fff; border-radius: 26px; text-decoration: none; color: #2c4a3b; box-shadow: 0 12px 24px rgba(0,0,0,.1); border-bottom: 8px solid var(--c2); transition: transform .2s cubic-bezier(.34,1.56,.64,1), box-shadow .2s ease; justify-self: stretch; }
.card:hover { transform: translateY(-8px) scale(1.04) rotate(-1deg); box-shadow: 0 18px 30px rgba(0,0,0,.16); }
.card:active { transform: translateY(-2px) scale(1); }
.card-icon { font-size: 60px; margin-bottom: 8px; animation: iconPop 4s ease-in-out infinite; }
.card:hover .card-icon { transform: scale(1.12) rotate(6deg); }
@keyframes iconPop { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.card-name { font-family: var(--font-title); font-size: 1.6rem; font-weight: 800; }
.card-sub { font-size: .95rem; font-weight: 500; color: #7a8a94; }
.card-live { font-size: .85rem; font-weight: 700; margin-top: 4px; padding: 4px 12px; border-radius: 999px; background: #d1fae5; color: #047857; }
.card-live.soon { background: #fee2e2; color: #b91c1c; }

.footer { position: relative; z-index: 1; text-align: center; padding: 20px 20px 40px; color: #2c4a3b; font-size: 1.05rem; font-weight: 500; }
.heart { color: #ff5d8f; animation: beat 1.1s ease-in-out infinite; display: inline-block; }
@keyframes beat { 0%,100% { transform: scale(1); } 30% { transform: scale(1.3); } }

#confetti-layer { position: fixed; inset: 0; z-index: 100; pointer-events: none; overflow: hidden; }
.confetti { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 3px; animation: confettiFall linear forwards; }
@keyframes confettiFall { to { transform: translateY(110vh) rotate(720deg); opacity: 0; } }

.modal-overlay { position: fixed; inset: 0; background: rgba(40,60,50,.55); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 50; opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility .25s ease; }
.modal-overlay.show { opacity: 1; visibility: visible; }
.modal-card { background: #fff; border-radius: 30px; padding: 40px 34px; text-align: center; max-width: 400px; width: 90%; box-shadow: 0 20px 50px rgba(0,0,0,.3); transform: scale(.8); transition: transform .25s cubic-bezier(.34,1.56,.64,1); border-top: 10px solid #059669; }
.modal-overlay.show .modal-card { transform: scale(1); }
.modal-icon { font-size: 80px; margin-bottom: 6px; animation: bob 2s ease-in-out infinite; }
.modal-card h3 { font-family: var(--font-title); font-size: 2rem; font-weight: 800; color: #2c4a3b; margin-bottom: 8px; }
.modal-text { color: #5f7280; font-size: 1.1rem; margin-bottom: 24px; line-height: 1.5; }
.btn-close { font-family: var(--font-title); font-size: 1.2rem; font-weight: 700; color: #fff; border: none; cursor: pointer; padding: 14px 38px; border-radius: 999px; background: linear-gradient(90deg,#059669,#34d399); box-shadow: 0 6px 0 #047857; transition: transform .15s ease, box-shadow .15s ease; }
.btn-close:hover { transform: translateY(-2px) scale(1.05); }
.btn-close:active { transform: translateY(3px); box-shadow: 0 2px 0 #047857; }

@media (max-width: 560px) {
  .mascot { font-size: 70px; }
  .card-icon { font-size: 50px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .card { padding: 22px 12px; border-radius: 20px; }
}