/* =============================================
   WOLFCHAT — TRIVIA NIGHT styles (purple theme, distinct from other modes)
   Reuses .screen / .grid-bg from style.css. All trivia ids/classes are tr-/tl-/tp-.
   ============================================= */
:root {
  --tv-purple: #9333EA;
  --tv-purple2: #7C3AED;
  --tv-amber: #F59E0B;
  --tv-green: #10B981;
  --tv-red: #EF4444;
  --tv-card: #111827;
  --tv-border: rgba(147,51,234,0.3);
}

/* ===================== shared ===================== */
#trivia-lobby-screen, #trivia-screen, #trivia-podium-screen {
  flex-direction: column; align-items: center; color: var(--text);
  font-family: var(--mono); background: var(--bg);
}
#trivia-lobby-screen, #trivia-podium-screen { overflow-y: auto; }
.tv-chip {
  background: rgba(255,255,255,0.06); border: 1px solid var(--border);
  color: rgba(255,255,255,0.8); font-family: var(--mono); font-size: 13px;
  letter-spacing: 1px; padding: 9px 14px; border-radius: 8px; cursor: pointer;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: background .12s, border-color .12s, color .12s;
}
.tv-chip.on { background: rgba(147,51,234,0.18); border-color: var(--tv-purple); color: #fff; }
.tv-chip:active { transform: scale(0.96); }

/* ===================== LOBBY ===================== */
.tl-wrap { position: relative; z-index: 2; width: 100%; max-width: 620px; padding: 22px 16px; display: flex; flex-direction: column; gap: 16px; align-items: center; }
.tl-head { display: flex; align-items: center; gap: 10px; }
.tl-head .logo-mark.sm { width: 22px; height: 22px; font-size: 14px; border-radius: 4px; box-shadow: none; }
.tl-title-mode { font-size: 16px; font-weight: 900; letter-spacing: 4px; color: var(--tv-purple); }
.tl-card { width: 100%; background: var(--panel); border: 1px solid var(--tv-border); border-radius: 12px; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.tl-card h2 { font-size: 18px; font-weight: 800; letter-spacing: 2px; text-align: center; }
.tl-sub { font-size: 12px; color: rgba(255,255,255,0.55); text-align: center; margin-top: -8px; }
#tl-players { display: flex; flex-direction: column; gap: 6px; }
.tl-prow { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: rgba(255,255,255,0.04); border-radius: 8px; font-size: 13px; }
.tl-prow .pdot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.tl-prow .pdot.red { background: var(--red); } .tl-prow .pdot.blue { background: var(--blue); }
.tl-prow .tl-host { margin-left: auto; font-size: 10px; letter-spacing: 1px; color: var(--tv-amber); }
.tl-section-label { font-size: 10px; letter-spacing: 3px; color: rgba(255,255,255,0.5); margin-bottom: 6px; }
.tl-row { display: flex; flex-wrap: wrap; gap: 8px; }
#tl-cats .tv-chip { font-size: 12px; }
#tl-start {
  width: 100%; background: var(--tv-purple); border: none; color: #fff; font-family: var(--mono);
  font-weight: 800; font-size: 16px; letter-spacing: 3px; padding: 15px; border-radius: 10px; cursor: pointer;
  touch-action: manipulation; transition: box-shadow .15s, opacity .15s;
}
#tl-start:hover { box-shadow: 0 0 24px rgba(147,51,234,0.5); }
#tl-start:disabled { opacity: 0.4; cursor: not-allowed; }
.tl-waiting-note { font-size: 11px; color: rgba(255,255,255,0.4); text-align: center; }
#tl-voice { font-size: 11px; letter-spacing: 1px; padding: 6px 14px; border-radius: 16px; background: rgba(0,0,0,0.5); }
#tl-voice.vs-on { color: var(--green); } #tl-voice.vs-connecting { color: var(--gold); }
#tl-voice.vs-waiting { color: rgba(255,255,255,0.5); } #tl-voice.vs-off { color: var(--red); }
.tl-hostonly.hidden-nonhost { display: none; }

/* ===================== GAME SCREEN ===================== */
#trivia-screen { justify-content: flex-start; }
#tr-top { flex: 0 0 52px; height: 52px; width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; background: var(--panel); border-bottom: 1px solid var(--tv-border); }
#tr-counter { font-size: 13px; font-weight: 700; letter-spacing: 1px; color: rgba(255,255,255,0.8); min-width: 70px; }
#tr-cat { font-size: 13px; font-weight: 700; letter-spacing: 1px; text-align: center; }
#tr-score { font-size: 12px; letter-spacing: 1px; color: rgba(255,255,255,0.7); min-width: 70px; text-align: right; }

#tr-timer-wrap { width: 100%; padding: 6px 14px 0; }
#tr-timer-num { font-size: 12px; font-weight: 800; text-align: center; letter-spacing: 1px; margin-bottom: 3px; }
#tr-timer-track { width: 100%; height: 8px; background: rgba(255,255,255,0.08); border-radius: 6px; overflow: hidden; }
#tr-timer-fill { height: 100%; width: 100%; background: var(--tv-green); border-radius: 6px; transition: width 1s linear, background .3s; }
#tr-timer-fill.warn { background: var(--tv-amber); }
#tr-timer-fill.danger { background: var(--tv-red); animation: tvpulse 0.7s ease-in-out infinite; }
@keyframes tvpulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

#tr-main { flex: 1 1 auto; min-height: 0; width: 100%; display: flex; flex-direction: column; }
#tr-left { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; padding: 14px; gap: 12px; overflow-y: auto; }
#tr-right { flex: 0 0 auto; }

#tr-card { position: relative; background: var(--tv-card); border: 1px solid var(--tv-border); border-radius: 14px; padding: 22px 18px; box-shadow: 0 0 28px rgba(147,51,234,0.18); animation: tvCardIn .3s ease-out; }
@keyframes tvCardIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
#tr-diff { position: absolute; top: 10px; right: 12px; font-size: 9px; font-weight: 800; letter-spacing: 1px; padding: 3px 8px; border-radius: 5px; }
#tr-diff.EASY { background: rgba(16,185,129,0.2); color: var(--tv-green); }
#tr-diff.MEDIUM { background: rgba(245,158,11,0.2); color: var(--tv-amber); }
#tr-diff.HARD { background: rgba(239,68,68,0.2); color: var(--tv-red); }
#tr-card-icon { position: absolute; top: 8px; left: 12px; font-size: 18px; }
#tr-question { font-size: 18px; line-height: 1.5; color: #fff; text-align: center; padding: 14px 4px 0; }

#tr-answers { display: flex; flex-direction: column; gap: 10px; }
.trivia-answer-btn {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; text-align: left;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.12); border-radius: 8px;
  color: #fff; font-family: var(--mono); font-size: 15px; padding: 14px 16px; cursor: pointer;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: background .12s, border-color .12s, transform .08s; animation: tvAnsIn .25s ease-out both;
}
.trivia-answer-btn .tr-letter { flex: 0 0 26px; width: 26px; height: 26px; border-radius: 6px; background: rgba(147,51,234,0.25); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; font-size: 13px; }
.trivia-answer-btn:nth-child(1) { animation-delay: 0ms; }
.trivia-answer-btn:nth-child(2) { animation-delay: 100ms; }
.trivia-answer-btn:nth-child(3) { animation-delay: 200ms; }
.trivia-answer-btn:nth-child(4) { animation-delay: 300ms; }
@keyframes tvAnsIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
.trivia-answer-btn:active { transform: scale(0.99); }
.trivia-answer-btn.selected { border: 2px solid var(--tv-purple); background: rgba(147,51,234,0.15); }
.trivia-answer-btn.correct { background: rgba(16,185,129,0.25); border-color: var(--tv-green); }
.trivia-answer-btn.wrong { background: rgba(239,68,68,0.12); border-color: rgba(239,68,68,0.3); color: rgba(255,255,255,0.5); }
.trivia-answer-btn.my-wrong { background: rgba(239,68,68,0.25); border-color: var(--tv-red); color: #fff; animation: tvShake .3s; }
@keyframes tvShake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-5px)} 75%{transform:translateX(5px)} }
.trivia-answer-btn[disabled] { cursor: default; }
.trivia-answer-btn .tr-check { margin-left: auto; font-weight: 900; }

