@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&family=Space+Grotesk:wght@400;500;700&display=swap');

:root {
  --color-bg-dark: #05021a;
  --color-bg-light: #0d0b30;
  --color-primary: #00f0ff;       /* Glowing Cyan */
  --color-secondary: #7f00ff;     /* Neon Purple */
  --color-accent: #ffd700;        /* Gold */
  --color-success: #39ff14;       /* Neon Green */
  --color-danger: #ff007f;        /* Hot Pink/Red */
  --color-warning: #ffaa00;       /* Warning Amber */
  --color-text: #ffffff;
  --color-text-muted: #a0aec0;
  
  --font-main: 'Outfit', sans-serif;
  --font-display: 'Space Grotesk', sans-serif;
  
  --shadow-glow-cyan: 0 0 15px rgba(0, 240, 255, 0.4);
  --shadow-glow-purple: 0 0 15px rgba(127, 0, 255, 0.4);
  --shadow-glow-gold: 0 0 15px rgba(255, 215, 0, 0.4);
  --shadow-glow-success: 0 0 15px rgba(57, 255, 20, 0.4);
}

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

body {
  font-family: var(--font-main);
  background-color: var(--color-bg-dark);
  background-image: 
    radial-gradient(at 0% 0%, rgba(127, 0, 255, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(0, 240, 255, 0.12) 0px, transparent 50%),
    radial-gradient(at 50% 50%, rgba(13, 11, 48, 0.95) 0px, var(--color-bg-dark) 100%);
  background-attachment: fixed;
  color: var(--color-text);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  letter-spacing: 0.5px;
}

/* Glassmorphism Panel */
.glass-panel {
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  box-shadow: 0 10px 40px 0 rgba(0, 0, 0, 0.5);
}

.glow-cyan {
  border-color: rgba(0, 240, 255, 0.3);
  box-shadow: var(--shadow-glow-cyan), inset 0 0 10px rgba(0, 240, 255, 0.1);
}

.glow-purple {
  border-color: rgba(127, 0, 255, 0.3);
  box-shadow: var(--shadow-glow-purple), inset 0 0 10px rgba(127, 0, 255, 0.1);
}

/* Utilities */
.hidden {
  display: none !important;
}

.text-center { text-align: center; }
.font-muted { color: var(--color-text-muted); }
.bold { font-weight: 600; }

/* Custom Buttons */
.btn {
  background: linear-gradient(135deg, var(--color-secondary), #5a00b3);
  color: var(--color-text);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 12px 28px;
  border-radius: 30px;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  outline: none;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow-purple), 0 6px 20px rgba(127, 0, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.4);
}

.btn:active {
  transform: translateY(1px);
}

.btn-cyan {
  background: linear-gradient(135deg, var(--color-primary), #00aacc);
  color: #05021a;
  border: none;
}

.btn-cyan:hover {
  box-shadow: var(--shadow-glow-cyan), 0 6px 20px rgba(0, 240, 255, 0.3);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--color-primary);
  color: var(--color-primary);
}

.btn-outline:hover {
  background: rgba(0, 240, 255, 0.1);
  box-shadow: var(--shadow-glow-cyan);
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 30px;
  background: rgba(5, 2, 26, 0.8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  position: relative;
  z-index: 10;
}

.logo h1 {
  font-size: 1.6rem;
  font-weight: 800;
  background: linear-gradient(to right, var(--color-primary), #d400ff, var(--color-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 30px rgba(0, 240, 255, 0.2);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.score-badge {
  background: rgba(255, 215, 0, 0.1);
  border: 1px solid var(--color-accent);
  padding: 6px 16px;
  border-radius: 20px;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--color-accent);
  box-shadow: var(--shadow-glow-gold);
}

.mute-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 1.2rem;
}

.mute-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: white;
}

.mute-btn.muted {
  background: rgba(255, 0, 127, 0.1);
  border-color: var(--color-danger);
  color: var(--color-danger);
}

/* App Container and Layout */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
}

