.screen[hidden] { display: none; }
.screen {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
}

/* ============ MENU ============ */
#menu-screen {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(0, 229, 255, 0.16), transparent 60%),
    radial-gradient(ellipse at 50% 100%, rgba(255, 47, 176, 0.14), transparent 60%),
    #06040f;
  justify-content: flex-start;
  padding: 6vh 20px 40px;
}

.menu-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

.logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 0.92;
  margin-top: 2vh;
}
.logo-line1, .logo-line2 {
  font-size: clamp(42px, 12vw, 64px);
  font-weight: 900;
  letter-spacing: 4px;
}
.logo-line1 {
  color: #eafcff;
  text-shadow: 0 0 20px rgba(0, 229, 255, 0.6);
}
.logo-line2 {
  background: linear-gradient(90deg, #00e5ff, #ff2fb0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 22px rgba(255, 47, 176, 0.55));
}

.tagline {
  text-align: center;
  color: rgba(230, 235, 255, 0.75);
  font-weight: 600;
  letter-spacing: 1px;
  font-size: 13px;
}

.btn {
  padding: 14px 36px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 1.5px;
  min-width: 220px;
  text-align: center;
  transition: transform 0.12s ease;
}
.btn:active { transform: scale(0.96); }
.btn-primary {
  background: linear-gradient(90deg, #00e5ff, #00b3ff);
  color: #04121a;
  box-shadow: 0 6px 24px rgba(0, 229, 255, 0.45);
}
.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #eafcff;
}
.btn-link {
  color: rgba(230, 235, 255, 0.65);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 10px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.btn-secondary {
  background: rgba(255, 210, 63, 0.12);
  border: 1px solid rgba(255, 210, 63, 0.5);
  color: #ffd23f;
}

.menu-best {
  font-size: 14px;
  font-weight: 700;
  color: rgba(230, 235, 255, 0.85);
  letter-spacing: 1px;
}
.menu-best span { color: #00e5ff; }

.menu-gold {
  font-size: 14px;
  font-weight: 700;
  color: #ffd23f;
  letter-spacing: 1px;
}

.menu-secondary {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.hint {
  font-size: 11px;
  color: rgba(230, 235, 255, 0.4);
  letter-spacing: 1px;
  margin-top: 6px;
}

.seo-copy {
  max-width: 560px;
  margin: 5vh auto 0;
  padding: 0 20px;
  color: rgba(230, 235, 255, 0.55);
  font-size: 13px;
  line-height: 1.6;
}
.seo-copy h2 { font-size: 15px; color: rgba(230,235,255,0.8); margin-bottom: 8px; }
.seo-copy h3 { font-size: 13px; color: rgba(230,235,255,0.7); margin: 14px 0 6px; }

/* ============ MODAL SCREENS ============ */
.modal-screen {
  background: rgba(4, 3, 12, 0.82);
  backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: linear-gradient(180deg, rgba(18, 14, 38, 0.96), rgba(10, 8, 24, 0.96));
  border: 1px solid rgba(0, 229, 255, 0.25);
  border-radius: 20px;
  padding: 28px 24px 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-card h2 {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #eafcff;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 24px;
  color: rgba(230, 235, 255, 0.6);
  line-height: 1;
  padding: 4px 8px;
}

/* ============ RESULT SCREEN ============ */
.result-title {
  color: #ff5470;
  text-shadow: 0 0 18px rgba(255, 84, 112, 0.6);
}
.new-high-badge[hidden] { display: none; }
.new-high-badge {
  font-weight: 800;
  color: #ffcf4d;
  font-size: 13px;
  letter-spacing: 1px;
}
.result-score {
  font-size: 46px;
  font-weight: 900;
  color: #eafcff;
  text-shadow: 0 0 16px rgba(0, 229, 255, 0.55);
  font-variant-numeric: tabular-nums;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 18px;
  width: 100%;
  margin-top: 4px;
}
.result-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.result-item-label {
  font-size: 10px;
  letter-spacing: 1.5px;
  color: rgba(230, 235, 255, 0.5);
  font-weight: 700;
}
.result-item-value {
  font-size: 18px;
  font-weight: 800;
  color: #eafcff;
}

.result-distance {
  font-size: 12px;
  color: rgba(230, 235, 255, 0.65);
  text-align: center;
  font-weight: 600;
}
.result-distance[hidden] { display: none; }

.nickname-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 6px;
}
.nickname-label {
  font-size: 10px;
  letter-spacing: 1.5px;
  color: rgba(230, 235, 255, 0.55);
  font-weight: 700;
}
#nickname-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(0, 229, 255, 0.3);
  background: rgba(255, 255, 255, 0.06);
  color: #eafcff;
  font-size: 15px;
  text-align: center;
  letter-spacing: 1px;
  text-transform: uppercase;
}
#nickname-input:focus {
  outline: 2px solid #00e5ff;
  outline-offset: 1px;
}
.save-status {
  font-size: 12px;
  min-height: 16px;
  color: rgba(230, 235, 255, 0.7);
  text-align: center;
}
.save-status.error { color: #ff5470; }
.save-status.success { color: #4dff9e; }

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin-top: 4px;
}

/* ============ HOW TO PLAY ============ */
.howto-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(230, 235, 255, 0.85);
}
.howto-list strong { color: #00e5ff; }

/* ============ LEADERBOARD ============ */
.leaderboard-card { max-width: 420px; }
.leaderboard-tabs {
  display: flex;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px;
  border-radius: 999px;
}
.lb-tab {
  padding: 6px 18px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: rgba(230, 235, 255, 0.6);
}
.lb-tab.active {
  background: linear-gradient(90deg, #00e5ff, #00b3ff);
  color: #04121a;
}
.leaderboard-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 320px;
  overflow-y: auto;
}
.leaderboard-loading, .leaderboard-empty {
  text-align: center;
  color: rgba(230, 235, 255, 0.5);
  font-size: 13px;
  padding: 20px 0;
}
.lb-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13px;
}
.lb-row:nth-child(odd) { background: rgba(255, 255, 255, 0.03); }
.lb-row.lb-you { background: rgba(0, 229, 255, 0.15); border: 1px solid rgba(0, 229, 255, 0.4); }
.lb-rank { font-weight: 800; color: rgba(230, 235, 255, 0.6); }
.lb-rank.top1 { color: #ffd54d; }
.lb-rank.top2 { color: #d8dee8; }
.lb-rank.top3 { color: #e0a458; }
.lb-name {
  font-weight: 700;
  color: #eafcff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lb-score { font-weight: 800; color: #00e5ff; font-variant-numeric: tabular-nums; }
.leaderboard-you[hidden] { display: none; }
.leaderboard-you {
  width: 100%;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ============ GARAGE ============ */
.garage-card { max-width: 440px; }
.garage-gold-bar {
  font-size: 15px;
  font-weight: 800;
  color: #ffd23f;
  letter-spacing: 1px;
  text-shadow: 0 0 10px rgba(255, 210, 63, 0.5);
}
.garage-tabs {
  display: flex;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px;
  border-radius: 999px;
}
.garage-tab {
  padding: 6px 18px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: rgba(230, 235, 255, 0.6);
}
.garage-tab.active {
  background: linear-gradient(90deg, #ffd23f, #ff9d4d);
  color: #2a1a00;
}
.garage-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 340px;
  overflow-y: auto;
}
.garage-item {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.garage-item.equipped {
  border-color: rgba(77, 255, 158, 0.5);
  background: rgba(77, 255, 158, 0.08);
}
.garage-preview {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.garage-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;
}
.garage-name {
  font-weight: 700;
  color: #eafcff;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.garage-subtitle {
  font-size: 11px;
  color: rgba(230, 235, 255, 0.5);
}
.garage-btn {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: linear-gradient(90deg, #ffd23f, #ff9d4d);
  color: #2a1a00;
  white-space: nowrap;
}
.garage-btn:disabled {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(230, 235, 255, 0.45);
}

/* ============ ERROR TOAST ============ */
.error-toast[hidden] { display: none; }
.error-toast {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 6, 12, 0.92);
  border: 1px solid rgba(255, 84, 112, 0.5);
  color: #ffd4dc;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  z-index: 60;
  max-width: 90vw;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

@media (max-width: 380px) {
  .btn { min-width: 180px; padding: 12px 28px; font-size: 14px; }
}
