﻿/* Menu Styles */
#menu-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
      width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    /* height: 100vh; */
}

#menu-icon {
    width: 250px;
    height: 250px;
}

#game-icon-left,
#game-icon-right {
    height: 55px;
    width: 55px;
    object-fit: contain;
    flex-shrink: 0;
}

#game-icon-right {
    transform: scaleX(-1); /* Flip horizontally */
}

/* Legacy support for old #game-icon */
#game-icon {
    height: 50px;
    width: 50px;
    object-fit: contain;
    flex-shrink: 0;
}

#menu-title,
#game-title {
  font-family: var(--home-display-font);
  font-size: 48px;
  color: var(--home-display-color);
  -webkit-text-stroke: var(--home-display-stroke);
  text-shadow: var(--home-display-shadow);
  /* heavier bottom glow */

  /* letter-spacing: 2px; */
  margin: 10px 0;
}

#game-title {
    white-space: nowrap;
    overflow: visible;
    flex-shrink: 1;
    font-size: 40px;
    margin: 3px 0;
    text-align: center;
}

#banner-container {
  width: 100%;
  overflow: hidden;
  position: relative;
  height: 30px;
  max-width: 900px;
}

#moving-banner {
  position: absolute;
  font-style: italic;
  color: var(--theme-gold-base);
  white-space: nowrap;
  opacity: 0;
  transform: translateX(0);
  transition: none;
}

#start-game, #daily-challenge, #open-duel-lobby-popup {
    padding: 12px 20px;
    background-color: var(--theme-red-deep);
    color: #ffffff;
    border: 1px solid var(--theme-gold-base);
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    margin: 8px 0;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.menu-play-row {
  width: 100%;
  max-width: 1120px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.duel-menu-row {
  flex-wrap: wrap;
}

#duel-lobby-popup-overlay.duel-lobby-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100dvh;
  z-index: 10035;
  background: rgba(0, 0, 0, 0.72);
  display: grid;
  place-items: center;
  padding: 14px;
}

.duel-lobby-popup-overlay.hidden {
  display: none !important;
}

.duel-lobby-popup {
  width: min(900px, 96vw);
  background: linear-gradient(160deg, rgba(17, 17, 20, 0.98), rgba(25, 25, 29, 0.98));
  border: 1px solid rgba(var(--theme-gold-rgb), 0.6);
  border-radius: 14px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.5);
  padding: 12px;
}

.duel-lobby-popup-grid {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto minmax(120px, 1fr) minmax(180px, 1.25fr);
  gap: 10px;
  align-items: center;
}

.duel-lobby-popup-grid > * {
  min-width: 0;
}

.duel-lobby-popup .eg-primary-btn {
  width: 100%;
  min-height: 46px;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.duel-lobby-popup .eg-primary-btn.duel-action-loading::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(245, 215, 142, 0.35), rgba(245, 215, 142, 0.52));
  animation: duel-popup-load 1.1s ease-in-out infinite;
  z-index: -1;
}

.duel-lobby-popup .eg-primary-btn.duel-action-loading {
  pointer-events: none;
}

.duel-lobby-popup .eg-primary-btn.duel-action-denied {
  background: linear-gradient(180deg, #6f6f74 0%, #505057 100%) !important;
  border-color: rgba(220, 220, 220, 0.6) !important;
  color: #efefef !important;
  animation: duel-popup-denied 0.24s linear 2;
}

@keyframes duel-popup-load {
  0% { transform: translateX(-92%); }
  100% { transform: translateX(92%); }
}

@keyframes duel-popup-denied {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  75% { transform: translateX(2px); }
}

.duel-lobby-popup-or {
  color: rgba(255, 241, 216, 0.86);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  text-align: center;
  justify-self: center;
}

#duel-code-input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border-color: rgba(var(--theme-gold-rgb), 0.45);
  background: rgba(18, 18, 22, 0.88);
  color: #f0f0f0;
  padding: 10px 10px;
  text-transform: uppercase;
  text-align: center;
}

body.wizard-open {
  overflow: hidden;
}

body.duel-lobby-popup-open {
  overflow: hidden;
}

