:root {
  --bg-obsidian: #050614;
  --bg-indigo: #0c1238;
  --bg-violet: #1b0a3a;
  --gold-bright: #ffe680;
  --gold-primary: #eab308;
  --gold-deep: #a16207;
  --cyan-glow: #38bdf8;
  --emerald-win: #10b981;
  --crimson-fail: #ef4444;
  --glass-surface: rgba(12, 19, 58, 0.78);
  --glass-border: rgba(234, 179, 8, 0.45);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html, body {
  width: 100%;
  min-height: 100dvh;
  background: radial-gradient(circle at 50% 0%, #24104f 0%, #090d2c 55%, #03040c 100%);
  color: var(--text-main);
  font-family: 'Plus Jakarta Sans', sans-serif;
  overflow-x: hidden;
}

#bg-particles,
#confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

#confetti-canvas {
  z-index: 999;
}

.app-shell {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 1400px;
  margin: 0 auto;
}

/* TOPBAR */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: rgba(5, 7, 24, 0.88);
  border-bottom: 1px solid var(--glass-border);
  backdrop-filter: blur(14px);
  gap: 8px;
}

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

.brand-emblem {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold-deep));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 0 15px rgba(234, 179, 8, 0.5);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: 'Cinzel', serif;
  font-weight: 900;
  font-size: 0.95rem;
  letter-spacing: 1px;
  color: var(--gold-bright);
}

.brand-sub {
  font-size: 0.62rem;
  letter-spacing: 2px;
  color: var(--cyan-glow);
  font-weight: 700;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.pill-btn,
.icon-btn {
  background: rgba(18, 28, 78, 0.9);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  justify-content: center;
  font-size: 0.95rem;
}

.icon-btn.active,
.lang-pill {
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.28), rgba(161, 98, 7, 0.45));
  border-color: var(--gold-bright);
  color: var(--gold-bright);
  box-shadow: 0 0 12px rgba(234, 179, 8, 0.25);
}

