*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --teal: #00e5c8;
  --teal-dim: #00b39e;
  --magenta: #ff2d7a;
  --magenta-dim: #cc1f60;
  --gold: #ffd54a;
  --bg-dark: #0a0e17;
  --glass: rgba(10, 14, 23, 0.75);
  --glass-border: rgba(0, 229, 200, 0.25);
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-dark);
  font-family: 'Rajdhani', 'Noto Sans JP', sans-serif;
  color: #e8f4f8;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

#game-container {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 520px;
  margin: 0 auto;
  overflow: hidden;
  box-shadow: 0 0 80px rgba(0, 229, 200, 0.08);
}

@media (min-aspect-ratio: 9/16) {
  #game-container {
    width: min(520px, calc(100vh * 9 / 16));
    height: 100vh;
    max-width: none;
  }
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--bg-dark);
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: opacity 0.4s ease;
}

.screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.menu-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: saturate(1.2) contrast(1.05);
}

.menu-overlay,
.gameover-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(10, 14, 23, 0.55) 0%,
    rgba(10, 14, 23, 0.85) 50%,
    rgba(10, 14, 23, 0.95) 100%
  );
}

.menu-content,
.gameover-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 2rem 1.5rem;
  width: 100%;
  animation: fadeUp 0.6s ease;
}

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

.menu-eyebrow,
.gameover-eyebrow {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  color: var(--teal);
  margin-bottom: 0.5rem;
  text-shadow: 0 0 20px rgba(0, 229, 200, 0.5);
}

.menu-title {
  font-family: 'Bebas Neue', sans-serif;
  line-height: 0.95;
  margin-bottom: 0.75rem;
}

.title-line {
  display: block;
  font-size: clamp(2.8rem, 12vw, 4.2rem);
  letter-spacing: 0.06em;
  text-shadow:
    3px 3px 0 var(--magenta),
    -1px -1px 0 var(--teal);
}

.title-line.accent {
  color: var(--teal);
  font-size: clamp(3.2rem, 14vw, 5rem);
}

.menu-tagline {
  font-size: 1rem;
  color: rgba(232, 244, 248, 0.7);
  margin-bottom: 2rem;
  font-weight: 500;
}

.btn-primary,
.btn-secondary {
  display: block;
  width: 100%;
  max-width: 280px;
  margin: 0 auto;
  border: none;
  cursor: pointer;
  font-family: 'Bebas Neue', sans-serif;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-dim) 100%);
  color: var(--bg-dark);
  padding: 1rem 2rem;
  font-size: 1.6rem;
  letter-spacing: 0.15em;
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
  box-shadow:
    0 0 30px rgba(0, 229, 200, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-primary:hover {
  transform: scale(1.03);
  box-shadow: 0 0 40px rgba(0, 229, 200, 0.6);
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-text {
  display: block;
}

.btn-sub {
  display: block;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  opacity: 0.7;
  margin-top: 0.15rem;
}

.btn-secondary {
  background: transparent;
  color: var(--teal);
  border: 1px solid var(--glass-border);
  padding: 0.75rem 1.5rem;
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  margin-top: 0.75rem;
}

.btn-secondary:hover {
  background: rgba(0, 229, 200, 0.1);
}

.menu-highscore {
  margin-top: 1.5rem;
  padding: 0.75rem 1.25rem;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  display: inline-block;
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
}

.hs-label {
  display: block;
  font-size: 0.65rem;
  letter-spacing: 0.25em;
  color: rgba(232, 244, 248, 0.5);
}

#menu-highscore {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.8rem;
  color: var(--gold);
}

.menu-controls {
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  justify-content: center;
  font-size: 0.8rem;
  color: rgba(232, 244, 248, 0.5);
}

.control-group kbd {
  display: inline-block;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  font-family: inherit;
  font-size: 0.75rem;
  margin-right: 0.15rem;
}

#pause-esc-hint.hidden {
  display: none;
}

.menu-touch-controls {
  display: none;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 1.25rem;
  font-size: 0.9rem;
  color: rgba(232, 244, 248, 0.65);
}

