:root {
  --ink: #07111f;
  --muted: #b4c7df;
  --panel: rgba(5, 11, 27, 0.72);
  --line: rgba(116, 245, 255, 0.26);
  --blue: #1263ee;
  --blue-dark: #073a97;
  --neon-cyan: #35f4ff;
  --neon-pink: #ff3df2;
  --neon-gold: #ffd34d;
  --gold: #ffc928;
  --green: #24b86e;
  --red: #ec4b42;
  --shadow: 0 24px 80px rgba(7, 17, 31, 0.22);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: #eaf7ff;
  background:
    radial-gradient(circle at 18% 12%, rgba(53, 244, 255, 0.24), transparent 28%),
    radial-gradient(circle at 82% 10%, rgba(255, 61, 242, 0.22), transparent 30%),
    radial-gradient(circle at 52% 86%, rgba(255, 211, 77, 0.12), transparent 28%),
    linear-gradient(135deg, #07111f 0%, #111a3d 48%, #160d2b 100%);
}

button {
  font: inherit;
}

[hidden] {
  display: none !important;
}

.runner-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 18%),
    radial-gradient(circle at 50% 92%, rgba(53, 244, 255, 0.09), transparent 34%);
}

.game-shell {
  width: min(1120px, 100%);
}

.game-topbar {
  min-height: 72px;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 4px 18px;
}

.brand-link {
  color: var(--neon-cyan);
  font-size: 14px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-shadow: 0 0 18px rgba(53, 244, 255, 0.42);
}

.stat-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.stat {
  min-width: 112px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.025)),
    var(--panel);
  box-shadow: 0 12px 38px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px);
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat strong {
  display: block;
  margin-top: 3px;
  color: #ffffff;
  font-size: 25px;
  line-height: 1;
}

.game-frame {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(116, 245, 255, 0.38);
  border-radius: 8px;
  background: #07111f;
  box-shadow:
    0 28px 90px rgba(0, 0, 0, 0.34),
    0 0 44px rgba(53, 244, 255, 0.18),
    inset 0 0 0 1px rgba(255, 255, 255, 0.055);
  aspect-ratio: 3 / 2;
  min-height: 360px;
  touch-action: none;
}

.feedback-toast {
  position: absolute;
  left: 50%;
  top: 92px;
  min-width: 128px;
  min-height: 34px;
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 999px;
  background: rgba(7, 17, 31, 0.72);
  color: #fff;
  font-size: 14px;
  font-weight: 850;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, -10px) scale(0.96);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
  z-index: 3;
}

.feedback-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.game-canvas,
.game-canvas canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: auto;
}

.screen-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(circle at 50% 16%, rgba(53, 244, 255, 0.18), transparent 34%),
    radial-gradient(circle at 50% 72%, rgba(255, 61, 242, 0.12), transparent 36%),
    linear-gradient(180deg, rgba(7, 17, 31, 0.12), rgba(3, 7, 18, 0.76));
  transition: opacity 0.18s ease, visibility 0.18s ease;
  z-index: 4;
}

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

.overlay-panel {
  width: min(460px, 100%);
  padding: 32px;
  border: 1px solid rgba(116, 245, 255, 0.34);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.035)),
    rgba(5, 10, 26, 0.88);
  box-shadow:
    0 26px 78px rgba(0, 0, 0, 0.52),
    0 0 42px rgba(53, 244, 255, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  text-align: center;
  backdrop-filter: blur(18px);
}

.eyeline {
  margin: 0 0 10px;
  color: var(--neon-cyan);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.overlay-panel h1 {
  margin: 0;
  color: #ffffff;
  font-size: clamp(42px, 7vw, 72px);
  line-height: 0.94;
  letter-spacing: 0;
}

.overlay-panel p {
  margin: 18px auto 0;
  max-width: 360px;
  color: #cfe5ff;
  font-size: 16px;
}

.result-line {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.result-line span {
  min-width: 118px;
  padding: 10px 12px;
  border: 1px solid rgba(53, 244, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.result-line strong {
  color: #ffffff;
}

.run-summary {
  margin-top: 14px;
  color: #dcecff;
  font-size: 14px;
  font-weight: 750;
}

.button-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.primary-button {
  position: relative;
  min-width: 150px;
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.24), transparent 32%),
    linear-gradient(135deg, #35f4ff 0%, #1263ee 42%, #ff3df2 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 850;
  letter-spacing: 0;
  cursor: pointer;
  box-shadow: 0 14px 34px rgba(18, 99, 238, 0.38), 0 0 18px rgba(255, 61, 242, 0.2);
  touch-action: manipulation;
  z-index: 1;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.secondary-button {
  min-width: 190px;
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid rgba(53, 244, 255, 0.38);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.025)),
    rgba(53, 244, 255, 0.1);
  color: #eafcff;
  font-size: 14px;
  font-weight: 850;
  cursor: pointer;
  touch-action: manipulation;
}

.mission-card {
  flex: 1 1 280px;
  max-width: 380px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.026)),
    var(--panel);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.075);
  backdrop-filter: blur(16px);
}

