/* ==========================================================================
   Socky's Party Trivia - OBS Stream Overlay Stylesheet
   Designed for 9:16 Vertical Video (1080 x 1920) and Scalable Stream Sources
   With Draggable OBS Interact Support & High-Contrast Sharp Text Rendering
   ========================================================================== */

:root {
  --bg-deep: #070913;
  --panel-bg: #0c1024;
  --panel-border: rgba(255, 255, 255, 0.18);
  --panel-glow: rgba(121, 40, 202, 0.35);
  
  --color-primary: #7928ca;
  --color-accent: #00f2fe;
  --color-gold: #ffb703;
  --color-success: #10b981;
  --color-danger: #ef4444;

  /* Choice Colors & Gradients */
  --choice-a-bg: #ff0844;
  --choice-b-bg: #0072ff;
  --choice-c-bg: #10b981;
  --choice-d-bg: #f59e0b;

  --font-display: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  --font-mono: 'Space Grotesk', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body.obs-overlay-body {
  font-family: var(--font-body);
  background: transparent;
  color: #ffffff;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Confetti Canvas */
#confetti-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
}

/* Main Container Frame */
.overlay-container {
  width: 100%;
  max-width: 820px;
  height: 96vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px;
  position: relative;
  z-index: 10;
}

/* --- DRAGGABLE OBS INTERACT STYLES --- */
.draggable-block {
  position: relative;
  touch-action: none;
  cursor: grab;
  transition: box-shadow 0.2s;
}

.draggable-block:active, .draggable-block.is-dragging {
  cursor: grabbing !important;
  z-index: 9000 !important;
  box-shadow: 0 0 35px rgba(0, 242, 254, 0.7), 0 16px 40px rgba(0, 0, 0, 0.8) !important;
}

.drag-handle {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 1.1rem;
  line-height: 1;
  color: rgba(255, 255, 255, 0.25);
  cursor: grab;
  padding: 2px 6px;
  border-radius: 6px;
  user-select: none;
  z-index: 20;
  transition: all 0.2s;
}

.draggable-block:hover .drag-handle {
  color: var(--color-accent);
  background: rgba(0, 242, 254, 0.15);
}

.btn-reset-overlay-layout {
  position: fixed;
  bottom: 8px;
  right: 8px;
  background: rgba(12, 16, 36, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 6px 12px;
  color: #94a3b8;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  z-index: 1000;
  opacity: 0.35;
  transition: all 0.2s;
}

.btn-reset-overlay-layout:hover {
  opacity: 1;
  color: #ffffff;
  border-color: var(--color-accent);
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.4);
}

/* --- TOP HEADER --- */
.overlay-header {
  background: var(--panel-bg);
  border: 2px solid var(--panel-border);
  border-radius: 24px;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), 0 0 25px var(--panel-glow);
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 16px;
}

.socky-avatar {
  font-size: 2.8rem;
  line-height: 1;
  filter: drop-shadow(0 0 14px rgba(255, 183, 3, 0.8));
  animation: bobble 3s ease-in-out infinite;
}

.title-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 900;
  letter-spacing: 0.5px;
  background: linear-gradient(90deg, #ffffff 0%, #ffd166 50%, #ff007f 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.sub-badges {
  display: flex;
  align-items: center;
  gap: 10px;
}

.live-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 800;
  color: #ff3366;
  letter-spacing: 0.5px;
}

.dot-ping {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff3366;
  box-shadow: 0 0 8px #ff3366;
  animation: pulseDot 1.5s infinite;
}

.round-badge {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 2px 10px;
  font-size: 0.75rem;
  font-weight: 800;
  color: #ffffff;
}

.category-cluster {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  margin-right: 24px; /* clearance for drag handle */
}

.category-pill {
  background: linear-gradient(135deg, rgba(121, 40, 202, 0.8), rgba(0, 242, 254, 0.6));
  border: 1px solid rgba(0, 242, 254, 0.5);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #ffffff;
  text-transform: uppercase;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

.difficulty-stars {
  display: flex;
  gap: 3px;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.3);
}

.difficulty-stars .star.filled {
  color: #ffb703;
  text-shadow: 0 0 10px rgba(255, 183, 3, 0.9);
}

/* --- QUESTION STAGE --- */
.question-stage {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: auto 0;
}

/* Lobby Card (Socks Mascot) */
.lobby-card {
  background: var(--panel-bg);
  border: 2px solid var(--panel-border);
  border-radius: 28px;
  padding: 48px 32px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 35px var(--panel-glow);
}

.lobby-icon-pulse {
  font-size: 5rem;
  margin-bottom: 20px;
  filter: drop-shadow(0 0 18px rgba(255, 183, 3, 0.85));
  animation: floatIcon 2.8s ease-in-out infinite;
}

