/* 3DW3B FUN — shared styles. Mithai colours, glossy glass, everything animates in. */
:root {
  --saffron: #ff8a1f;
  --orange: #ff6a00;
  --pink: #e83e8c;
  --gold: #f5b400;
  --gold-deep: #d98e04;
  --pista: #93c572;
  --pista-deep: #5e9a3c;
  --cream: #fff8ec;
  --ink: #3b2314;
  --ink-soft: #7a5a48;
  --wa: #25d366;
  --glass: rgba(255, 255, 255, 0.66);
  --glass-line: rgba(255, 255, 255, 0.9);
  --shadow: 0 10px 30px rgba(175, 90, 20, 0.16);
  --radius: 22px;
  --font: "Baloo 2", "Poppins", "Segoe UI", system-ui, -apple-system, "Noto Sans", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background:
    radial-gradient(60vmax 40vmax at 100% 0%, rgba(232, 62, 140, 0.16), transparent 60%),
    radial-gradient(55vmax 40vmax at 0% 20%, rgba(255, 138, 31, 0.2), transparent 60%),
    radial-gradient(50vmax 40vmax at 60% 100%, rgba(147, 197, 114, 0.22), transparent 60%),
    var(--cream);
  background-attachment: scroll;
  overflow-x: hidden;
}
img, svg, canvas { max-width: 100%; }
a { color: var(--pink); }
h1, h2, h3 { line-height: 1.15; margin: 0 0 0.4em; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.8rem, 6vw, 3.2rem); }
h2 { font-size: clamp(1.35rem, 4vw, 2rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
.muted { color: var(--ink-soft); }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.hidden { display: none !important; }
.grad-text {
  background: linear-gradient(90deg, var(--orange), var(--pink));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 560px; }
.section { padding: 28px 0; }

/* Glass */
.glass {
  position: relative;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  overflow: hidden;
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .glass { -webkit-backdrop-filter: blur(10px) saturate(1.3); backdrop-filter: blur(10px) saturate(1.3); }
}
.glass::before {
  content: "";
  position: absolute;
  inset: 0 0 55% 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0));
  pointer-events: none;
}
.glass > * { position: relative; }
.pad { padding: 20px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 22px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 4px 14px rgba(175, 90, 20, 0.16), inset 0 1px 0 #fff;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: scale(0.97); }
.btn:focus-visible, .opt:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--pink);
  outline-offset: 2px;
}
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--saffron), var(--pink));
  box-shadow: 0 8px 20px rgba(232, 62, 140, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.btn-wa { color: #fff; background: linear-gradient(135deg, #2fe077, #12a150); }
.btn-ghost { background: transparent; box-shadow: none; border: 1.5px solid rgba(59, 35, 20, 0.2); }
.btn-sm { min-height: 38px; padding: 6px 14px; font-size: 0.9rem; }
.btn-block { display: flex; width: 100%; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 138, 31, 0.35);
  color: var(--gold-deep);
}
.chip-pink { border-color: rgba(232, 62, 140, 0.35); color: var(--pink); }
.chip-pista { border-color: rgba(94, 154, 60, 0.4); color: var(--pista-deep); }

/* Entry animation: add .anim-in, optionally style="--i:2" for stagger */
.anim-in {
  opacity: 0;
  animation: rise 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.2) forwards;
  animation-delay: calc(var(--i, 0) * 70ms);
}
.pop { animation: pop 0.6s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.wiggle { animation: wiggle 2.6s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: none; } }
@keyframes wiggle { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg) translateY(-4px); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .anim-in, .pop, .wiggle { animation: none; opacity: 1; }
  html { scroll-behavior: auto; }
}