.mission-card span,
.focus-meter span {
  display: block;
  color: var(--neon-cyan);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mission-card strong {
  display: block;
  margin-top: 4px;
  color: #fff;
  font-size: 18px;
}

.mission-progress,
.focus-meter {
  overflow: hidden;
  height: 8px;
  margin-top: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.mission-progress i,
.focus-meter i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--neon-cyan), #7c3cff, var(--neon-pink), var(--neon-gold));
  box-shadow: 0 0 18px rgba(53, 244, 255, 0.42);
  transition: width 0.16s ease;
}

.focus-meter {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 16px;
  z-index: 3;
  height: 12px;
  border: 1px solid rgba(116, 245, 255, 0.22);
  box-shadow: 0 0 28px rgba(53, 244, 255, 0.24);
}

.focus-meter span {
  position: absolute;
  left: 0;
  bottom: 16px;
}

.star-row {
  min-height: 30px;
  margin-top: 14px;
  color: var(--neon-gold);
  font-size: 25px;
  letter-spacing: 0;
  text-shadow: 0 0 18px rgba(255, 211, 77, 0.45);
}

.primary-button:hover,
.primary-button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 18px 34px rgba(18, 99, 238, 0.38);
}

.primary-button:focus-visible {
  outline: 3px solid rgba(255, 201, 40, 0.7);
  outline-offset: 3px;
}

.mobile-controls {
  display: none;
}

.lane-button {
  min-height: 58px;
  border: 1px solid rgba(7, 17, 31, 0.12);
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff, #eaf3ff);
  color: var(--blue-dark);
  font-size: 26px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(7, 17, 31, 0.12);
  touch-action: manipulation;
}

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

.lane-button:focus-visible {
  outline: 3px solid rgba(18, 99, 238, 0.32);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 760px) {
  body {
    overflow-x: hidden;
  }

  .runner-page {
    min-height: 100dvh;
    padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
    align-items: start;
    place-items: stretch;
  }

  .game-shell {
    width: 100%;
    min-height: calc(100dvh - 22px);
    display: flex;
    flex-direction: column;
  }

  .game-topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    padding-bottom: 12px;
  }

  .mission-card {
    width: 100%;
    max-width: none;
    flex: 0 0 auto;
    padding: 9px 10px;
  }

  .mission-card strong {
    font-size: 15px;
  }

  .brand-link {
    font-size: 12px;
  }

  .stat-row {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stat {
    min-width: 0;
    padding: 9px 10px;
  }

  .stat strong {
    font-size: 21px;
  }

  .game-frame {
    flex: 0 0 auto;
    min-height: 0;
    aspect-ratio: 2 / 3;
    height: auto;
    max-height: min(66dvh, 610px);
  }

  .feedback-toast {
    top: 72px;
    min-width: 112px;
    min-height: 30px;
    padding: 7px 12px;
    font-size: 12px;
  }

  .focus-meter {
    left: 12px;
    right: 12px;
    bottom: 12px;
    height: 10px;
  }

  .mobile-controls {
    display: grid;
    grid-template-columns: 78px minmax(0, 1fr) 78px;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
  }

  .mobile-controls p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
    line-height: 1.25;
    text-align: center;
  }

  .overlay-panel {
    padding: 18px 16px;
  }

  .eyeline {
    margin-bottom: 7px;
    font-size: 10px;
  }

  .overlay-panel h1 {
    font-size: clamp(34px, 11vw, 46px);
  }

  .overlay-panel p {
    margin-top: 10px;
    font-size: 13px;
    line-height: 1.4;
  }

  .button-row {
    margin-top: 14px;
  }

  .primary-button {
    min-height: 42px;
    font-size: 14px;
  }

  .secondary-button {
    min-height: 42px;
    font-size: 13px;
  }

  .star-row {
    min-height: 24px;
    font-size: 20px;
  }

  .result-line {
    gap: 8px;
  }
}