.lobby-title {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 900;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #ffffff 0%, #ffd166 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 2px 6px rgba(0,0,0,0.6);
}

.lobby-subtitle {
  font-size: 1.2rem;
  color: #cbd5e1;
  max-width: 520px;
  margin: 0 auto 28px auto;
  line-height: 1.6;
  font-weight: 600;
}

.glow-key {
  color: #00f2fe;
  font-weight: 800;
  text-shadow: 0 0 8px rgba(0, 242, 254, 0.8);
}

.lobby-countdown-preview {
  display: inline-block;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 10px 24px;
  font-weight: 800;
  font-size: 1rem;
  color: #f1f5f9;
}

/* Question Box - Ultra Sharp High Contrast */
.question-box {
  background: #0d122b;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 28px;
  padding: 28px 28px 24px 28px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px var(--panel-glow);
  position: relative;
}

.question-header-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.q-number {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 1px;
  color: #94a3b8;
  text-transform: uppercase;
}

.timer-bubble {
  background: #080b1a;
  border: 2px solid #00f2fe;
  border-radius: 999px;
  padding: 4px 16px;
  display: flex;
  align-items: baseline;
  gap: 4px;
  box-shadow: 0 0 18px rgba(0, 242, 254, 0.5);
  transition: all 0.3s;
}

.timer-bubble.urgent {
  border-color: #ff0055;
  box-shadow: 0 0 25px rgba(255, 0, 85, 0.9);
  animation: pulseUrgent 0.6s infinite alternate;
}

.timer-num {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 800;
  color: #ffffff;
}

.timer-sec {
  font-size: 0.85rem;
  font-weight: 700;
  color: #94a3b8;
}

/* Timer Bar */
.timer-bar-track {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 24px;
}

.timer-bar-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #00f2fe, #4facfe, #7928ca);
  border-radius: 999px;
  transition: width 0.95s linear;
}

