* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: 'Consolas', 'Menlo', monospace;
}

#game {
  display: block;
  width: 100vw;
  height: 100vh;
}

/* ---------- HUD ---------- */

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  color: #7dffa0;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
  user-select: none;
}

.hud-tape {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  min-width: 120px;
  padding: 8px 12px;
  border: 1px solid rgba(125, 255, 160, 0.6);
  background: rgba(0, 20, 8, 0.25);
  text-align: center;
}

.hud-tape.left {
  left: 18%;
}

.hud-tape.right {
  right: 18%;
}

.hud-label {
  font-size: 11px;
  letter-spacing: 2px;
  opacity: 0.8;
}

.hud-value {
  font-size: 30px;
  font-weight: bold;
  font-variant-numeric: tabular-nums;
}

.hud-unit {
  font-size: 11px;
  opacity: 0.8;
}

.hud-bottom {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 28px;
  font-size: 14px;
}

.hud-throttle {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-throttle-bar {
  width: 140px;
  height: 8px;
  border: 1px solid rgba(125, 255, 160, 0.6);
}

.hud-throttle-fill {
  height: 100%;
  background: #7dffa0;
}





.hud-device {
  position: absolute;
  top: 14px;
  right: 16px;
  font-size: 12px;
  opacity: 0.85;
}

.hud-help {
  position: absolute;
  top: 14px;
  left: 16px;
  font-size: 12px;
  line-height: 1.6;
  opacity: 0.85;
  white-space: pre;
}

.hud-alert {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 34px;
  font-weight: bold;
  color: #ff5a4a;
  letter-spacing: 4px;
}

.hud-alert.warn {
  color: #ffd24a;
  font-size: 22px;
}

.hud-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hud-supersonic {
  color: #9fe3ff;
  font-weight: bold;
}

.hud-mach-flash {
  position: absolute;
  top: 22%;
  left: 50%;
  transform: translateX(-50%) scale(0.8);
  font-size: 44px;
  font-weight: bold;
  letter-spacing: 10px;
  color: #e8f7ff;
  text-shadow: 0 0 18px rgba(160, 220, 255, 0.9);
  opacity: 0;
  pointer-events: none;
}

.hud-mach-flash.show {
  animation: mach-flash 1.6s ease-out forwards;
}

@keyframes mach-flash {
  0% { opacity: 0; transform: translateX(-50%) scale(1.6); }
  10% { opacity: 1; transform: translateX(-50%) scale(1); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) scale(1); }
}

.hud-ab {
  color: #ffb347;
  font-weight: bold;
  visibility: hidden;
}

/* ---------- Arcade ---------- */

.arcade-stats {
  position: absolute;
  top: 54px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 22px;
  font-size: 14px;
  white-space: nowrap;
}

.arcade-stats b {
  font-size: 18px;
}

.arcade-stats .dim {
  opacity: 0.65;
}

.arcade-mult {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  color: #ffd24a;
  letter-spacing: 2px;
}

.arcade-ceiling {
  position: absolute;
  top: calc(50% + 62px);
  right: 18%;
  min-width: 120px;
  text-align: center;
  font-size: 12px;
  padding: 3px 0;
  border: 1px solid rgba(125, 255, 160, 0.6);
}

.arcade-ceiling.near {
  color: #ffd24a;
  border-color: #ffd24a;
}

.arcade-ceiling.over {
  color: #fff;
  background: rgba(255, 60, 50, 0.75);
  border-color: #ff5a4a;
}

.arcade-minspeed {
  position: absolute;
  top: calc(50% + 62px);
  left: 18%;
  min-width: 120px;
  text-align: center;
  font-size: 12px;
  opacity: 0.85;
}

.arcade-radar {
  display: none;
  position: absolute;
  top: 22%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  font-size: 26px;
  font-weight: bold;
  color: #ff5a4a;
  letter-spacing: 3px;
  animation: blink 0.5s steps(2) infinite;
}

.arcade-radar b {
  font-size: 44px;
}

@keyframes blink {
  50% {
    opacity: 0.35;
  }
}

.arcade-toast {
  position: absolute;
  top: 36%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 26px;
  font-weight: bold;
  color: #ffd24a;
  letter-spacing: 3px;
  opacity: 0;
  transition: opacity 0.3s;
}

.arcade-results {
  display: none;
  position: absolute;
  bottom: 9%; /* abajo: arriba se sigue viendo la explosión */
  left: 50%;
  transform: translateX(-50%);
  min-width: 360px;
  padding: 26px 34px;
  background: rgba(0, 18, 8, 0.82);
  border: 1px solid rgba(125, 255, 160, 0.7);
  text-align: center;
}

.arcade-results-title {
  font-size: 26px;
  font-weight: bold;
  color: #ff5a4a;
  letter-spacing: 2px;
}

