:root {
  --bg1: rgba(5,10,25,.70);
  --glass: rgba(255,255,255,.08);
  --stroke: rgba(180,220,255,.25);
  --neon: rgba(120,210,255,.85);
  --neon2: rgba(160,120,255,.75);
  --text: #eef6ff;
  --muted: rgba(238,246,255,.72);
  --good: #25c26e;
  --bad: #ff4d4d;
  --warn: #ffcc00;
  --shadow: 0 18px 60px rgba(0,0,0,.55);
}

* { box-sizing: border-box; }

body {
  margin: 0; font-family: ui-sans-serif, system-ui, sans-serif; color: var(--text); min-height: 100vh;
  display: flex; flex-direction: column; align-items: center;
  background: radial-gradient(1200px 700px at 50% 35%, rgba(120,210,255,.18), transparent 60%),
    radial-gradient(900px 500px at 70% 55%, rgba(160,120,255,.16), transparent 65%),
    linear-gradient(180deg, rgba(0,0,0,.85), rgba(0,0,0,.55)), url("/static/anytime_bar_trivia_bg.png");
  background-size: cover; background-position: center; background-attachment: fixed;
}

body::before {
  content:""; position:fixed; inset:0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.18'/%3E%3C/svg%3E");
  mix-blend-mode: overlay; pointer-events:none; opacity:.35;
}

.bgVideo {
  position: fixed; right: 0; bottom: 0; min-width: 100%; min-height: 100%;
  width: auto; height: auto; z-index: 10000; opacity: 1.0; display: none; object-fit: cover;
}

.wrap { width: 100%; max-width: 1100px; padding: 20px; flex: 1; display: flex; flex-direction: column; z-index: 10002; }
.app { width: 100%; display: flex; flex-direction: column; gap: 20px; }

/* MENU GRID */
.menuGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 20px; }
.bigBtn { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; font-size: 1.1rem; gap: 10px; height: 120px; }
.bigBtn span { font-size: 2rem; }
@media (max-width: 600px) { .menuGrid { grid-template-columns: 1fr; } .bigBtn { height: 80px; flex-direction: row; } }

/* HELP / GUIDE */
.modeGuide { margin-top: 20px; text-align: left; background: rgba(255,255,255,0.05); padding: 15px; border-radius: 12px; font-size: 0.9rem; }
.modeGuide summary { cursor: pointer; font-weight: bold; color: var(--neon); outline: none; }
.guideContent { margin-top: 10px; color: var(--muted); line-height: 1.5; }
.guideContent p { margin: 5px 0; }

/* NAVIGATION */
.topNav { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-radius: 16px; background: rgba(0,0,0,.22); border: 1px solid rgba(255,255,255,.16); backdrop-filter: blur(8px); box-shadow: 0 10px 28px rgba(0,0,0,.35); }
.navLeft, .navRight { display: flex; gap: 10px; align-items: center; }
.navChip { padding: 6px 12px; border-radius: 999px; font-size: 12px; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.06); }
.navBtn { appearance: none; border: none; border-radius: 999px; padding: 6px 12px; font-weight: 800; cursor: pointer; color: rgba(5,10,25,.95); background: linear-gradient(135deg, var(--neon), var(--neon2)); box-shadow: 0 0 0 1px rgba(255,255,255,.18) inset; transition: transform .1s, filter .1s; font-size: 12px; }
.navBtn:hover { filter: brightness(1.1); }

/* LAYOUT */
.grid2 { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 860px) { .grid2 { grid-template-columns: 2fr 1fr; } }
.card { background: linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,.06)); border: 1px solid var(--stroke); border-radius: 20px; padding: 20px; box-shadow: var(--shadow); backdrop-filter: blur(10px); position: relative; }

/* OVERLAY */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.85); backdrop-filter: blur(8px); z-index: 20000; display: flex; align-items: center; justify-content: center; }
.overlayCard { width: 100%; max-width: 500px; text-align: center; }

/* CINEMATIC END SCREEN */
.cinematicOverlay {
    display: flex; flex-direction: column; justify-content: flex-start;
    padding: 0; background: transparent !important; backdrop-filter: none;
}
.cinematicTop {
    width: 100%; padding: 20px;
    background: rgba(0,0,0,0.8);
    border-bottom: 2px solid var(--neon);
    display: flex; justify-content: space-between; align-items: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
}
.winnerList { display: flex; gap: 20px; font-size: 1.2rem; font-weight: bold; }
.winnerItem { display: flex; align-items: center; gap: 8px; }