#tr-fact { background: rgba(124,58,237,0.12); border: 1px solid var(--tv-border); border-radius: 10px; padding: 14px 16px; font-size: 13px; font-style: italic; color: #d8c8ff; line-height: 1.5; animation: tvFactIn .35s ease-out; }
#tr-fact.hidden { display: none; }
@keyframes tvFactIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

#tr-phone {
  align-self: center; background: rgba(255,255,255,0.06); border: 1px solid var(--border);
  color: rgba(255,255,255,0.6); font-family: var(--mono); font-size: 11px; letter-spacing: 1px;
  padding: 7px 14px; border-radius: 18px; cursor: pointer; touch-action: manipulation;
}
#tr-phone:disabled { opacity: 0.35; cursor: default; }
#tr-phone.hidden { display: none; }

/* players strip (mobile, horizontal scroll) / panel (desktop, vertical) */
#tr-players { display: flex; flex-direction: row; overflow-x: auto; gap: 8px; padding: 6px 14px; scrollbar-width: none; }
#tr-players::-webkit-scrollbar { display: none; }
.tr-player {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
  background: rgba(255,255,255,0.06); border-radius: 20px; padding: 6px 12px; font-size: 12px;
  transition: background .15s;
}
.tr-player.answered { background: rgba(147,51,234,0.18); }
.tr-player.speaking { box-shadow: 0 0 0 2px var(--green); }
.tr-av { border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; line-height: 1; flex-shrink: 0; box-shadow: 0 0 0 1px rgba(0,0,0,0.3); }
.tr-player .pdot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.tr-player .pdot.red { background: var(--red); } .tr-player .pdot.blue { background: var(--blue); }
.tr-player .tr-pscore { font-weight: 800; color: var(--tv-purple); }
.tr-player .tr-fire { color: var(--tv-amber); }
.tr-player.flash-wrong { animation: tvRowWrong .5s; }
@keyframes tvRowWrong { 0%,100%{background:rgba(255,255,255,0.06)} 50%{background:rgba(239,68,68,0.3)} }

