/* ===== Base layout ===== */
*{box-sizing:border-box}
:root{--radius:12px}
body{margin:0;font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;background:#fff;color:#111}
.wrap{max-width:720px;margin:0 auto;padding:16px;padding-bottom:16px} /* JS bumps this only when an ad is visible */
.hidden{display:none}

/* Cards & controls */
.card{background:#fff;border:1px solid #eee;border-radius:var(--radius);padding:16px;box-shadow:0 4px 16px rgba(0,0,0,.04);margin:12px 0}
.muted{color:#666}
.lbl{display:block;margin-top:12px;font-weight:600}
input,select,button{font-size:16px}
input,select{width:100%;padding:10px;border:1px solid #ddd;border-radius:10px;background:#fff}
.row{display:flex;gap:8px;margin-top:12px;flex-wrap:wrap}
button{appearance:none;border:1px solid #ddd;background:#f9f9f9;border-radius:10px;padding:10px 14px;font-weight:600;cursor:pointer}
button:active{transform:translateY(1px)}

/* Quiz UI */
.top{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:8px}
.q{border:1px solid #eee;border-radius:10px;padding:10px;margin:8px 0}
.progress{font-size:12px;color:#666;margin-bottom:6px}
.opts{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.opts button.selected{outline:2px solid #111}

/* ===== Consent banner ===== */
.consent{
  position:fixed;left:16px;right:16px;bottom:100px;
  background:#fff;border:1px solid #ddd;border-radius:10px;padding:12px;
  box-shadow:0 6px 20px rgba(0,0,0,.08);z-index:2147482500
}
.consent.hidden{display:none}
.consent .row{display:flex;gap:8px;margin-top:8px}

/* ===== Bottom ad banner (no space unless visible) ===== */
.ad-banner{
  position:fixed;left:0;right:0;bottom:0;
  background:#fff;border-top:1px solid #e5e5e5;text-align:center;
  z-index:2147483000;padding:4px 0
}
.ad-banner.hidden{display:none!important}
.ad-banner ins.adsbygoogle{display:block;width:100%}

/* Ensure overlays stay below ad */
.overlay-safe{z-index:2147482000}

/* ===== Mobile polish ===== */
@media (max-width:480px){
  h1{font-size:28px;margin:8px 0 6px}
  .card{border-radius:14px;padding:14px;box-shadow:0 6px 22px rgba(0,0,0,.06)}
  .lbl{margin-top:10px}
  input,select{padding:12px;border-radius:12px}
  .row{gap:10px}
  button{width:100%;padding:12px 14px;border-radius:12px}
  .opts{grid-template-columns:1fr} /* stack answers */
  .q{padding:12px}
}
/* ===== HeiyuQuiz Beauty Pack ===== */

/* Subtle app background */
body{
  background:
    radial-gradient(1000px 600px at 10% -10%, #f7faff 0%, transparent 60%),
    radial-gradient(800px 500px at 110% 10%, #fff3f7 0%, transparent 60%),
    #ffffff;
}

/* Fancy gradient title */
h1{
  font-weight:800;
  letter-spacing:-0.02em;
  background:linear-gradient(90deg,#111 0%,#6e56cf 30%,#d6467e 70%,#ffb224 100%);
  -webkit-background-clip:text;background-clip:text;color:transparent;
}

/* Glow card with gradient border */
.card{
  position:relative; overflow:hidden;
  border:1px solid rgba(0,0,0,0.06);
  background:rgba(255,255,255,0.85);
  backdrop-filter:saturate(140%) blur(6px);
  transition:transform .12s ease, box-shadow .2s ease;
}
.card::before{
  content:""; position:absolute; inset:-1px;
  border-radius:inherit; padding:1px;
  background:linear-gradient(135deg, #e2d9ff, #ffd8e5);
  -webkit-mask:
    linear-gradient(#000 0 0) content-box, 
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events:none;
}
.card:hover{ transform:translateY(-1px); box-shadow:0 10px 30px rgba(0,0,0,.06); }

/* Inputs */
input,select{
  border:1px solid #e6e6e6; background:#fff;
  transition:box-shadow .15s,border-color .15s;
}
input:focus,select:focus{
  outline:none; border-color:#b9a6ff;
  box-shadow:0 0 0 3px rgba(185,166,255,.25);
}

/* Buttons */
#createBtn{
  background:linear-gradient(90deg,#6e56cf,#d6467e,#ffb224);
  color:#fff; border:0;
  box-shadow:0 6px 18px rgba(214,70,126,.25);
  transition:transform .06s ease, filter .2s ease;
}
#createBtn:active{ transform:translateY(1px) scale(.99); }

/* Share button */
#shareBtn{
  border:1px solid #e6e6e6; background:#fff;
  border-radius:10px; padding:8px 12px;
}
#shareBtn:hover{ border-color:#c9c9c9; }

/* Quiz options */
.opts button{
  background:#fff; border:1px solid #e9e9e9;
  border-radius:12px; padding:12px; text-align:left;
  transition:transform .06s ease, border-color .15s, box-shadow .15s;
}
.opts button:hover{ border-color:#cfcfcf; box-shadow:0 4px 14px rgba(0,0,0,.05); }
.opts button:active{ transform:translateY(1px); }
.opts button.selected{
  border-color:#6e56cf; box-shadow:0 0 0 4px rgba(185,166,255,.25);
}

/* Progress pill */
.progress{
  display:inline-block; padding:4px 10px; border-radius:999px;
  background:#f6f5ff; color:#5a4fbf; font-weight:600;
}

/* Toast */
.toast{
  position:fixed; left:50%; transform:translateX(-50%);
  bottom:calc(100px + 8px); /* stays above ad */
  background:#111; color:#fff; padding:10px 14px;
  border-radius:12px; font-size:14px;
  box-shadow:0 8px 24px rgba(0,0,0,.25);
  opacity:0; pointer-events:none; transition:opacity .2s ease;
  z-index:2147482800;
}
.toast.show{ opacity:1; }

/* Confetti bits */
.confetti{
  position:fixed; width:8px; height:12px; border-radius:2px;
  top:0; left:50%; opacity:.9; transform:translateX(-50%);
  animation:confetti-fall 1000ms ease-out forwards;
  z-index:2147482600;
}
@keyframes confetti-fall{
  0%{ transform:translate(var(--x,0), -20px) rotate(0); }
  100%{ transform:translate(var(--x,0), calc(100vh - 120px)) rotate(240deg); }
}
/* === HeiyuQuiz Play Page – Cute/Cartoon UI pass === */

/* Category themes (auto-applied by app.js) */
:root{
  --theme: #6e56cf;          /* default (General) */
  --theme-soft: rgba(110,86,207,.12);
}
html[data-theme*="sport"] { --theme:#22c55e; --theme-soft:rgba(34,197,94,.12); }   /* green */
html[data-theme*="movie"] { --theme:#f97316; --theme-soft:rgba(249,115,22,.12); }  /* orange */
html[data-theme*="music"] { --theme:#ec4899; --theme-soft:rgba(236,72,153,.12); }  /* pink */
html[data-theme*="history"]{ --theme:#3b82f6; --theme-soft:rgba(59,130,246,.12);} /* blue */
html[data-theme*="science"]{ --theme:#06b6d4; --theme-soft:rgba(6,182,212,.12);}  /* cyan */

/* Play card */
#playView .card{
  border:0;
  background:linear-gradient(180deg,#fff, #fff8);
  backdrop-filter:saturate(140%) blur(4px);
  box-shadow:0 10px 30px rgba(0,0,0,.08);
}

/* Question block = rounded, pill header, gentle glow */
.q{
  border:1px solid rgba(0,0,0,.06);
  border-radius:16px;
  padding:14px;
  background:#fff;
  box-shadow:0 6px 18px rgba(0,0,0,.05);
}
.q h3{
  margin:8px 0 12px;
  font-size:18px;
  line-height:1.25;
}

/* Progress pill */
.progress{
  display:inline-block;
  font-weight:700;
  font-size:12px;
  padding:6px 10px;
  border-radius:999px;
  background:var(--theme-soft);
  color:var(--theme);
}

/* Options grid – big, tap-friendly */
.opts{ display:grid; grid-template-columns:1fr 1fr; gap:10px; }
@media (max-width:480px){ .opts{ grid-template-columns:1fr; } }

.opts button{
  background:#fff;
  border:2px solid rgba(0,0,0,.06);
  border-radius:14px;
  padding:14px 12px;
  text-align:left;
  font-weight:700;
  line-height:1.25;
  box-shadow:0 4px 12px rgba(0,0,0,.05);
  transition:transform .06s ease, border-color .15s, box-shadow .15s, background .15s;
  position:relative;
  overflow:hidden;
}
.opts button:active{ transform:translateY(1px) scale(.99); }
.opts button:hover{ border-color:#d6d6d6; box-shadow:0 8px 18px rgba(0,0,0,.06); }

/* Selected = chunky colorful outline + soft glow */
.opts button.selected{
  border-color:var(--theme);
  box-shadow:0 0 0 4px var(--theme-soft), 0 10px 24px rgba(0,0,0,.06);
}

/* Tiny emoji badge (cartoon vibe) */
.opts button::before{
  content:"✨";
  position:absolute; right:10px; top:8px; opacity:.25; font-size:18px;
}
.opts button.selected::before{ content:"✅"; opacity:1; }

/* Sticky submit button above the ad */
.sticky-submit{
  position: sticky;
  bottom: calc(70px + env(safe-area-inset-bottom, 0px)); /* sits above ad/footer */
  background: linear-gradient(90deg,#6e56cf,#d6467e,#ffb224);
  color: #fff;
  border: 0;
  border-radius: 14px;
  padding: 14px;
  font-weight: 800;
  width: 100%;          /* ensure full-width */
  box-shadow: 0 12px 28px rgba(214,70,126,.25);
  z-index: 2147481000;  /* stay above content */
}

/* Reserve room so last question isn't covered */
#playView, #quizBody{
  padding-bottom: 120px;          /* space for the sticky button */
  scroll-padding-bottom: 120px;   /* when browser scrolls to anchors */
}
@supports (padding: max(0px)){
  #playView, #quizBody{
    padding-bottom: max(120px, calc(80px + env(safe-area-inset-bottom, 0px)));
    scroll-padding-bottom: max(120px, calc(80px + env(safe-area-inset-bottom, 0px)));
  }
}

/* Keep the button sticky above the safe area */
.sticky-submit{
  position: sticky;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 10;
}

/* Micro polish */
.muted{ color:#667085; }
:root{
  /* set this to your create/start button color if you want an exact match */
  --brand: #6e56cf;
}

/* reset any old star styles and build our box + dot */
.opts button{
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 14px 12px 48px; /* room for the box */
  margin: 8px 0;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  font-weight: 700;
  line-height: 1.2;
  box-shadow: 0 2px 6px rgba(0,0,0,.04);
}

/* remove any previous emoji/star bullets */
.opts button::before,
.opts button::after{
  background: none;
  content: "";
}

/* small square box */
.opts button::before{
  content: "";
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border: 2px solid #d4d4d8;     /* light gray border */
  border-radius: 6px;             /* rounded square */
  background: #fff;
}

/* brand-colored round dot when selected */
.opts button.selected::after{
  content: "";
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--brand);
}
:root{
  /* keep these aligned to your create/start button */
  --brand: #6e56cf;
  --brand2: #d6467e;    /* end of gradient */
  --btn-radius: 14px;
}

/* Primary brand buttons everywhere */
button,
#resultsActions button,
.home-cta button,
#linkPanel button,
#linkPanel a,
#viewResultsBtn,
#copyLinkBtn,
#openLinkBtn {
  background: linear-gradient(90deg, var(--brand), var(--brand2)) !important;
  color: #fff !important;
  border: 0 !important;
  border-radius: var(--btn-radius) !important;
  padding: 12px 14px !important;
  font-weight: 800 !important;
  line-height: 1.1 !important;
  box-shadow: 0 10px 22px rgba(110,86,207,.25) !important;
  cursor: pointer !important;
  text-decoration: none !important; /* for the <a> buttons */
}

/* Disabled look */
button:disabled{
  opacity: .6 !important;
  cursor: not-allowed !important;
}

/* Keep the sticky submit behavior (can stay the same color/gradient) */
.sticky-submit{
  position: sticky;
  bottom: calc(70px + env(safe-area-inset-bottom, 0px));
}

/* IMPORTANT: keep answer option cards white (override the global button style) */
.opts button{
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 14px 12px 48px !important;
  margin: 8px 0 !important;
  background: #fff !important;
  color: #111 !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 12px !important;
  box-shadow: 0 2px 6px rgba(0,0,0,.04) !important;
}

/* (from previous step) the small square + brand dot indicator */
.opts button::before{
  content: "";
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border: 2px solid #d4d4d8;
  border-radius: 6px;
  background: #fff;
}
.opts button.selected::after{
  content: "";
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--brand);
}
/* --- OVERRIDE: kill old green ticks and use a centered round dot --- */

/* Base option card stays white */
.opts button{
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 14px 12px 48px !important;
  margin: 8px 0 !important;
  background: #fff !important;
  color: #111 !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 12px !important;
  box-shadow: 0 2px 6px rgba(0,0,0,.04) !important;
}

/* Small square (kept on both selected/unselected) */
.opts button::before{
  content: "";
  position: absolute;
  left: 16px;                /* anchor for the 18px square */
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border: 2px solid #d4d4d8;
  border-radius: 6px;
  background: #fff;
  z-index: 0;
}

/* Nuke ANY legacy ticks (backgrounds, masks, old pseudo content) */
.opts button.selected{
  background-image: none !important;
}
.opts button.selected::after{
  background-image: none !important;
  -webkit-mask: none !important;
  mask: none !important;
}

/* Round dot that fully covers inside the square */
:root{ --brand:#6e56cf; } /* ensure brand is defined */
.opts button.selected::after{
  content: "" !important;
  position: absolute;
  /* center the 14px dot inside the 18px square:
     16px (square left) + (18-14)/2 = 16 + 2 = 18 → tweak to 19 for visual crispness */
  left: 19px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;               /* larger so it hides any old ✓ completely */
  height: 14px;
  border-radius: 999px;
  background: var(--brand) !important;
  z-index: 1;                /* on top of the square */
}

/* If an old template injected icon elements, hide them too */
.opts button .icon,
.opts button .tick {
  display: none !important;
}
:root{ --brand:#6e56cf; } /* your create/start color */

/* Base option button */
.q .opts button{
  position:relative;
  display:block;
  width:100%;
  text-align:left;
  padding:12px 14px 12px 56px !important; /* space for square */
  margin:8px 0 !important;
  background:#fff !important;
  color:#111 !important;
  border:1px solid #e5e7eb !important;
  border-radius:12px !important;
  box-shadow:0 2px 6px rgba(0,0,0,.04) !important;
  /* 💣 kill any legacy tick images */
  background-image:none !important;
  background-size:0 0 !important;
  background-position:9999px 9999px !important;
}

/* Left square outline */
.q .opts button::before{
  content:"";
  position:absolute;
  left:16px;
  top:50%;
  transform:translateY(-50%);
  width:22px;
  height:22px;
  border:2px solid #d4d4d8;
  border-radius:6px;
  background:transparent;
  z-index:1;
}

/* Filled round dot that sits on top of the square when selected */
.q .opts button::after{
  content:"";
  position:absolute;
  left:16px;
  top:50%;
  transform:translateY(-50%);
  width:22px;
  height:22px;
  border-radius:50%;
  background:var(--brand);
  opacity:0;
  z-index:2;                /* sits above any old ticks */
  transition:opacity .12s ease;
}

/* Show the dot on selected */
.q .opts button.selected::after{ opacity:1 !important; }

/* Extra hard kill in case a theme injects ticks via pseudo-elements */
.q .opts button.selected,
.q .opts button.selected *{
  background-image:none !important;
  -webkit-mask-image:none !important;
  mask-image:none !important;
}
.q .opts button.selected::before,
.q .opts button.selected::after{
  background-image:none !important;
  -webkit-mask-image:none !important;
  mask-image:none !important;
}
/* Hard mask the old tick area, then show the brand dot on top */
.q .opts button{
  background-image:none !important;
  background-position:9999px 9999px !important;
}

.q .opts button::before{
  /* filled white square to cover any legacy tick */
  content:"";
  position:absolute;
  left:16px; top:50%;
  transform:translateY(-50%);
  width:22px; height:22px;
  border:2px solid #e5e7eb;
  border-radius:6px;
  background:#fff !important;   /* <-- mask */
  z-index:2;                     /* sits above any old background */
}

.q .opts button::after{
  /* brand round dot */
  content:"";
  position:absolute;
  left:16px; top:50%;
  transform:translateY(-50%);
  width:22px; height:22px;
  border-radius:50%;
  background:var(--brand, #6e56cf);
  opacity:0;
  z-index:3;                     /* above the white square */
  transition:opacity .12s ease;
}

.q .opts button.selected::after{ opacity:1 !important; }

/* Nuclear option: hide any inline icons inside options */
.q .opts button svg,
.q .opts button i,
.q .opts button .icon { display:none !important; }

#shareBtn { display: none !important; }

/* Results list rows: keep label left, tiny action on right */
#scoreList li { display:flex; align-items:center; justify-content:space-between; gap:8px; }
#scoreList li > span { flex:1; min-width:0; }

/* Make "See answers" a link-like button (no gradient) */
.see-answers{
  background: transparent !important;
  background-image: none !important;
  border: 0 !important;
  padding: 0 !important;
  box-shadow: none !important;
  text-decoration: underline;
  font-weight: 700;
  cursor: pointer;
  color: #6e56cf;       /* match your brand purple */
}
.see-answers:active { opacity: .7; }

/* App header */
#appHeader{
  display:flex;
  justify-content:center;
  align-items:center;
  padding:14px 0 6px;
}

/* Responsive logo size */
#appHeader img{
  width: clamp(160px, 34vw, 260px); /* min, fluid, max */
  height: auto;
  display:block;
}
/* Sticky app header */
#appHeader{
  position: sticky;
  top: env(safe-area-inset-top, 0);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px 0 6px;
  background: #fff;                /* solid so content doesn’t show through */
  border-bottom: 1px solid #eee;   /* subtle divider */
}

#appHeader img{
  width: clamp(160px, 34vw, 260px);
  height: auto;
  display: block;
}
#scoreList li{
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tagline{
  margin: 6px 0 16px;
  color: #666;
  font-size: .95rem;
  line-height: 1.4;
}
:root { --header-h: 56px; }          /* adjust if your header is taller */

#appHeader{
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-h);
  display: flex; align-items: center; gap: 8px;
  background: #fff; z-index: 1000;   /* stay above content */
  border-bottom: 1px solid #eee;
}

/* make room for the fixed header on all views */
#startCard, #playView, #resultsView{
  padding-top: calc(var(--header-h) + 8px);
}

/* ensure the first elements don’t tuck under the header when linked */
#playNameBar, #playView .q:first-child, #resultsView h2, #startCard h2 {
  scroll-margin-top: calc(var(--header-h) + 8px);
}
/* Inline AI segmented toggle */
.ai-row{ display:flex; gap:8px; align-items:center; margin-top:6px; }
.ai-seg{ display:flex; border:1px solid #e6e6e6; border-radius:10px; overflow:hidden; background:#fff; }
.seg-btn{
  padding:8px 12px; font-weight:700; border:0; background:#fff; color:#444; cursor:pointer;
}
.seg-btn + .seg-btn{ border-left:1px solid #e6e6e6; }
.seg-btn.active{
  background: linear-gradient(90deg, var(--brand,#6e56cf), var(--brand2,#d6467e));
  color:#fff; box-shadow:0 6px 18px rgba(214,70,126,.18);
}
.ai-input{ flex:1; min-width:160px; }

/* hide the real checkbox but keep it accessible if needed */
.visually-hidden{
  position:absolute !important; width:1px; height:1px; margin:-1px; padding:0; border:0; overflow:hidden; clip:rect(0 0 0 0);
}
/* Opposite button highlight (black) */
.seg-btn.inverse{ background:#111; color:#fff; }
/* Force styles for the AI segmented buttons (override global button !important) */
.ai-seg .seg-btn{
  background:#fff !important;
  color:#444 !important;
  box-shadow:none !important;
  border:0 !important;
}
.ai-seg .seg-btn + .seg-btn{ border-left:1px solid #e6e6e6 !important; }

.ai-seg .seg-btn.active{
  background: linear-gradient(90deg, var(--brand,#6e56cf), var(--brand2,#d6467e)) !important;
  color:#fff !important;
  box-shadow:0 6px 18px rgba(214,70,126,.18) !important;
}

/* Black out the opposite (non-selected) button */
.ai-seg .seg-btn.inverse{
  background:#111 !important;
  color:#fff !important;
}