/* INPUTS */
h2, h3 { margin: 0 0 12px 0; font-weight: 700; letter-spacing: 0.5px; }
label { display: block; font-size: 13px; color: var(--muted); margin-top: 10px; }
.muted { color: var(--muted); font-size: 13px; }
input, textarea, select { width: 100%; padding: 12px; margin-top: 6px; border-radius: 12px; border: 1px solid rgba(255,255,255,.18); background: rgba(7,12,26,.55); color: var(--text); outline: none; }
button { width: 100%; border: none; border-radius: 14px; padding: 12px; font-weight: 700; cursor: pointer; color: #050a19; background: linear-gradient(135deg, var(--neon), var(--neon2)); box-shadow: 0 0 0 1px rgba(255,255,255,.18) inset, 0 10px 25px rgba(0,0,0,.3); margin-top: 10px; font-size: 14px; }
button:hover { filter: brightness(1.1); }
button:disabled { opacity: 0.6; filter: grayscale(1); cursor: not-allowed; }
.btnRow { display: flex; gap: 10px; flex-wrap: wrap; }
.btnRow button { flex: 1; margin-top: 0; }

/* GAMEPLAY */
.qCounter { display: flex; justify-content: space-between; padding: 10px; border-radius: 12px; background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.1); margin-bottom: 15px; font-weight: bold; }
.qTypeLabel { background: rgba(139, 92, 246, 0.2); border: 1px solid var(--neon); color: var(--neon); padding: 5px 12px; border-radius: 20px; display: inline-block; font-size: 0.8rem; font-weight: bold; margin-bottom: 15px; text-transform: uppercase; letter-spacing: 1px; }
.questionPrompt { font-size: 1.2rem; line-height: 1.4; margin-bottom: 20px; }