.ladder-toggle-btn {
  display: none;
  background: linear-gradient(90deg, #b45309, #eab308);
  color: #050614;
  border-color: #fff;
}

/* SCREENS */
.screen {
  display: none;
  flex: 1;
  padding: 14px 16px;
}

.screen.active {
  display: flex;
  flex-direction: column;
  justify-content: center;
  animation: screenEnter 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* START / LOBBY SCREEN */
.hero-card {
  margin: auto;
  width: 100%;
  max-width: 540px;
  background: var(--glass-surface);
  border: 1.5px solid var(--glass-border);
  border-radius: 24px;
  padding: 26px 22px;
  backdrop-filter: blur(18px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75), 0 0 40px rgba(234, 179, 8, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

.kbc-ring-stage {
  position: relative;
  width: 210px;
  height: 210px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

.ring-1 {
  border: 3px dashed var(--gold-primary);
  box-shadow: 0 0 30px rgba(234, 179, 8, 0.4);
  animation: orbitCW 22s linear infinite;
}

.ring-2 {
  inset: 12px;
  border: 2px solid var(--cyan-glow);
  box-shadow: inset 0 0 20px rgba(56, 189, 248, 0.45);
  animation: orbitCCW 14s linear infinite;
}

@keyframes orbitCW { to { transform: rotate(360deg); } }
@keyframes orbitCCW { to { transform: rotate(-360deg); } }

.ring-core {
  width: 168px;
  height: 168px;
  border-radius: 50%;
  background: radial-gradient(circle, #2e1065 0%, #090d2a 85%);
  border: 2.5px solid var(--gold-bright);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px;
  z-index: 1;
}

.core-crown {
  font-size: 1.6rem;
}

.ring-core h1 {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  line-height: 1.25;
  color: #fff;
  margin-top: 4px;
}

.ring-core h1 span {
  font-size: 1.25rem;
  color: var(--gold-bright);
  text-shadow: 0 0 12px rgba(255, 230, 128, 0.8);
}

.ring-core p {
  font-size: 0.56rem;
  letter-spacing: 1.5px;
  color: var(--cyan-glow);
  margin-top: 5px;
  font-weight: 700;
}

.setup-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

.input-group label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--gold-bright);
}

.input-group input,
.input-group select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid rgba(234, 179, 8, 0.4);
  background: rgba(5, 8, 28, 0.92);
  color: #fff;
  font-size: 0.92rem;
  font-family: inherit;
  font-weight: 600;
  outline: none;
}

.input-group input:focus,
.input-group select:focus {
  border-color: var(--gold-bright);
  box-shadow: 0 0 14px rgba(234, 179, 8, 0.35);
}

.cta-primary-btn {
  width: 100%;
  padding: 15px 24px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(90deg, #ca8a04 0%, #fde047 50%, #ca8a04 100%);
  color: #050614;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 10px 28px rgba(234, 179, 8, 0.45);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cta-primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(234, 179, 8, 0.7);
}

/* GAME ARENA LAYOUT */
.arena-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 18px;
  align-items: stretch;
  width: 100%;
  margin: auto 0;
}

.stage-column {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

/* HUD BAR */
.hud-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.hud-card {
  background: var(--glass-surface);
  border: 1.5px solid var(--glass-border);
  border-radius: 16px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.prize-card {
  text-align: right;
}

.hud-label {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 1.2px;
  color: var(--text-muted);
}

.hud-val {
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gold-text {
  color: var(--gold-bright);
  text-shadow: 0 0 12px rgba(255, 230, 128, 0.45);
}

/* 3D NEON CLOCK POD */
.clock-pod {
  position: relative;
  width: 78px;
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, #172554 0%, #05081c 100%);
  border-radius: 50%;
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.35);
}

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

.clock-track {
  fill: none;
  stroke: rgba(148, 163, 184, 0.2);
  stroke-width: 7;
}

.clock-fill {
  fill: none;
  stroke: var(--gold-bright);
  stroke-width: 7;
  stroke-dasharray: 263.89;
  stroke-dashoffset: 0;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear, stroke 0.3s ease;
}

.clock-digits {
  position: absolute;
  font-family: 'Cinzel', serif;
  font-size: 1.4rem;
  font-weight: 900;
  color: #fff;
}

.timer-danger .clock-fill {
  stroke: var(--crimson-fail);
}

.timer-danger .clock-digits {
  color: var(--crimson-fail);
  animation: beatUrgent 0.4s infinite alternate;
}

@keyframes beatUrgent {
  from { transform: scale(1); }
  to { transform: scale(1.22); }
}

/* HOST DIALOGUE STRIP */
.host-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(90deg, rgba(30, 12, 64, 0.9), rgba(12, 22, 68, 0.9));
  border: 1px solid rgba(234, 179, 8, 0.4);
  border-radius: 14px;
  padding: 10px 14px;
}

.host-mic-pulse {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-primary), var(--gold-deep));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 12px rgba(234, 179, 8, 0.5);
}

#host-dialogue {
  font-size: 0.88rem;
  color: #e2e8f0;
  font-style: italic;
  line-height: 1.35;
}

/* META BADGES */
.meta-strip {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.meta-badge {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(234, 179, 8, 0.4);
  color: var(--gold-bright);
}

.diff-badge {
  color: var(--cyan-glow);
  border-color: rgba(56, 189, 248, 0.45);
}

/* HEXAGONAL QUESTION & OPTIONS */
.hex-question-container,
.options-pair {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.beam-line {
  position: absolute;
  left: -12px;
  right: -12px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-primary), var(--gold-bright), var(--gold-primary), transparent);
  z-index: 0;
}

.hex-question-card {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 104px;
  padding: 20px 30px;
  background: linear-gradient(180deg, #132266 0%, #070e33 100%);
  border: 2px solid var(--gold-primary);
  border-radius: 18px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.75), inset 0 0 24px rgba(234, 179, 8, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

#question-text {
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.45;
  color: #ffffff;
}

.options-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.options-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.hex-option-btn {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 58px;
  padding: 12px 18px;
  background: linear-gradient(180deg, #101c54 0%, #070c2b 100%);
  border: 2px solid rgba(234, 179, 8, 0.65);
  border-radius: 14px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  font-size: 0.96rem;
  font-weight: 600;
  transition: all 0.2s ease;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}

.opt-key {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(234, 179, 8, 0.18);
  border: 1px solid var(--gold-bright);
  color: var(--gold-bright);
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.opt-label {
  flex: 1;
  line-height: 1.3;
}

.hex-option-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #1d3587 0%, #0c1747 100%);
  border-color: var(--gold-bright);
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(234, 179, 8, 0.3);
}

.hex-option-btn.selected {
  background: linear-gradient(180deg, #f59e0b 0%, #b45309 100%);
  border-color: #fff;
  color: #050614;
  font-weight: 800;
}

.hex-option-btn.selected .opt-key {
  background: #050614;
  color: var(--gold-bright);
}

.hex-option-btn.locked {
  background: linear-gradient(180deg, #fbbf24 0%, #d97706 100%);
  animation: pulseLock 0.5s infinite alternate;
}

@keyframes pulseLock {
  from { box-shadow: 0 0 15px rgba(251, 191, 36, 0.5); }
  to { box-shadow: 0 0 32px rgba(251, 191, 36, 0.95); }
}

.hex-option-btn.correct {
  background: linear-gradient(180deg, #10b981 0%, #047857 100%) !important;
  border-color: #a7f3d0 !important;
  color: #fff !important;
  box-shadow: 0 0 28px rgba(16, 185, 129, 0.75) !important;
}

.hex-option-btn.wrong {
  background: linear-gradient(180deg, #ef4444 0%, #991b1b 100%) !important;
  border-color: #fecaca !important;
  color: #fff !important;
  animation: shakeError 0.45s ease-in-out;
}

@keyframes shakeError {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.hex-option-btn.eliminated {
  opacity: 0.2;
  pointer-events: none;
  filter: grayscale(1);
}

/* CONTROLS DOCK: LIFELINES & ACTION BUTTONS */
.controls-dock {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lifeline-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.ll-orb {
  background: radial-gradient(circle at 50% 20%, #1e3a8a, #091034);
  border: 1.5px solid var(--gold-primary);
  border-radius: 14px;
  padding: 8px 6px;
  color: var(--gold-bright);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: all 0.2s ease;
}

.ll-orb strong {
  font-size: 0.95rem;
}

.ll-orb span {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #cbd5e1;
}

.ll-orb:hover:not(:disabled) {
  border-color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(234, 179, 8, 0.4);
}

.ll-orb.used {
  opacity: 0.28;
  filter: grayscale(1);
  cursor: not-allowed;
}

.decision-bar {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
}

.decision-btn {
  padding: 14px 18px;
  border-radius: 14px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.6px;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.lock-btn {
  background: linear-gradient(90deg, #eab308, #f59e0b);
  color: #050614;
  box-shadow: 0 6px 20px rgba(234, 179, 8, 0.4);
}

.lock-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  box-shadow: none;
}

.next-btn {
  background: linear-gradient(90deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 6px 22px rgba(16, 185, 129, 0.55);
}

.quit-btn {
  background: rgba(127, 29, 29, 0.8);
  border: 1.5px solid #ef4444;
  color: #fecaca;
}

.hidden {
  display: none !important;
}

/* PRIZE LADDER SIDEBAR */
.ladder-sidebar {
  background: var(--glass-surface);
  border: 1.5px solid var(--glass-border);
  border-radius: 20px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.ladder-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  font-weight: 900;
  color: var(--gold-bright);
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(234, 179, 8, 0.3);
  margin-bottom: 8px;
}

.close-drawer-btn {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
}

.ladder-list {
  list-style: none;
  display: flex;
  flex-direction: column-reverse;
  gap: 3px;
}

.ladder-item {
  display: flex;
  justify-content: space-between;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #94a3b8;
}

.ladder-item.safe {
  color: #f8fafc;
  font-weight: 800;
}

.ladder-item.active {
  background: linear-gradient(90deg, #eab308, #ca8a04);
  color: #050614;
  font-weight: 900;
  box-shadow: 0 0 12px rgba(234, 179, 8, 0.6);
}

.ladder-item.passed {
  color: var(--emerald-win);
}

/* FINALE CHEQUE CARD */
.finale-card {
  margin: auto;
  width: 100%;
  max-width: 600px;
  background: var(--glass-surface);
  border: 2px solid var(--gold-bright);
  border-radius: 24px;
  padding: 28px 22px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.85);
}

.finale-badge {
  font-size: 3.6rem;
  margin-bottom: 6px;
}

.royal-cheque {
  margin: 20px 0;
  background: linear-gradient(135deg, #fefce8 0%, #fef08a 100%);
  color: #0f172a;
  border: 3px double #854d0e;
  border-radius: 16px;
  padding: 18px;
  text-align: left;
}

.cheque-header,
.cheque-footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  font-weight: 800;
  color: #713f12;
}

.cheque-body {
  margin: 14px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cheque-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px dashed #a16207;
  padding-bottom: 6px;
  font-size: 0.9rem;
}

.prize-highlight strong {
  font-size: 1.35rem;
  color: #047857;
  font-weight: 900;
}

.verified-seal {
  color: #15803d;
  border: 1.5px solid #15803d;
  padding: 2px 8px;
  border-radius: 6px;
}

/* MODAL */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 5, 18, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 500;
}

.modal-dialog {
  width: 100%;
  max-width: 460px;
  background: linear-gradient(180deg, #131f5c 0%, #070c28 100%);
  border: 2px solid var(--gold-bright);
  border-radius: 22px;
  padding: 22px;
  text-align: center;
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.85);
}

.modal-top h3 {
  font-family: 'Cinzel', serif;
  color: var(--gold-bright);
  margin-bottom: 14px;
}

.modal-content {
  margin-bottom: 18px;
}

.poll-grid {
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  height: 160px;
  padding: 14px 8px 6px;
  border-bottom: 2px solid rgba(234, 179, 8, 0.5);
}

.poll-bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 48px;
}

.poll-bar {
  width: 100%;
  background: linear-gradient(180deg, var(--gold-bright), #b45309);
  border-radius: 8px 8px 0 0;
}

/* MOBILE PORTRAIT OPTIMIZATION (100% Phone Aspect Ratio Fit) */
@media (max-width: 920px) {
  .arena-grid {
    grid-template-columns: 1fr;
  }

  .ladder-toggle-btn {
    display: inline-flex;
  }

  .ladder-sidebar {
    position: fixed;
    top: 0;
    right: -340px;
    width: 290px;
    height: 100dvh;
    z-index: 600;
    border-radius: 20px 0 0 20px;
    transition: right 0.3s ease;
    background: #070c29;
  }

  .ladder-sidebar.open {
    right: 0;
    box-shadow: -15px 0 45px rgba(0, 0, 0, 0.9);
  }

  .close-drawer-btn {
    display: block;
  }
}

@media (max-width: 600px) {
  .topbar {
    padding: 8px 10px;
  }

  .brand-title {
    font-size: 0.82rem;
  }

  .form-row,
  .options-pair {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .hex-question-card {
    min-height: 88px;
    padding: 16px 18px;
  }

  #question-text {
    font-size: 0.98rem;
  }

  .hex-option-btn {
    min-height: 50px;
    padding: 10px 14px;
    font-size: 0.9rem;
  }

  .clock-pod,
  .clock-svg {
    width: 64px;
    height: 64px;
  }

  .clock-digits {
    font-size: 1.15rem;
  }

  .decision-bar {
    grid-template-columns: 1fr;
  }
}
