.game-surface {
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: 1rem;
}

.game-topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  padding: .85rem 0;
  border-bottom: 1px solid var(--page-card-border);
  background: color-mix(in srgb, var(--page-card-bg), white 10%);
  backdrop-filter: blur(18px);
}

.game-topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.game-topbar__cluster {
  display: flex;
  align-items: center;
  gap: .65rem;
  flex-wrap: wrap;
}

.game-topbar__title {
  display: grid;
  justify-items: end;
  gap: .1rem;
  text-align: right;
}

.game-topbar__title strong {
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.1;
}

.game-topbar__eyebrow {
  color: color-mix(in srgb, var(--route-accent, #4cc9f0), var(--text) 42%);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.game-topbar__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: .45rem .82rem;
  border: 1px solid var(--page-card-border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--page-card-bg), white 18%);
  box-shadow: 0 8px 20px rgba(15, 23, 42, .08);
  color: var(--text);
  font-size: .86rem;
  font-weight: 700;
}

.game-topbar__link--secondary {
  background: color-mix(in srgb, var(--page-card-bg), white 8%);
}

.game-shell--immersive {
  padding-top: 1rem;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(0, 1.25fr) minmax(200px, 240px);
  gap: 1rem;
  align-items: start;
}

.game-card,
.game-stage-card {
  border: 1px solid var(--page-card-border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--page-card-bg), white 8%);
  box-shadow: 0 18px 44px rgba(30, 41, 59, .08);
}

.game-stage-card {
  position: relative;
  padding: 1.1rem;
  background:
    radial-gradient(circle at 50% 0%, rgba(76, 201, 240, .08), transparent 32%),
    color-mix(in srgb, var(--page-card-bg), #081223 8%);
}

body.debris-run-storyboard-focus::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 22, .68);
  backdrop-filter: blur(2px) saturate(.78);
  pointer-events: none;
  z-index: 40;
}

.game-stage-card.is-story-focus {
  z-index: 41;
  box-shadow:
    0 26px 60px rgba(5, 10, 22, .46),
    0 0 0 1px rgba(255, 255, 255, .06);
}

.game-card {
  display: grid;
  gap: 1rem;
  padding: 1rem;
}

.game-stat-grid {
  display: grid;
  gap: 1rem;
}

.game-pilot {
  display: grid;
  gap: .5rem;
  align-items: center;
  padding-bottom: .95rem;
  border-bottom: 1px solid var(--page-card-border);
}

.game-pilot__portrait {
  display: grid;
  place-items: center;
  min-height: 190px;
  padding: .35rem;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(8, 14, 24, .34), rgba(8, 14, 24, .52)),
    radial-gradient(circle at 50% 18%, rgba(76, 201, 240, .16), transparent 58%),
    url("/games/debris-run/assets/cockpit-tile.png") center / cover no-repeat,
    linear-gradient(180deg, rgba(10, 18, 31, .92), rgba(19, 36, 61, .94));
  box-shadow:
    inset 0 0 0 1px rgba(76, 201, 240, .18),
    0 10px 24px rgba(15, 23, 42, .12);
  overflow: hidden;
}

.game-pilot__stage {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 178px;
}

.game-pilot__canvas {
  display: block;
  width: 100%;
  max-width: 160px;
  height: auto;
}

.game-pilot__portrait.is-impacting {
  box-shadow:
    inset 0 0 0 2px rgba(248, 113, 113, .72),
    inset 0 0 40px rgba(248, 113, 113, .38),
    inset 0 0 68px rgba(248, 113, 113, .16),
    0 0 0 2px rgba(248, 113, 113, .14);
}

.game-pilot__portrait.is-critical {
  animation: cockpit-critical-flash .88s ease-in-out infinite;
}

.game-pilot__copy {
  display: grid;
  place-items: center;
  text-align: center;
}

.game-pilot__copy h3 {
  margin: 0;
  font-size: 1.2rem;
}

.game-card__section {
  display: grid;
  gap: .45rem;
}

.game-card__section + .game-card__section {
  padding-top: 1rem;
  border-top: 1px solid var(--page-card-border);
}

.game-card__section h3 {
  margin-bottom: 0;
  font-size: 1.12rem;
}

.game-card__section p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.game-stat {
  display: grid;
  gap: .45rem;
}

.game-stat__label {
  color: var(--accent);
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.game-stat__value {
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  line-height: 1;
}

.game-stat__value--compact {
  font-size: clamp(1.1rem, 2vw, 1.45rem);
}

.game-meter {
  height: .7rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--page-card-border), transparent 20%);
  overflow: hidden;
}

