/* Scoped Styles for Math Runner 3D Game */

.math-runner-page {
  background-color: #0b0f19;
  color: #f3f4f6;
  font-family: 'Prompt', 'Kanit', sans-serif;
  overflow-x: hidden;
}

/* Category Background Theme Orbs */
.bg-theme-addition { background: radial-gradient(circle at 10% 10%, rgba(34, 211, 238, 0.08) 0%, #080c14 100%); }
.bg-theme-subtraction { background: radial-gradient(circle at 10% 10%, rgba(248, 113, 113, 0.08) 0%, #080c14 100%); }
.bg-theme-multiplication { background: radial-gradient(circle at 10% 10%, rgba(192, 132, 252, 0.08) 0%, #080c14 100%); }
.bg-theme-division { background: radial-gradient(circle at 10% 10%, rgba(52, 211, 153, 0.08) 0%, #080c14 100%); }
.bg-theme-mixed { background: radial-gradient(circle at 10% 10%, rgba(251, 191, 36, 0.06) 0%, #080c14 100%); }

/* Game Shell Core layout */
.game-shell {
  min-height: calc(100vh - 120px);
  display: grid;
  place-items: center;
  padding: 24px 16px;
  position: relative;
  z-index: 10;
  box-sizing: border-box;
}

/* START SCREEN CARD */
.hero-card {
  background: rgba(17, 24, 39, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 28px;
  padding: 32px clamp(16px, 4vw, 40px);
  max-width: 680px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  box-sizing: border-box;
  animation: cardFadeIn 0.5s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

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

.menu-top-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.menu-sound-btn, .hud-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 1.1rem;
  padding: 8px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.menu-sound-btn:hover, .hud-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: scale(1.05);
}
.menu-sound-btn.sound-off, .hud-btn.sound-off {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
}

.leaderboard-corner-btn {
  background: linear-gradient(135deg, #fbbf24, #d97706);
  border: none;
  color: #000;
  font-weight: 800;
  padding: 8px 16px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(251, 191, 36, 0.25);
  transition: all 0.2s;
}
.leaderboard-corner-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(251, 191, 36, 0.4);
}

.game-logo-mini {
  font-size: 4rem;
  margin-bottom: 8px;
  animation: bobRunning 1.2s infinite ease-in-out;
}
@keyframes bobRunning {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-8px) rotate(4deg); }
}

.eyebrow {
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: #3b82f6;
  margin: 0;
}
.hero-card h1 {
  font-size: clamp(2rem, 5vw, 2.8rem);
  font-weight: 900;
  margin: 8px 0;
  background: linear-gradient(135deg, #fff 40%, #9ca3af 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.02em;
}
.subtitle {
  color: #9ca3af;
  font-size: 0.95rem;
  margin-bottom: 24px;
  line-height: 1.5;
}

/* User profile display bridge style */
.player-profile-bar-wrapper {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 12px;
}
.player-profile-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  text-align: left;
}
.profile-avatar-btn {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.2);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  padding: 0;
}
.profile-avatar-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.avatar-edit-badge {
  position: absolute;
  bottom: 0;
  inset-inline: 0;
  background: rgba(0, 0, 0, 0.6);
  font-size: 0.6rem;
  text-align: center;
  padding: 2px 0;
  color: #fff;
  opacity: 0;
  transition: opacity 0.2s;
}
.profile-avatar-btn:hover .avatar-edit-badge {
  opacity: 1;
}

.player-name-container {
  flex: 1;
}
.player-name-display {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.1rem;
}
.edit-name-btn {
  background: transparent;
  border: none;
  color: #60a5fa;
  cursor: pointer;
  font-size: 0.95rem;
}
.player-name-input {
  background: rgba(0, 0, 0, 0.3);
  border: 1.5px solid rgba(96, 165, 250, 0.3);
  color: #fff;
  font-family: inherit;
  font-size: 1.05rem;
  padding: 6px 12px;
  border-radius: 8px;
  width: 100%;
  box-sizing: border-box;
}
.player-name-input:focus {
  outline: none;
  border-color: #60a5fa;
}

.toa-game-member-notice {
  font-size: 0.72rem;
  color: #10b981;
  margin-top: 2px;
}

.mascot-picker-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
}
.mascot-card {
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  background: rgba(255,255,255,0.03);
  border-radius: 18px;
  padding: 10px 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  color: #fff;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.mascot-card:hover {
  transform: translateY(-2px);
  border-color: rgba(96, 165, 250, 0.45);
  background: rgba(30, 41, 59, 0.88);
}
.mascot-card.active {
  border-color: rgba(96, 165, 250, 0.95);
  background: linear-gradient(180deg, rgba(59,130,246,0.18), rgba(15,23,42,0.9));
  box-shadow: 0 10px 24px rgba(59, 130, 246, 0.2);
}
.mascot-card img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: contain;
  border-radius: 14px;
  background: radial-gradient(circle at 50% 20%, rgba(255,255,255,0.18), rgba(255,255,255,0.02));
}
.mascot-card strong {
  font-size: 0.95rem;
  font-weight: 800;
}
.mascot-card small {
  font-size: 0.72rem;
  color: #9ca3af;
  font-weight: 600;
}
.mascot-desc {
  width: 100%;
  font-size: 0.78rem;
  line-height: 1.45;
  color: #9ca3af;
  text-align: left;
}

/* Grids selectors styling */
.setup-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 24px;
}
.field {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.field > span {
  font-size: 0.85rem;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
}

/* Grade Pills */
.grade-segmented {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.grade-pill {
  font-family: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  background: transparent;
  border: none;
  color: #9ca3af;
  padding: 8px 4px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.grade-pill:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}
.grade-pill.active {
  background: #3b82f6;
  color: #fff;
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.25);
}
.grade-desc {
  font-size: 0.78rem;
  color: #6b7280;
  text-align: left;
  line-height: 1.4;
}

/* Mode cards */
.mode-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  width: 100%;
}
.mode-card {
  font-family: inherit;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  padding: 12px 4px;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.mode-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}
.mode-icon {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent);
}
.mode-card strong {
  font-size: 0.8rem;
}
.mode-card.active {
  background: var(--accent);
  border-color: transparent;
  color: #000;
}
.mode-card.active .mode-icon {
  color: #000;
}

.start-actions {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}
.ghost-btn {
  text-decoration: none;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  color: #9ca3af;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 12px 24px;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
}
.ghost-btn:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.02);
}

.primary-btn {
  flex: 1;
  font-family: inherit;
  font-weight: 800;
  font-size: 1rem;
  background: #3b82f6;
  border: none;
  color: #fff;
  border-radius: 14px;
  padding: 12px 24px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}
.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(59, 130, 246, 0.5);
  filter: brightness(1.1);
}

/* ================================================== */
/* GAME SCREEN & HUD                                  */
/* ================================================== */
.game-screen {
  width: 100%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: cardFadeIn 0.4s ease-out;
}

.game-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(17, 24, 39, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px 16px;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}
.hud-stats {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.hud-capsule {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 6px 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  position: relative;
  overflow: hidden;
}
.hud-label {
  font-size: 0.62rem;
  font-weight: 800;
  color: #6b7280;
  letter-spacing: 0.08em;
}
.hud-main {
  font-size: 1rem;
  font-weight: 800;
}
.hud-mode-main {
  font-size: 0.82rem;
  font-weight: 700;
  color: #3b82f6;
}

/* Endless-run HUD helpers */
.lives-main {
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.lives-card .hud-main {
  font-size: 0.9rem;
}
.speed-card .hud-main {
  color: #fbbf24;
}


.lives-card.life-hit {
  animation: lifeHit 0.38s ease-out;
}
@keyframes lifeHit {
  0% { transform: scale(1); border-color: rgba(255,255,255,0.05); }
  38% { transform: scale(1.08); border-color: rgba(239,68,68,0.85); background: rgba(127,29,29,0.28); }
  100% { transform: scale(1); border-color: rgba(255,255,255,0.05); }
}
.speed-card.level-up {
  animation: speedLevelUp 0.48s ease-out;
}
@keyframes speedLevelUp {
  0% { transform: scale(1); }
  45% { transform: scale(1.1); border-color: rgba(251,191,36,0.85); box-shadow: 0 0 18px rgba(251,191,36,0.22); }
  100% { transform: scale(1); }
}

.score-pop {
  animation: scoreBounce 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes scoreBounce {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); border-color: #fbbf24; }
  100% { transform: scale(1); }
}

.hud-actions {
  display: flex;
  gap: 8px;
}
.hud-btn.danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
}

/* Question Banner inside Game View */
.hud-question-wrapper {
  background: rgba(17, 24, 39, 0.9);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 12px 16px;
  text-align: center;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
}
.question-label {
  font-size: 0.68rem;
  font-weight: 800;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  display: block;
  margin-bottom: 4px;
}
.hud-question-wrapper h2 {
  font-size: 2.05rem;
  font-weight: 900;
  margin: 0;
  color: #fff;
  letter-spacing: -0.01em;
}

/* 3D Canvas Game Wrapper */
.canvas-3d-wrapper {
  position: relative;
  width: 100%;
  height: 400px;
  background: #000;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.8);
}
#gameCanvas3d {
  width: 100%;
  height: 100%;
  display: block;
}

/* CSS absolute overlays for Gate text projection */
.css-gate-labels-container {
  position: absolute;
  inset: 0;
  pointer-events: none; /* Let canvas capture touch gestures */
  z-index: 50;
}
.gate-label-el {
  position: absolute;
  transform: translate(-50%, -50%);
  min-width: 56px;
  box-sizing: border-box;
  white-space: nowrap;
  text-align: center;
  background: rgba(8, 13, 24, 0.92);
  border: 2px solid var(--accent, #fbbf24);
  color: #fff;
  font-weight: 900;
  font-size: 1.65rem;
  line-height: 1;
  padding: 8px 14px;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.62), 0 0 16px var(--accent-glow, rgba(251, 191, 36, 0.4));
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.55), 0 2px 4px rgba(0, 0, 0, 0.8);
  opacity: 0;
  pointer-events: none;
  will-change: transform, left, top, opacity;
  transition: opacity 0.18s ease-out, border-color 0.2s;
}
.gate-label-el.gate-label-active {
  opacity: 1;
}
.left-gate { --accent: #22d3ee; --accent-glow: rgba(34, 211, 238, 0.55); }
.center-gate { --accent: #c084fc; --accent-glow: rgba(192, 132, 252, 0.55); }
.right-gate { --accent: #34d399; --accent-glow: rgba(52, 211, 153, 0.55); }

/* Mobile Touch fallback controls overlay */
.mobile-controls-overlay {
  position: absolute;
  bottom: 10px;
  inset-inline: 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  pointer-events: none;
  z-index: 60;
}
.mobile-touch-btn {
  pointer-events: auto; /* enable touch interaction */
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  font-size: 1.6rem;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  transition: transform 0.1s, background-color 0.15s;
}
.mobile-touch-btn:active {
  transform: scale(0.9);
  background-color: rgba(59, 130, 246, 0.3);
  border-color: #3b82f6;
}

/* Center jump control: compact horizontal bar so it does not cover the rover. */
.jump-touch-btn {
  width: 126px;
  height: 46px;
  border-radius: 16px;
  padding: 0 14px;
  flex: 0 0 auto;
  flex-direction: row;
  gap: 8px;
  background: rgba(11, 18, 32, 0.78);
  border: 1.5px solid rgba(251, 191, 36, 0.72);
  box-shadow: 0 6px 18px rgba(0,0,0,0.3), 0 0 14px rgba(245, 158, 11, 0.14);
}
.jump-touch-btn:hover {
  background: rgba(17, 24, 39, 0.88);
  border-color: #fbbf24;
}
.jump-touch-icon {
  display: block;
  font-size: 1.18rem;
  line-height: 1;
  transform: translateY(-1px);
}
.jump-touch-label {
  display: block;
  margin-top: 0;
  font-size: 0.8rem;
  line-height: 1;
  font-weight: 850;
  letter-spacing: 0;
}
.jump-touch-btn.jump-pressed {
  animation: jumpButtonPulse 0.24s ease-out;
}
@keyframes jumpButtonPulse {
  0% { transform: scale(1); }
  45% { transform: scale(0.86); }
  100% { transform: scale(1); }
}

/* Feedbacks banners */
.hud-feedback-banner {
  position: absolute;
  top: 23%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(52, 211, 153, 0.42);
  color: rgba(255, 255, 255, 0.94);
  font-weight: 850;
  font-size: 1.18rem;
  letter-spacing: 0.01em;
  padding: 8px 18px;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.14);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  pointer-events: none;
  animation: bannerPop 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
.hud-feedback-banner.incorrect {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(248, 113, 113, 0.42);
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.14);
}
@keyframes bannerPop {
  0% { transform: translate(-50%, -50%) scale(0.9) translateY(8px); opacity: 0; }
  15% { transform: translate(-50%, -50%) scale(1.02) translateY(0); opacity: 1; }
  85% { transform: translate(-50%, -50%) scale(1) translateY(0); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(0.96) translateY(-6px); opacity: 0; }
}

/* ================================================== -->
/* MODAL POPUPS                                       -->
/* ================================================== --> */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 2000;
}
.modal-card {
  background: rgba(17, 24, 39, 0.95);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 28px;
  padding: 32px clamp(16px, 4vw, 40px);
  max-width: 520px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 50px rgba(0,0,0,0.5);
  box-sizing: border-box;
}

.result-mascot-card {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 18px 0 4px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
}
.result-mascot-card img {
  width: 84px;
  height: 112px;
  object-fit: contain;
  border-radius: 14px;
  background: radial-gradient(circle at 50% 20%, rgba(255,255,255,0.18), rgba(255,255,255,0.03));
  flex: 0 0 auto;
}
.result-mascot-text {
  text-align: left;
}
.result-mascot-text span {
  display: block;
  color: #9ca3af;
  font-size: 0.76rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.result-mascot-text strong {
  display: block;
  color: #fff;
  font-size: 1.25rem;
  font-weight: 850;
}
.result-mascot-text small {
  display: block;
  margin-top: 6px;
  color: #9ca3af;
  font-size: 0.78rem;
  line-height: 1.45;
  font-weight: 700;
}

.report-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 20px 0;
}
.report-box {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 16px;
  padding: 12px;
  display: flex;
  flex-direction: column;
}
.report-box span {
  font-size: 0.65rem;
  font-weight: 800;
  color: #6b7280;
  letter-spacing: 0.06em;
}
.report-box strong {
  font-size: 1.4rem;
  font-weight: 850;
  color: #fff;
  margin-top: 4px;
}
.success-box strong { color: #fbbf24; }

.personal-best-banner {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  border-radius: 12px;
  color: #000;
  font-weight: 900;
  font-size: 0.9rem;
  padding: 8px;
  margin-top: 14px;
  letter-spacing: 0.05em;
  box-shadow: 0 4px 12px rgba(251, 191, 36, 0.25);
  animation: pbPulse 1.5s infinite ease-in-out;
}
@keyframes pbPulse {
  0%, 100% { opacity: 0.9; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.02); }
}

/* Leaderboards tabs & lists */
.leaderboard-modal-card {
  max-width: 560px !important;
}
.leaderboard-tabs-wrap {
  display: flex;
  justify-content: center;
  margin: 16px 0;
}
.leaderboard-tabs {
  display: flex;
  background: rgba(0,0,0,0.3);
  padding: 3px;
  border-radius: 12px;
  border: 1.5px solid rgba(255,255,255,0.05);
  overflow-x: auto;
}
.leaderboard-tabs button {
  background: transparent;
  border: none;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.78rem;
  color: #9ca3af;
  padding: 6px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.leaderboard-tabs button.active {
  background: #3b82f6;
  color: #fff;
}
.leaderboard-sub {
  font-size: 0.85rem;
  color: #9ca3af;
  margin-bottom: 12px;
  font-weight: 700;
}
.leaderboard-list {
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 20px;
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 16px;
  background: rgba(0,0,0,0.15);
}
.leaderboard-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.leaderboard-entry:last-child {
  border-bottom: none;
}
.leaderboard-entry.me {
  background: rgba(59, 130, 246, 0.08);
}
.lb-rank {
  font-weight: 800;
  font-size: 0.95rem;
  width: 24px;
}
.lb-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0,0,0,0.2);
}
.lb-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.lb-name {
  flex: 1;
  text-align: left;
  font-weight: 700;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lb-stats {
  text-align: right;
}
.lb-score {
  font-weight: 900;
  color: #fbbf24;
  font-size: 1.05rem;
}
.lb-meta {
  font-size: 0.65rem;
  color: #6b7280;
}

/* Countdown Overlay */
.countdown-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: grid;
  place-items: center;
  z-index: 3000;
}
.countdown-number {
  font-size: 8rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}
