@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Rajdhani:wght@400;600;700&display=swap');

:root {
  --bg-primary: #0a0a2e;
  --bg-secondary: #12124a;
  --bg-card: rgba(255,255,255,0.06);
  --gold: #ffd700;
  --gold-dim: #b8960f;
  --blue: #0088ff;
  --red: #ff3344;
  --green: #00cc66;
  --yellow: #ffcc00;
  --orange: #ff8800;
  --text: #ffffff;
  --text-dim: #8899bb;
  --safe: #00ff88;
  --danger: #ff3344;
}

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

html { font-size: 16px; }

body {
  font-family: 'Rajdhani', sans-serif;
  background: var(--bg-primary);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(0,100,255,0.08) 0%, transparent 70%),
              radial-gradient(ellipse at 50% 100%, rgba(255,215,0,0.05) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

h1, h2, h3 { font-family: 'Orbitron', sans-serif; font-weight: 700; }
h1 { font-size: clamp(1.4em, 5vw, 2.5em); }
h2 { font-size: clamp(1.2em, 4vw, 1.8em); }
h3 { font-size: clamp(1em, 3vw, 1.3em); }

.container { position: relative; z-index: 1; max-width: 1800px; margin: 0 auto; padding: clamp(10px, 2vw, 20px); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: clamp(10px, 2vw, 14px) clamp(16px, 3vw, 32px);
  border: none; border-radius: 12px;
  font-family: 'Rajdhani', sans-serif; font-size: clamp(0.9em, 2vw, 1.2em); font-weight: 700;
  cursor: pointer; transition: all 0.2s; text-decoration: none;
  text-transform: uppercase; letter-spacing: 1px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(0,0,0,0.3); }
.btn:active { transform: translateY(0); }

.btn-gold { background: linear-gradient(135deg, var(--gold), var(--gold-dim)); color: #1a1a3e; }
.btn-blue { background: linear-gradient(135deg, #0066cc, #004499); color: white; }
.btn-red { background: linear-gradient(135deg, #cc2233, #991122); color: white; }
.btn-green { background: linear-gradient(135deg, var(--green), #009944); color: white; }
.btn-small { padding: 8px 16px; font-size: clamp(0.75em, 1.5vw, 0.9em); }

.card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: clamp(16px, 3vw, 24px);
  backdrop-filter: blur(10px);
}

.glow-gold { box-shadow: 0 0 30px rgba(255,215,0,0.1); border-color: rgba(255,215,0,0.3); }
.glow-blue { box-shadow: 0 0 30px rgba(0,136,255,0.1); border-color: rgba(0,136,255,0.3); }

.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.flex-col { display: flex; flex-direction: column; }
.gap-10 { gap: 10px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-30 { gap: 30px; }
.text-center { text-align: center; }
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }
.mb-20 { margin-bottom: 20px; }
.w-full { width: 100%; }

.title-glow {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(1.4em, 6vw, 2.8em);
  font-weight: 900;
  background: linear-gradient(135deg, var(--gold), #fff4a0, var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 0 20px rgba(255,215,0,0.3));
}

.input {
  width: 100%; padding: clamp(10px, 2vw, 14px) clamp(12px, 2vw, 18px);
  background: rgba(255,255,255,0.08);
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 12px; color: white;
  font-family: 'Rajdhani', sans-serif; font-size: clamp(0.95em, 2vw, 1.1em);
  transition: all 0.2s;
}
.input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 20px rgba(255,215,0,0.15); }
.input::placeholder { color: rgba(255,255,255,0.3); }

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238899bb' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}
select.input option { background: #1a1a3e; color: white; }

/* Landing Page */
.landing {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(12px, 3vw, 20px);
}
.landing-inner { max-width: 500px; width: 100%; text-align: center; }
.landing .subtitle { color: var(--text-dim); font-size: clamp(0.9em, 2vw, 1.1em); margin: 10px 0 40px; }

/* Host Lobby */
.lobby-qr { text-align: center; margin: clamp(16px, 3vw, 30px) 0; }
.lobby-qr img { width: min(220px, 60vw); height: min(220px, 60vw); border-radius: 16px; background: white; padding: 12px; }
.lobby-code {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(1.4em, 5vw, 2.2em);
  font-weight: 900;
  color: var(--gold);
  letter-spacing: clamp(4px, 1.5vw, 8px);
  margin: 10px 0;
}
.lobby-url { color: var(--text-dim); font-size: 0.9em; word-break: break-all; }
.player-grid {
  display: flex; flex-wrap: wrap; gap: 8px;
  max-height: 300px; overflow-y: auto; padding: 10px 0;
}
.player-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; background: rgba(255,255,255,0.08);
  border-radius: 20px; font-size: clamp(0.8em, 1.5vw, 0.95em); font-weight: 600;
}
.player-chip .status { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.player-chip .status.alive { background: var(--green); }
.player-chip .status.out { background: var(--red); }

/* Host Game */
.game-layout {
  display: grid;
  grid-template-columns: clamp(260px, 32vw, 540px) 1fr;
  gap: clamp(12px, 1.5vw, 28px);
  min-height: calc(100vh - 40px);
  min-height: calc(100dvh - 40px);
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow: hidden;
}

.ladder {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: clamp(6px, 0.6vw, 12px);
  display: flex;
  flex-direction: column-reverse;
  gap: 2px;
  overflow-y: auto;
  max-height: 100%;
}

.ladder-step {
  display: flex; align-items: center; justify-content: space-between;
  padding: clamp(4px, 0.5vw, 10px) clamp(8px, 1vw, 18px);
  border-radius: clamp(6px, 0.5vw, 10px);
  font-size: clamp(0.85em, 1.1vw, 1.3em);
  font-weight: 600;
  transition: all 0.3s;
  position: relative;
  min-height: clamp(30px, 3.2vh, 52px);
  flex-shrink: 0;
}

.ladder-step .level {
  color: var(--text-dim);
  font-size: 0.8em;
  width: clamp(18px, 1.5vw, 30px);
}

.ladder-step .amount {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(0.85em, 1.1vw, 1.3em);
  color: var(--text-dim);
}

.ladder-step .marker {
  width: clamp(12px, 1.2vw, 22px);
  height: clamp(12px, 1.2vw, 22px);
  border-radius: 50%;
  border: 2px solid transparent;
  flex-shrink: 0;
}

.ladder-step.current {
  background: linear-gradient(90deg, rgba(255,215,0,0.2), transparent);
  border: 1px solid rgba(255,215,0,0.3);
}
.ladder-step.current .amount { color: var(--gold); font-weight: 900; }
.ladder-step.done { opacity: 0.4; }
.ladder-step.safe .amount { color: var(--safe); }
.ladder-step.safe::after {
  content: '★';
  color: var(--safe);
  position: absolute;
  right: 10px;
  font-size: 0.8em;
}

/* Question Area */
.question-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow-y: auto;
}

.question-header {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: clamp(8px, 2vw, 12px) clamp(12px, 2vw, 16px);
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  flex-shrink: 0;
}

.question-progress {
  font-family: 'Orbitron', sans-serif;
  color: var(--gold);
  font-size: clamp(0.8em, 1.5vw, 0.95em);
}

.question-image {
  width: 100%; max-height: 200px;
  object-fit: contain; border-radius: 12px;
  background: rgba(0,0,0,0.3);
  flex-shrink: 0;
}

.question-text {
  font-size: clamp(1.2em, 2.5vw, 2em);
  font-weight: 700;
  line-height: 1.4;
  padding: clamp(12px, 2vw, 24px);
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  text-align: center;
  flex-shrink: 0;
}

.answers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(8px, 1vw, 16px);
  flex-shrink: 0;
}

.answer-btn {
  display: flex; align-items: center; gap: clamp(8px, 1vw, 16px);
  padding: clamp(10px, 1.5vw, 20px) clamp(10px, 1.5vw, 22px);
  min-height: clamp(44px, 4vh, 60px);
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  background: var(--bg-card);
  color: white;
  font-family: 'Rajdhani', sans-serif;
  font-size: clamp(0.9em, 1.6vw, 1.35em);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.answer-btn:hover { background: rgba(255,255,255,0.12); }
.answer-btn .letter {
  width: clamp(30px, 3.5vw, 48px);
  height: clamp(30px, 3.5vw, 48px);
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-weight: 900;
  font-size: clamp(0.85em, 1.6vw, 1.3em);
  flex-shrink: 0;
}
.answer-btn .letter.a { background: var(--yellow); color: #1a1a3e; }
.answer-btn .letter.b { background: var(--blue); color: white; }
.answer-btn .letter.c { background: var(--red); color: white; }
.answer-btn .letter.d { background: var(--green); color: white; }

.answer-btn.correct { border-color: var(--green); background: rgba(0,204,102,0.15); }
.answer-btn.correct .letter { background: var(--green); color: white; }
.answer-btn.wrong { border-color: var(--red); background: rgba(255,51,68,0.15); }
.answer-btn.wrong .letter { background: var(--red); color: white; }
.answer-btn.revealed { border-color: rgba(255,255,255,0.3); }
.answer-btn.disabled { opacity: 0.5; cursor: default; }

/* Answer Progress */
.answer-progress {
  padding: clamp(12px, 2vw, 16px);
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  text-align: center;
}
.answer-progress .count { font-size: clamp(1.2em, 3vw, 1.8em); font-weight: 900; color: var(--gold); }
.answer-progress .bar-track {
  width: 100%; height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px; margin: 10px 0; overflow: hidden;
}
.answer-progress .bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--orange));
  border-radius: 4px;
  transition: width 0.3s;
}

/* Players Bar */
.players-bar {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: clamp(8px, 2vw, 12px) clamp(12px, 2vw, 16px);
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  max-height: 120px;
  overflow-y: auto;
}
.player-tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 12px;
  border-radius: 14px;
  font-size: clamp(0.75em, 1.2vw, 0.85em);
  font-weight: 600;
}
.player-tag.alive { background: rgba(0,204,102,0.15); color: var(--green); }
.player-tag.out { background: rgba(255,51,68,0.15); color: var(--red); }

/* Player View */
.player-view {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: clamp(6px, 1.5vw, 16px);
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
}

.player-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: clamp(8px, 1.5vw, 12px) clamp(10px, 1.5vw, 16px);
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  margin-bottom: clamp(6px, 1.5vw, 16px);
}

.player-header .room-badge {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(0.7em, 1.8vw, 0.85em);
  color: var(--gold);
  letter-spacing: 2px;
}

.player-header .name-badge {
  font-weight: 700;
  color: var(--text);
  font-size: clamp(0.8em, 1.8vw, 1em);
}

.player-question-image {
  width: 100%; max-height: min(160px, 25vh);
  object-fit: contain; border-radius: 12px;
  margin-bottom: 8px;
  background: rgba(0,0,0,0.3);
}

.player-question-text {
  font-size: clamp(1.05em, 3.5vw, 1.4em);
  font-weight: 700;
  text-align: center;
  padding: clamp(10px, 2.5vw, 20px);
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  margin-bottom: clamp(8px, 2vw, 18px);
  line-height: 1.4;
  flex-shrink: 0;
}

#questionArea {
  min-height: 0;
}

.player-answers {
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 1.5vw, 10px);
  flex: 1;
  justify-content: space-evenly;
  min-height: 0;
}

.player-answer-btn {
  display: flex; align-items: center; gap: clamp(10px, 1.8vw, 16px);
  width: 100%; padding: clamp(14px, 2.5vw, 22px) clamp(12px, 2.5vw, 24px);
  min-height: 48px;
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 14px;
  background: var(--bg-card);
  color: white;
  font-family: 'Rajdhani', sans-serif;
  font-size: clamp(1em, 2.8vw, 1.3em);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  flex: 1 0 auto;
}
.player-answer-btn:active { transform: scale(0.98); }
.player-answer-btn .letter {
  width: clamp(34px, 7vw, 48px);
  height: clamp(34px, 7vw, 48px);
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-weight: 900;
  font-size: clamp(1em, 2.8vw, 1.3em);
  flex-shrink: 0;
}
.player-answer-btn .letter.a { background: var(--yellow); color: #1a1a3e; }
.player-answer-btn .letter.b { background: var(--blue); color: white; }
.player-answer-btn .letter.c { background: var(--red); color: white; }
.player-answer-btn .letter.d { background: var(--green); color: white; }

.player-answer-btn.selected { border-color: var(--gold); background: rgba(255,215,0,0.1); }
.player-answer-btn.correct { border-color: var(--green) !important; background: rgba(0,204,102,0.15) !important; }
.player-answer-btn.correct .letter { background: var(--green) !important; color: white; }
.player-answer-btn.wrong { border-color: var(--red) !important; background: rgba(255,51,68,0.15) !important; }
.player-answer-btn.wrong .letter { background: var(--red) !important; color: white; }
.player-answer-btn.disabled { opacity: 0.6; cursor: default; }
.player-answer-btn.disabled:active { transform: none; }

.player-status {
  text-align: center;
  padding: clamp(8px, 2vw, 20px);
  font-size: clamp(0.9em, 2.5vw, 1.2em);
  font-weight: 600;
}

.player-status.waiting { color: var(--text-dim); }
.player-status.answered { color: var(--gold); }
.player-status.correct { color: var(--green); }
.player-status.wrong { color: var(--red); }
.player-status.eliminated { color: var(--red); }

/* Editor */
.editor-layout {
  max-width: 1000px;
  margin: 0 auto;
  padding: clamp(10px, 2vw, 20px);
}

.editor-top-bar {
  margin-bottom: clamp(16px, 3vw, 30px);
}

.quiz-bar {
  margin-bottom: 16px;
}

.quiz-selector-group label {
  display: block;
  margin-bottom: 6px;
}

.quiz-select-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.quiz-select-row select {
  min-width: 150px;
}

.quiz-name-bar {
  padding: clamp(10px, 2vw, 14px) clamp(14px, 3vw, 20px);
  background: rgba(255,215,0,0.06);
  border: 1px solid rgba(255,215,0,0.2);
  border-radius: 12px;
  margin-bottom: 16px;
}

.save-status {
  padding: 12px 20px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-weight: 600;
  text-align: center;
  border: 1px solid;
}

.editor-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.editor-item {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.2s;
}

.editor-item-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: clamp(10px, 2vw, 14px) clamp(14px, 2vw, 20px);
  cursor: pointer;
  transition: background 0.2s;
  gap: 8px;
}
.editor-item-header:hover { background: rgba(255,255,255,0.05); }
.editor-item-header .q-number {
  font-family: 'Orbitron', sans-serif;
  color: var(--gold);
  font-size: 0.9em;
  width: 50px;
  flex-shrink: 0;
}
.editor-item-header .q-preview {
  flex: 1; margin: 0 12px;
  color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-size: clamp(0.8em, 1.5vw, 0.95em);
}
.editor-item-header .q-money {
  font-family: 'Orbitron', sans-serif;
  color: var(--text-dim);
  font-size: clamp(0.7em, 1.2vw, 0.85em);
  width: auto;
  text-align: right;
  flex-shrink: 0;
}
.editor-item-header .expand-icon {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  font-size: 0.8em;
  transition: transform 0.2s;
  margin-left: 8px;
  flex-shrink: 0;
}
.editor-item.open .expand-icon { transform: rotate(180deg); }

.editor-item-body {
  display: none;
  padding: clamp(14px, 3vw, 20px);
  border-top: 1px solid rgba(255,255,255,0.1);
}
.editor-item.open .editor-item-body { display: block; }

.editor-field { margin-bottom: 16px; }
.editor-field label {
  display: block; margin-bottom: 6px;
  font-weight: 600; color: var(--text-dim); font-size: 0.9em;
  text-transform: uppercase; letter-spacing: 1px;
}
.editor-field input, .editor-field textarea, .editor-field select {
  width: 100%; padding: 10px 14px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px; color: white;
  font-family: 'Rajdhani', sans-serif; font-size: 1em;
}
.editor-field textarea { min-height: 60px; resize: vertical; }
.editor-field input:focus, .editor-field textarea:focus {
  outline: none; border-color: var(--gold);
}

.img-upload-row {
  gap: 8px;
}

.editor-answers .answer-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.editor-answers .answer-row .letter-badge {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-weight: 900; font-size: 0.9em;
  flex-shrink: 0;
}
.editor-answers .answer-row .letter-badge.a { background: var(--yellow); color: #1a1a3e; }
.editor-answers .answer-row .letter-badge.b { background: var(--blue); color: white; }
.editor-answers .answer-row .letter-badge.c { background: var(--red); color: white; }
.editor-answers .answer-row .letter-badge.d { background: var(--green); color: white; }
.editor-answers .answer-row input { flex: 1; min-width: 100px; }
.editor-answers .answer-row .correct-radio {
  width: 20px; height: 20px; cursor: pointer;
  accent-color: var(--gold);
  flex-shrink: 0;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 20px;
  padding: clamp(20px, 4vw, 32px);
  max-width: 440px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.editor-image-preview {
  max-width: 100%;
  max-height: 120px;
  border-radius: 8px;
  margin-top: 8px;
  background: rgba(0,0,0,0.3);
}

/* Results */
.results-screen {
  text-align: center;
  padding: clamp(20px, 5vw, 40px) clamp(12px, 3vw, 20px);
}

.results-screen .millionaire-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 30px auto;
  max-width: 400px;
}

.results-screen .millionaire-item {
  display: flex; align-items: center; gap: 16px;
  padding: clamp(12px, 3vw, 16px) clamp(16px, 3vw, 24px);
  background: linear-gradient(135deg, rgba(255,215,0,0.1), rgba(255,215,0,0.05));
  border: 1px solid rgba(255,215,0,0.3);
  border-radius: 14px;
  font-size: clamp(1em, 2.5vw, 1.3em);
  font-weight: 700;
}

.results-screen .millionaire-item .crown { font-size: 1.5em; }

.results-screen .all-players {
  margin-top: 30px;
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.4s ease-out; }

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}
.pulse { animation: pulse 2s ease-in-out infinite; }

@keyframes glow {
  0%, 100% { box-shadow: 0 0 20px rgba(255,215,0,0.2); }
  50% { box-shadow: 0 0 40px rgba(255,215,0,0.4); }
}

.glow-anim { animation: glow 3s ease-in-out infinite; }

.hidden { display: none !important; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }

/* Join Page */
.join-page { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: clamp(12px, 3vw, 20px); }
.join-inner { max-width: 420px; width: 100%; }

/* Eliminated Overlay in Player */
.eliminated-screen {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  flex: 1; text-align: center; padding: clamp(20px, 5vw, 40px) clamp(12px, 3vw, 20px);
}
.eliminated-screen .icon { font-size: clamp(2.5em, 10vw, 4em); margin-bottom: 20px; }
.eliminated-screen h2 { color: var(--red); margin-bottom: 10px; }
.eliminated-screen p { color: var(--text-dim); font-size: clamp(0.95em, 2vw, 1.1em); }

.game-over-message {
  font-size: clamp(0.95em, 2.5vw, 1.3em);
  font-weight: 700;
  padding: clamp(12px, 3vw, 20px);
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  text-align: center;
}

/* === Responsive Breakpoints === */
/* Structural changes only — clamp() handles sizing */

@media (max-width: 900px) {
  .ladder-step .level { display: none; }
  .question-image { max-height: 150px; }
  .players-bar { max-height: 80px; }
}

@media (max-width: 768px) {
  .game-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    min-height: none;
    max-height: none;
    overflow: visible;
  }
  .ladder {
    flex-direction: row;
    overflow-x: auto;
    max-height: none;
    order: -1;
    border-radius: 12px;
  }
  .ladder-step {
    flex-direction: column;
    gap: 2px;
    min-width: 64px;
  }
  .ladder-step .level { display: none; }
  .ladder-step .marker { display: none; }
  .ladder-step.current .amount { transform: none; }
  .ladder-step.safe::after { display: none; }
  .answers-grid { grid-template-columns: 1fr; }
  .lobby-qr img { width: min(180px, 50vw); height: min(180px, 50vw); }
  .editor-top-bar { flex-direction: column; align-items: flex-start; }
  .editor-top-bar .flex-center { align-items: flex-start; }
  .quiz-select-row select { min-width: 120px; flex: 1; }
  .editor-answers .answer-row input { min-width: 80px; }
  .editor-answers .answer-row .correct-radio { width: 18px; height: 18px; }
  .editor-answers .answer-row span { font-size: 0.7em; }
}

