@import url("https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap");
:root {
  --navy: #001842; --dark: #0033A9; --blue: #3563D8; --mid: #54AFFF; --pale: #A3DCFF;
  --peri: #DFE9FF; --white: #FFFFFF; --gold: #F7D244; --red: #FF7A7A;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Open Sans", Arial, sans-serif; color: var(--white);
  background: radial-gradient(ellipse at 78% 12%, #12306e 0%, var(--navy) 45%, #000a1c 100%) fixed var(--navy);
  min-height: 100vh; overflow-x: hidden;
}
.moon { position: fixed; right: 6vw; top: 5vh; width: 120px; height: 120px; border-radius: 50%; z-index: 0;
  background: radial-gradient(circle at 38% 35%, #fff8d6 0%, var(--gold) 55%, #c9a21f 100%);
  box-shadow: 0 0 60px 18px rgba(247,210,68,.3), 0 0 160px 60px rgba(247,210,68,.1); }
.bat { position: fixed; font-size: 32px; z-index: 0; animation: flap 6s ease-in-out infinite; }
@keyframes flap { 0%,100% { transform: translate(0,0) rotate(-6deg); } 25% { transform: translate(-30px,-14px) rotate(4deg) scaleX(.85); }
  50% { transform: translate(-60px,6px) rotate(-4deg); } 75% { transform: translate(-30px,16px) rotate(6deg) scaleX(.85); } }
.ghost { position: fixed; left: 4vw; bottom: 8vh; font-size: 64px; z-index: 0; opacity: .85; animation: haunt 5s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(163,220,255,.7)); }
@keyframes haunt { 0%,100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-20px) rotate(4deg); } }
.fog { position: fixed; left: -10%; right: -10%; bottom: -40px; height: 200px; z-index: 0; pointer-events: none;
  background: radial-gradient(ellipse at 30% 60%, rgba(163,220,255,.16), transparent 60%), radial-gradient(ellipse at 75% 70%, rgba(84,175,255,.12), transparent 60%);
  filter: blur(20px); animation: drift 14s ease-in-out infinite alternate; }
@keyframes drift { to { transform: translateX(6%); } }
@media (prefers-reduced-motion: reduce) { .bat, .ghost, .fog { animation: none; } }

main { position: relative; z-index: 1; max-width: 760px; margin: 0 auto; padding: 14vh 16px 80px; }
.kicker { font-size: 14px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
h1, h2 { margin: 12px 0 24px; line-height: 1.2; }
h1 { font-size: clamp(32px, 6vw, 48px); }
h2 { font-size: clamp(24px, 4.5vw, 36px); }
p { color: var(--peri); line-height: 1.5; font-size: 18px; }

input[type=text] { width: 100%; font: 600 20px "Open Sans", Arial, sans-serif; color: var(--white);
  background: rgba(255,255,255,.07); border: 1.5px solid rgba(163,220,255,.35); border-radius: 14px; padding: 16px 18px; outline: none; }
input[type=text]:focus { border-color: var(--gold); }
button.go { margin-top: 18px; font: 700 18px "Open Sans", Arial, sans-serif; color: var(--navy); background: var(--gold);
  border: 0; border-radius: 14px; padding: 14px 28px; cursor: pointer; }
button.go:disabled { opacity: .5; cursor: default; }

.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .opts { grid-template-columns: 1fr; } }
.opt { text-align: left; font: 600 19px/1.35 "Open Sans", Arial, sans-serif; color: var(--white); cursor: pointer;
  background: rgba(255,255,255,.07); border: 1.5px solid rgba(163,220,255,.35); border-radius: 16px; padding: 16px 18px;
  display: flex; gap: 14px; align-items: center; transition: background .2s, border-color .2s, opacity .4s; }
.opt:hover:not(:disabled) { background: rgba(255,255,255,.13); border-color: var(--pale); }
.opt b { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--blue); font-size: 18px; }
.opt:disabled { cursor: default; }
.opt.wrong { opacity: .35; }
.opt.picked-wrong { opacity: 1; border-color: var(--red); background: rgba(255,122,122,.12); }
.opt.right { border-color: var(--gold); background: rgba(247,210,68,.14); box-shadow: 0 0 30px rgba(247,210,68,.3); }
.opt.right b { background: var(--gold); color: var(--navy); }
.verdict { min-height: 28px; margin-top: 20px; font-size: 20px; font-weight: 700; }
.hidden { display: none !important; }

/* Results */
.q { margin: 0 0 36px; }
.q h3 { font-size: 20px; margin: 6px 0 14px; }
.bar { display: grid; grid-template-columns: 170px 1fr 34px; gap: 10px; align-items: center; margin: 6px 0; font-size: 15px; }
.bar .track { height: 22px; background: rgba(255,255,255,.07); border-radius: 6px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--mid); border-radius: 6px; }
.bar.ok .fill { background: var(--gold); }
.bar.ok span:first-child { color: var(--gold); font-weight: 700; }
table { width: 100%; border-collapse: collapse; font-size: 16px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid rgba(163,220,255,.18); }
th { color: var(--pale); font-weight: 600; }
@media (max-width: 560px) { .bar { grid-template-columns: 110px 1fr 28px; } }