.timer-bar-fill.urgent {
  background: linear-gradient(90deg, #ff0844, #ffb199);
}

/* Question Text: Large, Crisp, Pin-Sharp */
.question-text {
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1.35;
  margin-bottom: 28px;
  color: #ffffff;
  min-height: 64px;
  display: flex;
  align-items: center;
  text-shadow: 0 2px 5px rgba(0,0,0,0.8);
}

/* Choices Grid */
.choices-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.choice-card {
  background: #151b3b;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-radius: 20px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  min-height: 84px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.choice-badge {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 900;
  color: #ffffff;
  flex-shrink: 0;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

.choice-a .choice-badge { background: linear-gradient(135deg, #ff0844, #ff5252); box-shadow: 0 4px 14px rgba(255, 8, 68, 0.4); }
.choice-b .choice-badge { background: linear-gradient(135deg, #0072ff, #00c6ff); box-shadow: 0 4px 14px rgba(0, 114, 255, 0.4); }
.choice-c .choice-badge { background: linear-gradient(135deg, #10b981, #38ef7d); box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4); }
.choice-d .choice-badge { background: linear-gradient(135deg, #f59e0b, #ffd200); box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4); }

/* Choice Label Text: Crisp & High Contrast */
.choice-label {
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.3;
  flex: 1;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.7);
}

/* Choice States on Reveal (Crisp legibility for all options!) */
.choice-card.is-correct {
  background: #064e3b !important;
  border: 2px solid #10b981 !important;
  box-shadow: 0 0 35px rgba(16, 185, 129, 0.85), inset 0 0 20px rgba(16, 185, 129, 0.4) !important;
}

.choice-card.is-correct .choice-badge {
  background: #10b981 !important;
}

.choice-card.is-correct .choice-status-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #10b981;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 900;
  font-size: 1.1rem;
  box-shadow: 0 0 12px #10b981;
}
.choice-card.is-correct .choice-status-icon::after {
  content: '✓';
}

/* Incorrect options remain sharp, legible, but clearly marked with red cross */
.choice-card.is-incorrect {
  opacity: 0.65;
  background: #0f1325;
  border-color: rgba(239, 68, 68, 0.45);
}

.choice-card.is-incorrect .choice-label {
  color: #cbd5e1;
}

.choice-card.is-incorrect .choice-status-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ef4444;
  font-weight: 900;
  font-size: 0.95rem;
}
.choice-card.is-incorrect .choice-status-icon::after {
  content: '✗';
}

/* Winner Spotlight */
.winner-spotlight {
  background: linear-gradient(135deg, rgba(255, 183, 3, 0.35), rgba(255, 0, 127, 0.25));
  border: 2px solid #ffb703;
  border-radius: 20px;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 10px 30px rgba(255, 183, 3, 0.4);
}

.spotlight-crown {
  font-size: 2.5rem;
  filter: drop-shadow(0 0 12px rgba(255, 183, 3, 0.9));
}

.spotlight-content {
  flex: 1;
  margin: 0 16px;
}

.spotlight-tag {
  font-size: 0.78rem;
  font-weight: 800;
  color: #ffb703;
  letter-spacing: 1px;
}

.spotlight-name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.6);
}

.spotlight-details {
  font-size: 0.9rem;
  color: #f1f5f9;
  font-weight: 700;
}

.spotlight-streak {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 183, 3, 0.5);
  border-radius: 12px;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.flame-icon {
  font-size: 1.3rem;
  animation: flicker 1s infinite alternate;
}

.streak-num {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 800;
  color: #ffb703;
}

.streak-lbl {
  font-size: 0.72rem;
  font-weight: 800;
  color: #94a3b8;
}

/* Chat Instructions Bar */
.chat-instructions-bar {
  background: #0a0e22;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-icon {
  font-size: 1.4rem;
  margin-right: 8px;
}

.chat-instruct-text {
  font-size: 1.05rem;
  color: #ffffff;
  font-weight: 700;
}

.key-tag {
  background: rgba(0, 242, 254, 0.2);
  border: 1px solid rgba(0, 242, 254, 0.4);
  padding: 2px 8px;
  border-radius: 6px;
  color: #00f2fe;
  font-family: var(--font-mono);
  font-weight: 800;
}

.answer-count-pill {
  background: rgba(0, 242, 254, 0.15);
  border: 1px solid rgba(0, 242, 254, 0.35);
  color: #00f2fe;
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 800;
}

/* Live Activity Stream (Locked in answers) */
.live-activity-stream {
  display: flex;
  gap: 8px;
  overflow: hidden;
  height: 38px;
  align-items: center;
}

.activity-tag {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  animation: activityPop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.activity-tag.activity-vote {
  background: rgba(16, 185, 129, 0.25);
  border-color: rgba(16, 185, 129, 0.65);
  color: #6ee7b7;
}

.activity-tag.activity-chat {
  background: rgba(56, 189, 248, 0.2);
  border-color: rgba(56, 189, 248, 0.55);
  color: #bae6fd;
}

@keyframes activityPop {
  0% { transform: scale(0.7) translateY(8px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* --- BOTTOM LEADERBOARD --- */
.overlay-footer {
  margin-top: auto;
}

.leaderboard-podium {
  background: var(--panel-bg);
  border: 2px solid var(--panel-border);
  border-radius: 24px;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), 0 0 25px var(--panel-glow);
}

.podium-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.podium-icon {
  font-size: 1.6rem;
}

.podium-label {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 1px;
  color: #ffffff;
}

.top-players-row {
  display: flex;
  gap: 12px;
  flex: 1;
  justify-content: flex-end;
  margin-right: 24px; /* clearance for drag handle */
}

.player-rank {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #141b38;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  padding: 6px 14px;
  min-width: 145px;
}

.rank-badge {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 0.9rem;
  color: #000;
}

.rank-badge.gold {
  background: linear-gradient(135deg, #ffd700, #ffa500);
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.7);
}

.rank-badge.silver {
  background: linear-gradient(135deg, #f1f5f9, #cbd5e1);
  box-shadow: 0 0 10px rgba(241, 245, 249, 0.6);
}

.rank-badge.bronze {
  background: linear-gradient(135deg, #cd7f32, #a0522d);
  box-shadow: 0 0 10px rgba(205, 127, 50, 0.6);
  color: #fff;
}

.rank-info {
  display: flex;
  flex-direction: column;
}

.rank-name {
  font-size: 0.9rem;
  font-weight: 800;
  color: #ffffff;
  max-width: 95px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-points {
  font-size: 0.8rem;
  color: #cbd5e1;
  font-weight: 700;
}

/* --- KEYFRAME ANIMATIONS --- */
@keyframes bobble {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-4px) rotate(4deg); }
}

@keyframes floatIcon {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

@keyframes pulseUrgent {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}

@keyframes flicker {
  0% { opacity: 0.8; transform: scale(0.95); }
  100% { opacity: 1; transform: scale(1.1); }
}

/* Responsive adjustments for 16:9 or smaller preview containers */
@media (max-height: 800px) {
  .overlay-container {
    height: 98vh;
    padding: 12px;
  }
  .lobby-card {
    padding: 24px 20px;
  }
  .question-box {
    padding: 18px 20px;
  }
  .question-text {
    font-size: 1.6rem;
    margin-bottom: 16px;
  }
  .choices-grid {
    gap: 10px;
  }
  .choice-card {
    padding: 12px 16px;
    min-height: 64px;
  }
  .choice-label {
    font-size: 1.15rem;
  }
}