.screen {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

/* Setup Screen */
.setup-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  padding: 40px;
  align-items: center;
}

.setup-info-panel h2 {
  font-size: 2.2rem;
  margin-bottom: 15px;
  color: var(--color-primary);
  text-shadow: var(--shadow-glow-cyan);
}

.setup-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-group label {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-muted);
}

.input-group input, .input-group select {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 14px;
  border-radius: 12px;
  color: white;
  font-size: 1rem;
  font-family: var(--font-main);
  outline: none;
  transition: all 0.3s;
}

.input-group input:focus, .input-group select:focus {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-glow-cyan);
  background: rgba(255, 255, 255, 0.08);
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 5px;
}

.avatar-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  font-size: 2rem;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.avatar-item:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.05);
}

.avatar-item.selected {
  background: rgba(0, 240, 255, 0.1);
  border-color: var(--color-primary);
  box-shadow: var(--shadow-glow-cyan);
  transform: scale(1.05);
}

.leaderboard-panel {
  padding: 25px;
}

.leaderboard-panel h3 {
  font-size: 1.5rem;
  margin-bottom: 15px;
  color: var(--color-accent);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 8px;
}

.table-wrapper {
  overflow-y: auto;
  max-height: 250px;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th, td {
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.95rem;
}

th {
  color: var(--color-text-muted);
  font-family: var(--font-display);
  font-weight: 500;
}

.lb-avatar {
  margin-right: 6px;
}

.lb-prize {
  color: var(--color-accent);
  font-weight: 700;
}

/* Game Board Layout */
.game-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 30px;
}

.game-main-area {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

/* Host Panel */
.host-panel {
  display: flex;
  gap: 20px;
  align-items: center;
  padding: 20px 25px;
  min-height: 110px;
}

.host-avatar-container {
  width: 70px;
  height: 70px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.host-dialogue-bubble {
  background: rgba(255, 255, 255, 0.04);
  border-left: 4px solid var(--color-primary);
  padding: 12px 20px;
  border-radius: 0 15px 15px 15px;
  position: relative;
  flex: 1;
  font-size: 1.05rem;
  line-height: 1.5;
}

/* Animated Robot Host Mascot (SVG controls) */
#host-mascot {
  width: 100%;
  height: 100%;
}

.host-idle #host-eye-left, .host-idle #host-eye-right {
  animation: eyeBlink 4s infinite;
}

.host-thinking #host-eyes {
  transform: translateY(-2px);
  animation: eyeRoll 3s infinite;
}

.host-nervous {
  animation: jitter 0.15s infinite;
}

.host-happy {
  animation: bobbing 0.5s infinite alternate;
}

/* Keyframes for Host SVG */
@keyframes eyeBlink {
  0%, 95%, 100% { scale: 1 1; }
  97% { scale: 1 0.1; }
}

@keyframes eyeRoll {
  0%, 100% { transform: translate(0, 0); }
  30% { transform: translate(2px, -2px); }
  60% { transform: translate(-2px, -2px); }
}

@keyframes jitter {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(1px, -1px); }
  75% { transform: translate(-1px, 1px); }
}

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

/* Board Center: Timer & Lifelines */
.dashboard-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.01);
  padding: 10px 20px;
  border-radius: 15px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Lifeline Buttons */
.lifelines-toolbar {
  display: flex;
  gap: 12px;
}

.lifeline-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 1.3rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.lifeline-btn:hover:not(:disabled) {
  background: rgba(0, 240, 255, 0.1);
  border-color: var(--color-primary);
  box-shadow: var(--shadow-glow-cyan);
  transform: translateY(-2px) scale(1.05);
}

.lifeline-btn.used {
  opacity: 0.2;
  cursor: not-allowed;
  border-color: rgba(255, 255, 255, 0.05);
  box-shadow: none;
  background: transparent;
  transform: none;
}

