:root {
  --bg0: #0a0e1a;
  --bg1: #141a2e;
  --ink: #eef2ff;
  --dim: #8a93b8;
  --accent: #7cf0d8;
  --accent2: #ffd36e;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Bricolage Grotesque', sans-serif;
  color: var(--ink);
  background: radial-gradient(120% 90% at 50% -10%, #1c2444 0%, var(--bg1) 45%, var(--bg0) 100%);
  overflow: hidden;
}
#root { height: 100%; }

.app-shell {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* ambient background */
.bg-orb {
  position: absolute; border-radius: 50%; filter: blur(70px);
  opacity: 0.35; pointer-events: none; z-index: 0;
  animation: drift 22s ease-in-out infinite alternate;
}
.orb1 { width: 340px; height: 340px; background: #4a63ff; top: -80px; left: -60px; }
.orb2 { width: 300px; height: 300px; background: #ff5fa2; bottom: -90px; right: -50px; animation-delay: -7s; }
.orb3 { width: 260px; height: 260px; background: #2ce6c4; top: 40%; right: 30%; animation-delay: -13s; }
@keyframes drift { from { transform: translate(0,0) scale(1); } to { transform: translate(40px,30px) scale(1.15); } }

/* header */
.hdr {
  position: relative; z-index: 5;
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px 6px;
}
.brand { display: flex; align-items: center; gap: 8px; }
.logo { font-size: 22px; animation: bob 3s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-4px); } }
.title { font-weight: 800; font-size: 18px; letter-spacing: -0.5px; }
.stats {
  display: flex; align-items: center; gap: 8px;
  font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--dim);
}
.stats b { color: var(--accent); font-weight: 500; }
.sep { opacity: 0.4; }
.streak { color: var(--accent2); font-weight: 500; }
.mute-btn { background: none; border: none; font-size: 15px; cursor: pointer; opacity: 0.7; padding: 2px 4px; }
.mute-btn:hover { opacity: 1; }

/* tabs */
.tabs {
  position: relative; z-index: 5;
  display: flex; gap: 8px; justify-content: center; padding: 6px 0 4px;
}
.tab {
  font-family: 'Bricolage Grotesque'; font-size: 13px; font-weight: 400;
  padding: 7px 16px; border-radius: 999px; cursor: pointer;
  border: 1px solid #ffffff1a; background: #ffffff0a; color: var(--dim);
  transition: all .25s;
}
.tab.on { background: var(--ink); color: var(--bg0); border-color: var(--ink); font-weight: 800; }
.tab:hover:not(.on) { color: var(--ink); }

/* play area */
.play-wrap { position: relative; z-index: 4; flex: 1; display: flex; flex-direction: column; padding: 10px 14px 4px; min-height: 0; }
.play-area {
  position: relative; flex: 1; border-radius: 24px;
  background: linear-gradient(160deg, #ffffff0d, #ffffff03);
  border: 1px solid #ffffff12;
  overflow: hidden; min-height: 0;
  box-shadow: inset 0 0 60px #00000040;
}
.ball {
  position: absolute; border-radius: 50%; border: none; cursor: pointer;
  padding: 0; transition: transform .12s ease;
  animation: pop-in .4s cubic-bezier(.2,1.4,.4,1);
}
.ball:hover { transform: scale(1.12); z-index: 3; }
.ball:active { transform: scale(0.9); }
.ball .shine {
  position: absolute; top: 16%; left: 20%; width: 26%; height: 26%;
  background: #ffffffcc; border-radius: 50%; filter: blur(2px);
}
@keyframes pop-in { from { transform: scale(0); } to { transform: scale(1); } }

/* burst */
.burst { position: absolute; width: 0; height: 0; z-index: 6; pointer-events: none; }
.part {
  position: absolute; width: 8px; height: 8px; border-radius: 50%;
  left: 0; top: 0; margin: -4px;
  animation: fly .6s ease-out forwards;
}
@keyframes fly {
  from { transform: translate(0,0) scale(1); opacity: 1; }
  to { transform: translate(var(--dx), var(--dy)) scale(0); opacity: 0; }
}
.ring {
  position: absolute; left: 0; top: 0; width: 20px; height: 20px; margin: -10px;
  border: 3px solid; border-radius: 50%; opacity: 0.9;
  animation: ringexp .55s ease-out forwards;
}
@keyframes ringexp {
  from { transform: scale(0.4); opacity: .9; }
  to { transform: scale(4.5); opacity: 0; }
}

/* mini toast */
.mini-toast {
  position: absolute; z-index: 6; transform: translate(-50%, -140%);
  font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--dim);
  white-space: nowrap; pointer-events: none;
  animation: floatup 1.1s ease-out forwards;
}
@keyframes floatup { from { opacity: 0; transform: translate(-50%,-100%); } 20% { opacity: 1; } to { opacity: 0; transform: translate(-50%,-260%); } }

/* brewing */
.brewing {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  display: flex; align-items: center; gap: 8px; color: var(--dim);
  font-family: 'IBM Plex Mono', monospace; font-size: 13px;
}
.pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: .3; transform: scale(.8);} 50% { opacity: 1; transform: scale(1.3);} }

