/* ==========================================================
   Guess the Google — Color Palette
   --purple:    #9b5de5
   --pink:      #f15bb5
   --yellow:    #fee440
   --blue:      #00bbf9
   --mint:      #00f5d4
   ========================================================== */

:root {
  --purple: #9b5de5;
  --purple-dark: #7b3fc5;
  --pink: #f15bb5;
  --pink-dark: #d13a95;
  --yellow: #fee440;
  --blue: #00bbf9;
  --blue-dark: #009ad9;
  --mint: #00f5d4;
  --bg: #faf8ff;
  --bg-warm: #fff8f0;
  --text: #2c2137;
  --text-muted: #6c6279;
  --white: #ffffff;
  --border: #e8dff5;
  --shadow: 0 2px 16px rgba(155, 93, 229, 0.1);
  --shadow-lg: 0 8px 32px rgba(155, 93, 229, 0.15);
  --radius: 16px;
  --radius-sm: 10px;
  --transition: 0.2s ease;
}

/* --- Base --- */
body {
  font-family: 'Poppins', sans-serif;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--purple-dark);
  font-weight: 600;
}

a {
  color: var(--purple);
  transition: color var(--transition);
}

a:hover {
  color: var(--purple-dark);
}

/* --- Navbar --- */
.navbar {
  background: var(--white) !important;
  border-bottom: 2px solid var(--border);
  padding: 0.75rem 0;
}

.navbar .navbar-brand {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--purple-dark);
  letter-spacing: -0.02em;
}

.navbar .navbar-brand:hover {
  color: var(--purple);
}

.navbar .form-select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  padding: 0.35rem 2rem 0.35rem 0.75rem;
  background-color: var(--bg);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.navbar .form-select:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(155, 93, 229, 0.2);
}

/* --- Hero Section --- */
.hero-section {
  padding: 3rem 0 2rem;
  text-align: center;
}

.game-title {
  font-size: 2.75rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--purple), var(--pink), var(--blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1rem;
}

.game-title i {
  -webkit-text-fill-color: var(--purple);
  margin-right: 0.5rem;
}

.hero-section .lead {
  color: var(--text-muted);
  font-size: 1.15rem;
  max-width: 600px;
  margin: 0 auto 2rem;
  font-weight: 400;
}