.menu-touch-controls .control-group {
  justify-content: center;
}

.pause-btn {
  position: absolute;
  right: max(10px, env(safe-area-inset-right, 0px));
  bottom: max(10px, env(safe-area-inset-bottom, 0px));
  z-index: 8;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  background: rgba(10, 14, 23, 0.82);
  color: var(--teal);
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.05rem;
  letter-spacing: 0.14em;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
  transition: transform 0.12s ease, background 0.12s ease;
}

.pause-btn:active {
  transform: scale(0.94);
  background: rgba(0, 229, 200, 0.18);
}

.pause-btn.hidden {
  display: none;
}

#game-container:has(#touch-controls:not(.hidden)) .pause-btn {
  bottom: calc(68px + env(safe-area-inset-bottom, 0px));
}

#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  pointer-events: none;
  padding: env(safe-area-inset-top, 10px) 10px 0;
}

#hud.hidden {
  display: none;
}

.hud-lives-row {
  display: flex;
  justify-content: center;
  padding: 0.15rem 1rem 0.25rem;
}

.hud-lives {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background: rgba(10, 14, 23, 0.65);
  border: 1px solid rgba(255, 45, 122, 0.35);
  backdrop-filter: blur(6px);
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.5rem;
  letter-spacing: 0.08em;
  color: var(--magenta);
  text-shadow: 0 0 12px rgba(255, 45, 122, 0.45);
  line-height: 1;
}

.hud-life-icon {
  display: inline-block;
}

.hud-life-icon.empty {
  color: rgba(255, 45, 122, 0.25);
  text-shadow: none;
}

.hud-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.5rem;
}

.hud-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(10, 14, 23, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(6px);
  justify-self: start;
}

.hud-lv-pill {
  justify-self: end;
}

.hud-pill-label {
  font-size: 0.55rem;
  letter-spacing: 0.15em;
  color: var(--teal);
  font-weight: 700;
}

.hud-gas-pill #gas-display,
.hud-lv-pill #level-display {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.35rem;
  line-height: 1;
}

.hud-gas-pill #gas-display { color: #ff6644; }
.hud-lv-pill #level-display { color: var(--teal); }

.hud-gas-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  object-fit: cover;
}

.hud-score-hero {
  text-align: center;
  line-height: 0.9;
  text-shadow:
    0 0 20px rgba(0, 229, 200, 0.35),
    2px 2px 0 rgba(255, 45, 122, 0.5);
}

.hud-score-num {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(2.8rem, 14vw, 3.6rem);
  color: #fff;
  letter-spacing: 0.04em;
}

.hud-score-unit {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.1rem;
  color: rgba(232, 244, 248, 0.55);
  margin-left: 0.15rem;
}

.hud-district-row {
  display: flex;
  justify-content: center;
  padding: 0.1rem 1rem 0.2rem;
}

.hud-district {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  background: rgba(10, 14, 23, 0.55);
  border: 1px solid rgba(0, 229, 200, 0.22);
  backdrop-filter: blur(6px);
  font-family: 'Bebas Neue', sans-serif;
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  color: rgba(0, 229, 200, 0.9);
  line-height: 1;
  transition: opacity 0.3s, transform 0.3s;
}

.hud-district-jp {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.55rem;
  letter-spacing: 0.1em;
  color: rgba(232, 244, 248, 0.4);
  font-weight: 400;
}

.hud-progress-track {
  height: 4px;
  margin: 0.45rem 1.5rem 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.hud-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--teal), var(--magenta));
  border-radius: 2px;
  transition: width 0.15s linear;
  box-shadow: 0 0 8px rgba(0, 229, 200, 0.5);
}

.hud-action-hints {
  position: absolute;
  bottom: 5.5rem;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 1rem;
  pointer-events: none;
}

.hint-chip {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.65rem;
  border-radius: 8px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  background: rgba(10, 14, 23, 0.55);
  backdrop-filter: blur(4px);
}

.hint-arrow {
  font-size: 1rem;
  line-height: 1;
}

.hint-jump {
  border: 1px solid rgba(255, 140, 60, 0.45);
  color: rgba(255, 160, 80, 0.95);
}