.count-pop {
  animation: countdownPop 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) infinite;
}
.start-pop {
  animation: startPop 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  color: #10b981;
}
@keyframes countdownPop {
  0% { transform: scale(0.6); opacity: 0; }
  25% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes startPop {
  0% { transform: scale(0.6); opacity: 0; }
  25% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); opacity: 0.8; }
}

/* Avatar selection popover modal */
.avatar-modal-card {
  max-width: 440px !important;
}
.avatar-selection-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  max-height: 280px;
  overflow-y: auto;
  padding: 10px 4px;
}
.avatar-selection-option {
  background: rgba(255, 255, 255, 0.02);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  cursor: pointer;
  overflow: hidden;
  padding: 0;
  aspect-ratio: 1;
  transition: all 0.2s;
}
.avatar-selection-option:hover {
  transform: scale(1.08);
  border-color: rgba(255, 255, 255, 0.25);
}
.avatar-selection-option.active {
  border-color: #3b82f6;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}
.avatar-selection-option img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Responsive viewports adjustments */
@media (max-width: 680px) {
  .setup-grid {
    gap: 14px;
  }
  .mascot-picker-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .mascot-card {
    padding: 8px 8px 10px;
    border-radius: 16px;
  }
  .mascot-card strong {
    font-size: 0.88rem;
  }
  .mascot-card small {
    font-size: 0.68rem;
  }
  .mode-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .grade-segmented {
    grid-template-columns: repeat(3, 1fr);
  }
  .hud-stats {
    gap: 8px;
  }
  .hud-capsule {
    padding: 4px 10px;
  }
}

@media (max-width: 440px) {
  .hero-card {
    padding: 20px 14px;
  }
  .mascot-picker-grid {
    gap: 6px;
  }
  .result-mascot-card {
    gap: 10px;
    padding: 10px 12px;
  }
  .result-mascot-card img {
    width: 64px;
    height: 88px;
  }
  .result-mascot-text strong {
    font-size: 1.05rem;
  }
  .mode-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .grade-segmented {
    grid-template-columns: repeat(2, 1fr);
  }
  .hud-question-wrapper h2 {
    font-size: 1.7rem;
  }
  .canvas-3d-wrapper {
    height: 320px;
  }
  .gate-label-el {
    min-width: 44px;
    font-size: 1.35rem;
    padding: 7px 10px;
    border-radius: 11px;
  }
}

.hidden {
  display: none !important;
}


@media (max-width: 560px) {
  .mobile-controls-overlay {
    bottom: 8px;
    inset-inline: 10px;
    gap: 8px;
  }
  .mobile-touch-btn {
    width: 58px;
    height: 58px;
  }
  .jump-touch-btn {
    width: 112px;
    height: 42px;
    padding: 0 12px;
    border-radius: 14px;
  }
  .jump-touch-icon { font-size: 1.05rem; }
  .jump-touch-label { font-size: 0.74rem; }
}

@media (max-width: 640px) {
  .hud-feedback-banner {
    top: 18%;
    font-size: 0.94rem;
    padding: 7px 14px;
    border-radius: 14px;
  }
}

/* ================================================== */
/* MOBILE-FIRST POLISH v12.5                          */
/* Keeps the desktop layout unchanged while making   */
/* setup, gameplay and modals fit phone viewports.    */
/* ================================================== */

.math-runner-page,
.game-shell,
.start-screen,
.game-screen,
.hero-card,
.game-hud,
.hud-question-wrapper,
.canvas-3d-wrapper,
.modal,
.modal-card {
  max-width: 100%;
  box-sizing: border-box;
}

.math-runner-page {
  width: 100%;
  max-width: 100vw;
  overflow-x: clip;
}

.start-screen {
  width: min(100%, 680px);
  min-width: 0;
}

.game-screen {
  width: min(100%, 900px);
  min-width: 0;
  overflow: hidden;
}

.game-hud,
.hud-stats,
.hud-actions,
.hud-capsule {
  min-width: 0;
}

/* Mobile / small tablet portrait */
@media (max-width: 680px) {
  .game-shell {
    width: 100%;
    min-height: calc(100svh - 64px);
    padding: 8px 8px 14px;
    place-items: start center;
    overflow-x: clip;
  }

  /* Compact setup so character + level + mode + Start all belong to one phone flow. */
  .hero-card {
    width: 100%;
    max-width: 100%;
    border-radius: 20px;
    padding: 12px 10px 14px;
  }
  .menu-top-actions {
    margin-bottom: 6px;
  }
  .menu-sound-btn,
  .leaderboard-corner-btn {
    min-height: 36px;
    padding: 6px 10px;
    border-radius: 10px;
    font-size: 0.78rem;
  }
  .game-logo-mini {
    display: none;
  }
  .hero-card .eyebrow {
    display: none;
  }
  .hero-card h1 {
    font-size: 1.45rem;
    margin: 3px 0 2px;
  }
  .subtitle {
    font-size: 0.76rem;
    line-height: 1.35;
    margin: 0 auto 9px;
    max-width: 34rem;
  }

  .setup-grid {
    gap: 9px;
    margin-bottom: 8px;
  }
  .field {
    gap: 5px;
    min-width: 0;
  }
  .field > span {
    font-size: 0.72rem;
    letter-spacing: 0.01em;
  }

  .player-profile-bar-wrapper {
    padding: 7px 9px;
    margin-bottom: 0;
    border-radius: 12px;
  }
  .player-profile-bar {
    gap: 9px;
  }
  .profile-avatar-btn {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
  }
  .player-name-display {
    font-size: 0.92rem;
  }

  .mascot-picker-grid {
    gap: 6px;
  }
  .mascot-card {
    min-width: 0;
    min-height: 0;
    padding: 5px 5px 7px;
    gap: 3px;
    border-radius: 13px;
  }
  .mascot-card img {
    width: 100%;
    height: 92px;
    aspect-ratio: auto;
    object-fit: contain;
    border-radius: 10px;
  }
  .mascot-card strong {
    font-size: 0.8rem;
    line-height: 1.1;
  }
  .mascot-card small {
    display: none;
  }
  .mascot-desc {
    display: none;
  }

  .grade-segmented {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 3px;
    padding: 3px;
    border-radius: 10px;
  }
  .grade-pill {
    min-width: 0;
    padding: 7px 1px;
    font-size: 0.72rem;
    border-radius: 7px;
  }
  .grade-desc {
    font-size: 0.67rem;
    line-height: 1.25;
    margin-top: 1px;
  }

  /* Five calculation modes fit in one row on phone instead of tall 2-column cards. */
  .mode-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
  }
  .mode-card {
    min-width: 0;
    min-height: 54px;
    padding: 6px 2px;
    gap: 1px;
    border-radius: 11px;
  }
  .mode-icon {
    font-size: 1.02rem;
    line-height: 1;
  }
  .mode-card strong {
    font-size: 0.66rem;
    white-space: nowrap;
  }

  /* Start is always in the same compact setup card, directly under selectors. */
  .start-actions {
    width: 100%;
    margin-top: 7px;
    gap: 6px;
    display: grid;
    grid-template-columns: 0.72fr 1.28fr;
  }
  .start-actions .ghost-btn,
  .start-actions .primary-btn {
    min-width: 0;
    min-height: 44px;
    padding: 9px 8px;
    border-radius: 11px;
    justify-content: center;
    font-size: 0.8rem;
  }

  /* Gameplay: never exceed phone width, keep HUD compact, and use available height better. */
  .game-screen {
    gap: 8px;
    width: 100%;
    max-width: 100%;
  }
  .game-hud {
    width: 100%;
    padding: 7px;
    gap: 6px;
    border-radius: 15px;
    align-items: center;
  }
  .hud-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    flex: 1 1 auto;
  }
  .hud-capsule {
    padding: 4px 6px;
    border-radius: 9px;
    min-height: 40px;
    justify-content: center;
  }
  .hud-capsule.mode-info-card {
    grid-column: span 2;
  }
  .hud-label {
    font-size: 0.48rem;
    letter-spacing: 0.04em;
  }
  .hud-main {
    font-size: 0.78rem;
  }
  .lives-card .hud-main {
    font-size: 0.72rem;
  }
  .hud-mode-main {
    font-size: 0.68rem;
    white-space: nowrap;
  }
  .hud-actions {
    align-self: stretch;
    flex: 0 0 auto;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
  }
  .hud-btn {
    width: 38px;
    height: 38px;
    padding: 0;
    display: grid;
    place-items: center;
    border-radius: 10px;
    font-size: 0.95rem;
  }

  .hud-question-wrapper {
    width: 100%;
    padding: 7px 10px 8px;
    border-radius: 15px;
  }
  .question-label {
    font-size: 0.53rem;
    margin-bottom: 1px;
  }
  .hud-question-wrapper h2 {
    font-size: clamp(1.45rem, 7vw, 1.8rem);
    line-height: 1.1;
  }

  .canvas-3d-wrapper {
    width: 100%;
    max-width: 100%;
    height: clamp(300px, 52svh, 470px);
    min-height: 300px;
    border-radius: 18px;
    overflow: hidden;
  }
  #gameCanvas3d {
    width: 100% !important;
    height: 100% !important;
    max-width: 100%;
  }

  .mobile-controls-overlay {
    inset-inline: 8px;
    bottom: 8px;
  }
  .mobile-touch-btn {
    width: 52px;
    height: 52px;
    font-size: 1.25rem;
  }
  .jump-touch-btn {
    width: 108px;
    height: 40px;
  }

  /* Every popup must fit inside the visible mobile viewport. */
  .modal {
    width: 100vw;
    max-width: 100vw;
    min-width: 0;
    padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    overflow: hidden;
  }
  .modal-card,
  .leaderboard-modal-card,
  .avatar-modal-card {
    width: 100%;
    max-width: min(100%, 520px) !important;
    max-height: calc(100svh - 16px);
    overflow-y: auto;
    overflow-x: hidden;
    border-radius: 20px;
    padding: 16px 12px;
    scrollbar-width: thin;
  }
  .modal-card h2 {
    font-size: 1.55rem;
    margin: 5px 0 8px;
  }
  .countdown-number {
    font-size: clamp(4.5rem, 25vw, 7rem);
  }

  .result-mascot-card {
    gap: 8px;
    margin: 10px 0 4px;
    padding: 8px 9px;
    border-radius: 14px;
  }
  .result-mascot-card img {
    width: 54px;
    height: 72px;
    border-radius: 10px;
  }
  .result-mascot-text span {
    font-size: 0.64rem;
  }
  .result-mascot-text strong {
    font-size: 1rem;
  }
  .result-mascot-text small {
    font-size: 0.66rem;
    line-height: 1.25;
    margin-top: 3px;
  }
  .report-grid {
    gap: 7px;
    margin: 10px 0;
  }
  .report-box {
    padding: 8px 6px;
    border-radius: 12px;
  }
  .report-box span {
    font-size: 0.55rem;
  }
  .report-box strong {
    font-size: 1.15rem;
  }

  .result-actions-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    width: 100%;
  }
  .result-actions-layout .primary-btn-restart {
    grid-column: 1 / -1;
    grid-row: 1;
  }
  .result-actions-layout .secondary-btn-mode,
  .result-actions-layout .secondary-btn-leaderboard {
    width: 100%;
    justify-content: center;
  }

  .avatar-selection-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
    max-height: min(54svh, 360px);
  }
  .leaderboard-tabs-wrap {
    margin: 8px 0;
  }
  .leaderboard-tabs {
    width: 100%;
  }
  .leaderboard-tabs button {
    flex: 1 0 auto;
    padding: 6px 9px;
    font-size: 0.68rem;
  }
  .leaderboard-list {
    max-height: min(48svh, 320px);
    margin-bottom: 10px;
  }
}