@media (max-width: 480px) {
  .ladder-step { min-width: 56px; padding: 4px 10px; }
  .editor-item-header { flex-wrap: wrap; }
  .editor-item-header .q-preview { width: 100%; margin: 4px 0; order: 3; }
  .editor-item-header .q-number { width: auto; }
  .editor-item-header .expand-icon { margin-left: auto; }
  .editor-answers .answer-row { flex-wrap: wrap; }
  .editor-answers .answer-row input { min-width: 100%; order: 3; }

  .player-view { padding: 6px; }
  .player-header { padding: 8px 10px; margin-bottom: 6px; }
  .player-header .room-badge { font-size: 0.7em; }
  .player-header .name-badge { font-size: 0.8em; }
  .player-question-text { font-size: 1em; padding: 10px; margin-bottom: 8px; }
  .player-question-image { max-height: 100px; }
  .player-answers { gap: 5px; }
  .player-answer-btn { padding: 12px 10px; min-height: 44px; font-size: 0.95em; border-radius: 12px; gap: 8px; }
  .player-answer-btn .letter { width: 32px; height: 32px; font-size: 0.95em; }
  #questionArea > div:first-child { margin-bottom: 4px; }
  #questionArea > div:first-child span { font-size: 0.8em; }
}

@media (max-width: 360px) {
  .ladder-step { min-width: 48px; }
  .player-question-text { font-size: 0.95em; padding: 8px; margin-bottom: 6px; }
  .player-answer-btn { padding: 10px 8px; min-height: 42px; font-size: 0.9em; gap: 6px; }
  .player-answer-btn .letter { width: 28px; height: 28px; font-size: 0.85em; }
}

@media (min-width: 1600px) {
  html { font-size: 18px; }
}

@media (min-width: 2000px) {
  html { font-size: 20px; }
}
