:root {
  --bg-0: #0b0420;
  --ink: #f4f1ff;
  --muted: #a99fce;
  --accent: #ff4d79;      /* hot pink   */
  --accent-2: #ffd166;    /* gold       */
  --accent-3: #7c5cff;    /* violet     */
  --cyan: #46e0d8;        /* teal       */
  --good: #2ee6a8;
  --glass: rgba(255, 255, 255, 0.055);
  --glass-brd: rgba(255, 255, 255, 0.13);
  --radius: 20px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --grad-cta: linear-gradient(135deg, #ff4d79 0%, #ff7d54 50%, #ffba5e 100%);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  font-family: "Sora", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg-0);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ===== Animated background ===== */
.bg { position: fixed; inset: 0; z-index: -2; overflow: hidden; background:
  radial-gradient(1200px 700px at 80% -10%, #2a1163 0%, transparent 60%),
  radial-gradient(900px 600px at -10% 110%, #15314f 0%, transparent 55%),
  linear-gradient(160deg, #0b0420, #150a32 55%, #0a0a26); }
.blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.5; mix-blend-mode: screen; animation: drift 18s ease-in-out infinite; }
.b1 { width: 360px; height: 360px; background: #ff4d79; top: -80px; left: -60px; }
.b2 { width: 420px; height: 420px; background: #7c5cff; bottom: -120px; right: -80px; animation-delay: -6s; }
.b3 { width: 300px; height: 300px; background: #46e0d8; top: 40%; left: 55%; animation-delay: -11s; }
@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(40px, -30px) scale(1.12); }
  66% { transform: translate(-30px, 25px) scale(0.92); }
}
.grain { position: absolute; inset: 0; opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }

/* ===== Layout ===== */
#app { max-width: 540px; margin: 0 auto; padding: 26px 18px 60px; min-height: 100vh; }
.screen { display: none; animation: slideUp 0.35s cubic-bezier(.2,.8,.2,1); }
.screen.active { display: block; }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.hidden { display: none !important; }
.center { text-align: center; }

/* ===== Hero / logo ===== */
.hero { text-align: center; margin: 14px 0 26px; }
.logo {
  font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 3.1rem;
  line-height: 0.95; letter-spacing: 1px;
  background: linear-gradient(180deg, #fff, #ffd9e3 55%, var(--accent));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 6px 24px rgba(255, 77, 121, 0.45));
  animation: pop 0.6s cubic-bezier(.2,1.3,.4,1) both;
}
.logo span {
  display: block;
  background: linear-gradient(90deg, var(--accent-3), var(--cyan));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 6px 24px rgba(124, 92, 255, 0.4));
}
.logo.small { font-size: 2rem; margin: 6px 0 20px; text-align: center; }
@keyframes pop { from { opacity: 0; transform: scale(0.85); } to { opacity: 1; transform: scale(1); } }
.tagline { color: var(--muted); margin-top: 12px; font-size: 1rem; }
.footer-note { text-align: center; color: var(--muted); font-size: 0.8rem; margin-top: 20px; opacity: 0.7; }

/* ===== Headings / text ===== */
h2 { font-size: 1.4rem; font-weight: 700; margin: 14px 0; }
.section-head { font-size: 1rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); margin: 22px 0 10px; }
.muted { color: var(--muted); font-weight: 400; font-size: 0.9rem; }
.hint { color: var(--muted); font-size: 0.9rem; text-align: center; margin: 10px 0; }

/* ===== Card / inputs ===== */
.card {
  background: var(--glass); border: 1px solid var(--glass-brd);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.field { display: block; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-bottom: 16px; }
input, select {
  width: 100%; margin-top: 8px; padding: 14px 15px; font-size: 1rem; font-family: inherit;
  border-radius: 14px; border: 1.5px solid var(--glass-brd); color: var(--ink);
  background: rgba(0, 0, 0, 0.28); transition: border-color .18s, box-shadow .18s;
  -webkit-appearance: none; appearance: none;
}
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='%23a99fce'%3E%3Cpath d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 15px center; padding-right: 38px; }
input::placeholder { color: #6f6792; }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(255, 77, 121, 0.18); }
.code-input { text-transform: uppercase; letter-spacing: 8px; font-weight: 700; text-align: center; font-size: 1.3rem; }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.settings-grid .field:nth-child(5), .settings-grid .field:nth-child(6) { grid-column: 1 / -1; }

/* ===== Tabs ===== */
.tabs { display: flex; gap: 6px; margin: 6px 0 20px; padding: 5px; background: rgba(0,0,0,0.25); border-radius: 14px; }
.tab {
  flex: 1; padding: 11px; border: none; border-radius: 10px; cursor: pointer;
  background: transparent; color: var(--muted); font-size: 0.95rem; font-weight: 600;
  font-family: inherit; transition: all .2s;
}
.tab.active { background: var(--grad-cta); color: #fff; box-shadow: 0 6px 18px rgba(255, 77, 121, 0.35); }
.tab-panel { display: none; animation: slideUp .25s; }
.tab-panel.active { display: block; }

/* ===== Buttons ===== */
.btn {
  width: 100%; padding: 16px; font-size: 1.05rem; font-weight: 700; font-family: inherit;
  border: none; border-radius: 15px; cursor: pointer; margin-top: 6px; color: #fff;
  transition: transform .12s ease, box-shadow .2s, opacity .2s; letter-spacing: 0.3px;
}
.btn:active { transform: translateY(1px) scale(0.985); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: var(--grad-cta); box-shadow: 0 10px 28px rgba(255, 77, 121, 0.4); }
.btn.primary:hover:not(:disabled) { box-shadow: 0 14px 34px rgba(255, 77, 121, 0.55); transform: translateY(-1px); }
.btn.ghost { background: transparent; border: 1.5px solid var(--glass-brd); color: var(--muted); margin-top: 14px; }
.sticky-cta { position: sticky; bottom: 14px; margin-top: 18px; }

/* ===== Lobby ===== */
.room-pill {
  text-align: center; margin: 12px 0 6px; position: relative;
  background: var(--glass); border: 1px solid var(--glass-brd);
  border-radius: 18px; padding: 16px; box-shadow: var(--shadow);
}
.room-label { display: block; font-size: 0.7rem; letter-spacing: 3px; color: var(--muted); margin-bottom: 4px; }
.room-pill strong {
  font-family: "Space Grotesk", sans-serif; font-size: 2.4rem; letter-spacing: 10px; padding-left: 10px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.copy-btn { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,0.08); border: 1px solid var(--glass-brd); color: var(--ink); width: 40px; height: 40px; border-radius: 12px; font-size: 1.1rem; cursor: pointer; }
.copy-btn:active { transform: translateY(-50%) scale(0.92); }

.player-list { list-style: none; display: flex; flex-direction: column; gap: 9px; margin: 10px 0; }
.player-list li {
  display: flex; align-items: center; gap: 12px;
  background: var(--glass); border: 1px solid var(--glass-brd);
  border-radius: 14px; padding: 11px 14px; animation: slideUp .3s;
}
.player-list li.disconnected { opacity: 0.4; }
.avatar { width: 38px; height: 38px; min-width: 38px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; color: #120a25; font-size: 1rem; }
.p-name { font-weight: 600; flex: 1; }
.player-list .score { font-weight: 800; font-family: "Space Grotesk", sans-serif; color: var(--accent-2); font-size: 1.1rem; }
.badge { font-size: 0.62rem; font-weight: 800; background: var(--grad-cta); color: #fff; border-radius: 6px; padding: 3px 7px; margin-left: 7px; letter-spacing: 0.5px; vertical-align: middle; }
.badge.bot { background: linear-gradient(135deg, var(--accent-3), var(--cyan)); }
.you-tag { font-size: 0.65rem; color: var(--good); margin-left: 7px; font-weight: 700; }
.delta { color: var(--good); font-weight: 800; font-size: 0.95rem; animation: pop .4s; }

/* ===== Round play ===== */
.topbar { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.round-tag { font-weight: 700; color: var(--muted); font-size: 0.95rem; letter-spacing: 0.5px; }
.timer {
  font-family: "Space Grotesk", sans-serif; font-size: 1.4rem; font-weight: 700; min-width: 62px; text-align: center;
  background: var(--glass); border: 1px solid var(--glass-brd); border-radius: 14px; padding: 6px 12px;
}
.timer.warn { color: #fff; background: var(--accent); border-color: var(--accent); animation: tick 1s infinite; box-shadow: 0 0 22px rgba(255,77,121,0.6); }
@keyframes tick { 50% { transform: scale(1.08); opacity: 0.85; } }
.category-tag { color: var(--cyan); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 2px; margin-top: 16px; font-weight: 700; }

.q-card { background: var(--glass); border: 1px solid var(--glass-brd); border-radius: var(--radius); padding: 20px; margin: 12px 0 20px; box-shadow: var(--shadow); }
.q-label { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 2px; color: var(--muted); margin-bottom: 10px; }
.question { font-size: 1.45rem; line-height: 1.35; font-weight: 700; }

.done-state { text-align: center; padding: 40px 0; }
.done-state .check {
  width: 76px; height: 76px; margin: 0 auto 16px; border-radius: 50%;
  background: linear-gradient(135deg, var(--good), var(--cyan)); color: #06281f;
  font-size: 2.4rem; display: grid; place-items: center; font-weight: 900;
  box-shadow: 0 0 40px rgba(46, 230, 168, 0.55); animation: pop .5s cubic-bezier(.2,1.5,.4,1);
}
.done-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 6px; }

/* ===== Vote options ===== */
.options { display: flex; flex-direction: column; gap: 11px; margin: 16px 0; }
.option {
  text-align: left; padding: 17px 18px; font-size: 1.05rem; font-weight: 600; font-family: inherit;
  border-radius: 15px; background: var(--glass); border: 1.5px solid var(--glass-brd); color: var(--ink);
  cursor: pointer; transition: transform .12s, border-color .18s, background .18s; animation: slideUp .3s both;
}
.option:hover:not(.own):not(.disabled) { border-color: var(--accent-3); transform: translateX(3px); }
.option:active { transform: scale(0.99); }
.option.own { opacity: 0.45; cursor: not-allowed; border-style: dashed; }
.option.selected { border-color: var(--accent); background: rgba(255, 77, 121, 0.2); box-shadow: 0 0 24px rgba(255,77,121,0.35); }
.option.disabled { pointer-events: none; }

/* ===== Reveal ===== */
.reveal-hero { text-align: center; margin: 10px 0 18px; }
.answer-big {
  font-family: "Space Grotesk", sans-serif; font-size: 2rem; margin-top: 6px;
  background: linear-gradient(90deg, var(--good), var(--cyan)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 20px rgba(46,230,168,0.4)); animation: pop .5s cubic-bezier(.2,1.4,.4,1);
}
.reveal-list { display: flex; flex-direction: column; gap: 9px; margin-bottom: 4px; }
.reveal-item { background: var(--glass); border: 1px solid var(--glass-brd); border-radius: 14px; padding: 13px 15px; animation: slideUp .3s both; }
.reveal-item.truth { border-color: var(--good); background: rgba(46, 230, 168, 0.12); box-shadow: 0 0 24px rgba(46,230,168,0.22); }
.reveal-item .ri-text { font-weight: 700; font-size: 1.05rem; }
.reveal-item .ri-text::before { content: "🪤 "; }
.reveal-item.truth .ri-text::before { content: "✅ "; }
.reveal-item .ri-meta { font-size: 0.83rem; color: var(--muted); margin-top: 5px; }

/* ===== Final ===== */
.final-board { list-style: none; counter-reset: rank; }
.final-board li {
  counter-increment: rank; display: flex; align-items: center; gap: 13px;
  background: var(--glass); border: 1px solid var(--glass-brd);
  border-radius: 15px; padding: 15px; margin-bottom: 11px; font-size: 1.08rem; font-weight: 600;
  animation: slideUp .4s both;
}
.final-board li::before {
  content: counter(rank); font-family: "Space Grotesk", sans-serif; font-weight: 700;
  width: 34px; height: 34px; min-width: 34px; display: grid; place-items: center;
  border-radius: 50%; background: rgba(255, 255, 255, 0.1); font-size: 0.95rem;
}
.final-board li:nth-child(1) { border-color: var(--accent-2); box-shadow: 0 0 28px rgba(255,209,102,0.3); }
.final-board li:nth-child(1)::before { background: var(--accent-2); color: #3a2c00; }
.final-board li:nth-child(2)::before { background: #d3d7e3; color: #222; }
.final-board li:nth-child(3)::before { background: #cd7f32; color: #fff; }
.final-board li .fb-score { margin-left: auto; font-family: "Space Grotesk", sans-serif; font-weight: 700; color: var(--accent-2); font-size: 1.15rem; }

/* ===== Confetti (CSS-only, on game over) ===== */
.confetti { position: absolute; inset: 0 0 auto 0; height: 0; pointer-events: none; z-index: 5; }
#screen-over.active .confetti::before, #screen-over.active .confetti::after {
  content: ""; position: absolute; top: -10vh; left: 0; right: 0; height: 100vh;
  background-image:
    radial-gradient(6px 10px at 20% 0, var(--accent) 50%, transparent 51%),
    radial-gradient(6px 10px at 50% 0, var(--accent-2) 50%, transparent 51%),
    radial-gradient(6px 10px at 75% 0, var(--cyan) 50%, transparent 51%),
    radial-gradient(6px 10px at 90% 0, var(--accent-3) 50%, transparent 51%);
  background-repeat: repeat-y; background-size: 100% 22vh;
  animation: fall 2.6s linear forwards; opacity: 0.9;
}
#screen-over.active .confetti::after { animation-delay: .5s; left: 12%; opacity: 0.7; }
@keyframes fall { from { transform: translateY(-20vh) rotate(0); } to { transform: translateY(120vh) rotate(140deg); opacity: 0; } }

/* ===== Toast ===== */
.toast {
  position: fixed; left: 50%; top: 18px; transform: translateX(-50%);
  background: rgba(20, 10, 40, 0.92); border: 1px solid var(--accent); color: #fff;
  padding: 13px 20px; border-radius: 14px; font-size: 0.92rem; font-weight: 600;
  max-width: 90%; text-align: center; z-index: 50;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5); backdrop-filter: blur(10px);
  animation: toastIn .3s cubic-bezier(.2,1.3,.4,1);
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ===== Sound toggle ===== */
.sound-btn {
  position: fixed; top: 14px; right: 14px; z-index: 40;
  width: 42px; height: 42px; border-radius: 13px; font-size: 1.15rem; cursor: pointer;
  background: var(--glass); border: 1px solid var(--glass-brd); color: var(--ink);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.sound-btn.off { opacity: 0.5; }

/* ===== Share row / QR (lobby) ===== */
.share-row { display: flex; gap: 8px; margin: 4px 0 6px; }
.share-btn {
  flex: 1; padding: 12px 6px; font-size: 0.88rem; font-weight: 700; font-family: inherit;
  border-radius: 13px; cursor: pointer; color: var(--ink);
  background: var(--glass); border: 1.5px solid var(--glass-brd);
  transition: transform .12s, border-color .18s;
}
.share-btn:active { transform: scale(0.96); }
.share-btn.wa { border-color: rgba(37, 211, 102, 0.55); background: rgba(37, 211, 102, 0.12); }
.qr-box { text-align: center; margin: 10px 0; animation: slideUp .3s; }
.qr-box img { border-radius: 14px; border: 6px solid #fff; background: #fff; }

/* ===== Final round / double points ===== */
.final-banner {
  margin-top: 14px; padding: 11px; text-align: center; border-radius: 13px;
  font-weight: 800; letter-spacing: 1px; font-size: 0.95rem;
  background: linear-gradient(90deg, rgba(255,209,102,0.22), rgba(255,77,121,0.22));
  border: 1.5px solid var(--accent-2); color: var(--accent-2);
  box-shadow: 0 0 26px rgba(255,209,102,0.25); animation: bannerPulse 1.4s ease-in-out infinite;
}
@keyframes bannerPulse { 50% { box-shadow: 0 0 40px rgba(255,209,102,0.5); } }
.double-tag {
  font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 0.8rem; letter-spacing: 1px;
  background: var(--accent-2); color: #3a2c00; border-radius: 9px; padding: 5px 10px;
  animation: bannerPulse 1.4s infinite;
}

/* ===== Staged reveal ===== */
.reveal-item { position: relative; }
.reveal-item.pending { opacity: 0; transform: rotateX(80deg); }
.reveal-item.flipped { animation: flipIn .5s cubic-bezier(.2,1.2,.3,1) both; }
@keyframes flipIn {
  from { opacity: 0; transform: rotateX(80deg) translateY(-8px); }
  to   { opacity: 1; transform: rotateX(0) translateY(0); }
}
.reveal-item.house { border-style: dashed; }
.reveal-item.house .ri-text::before { content: "🤖 "; }
.like-btn {
  position: absolute; right: 10px; top: 10px; cursor: pointer;
  background: rgba(255,255,255,0.07); border: 1px solid var(--glass-brd); color: var(--ink);
  border-radius: 11px; padding: 6px 11px; font-size: 0.85rem; font-weight: 700; font-family: inherit;
  transition: transform .12s, border-color .18s;
}
.like-btn:active { transform: scale(1.2); }
.like-btn.liked { border-color: var(--accent); background: rgba(255,77,121,0.18); pointer-events: none; }
.callout {
  text-align: center; font-weight: 800; font-size: 1.05rem; padding: 13px; margin: 12px 0;
  border-radius: 14px; border: 1.5px solid var(--accent-3);
  background: rgba(124, 92, 255, 0.14); box-shadow: 0 0 26px rgba(124,92,255,0.25);
  animation: pop .45s cubic-bezier(.2,1.4,.4,1) both;
}
.streak-tag { color: #ff9d42; font-weight: 800; font-size: 0.8rem; margin-left: 6px; }

/* ===== Awards (game over) ===== */
.awards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0 6px; }
.award {
  background: var(--glass); border: 1px solid var(--glass-brd); border-radius: 15px;
  padding: 14px 12px; text-align: center; animation: slideUp .45s both;
}
.award .a-emoji { font-size: 1.7rem; display: block; margin-bottom: 5px; }
.award .a-title { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); font-weight: 700; }
.award .a-name { font-weight: 800; font-size: 1.02rem; margin-top: 3px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.award .a-detail { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }

@media (max-width: 380px) { .logo { font-size: 2.6rem; } .room-pill strong { font-size: 2rem; letter-spacing: 7px; } }
