:root {
  color-scheme: dark;
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  background: #05090c;
  color: #f4f8fa;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #05090c;
}

button {
  font: inherit;
}

.game-shell {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 520px;
  isolation: isolate;
  overflow: hidden;
  background: #081016;
}

#gameCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  outline: none;
}

.game-shell.is-playing #gameCanvas {
  cursor: none;
}

.hud {
  position: absolute;
  z-index: 4;
  top: max(18px, env(safe-area-inset-top));
  left: clamp(18px, 3vw, 44px);
  right: clamp(18px, 3vw, 44px);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  pointer-events: none;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.5);
}

.hud-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: rgba(225, 239, 245, 0.72);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.hud-mark {
  width: 9px;
  height: 9px;
  border: 2px solid #62d5ff;
  border-radius: 50%;
  box-shadow: 0 0 16px rgba(98, 213, 255, 0.7);
}

.hud-stats {
  display: flex;
  align-items: flex-start;
  gap: clamp(26px, 5vw, 78px);
  margin: 0;
  text-align: center;
}

.hud-stats div {
  min-width: 74px;
}

.hud-stats dt {
  margin-bottom: 2px;
  color: rgba(219, 231, 236, 0.6);
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.16em;
}

.hud-stats dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  font-size: clamp(1.25rem, 2.25vw, 2rem);
  font-weight: 680;
  line-height: 1;
  letter-spacing: -0.04em;
}

.hud-score dd {
  min-width: 128px;
  color: #f6fbfd;
  font-size: clamp(1.55rem, 3vw, 2.65rem);
}

.start-panel {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(3, 8, 11, 0.52);
  backdrop-filter: blur(8px);
  transition: opacity 180ms ease;
}

.start-panel[hidden] {
  display: none;
}

.countdown {
  position: absolute;
  z-index: 4;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #eefaff;
  text-align: center;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
  pointer-events: none;
  user-select: none;
}

.countdown[hidden] {
  display: none;
}

.countdown span {
  display: block;
  margin-bottom: 8px;
  color: #bdeeff;
  font-size: 0.8rem;
  letter-spacing: 0.16em;
}

