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

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

body {
  font-family: 'Poppins', sans-serif;
  background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
  color: #fff;
  min-height: 100vh;
  overflow-x: hidden;
}

.container {
  max-width: 500px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.card {
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 30px;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

h1 { font-size: 1.8em; font-weight: 700; margin-bottom: 8px; }
h2 { font-size: 1.4em; font-weight: 600; margin-bottom: 12px; }
h3 { font-size: 1.1em; font-weight: 500; }
.subtitle { color: rgba(255,255,255,0.6); font-size: 0.9em; margin-bottom: 24px; }

.btn {
  display: inline-block;
  padding: 14px 28px;
  border: none;
  border-radius: 16px;
  font-family: 'Poppins', sans-serif;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  text-align: center;
  width: 100%;
}
.btn-primary {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  box-shadow: 0 8px 24px rgba(102,126,234,0.4);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(102,126,234,0.6); }
.btn-secondary {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
}
.btn-secondary:hover { background: rgba(255,255,255,0.2); }
.btn-pink {
  background: linear-gradient(135deg, #f093fb, #f5576c);
  color: #fff;
  box-shadow: 0 8px 24px rgba(245,87,108,0.4);
}
.btn-green {
  background: linear-gradient(135deg, #11998e, #38ef7d);
  color: #fff;
  box-shadow: 0 8px 24px rgba(56,239,125,0.3);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

.input-group { margin-bottom: 16px; }
.input-group label {
  display: block; font-size: 0.85em;
  color: rgba(255,255,255,0.6); margin-bottom: 6px; font-weight: 500;
}
.input-group input, .input-group textarea {
  width: 100%; padding: 14px 18px;
  border: 1px solid rgba(255,255,255,0.15); border-radius: 14px;
  background: rgba(255,255,255,0.08); color: #fff;
  font-family: 'Poppins', sans-serif; font-size: 1em; outline: none;
  transition: border-color 0.3s;
}
.input-group input:focus, .input-group textarea:focus { border-color: #667eea; }
.input-group textarea { resize: vertical; min-height: 80px; }

.login-logo { font-size: 2.5em; text-align: center; margin-bottom: 12px; }
.login-card { text-align: center; }
.login-card h1 { font-size: 1.5em; }

.error-msg { color: #f5576c; font-size: 0.85em; margin-top: 8px; display: none; }
.error-msg.show { display: block; }

.user-login-card { text-align: center; }
.user-select { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 20px 0; }
.user-option {
  background: rgba(255,255,255,0.06); border: 2px solid rgba(255,255,255,0.15);
  border-radius: 20px; padding: 20px; cursor: pointer; transition: all 0.3s; text-align: center;
}
.user-option:hover { border-color: #667eea; background: rgba(102,126,234,0.15); }
.user-option.selected { border-color: #667eea; background: rgba(102,126,234,0.2); }
.user-option .avatar { font-size: 2.5em; margin-bottom: 8px; }
.user-option .name { font-weight: 600; }

.dashboard-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.dashboard-header .user-info { display: flex; align-items: center; gap: 10px; }
.dashboard-header .user-info .avatar { font-size: 1.8em; }
.dashboard-header .user-info .greeting { font-size: 0.85em; color: rgba(255,255,255,0.6); }
.dashboard-header .user-info .name { font-weight: 600; font-size: 1.2em; }

.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 24px; }
.stat-card { background: rgba(255,255,255,0.06); border-radius: 16px; padding: 16px; text-align: center; }
.stat-card .number { font-size: 1.8em; font-weight: 700; color: #667eea; }
.stat-card .label { font-size: 0.7em; color: rgba(255,255,255,0.5); }

.game-modes { display: grid; gap: 16px; margin-bottom: 24px; }
.game-mode-card {
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px; padding: 24px; cursor: pointer; transition: all 0.3s;
  display: flex; align-items: center; gap: 16px; text-decoration: none; color: #fff;
}
.game-mode-card:hover { transform: translateY(-3px); border-color: #667eea; box-shadow: 0 12px 36px rgba(0,0,0,0.3); }
.game-mode-card .mode-icon { font-size: 2.5em; }
.game-mode-card .mode-info h3 { margin-bottom: 4px; }
.game-mode-card .mode-info p { font-size: 0.8em; color: rgba(255,255,255,0.5); }

.logout-btn {
  background: none; border: none; color: rgba(255,255,255,0.4);
  cursor: pointer; font-size: 0.85em; font-family: 'Poppins', sans-serif;
  text-align: center; width: 100%; padding: 10px;
}
.logout-btn:hover { color: #fff; }

.catalog-grid { display: grid; gap: 12px; margin: 16px 0; }
.catalog-card {
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px; padding: 18px; cursor: pointer; transition: all 0.3s;
  display: flex; align-items: center; gap: 14px;
}
.catalog-card:hover { border-color: #667eea; transform: translateX(4px); }
.catalog-card .cat-icon { font-size: 2em; }
.catalog-card .cat-info h3 { font-size: 0.95em; margin-bottom: 2px; }
.catalog-card .cat-info p { font-size: 0.75em; color: rgba(255,255,255,0.5); }
.catalog-card .cat-count {
  margin-left: auto; background: rgba(102,126,234,0.2); color: #667eea;
  padding: 4px 10px; border-radius: 10px; font-size: 0.75em; font-weight: 600;
}

.lobby { text-align: center; padding: 40px 20px; }
.lobby .waiting-icon { font-size: 4em; margin-bottom: 16px; animation: pulse 2s infinite; }
.lobby .players-list { margin: 24px 0; display: flex; justify-content: center; gap: 30px; }
.lobby .player-slot { text-align: center; }
.lobby .player-slot .slot-avatar {
  width: 60px; height: 60px; border-radius: 50%; background: rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center; font-size: 1.5em;
  margin: 0 auto 8px; border: 2px solid rgba(255,255,255,0.2);
}
.lobby .player-slot .slot-avatar.active { border-color: #38ef7d; background: rgba(56,239,125,0.15); }
.lobby .player-slot .slot-avatar.waiting { animation: pulse 1.5s infinite; border-color: rgba(255,255,255,0.3); }

.dots-loading::after { content: ''; animation: dots 1.5s infinite; }
@keyframes dots { 0%{content:''} 25%{content:'.'} 50%{content:'..'} 75%{content:'...'} }

.game-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.progress-text { font-size: 0.85em; color: rgba(255,255,255,0.6); }
.progress-bar { width: 100%; height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px; margin-bottom: 24px; overflow: hidden; }
.progress-bar .fill { height: 100%; background: linear-gradient(90deg, #667eea, #764ba2); border-radius: 3px; transition: width 0.5s ease; }

.question-text { font-size: 1.2em; font-weight: 600; text-align: center; margin-bottom: 24px; line-height: 1.5; }

.timer-container { display: flex; justify-content: center; margin-bottom: 20px; }
.timer-circle { width: 70px; height: 70px; position: relative; }
.timer-circle svg { width: 70px; height: 70px; transform: rotate(-90deg); }
.timer-circle .track { fill: none; stroke: rgba(255,255,255,0.1); stroke-width: 4; }
.timer-circle .progress-ring {
  fill: none; stroke: #667eea; stroke-width: 4; stroke-linecap: round;
  stroke-dasharray: 188.5; stroke-dashoffset: 0; transition: stroke-dashoffset 1s linear, stroke 0.3s;
}
.timer-circle .progress-ring.warning { stroke: #f5576c; }
.timer-text {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  font-size: 1.2em; font-weight: 700;
}

.answer-area { margin-top: 16px; }
.answer-area textarea {
  width: 100%; padding: 16px; border: 1px solid rgba(255,255,255,0.15);
  border-radius: 16px; background: rgba(255,255,255,0.08); color: #fff;
  font-family: 'Poppins', sans-serif; font-size: 1em; min-height: 100px; resize: none; outline: none;
}
.answer-area textarea:focus { border-color: #667eea; }

.submit-row { display: flex; gap: 10px; margin-top: 12px; }
.submit-row .btn { flex: 1; }

.waiting-partner {
  text-align: center; padding: 20px; color: rgba(255,255,255,0.6); font-size: 0.9em;
}
.waiting-partner .spinner {
  display: inline-block; width: 24px; height: 24px;
  border: 3px solid rgba(255,255,255,0.2); border-top-color: #667eea;
  border-radius: 50%; animation: spin 0.8s linear infinite;
  margin-right: 8px; vertical-align: middle;
}

.success-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.92); display: flex; flex-direction: column;
  align-items: center; justify-content: center; z-index: 1000;
  opacity: 0; pointer-events: none; transition: opacity 0.5s;
}
.success-overlay.active { opacity: 1; pointer-events: auto; }
.success-check {
  width: 80px; height: 80px; border-radius: 50%;
  background: linear-gradient(135deg, #11998e, #38ef7d);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5em; margin-bottom: 20px; animation: scaleIn 0.5s ease;
}
.success-image {
  width: 280px; height: 200px; border-radius: 20px; object-fit: cover;
  margin-top: 16px; border: 3px solid rgba(255,255,255,0.2); box-shadow: 0 16px 48px rgba(0,0,0,0.5);
}
.success-text { font-size: 1.1em; font-weight: 600; margin-top: 12px; color: #38ef7d; }

.phase-badge {
  display: inline-block; padding: 6px 16px; border-radius: 20px;
  font-size: 0.8em; font-weight: 600; margin-bottom: 16px;
}
.phase-badge.choose { background: rgba(102,126,234,0.2); color: #667eea; }
.phase-badge.guess { background: rgba(245,87,108,0.2); color: #f5576c; }
.phase-badge.reveal { background: rgba(56,239,125,0.2); color: #38ef7d; }

.image-options { display: grid; gap: 14px; margin: 16px 0; }
.image-option {
  border: 2px solid rgba(255,255,255,0.12); border-radius: 20px;
  overflow: hidden; cursor: pointer; transition: all 0.3s; position: relative;
}
.image-option:hover { border-color: #667eea; transform: scale(1.02); }
.image-option.selected { border-color: #667eea; border-width: 3px; }
.image-option.correct { border-color: #38ef7d; border-width: 3px; }
.image-option.wrong { border-color: #f5576c; border-width: 3px; }
.image-option img { width: 100%; height: 140px; object-fit: cover; display: block; }
.image-option .option-label {
  padding: 10px 14px; font-size: 0.9em; font-weight: 500; background: rgba(0,0,0,0.3);
}
.image-option .option-badge {
  position: absolute; top: 10px; right: 10px; padding: 4px 10px;
  border-radius: 10px; font-size: 0.75em; font-weight: 600;
}
.option-badge.my-choice { background: #667eea; }
.option-badge.partner-choice { background: #f093fb; }
.option-badge.my-guess { background: #f5576c; }

.results-card { text-align: center; }
.results-card .winner-crown { font-size: 4em; margin-bottom: 8px; }
.results-card .winner-name { font-size: 1.5em; font-weight: 700; color: #ffd700; }
.results-card .loser-text { font-size: 0.85em; color: rgba(255,255,255,0.5); margin-top: 4px; }

.match-circle {
  width: 120px; height: 120px; border-radius: 50%;
  background: rgba(102,126,234,0.15); border: 3px solid #667eea;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  margin: 20px auto;
}
.match-circle .pct { font-size: 2em; font-weight: 700; color: #667eea; }
.match-circle .pct-label { font-size: 0.7em; color: rgba(255,255,255,0.5); }

.score-compare { display: flex; justify-content: center; gap: 40px; margin: 20px 0; }
.score-player { text-align: center; }
.score-player .score-num { font-size: 2em; font-weight: 700; }
.score-player .score-label { font-size: 0.8em; color: rgba(255,255,255,0.5); }

.prize-section { margin-top: 24px; }
.prize-section h3 { text-align: center; margin-bottom: 16px; }
.prize-category { margin-bottom: 16px; }
.prize-category-header {
  font-size: 0.85em; font-weight: 600; color: rgba(255,255,255,0.6);
  margin-bottom: 8px; padding-left: 4px;
}
.prize-options { display: grid; gap: 8px; }
.prize-card {
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px; padding: 14px 16px; cursor: pointer; transition: all 0.3s;
  display: flex; align-items: center; gap: 12px;
}
.prize-card:hover { border-color: #ffd700; background: rgba(255,215,0,0.08); }
.prize-card.selected { border-color: #ffd700; background: rgba(255,215,0,0.15); }
.prize-card .prize-emoji { font-size: 1.8em; }
.prize-card .prize-info .prize-name { font-weight: 600; font-size: 0.9em; }
.prize-card .prize-info .prize-desc { font-size: 0.75em; color: rgba(255,255,255,0.5); }

.prize-selected-banner {
  background: linear-gradient(135deg, rgba(255,215,0,0.15), rgba(255,165,0,0.15));
  border: 1px solid rgba(255,215,0,0.3); border-radius: 16px;
  padding: 20px; text-align: center; margin-top: 16px;
}
.prize-selected-banner .prize-big-emoji { font-size: 3em; }
.prize-selected-banner .prize-big-name { font-weight: 700; font-size: 1.1em; margin-top: 8px; }
.prize-selected-banner .prize-payer { font-size: 0.85em; color: rgba(255,255,255,0.6); margin-top: 4px; }

.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; color: rgba(255,255,255,0.6);
  cursor: pointer; font-family: 'Poppins', sans-serif; font-size: 0.9em;
  margin-bottom: 16px; padding: 8px 0;
}
.back-btn:hover { color: #fff; }

.hidden { display: none !important; }

@keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.05)} }
@keyframes spin { to{transform:rotate(360deg)} }
@keyframes scaleIn { 0%{transform:scale(0)} 70%{transform:scale(1.1)} 100%{transform:scale(1)} }
@keyframes fadeIn { from{opacity:0;transform:translateY(10px)} to{opacity:1;transform:translateY(0)} }
.fade-in { animation: fadeIn 0.4s ease; }

.confetti-container {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none; z-index: 999; overflow: hidden;
}
.confetti {
  position: absolute; width: 10px; height: 10px; top: -10px;
  animation: confettiFall 3s ease-in forwards;
}
@keyframes confettiFall {
  0%{transform:translateY(0) rotate(0deg);opacity:1}
  100%{transform:translateY(100vh) rotate(720deg);opacity:0}
}

@media (max-width: 480px) {
  .container { padding: 12px; }
  .card { padding: 20px; border-radius: 20px; }
  h1 { font-size: 1.4em; }
  .stats-grid { gap: 6px; }
  .stat-card { padding: 10px; }
  .stat-card .number { font-size: 1.4em; }
  .image-option img { height: 110px; }
}

/* ============ ANSWER REVIEW ============ */
.answer-review-item {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.answer-review-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
}
.review-question-num {
  font-size: 0.7em;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #667eea;
  margin-bottom: 4px;
}
.review-question-text {
  font-size: 1.05em;
  font-weight: 600;
  margin-bottom: 14px;
  color: rgba(255,255,255,0.9);
  line-height: 1.4;
}
.review-answers {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.review-answer {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.review-avatar {
  font-size: 1.6em;
  flex-shrink: 0;
  margin-top: 4px;
}
.review-bubble {
  background: rgba(102,126,234,0.15);
  border: 1px solid rgba(102,126,234,0.25);
  border-radius: 4px 16px 16px 16px;
  padding: 10px 14px;
  flex: 1;
  min-width: 0;
}
.review-bubble.partner {
  background: rgba(240,147,251,0.12);
  border-color: rgba(240,147,251,0.25);
  border-radius: 16px 4px 16px 16px;
}
.review-name {
  font-size: 0.75em;
  font-weight: 600;
  color: rgba(255,255,255,0.5);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.review-text {
  font-size: 0.95em;
  color: rgba(255,255,255,0.85);
  line-height: 1.5;
  word-wrap: break-word;
}
.review-text em {
  color: rgba(255,255,255,0.3);
  font-style: italic;
}