.tip { text-align: center; color: var(--dim); font-size: 12px; font-family: 'IBM Plex Mono', monospace; margin: 8px 0 4px; }

/* fact overlay */
.fact-overlay {
  position: absolute; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  background: #060812b0; backdrop-filter: blur(6px);
  animation: fade .3s ease;
}
@keyframes fade { from { opacity: 0; } }
.fact-card {
  position: relative; max-width: 440px; width: 88%;
  padding: 46px 26px 24px; border-radius: 24px; text-align: center;
  background: linear-gradient(150deg, #ffffff18, #ffffff08);
  border: 1px solid #ffffff26;
  box-shadow: 0 20px 60px #00000060, 0 0 40px #7cf0d820;
  animation: cardin .45s cubic-bezier(.2,1.3,.4,1);
}
@keyframes cardin { from { transform: scale(.85) translateY(20px); opacity: 0; } }
.ring-wrap {
  position: absolute; top: -34px; left: 50%; transform: translateX(-50%);
  width: 68px; height: 68px;
}
.count-ring { width: 68px; height: 68px; transform: rotate(-90deg); }
.ring-bg { fill: #141a2e; stroke: #ffffff1a; stroke-width: 6; }
.ring-fg { fill: none; stroke: var(--accent); stroke-width: 6; stroke-linecap: round; transition: stroke-dashoffset .06s linear; }
.ring-emoji { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 24px; }
.fact-text { font-size: 20px; line-height: 1.45; font-weight: 400; margin: 10px 0 20px; letter-spacing: -0.2px; }
.got-it {
  font-family: 'Bricolage Grotesque'; font-weight: 800; font-size: 13px;
  padding: 9px 22px; border-radius: 999px; cursor: pointer;
  background: var(--accent); color: #04120d; border: none;
}
.got-it:hover { filter: brightness(1.1); }

/* quiz */
.quiz-wrap { position: relative; z-index: 4; flex: 1; display: flex; align-items: center; justify-content: center; padding: 16px; overflow-y: auto; }
.quiz-card {
  width: 100%; max-width: 500px; text-align: center;
  padding: 30px 24px; border-radius: 24px;
  background: linear-gradient(150deg, #ffffff12, #ffffff05);
  border: 1px solid #ffffff18;
  box-shadow: 0 16px 50px #00000050;
  animation: cardin .4s cubic-bezier(.2,1.3,.4,1);
}
.big-emoji { font-size: 46px; margin-bottom: 6px; }
.big-emoji.spin { animation: spin 1.4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.quiz-card h2 { font-weight: 800; font-size: 22px; margin: 6px 0 8px; letter-spacing: -0.5px; }
.quiz-card p { color: var(--dim); font-size: 14px; margin: 4px 0 18px; line-height: 1.4; }
.primary-btn {
  font-family: 'Bricolage Grotesque'; font-weight: 800; font-size: 14px;
  padding: 12px 26px; border-radius: 999px; cursor: pointer; border: none;
  background: linear-gradient(120deg, var(--accent), #6ad0ff); color: #04120d;
  box-shadow: 0 6px 20px #7cf0d840; transition: transform .15s;
}
.primary-btn:hover { transform: translateY(-2px); }
.active-q { text-align: left; }
.qmeta {
  display: flex; justify-content: space-between; align-items: center;
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--dim); margin-bottom: 14px;
}
.qscore { color: var(--accent2); }
.q-text { color: var(--ink) !important; font-size: 18px !important; font-weight: 400; margin: 0 0 18px !important; line-height: 1.4; }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt {
  display: flex; align-items: center; gap: 12px; text-align: left;
  font-family: 'Bricolage Grotesque'; font-size: 15px; color: var(--ink);
  padding: 13px 14px; border-radius: 14px; cursor: pointer;
  background: #ffffff0a; border: 1px solid #ffffff14; transition: all .2s;
}
.opt:hover { background: #ffffff16; border-color: #ffffff30; }
.opt-key {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'IBM Plex Mono', monospace; font-size: 12px;
  background: #ffffff14; color: var(--dim);
}
.opt.correct { background: #2ce6a018; border-color: var(--accent); color: var(--accent); animation: goodpulse .5s; }
.opt.correct .opt-key { background: var(--accent); color: #04120d; }
.opt.wrong { background: #ff5f8018; border-color: #ff6b8a; color: #ff8fa5; animation: shake .4s; }
.opt.dim { opacity: 0.4; }
@keyframes goodpulse { 0%,100% { transform: scale(1);} 40% { transform: scale(1.03);} }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-6px)} 75%{transform:translateX(6px)} }
.nextb { margin-top: 16px; width: 100%; }

/* footer */
.ftr {
  position: relative; z-index: 5;
  display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 12px 10px; font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px; color: #5a6386;
}
.ftr a { color: var(--accent); text-decoration: none; }
.ftr a:hover { text-decoration: underline; }
.dot { opacity: 0.4; }
.reset-link { background: none; border: none; color: #5a6386; font-family: inherit; font-size: 10.5px; cursor: pointer; padding: 0; }
.reset-link:hover { color: #ff8fa5; }

@media (max-width: 480px) {
  .title { font-size: 16px; }
  .fact-text { font-size: 18px; }
  .stats { font-size: 11px; gap: 6px; }
}