.hint-slide {
  border: 1px solid rgba(0, 229, 200, 0.4);
  color: rgba(0, 229, 200, 0.95);
}

.menu-wallet {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  background: var(--glass);
  border: 1px solid rgba(255, 80, 40, 0.3);
  padding: 0.5rem 1rem;
  margin-bottom: 1rem;
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
}

.wallet-label {
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  color: rgba(232, 244, 248, 0.5);
}

.wallet-amount {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.6rem;
  color: #ff6644;
}

.wallet-unit { font-size: 1rem; }

.menu-mods {
  width: 100%;
  max-width: 340px;
  margin: 0 auto 1.25rem;
  text-align: left;
}

.menu-mods.hidden {
  display: none;
}

.menu-mods-label {
  font-size: 0.6rem;
  letter-spacing: 0.28em;
  color: rgba(232, 244, 248, 0.45);
  margin-bottom: 0.5rem;
  text-align: center;
}

.modifier-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.mod-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  padding: 0.55rem 0.6rem;
  background: rgba(10, 14, 23, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  cursor: pointer;
  color: inherit;
  font-family: inherit;
  text-align: left;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.mod-card:hover {
  border-color: rgba(0, 229, 200, 0.35);
  transform: translateY(-1px);
}

.mod-card.selected {
  border-color: var(--teal);
  box-shadow: 0 0 18px rgba(0, 229, 200, 0.22);
  background: rgba(0, 229, 200, 0.08);
}

.mod-card-icon {
  font-size: 1rem;
  line-height: 1;
}

.mod-card-name {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1rem;
  letter-spacing: 0.06em;
  color: #fff;
  line-height: 1.1;
}

.mod-card-jp {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.55rem;
  letter-spacing: 0.12em;
  color: rgba(232, 244, 248, 0.4);
}

.mod-card-desc {
  font-size: 0.62rem;
  line-height: 1.3;
  color: rgba(232, 244, 248, 0.55);
  margin-top: 0.1rem;
}

.mod-card-check {
  position: absolute;
  top: 0.4rem;
  right: 0.45rem;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  color: transparent;
  transition: all 0.15s;
}

.mod-card.selected .mod-card-check {
  border-color: var(--teal);
  background: var(--teal);
  color: var(--bg-dark);
}

.rules-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 14, 23, 0.92);
}

.rules-panel {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1rem 1rem;
  overflow: hidden;
}

.rules-eyebrow {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  color: var(--teal);
  text-align: center;
}

.rules-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.2rem;
  text-align: center;
  color: var(--teal);
  margin-bottom: 0.5rem;
}

.rules-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.5rem;
}

.rules-section {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  padding: 0.85rem 1rem;
  margin-bottom: 0.65rem;
}

.rules-section-head {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-bottom: 0.5rem;
}

.rules-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: 6px;
  flex-shrink: 0;
}

.rules-jump-head .rules-icon {
  background: rgba(255, 140, 60, 0.2);
  color: #ff8c3c;
  border: 1px solid rgba(255, 140, 60, 0.4);
}

.rules-slide-head .rules-icon {
  background: rgba(0, 229, 200, 0.15);
  color: var(--teal);
  border: 1px solid rgba(0, 229, 200, 0.35);
}

.rules-section-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.25rem;
  letter-spacing: 0.08em;
  line-height: 1.1;
}

.rules-jump-head .rules-section-title { color: #ff8c3c; }
.rules-slide-head .rules-section-title { color: var(--teal); }
.rules-lanes .rules-section-title,
.rules-checkpoint .rules-section-title,
.rules-lives .rules-section-title,
.rules-combo .rules-section-title,
.rules-mods .rules-section-title,
.rules-districts .rules-section-title { color: var(--magenta); margin-bottom: 0.35rem; }

.rules-section-sub {
  font-size: 0.78rem;
  color: rgba(232, 244, 248, 0.55);
  margin-top: 0.15rem;
  line-height: 1.35;
}

.rules-section-sub kbd {
  display: inline-block;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  padding: 0.05rem 0.35rem;
  font-family: inherit;
  font-size: 0.72rem;
}

.rules-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
}