/* Circular Timer */
.timer-container {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.timer-box {
  width: 70px;
  height: 70px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.timer-progress-ring {
  position: absolute;
  top: 0;
  left: 0;
  transform: rotate(-90deg);
}

.timer-progress-ring__circle {
  transition: stroke-dashoffset 0.35s;
  transform-origin: 50% 50%;
  stroke: var(--color-primary);
}

.timer-text {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  position: absolute;
  color: white;
}

.pulse-warning {
  animation: warningPulse 1s infinite alternate;
}

@keyframes warningPulse {
  0% { transform: scale(1); filter: drop-shadow(0 0 2px var(--color-danger)); }
  100% { transform: scale(1.1); filter: drop-shadow(0 0 10px var(--color-danger)); }
}

/* Question Panel */
.question-panel {
  padding: 30px;
  position: relative;
}

.question-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 10px;
}

.level-indicator {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--color-accent);
}

.category-tag {
  background: rgba(127, 0, 255, 0.15);
  border: 1px solid rgba(127, 0, 255, 0.3);
  color: #c48dfc;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.question-text-box h3 {
  font-size: 1.35rem;
  line-height: 1.5;
  font-weight: 500;
}

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

.option-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  padding: 16px 24px;
  border-radius: 15px;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  gap: 15px;
  position: relative;
  overflow: hidden;
}

.option-prefix {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--color-primary);
  font-size: 1.1rem;
}

.option-text {
  font-size: 1.05rem;
  font-weight: 400;
}

.option-card:hover {
  background: rgba(0, 240, 255, 0.03);
  border-color: var(--color-primary);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.15);
  transform: translateY(-2px);
}

.option-card:active {
  transform: translateY(0);
}

/* Option States */
.option-card.selected {
  background: rgba(255, 215, 0, 0.08) !important;
  border-color: var(--color-accent) !important;
  box-shadow: var(--shadow-glow-gold) !important;
  animation: pulseGold 0.5s infinite alternate;
}

.option-card.correct {
  background: rgba(57, 255, 20, 0.08) !important;
  border-color: var(--color-success) !important;
  box-shadow: var(--shadow-glow-success) !important;
  color: var(--color-success);
  font-weight: 600;
}

.option-card.wrong {
  background: rgba(255, 0, 127, 0.08) !important;
  border-color: var(--color-danger) !important;
  box-shadow: 0 0 15px rgba(255, 0, 127, 0.4) !important;
  color: var(--color-danger);
}

.option-card.dimmed {
  opacity: 0.15;
  cursor: not-allowed;
  pointer-events: none;
  border-color: rgba(255, 255, 255, 0.05);
}

@keyframes pulseGold {
  0% { box-shadow: 0 0 5px rgba(255, 215, 0, 0.3); }
  100% { box-shadow: 0 0 15px rgba(255, 215, 0, 0.6); }
}

/* Bottom Controls */
.game-bottom-controls {
  display: flex;
  justify-content: flex-end;
}

/* Side Winnings Tree Panel */
.winnings-panel {
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.winnings-panel h3 {
  font-size: 1.1rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 8px;
}

.prize-tree-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3.5px;
}

.prize-node {
  display: flex;
  align-items: center;
  padding: 3.5px 12px;
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--color-text-muted);
  border: 1px solid transparent;
  transition: all 0.3s;
}

.node-number {
  width: 25px;
  font-weight: 600;
}

.node-arrow {
  margin: 0 10px;
  opacity: 0;
  color: var(--color-accent);
}

.node-amount {
  font-weight: 500;
  flex: 1;
}

/* Safe Zone Indicator */
.safe-zone-node {
  color: #c48dfc; /* Light purple for safe milestones */
}

/* Cleared Nodes */
.prize-node.cleared {
  color: var(--color-accent);
  opacity: 0.6;
}

/* Active Node */
.prize-node.active {
  background: rgba(255, 215, 0, 0.08);
  border-color: var(--color-accent);
  color: var(--color-accent);
  font-weight: 700;
  font-size: 1rem;
  box-shadow: var(--shadow-glow-gold);
}

