/* =====================================================================
   3D GLASS THEME: frosted translucent surfaces, specular highlights,
   layered depth shadows, glossy gel buttons. Loaded after styles.css.
   ===================================================================== */
:root {
  --glass: linear-gradient(145deg, rgba(255,255,255,.20), rgba(255,255,255,.05));
  --glass-line: rgba(255,255,255,.30);
  --glass-blur: blur(18px) saturate(170%);
  --glass-depth:
    inset 0 1px 0 rgba(255,255,255,.55),
    inset 0 -3px 8px rgba(4,10,30,.28),
    inset 1px 0 0 rgba(255,255,255,.12),
    0 12px 28px rgba(2,6,20,.45);
}

/* Background: deep scene with colour orbs so the glass has something to refract */
.app {
  isolation: isolate;
  background:
    radial-gradient(60% 40% at 15% 12%, rgba(47,123,255,.75), transparent 70%),
    radial-gradient(55% 35% at 92% 38%, rgba(160,80,255,.45), transparent 70%),
    radial-gradient(70% 40% at 20% 88%, rgba(48,213,255,.45), transparent 70%),
    radial-gradient(50% 30% at 85% 96%, rgba(255,90,170,.28), transparent 70%),
    linear-gradient(180deg, #0E2160, #070F2B);
}
.app::before { z-index: 0; opacity: .05; }
.app::after {
  content: ""; position: absolute; z-index: 0; pointer-events: none;
  width: 70cqw; aspect-ratio: 1; left: -15cqw; top: 30cqh; border-radius: 50%;
  background: radial-gradient(circle, rgba(48,213,255,.35), transparent 65%);
  filter: blur(20px); animation: orb 14s ease-in-out infinite alternate;
}
@keyframes orb { to { transform: translate(70cqw, -20cqh) scale(1.2); } }
.screen { z-index: 1; }
@media (min-width: 560px) and (min-height: 640px) {
  .app { box-shadow: 0 0 0 1px rgba(255,255,255,.25), 0 0 0 10px rgba(20,34,72,.85), 0 0 0 11px rgba(255,255,255,.18), 0 40px 90px rgba(0,0,0,.65), 0 0 120px rgba(47,123,255,.25); }
}

/* Generic glass surfaces */
.chip, .icon-btn, .btn-ghost, .scoreboard, .pu, .ans, .stat, .nick-input, .nick-dice, .toast, .turn-banner {
  background: var(--glass);
  border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-depth);
}
.chip { box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 6px 16px rgba(2,6,20,.35); }
.icon-btn { border-radius: 14px; transition: transform .15s; }
.nick-ava, .q-cat-ico, .ans .key, .cat-tile .ico {
  box-shadow: inset 0 2px 2px rgba(255,255,255,.55), inset 0 -3px 4px rgba(0,0,0,.25), 0 4px 10px rgba(0,0,0,.3);
}

/* Glossy gel buttons */
.btn { position: relative; overflow: hidden; isolation: isolate; }
.btn::after {
  content: ""; position: absolute; left: 6%; right: 6%; top: 3px; height: 46%;
  border-radius: 12px 12px 40% 40% / 12px 12px 100% 100%;
  background: linear-gradient(180deg, rgba(255,255,255,.55), rgba(255,255,255,0));
  pointer-events: none; z-index: -1; opacity: .75;
}
.btn-primary {
  background: linear-gradient(180deg, rgba(110,170,255,.95), rgba(10,93,255,.92) 55%, rgba(6,62,190,.95));
  border: 1px solid rgba(170,210,255,.7);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.7), inset 0 -4px 10px rgba(0,20,90,.45),
    0 6px 0 rgba(6,45,150,.9), 0 14px 30px rgba(10,93,255,.55), 0 0 26px rgba(48,213,255,.25);
}
.btn-primary:active {
  transform: translateY(4px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6), inset 0 -2px 8px rgba(0,20,90,.45), 0 2px 0 rgba(6,45,150,.9), 0 6px 16px rgba(10,93,255,.45);
}
.btn-ghost::after { opacity: .35; }
.btn-ghost:active { transform: translateY(3px); }
@media (hover: hover) {
  .btn:hover, .cat-tile:hover, .pu:hover, .ans:hover, .icon-btn:hover, .pick:hover { filter: brightness(1.12); }
}