.rules-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.55rem;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 6px;
}

.rules-jump-head + .rules-list .rules-item {
  border-left: 2px solid rgba(255, 140, 60, 0.5);
}

.rules-slide-head + .rules-list .rules-item {
  border-left: 2px solid rgba(0, 229, 200, 0.45);
}

.rules-thumb {
  width: 52px;
  height: 52px;
  object-fit: contain;
  flex-shrink: 0;
  background: transparent;
  border: none;
  padding: 0;
}

.rules-item-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.rules-item-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: rgba(232, 244, 248, 0.92);
  line-height: 1.2;
}

.rules-item-hint {
  font-size: 0.72rem;
  color: rgba(232, 244, 248, 0.45);
  line-height: 1.3;
}

.rules-body {
  font-size: 0.85rem;
  color: rgba(232, 244, 248, 0.75);
  line-height: 1.45;
  margin: 0;
}

.rules-body kbd {
  display: inline-block;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  padding: 0.05rem 0.35rem;
  font-family: inherit;
  font-size: 0.75rem;
  margin: 0 0.1rem;
}

.rules-body strong {
  color: var(--teal);
  font-weight: 600;
}

#rules-back-btn {
  flex-shrink: 0;
  margin-top: 0.5rem;
}

.shop-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 14, 23, 0.92);
}

.shop-panel {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1rem;
  overflow: hidden;
}

.shop-eyebrow {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  color: var(--teal);
  text-align: center;
}

.shop-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.2rem;
  text-align: center;
  color: var(--teal);
  margin-bottom: 0.75rem;
}

.shop-preview-wrap {
  flex-shrink: 0;
  text-align: center;
  margin-bottom: 0.75rem;
  padding: 0.65rem 0.75rem 0.5rem;
  background: rgba(10, 14, 23, 0.65);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
}

.shop-preview-canvas {
  display: block;
  width: 100%;
  max-width: 280px;
  height: 140px;
  margin: 0 auto;
  border-radius: 8px;
  background: radial-gradient(ellipse at 50% 80%, rgba(0, 229, 200, 0.08), rgba(10, 14, 23, 0.95));
}

.shop-preview-label {
  margin-top: 0.4rem;
  font-size: 0.58rem;
  letter-spacing: 0.28em;
  color: rgba(232, 244, 248, 0.45);
}

.shop-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.5rem;
}

.shop-wallet {
  text-align: center;
  padding: 0.75rem;
  background: var(--glass);
  border: 1px solid rgba(255, 80, 40, 0.3);
  margin-bottom: 1rem;
}

.shop-wallet-label {
  display: block;
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  color: rgba(232, 244, 248, 0.5);
}

.shop-wallet-amount {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2rem;
  color: #ff6644;
}

.shop-category {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  color: var(--magenta);
  margin: 0.75rem 0 0.5rem;
}

.shop-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.shop-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  padding: 0.65rem 0.5rem;
  text-align: center;
  cursor: pointer;
  color: inherit;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
  transition: border-color 0.15s, transform 0.15s;
}

.shop-card:hover { border-color: var(--teal); transform: scale(1.02); }
.shop-card.equipped { border-color: var(--teal); box-shadow: 0 0 15px rgba(0, 229, 200, 0.2); }
.shop-card.owned:not(.equipped) { border-color: rgba(255, 255, 255, 0.15); }

.shop-card-preview {
  display: block;
  width: 100%;
  height: 72px;
  object-fit: contain;
  object-position: center bottom;
  margin-bottom: 0.35rem;
  background: radial-gradient(ellipse at 50% 90%, rgba(0, 229, 200, 0.08), transparent 70%);
}

.shop-card-name {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 0.2rem;
}

.shop-card-price {
  display: block;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.1rem;
  color: #ff6644;
}

.shop-card-status {
  display: block;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  color: var(--teal);
  margin-top: 0.25rem;
}

.hud-combo-wrap {
  text-align: center;
  margin-top: 0.3rem;
  min-height: 2.4rem;
}

