/* Import Premium Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&family=Playfair+Display:ital,wght@0,700;1,400&display=swap');

:root {
  --bg-dark: #070913;
  --panel-bg: rgba(15, 20, 42, 0.7);
  --primary-glow: rgba(54, 83, 238, 0.4);
  --accent-gold: #FFD700;
  --accent-orange: #FF8C00;
  --correct-green: #2ECC71;
  --wrong-red: #E74C3C;
  --text-light: #F5F6FA;
  --text-muted: #8F9BB3;
  --border-light: rgba(255, 255, 255, 0.1);
  --border-gold: rgba(255, 215, 0, 0.3);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Outfit', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-light);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
}

/* Ambient Floating Orbs in Background */
body::before, body::after {
  content: '';
  position: absolute;
  width: 35vw;
  height: 35vw;
  border-radius: 50%;
  filter: blur(120px);
  z-index: -1;
  pointer-events: none;
  opacity: 0.45;
}

body::before {
  background: radial-gradient(circle, #1a2a6c, #2759f5);
  top: -10%;
  left: -10%;
  animation: floatOrb 18s infinite alternate ease-in-out;
}

body::after {
  background: radial-gradient(circle, #6a11cb, #2575fc);
  bottom: -10%;
  right: -10%;
  animation: floatOrb 22s infinite alternate-reverse ease-in-out;
}

@keyframes floatOrb {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(8%, 8%) scale(1.15); }
}

/* Container & Layout */
.app-container {
  width: 100%;
  max-width: 1200px;
  min-height: 90vh;
  margin: 20px;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 10;
}

/* Header Utilities */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 25px;
  background: var(--panel-bg);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  margin-bottom: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.logo h1 {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 24px;
  background: linear-gradient(135deg, #FFF 30%, var(--accent-gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 1px;
}

.logo span {
  font-size: 14px;
  color: var(--text-muted);
  font-family: 'Outfit', sans-serif;
  margin-left: 8px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.controls button {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-light);
  color: var(--text-light);
  padding: 8px 16px;
  border-radius: 30px;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.controls button:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.controls button.muted {
  border-color: rgba(231, 76, 60, 0.4);
  color: var(--wrong-red);
}

/* Screen Wrapper */
.screen-wrapper {
  flex: 1;
  display: flex;
  position: relative;
}

.screen {
  display: none;
  width: 100%;
  flex: 1;
}

.screen.active {
  display: flex;
  animation: fadeIn 0.5s ease-out forwards;
}

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

/* ================= WELCOME SCREEN ================= */
.welcome-card {
  margin: auto;
  max-width: 600px;
  background: var(--panel-bg);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid var(--border-light);
  border-radius: 24px;
  padding: 40px;
  text-align: center;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 25px;
}

.welcome-title h2 {
  font-family: 'Playfair Display', serif;
  font-size: 38px;
  line-height: 1.2;
  margin-bottom: 5px;
  background: linear-gradient(135deg, #FFF 20%, var(--accent-gold) 60%, var(--accent-orange) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.welcome-subtitle {
  font-size: 16px;
  color: var(--text-muted);
  letter-spacing: 3px;
  text-transform: uppercase;
}

.welcome-card p {
  color: var(--text-light);
  font-size: 15px;
  line-height: 1.6;
  opacity: 0.85;
}

.rules-list {
  text-align: left;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 12px;
  padding: 20px 25px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.rules-list li {
  margin-bottom: 12px;
  font-size: 14px;
  color: #d1d5db;
  list-style: none;
  position: relative;
  padding-left: 20px;
}

.rules-list li::before {
  content: '✦';
  color: var(--accent-gold);
  position: absolute;
  left: 0;
  top: 0;
}

.rules-list li:last-child {
  margin-bottom: 0;
}

.cta-btn {
  background: linear-gradient(135deg, var(--accent-orange), var(--accent-gold));
  color: #000;
  border: none;
  padding: 16px 36px;
  font-size: 18px;
  font-weight: 800;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(255, 140, 0, 0.4);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.cta-btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 25px rgba(255, 140, 0, 0.6);
}

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

/* ================= GAME SCREEN ================= */
.game-layout {
  display: flex;
  width: 100%;
  gap: 20px;
}

/* Left Board: Jokers, Timer, Question, Answers */
.game-board {
  flex: 3;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Jokers panel */
.jokers-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--panel-bg);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 15px 25px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.joker-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.joker-buttons {
  display: flex;
  gap: 15px;
}

.joker-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid var(--border-light);
  color: var(--text-light);
  padding: 10px 20px;
  border-radius: 30px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.joker-btn:hover:not(:disabled) {
  background: rgba(54, 83, 238, 0.2);
  border-color: rgba(54, 83, 238, 0.8);
  box-shadow: 0 0 15px rgba(54, 83, 238, 0.4);
  transform: translateY(-2px);
}

.joker-btn.used {
  background: rgba(0, 0, 0, 0.4);
  border-color: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  cursor: not-allowed;
  text-decoration: line-through;
  opacity: 0.5;
}

/* Question Area */
.question-container {
  flex: 1;
  background: var(--panel-bg);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid var(--border-light);
  border-radius: 24px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Circular Timer */
.timer-wrapper {
  position: absolute;
  top: -25px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 60px;
  background: #0f142a;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5), 0 0 10px var(--primary-glow);
  border: 2px solid rgba(255, 255, 255, 0.05);
}

.timer-svg {
  width: 54px;
  height: 54px;
  transform: rotate(-90deg);
}

.timer-svg circle {
  fill: none;
  stroke-width: 3.5;
}

.timer-svg .bg-circle {
  stroke: rgba(255, 255, 255, 0.05);
}

.timer-svg .progress-circle {
  stroke: var(--accent-orange);
  stroke-dasharray: 283;
  stroke-dashoffset: 0;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear;
}

.timer-text {
  position: absolute;
  font-size: 18px;
  font-weight: 800;
  color: var(--text-light);
  font-variant-numeric: tabular-nums;
}

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

.question-index {
  color: var(--accent-gold);
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.question-body {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
  margin: 15px 0;
}

/* Answers Grid */
.answers-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  margin-bottom: 15px;
}

.option-btn {
  background: rgba(15, 20, 42, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1.5px solid var(--border-light);
  border-radius: 12px;
  padding: 18px 24px;
  text-align: left;
  color: var(--text-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.option-letter {
  color: var(--accent-orange);
  font-weight: 800;
  margin-right: 12px;
  font-size: 16px;
}

.option-text {
  flex: 1;
}

/* State Styling for Option Buttons */
.option-btn:hover:not(.selected):not(.correct):not(.wrong) {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--accent-orange);
  box-shadow: 0 0 15px rgba(255, 140, 0, 0.25);
  transform: translateY(-2px);
}

.option-btn.selected {
  background: rgba(255, 140, 0, 0.2);
  border-color: var(--accent-orange);
  color: #fff;
  box-shadow: 0 0 20px rgba(255, 140, 0, 0.4);
  animation: selectPulse 0.4s infinite alternate;
}

.option-btn.correct {
  background: rgba(46, 204, 113, 0.25);
  border-color: var(--correct-green);
  color: #fff;
  box-shadow: 0 0 25px rgba(46, 204, 113, 0.5);
  animation: correctFlash 0.5s ease-in-out 3;
}

.option-btn.wrong {
  background: rgba(231, 76, 96, 0.25);
  border-color: var(--wrong-red);
  color: #fff;
  box-shadow: 0 0 25px rgba(231, 76, 96, 0.5);
}

@keyframes selectPulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.015); }
}

@keyframes correctFlash {
  0%, 100% { background: rgba(46, 204, 113, 0.25); border-color: var(--correct-green); }
  50% { background: rgba(46, 204, 113, 0.6); border-color: #fff; }
}

/* Bottom Action Bar */
.action-bar {
  display: flex;
  justify-content: flex-end;
}

.withdraw-btn {
  background: rgba(231, 76, 60, 0.15);
  border: 1px solid rgba(231, 76, 60, 0.3);
  color: var(--wrong-red);
  padding: 10px 24px;
  border-radius: 30px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.withdraw-btn:hover:not(:disabled) {
  background: var(--wrong-red);
  color: #fff;
  box-shadow: 0 0 15px rgba(231, 76, 60, 0.4);
}

.withdraw-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Right Board: Money Tree */
.money-sidebar {
  flex: 1;
  background: var(--panel-bg);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid var(--border-light);
  border-radius: 24px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
}

.sidebar-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  text-align: center;
  margin-bottom: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 8px;
}

.money-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.money-level {
  display: flex;
  justify-content: space-between;
  padding: 7px 15px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.3s ease;
}

.money-level .level-num {
  font-variant-numeric: tabular-nums;
  opacity: 0.6;
}

.money-level.milestone {
  color: var(--text-light);
  font-weight: 800;
}

.money-level.milestone .level-val {
  color: var(--accent-gold);
}

.money-level.passed {
  color: rgba(255, 255, 255, 0.4);
  text-decoration: line-through;
}

.money-level.passed .level-val {
  color: rgba(255, 215, 0, 0.3);
}

.money-level.active {
  background: linear-gradient(90deg, rgba(255, 140, 0, 0.3), rgba(255, 215, 0, 0.15));
  border: 1px solid var(--accent-orange);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 0 12px rgba(255, 140, 0, 0.3);
  transform: scale(1.02);
}

.money-level.active .level-val {
  color: var(--accent-gold);
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
}


/* ================= MODALS ================= */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(4, 6, 15, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: #0f142a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: 30px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(54, 83, 238, 0.25);
  position: relative;
  transform: scale(0.9);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal.active .modal-content {
  transform: scale(1);
}

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

.modal-header h3 {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  color: var(--accent-gold);
}

.close-modal-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  transition: color 0.3s ease;
}

.close-modal-btn:hover {
  color: var(--wrong-red);
}

/* Audience Chart Layout */
.audience-chart {
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  height: 220px;
  padding: 20px 10px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

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

.chart-bar-container {
  height: 150px;
  width: 24px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
}

.chart-bar {
  width: 100%;
  height: 0%;
  background: linear-gradient(180deg, var(--accent-gold), var(--accent-orange));
  border-radius: 12px;
  box-shadow: 0 0 10px rgba(255, 140, 0, 0.5);
  transition: height 1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chart-percent {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-light);
}

.chart-label {
  font-size: 14px;
  font-weight: 800;
  color: var(--accent-orange);
}

/* Phone Joker Select layout */
.characters-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}

.char-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1.5px solid var(--border-light);
  border-radius: 16px;
  padding: 15px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  transition: all 0.3s ease;
}

.char-btn:hover {
  background: rgba(54, 83, 238, 0.1);
  border-color: rgba(54, 83, 238, 0.6);
  transform: translateY(-2px);
}

.char-avatar {
  width: 55px;
  height: 55px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  border: 2.5px solid rgba(255, 255, 255, 0.2);
}

.avatar-nephi { background: radial-gradient(circle, #2193b0, #6dd5ed); }
.avatar-lehi { background: radial-gradient(circle, #ffe259, #ffa751); }
.avatar-sariah { background: radial-gradient(circle, #ff0844, #ffb199); }
.avatar-laman { background: radial-gradient(circle, #373b44, #4286f4); }

.char-name {
  font-weight: 800;
  font-size: 15px;
  color: var(--text-light);
}

.char-accuracy {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Calling Screen style */
.caller-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  margin: 10px 0;
}

.caller-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  font-size: 32px;
  font-weight: 800;
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 0 25px rgba(0, 0, 0, 0.5);
  animation: pulseAvatar 1.5s infinite alternate;
}

@keyframes pulseAvatar {
  0% { transform: scale(1); box-shadow: 0 0 15px rgba(255,255,255,0.1); }
  100% { transform: scale(1.05); box-shadow: 0 0 25px var(--primary-glow); }
}

.caller-name-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-light);
}

.call-status {
  font-size: 14px;
  color: var(--accent-gold);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.call-dialogue {
  background: rgba(0, 0, 0, 0.4);
  border-radius: 12px;
  padding: 18px 22px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-style: italic;
  font-size: 15px;
  line-height: 1.6;
  color: #d1d5db;
  text-align: center;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.5s ease;
}

.call-dialogue.active {
  opacity: 1;
  transform: translateY(0);
}


/* ================= END SCREENS ================= */
.end-card {
  margin: auto;
  max-width: 500px;
  background: var(--panel-bg);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid var(--border-light);
  border-radius: 24px;
  padding: 40px;
  text-align: center;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 25px;
}

.end-card h2 {
  font-family: 'Playfair Display', serif;
  font-size: 36px;
}

.end-card.win-card h2 {
  background: linear-gradient(135deg, #FFF 20%, var(--accent-gold) 60%, var(--accent-orange) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.reward-badge {
  background: rgba(255, 215, 0, 0.15);
  border: 2px dashed var(--accent-gold);
  padding: 20px 40px;
  border-radius: 50px;
  font-size: 32px;
  font-weight: 800;
  color: var(--accent-gold);
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
  margin: 10px 0;
}

.badge-win-confetti {
  animation: prizeScale 0.8s infinite alternate cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes prizeScale {
  0% { transform: scale(1); }
  100% { transform: scale(1.06); }
}


/* ================= RESPONSIVE LAYOUT ================= */
@media (max-width: 900px) {
  .game-layout {
    flex-direction: column;
  }
  .money-sidebar {
    order: -1; /* Display level bar at the top or toggleable */
    flex: none;
    height: 90px;
    padding: 10px 15px;
  }
  .money-sidebar .sidebar-title {
    display: none;
  }
  .money-list {
    flex-direction: row;
    overflow-x: auto;
    white-space: nowrap;
    gap: 8px;
    padding-bottom: 5px;
  }
  .money-level {
    flex-direction: column;
    align-items: center;
    padding: 6px 12px;
    font-size: 11px;
    gap: 2px;
  }
  .money-level .level-num {
    opacity: 0.8;
  }
}

@media (max-width: 600px) {
  .answers-grid {
    grid-template-columns: 1fr;
  }
  .welcome-card, .end-card, .modal-content {
    padding: 20px;
    margin: 10px;
  }
  .welcome-title h2 {
    font-size: 28px;
  }
  .option-btn {
    padding: 14px 18px;
    font-size: 14px;
  }
  .jokers-panel {
    flex-direction: column;
    gap: 10px;
    padding: 10px 15px;
  }
  .joker-buttons {
    width: 100%;
    justify-content: space-around;
  }
  .joker-btn {
    padding: 8px 14px;
    font-size: 12px;
  }
}