/* --- Score Banner --- */
.score-banner {
  display: inline-block;
  background: linear-gradient(135deg, var(--yellow), #ffd700);
  color: var(--text);
  padding: 0.75rem 2rem;
  border-radius: 50px;
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 2rem;
  box-shadow: 0 4px 15px rgba(254, 228, 64, 0.4);
}

.score-banner i {
  color: #e6a800;
}

/* --- Start Game Card --- */
.start-game-card {
  max-width: 720px;
  margin: 0 auto 3rem;
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
}

.start-game-card .form-control {
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 1rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.start-game-card .form-control:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(155, 93, 229, 0.15);
}

/* --- Game Button --- */
.btn-game {
  background: linear-gradient(135deg, var(--purple), var(--pink));
  border: none;
  border-radius: var(--radius-sm);
  color: var(--white);
  font-weight: 600;
  padding: 1rem 2rem;
  font-size: 1.25rem;
  transition: all var(--transition);
  box-shadow: 0 4px 15px rgba(155, 93, 229, 0.3);
}

.btn-game:hover,
.btn-game:focus {
  background: linear-gradient(135deg, var(--purple-dark), var(--pink-dark));
  box-shadow: 0 6px 20px rgba(155, 93, 229, 0.4);
  transform: translateY(-1px);
  color: var(--white);
}

.btn-game:disabled {
  background: #ccc;
  box-shadow: none;
  transform: none;
  cursor: not-allowed;
}

/* --- Versus Button --- */
.btn-versus {
  background: linear-gradient(135deg, var(--blue), var(--mint));
  box-shadow: 0 4px 15px rgba(0, 187, 249, 0.3);
}

.btn-versus:hover,
.btn-versus:focus {
  background: linear-gradient(135deg, var(--blue-dark), #00d4b0);
  box-shadow: 0 6px 20px rgba(0, 187, 249, 0.4);
}

/* --- How to Play --- */
.how-to-play {
  margin-bottom: 3rem;
}

.how-step {
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1rem;
  text-align: center;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  height: 100%;
}

.how-step:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: #999;
}

.step-number {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #333, #888);
  color: var(--white);
  font-weight: 700;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

.how-step p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0;
  font-weight: 500;
}

/* --- Joker Tip --- */
.joker-tip {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: linear-gradient(135deg, #fffbea, #fff8d0);
  border: 2px solid #ffc107;
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  margin-top: 1.5rem;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.joker-tip-icon {
  font-size: 1.8rem;
  color: #e6a100;
  flex-shrink: 0;
}

.joker-tip-body strong {
  display: block;
  font-size: 1rem;
  color: #7a5200;
  margin-bottom: 0.25rem;
}

.joker-tip-body p {
  font-size: 0.875rem;
  color: #8a6500;
}

/* --- Leaderboard --- */
.leaderboard-table {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

/* --- Section Headings --- */
.section-title {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--purple-dark);
  margin-bottom: 1.5rem;
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 40px;
  height: 3px;
  background: linear-gradient(90deg, var(--purple), var(--pink));
  border-radius: 2px;
}

.section-title.text-center::after {
  left: 50%;
  transform: translateX(-50%);
}

/* --- Table --- */
.table-modern {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.table-modern .table {
  margin-bottom: 0;
}

.table-modern .table thead {
  background: linear-gradient(135deg, var(--purple), var(--purple-dark));
  color: var(--white);
}

.table-modern .table thead th {
  border: none;
  font-weight: 500;
  font-size: 0.9rem;
  padding: 0.85rem 1rem;
  letter-spacing: 0.02em;
}

.table-modern .table tbody tr {
  transition: background-color var(--transition);
}

.table-modern .table tbody tr:hover {
  background-color: rgba(155, 93, 229, 0.06);
}

.table-modern .table tbody td,
.table-modern .table tbody th {
  padding: 0.8rem 1rem;
  font-size: 0.9rem;
  border-color: var(--border);
  vertical-align: middle;
}

.top-rank {
  font-weight: 600;
}

.rank-1 {
  background-color: rgba(254, 228, 64, 0.12);
}

.rank-2 {
  background-color: rgba(192, 192, 192, 0.1);
}

.rank-3 {
  background-color: rgba(205, 127, 50, 0.08);
}

/* --- Alerts --- */
.alert {
  border-radius: var(--radius-sm);
  border: none;
  font-size: 0.9rem;
}

.alert-game {
  background-color: rgba(155, 93, 229, 0.1);
  color: var(--purple-dark);
  border: 1px dashed var(--purple);
  padding: 1.5rem;
  font-weight: 500;
}

.alert-info {
  background-color: rgba(0, 187, 249, 0.1);
  color: var(--blue-dark);
}

.alert-danger {
  background-color: rgba(220, 53, 69, 0.1);
  color: #842029;
}

/* --- Footer --- */
.footer {
  background: var(--white) !important;
  border-top: 2px solid var(--border);
  padding: 1.5rem 0;
  margin-top: auto;
}

.footer p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0;
}

/* --- Error Pages --- */
.error-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
}

.error-page .error-code {
  font-size: 7rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.error-page h2 {
  font-size: 1.5rem;
  color: var(--purple-dark);
  margin-bottom: 1rem;
}

.error-page p {
  color: var(--text-muted);
  max-width: 400px;
  margin: 0 auto 2rem;
}

/* --- Language Selector --- */
.lang-globe-icon {
  color: var(--text-muted);
}

.lang-select {
  width: auto;
}

/* --- Buttons (legacy) --- */
.btn-primary {
  background-color: var(--purple);
  border-color: var(--purple);
  border-radius: var(--radius-sm);
  font-weight: 500;
  padding: 0.6rem 1.5rem;
  transition: all var(--transition);
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--purple-dark);
  border-color: var(--purple-dark);
  box-shadow: 0 4px 12px rgba(155, 93, 229, 0.3);
}

/* ===================================================
   GAME PAGE STYLES
   =================================================== */

.game-body {
  background: linear-gradient(180deg, var(--bg) 0%, #f0e6ff 100%);
}

/* --- Game Header Bar --- */
.game-header {
  background: var(--white);
  border-bottom: 2px solid var(--border);
  padding: 0.75rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.game-header-inner {
  display: flex;
  justify-content: space-around;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.game-stat {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}

.game-stat i {
  color: var(--purple);
}

/* --- Timer Block (above images) --- */
.game-timer-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  padding: 0.75rem 2rem;
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: 50px;
  box-shadow: var(--shadow);
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}

.game-timer-block > i {
  font-size: 1.5rem;
  color: var(--blue);
}

.timer-score {
  margin-left: 1.5rem;
  padding-left: 1.5rem;
  border-left: 2px solid var(--border);
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  line-height: 1;
}

.timer-score i {
  color: var(--yellow);
  font-size: 1.5rem;
}

.timer-streak {
  margin-left: 1.5rem;
  padding-left: 1.5rem;
  border-left: 2px solid var(--border);
  font-size: 1.1rem;
  font-weight: 700;
  color: #ff6b35;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.timer-streak i {
  color: #ff6b35;
  font-size: 1.2rem;
}

.streak-multiplier {
  background: linear-gradient(135deg, #ff6b35, #fee440);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.1rem 0.5rem;
  border-radius: 12px;
}

@keyframes streak-bounce {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.streak-bounce {
  animation: streak-bounce 0.4s ease;
}

.game-timer {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--blue);
  line-height: 1;
  min-width: 2ch;
  text-align: center;
}

.game-timer.timer-danger {
  color: var(--pink);
  animation: pulse 0.5s ease infinite alternate;
}

.game-timer-block:has(.timer-danger) {
  border-color: var(--pink);
  box-shadow: 0 0 20px rgba(241, 91, 181, 0.25);
}

@keyframes pulse {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0.6; transform: scale(1.05); }
}

@keyframes timer-blink {
  0% { opacity: 1; transform: scale(1); }
  25% { opacity: 0.2; transform: scale(1.15); }
  50% { opacity: 1; transform: scale(1); }
}

.timer-blink {
  animation: timer-blink 0.6s ease;
}

/* --- Game Container --- */
.game-container {
  padding: 1.5rem 1rem;
  max-width: 700px;
}

/* --- Image Grid --- */
.image-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 1.5rem;
}

.image-cell {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--white);
  border: 2px solid var(--border);
  position: relative;
}

.image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #f0e6ff, #ffe6f0);
  color: var(--purple);
  font-size: 2rem;
}

.game-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --- Guess Section --- */
.guess-section {
  margin-bottom: 1rem;
}

.guess-form .input-group {
  box-shadow: var(--shadow);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.guess-input {
  border: 2px solid var(--border);
  border-right: none;
  padding: 0.85rem 1.25rem;
  font-size: 1.1rem;
  font-weight: 500;
}

.guess-input:focus {
  border-color: var(--purple);
  box-shadow: none;
}

.guess-form .btn-game {
  border-radius: 0;
  padding: 0.85rem 1.5rem;
}

/* --- Joker Button --- */
.btn-joker {
  background: linear-gradient(135deg, var(--yellow), #ffc107);
  border: none;
  border-radius: var(--radius-sm);
  color: #333;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.45rem 1.2rem;
  transition: all 0.2s ease;
  box-shadow: 0 3px 10px rgba(254, 228, 64, 0.4);
}

.btn-joker:hover:not(:disabled) {
  background: linear-gradient(135deg, #ffd700, #ffa000);
  transform: translateY(-1px);
  box-shadow: 0 5px 15px rgba(254, 228, 64, 0.5);
  color: #222;
}

.btn-joker:disabled {
  background: #ccc;
  box-shadow: none;
  transform: none;
  color: #666;
  cursor: not-allowed;
  opacity: 0.7;
}

.btn-joker-used {
  background: #e0e0e0 !important;
  box-shadow: none !important;
  color: #999 !important;
}

/* --- Countdown Overlay --- */
.countdown-overlay {
  position: fixed;
  inset: 0;
  background: rgba(44, 33, 55, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.countdown-number {
  font-size: 10rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--yellow), var(--mint));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
}

/* --- Game Over Overlay --- */
.gameover-overlay {
  position: fixed;
  inset: 0;
  background: rgba(44, 33, 55, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.gameover-content {
  background: var(--white);
  border-radius: var(--radius);
  padding: 3rem 2.5rem;
  text-align: center;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.gameover-icon {
  font-size: 4rem;
  color: var(--yellow);
  margin-bottom: 1rem;
}

.gameover-content h2 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.gameover-score {
  font-size: 1.5rem;
  color: var(--purple);
  font-weight: 600;
}

.gameover-message {
  color: var(--text-muted);
  font-size: 1rem;
}

.congrats-message {
  color: var(--mint);
  font-weight: 600;
  font-size: 1.1rem;
}

/* --- Feedback Overlay --- */
.feedback-overlay {
  position: fixed;
  inset: 0;
  background: rgba(44, 33, 55, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
}

.feedback-content {
  text-align: center;
  padding: 2rem;
}

.feedback-icon {
  font-size: 5rem;
  margin-bottom: 0.5rem;
}

.feedback-text {
  font-size: 1.5rem;
  font-weight: 700;
}

.feedback-correct {
  color: var(--mint);
}

.feedback-correct i {
  color: var(--mint);
}

.feedback-wrong {
  color: var(--pink);
}

.feedback-wrong i {
  color: var(--pink);
}

/* --- Fireworks Particles --- */
@keyframes firework-burst {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--tx), var(--ty)) scale(0);
  }
}

/* --- Hidden utility --- */
.hidden {
  display: none !important;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .game-title {
    font-size: 2rem;
  }

  .hero-section .lead {
    font-size: 1rem;
  }

  .image-grid {
    gap: 6px;
  }

  .game-container {
    padding: 1rem 0.5rem;
  }

  .game-header-inner {
    font-size: 0.85rem;
  }

  .game-timer {
    font-size: 1.2rem;
  }

  .timer-score {
    font-size: 1.2rem;
  }

  .countdown-number {
    font-size: 6rem;
  }

  .start-game-card {
    margin: 0 1rem 3rem;
  }
}
