/* RESET WITHIN THE GAME WRAPPER */
.rr-page * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* MAIN WRAPPER */
.rr-page {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  font-size: 16px;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, #172554, transparent 55%),
    radial-gradient(circle at bottom right, #164e63, transparent 55%),
    linear-gradient(to bottom, #020617, #020617);
  color: #f9fafb;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 24px;
}

/* HEADER BAR */
.rr-page header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.7);
  margin-bottom: 18px;
  width: 100%;
  max-width: 1400px;
}

.rr-page header h1 {
  font-size: 1.4rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 10px;
}

.rr-page header h1 span.logo-icon {
  font-size: 1.6rem;
}

.rr-page header .badge {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  color: #9ca3af;
}

/* MAIN LAYOUT */
.rr-page main {
  width: 100%;
  max-width: 1400px;
  display: grid;
  grid-template-columns: minmax(0, 2.4fr) minmax(280px, 1fr);
  gap: 18px;
}

@media (max-width: 900px) {
  .rr-page main {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* CARDS */
.rr-page .card {
  background:
    radial-gradient(circle at top left, rgba(148, 163, 184, 0.06), transparent 60%),
    radial-gradient(circle at bottom right, rgba(34, 197, 94, 0.08), transparent 60%),
    #0f172a;
  border-radius: 16px;
  border: 1px solid #1f2937;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.6);
  padding: 20px 18px 22px;
  position: relative;
  overflow: hidden;
}

.rr-page .card-inner {
  position: relative;
  z-index: 1;
}

.rr-page .card h2 {
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #9ca3af;
  margin-bottom: 14px;
}

.rr-page .subtext {
  font-size: 0.95rem;
  color: #9ca3af;
  margin-bottom: 16px;
}

/* FORM FIELDS */
.rr-page .field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.rr-page label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #9ca3af;
}

.rr-page input[type="text"],
.rr-page select {
  background-color: rgba(15, 23, 42, 0.9);
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  padding: 10px 16px;
  color: #f9fafb;
  font-size: 0.95rem;
  outline: none;
}

.rr-page input[type="text"]:focus,
.rr-page select:focus {
  border-color: #38bdf8;
  background-color: rgba(15, 23, 42, 1);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.4);
}

/* BUTTONS */
.rr-page button {
  border-radius: 999px;
  border: none;
  padding: 11px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.12s ease-out, box-shadow 0.12s ease-out, background 0.15s ease-out;
}

.rr-page button:disabled {
  opacity: 0.55;
}

.rr-page .btn-primary {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #052e16;
  box-shadow: 0 10px 30px rgba(34, 197, 94, 0.45);
}

.rr-page .btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(34, 197, 94, 0.65);
}

.rr-page .btn-ghost {
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.5);
  color: #9ca3af;
}

.rr-page .btn-ghost:hover:not(:disabled) {
  transform: translateY(-1px);
  background: rgba(17, 24, 39, 0.9);
}

.rr-page .hidden {
  display: none !important;
}

/* RACE TRACK */
.rr-page .race-card {
  margin-bottom: 18px;
}

.rr-page .race-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}

.rr-page .pill {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  color: #9ca3af;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.9);
}

.rr-page .race-track {
  background: linear-gradient(135deg, #0a2540 0%, #1b3a6d 50%, #2a2d7c 100%);
  border-radius: 16px;
  padding: 14px 10px 16px;
  border: 1px solid #1f2937;
  box-shadow: inset 0 0 0 1px #0f172a;
  position: relative;
  overflow: hidden;
}

.rr-page .lane {
  position: relative;
  padding: 14px 0;
}

.rr-page .lane + .lane {
  border-top: 1px dashed rgba(55, 65, 81, 0.8);
}

.rr-page .lane-label {
  font-size: 0.9rem;
  color: #9ca3af;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.rr-page .lane-label span.name {
  font-weight: 600;
  color: #e5e7eb;
}

.rr-page .lane-label .tag {
  font-size: 0.8rem;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid #374151;
  background: #0f172a;
}

.rr-page .track-inner {
  position: relative;
  height: 55px;
}

.rr-page .finish-flag {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 2.4rem;
  filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.7));
}

.rr-page .reindeer {
  width: 40px;
  height: auto;
  display: block;
  position: absolute;
  top: 50%;
  transform: translateY(-50%) scaleX(-1) !important;
  transition: left 0.25s linear;
  pointer-events: none;
}

/* HUD */
.rr-page .hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.rr-page .hud-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.rr-page .hud-item {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #9ca3af;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.rr-page .hud-value {
  font-size: 1rem;
  font-weight: 600;
  color: #f9fafb;
}

/* QUESTION AREA */
.rr-page .question-card h2 {
  margin-bottom: 10px;
}

.rr-page #question-text {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.rr-page .question-meta {
  font-size: 0.95rem;
  color: #9ca3af;
  margin-bottom: 16px;
}

.rr-page #answers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 600px) {
  .rr-page #answers {
    grid-template-columns: 1fr;
  }
}

/* ANSWER BUTTONS */
.rr-page .answer-btn {
  width: 100%;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(55, 65, 81, 0.95);
  color: #e5e7eb;
  padding: 12px 16px;
  font-size: 1rem;
  border-radius: 14px;
  text-align: left;
  position: relative;
  overflow: hidden;
}

.rr-page .answer-btn span.label {
  flex: 1;
  white-space: normal;
}

.rr-page .answer-btn span.key {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #9ca3af;
}

.rr-page .answer-btn.correct {
  background: #052e16;
  border-color: #22c55e;
  color: #dcfce7;
}

.rr-page .answer-btn.incorrect {
  background: #450a0a;
  border-color: #ef4444;
  color: #fee2e2;
}

/* SIDEBAR / LEADERBOARD */
.rr-page .sidebar-section + .sidebar-section {
  margin-top: 16px;
}

.rr-page .sidebar-title {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: #9ca3af;
  margin-bottom: 8px;
}

.rr-page .leaderboard-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 4px;
}

.rr-page .leaderboard-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid #1f2937;
  font-size: 0.95rem;
}

.rr-page .leaderboard-item.me {
  border-color: #22c55e;
  box-shadow: 0 0 16px rgba(34, 197, 94, 0.35);
}

.rr-page .lb-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.rr-page .lb-rank {
  font-size: 0.8rem;
  width: 18px;
  text-align: right;
  color: #9ca3af;
}

.rr-page .lb-name {
  font-weight: 500;
}

.rr-page .lb-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 0.8rem;
  color: #9ca3af;
}

/* RESULT SCREEN */
.rr-page #result-screen {
  margin-top: 12px;
  border-radius: 16px;
  border: none;
  background: rgba(15, 23, 42, 0.85);
}

.rr-page #result-screen h3 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: #9ca3af;
  margin-bottom: 10px;
}

.rr-page #result-screen .result-main {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 5px;
}

.rr-page #result-screen .result-sub {
  font-size: 0.95rem;
  color: #9ca3af;
  margin-bottom: 12px;
}

/* FOOTER */
.rr-page footer {
  margin-top: 6px;
  font-size: 0.8rem;
  color: #9ca3af;
  text-align: right;
  opacity: 0.75;
}

#question-area.hidden,
#result-screen.hidden {
  display: none;
}

#result-screen {
  animation: fadeIn 0.35s ease;
}

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

/* When all categories are completed, hide scoring info and let leaderboard expand */
.rr-page.all-categories-complete #scoring-info {
  display: none;
}

.rr-page.all-categories-complete .leaderboard-list {
  max-height: none;
  overflow-y: visible;
}

.rr-page header h1 {
  color: #ffffff !important;
}