/* CHOICES */
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media(max-width:600px){ .choices { grid-template-columns: 1fr; } }
.choiceBtn { background: rgba(7,12,26,.6); color: var(--text); text-align: left; border: 1px solid rgba(255,255,255,0.15); margin-top: 0; width: 100%; display: block; cursor: pointer; }
.choiceBtn:hover { transform: translateY(-1px); border-color: var(--neon); }
.choiceBtn.selected { background: linear-gradient(135deg, rgba(120,210,255,.2), rgba(160,120,255,.1)); border-color: var(--neon); box-shadow: 0 0 15px rgba(120,210,255,.2); }
.choiceBtn.correct { background: var(--good); color: #000; border-color: var(--good); }
.choiceBtn.wrong { background: var(--bad); border-color: var(--bad); opacity: 0.8; }
.choiceBtn.dim { opacity: 0.4; }

/* DYNAMIC INPUTS */
.bigInput { font-size: 1.5rem; padding: 15px; border-radius: 10px; border: 1px solid #555; background: #222; color: white; margin-bottom: 20px; }
.actionBtn { background: var(--good); font-size: 1.2rem; padding: 15px; }

/* RANKING */
.rankList { list-style: none; padding: 0; margin-bottom: 20px; }
.rankList li { background: #334155; margin: 5px 0; padding: 15px; border-radius: 8px; display: flex; justify-content: space-between; align-items: center; cursor: grab; border: 2px solid transparent; }
.rankList li.dragging { opacity: 0.5; border-color: var(--neon); }
.rankList li span { cursor: pointer; padding: 5px 10px; background: rgba(0,0,0,0.3); border-radius: 5px; margin-left: 5px; }

/* TIMERS & REVEAL */
.timerWrap { height: 8px; background: rgba(255,255,255,0.1); border-radius: 4px; margin-top: 20px; overflow: hidden; }
.timerBar { height: 100%; background: linear-gradient(90deg, var(--neon), var(--neon2)); width: 100%; transform-origin: left; }
.revealBox { margin-top: 15px; padding: 15px; border-radius: 12px; background: rgba(0,0,0,0.4); border: 1px solid rgba(255,255,255,0.1); animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from{opacity:0; transform:translateY(5px);} to{opacity:1; transform:translateY(0);} }

/* SCOREBOARD & STATUS */
.scoreboardItem { display: flex; justify-content: space-between; padding: 10px; border-bottom: 1px solid rgba(255,255,255,0.08); font-size: 14px; }
.light { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,0.2); margin-right: 8px; }
.light.answered { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.light.correct { background: var(--good); box-shadow: 0 0 8px var(--good); }
.light.wrong { background: var(--bad); }
.statusBubble { position: fixed; left: 20px; bottom: 20px; padding: 12px 20px; border-radius: 12px; background: rgba(0,0,0,0.8); border: 1px solid rgba(255,255,255,0.2); backdrop-filter: blur(10px); color: var(--neon); font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,0.5); z-index: 9999; animation: popUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
@keyframes popUp { from{transform: scale(0.8) translateY(20px); opacity:0;} to{transform: scale(1) translateY(0); opacity:1;} }
.pointsPop { color: #4ade80; font-weight: bold; animation: floatUp 1.5s ease-out forwards; margin-right: 5px; }
@keyframes floatUp { 0% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(-20px); } }

/* TRICK QUESTION */
.trickBadge { background: rgba(255,200,0,.12); border: 1px solid #ffcc00; color: #ffcc00; padding: 8px 14px; border-radius: 10px; font-size: .85rem; font-weight: 600; margin-bottom: 10px; animation: fadeIn .3s ease; }

/* CHALLENGE SYSTEM */
.inlineChallengeArea { margin-top: 15px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.1); }
.challengeToggleBtn { background: rgba(255,200,0,.1); border: 1px solid #ffcc00 !important; color: #ffcc00 !important; font-size: .88rem; width: 100%; background-image: none !important; box-shadow: none !important; }
.challengeToggleBtn:hover:not(:disabled) { background: rgba(255,200,0,.2) !important; filter: none; }
.challengeToggleBtn:disabled { opacity: .5; cursor: not-allowed; }
.challengeCount { background: #ffcc00; color: #000; border-radius: 999px; padding: 2px 8px; font-size: .72rem; font-weight: 800; margin-left: 8px; }
.challengeForm { margin-top: 10px; }
.challengeForm textarea { width: 100%; background: rgba(7,12,26,.7); color: var(--text); border: 1px solid rgba(255,255,255,.2); border-radius: 12px; padding: 10px; resize: vertical; min-height: 70px; font-family: inherit; margin-top: 0; }
.challengeSubmitBtn { background: #ffcc00 !important; color: #000 !important; font-weight: 700; margin-top: 8px; background-image: none !important; }
.challengeSubmitBtn:hover:not(:disabled) { filter: brightness(1.1); }

.challengeOverlayPanel { position: fixed; inset: 0; background: rgba(0,0,0,.82); backdrop-filter: blur(6px); z-index: 25000; display: none; align-items: center; justify-content: center; }
.challengeOverlayPanel.active { display: flex; }
.challengeCard { background: linear-gradient(180deg, rgba(20,25,50,.98), rgba(10,15,35,.98)); border: 1px solid var(--stroke); border-radius: 24px; padding: 32px 28px; max-width: 480px; width: 90%; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.7); animation: fadeIn .25s ease; }
.challengeVerdictIcon { font-size: 3rem; margin-bottom: 8px; }
.challengeVerdictTitle { font-size: 1.3rem; font-weight: 900; letter-spacing: 2px; margin: 0 0 14px; color: var(--neon); }
.challengeVerdictTitle.upheld { color: var(--good); }
.challengeVerdictTitle.denied { color: var(--bad); }
.challengeArg { border-left: 3px solid #ffcc00; margin: 12px 0; padding: 8px 14px; text-align: left; color: var(--muted); font-style: italic; border-radius: 0 8px 8px 0; background: rgba(255,200,0,.06); }
.challengeRuling { font-weight: 600; font-size: 1rem; margin: 10px 0 6px; }
.challengeReasoning { font-size: .88rem; line-height: 1.5; margin-bottom: 8px; }
.challengePoints { color: var(--good); font-weight: 700; font-size: 1.1rem; margin: 14px 0 4px; }
#challengeOverlayClose { background: rgba(255,255,255,.1) !important; background-image: none !important; color: var(--text) !important; border: 1px solid rgba(255,255,255,.2) !important; margin-top: 18px; box-shadow: none !important; display: none; }

/* BIM — Bumbum's Immigration Module */
body.bimMode {
  background: radial-gradient(1200px 700px at 50% 30%, rgba(0,40,180,.22), transparent 60%),
    radial-gradient(900px 500px at 70% 60%, rgba(180,0,0,.18), transparent 65%),
    linear-gradient(180deg, rgba(0,0,0,.80), rgba(0,0,0,.50)),
    url("/static/bim/bimpaper.png");
  background-size: cover; background-position: center; background-attachment: fixed;
}
.immigrationBadge { padding: 4px 0 10px; text-align: center; animation: fadeIn .4s ease; }
.immigrationBadge img { width: 100%; border-radius: 10px; display: block; }
.immigrationBadge .bimTagline { margin-top: 8px; font-size: .82rem; color: var(--muted); letter-spacing: .5px; }
.bimHostBanner { width: 100%; border-radius: 10px; margin-bottom: 14px; display: block; }
.immigrationNote { background: rgba(0,40,120,.2); border-left: 3px solid #4488ff; padding: 10px 14px; border-radius: 0 10px 10px 0; font-size: .82rem; color: var(--muted); margin-top: 10px; line-height: 1.5; }