.prize-node.active .node-arrow {
  opacity: 1;
  animation: blinkArrow 0.8s infinite alternate;
}

@keyframes blinkArrow {
  0% { opacity: 0.3; }
  100% { opacity: 1; }
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(5, 2, 26, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-content {
  width: 90%;
  max-width: 500px;
  padding: 30px;
  position: relative;
}

.modal-content h3 {
  font-size: 1.5rem;
  color: var(--color-primary);
  margin-bottom: 20px;
  text-shadow: var(--shadow-glow-cyan);
}

/* Audience Poll Charts */
.poll-chart-container {
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  height: 200px;
  padding: 20px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 20px;
}

.poll-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 50px;
  height: 100%;
  justify-content: flex-end;
  gap: 8px;
}

.poll-bar {
  width: 100%;
  background: linear-gradient(to top, var(--color-secondary), var(--color-primary));
  border-radius: 8px 8px 0 0;
  box-shadow: var(--shadow-glow-cyan);
  height: 0%; /* Dynamic */
  transition: height 1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.poll-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
}

.poll-value {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-accent);
}

/* Phone a Friend chat bubble */
.chat-container {
  min-height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  padding: 15px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.chat-options-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.expert-btn-call {
  text-align: left;
  font-size: 0.95rem;
  padding: 10px 20px;
}

.chat-message {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.chat-avatar {
  font-size: 2.2rem;
}

.chat-bubble {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 0 15px 15px 15px;
  padding: 12px 18px;
  border-left: 3px solid var(--color-primary);
  line-height: 1.5;
  font-size: 1rem;
}

/* End Screen */
.end-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 25px;
}

.end-container h2 {
  font-size: 2.5rem;
  color: var(--color-accent);
  text-shadow: var(--shadow-glow-gold);
}

.trophy-container {
  font-size: 5rem;
  animation: scaleFloat 2s infinite alternate;
}

@keyframes scaleFloat {
  0% { transform: scale(1) translateY(0); filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.2)); }
  100% { transform: scale(1.08) translateY(-10px); filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.6)); }
}

.prize-won-card {
  background: rgba(255, 215, 0, 0.08);
  border: 1.5px dashed var(--color-accent);
  padding: 20px 40px;
  border-radius: 15px;
  text-align: center;
  box-shadow: var(--shadow-glow-gold);
}

.prize-won-card span {
  display: block;
}

.prize-won-card .prize-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--color-text-muted);
  margin-bottom: 5px;
}

.prize-won-card .prize-amount {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--color-accent);
}

.end-actions {
  display: flex;
  gap: 15px;
}

/* Confetti Falling Keyframe */
#confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 99;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  opacity: 0.85;
}

@keyframes confetti-fall {
  0% {
    top: -20px;
    transform: rotate(0deg) translateX(0);
  }
  100% {
    top: 105vh;
    transform: rotate(720deg) translateX(50px);
  }
}

/* Animation utilities */
.fade-in {
  animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Responsive queries */
@media (max-width: 992px) {
  .game-layout {
    grid-template-columns: 1fr;
  }
  
  .winnings-panel {
    display: none; /* Hide side panel on small screens */
  }
  
  .setup-container {
    grid-template-columns: 1fr;
    gap: 30px;
    padding: 20px;
  }
}

@media (max-width: 600px) {
  header {
    padding: 10px 15px;
  }
  
  .logo h1 {
    font-size: 1.3rem;
  }
  
  .options-grid {
    grid-template-columns: 1fr;
  }
  
  .host-panel {
    flex-direction: column;
    text-align: center;
    align-items: center;
    padding: 15px;
  }
  
  .host-dialogue-bubble {
    border-left: none;
    border-top: 3px solid var(--color-primary);
    border-radius: 0 0 12px 12px;
  }
  
  .dashboard-row {
    flex-direction: column;
    gap: 15px;
  }
  
  .end-actions {
    flex-direction: column;
    width: 100%;
  }
  
  .btn {
    width: 100%;
    text-align: center;
  }
}