/* Home */
.brand-title { text-shadow: 0 1px 0 rgba(255,255,255,.4), 0 3px 0 #2A63E0, 0 6px 0 #0839A8, 0 14px 30px rgba(10,93,255,.7); }
.brand-title span { color: #7CE6FF; text-shadow: 0 1px 0 rgba(255,255,255,.5), 0 3px 0 #1795C2, 0 6px 0 #0B5E86, 0 14px 30px rgba(48,213,255,.6); }
.hero-glow { background: radial-gradient(circle, rgba(124,230,255,.55), rgba(47,123,255,.2) 50%, transparent 70%); filter: blur(14px); }
.hero-wrap::after {
  content: ""; position: absolute; bottom: 4%; width: 52%; height: 9%; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255,255,255,.35), rgba(124,230,255,.12) 60%, transparent);
  box-shadow: 0 0 30px rgba(48,213,255,.35);
}
.hero-img { z-index: 1; filter: drop-shadow(0 22px 22px rgba(0,0,0,.5)) drop-shadow(0 0 18px rgba(124,230,255,.25)); }
.cat-tile {
  position: relative; overflow: hidden;
  background: linear-gradient(150deg, color-mix(in srgb, var(--c) 42%, rgba(255,255,255,.14)), color-mix(in srgb, var(--c) 12%, transparent));
  border: 1px solid color-mix(in srgb, var(--c) 55%, rgba(255,255,255,.4));
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), inset 0 -3px 8px rgba(0,0,0,.2), 0 8px 18px color-mix(in srgb, var(--d) 45%, transparent);
  transition: transform .2s, filter .2s;
}
.cat-tile::before { content: ""; position: absolute; inset: 0 0 55% 0; background: linear-gradient(180deg, rgba(255,255,255,.22), transparent); pointer-events: none; }
.cat-tile .ico { position: relative; background: radial-gradient(circle at 35% 28%, color-mix(in srgb, var(--c) 40%, #fff), var(--c) 55%, var(--d)); }

/* Board */
.scoreboard { border-radius: 22px; }
.player-row.turn { background: linear-gradient(145deg, rgba(48,213,255,.28), rgba(48,213,255,.06)); box-shadow: inset 0 0 0 1.5px rgba(124,230,255,.75), 0 0 18px rgba(48,213,255,.35); }
.badge-dot { background: rgba(255,255,255,.06); border: 1px dashed rgba(255,255,255,.3); box-shadow: inset 0 1px 2px rgba(0,0,0,.3); }
.badge-dot.on { background: radial-gradient(circle at 35% 28%, color-mix(in srgb, var(--c) 40%, #fff), var(--c) 55%, var(--d)); box-shadow: inset 0 1px 1px rgba(255,255,255,.6), 0 2px 6px color-mix(in srgb, var(--c) 60%, transparent); }
.vs { text-shadow: 0 2px 0 #B07A00, 0 0 14px rgba(255,201,60,.6); }
.turn-banner { color: #9FEFFF; border-color: rgba(124,230,255,.5); }
.turn-banner.bot { background: linear-gradient(145deg, rgba(255,120,80,.35), rgba(255,120,80,.08)); border-color: rgba(255,170,140,.55); color: #FFC2AB; }
.wheel-box::before {
  content: ""; position: absolute; inset: -5%; border-radius: 50%;
  background: var(--glass); border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-depth);
}
#wheel { position: relative; filter: drop-shadow(0 18px 26px rgba(0,0,0,.55)) drop-shadow(0 0 22px rgba(47,123,255,.35)); }
.wheel-hub {
  background: radial-gradient(circle at 35% 28%, rgba(255,255,255,.95), rgba(210,228,255,.75) 45%, rgba(120,170,255,.6));
  border: 3px solid rgba(255,255,255,.8);
  box-shadow: inset 0 -6px 12px rgba(10,60,180,.35), inset 0 4px 6px rgba(255,255,255,.9), 0 0 0 4px rgba(10,93,255,.75), 0 10px 22px rgba(0,0,0,.45);
}
.wheel-hub { transition: box-shadow .3s; }
.wheel-hub.bot { box-shadow: inset 0 -6px 12px rgba(10,60,180,.35), inset 0 4px 6px rgba(255,255,255,.9), 0 0 0 4px rgba(255,120,80,.85), 0 10px 22px rgba(0,0,0,.45); }
.wheel-hub img {
  width: 66%; height: 66%; margin: 0; object-fit: contain;
  filter: drop-shadow(0 3px 2px rgba(4,20,80,.45)) drop-shadow(0 0 6px rgba(124,230,255,.35));
}
.wheel-pointer { border-top-color: #EAF6FF; filter: drop-shadow(0 4px 3px rgba(0,0,0,.45)) drop-shadow(0 0 8px rgba(124,230,255,.7)); }
.meter i { background: rgba(255,255,255,.1); box-shadow: inset 0 1px 3px rgba(0,0,0,.4), 0 1px 0 rgba(255,255,255,.12); }
.meter i.on { background: linear-gradient(180deg, #FFE48A, var(--gold) 50%, #E8930F); box-shadow: inset 0 1px 0 rgba(255,255,255,.8), 0 0 12px rgba(255,201,60,.7); }
.toast { background: linear-gradient(145deg, rgba(30,55,120,.8), rgba(10,20,50,.75)); border-radius: 20px; }

/* Question */
.q-header {
  position: relative; z-index: 1;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c, #F5A524) 88%, transparent), color-mix(in srgb, var(--d, #B9730A) 72%, transparent));
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid rgba(255,255,255,.4);
  box-shadow: inset 0 -2px 0 rgba(255,255,255,.18), inset 0 -10px 18px rgba(0,0,0,.15), 0 14px 30px color-mix(in srgb, var(--d, #B9730A) 45%, transparent);
}
.q-header::before { content: ""; position: absolute; inset: 0 0 50% 0; background: linear-gradient(180deg, rgba(255,255,255,.22), transparent); pointer-events: none; }
.q-header > * { position: relative; }
.q-quit { background: rgba(255,255,255,.18); }
.q-cat-ico { background: linear-gradient(145deg, rgba(255,255,255,.45), rgba(255,255,255,.12)); border: 1px solid rgba(255,255,255,.5); }
.timer { background: rgba(0,0,0,.22); box-shadow: inset 0 2px 4px rgba(0,0,0,.35), 0 1px 0 rgba(255,255,255,.3); }
.timer-bar { background: linear-gradient(180deg, #fff, rgba(225,240,255,.85)); box-shadow: inset 0 -2px 3px rgba(0,0,0,.12); }
.q-card {
  background: linear-gradient(150deg, rgba(255,255,255,.26), rgba(255,255,255,.07));
  color: var(--white); border: 1px solid rgba(255,255,255,.4);
  -webkit-backdrop-filter: blur(22px) saturate(180%); backdrop-filter: blur(22px) saturate(180%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.65), inset 0 -4px 12px rgba(0,0,0,.2), 0 18px 36px rgba(2,6,20,.5);
}
.q-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 45%; border-radius: 20px 20px 0 0; background: linear-gradient(180deg, rgba(255,255,255,.16), transparent); pointer-events: none; }
.q-text { position: relative; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.ans { border-width: 1px; }
.ans .key { background: linear-gradient(145deg, rgba(255,255,255,.4), rgba(255,255,255,.1)); border: 1px solid rgba(255,255,255,.4); }
.ans:active { transform: translateY(3px); }
.ans.correct { background: linear-gradient(145deg, rgba(74,222,128,.88), rgba(22,163,74,.8)); border-color: #B7F7CD; box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 0 24px rgba(34,197,94,.6), 0 10px 22px rgba(0,0,0,.35); }
.ans.wrong { background: linear-gradient(145deg, rgba(255,110,125,.88), rgba(220,38,60,.8)); border-color: #FFC9CF; box-shadow: inset 0 1px 0 rgba(255,255,255,.6), 0 0 24px rgba(255,77,94,.55), 0 10px 22px rgba(0,0,0,.35); }
.pu { border-radius: 16px; transition: transform .15s; }
.pu:active { transform: translateY(2px) scale(.97); }
.feedback { background: rgba(5,12,40,.45); -webkit-backdrop-filter: blur(14px) saturate(150%); backdrop-filter: blur(14px) saturate(150%); }
.fb-title { text-shadow: 0 3px 0 rgba(0,0,0,.25), 0 0 26px currentColor; line-height: 1; }

/* Result panel with explanation + Continue */
.feedback { justify-content: flex-start; align-items: stretch; overflow-y: auto; overscroll-behavior: contain; background: rgba(5,12,40,.55); }
.fb-inner {
  margin: auto 0; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top, 0px) + 20px) 18px max(18px, env(safe-area-inset-bottom));
  transform: translateY(14px); transition: transform .35s cubic-bezier(.3,1.4,.5,1);
}
.feedback.show .fb-inner { transform: none; }
.feedback img { width: 34%; max-height: 20cqh; }
.fb-sub { font-size: 16px; color: var(--gold); text-shadow: 0 0 12px rgba(255,201,60,.5); }
.fb-card {
  position: relative; width: 100%; text-align: left; margin-top: 4px;
  padding: 14px 16px; border-radius: 20px;
  background: linear-gradient(150deg, rgba(255,255,255,.22), rgba(255,255,255,.06));
  border: 1px solid rgba(255,255,255,.35);
  -webkit-backdrop-filter: blur(22px) saturate(170%); backdrop-filter: blur(22px) saturate(170%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6), inset 0 -4px 12px rgba(0,0,0,.2), 0 16px 34px rgba(2,6,20,.5);
}
.fb-card.ok { border-color: rgba(140,240,174,.55); }
.fb-card.bad { border-color: rgba(255,176,184,.5); }
.fb-answer {
  display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; padding: 10px 12px; border-radius: 14px;
  background: linear-gradient(145deg, rgba(74,222,128,.85), rgba(22,163,74,.75)); border: 1px solid #B7F7CD;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6), 0 0 18px rgba(34,197,94,.4);
}
.fb-answer span { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; opacity: .9; }
.fb-answer b { font-size: 16px; line-height: 1.3; }
.fb-explain-label { font-size: 12px; font-weight: 700; letter-spacing: .5px; color: #9FEFFF; margin-bottom: 4px; }
.fb-explain { margin: 0; font-size: 14.5px; line-height: 1.5; color: #EAF1FF; }
#fb-continue { margin-top: 8px; }
[hidden] { display: none !important; }

/* Perfect 6/6 victory */
.stat.wide { grid-column: 1 / -1; }
.stat.perfect { background: linear-gradient(145deg, rgba(255,201,60,.28), rgba(255,201,60,.06)); border-color: rgba(255,214,110,.55); }
.stat.perfect b { color: var(--gold); text-shadow: 0 0 14px rgba(255,201,60,.55); }
.modal-card.perfect {
  border-color: rgba(255,214,110,.7);
  background: linear-gradient(160deg, rgba(255,201,60,.30), rgba(60,90,200,.40) 35%, rgba(10,20,60,.6));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), inset 0 -6px 18px rgba(0,0,0,.25), 0 30px 70px rgba(0,0,0,.6), 0 0 50px rgba(255,201,60,.35);
  overflow-x: hidden;
}
.modal-card.perfect::before {
  content: ""; position: absolute; left: 50%; top: 90px; width: 360px; aspect-ratio: 1; translate: -50% -50%; pointer-events: none; z-index: 0;
  background: repeating-conic-gradient(from 0deg, rgba(255,214,110,.20) 0 10deg, transparent 10deg 30deg);
  mask-image: radial-gradient(circle, #000 20%, transparent 65%); -webkit-mask-image: radial-gradient(circle, #000 20%, transparent 65%);
  animation: pf-rays 18s linear infinite;
}
@keyframes pf-rays { to { rotate: 360deg; } }
.modal-card.perfect > * { position: relative; z-index: 1; }
.pf-crown { font-size: 34px; line-height: 1; margin-bottom: -6px; animation: pf-bob 1.6s ease-in-out infinite; filter: drop-shadow(0 0 10px rgba(255,201,60,.8)); }
@keyframes pf-bob { 50% { transform: translateY(-5px) rotate(-6deg); } }
.pf-hero { height: 120px !important; }
.pf-kicker { font-weight: 800; font-size: 11px; letter-spacing: 3px; color: var(--gold); }
.pf-title {
  font-size: 30px !important; color: #FFE48A;
  text-shadow: 0 1px 0 rgba(255,255,255,.6), 0 3px 0 #C98A12, 0 5px 0 #8A5A00, 0 12px 26px rgba(255,170,0,.55);
}
.pf-medals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 12px; }
.pf-medal {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px 7px; border-radius: 16px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 75%, #fff), var(--c) 45%, var(--d));
  border: 1px solid rgba(255,255,255,.5);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), inset 0 -4px 8px rgba(0,0,0,.25), 0 4px 0 var(--d), 0 0 16px color-mix(in srgb, var(--c) 55%, transparent);
  opacity: 0; transform: translateY(-40px) scale(.3) rotate(-20deg);
  animation: pf-in .6s cubic-bezier(.3,1.6,.5,1) forwards; animation-delay: calc(.35s + var(--i) * .18s);
}
.pf-medal span { font-size: 24px; filter: drop-shadow(0 2px 2px rgba(0,0,0,.3)); }
.pf-medal small { font-size: 10.5px; font-weight: 700; text-shadow: 0 1px 1px rgba(0,0,0,.3); }
@keyframes pf-in { to { opacity: 1; transform: none; } }
.pf-rewards {
  display: flex; flex-direction: column; gap: 4px; padding: 10px 14px; border-radius: 16px; text-align: left;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.2); box-shadow: inset 0 1px 0 rgba(255,255,255,.3);
}
.pf-rewards div { display: flex; justify-content: space-between; font-size: 14px; color: var(--mist); }
.pf-rewards b { color: var(--gold); }
.pf-rewards .pf-total { border-top: 1px dashed rgba(255,255,255,.25); padding-top: 6px; margin-top: 2px; font-size: 16px; color: #fff; font-weight: 700; }
.pf-count { font-size: 12.5px !important; margin: 8px 0 4px !important; }
@media (prefers-reduced-motion: reduce) {
  .modal-card.perfect::before, .pf-crown { animation: none; }
  .pf-medal { animation-duration: .01s; animation-delay: 0s; }
}

/* Modal */
.modal { background: rgba(3,8,30,.45); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.modal-card {
  position: relative;
  background: linear-gradient(150deg, rgba(90,140,255,.32), rgba(20,40,100,.42) 45%, rgba(10,20,60,.55));
  border: 1px solid rgba(255,255,255,.35);
  -webkit-backdrop-filter: blur(26px) saturate(180%); backdrop-filter: blur(26px) saturate(180%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6), inset 0 -6px 18px rgba(0,0,0,.25), 0 30px 70px rgba(0,0,0,.6), 0 0 40px rgba(47,123,255,.25);
}
.pick {
  position: relative; overflow: hidden;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 75%, #fff), var(--c) 45%, var(--d));
  border: 1px solid rgba(255,255,255,.45);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.65), inset 0 -4px 8px rgba(0,0,0,.25), 0 5px 0 var(--d), 0 10px 18px rgba(0,0,0,.35);
}
.pick::before { content: ""; position: absolute; inset: 0 0 55% 0; background: linear-gradient(180deg, rgba(255,255,255,.3), transparent); pointer-events: none; }
.pick > * { position: relative; }
.stat b { color: #7CE6FF; text-shadow: 0 0 14px rgba(48,213,255,.5); }
.nick-input:focus { border-color: rgba(124,230,255,.9); box-shadow: var(--glass-depth), 0 0 0 4px rgba(48,213,255,.22); }

@media (prefers-reduced-motion: reduce) { .app::after { animation: none; } }
