:root {
  --bg: #0d0a0f;
  --card: #1a1218;
  --pink: #ff4d6d;
  --pink-light: #ff8fa3;
  --red: #c9184a;
  --text: #fff5f7;
  --muted: #a88a94;
  --border: rgba(255, 77, 109, 0.25);
  --success: #52b788;
  --warning: #f4a261;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
  line-height: 1.5;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  position: relative;
}

.screen {
  display: none;
  min-height: 100dvh;
  padding: 20px 18px 40px;
  animation: fadeIn 0.35s ease;
}

.screen.active {
  display: block;
}

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

/* ===== Home ===== */
#screen-home {
  display: none;
  position: relative;
  overflow: hidden;
  padding: 0;
}

#screen-home.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.home-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 20%, rgba(255, 77, 109, 0.25) 0%, transparent 55%),
              radial-gradient(ellipse at 80% 80%, rgba(201, 24, 74, 0.2) 0%, transparent 50%),
              var(--bg);
}

.home-content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 40px 24px;
  width: 100%;
}

.logo {
  font-size: 48px;
  margin-bottom: 24px;
  filter: drop-shadow(0 0 20px rgba(255, 77, 109, 0.5));
}

.slogan {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #fff 0%, var(--pink-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sub {
  color: var(--muted);
  font-size: 15px;
  margin-bottom: 48px;
}

.hint {
  margin-top: 28px;
  font-size: 13px;
  color: var(--muted);
}

/* ===== Buttons ===== */
.btn-primary {
  background: linear-gradient(135deg, var(--pink) 0%, var(--red) 100%);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 16px 40px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  max-width: 280px;
  box-shadow: 0 8px 24px rgba(255, 77, 109, 0.35);
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-secondary {
  background: transparent;
  color: var(--pink-light);
  border: 1.5px solid var(--border);
  border-radius: 50px;
  padding: 14px 32px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  max-width: 280px;
}

.btn-back {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
}

/* ===== Header ===== */
.header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.header h2 {
  font-size: 20px;
  font-weight: 600;
}

/* ===== Room Select ===== */
.room-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.room-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px 16px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
}

.room-card:active {
  transform: scale(0.98);
  border-color: var(--pink);
}

.room-emoji {
  font-size: 32px;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 77, 109, 0.12);
  border-radius: 14px;
}

.room-info h3 {
  font-size: 17px;
  margin-bottom: 4px;
}

.room-info p {
  font-size: 13px;
  color: var(--muted);
}

/* ===== Setup ===== */
.setup-form {
  padding-top: 12px;
}

.input-group {
  margin-bottom: 20px;
}

.input-group label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.input-group input {
  width: 100%;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 16px;
  color: var(--text);
  outline: none;
}

.input-group input:focus {
  border-color: var(--pink);
}

.setup-tip {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin: 28px 0 24px;
}

/* ===== Question ===== */
.q-header {
  margin-bottom: 20px;
}

.progress {
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--pink), var(--red));
  width: 10%;
  transition: width 0.3s ease;
}

.q-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
}

.tag {
  background: rgba(255, 77, 109, 0.15);
  color: var(--pink-light);
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
}

.question-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px 20px;
  margin-bottom: 28px;
  text-align: center;
}

.q-dim {
  font-size: 12px;
  color: var(--pink-light);
  margin-bottom: 12px;
  letter-spacing: 1px;
}

.q-text {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.45;
  margin-bottom: 10px;
}

.q-hint {
  font-size: 13px;
  color: var(--muted);
}

.phase {
  animation: fadeIn 0.3s ease;
}

.phase.hidden {
  display: none;
}

.phase-title {
  text-align: center;
  font-size: 15px;
  color: var(--muted);
  margin-bottom: 16px;
}

.choice-grid {
  display: grid;
  gap: 10px;
}

.choice-btn {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  font-size: 15px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}

.choice-btn:active,
.choice-btn.selected {
  border-color: var(--pink);
  background: rgba(255, 77, 109, 0.12);
}

.choice-btn .level {
  font-weight: 600;
  margin-right: 8px;
}

/* Pass */
.pass-box {
  text-align: center;
  padding: 40px 20px;
}

.pass-emoji {
  font-size: 48px;
  margin-bottom: 16px;
}

.pass-box h3 {
  font-size: 20px;
  margin-bottom: 8px;
}

.pass-box p {
  color: var(--muted);
  margin-bottom: 32px;
}

/* Reveal */
.reveal-box {
  text-align: center;
}

.reveal-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 24px;
  color: var(--pink-light);
}

.reveal-choices {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
}