.hud-combo {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.2rem;
  color: var(--magenta);
  text-shadow: 0 0 15px rgba(255, 45, 122, 0.6);
  min-height: 1.4rem;
  opacity: 0;
  transition: opacity 0.2s, font-size 0.2s, color 0.2s;
}

.hud-combo.active {
  opacity: 1;
  font-size: 1.5rem;
  text-shadow: 0 0 18px rgba(255, 45, 122, 0.7);
}

.hud-combo.tier-1 { color: #ff8ec8; }
.hud-combo.tier-2 { color: var(--gold); text-shadow: 0 0 18px rgba(255, 213, 74, 0.55); }
.hud-combo.tier-3 {
  color: #fff;
  text-shadow: 0 0 22px rgba(0, 229, 200, 0.8), 0 0 8px rgba(255, 45, 122, 0.6);
  animation: comboPulse 0.6s ease infinite alternate;
}

.hud-combo-perk {
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  color: rgba(232, 244, 248, 0.45);
  min-height: 0.9rem;
  margin-top: 0.1rem;
  opacity: 0;
  transition: opacity 0.2s;
}

.hud-combo-perk.active {
  opacity: 1;
  color: var(--teal);
}

.hud-combo-perk.tier-2 { color: var(--gold); }
.hud-combo-perk.tier-3 { color: #fff; }

@keyframes comboPulse {
  from { transform: scale(1); }
  to { transform: scale(1.04); }
}

.respawn-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 14, 23, 0.7);
}

.respawn-content {
  position: relative;
  z-index: 2;
  text-align: center;
  animation: fadeUp 0.4s ease;
}

.respawn-eyebrow {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  color: var(--teal);
}

.respawn-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(2.5rem, 12vw, 3.5rem);
  color: var(--magenta);
  text-shadow: 0 0 25px rgba(255, 45, 122, 0.5);
  margin: 0.25rem 0;
}

.respawn-message {
  font-size: 1rem;
  color: rgba(232, 244, 248, 0.8);
}

.gameover-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(3rem, 15vw, 4.5rem);
  color: var(--magenta);
  text-shadow: 0 0 30px rgba(255, 45, 122, 0.5);
  margin-bottom: 0.5rem;
}

.crash-message {
  font-size: 1rem;
  color: rgba(232, 244, 248, 0.7);
  margin-bottom: 1.5rem;
  font-style: italic;
}

.gameover-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  max-width: 340px;
  margin-left: auto;
  margin-right: auto;
}

.stat-wide {
  grid-column: 1 / -1;
}

.stat {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  padding: 0.75rem 0.5rem;
}

.stat-label {
  display: block;
  font-size: 0.55rem;
  letter-spacing: 0.15em;
  color: rgba(232, 244, 248, 0.5);
}

.stat-value {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.4rem;
  color: var(--teal);
}

.new-record {
  color: var(--gold);
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.3rem;
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
  animation: pulse 0.8s ease infinite alternate;
}

.new-record.hidden {
  display: none;
}

@keyframes pulse {
  from { opacity: 0.7; transform: scale(1); }
  to { opacity: 1; transform: scale(1.05); }
}

#touch-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 6;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 8px;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  pointer-events: auto;
}

#touch-controls.hidden {
  display: none;
}

.touch-btn {
  background: rgba(10, 14, 23, 0.7);
  border: 1px solid var(--glass-border);
  color: var(--teal);
  font-size: 1.4rem;
  padding: 1rem;
  border-radius: 8px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.touch-btn:active {
  background: rgba(0, 229, 200, 0.2);
  transform: scale(0.95);
}

@media (min-width: 521px) {
  #touch-controls {
    display: none !important;
  }
}

@media (hover: none) and (pointer: coarse) {
  #touch-controls:not(.hidden) {
    display: grid !important;
  }

  .menu-controls {
    display: none;
  }

  .menu-touch-controls {
    display: flex;
  }

  .hud-action-hints {
    display: none;
  }
}

@media (max-width: 520px) {
  .menu-content,
  .gameover-content {
    padding: 1.5rem 1rem;
    max-height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .shop-panel,
  .rules-panel {
    max-height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  }
}