/* ---- Live game ---- */
.pixel { font-family: "Press Start 2P", "Courier New", monospace; letter-spacing: .02em; }
svg[role=img] { display: block; image-rendering: pixelated; }
.opt.c0 b { background: #d6334a; } .opt.c1 b { background: var(--blue); }
.opt.c2 b { background: #c99a00; } .opt.c3 b { background: #2e9e4f; }
.opt.c0 { border-color: rgba(214,51,74,.55); } .opt.c1 { border-color: rgba(84,175,255,.55); }
.opt.c2 { border-color: rgba(247,210,68,.55); } .opt.c3 { border-color: rgba(70,200,110,.55); }
.opt.mine { outline: 3px solid var(--white); outline-offset: 2px; }
.timer { height: 10px; border-radius: 6px; background: rgba(255,255,255,.1); overflow: hidden; margin: 6px 0 22px; }
.timer div { height: 100%; background: var(--gold); transition: width .25s linear; }
.timer.low div { background: var(--red); }
.center { text-align: center; }
.me { display: flex; flex-direction: column; align-items: center; gap: 14px; margin: 10px 0 24px; }
.me .pixel { font-size: 15px; color: var(--gold); line-height: 1.6; }
.roster { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 84px; position: relative; transition: opacity .3s, transform .3s; }
.tile span { font-size: 13px; font-weight: 600; max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile.waiting { opacity: .35; }
.tile.offline { opacity: .2; }
.tile.done { animation: pop .35s ease-out; }
.tile .tick { position: absolute; top: -6px; right: 4px; background: var(--gold); color: var(--navy); border-radius: 50%;
  width: 24px; height: 24px; display: grid; place-items: center; font-weight: 800; font-size: 14px; }
@keyframes pop { 50% { transform: scale(1.18); } }
.big { font-size: clamp(40px, 9vw, 72px); font-weight: 800; margin: 10px 0; }
.status { font-size: 18px; color: var(--peri); margin-top: 18px; }
.err { color: var(--red); min-height: 24px; margin-top: 10px; }
.rankrow { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border-bottom: 1px solid rgba(163,220,255,.18); font-size: 18px; }
.rankrow .n { width: 34px; color: var(--pale); font-weight: 700; }
.rankrow .nm { flex: 1; font-weight: 600; }
.rankrow .pts { color: var(--gold); font-weight: 800; }
.rankrow.mine { background: rgba(247,210,68,.1); border-radius: 10px; }

/* Host screen (made for a projector or a shared screen) */
.host main { max-width: 1200px; padding-top: 5vh; }
.host .hostbar { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.host button.ghostbtn { margin-top: 18px; font: 600 16px "Open Sans", Arial, sans-serif; color: var(--peri); background: transparent;
  border: 1.5px solid rgba(163,220,255,.35); border-radius: 14px; padding: 13px 22px; cursor: pointer; }
.host .joinurl { font-size: clamp(22px, 3.4vw, 40px); font-weight: 800; color: var(--gold); word-break: break-all; }
.host .roster { justify-content: flex-start; gap: 18px; margin-top: 26px; }
.host .tile { width: 110px; }
.host .tile span { font-size: 15px; max-width: 110px; }
.host .lobby .tile { cursor: pointer; }
.host .lobby .tile:hover::after { content: "kick"; position: absolute; top: 0; right: 10px; font-size: 11px; background: var(--red); color: #fff; padding: 2px 6px; border-radius: 6px; }
.host .qhead { display: flex; align-items: flex-start; gap: 30px; }
.host .qhead h2 { flex: 1; font-size: clamp(28px, 3.6vw, 46px); }
.host .clock { font-family: "Press Start 2P", monospace; font-size: 54px; color: var(--gold); min-width: 130px; text-align: right; padding-top: 10px; }
.host .clock.low { color: var(--red); }
.host .opts { gap: 16px; }
.host .opt { font-size: 24px; cursor: default; flex-wrap: wrap; }
.host .who { display: flex; gap: 4px; flex-wrap: wrap; width: 100%; margin-left: 52px; }
.host .who:empty { display: none; }
.host .count { margin-left: auto; font-weight: 800; color: var(--pale); }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 22px; margin: 30px 0 34px; }
.podium .step { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.podium .block { width: 160px; border-radius: 14px 14px 0 0; display: grid; place-items: center; font-family: "Press Start 2P", monospace;
  font-size: 30px; color: var(--navy); }
.podium .p1.in .block { height: 170px; background: var(--gold); }
.podium .p2.in .block { height: 120px; background: var(--pale); }
.podium .p3.in .block { height: 90px; background: #e0975a; }
.podium .nm { font-weight: 800; font-size: 20px; } .podium .pts { color: var(--gold); font-weight: 700; }
/* Keep the moon out from behind the text and timer. */
.moon { top: auto; bottom: 5vh; right: 4vw; width: 100px; height: 100px; opacity: .85; }
@media (max-width: 560px) { .moon { width: 70px; height: 70px; bottom: 3vh; } .bat { display: none; } }

/* Podium reveal */
.podium { min-height: 330px; }
.podium .step { opacity: 0; transform: translateY(60px) scale(.8); transition: opacity .5s, transform .7s cubic-bezier(.2,1.5,.4,1); }
.podium .step.in { opacity: 1; transform: none; }
.podium .block { height: 0; overflow: hidden; transition: height 1s cubic-bezier(.2,1.2,.4,1); }
.podium .p1.in svg { animation: champ 1s ease-in-out infinite alternate; }
@keyframes champ { from { filter: drop-shadow(0 0 6px rgba(247,210,68,.5)); transform: translateY(0); }
  to { filter: drop-shadow(0 0 28px rgba(247,210,68,1)); transform: translateY(-8px); } }
.drum { text-align: center; color: var(--gold); font-size: clamp(18px, 2.6vw, 32px); line-height: 1.5; min-height: 1.6em; margin-top: 20px; }
.drum.beat { animation: beat .5s ease-in-out infinite; }
@keyframes beat { 50% { transform: scale(1.08); color: var(--white); } }
#board .rankrow { opacity: 0; }
#board.in .rankrow { animation: rowin .5s ease-out forwards; }
@keyframes rowin { from { opacity: 0; transform: translateX(-30px); } to { opacity: 1; transform: none; } }
.confetti { position: fixed; top: -14px; width: 10px; height: 10px; z-index: 50; pointer-events: none; animation: fall 3s linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }
@media (prefers-reduced-motion: reduce) { .confetti { display: none; } .drum.beat, .podium .p1.in svg { animation: none; } }
/* A real-looking full moon: pale gray-white, dark "seas", small craters, soft cold glow. */
.moon { width: 130px; height: 130px; opacity: 1;
  background:
    radial-gradient(ellipse 18% 14% at 33% 31%, rgba(110,108,100,.6), transparent 75%),
    radial-gradient(ellipse 14% 20% at 44% 40%, rgba(110,108,100,.45), transparent 75%),
    radial-gradient(ellipse 22% 15% at 60% 36%, rgba(115,113,104,.5), transparent 72%),
    radial-gradient(ellipse 26% 18% at 42% 62%, rgba(125,123,113,.45), transparent 72%),
    radial-gradient(ellipse 12% 10% at 68% 64%, rgba(115,113,104,.4), transparent 75%),
    radial-gradient(circle at 36% 34%, #fbfaf4 0%, #e6e3d6 45%, #c9c5b5 80%, #a9a597 100%);
  box-shadow: 0 0 40px 10px rgba(225,230,255,.28), 0 0 120px 40px rgba(180,200,255,.12),
    inset -14px -10px 26px rgba(40,40,60,.35); }
.moon::after { background:
    radial-gradient(circle at 24% 52%, rgba(80,78,70,.5) 0 4%, rgba(255,255,255,.25) 5%, transparent 6%),
    radial-gradient(circle at 63% 22%, rgba(90,88,80,.3) 0 3%, rgba(255,255,255,.2) 4%, transparent 5%),
    radial-gradient(circle at 52% 80%, rgba(90,88,80,.3) 0 3.5%, rgba(255,255,255,.2) 4.5%, transparent 5.5%),
    radial-gradient(circle at 80% 45%, rgba(90,88,80,.25) 0 2.5%, transparent 3.5%),
    radial-gradient(circle at 46% 46%, rgba(90,88,80,.22) 0 2%, transparent 3%); }
@media (max-width: 560px) { .moon { width: 80px; height: 80px; } }
/* Crescent moon: a circle "bite" is masked out of the disc. The glow sits on the
   wrapper, so it follows the crescent shape instead of the full circle. */
.moonglow { position: fixed; right: 4vw; bottom: 5vh; z-index: 0; pointer-events: none;
  filter: drop-shadow(0 0 14px rgba(225,230,255,.55)) drop-shadow(0 0 40px rgba(180,200,255,.3)); }
.moon { position: static; box-shadow: none; transform: rotate(-12deg);
  -webkit-mask-image: radial-gradient(ellipse 62% 62% at 24% 34%, transparent 98%, #000 100%);
  mask-image: radial-gradient(ellipse 62% 62% at 24% 34%, transparent 98%, #000 100%); }
@media (max-width: 560px) { .moonglow { bottom: 3vh; } }