#tr-bottom { flex: 0 0 56px; height: 56px; width: 100%; display: flex; align-items: center; justify-content: center; gap: 14px; background: var(--panel); border-top: 1px solid var(--tv-border); }
#tr-mic { width: 46px; height: 46px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.25); background: var(--green); color: #fff; font-size: 20px; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
#tr-mic.muted { background: var(--red); }
#tr-leave { background: rgba(180,0,0,0.7); border: 1px solid rgba(255,80,80,0.5); color: #fff; font-family: var(--mono); font-size: 12px; letter-spacing: 2px; padding: 10px 16px; border-radius: 6px; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

/* floating score popups */
#tr-popups { position: fixed; left: 50%; top: 40%; transform: translateX(-50%); z-index: 60; pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tr-popup { font-size: 20px; font-weight: 900; letter-spacing: 1px; color: var(--tv-amber); text-shadow: 0 2px 10px rgba(0,0,0,0.6); animation: tvPop 1.5s ease-out forwards; }
.tr-popup.zero { color: rgba(255,255,255,0.5); font-size: 15px; }
@keyframes tvPop { 0% { opacity: 0; transform: translateY(10px) scale(0.8); } 20% { opacity: 1; transform: translateY(0) scale(1); } 100% { opacity: 0; transform: translateY(-40px); } }