.arcade-results-record {
  margin-top: 6px;
  font-size: 18px;
  color: #ffd24a;
}

.arcade-results-grid {
  display: grid;
  grid-template-columns: auto auto;
  gap: 8px 28px;
  margin: 20px auto;
  width: max-content;
  text-align: left;
  font-size: 16px;
}

.arcade-results-hint {
  font-size: 13px;
  opacity: 0.85;
}

/* ---------- Menú de modos ---------- */

.mode-menu {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 14px;
  background: linear-gradient(90deg, rgba(5, 12, 20, 0.75), rgba(5, 12, 20, 0.15) 70%);
  padding-left: 8vw;
  pointer-events: auto;
  color: #dff6e8;
}

.mode-title {
  font-size: 56px;
  font-weight: bold;
  letter-spacing: 12px;
  color: #e8f7ff;
  text-shadow: 0 0 24px rgba(120, 200, 255, 0.5);
}

.mode-sub {
  font-size: 16px;
  letter-spacing: 4px;
  opacity: 0.75;
  margin-bottom: 10px;
}

.mode-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(460px, 80vw);
}

.menu-item {
  all: unset;
  cursor: pointer;
  padding: 14px 18px;
  border: 1px solid rgba(140, 255, 180, 0.25);
  background: rgba(10, 30, 20, 0.45);
  transition: transform 0.12s, background 0.12s, border-color 0.12s;
}

.menu-item.selected {
  border-color: #8cffb4;
  background: rgba(40, 110, 70, 0.55);
  transform: translateX(10px);
}

.menu-item-title {
  font-size: 24px;
  font-weight: bold;
  letter-spacing: 6px;
}

.menu-item-desc {
  font-size: 13px;
  opacity: 0.8;
  margin-top: 4px;
  line-height: 1.4;
}

.mode-record {
  font-size: 13px;
  color: #ffd24a;
  margin-top: 6px;
}

.mode-hint {
  margin-top: 18px;
  font-size: 12px;
  opacity: 0.6;
}

#hud.in-menu > :not(.mode-menu):not(.options-menu) {
  display: none;
}

.hud-screen-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.55), rgba(220, 235, 255, 0.15) 70%);
  opacity: 0;
  pointer-events: none;
}

.hud-screen-flash.show {
  animation: screen-flash 0.35s ease-out forwards;
}

@keyframes screen-flash {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

.arcade-missile {
  display: none;
  position: absolute;
  top: 28%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 40px;
  font-weight: bold;
  letter-spacing: 6px;
  color: #ff3b2f;
  text-shadow: 0 0 16px rgba(255, 40, 20, 0.8);
  animation: blink 0.25s steps(2) infinite;
}

/* ---------- Pausa ---------- */

.pause-menu {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 18px;
  background: rgba(4, 10, 16, 0.6);
  backdrop-filter: blur(3px);
  pointer-events: auto;
  color: #dff6e8;
  z-index: 20;
}

.pause-title {
  font-size: 48px;
  font-weight: bold;
  letter-spacing: 14px;
  color: #e8f7ff;
  text-shadow: 0 0 24px rgba(120, 200, 255, 0.5);
}

.pause-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(360px, 80vw);
}

.pause-list .menu-item {
  text-align: center;
}

.pause-list .menu-item-title {
  font-size: 20px;
}

/* ---------- Opciones ---------- */

.options-menu {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4vh 0;
  gap: 12px;
  background: rgba(4, 10, 16, 0.82);
  pointer-events: auto;
  color: #dff6e8;
  z-index: 30;
}

.options-title {
  font-size: 38px;
  font-weight: bold;
  letter-spacing: 12px;
  color: #e8f7ff;
}

.options-body {
  flex: 1;
  overflow-y: auto;
  width: min(760px, 92vw);
  padding-right: 6px;
}

.options-hint {
  font-size: 12px;
  opacity: 0.65;
}

.options-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 14px;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 15px;
}

.options-row.header {
  cursor: default;
  margin-top: 14px;
  font-size: 12px;
  letter-spacing: 4px;
  color: #8cffb4;
  opacity: 0.8;
  border-bottom: 1px solid rgba(140, 255, 180, 0.2);
}

.options-row.selected {
  border-color: #8cffb4;
  background: rgba(40, 110, 70, 0.45);
}

.opt-label {
  flex: 1;
}

.opt-value {
  color: #ffd24a;
}

.opt-cell {
  width: 170px;
  text-align: center;
  padding: 3px 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 13px;
}

.opt-cell.fixed {
  opacity: 0.5;
}

.options-row.selected .opt-cell.col {
  border-color: #ffd24a;
  color: #ffd24a;
}

.options-row.button {
  justify-content: center;
  letter-spacing: 3px;
}