.game-meter__fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1aa6b7, #80ed99);
  transition: width .18s ease;
}

.game-meter__fill--hull {
  background: linear-gradient(90deg, #ffd166, #f97316);
}

.game-meter__fill.is-critical {
  background: linear-gradient(90deg, #f97316, #ef4444);
  animation: shield-critical-flash .88s ease-in-out infinite;
}

.game-stage-frame {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--page-card-border), #4cc9f0 18%);
  background: #081223;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: inset 0 0 0 1px rgba(76, 201, 240, .08);
}

.game-stage-frame canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 600 / 520;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.game-stage-frame::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(76, 201, 240, .16);
  border-radius: 14px;
  pointer-events: none;
}

.game-stage-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(8, 18, 35, .42);
}

.game-stage-overlay.is-story-focus {
  background:
    radial-gradient(circle at 50% 42%, rgba(8, 18, 35, .18), rgba(8, 18, 35, .68) 76%),
    rgba(4, 10, 20, .48);
}

.game-stage-overlay[hidden] {
  display: none;
}

.game-stage-overlay__panel {
  display: grid;
  gap: .8rem;
  width: min(100%, 360px);
  padding: 1.2rem;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 18px;
  background: rgba(8, 18, 35, .88);
  box-shadow: 0 18px 42px rgba(8, 18, 35, .34);
  text-align: center;
  color: #effbff;
}

.game-stage-overlay__panel.is-cinematic {
  width: min(100%, 520px);
  padding: .8rem;
  background: rgba(8, 18, 35, .72);
}

.game-stage-overlay__panel strong {
  font-size: 1.2rem;
  line-height: 1.2;
}

.game-stage-overlay__image {
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 14px 34px rgba(8, 18, 35, .34);
}

.game-stage-overlay__image[hidden] {
  display: none;
}

.game-stage-overlay__image img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.game-stage-overlay__art {
  display: grid;
  justify-items: center;
  gap: .35rem;
  padding: .95rem;
  border-radius: 16px;
  background:
    radial-gradient(circle at 50% 25%, rgba(128, 237, 153, .16), transparent 45%),
    linear-gradient(180deg, rgba(19, 36, 61, .94), rgba(8, 18, 35, .96));
  border: 1px solid rgba(76, 201, 240, .18);
}

.game-stage-overlay__art-icon {
  font-size: 2rem;
  line-height: 1;
  color: #80ed99;
  text-shadow: 0 0 18px rgba(76, 201, 240, .35);
}

.game-stage-overlay__art-label,
.game-stage-overlay__speaker,
.game-stage-overlay__progress {
  color: rgba(239, 251, 255, .7);
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.game-stage-overlay__eyebrow {
  color: rgba(128, 237, 153, .92);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.game-stage-overlay__panel p {
  margin: 0;
  color: rgba(239, 251, 255, .84);
  line-height: 1.6;
}

.game-stage-overlay__settings {
  display: grid;
  gap: .6rem;
  width: 100%;
  text-align: left;
}

.game-stage-overlay__settings[hidden] {
  display: none;
}

.game-controls-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.game-control-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .55rem;
}

.game-control-button {
  width: 100%;
  justify-content: center;
}

.game-audio-control {
  display: grid;
  gap: .45rem;
}

.game-audio-control + .game-audio-control {
  margin-top: .55rem;
}

.game-audio-control__label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  color: var(--muted);
  font-size: .95rem;
  font-weight: 600;
}

.game-audio-control__label strong {
  color: var(--text);
  font-size: .92rem;
}

.game-audio-control input[type="range"] {
  width: 100%;
  margin: 0;
  accent-color: #4cc9f0;
  touch-action: pan-x;
}

@keyframes cockpit-critical-flash {
  0%, 100% {
    box-shadow:
      inset 0 0 0 1px rgba(76, 201, 240, .18),
      0 10px 24px rgba(15, 23, 42, .12);
  }
  50% {
    box-shadow:
      inset 0 0 0 2px rgba(248, 113, 113, .74),
      inset 0 0 34px rgba(248, 113, 113, .24),
      0 0 0 2px rgba(248, 113, 113, .12);
  }
}

@keyframes shield-critical-flash {
  0%, 100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.18);
  }
}

@media (max-width: 980px) {
  .game-layout {
    grid-template-columns: 1fr;
  }

  .game-card--stats,
  .game-card--mission {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .game-topbar__inner {
    align-items: start;
    flex-direction: column;
  }

  .game-topbar__title {
    justify-items: start;
    text-align: left;
  }

  .game-pilot__portrait {
    min-height: 160px;
  }

  .game-stage-overlay__panel {
    padding: 1rem;
  }
}