.countdown strong {
  display: block;
  font-size: clamp(64px, 8vw, 96px);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.panel-card {
  width: min(92vw, 520px);
  padding: clamp(28px, 5vw, 48px);
  border: 1px solid rgba(163, 214, 233, 0.22);
  border-radius: 4px;
  background:
    linear-gradient(145deg, rgba(16, 29, 37, 0.96), rgba(6, 13, 18, 0.96)),
    #0a141a;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.5);
  text-align: center;
}

.eyebrow {
  margin: 0 0 14px;
  color: #68d8ff;
  font-size: 0.78rem;
  font-weight: 720;
  letter-spacing: 0.2em;
}

h1 {
  margin: 0;
  font-size: clamp(2.6rem, 9vw, 5.2rem);
  font-weight: 760;
  line-height: 0.98;
  letter-spacing: -0.065em;
}

.panel-copy {
  max-width: 390px;
  margin: 20px auto 28px;
  color: rgba(229, 240, 244, 0.72);
  font-size: 1rem;
  line-height: 1.7;
}

.start-button {
  min-width: 190px;
  min-height: 52px;
  padding: 0 28px;
  border: 1px solid #89e3ff;
  border-radius: 2px;
  background: #6bd9ff;
  color: #041117;
  font-size: 1rem;
  font-weight: 760;
  letter-spacing: 0.08em;
  cursor: pointer;
  box-shadow: 0 10px 34px rgba(50, 186, 234, 0.22);
  transition:
    transform 120ms ease,
    background-color 120ms ease,
    box-shadow 120ms ease;
}

.start-button:hover {
  background: #9ce8ff;
  box-shadow: 0 12px 42px rgba(50, 186, 234, 0.32);
  transform: translateY(-1px);
}

.start-button:active {
  transform: translateY(1px);
}

.start-button:focus-visible {
  outline: 3px solid rgba(255, 63, 88, 0.9);
  outline-offset: 4px;
}

.control-hint {
  margin: 16px 0 0;
  color: rgba(223, 236, 240, 0.45);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 26px 0;
  overflow: hidden;
  border: 1px solid rgba(160, 211, 229, 0.17);
  background: rgba(160, 211, 229, 0.17);
}

.result-grid[hidden] {
  display: none;
}

.result-grid div {
  padding: 15px 12px;
  background: #0b171e;
}

.result-grid span,
.result-grid strong {
  display: block;
}

.result-grid span {
  color: rgba(225, 237, 241, 0.52);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

.result-grid strong {
  margin-top: 5px;
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
}

.sensitivity-control {
  position: absolute;
  z-index: 6;
  bottom: max(16px, env(safe-area-inset-bottom));
  left: 50%;
  display: grid;
  grid-template-columns: 46px minmax(82px, auto) 46px;
  align-items: stretch;
  gap: 1px;
  overflow: hidden;
  border: 1px solid rgba(141, 210, 235, 0.24);
  border-radius: 4px;
  background: rgba(116, 194, 222, 0.18);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
  transform: translateX(-50%);
  backdrop-filter: blur(12px);
}

.sensitivity-control button {
  width: 46px;
  min-height: 46px;
  padding: 0;
  border: 0;
  background: rgba(7, 16, 21, 0.92);
  color: #e8f8fd;
  font-size: 1.6rem;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  transition:
    color 100ms ease,
    background-color 100ms ease;
}

.sensitivity-control button:hover {
  background: #17313e;
  color: #79dfff;
}

.sensitivity-control button:active {
  background: #214454;
}

.sensitivity-control button:focus-visible {
  position: relative;
  z-index: 1;
  outline: 2px solid #ff304f;
  outline-offset: -3px;
}

.sensitivity-control button:disabled {
  color: rgba(232, 248, 253, 0.25);
  cursor: not-allowed;
}

.sensitivity-readout {
  display: grid;
  min-width: 86px;
  padding: 6px 10px 5px;
  place-content: center;
  background: rgba(7, 16, 21, 0.92);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.sensitivity-readout span,
.sensitivity-readout strong {
  display: block;
}

.sensitivity-readout span {
  color: rgba(220, 237, 243, 0.5);
  font-size: 0.62rem;
  font-weight: 650;
  letter-spacing: 0.1em;
}

.sensitivity-readout strong {
  margin-top: 1px;
  color: #eefaff;
  font-size: 0.9rem;
  line-height: 1.1;
}

.game-footer {
  position: absolute;
  z-index: 4;
  right: clamp(18px, 3vw, 44px);
  bottom: max(18px, env(safe-area-inset-bottom));
  left: clamp(18px, 3vw, 44px);
  display: flex;
  justify-content: space-between;
  color: rgba(220, 233, 239, 0.48);
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  pointer-events: none;
}

@media (max-width: 700px) {
  .game-shell {
    min-height: 480px;
  }

  .hud {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .hud-brand {
    display: none;
  }

  .hud-stats {
    width: min(100%, 390px);
    justify-content: space-between;
    gap: 10px;
  }

  .hud-stats div {
    min-width: 68px;
  }

  .hud-score dd {
    min-width: 100px;
  }

  .game-footer {
    font-size: 0.68rem;
  }

  .game-footer span:first-child {
    display: none;
  }

  .game-footer {
    justify-content: flex-end;
  }

  .sensitivity-control {
    grid-template-columns: 44px minmax(76px, auto) 44px;
  }

  .sensitivity-control button {
    width: 44px;
    min-height: 44px;
  }
}

@media (max-height: 620px) {
  .panel-card {
    padding-block: 24px;
  }

  h1 {
    font-size: 2.6rem;
  }

  .panel-copy {
    margin-block: 12px 18px;
  }

  .result-grid {
    margin-block: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