.custom-game-wizard-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  z-index: 10030;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.custom-game-wizard-overlay.hidden {
  display: none;
}

.custom-game-wizard {
  width: min(900px, 96vw);
  max-height: 92vh;
  overflow: auto;
  overflow-x: hidden;
  background: linear-gradient(160deg, rgba(17, 17, 20, 0.98), rgba(25, 25, 29, 0.98));
  border: 1px solid rgba(var(--theme-gold-rgb), 0.6);
  border-radius: 14px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.5);
  padding: 14px;
  position: relative;
}

.custom-game-wizard-close,
#close-leaderboard-filters {
  background: none;
  border: none;
  color: var(--theme-gold-base);
  font-size: 36px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 40px;
  height: 40px;
  transition: transform 0.2s ease;
}

.custom-game-wizard-close {
  position: absolute;
  top: 10px;
  left: auto !important;
  right: 10px !important;
}

.custom-game-wizard-header {
  text-align: center;
  margin-bottom: 12px;
}

.custom-game-wizard-header h2 {
  margin: 0;
  color: var(--theme-gold-base);
}

.custom-game-wizard-header p {
  margin: 6px 0 0;
  color: #c2c2c2;
}

.custom-game-wizard-body {
  display: grid;
  gap: 10px;
}

.custom-game-wizard-copy {
  margin: 0;
  color: #ddd;
  text-align: center;
}

#custom-game-wizard-difficulty-buttons,
.custom-game-wizard-mode-grid,
.custom-game-wizard-checkbox-list {
  display: grid;
  gap: 8px;
}

#custom-game-wizard-difficulty-buttons {
  width: min(760px, 100%);
  margin: 0 auto;
}

@media (min-width: 920px) {
  #custom-game-wizard-difficulty-buttons {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "veryeasy veryeasy"
      "easy easy"
      "normal normal"
      "hard hard"
      "racebolt reversed";
    align-items: stretch;
  }
  #custom-game-wizard-difficulty-buttons .difficulty-btn-wrapper:nth-child(1) { grid-area: veryeasy; }
  #custom-game-wizard-difficulty-buttons .difficulty-btn-wrapper:nth-child(2) { grid-area: easy; }
  #custom-game-wizard-difficulty-buttons .difficulty-btn-wrapper:nth-child(3) { grid-area: normal; }
  #custom-game-wizard-difficulty-buttons .difficulty-btn-wrapper:nth-child(4) { grid-area: hard; }
  #custom-game-wizard-difficulty-buttons .custom-game-wizard-racebolt-slot { grid-area: racebolt; }
  #custom-game-wizard-difficulty-buttons .custom-game-wizard-reversed-slot { grid-area: reversed; }
}

.custom-game-wizard-mode-btn {
  min-height: 44px;
  border: 1px solid var(--theme-gold-base);
  border-radius: 10px;
  background: rgba(var(--theme-red-deep-rgb), 0.75);
  color: #fff;
  cursor: pointer;
  font-size: 16px;
  font-family: var(--home-display-font);
  position: relative;
  padding-right: 88px;
}

.custom-game-wizard-mode-btn.selected {
  outline: 2px solid rgba(var(--theme-gold-rgb), 0.95);
  background: linear-gradient(180deg, var(--theme-red-hover) 0%, var(--theme-red-deep) 100%);
}

.custom-game-wizard-mode-btn.locked {
  background-color: #555;
  cursor: not-allowed;
}

.custom-game-wizard-mode-btn .lock-chip {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  margin-left: 0;
}

.custom-game-wizard .difficulty-btn-wrapper {
  margin: 0;
}

.custom-game-wizard .difficulty-btn {
  width: 100%;
  position: relative;
  font-family: var(--home-display-font);
  padding-right: 88px;
}

.custom-game-wizard .difficulty-btn .lock-chip {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  margin-left: 0;
}

.custom-game-wizard .difficulty-btn.selected {
  transform: none;
  animation: none;
  box-shadow: 0 0 12px rgba(var(--theme-gold-rgb), 0.28) inset;
}

