:root {
  --success: var(--ok);
  --error: #d64545;
  --game-gradient: linear-gradient(135deg, rgba(233, 168, 107, 0.08) 0%, rgba(47, 72, 88, 0.04) 100%);
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--game-gradient);
}

.game-header {
  background: var(--paper);
  border-bottom: 1px solid rgba(40, 50, 70, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.game-header .nav {
  padding: 18px 20px;
}

.game-layout {
  flex: 1;
  display: flex;
  justify-content: center;
  padding-top: 32px;
  padding-bottom: 64px;
}

.game-card {
  width: min(720px, 100%);
  background: var(--paper);
  border: 1px solid rgba(40, 50, 70, 0.08);
  border-radius: calc(var(--radius) + 6px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
  padding: 32px clamp(20px, 5vw, 42px);
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: relative;
  overflow: hidden;
}

.game-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
}

.game-card__header .kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(233, 168, 107, 0.25), rgba(233, 168, 107, 0.15));
  color: #8a5e2f;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
  border: 1px solid rgba(233, 168, 107, 0.3);
}

.game-card__header .kicker::before {
  content: "🎯";
  font-size: 14px;
}

.game-card__header h1 {
  margin: 0;
  font-size: clamp(28px, 3.4vw, 36px);
  line-height: 1.1;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.scoreboard__item {
  background: linear-gradient(135deg, rgba(40, 50, 70, 0.05), rgba(40, 50, 70, 0.02));
  border: 1px solid rgba(40, 50, 70, 0.06);
  border-radius: 14px;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.scoreboard__item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.scoreboard__item .label {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.scoreboard__item .value {
  font-size: 26px;
  font-weight: 800;
}

.scoreboard__item.ok .value {
  color: var(--success);
}

.scoreboard__item.warn .value {
  color: #d97c2b;
}

.scoreboard__item.streak .value {
  color: var(--brand-2);
}

.question-block {
  background: linear-gradient(135deg, #fdfbf7, #f9f6f1);
  border-radius: calc(var(--radius) + 2px);
  padding: 24px;
  border: 2px solid rgba(233, 168, 107, 0.2);
  box-shadow: 0 2px 8px rgba(233, 168, 107, 0.08);
}

.question-kicker {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
  margin: 0 0 8px;
}

.question-text {
  margin: 0;
  font-size: clamp(24px, 4vw, 32px);
  color: var(--ink);
}

.question-type {
  margin-top: 12px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.type-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
  letter-spacing: 0.3px;
}

.type-badge.verb {
  background: rgba(106, 90, 205, 0.15);
  color: #5a4a9e;
  border: 1px solid rgba(106, 90, 205, 0.3);
}

.type-badge.noun {
  background: rgba(26, 157, 87, 0.15);
  color: #1a6b4a;
  border: 1px solid rgba(26, 157, 87, 0.3);
}

.type-badge.adjective {
  background: rgba(233, 168, 107, 0.15);
  color: #8a5e2f;
  border: 1px solid rgba(233, 168, 107, 0.3);
}

.type-badge.expression {
  background: rgba(47, 72, 88, 0.15);
  color: #2f4858;
  border: 1px solid rgba(47, 72, 88, 0.3);
}

.type-badge.adverb {
  background: rgba(214, 69, 69, 0.15);
  color: #8c2626;
  border: 1px solid rgba(214, 69, 69, 0.3);
}

.type-badge.preposition {
  background: rgba(255, 152, 0, 0.15);
  color: #b36800;
  border: 1px solid rgba(255, 152, 0, 0.3);
}

.type-badge.other {
  background: rgba(120, 120, 120, 0.15);
  color: #505050;
  border: 1px solid rgba(120, 120, 120, 0.3);
}

.options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.option-btn {
  background: linear-gradient(135deg, #fffaf5, #fff7ee);
  border: 2px solid rgba(233, 168, 107, 0.4);
  color: #703f18;
  border-radius: calc(var(--radius) - 8px);
  padding: 14px 16px;
  font-size: 18px;
  font-weight: 600;
  text-align: left;
  line-height: 1.4;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.option-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(233, 168, 107, 0.1), transparent);
  transition: left 0.5s ease;
}

.option-btn:hover::before {
  left: 100%;
}

.option-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(233, 168, 107, 0.25);
  border-color: rgba(233, 168, 107, 0.6);
}

.option-btn:active {
  transform: translateY(0);
}

.option-btn:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.option-btn.correct {
  background: linear-gradient(135deg, rgba(26, 157, 87, 0.2), rgba(26, 157, 87, 0.12));
  border-color: var(--success);
  color: var(--success);
  box-shadow: 0 4px 16px rgba(26, 157, 87, 0.2);
}

.option-btn.correct::after {
  content: "✓";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 24px;
  font-weight: 700;
}

.option-btn.wrong {
  background: linear-gradient(135deg, rgba(214, 69, 69, 0.15), rgba(214, 69, 69, 0.08));
  border-color: #d64545;
  color: #8c2626;
  box-shadow: 0 4px 16px rgba(214, 69, 69, 0.15);
}

.option-btn.wrong::after {
  content: "✗";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 24px;
  font-weight: 700;
  color: #d64545;
}

.option-btn.disabled {
  pointer-events: none;
  opacity: 0.75;
}

.feedback {
  min-height: 22px;
  font-size: 15px;
}

.feedback.positive {
  color: var(--success);
  font-weight: 600;
}

.feedback.negative {
  color: #d64545;
  font-weight: 600;
}

.cta-panel {
  background: linear-gradient(135deg, rgba(47, 72, 88, 0.06), rgba(233, 168, 107, 0.08));
  border: 1px solid rgba(47, 72, 88, 0.12);
  border-radius: var(--radius);
  padding: 18px 20px 18px 50px;
  font-size: 15px;
  color: var(--brand-2);
  position: relative;
}

.cta-panel::before {
  content: "💡";
  position: absolute;
  top: 18px;
  left: 20px;
  font-size: 20px;
  opacity: 0.8;
}

.cta-panel a {
  font-weight: 700;
  color: var(--brand-2);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  transition: color 0.2s ease;
}

.cta-panel a:hover {
  color: var(--brand);
}

/* Simple CTA Panel Design */
.cta-panel-simple {
  background: linear-gradient(135deg, #fdfbf7, #f9f6f1);
  border: 2px solid rgba(233, 168, 107, 0.3);
  border-radius: calc(var(--radius) + 2px);
  padding: 24px;
  display: flex;
  gap: 20px;
  align-items: center;
  box-shadow: 0 2px 8px rgba(233, 168, 107, 0.08);
}

.cta-panel-simple .cta-icon {
  font-size: 48px;
  flex-shrink: 0;
  line-height: 1;
}

.cta-panel-simple .cta-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cta-panel-simple .cta-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

.cta-panel-simple .cta-text {
  margin: 0;
  font-size: 15px;
  color: var(--muted);
  line-height: 1.4;
}

.cta-panel-simple .btn {
  align-self: center;
  min-width: 200px;
}

@media (max-width: 540px) {
  .cta-panel-simple {
    flex-direction: column;
    text-align: center;
    padding: 20px;
  }

  .cta-panel-simple .btn {
    align-self: stretch;
    width: 100%;
  }
}

/* Back link container */
.back-link-container {
  margin-top: 24px;
  text-align: center;
}

.back-link {
  display: inline-block;
  font-size: 15px;
  color: var(--brand-2);
  text-decoration: none;
  padding: 10px 16px;
  border-radius: var(--radius);
  transition: all 0.2s ease;
}

.back-link:hover {
  color: var(--brand);
  background: rgba(233, 168, 107, 0.1);
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(22, 24, 29, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.overlay.hidden {
  display: none;
}

.overlay__card {
  background: var(--paper);
  border-radius: calc(var(--radius) + 4px);
  padding: 32px clamp(24px, 5vw, 48px);
  max-width: 540px;
  text-align: center;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.25), 0 8px 16px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(233, 168, 107, 0.2);
  animation: slideUp 0.3s ease;
}

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

.overlay__card h2 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: clamp(26px, 3vw, 34px);
}

.overlay__card p {
  margin-bottom: 20px;
  color: var(--muted);
  line-height: 1.6;
}

.mistakes-list {
  list-style: none;
  padding: 0;
  margin: 20px 0;
  background: rgba(214, 69, 69, 0.08);
  border-radius: calc(var(--radius) - 2px);
  padding: 16px 20px;
  text-align: left;
}

.mistakes-list li {
  padding: 8px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  border-bottom: 1px solid rgba(40, 50, 70, 0.08);
}

.mistakes-list li:last-child {
  border-bottom: none;
}

.mistakes-list li::before {
  content: "✗ ";
  color: #d64545;
  font-weight: 700;
  margin-right: 8px;
}

.overlay-cta-text {
  margin-top: 16px;
  color: var(--brand-2) !important;
  font-weight: 500;
}

.overlay__actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.overlay .btn {
  min-width: 180px;
}

@media (max-width: 720px) {
  .scoreboard {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }

  .option-btn {
    font-size: 16px;
    padding: 12px 14px;
  }
}

@media (max-width: 540px) {
  .game-card {
    padding: 28px 18px;
  }

  .question-block {
    padding: 18px;
  }

  .scoreboard {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Pulse animation for streak milestones */
@keyframes pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(233, 168, 107, 0.7);
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 0 0 10px rgba(233, 168, 107, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(233, 168, 107, 0);
  }
}

.scoreboard__item.pulse {
  animation: pulse 0.6s ease;
}

/* Leaderboard Styles */
.leaderboard {
  background: linear-gradient(135deg, rgba(233, 168, 107, 0.08), rgba(47, 72, 88, 0.04));
  border: 1px solid rgba(233, 168, 107, 0.2);
  border-radius: calc(var(--radius) + 2px);
  padding: 16px 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.leaderboard-header {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid rgba(233, 168, 107, 0.15);
}

.leaderboard-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--brand-2);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.leaderboard-columns {
  display: grid;
  grid-template-columns: 32px 1fr 70px 70px 70px;
  gap: 8px;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(40, 50, 70, 0.08);
  margin-bottom: 8px;
}

.leaderboard-columns > div {
  text-align: center;
}

.col-name {
  text-align: left !important;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.leaderboard-empty {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
  padding: 12px 0;
}

.leaderboard-item {
  display: grid;
  grid-template-columns: 32px 1fr 70px 70px 70px;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  background: var(--paper);
  border-radius: var(--radius);
  border: 1px solid rgba(40, 50, 70, 0.06);
  transition: all 0.2s ease;
}

.leaderboard-item:hover {
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(233, 168, 107, 0.15);
}

.leaderboard-rank {
  font-size: 15px;
  font-weight: 700;
  color: var(--brand);
  text-align: center;
}

.leaderboard-item:nth-child(1) .leaderboard-rank {
  color: #FFD700;
  font-size: 16px;
}

.leaderboard-item:nth-child(2) .leaderboard-rank {
  color: #C0C0C0;
}

.leaderboard-item:nth-child(3) .leaderboard-rank {
  color: #CD7F32;
}

.leaderboard-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.leaderboard-streak {
  font-size: 15px;
  font-weight: 700;
  color: var(--brand-2);
  text-align: center;
}

.leaderboard-words {
  font-size: 15px;
  font-weight: 700;
  color: var(--brand);
  text-align: center;
}

.leaderboard-date {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

/* Leaderboard Form in Overlay */
.leaderboard-form {
  background: linear-gradient(135deg, rgba(233, 168, 107, 0.12), rgba(233, 168, 107, 0.06));
  border: 2px solid rgba(233, 168, 107, 0.3);
  border-radius: var(--radius);
  padding: 20px;
  margin: 20px 0;
}

.leaderboard-form.hidden {
  display: none;
}

.leaderboard-congrats {
  margin: 0 0 16px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}

.leaderboard-congrats strong {
  color: var(--brand-2);
  font-size: 18px;
  display: block;
  margin-bottom: 4px;
}

.leaderboard-input-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.leaderboard-input {
  flex: 1;
  min-width: 200px;
  padding: 12px 16px;
  font-size: 15px;
  border: 2px solid rgba(233, 168, 107, 0.3);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font-family: inherit;
  transition: all 0.2s ease;
}

.leaderboard-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(233, 168, 107, 0.15);
}

.leaderboard-input::placeholder {
  color: var(--muted);
}

@media (max-width: 540px) {
  .leaderboard {
    padding: 14px 16px;
  }

  .leaderboard-columns {
    grid-template-columns: 20px 1fr 44px 44px 52px;
  }

  .leaderboard-item {
    grid-template-columns: 20px 1fr 44px 44px 52px;
    gap: 8px;
    padding: 6px 10px;
  }

  .leaderboard-rank {
    font-size: 14px;
  }

  .leaderboard-name {
    font-size: 13px;
  }

  .leaderboard-streak {
    font-size: 14px;
  }

  .leaderboard-words {
    font-size: 14px;
  }

  .leaderboard-input-group {
    flex-direction: column;
  }

  .leaderboard-input {
    min-width: 100%;
  }
}

/* Best Streak Display in Overlay */
.best-streak-display {
  background: linear-gradient(135deg, rgba(233, 168, 107, 0.2), rgba(233, 168, 107, 0.1));
  border: 2px solid rgba(233, 168, 107, 0.4);
  border-radius: var(--radius);
  padding: 20px;
  margin: 20px 0;
  text-align: center;
}

.best-streak-display.hidden {
  display: none;
}

.best-streak-label {
  font-size: 14px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.best-streak-value {
  font-size: 48px;
  font-weight: 800;
  color: var(--brand-2);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.best-streak-value::before {
  content: "🔥";
  font-size: 40px;
}

/* Tertiary button style */
.btn.tertiary {
  background: linear-gradient(135deg, rgba(233, 168, 107, 0.15), rgba(233, 168, 107, 0.08));
  color: var(--brand-2);
  border: 2px solid rgba(233, 168, 107, 0.4);
}

.btn.tertiary:hover {
  background: linear-gradient(135deg, rgba(233, 168, 107, 0.25), rgba(233, 168, 107, 0.15));
  border-color: var(--brand);
  transform: translateY(-1px);
}

/* Smaller overlay card for leaderboard input */
.overlay__card--small {
  max-width: 420px;
}

@media (max-width: 540px) {
  .best-streak-value {
    font-size: 36px;
  }

  .best-streak-value::before {
    font-size: 32px;
  }
}