.reveal-side {
  flex: 1;
  background: var(--card);
  border-radius: 16px;
  padding: 16px 10px;
  border: 1px solid var(--border);
}

.reveal-side .name {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.choice-badge {
  font-size: 15px;
  font-weight: 600;
  padding: 6px 0;
}

.guess-result {
  font-size: 12px;
  margin-top: 6px;
  color: var(--muted);
}

.guess-result.correct {
  color: var(--success);
}

.guess-result.wrong {
  color: var(--warning);
}

.vs {
  font-size: 14px;
  color: var(--muted);
  font-weight: 600;
}

.reveal-comment {
  font-size: 15px;
  margin-bottom: 28px;
  padding: 0 10px;
  line-height: 1.5;
}

/* Challenge */
.challenge-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px 20px;
  text-align: center;
  margin-top: 20px;
}

.challenge-label {
  font-size: 12px;
  color: var(--pink-light);
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.challenge-card h2 {
  font-size: 18px;
  line-height: 1.45;
  margin-bottom: 24px;
}

.challenge-levels {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.level-btn {
  background: rgba(255, 77, 109, 0.08);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
}

.level-btn.active {
  border-color: var(--pink);
  background: rgba(255, 77, 109, 0.18);
}

.challenge-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 16px;
}

.challenge-actions .btn-primary,
.challenge-actions .btn-secondary {
  max-width: none;
  flex: 1;
  padding: 14px 16px;
}

.challenge-tip {
  font-size: 12px;
  color: var(--muted);
}

/* Result */
.result-header {
  text-align: center;
  margin-bottom: 24px;
}

.result-header h2 {
  font-size: 22px;
}

.winner-box {
  text-align: center;
  margin-bottom: 24px;
  padding: 20px;
  background: linear-gradient(135deg, rgba(255, 77, 109, 0.2), rgba(201, 24, 74, 0.15));
  border-radius: 18px;
  border: 1px solid var(--border);
}

.winner-label {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.winner-name {
  font-size: 28px;
  font-weight: 700;
  color: var(--pink-light);
}

.score-row {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.score-item {
  flex: 1;
  background: var(--card);
  border-radius: 14px;
  padding: 14px;
  text-align: center;
  border: 1px solid var(--border);
}

.s-name {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
}

.s-val {
  font-size: 24px;
  font-weight: 700;
}

.title-box {
  margin-bottom: 20px;
}

.title-item {
  background: var(--card);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.t-label {
  font-size: 13px;
  color: var(--muted);
}

.t-val {
  font-size: 14px;
  font-weight: 600;
  color: var(--pink-light);
}

.combo-box {
  text-align: center;
  background: rgba(255, 77, 109, 0.1);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 24px;
  border: 1px solid var(--border);
}

.combo-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.combo-text {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
}

.radar-box {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.insight-box {
  background: var(--card);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 24px;
  border: 1px solid var(--border);
  font-size: 14px;
  line-height: 1.6;
  color: var(--pink-light);
}

.surprise-box {
  margin-bottom: 28px;
}

.surprise-box h3 {
  font-size: 15px;
  margin-bottom: 12px;
  color: var(--muted);
}

.surprise-item {
  background: var(--card);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  font-size: 13px;
}

.surprise-item .sq {
  margin-bottom: 6px;
  color: var(--text);
}

.surprise-item .sc {
  color: var(--muted);
  font-size: 12px;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.result-actions .btn-primary,
.result-actions .btn-secondary {
  max-width: 260px;
}

/* Multiplayer additions */
.divider {
  text-align: center;
  color: var(--muted);
  margin: 24px 0;
  font-size: 14px;
  position: relative;
}
.divider::before, .divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: var(--border);
}
.divider::before { left: 0; }
.divider::after { right: 0; }

.error-msg {
  color: var(--pink);
  text-align: center;
  margin-top: 16px;
  font-size: 14px;
  min-height: 20px;
}

.code-highlight {
  color: var(--pink-light);
  letter-spacing: 3px;
  font-weight: 700;
}

.lobby-box {
  text-align: center;
  padding-top: 20px;
}
.lobby-status {
  font-size: 16px;
  margin-bottom: 24px;
  color: var(--pink-light);
}
.players-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 20px;
}
.player-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 20px;
  min-width: 100px;
}
.p-role {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.p-name {
  font-size: 16px;
  font-weight: 600;
}
.vs-small {
  color: var(--muted);
  font-weight: 600;
}
.lobby-tip {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}
.room-list.compact .room-card {
  padding: 14px 12px;
}
.room-list.compact .room-emoji {
  width: 42px;
  height: 42px;
  font-size: 24px;
}
.hidden { display: none !important; }