.custom-game-wizard .custom-game-wizard-reversed-btn.selected {
  animation: pulse-gold 1.2s infinite ease-in-out !important;
  box-shadow: 0 0 10px var(--theme-gold-base), 0 0 20px var(--theme-gold-base) inset !important;
}

.custom-game-wizard-checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(var(--theme-gold-rgb), 0.35);
  border-radius: 10px;
  padding: 9px 10px;
  color: var(--theme-gold-muted);
  background: rgba(0, 0, 0, 0.24);
}

.custom-game-wizard-checkbox-row input {
  accent-color: var(--theme-gold-base);
}

.custom-game-wizard-checkbox-row.is-locked {
  opacity: 0.92;
}

.custom-game-wizard-info,
.custom-game-wizard-note {
  margin: 0;
  color: #bdbdbd;
  text-align: center;
}

.custom-game-wizard-summary {
  border: 1px solid rgba(var(--theme-gold-rgb), 0.35);
  border-radius: 10px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.24);
}

.custom-game-wizard-summary p {
  margin: 5px 0;
  color: #ddd;
}

.custom-game-wizard-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.custom-game-wizard-nav,
.custom-game-wizard-play {
  min-width: 110px;
  min-height: 46px;
  line-height: 1.25;
  border: 1px solid var(--theme-gold-base);
  border-radius: 10px;
  background: linear-gradient(180deg, var(--theme-red-base) 0%, var(--theme-red-deep) 100%);
  color: #fff;
  padding: 9px 12px;
  cursor: pointer;
  font-size: 15px;
  font-family: var(--home-display-font);
}

.custom-game-wizard-nav:hover,
.custom-game-wizard-play:hover {
  background: linear-gradient(180deg, var(--theme-red-hover) 0%, var(--theme-red-deep) 100%);
}

.custom-game-wizard-close:hover,
#close-leaderboard-filters:hover {
  transform: scale(1.2) rotate(90deg);
  color: var(--theme-red-base);
}

@media (max-width: 768px) {
  .custom-game-wizard-overlay {
    padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom)) 8px;
  }

  .custom-game-wizard {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    padding: 12px 10px 10px;
    border-radius: 12px;
    -webkit-overflow-scrolling: touch;
  }

  .custom-game-wizard-header {
    padding-right: 40px;
  }

  .custom-game-wizard-header h2 {
    font-size: 20px;
    line-height: 1.2;
  }

  .custom-game-wizard-header p {
    font-size: 13px;
  }

  .custom-game-wizard .difficulty-btn,
  .custom-game-wizard-mode-btn {
    min-height: 50px;
    font-size: 15px;
    line-height: 1.25;
    white-space: normal;
  }

  .custom-game-wizard .difficulty-btn {
    padding: 10px 90px 10px 12px;
  }

  .custom-game-wizard-checkbox-row {
    align-items: flex-start;
    padding: 10px;
  }

  .custom-game-wizard-checkbox-row span {
    flex: 1 1 auto;
    min-width: 0;
    line-height: 1.3;
  }

  .custom-game-wizard-actions {
    position: sticky;
    bottom: 0;
    margin-top: 10px;
    padding-top: 8px;
    background: linear-gradient(180deg, rgba(17, 17, 20, 0), rgba(17, 17, 20, 0.95) 30%);
  }

  .custom-game-wizard-nav,
  .custom-game-wizard-play {
    flex: 1 1 0;
    min-width: 0;
    font-size: 14px;
    padding: 10px;
  }
}

@media (max-width: 420px) {
  .custom-game-wizard {
    width: calc(100vw - 12px);
    max-height: calc(100dvh - 12px);
    padding: 10px 8px 8px;
  }

  .custom-game-wizard-close {
    top: 8px;
    left: auto !important;
    right: 8px !important;
    width: 30px;
    height: 30px;
  }

  .custom-game-wizard-header h2 {
    font-size: 18px;
  }

  .custom-game-wizard .difficulty-btn {
    font-size: 14px;
    padding-right: 82px;
  }

  .custom-game-wizard .lock-chip {
    min-width: 42px;
    padding: 2px 5px;
    font-size: 9px;
  }
}