/* ===================== PODIUM ===================== */
.tp-wrap { position: relative; z-index: 2; width: 100%; max-width: 720px; padding: 22px 16px; display: flex; flex-direction: column; gap: 16px; align-items: center; }
.tp-title { font-size: 30px; font-weight: 900; letter-spacing: 6px; color: var(--tv-purple); text-shadow: 0 0 24px rgba(147,51,234,0.5); }
#tp-platforms { display: flex; align-items: flex-end; justify-content: center; gap: 12px; width: 100%; }
.tp-plat { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.tp-plat .tp-av { width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 900; color: #fff; }
.tp-plat .tp-av.red { background: var(--red); } .tp-plat .tp-av.blue { background: var(--blue); }
.tp-plat .tp-name { font-size: 13px; font-weight: 700; }
.tp-plat .tp-pscore { font-size: 18px; font-weight: 900; color: var(--tv-purple); }
.tp-plat .tp-base { width: 90px; border-radius: 8px 8px 0 0; display: flex; align-items: flex-start; justify-content: center; padding-top: 6px; font-size: 22px; }
.tp-plat.p1 .tp-base { height: 90px; background: linear-gradient(180deg,#FFD700,#9a7b00); }
.tp-plat.p2 .tp-base { height: 64px; background: linear-gradient(180deg,#C0C0C0,#6b6b6b); }
.tp-plat.p3 .tp-base { height: 46px; background: linear-gradient(180deg,#CD7F32,#7a4a1e); }
.tp-plat .tp-mini { font-size: 10px; color: rgba(255,255,255,0.5); }

#tp-board { width: 100%; display: flex; flex-direction: column; gap: 6px; }
.tp-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: rgba(255,255,255,0.04); border-radius: 8px; font-size: 13px; }
.tp-row.winner { background: rgba(147,51,234,0.18); border: 1px solid var(--tv-border); }
.tp-row .tp-rank { width: 22px; font-weight: 800; color: rgba(255,255,255,0.5); }
.tp-row .tp-rname { font-weight: 700; }
.tp-row .tp-rstats { margin-left: auto; font-size: 11px; color: rgba(255,255,255,0.55); text-align: right; }
.tp-row .tp-rscore { font-size: 16px; font-weight: 900; color: var(--tv-purple); min-width: 56px; text-align: right; }
#tp-stats { width: 100%; display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: rgba(255,255,255,0.6); background: rgba(255,255,255,0.03); border-radius: 8px; padding: 12px; }
#tp-stats .tp-stat::before { content: '✦ '; color: var(--tv-amber); }
.tp-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.tp-actions button { font-family: var(--mono); font-weight: 800; letter-spacing: 2px; font-size: 13px; padding: 13px 18px; border-radius: 8px; cursor: pointer; border: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
#tp-again { background: var(--tv-purple); color: #fff; }
#tp-change { background: rgba(255,255,255,0.08); color: #fff; border: 1px solid var(--tv-border); }
#tp-exit { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.7); border: 1px solid var(--border); }

/* phone-a-friend banner */
#tr-phone-banner { position: fixed; top: 60px; left: 50%; transform: translateX(-50%) translateY(-140%); z-index: 70; background: var(--tv-purple); color: #fff; font-weight: 800; letter-spacing: 1px; font-size: 13px; padding: 9px 18px; border-radius: 8px; transition: transform .3s cubic-bezier(.2,.8,.2,1); }
#tr-phone-banner:not(.hidden) { transform: translateX(-50%) translateY(0); }

/* ===================== DESKTOP ===================== */
@media (min-width: 768px) {
  #tr-question { font-size: 22px; line-height: 1.6; }
  #tr-main { flex-direction: row; height: calc(100dvh - 108px); }
  #tr-left { flex: 0 0 60%; padding: 24px; }
  #tr-right { flex: 0 0 40%; border-left: 1px solid rgba(255,255,255,0.08); padding: 16px; overflow-y: auto; }
  #tr-answers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .trivia-answer-btn { min-height: 80px; }
  .trivia-answer-btn:hover:not([disabled]) { background: rgba(147,51,234,0.2); border-color: var(--tv-purple); transform: translateY(-2px); }
  #tr-players { flex-direction: column; overflow-x: visible; gap: 8px; }
  .tr-player { border-radius: 10px; padding: 12px; justify-content: flex-start; }
  .tr-player .tr-pscore { margin-left: auto; font-size: 20px; }
  .tp-plat .tp-base { width: 110px; }
}

/* ===================== MOBILE ===================== */
@media (max-width: 767px) {
  #tr-question { font-size: 18px; }
  .trivia-answer-btn { min-height: 70px; }
  #tr-timer-track { height: 12px; }
  #tr-cat span.tr-cat-name { display: none; }   /* icon only in the top bar to save space */
  #tr-players { flex-direction: row; overflow-x: auto; gap: 8px; padding: 4px 0; scrollbar-width: none; }
  #tr-players::-webkit-scrollbar { display: none; }
  .tr-popup { font-size: 22px; }
  #tp-platforms { flex-direction: column; align-items: stretch; gap: 8px; }
  .tp-plat { flex-direction: row; align-items: center; gap: 12px; background: rgba(255,255,255,0.04); border-radius: 10px; padding: 10px 12px; }
  .tp-plat .tp-base { display: none; }
  .tp-plat .tp-pscore { margin-left: auto; }
}