/* Header and footer */
.site-header { padding: 12px 0; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.logo img { width: 34px; height: 34px; }
.site-nav { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.site-nav a { padding: 6px 10px; border-radius: 999px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 0.9rem; }
.site-nav a:hover { background: rgba(255, 255, 255, 0.7); }
.site-footer { padding: 28px 0 36px; font-size: 0.85rem; color: var(--ink-soft); text-align: center; }
.site-footer nav { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-bottom: 10px; }
.disclaimer { max-width: 620px; margin: 0 auto 8px; font-size: 0.8rem; color: var(--ink-soft); text-align: center; }

/* Exit button: on every game screen */
.exit-btn {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 50;
  min-height: 40px;
  padding: 6px 14px;
  font-size: 0.85rem;
}

/* Card grid */
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.game-card { display: flex; flex-direction: column; gap: 6px; padding: 18px; color: var(--ink); text-decoration: none; transition: transform 0.18s ease; }
a.game-card:hover { transform: translateY(-4px); }
.game-card .emoji { font-size: 2.2rem; line-height: 1; }
.game-card.soon { opacity: 0.75; }

/* Game shell */
.game { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.game-main { flex: 1; display: flex; align-items: center; padding: 60px 0 16px; }
.screen { width: 100%; }
.game-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.hero-emoji { font-size: 3.4rem; line-height: 1; display: inline-block; }
.mascot { width: 132px; height: auto; }

.progress { height: 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.8); box-shadow: inset 0 1px 3px rgba(59, 35, 20, 0.15); overflow: hidden; margin-bottom: 6px; }
.progress > i { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--gold), var(--saffron), var(--pink)); transition: width 0.35s ease; }
.q-title { font-size: clamp(1.25rem, 5vw, 1.6rem); font-weight: 800; margin: 10px 0 14px; }
.options { display: grid; gap: 10px; }
.opt {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  padding: 10px 16px;
  text-align: left;
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.88);
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  border-radius: 16px;
  box-shadow: 0 3px 10px rgba(175, 90, 20, 0.12);
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
.opt:hover { border-color: var(--saffron); }
.opt:active { transform: scale(0.98); }
.opt.picked { background: linear-gradient(135deg, #fff1d6, #ffe0ee); border-color: var(--pink); }
.opt .e { font-size: 1.4rem; }
.opt.right { background: linear-gradient(135deg, #eaf6e0, #d6efc6); border-color: var(--pista-deep); }
.opt.wrong { background: #fff0ec; border-color: #e6a497; }
.feedback { margin-top: 12px; padding: 10px 14px; border-radius: 14px; background: rgba(255, 255, 255, 0.9); text-align: center; animation: pop 0.4s ease both; }

/* Arcade games */
.arcade-how { font-weight: 700; color: var(--gold-deep); }
.arcade-hud { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; font-weight: 800; }
.arcade-hud .progress { flex: 1; margin: 0; }
.arcade-score b { font-size: 1.35rem; color: var(--pink); }
.arcade-clock { min-width: 2ch; text-align: right; font-size: 1.2rem; }
.arcade-stage {
  position: relative;
  height: min(64vh, 540px);
  min-height: 340px;
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--glass-line);
  box-shadow: var(--shadow);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.arcade-over { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; background: rgba(255, 248, 236, 0.82); }
.countdown { font-size: clamp(4rem, 22vw, 7rem); font-weight: 800; line-height: 1.1; color: var(--pink); }
.times-up { font-size: clamp(2rem, 9vw, 3rem); font-weight: 800; }
.pop-text { position: absolute; z-index: 4; transform: translate(-50%, -50%); font-weight: 800; font-size: 1.4rem; color: var(--pink); pointer-events: none; white-space: nowrap; text-shadow: 0 2px 0 #fff; animation: float-up 0.8s ease-out forwards; }
@keyframes float-up { from { opacity: 1; transform: translate(-50%, -50%); } to { opacity: 0; transform: translate(-50%, -150%); } }

/* Result and share */
.result-name { font-size: clamp(1.5rem, 6.5vw, 2.2rem); font-weight: 800; }
.result-line { font-size: 1.05rem; }
.result-score { font-size: clamp(2.4rem, 11vw, 3.4rem); font-weight: 800; line-height: 1.1; }
.meter { height: 16px; border-radius: 999px; background: rgba(255, 255, 255, 0.85); overflow: hidden; box-shadow: inset 0 1px 3px rgba(59, 35, 20, 0.15); margin: 10px 0; }
.meter > i { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--gold), var(--saffron), var(--pink)); transition: width 1.1s cubic-bezier(0.2, 0.9, 0.3, 1); }
.share-block { margin-top: 16px; }
.card-preview { display: block; margin: 0 auto 12px; border-radius: 16px; box-shadow: var(--shadow); background: #fff; max-height: 46vh; width: auto; }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: rgba(255, 255, 255, 0.75); margin-bottom: 10px; }
.seg button { border: 0; background: transparent; font: inherit; font-weight: 700; font-size: 0.85rem; padding: 6px 14px; border-radius: 999px; color: var(--ink-soft); cursor: pointer; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 2px 6px rgba(175, 90, 20, 0.18); }
.btn-row { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.btn-row .full { grid-column: 1 / -1; }
.banner { padding: 10px 14px; border-radius: 14px; background: linear-gradient(135deg, #fff1d6, #ffe0ee); font-weight: 700; margin-bottom: 12px; }

/* Avatars */
.avatar-grid { display: grid; gap: 10px; grid-template-columns: repeat(4, 1fr); }
.avatar-opt { padding: 6px; border-radius: 16px; border: 2px solid transparent; background: rgba(255, 255, 255, 0.85); cursor: pointer; font: inherit; font-size: 0.7rem; font-weight: 600; color: var(--ink-soft); }
.avatar-opt svg { display: block; width: 100%; height: auto; }
.avatar-opt.on { border-color: var(--pink); background: #fff; }
.avatar-chip { width: 44px; height: 44px; border-radius: 50%; overflow: hidden; background: #fff; box-shadow: 0 2px 8px rgba(175, 90, 20, 0.2); border: 0; padding: 0; cursor: pointer; }
.avatar-chip svg { display: block; width: 100%; height: 100%; }

/* Badges */
.badge-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.badge-tile { padding: 16px 12px; text-align: center; }
.badge-tile .emoji { font-size: 2.4rem; line-height: 1.1; }
.badge-tile .name { font-weight: 800; line-height: 1.2; margin-top: 6px; }

/* Modal, forms, toast */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; padding: 12px; background: rgba(59, 35, 20, 0.45); animation: fade 0.2s ease both; overflow-y: auto; }
@media (min-width: 600px) { .modal-backdrop { align-items: center; } }
.modal { width: 100%; max-width: 480px; max-height: calc(100dvh - 24px); overflow-y: auto; padding: 20px; background: #fffaf2; border-radius: 22px; box-shadow: 0 20px 60px rgba(59, 35, 20, 0.35); animation: rise 0.35s ease both; }
.modal-close { float: right; }
.field { display: block; margin-bottom: 12px; font-weight: 600; font-size: 0.9rem; }
.field input, .field select { display: block; width: 100%; min-height: 46px; margin-top: 4px; padding: 8px 12px; font: inherit; color: var(--ink); background: #fff; border: 1.5px solid rgba(59, 35, 20, 0.2); border-radius: 12px; }
.check { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; font-size: 0.9rem; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--pink); }
.notice { padding: 12px; border-radius: 12px; background: rgba(147, 197, 114, 0.18); font-size: 0.85rem; margin-bottom: 12px; }
.form-msg { font-weight: 700; margin: 8px 0; }
.form-msg.err { color: #b3261e; }
.form-msg.ok { color: var(--pista-deep); }
.toast { position: fixed; left: 50%; bottom: 22px; z-index: 200; transform: translateX(-50%); padding: 10px 18px; border-radius: 999px; background: var(--ink); color: #fff; font-weight: 600; font-size: 0.9rem; animation: rise 0.3s ease both; max-width: calc(100vw - 32px); text-align: center; }

@media (max-width: 380px) {
  .btn { padding: 10px 14px; }
  .pad { padding: 16px; }
  .avatar-grid { gap: 6px; }
}