.identity-stack {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 8px;
  margin: 8px auto 12px auto;
}

.identity-top-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.identity-hud-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 8px;
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.economy-profile-card {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  border: none;
  border-radius: 10px;
  background: transparent;
  padding: 8px;
  overflow: hidden;
}

.identity-hud-row .economy-profile-card {
  width: 100%;
  margin: 0;
  min-width: 0;
  overflow: hidden;
}

.economy-profile-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}

.economy-level-pill,
.economy-credits-pill {
  color: var(--theme-gold-muted);
}

.economy-level-pill strong,
.economy-credits-pill strong {
  color: #fff;
}

.economy-xp-track {
  margin-top: 6px;
  height: 10px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.economy-xp-fill {
  height: 100%;
  width: 0%;
  max-width: 100%;
  box-sizing: border-box;
  background: linear-gradient(
    90deg,
    #1f0d10 0%,
    rgba(var(--theme-red-deep-rgb), 0.95) 28%,
    var(--theme-gold-base) 62%,
    #7dd6dd 100%
  );
  transition: width 700ms ease-out;
}

.economy-xp-label {
  margin-top: 4px;
  text-align: center;
  color: #d6d6d6;
  font-size: 11px;
}

.economy-level-up {
  animation: pulse-gold 1s ease-in-out 2;
}

.lock-chip {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  margin-left: auto;
  padding: 2px 6px;
  min-width: 48px;
  box-sizing: border-box;
  border-radius: 999px;
  border: 1px solid var(--theme-gold-base);
  background: rgba(var(--theme-red-deep-rgb), 0.7);
  color: #fff3d0;
  font-size: 10px;
  text-align: left;
}

.purchase-hint {
  font-size: 11px;
  color: var(--theme-gold-accent);
  margin-top: 4px;
}

label.is-locked,
.difficulty-btn-wrapper.is-locked {
  opacity: 0.9;
  cursor: pointer;
}

label.is-locked input[type="checkbox"],
label.is-locked input[type="radio"] {
  pointer-events: none;
}

.purchase-toast {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 10050;
  background: #111;
  border: 1px solid var(--theme-gold-base);
  border-radius: 8px;
  padding: 8px 10px;
  color: #f3f3f3;
  font-size: 13px;
}

.menu-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 10080;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.menu-confirm-dialog {
  width: min(92vw, 520px);
  border-radius: 12px;
  border: 2px solid var(--theme-gold-base);
  background: linear-gradient(145deg, #2b2b2b, #171717);
  color: #f1f1f1;
  box-shadow: 0 12px 38px rgba(0, 0, 0, 0.5), 0 0 18px rgba(var(--theme-gold-rgb), 0.28);
  padding: 18px;
}

.menu-confirm-title {
  margin: 0 0 8px 0;
  color: var(--theme-gold-base);
}

.menu-confirm-message {
  margin: 0;
  white-space: pre-line;
  line-height: 1.45;
  color: #e7e7e7;
}

.menu-confirm-actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.menu-confirm-actions button {
  border: 1px solid var(--theme-gold-base);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  cursor: pointer;
}

.menu-confirm-cancel {
  background: #202020;
  color: #d9d9d9;
}

.menu-confirm-ok {
  background: linear-gradient(145deg, #f7cf62, #d09a1c);
  color: #111111;
  font-weight: 700;
}

#menu-reward-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  /* Same stacking as #end-game-popup: must sit above #popup-overlay (40000) */
  z-index: 40001;
  width: min(92vw, 620px);
}

#close-menu-reward-popup {
  margin: 8px auto 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 148px;
  min-height: 42px;
  padding: 10px 18px;
  border: 1px solid rgba(var(--theme-gold-rgb), 0.62);
  border-radius: 10px;
  background: linear-gradient(180deg, var(--theme-red-base) 0%, var(--theme-red-deep) 100%);
  color: var(--theme-gold-soft);
  font-family: var(--home-display-font);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 140ms ease, background 140ms ease;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

#close-menu-reward-popup:hover {
  background: linear-gradient(180deg, var(--theme-red-hover) 0%, var(--theme-red-deep) 100%);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45), 0 0 14px rgba(var(--theme-gold-rgb), 0.26);
  transform: translateY(-1px);
}