/* Extra-small phones */
@media (max-width: 390px) {
  .game-shell {
    padding-inline: 5px;
  }
  .hero-card {
    padding-inline: 7px;
  }
  .mascot-card img {
    height: 80px;
  }
  .grade-pill {
    font-size: 0.66rem;
  }
  .mode-card {
    min-height: 50px;
  }
  .mode-card strong {
    font-size: 0.61rem;
  }
  .canvas-3d-wrapper {
    height: clamp(290px, 50svh, 420px);
  }
  .hud-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .hud-capsule.mode-info-card {
    grid-column: span 1;
  }
}

/* Mobile landscape: use the short height efficiently and keep the whole game in view. */
@media (max-height: 620px) and (orientation: landscape) {
  .game-shell {
    min-height: auto;
    padding: 5px 8px 8px;
  }
  .hero-card {
    max-width: 960px;
    padding: 9px 12px;
  }
  .hero-card h1,
  .hero-card .eyebrow,
  .hero-card .subtitle,
  .game-logo-mini {
    display: none;
  }
  .setup-grid {
    display: grid;
    grid-template-columns: 0.8fr 1.2fr;
    gap: 7px 10px;
    margin-bottom: 6px;
  }
  .player-profile-bar-wrapper {
    grid-column: 1;
  }
  .field:has(.mascot-picker-grid) {
    grid-column: 1;
    grid-row: span 2;
  }
  .field:has(.grade-segmented),
  .field:has(.mode-grid) {
    grid-column: 2;
  }
  .mascot-card img {
    height: 72px;
  }
  .mascot-desc,
  .grade-desc {
    display: none;
  }
  .start-actions {
    margin-top: 4px;
  }

  .game-screen {
    max-width: min(100%, 980px);
    gap: 5px;
  }
  .game-hud {
    padding: 5px 8px;
  }
  .hud-stats {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
  }
  .hud-capsule,
  .hud-capsule.mode-info-card {
    min-height: 34px;
    padding: 3px 7px;
  }
  .hud-actions {
    flex-direction: row;
  }
  .hud-btn {
    width: 34px;
    height: 34px;
  }
  .hud-question-wrapper {
    padding: 4px 9px 5px;
  }
  .question-label {
    display: none;
  }
  .hud-question-wrapper h2 {
    font-size: 1.35rem;
  }
  .canvas-3d-wrapper {
    height: min(62svh, 390px);
    min-height: 230px;
    border-radius: 16px;
  }
  .mobile-touch-btn {
    width: 48px;
    height: 48px;
  }
  .jump-touch-btn {
    width: 102px;
    height: 38px;
  }
  .modal-card,
  .leaderboard-modal-card,
  .avatar-modal-card {
    max-width: min(92vw, 680px) !important;
    max-height: calc(100svh - 10px);
    padding: 10px 14px;
  }
  .result-mascot-card {
    margin: 6px 0 2px;
  }
  .report-grid {
    grid-template-columns: repeat(4, 1fr);
    margin: 7px 0;
  }
  .result-actions-layout {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .result-actions-layout .primary-btn-restart {
    grid-column: auto;
    grid-row: auto;
  }
}

/* ================================================== */
/* MOBILE WIDTH LOCK v12.6                            */
/* Hard-stop page/header/modal horizontal overflow.   */
/* ================================================== */
html,
body.math-runner-page {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  overflow-x: hidden !important;
  overscroll-behavior-x: none;
}

body.math-runner-page {
  position: relative;
  touch-action: pan-y;
}

.math-runner-page .site-header,
.math-runner-page .site-header .container,
.math-runner-page .site-header .nav-wrap,
.math-runner-page .game-shell,
.math-runner-page .start-screen,
.math-runner-page .game-screen,
.math-runner-page .hero-card,
.math-runner-page .game-hud,
.math-runner-page .hud-question-wrapper,
.math-runner-page .canvas-3d-wrapper {
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

.math-runner-page .site-header {
  width: 100% !important;
  overflow: hidden !important;
}

.math-runner-page .site-header .container.nav-wrap {
  width: 100% !important;
  margin-inline: 0 !important;
}

.math-runner-page .setup-grid > *,
.math-runner-page .mascot-picker-grid > *,
.math-runner-page .grade-segmented > *,
.math-runner-page .mode-grid > *,
.math-runner-page .start-actions > *,
.math-runner-page .game-hud > *,
.math-runner-page .hud-stats > *,
.math-runner-page .report-grid > *,
.math-runner-page .result-actions-layout > * {
  min-width: 0 !important;
  max-width: 100%;
  box-sizing: border-box;
}

.math-runner-page .player-name-container,
.math-runner-page .result-mascot-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 680px) {
  .math-runner-page .site-header .container.nav-wrap {
    padding-inline: 8px !important;
    gap: 6px !important;
    justify-content: space-between !important;
    overflow: hidden !important;
  }

  .math-runner-page .site-header .brand {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    max-width: calc(100% - 104px) !important;
    gap: 7px !important;
    overflow: hidden !important;
  }

  .math-runner-page .site-header .brand > div {
    min-width: 0 !important;
    overflow: hidden !important;
  }

  .math-runner-page .site-header .brand-logo {
    width: 42px !important;
    height: 42px !important;
    flex: 0 0 42px !important;
  }

  .math-runner-page .site-header .brand-title {
    font-size: 0.95rem !important;
    line-height: 1.1 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .math-runner-page .site-header .brand-subtitle {
    font-size: 0.68rem !important;
    line-height: 1.1 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .math-runner-page .site-header .main-nav {
    display: none !important;
  }

  .math-runner-page .site-header .header-actions {
    flex: 0 0 auto !important;
    min-width: 0 !important;
    max-width: 96px !important;
    gap: 5px !important;
    margin-left: auto !important;
  }

  /* Login remains available from the hamburger/global member menu; hiding the large
     injected desktop pill is what prevents it from widening the phone viewport. */
  .math-runner-page .site-header .auth-header-trigger,
  .math-runner-page .site-header .member-nav {
    display: none !important;
  }

  .math-runner-page .site-header .theme-toggle,
  .math-runner-page .site-header .menu-toggle {
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    padding: 0 !important;
    flex: 0 0 42px !important;
  }

  .math-runner-page .game-shell {
    width: 100% !important;
    margin: 0 !important;
    padding-inline: 8px !important;
    overflow-x: hidden !important;
  }

  .math-runner-page .start-screen,
  .math-runner-page .game-screen {
    width: 100% !important;
    max-width: 100% !important;
    margin-inline: auto !important;
    left: auto !important;
    right: auto !important;
    transform: none !important;
    overflow-x: hidden !important;
  }

  .math-runner-page .hero-card {
    width: 100% !important;
    max-width: 100% !important;
    margin-inline: 0 !important;
  }

  .math-runner-page .mascot-picker-grid,
  .math-runner-page .grade-segmented,
  .math-runner-page .mode-grid,
  .math-runner-page .start-actions,
  .math-runner-page .hud-stats,
  .math-runner-page .result-actions-layout,
  .math-runner-page .report-grid {
    width: 100% !important;
    max-width: 100% !important;
  }

  .math-runner-page .modal {
    position: fixed !important;
    inset: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 8px !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }

  .math-runner-page .modal-card,
  .math-runner-page .leaderboard-modal-card,
  .math-runner-page .avatar-modal-card {
    width: 100% !important;
    max-width: 520px !important;
    min-width: 0 !important;
    margin-inline: auto !important;
    box-sizing: border-box !important;
  }

  .math-runner-page .result-mascot-card {
    width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }
}

@media (max-width: 430px) {
  .math-runner-page .site-header .brand {
    max-width: calc(100% - 96px) !important;
  }
  .math-runner-page .site-header .brand-subtitle {
    display: none !important;
  }
  .math-runner-page .site-header .brand-title {
    font-size: 0.88rem !important;
  }
  .math-runner-page .site-header .brand-logo {
    width: 38px !important;
    height: 38px !important;
    flex-basis: 38px !important;
  }
  .math-runner-page .site-header .theme-toggle,
  .math-runner-page .site-header .menu-toggle {
    width: 40px !important;
    min-width: 40px !important;
    height: 40px !important;
    flex-basis: 40px !important;
  }
  .math-runner-page .site-header .header-actions {
    max-width: 88px !important;
  }
}

/* ================================================== */
/* DESKTOP RESULT MODAL FIX v12.9                     */
/* Restore a compact centered result card on desktop. */
/* ================================================== */
@media (min-width: 681px) {
  #gameOverModal.modal {
    padding: 24px !important;
    align-items: center !important;
    justify-content: center !important;
  }

  #gameOverModal .modal-card {
    width: min(92vw, 560px) !important;
    max-width: 560px !important;
    max-height: calc(100vh - 48px) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    margin: 0 auto !important;
    padding: 28px 30px !important;
    border-radius: 24px !important;
  }

  #gameOverModal .modal-card h2 {
    font-size: 2rem !important;
    margin: 6px 0 10px !important;
  }

  #gameOverModal .result-mascot-card {
    margin: 14px 0 8px !important;
    padding: 10px 12px !important;
    gap: 12px !important;
  }

  #gameOverModal .result-mascot-card img {
    width: 72px !important;
    height: 92px !important;
  }

  #gameOverModal .report-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    margin: 16px 0 !important;
  }

  #gameOverModal .report-box {
    min-height: 76px !important;
    padding: 10px 12px !important;
    justify-content: center !important;
  }

  #gameOverModal .result-actions-layout {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 10px !important;
    width: 100% !important;
    margin-top: 12px !important;
  }

  #gameOverModal .result-actions-layout > * {
    width: 100% !important;
    min-width: 0 !important;
    justify-content: center !important;
    padding: 11px 10px !important;
    white-space: nowrap !important;
  }
}