#close-menu-reward-popup:active {
  transform: translateY(0);
}

.menu-achievement-toast {
  position: fixed;
  top: calc(50% + 235px);
  left: 50%;
  transform: translate(-50%, 20px) scale(0.97);
  opacity: 0;
  width: min(92vw, 620px);
  background: linear-gradient(145deg, #2c2c2c, #1a1a1a);
  border: 2px solid var(--theme-gold-base);
  border-radius: 14px;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.45), 0 0 24px rgba(var(--theme-gold-rgb), 0.25);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  z-index: 40002;
  transition: transform 220ms ease, opacity 220ms ease;
  overflow: hidden;
}

.menu-achievement-toast.show {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.menu-achievement-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, var(--theme-gold-base), var(--theme-red-base));
  font-size: 28px;
}

.menu-achievement-credit {
  position: absolute;
  top: 8px;
  right: 10px;
  border: 1px solid var(--theme-gold-base);
  border-radius: 999px;
  padding: 2px 7px;
  background: rgba(var(--theme-red-deep-rgb), 0.85);
  color: var(--theme-gold-soft);
  font-size: 11px;
  font-weight: 700;
}

.menu-achievement-content {
  min-width: 0;
}

.menu-achievement-kicker {
  color: var(--theme-gold-base);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.menu-achievement-title {
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.1;
}

.menu-achievement-description {
  color: #ddd;
  font-size: 13px;
  margin-top: 4px;
}

#player-name-home {
  --name-font-max: 24px;
  --name-font-min: 12px;
  width: auto;
  flex: 1 1 auto;
  min-width: 0;
  max-width: unset;
  height: 42px;
  box-sizing: border-box;
  margin: 0 auto;
  padding: 8px 10px;
  border: 1px solid var(--theme-gold-base);
  border-radius: 5px;
  background-color: #1a1a1a;
  color: var(--home-display-color);
  font-family: 'Cinzel', serif;
  font-size: var(--name-font-max);
  text-align: center !important;
  text-align-last: center;
  -webkit-text-stroke: 0.1px #000000;
  text-shadow:
    -1px -1px 0 #000000,
    1px -1px 0 #000000,
    -1px 1px 0 #000000,
    1px 1px 0 #000000,
    0px -2px 1px var(--theme-red-deep);
}

#player-name-home::placeholder {
  color: rgba(var(--theme-gold-rgb), 0.65);
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 400;
  -webkit-text-stroke: 0;
  text-shadow: none;
  text-align: center !important;
  text-align-last: center;
}

#player-name-home:disabled {
  cursor: not-allowed;
  background-color: transparent;
  border-color: transparent;
  box-shadow: none;
  text-align: center !important;
  text-align-last: center;
  color: var(--home-display-color);
  -webkit-text-fill-color: var(--home-display-color);
  opacity: 1;
}

#player-name-home:-webkit-autofill,
#player-name-home:-webkit-autofill:hover,
#player-name-home:-webkit-autofill:focus,
#player-name-home:-webkit-autofill:active {
  -webkit-text-fill-color: var(--home-display-color);
  box-shadow: 0 0 0 1000px #1a1a1a inset;
  -webkit-box-shadow: 0 0 0 1000px #1a1a1a inset;
  transition: background-color 9999s ease-out 0s;
}

#login-twitter-link {
  text-decoration: none;
  display: inline-block;
  width: auto;
  flex: 0 0 auto;
}



#stats {
    font-size: 18px;
    text-align: center;
}

#stats p {
    margin: 5px 0;
}

#contribute-message {
  color: var(--theme-gold-base);
  font-size: 0.85em;
  width: 100%;
  max-width: 900px;
  text-align: center;
  line-height: 1.0em;
  margin: 0px auto;
  padding: 0px 0;
}

.decimal {
  font-size: 0.6em;
  color: #999;
}
.small-cell {
  font-size: 0.85em !important;
  color: #999 !important;
}
