/* ==========================================================================
   Motorcycle Arcade — game shell
   Canvas stage, HUD, state overlays, touch controls, game page furniture.
   ========================================================================== */

.game-shell {
  --stage-radius: var(--radius);
  margin: 0 auto 1.25rem;
  max-width: 960px;
}

/* --- Stage --------------------------------------------------------------- */
.game-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: #0d1016;
  border: 1px solid var(--border-strong);
  border-radius: var(--stage-radius);
  overflow: hidden;
  touch-action: none;              /* stop scroll-jank while playing */
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: var(--shadow);
  contain: layout paint;
}
.game-stage canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
}
.game-stage:focus-visible { outline: 3px solid var(--signal); outline-offset: 3px; }

@media (min-width: 700px) {
  .game-shell--tall .game-stage { aspect-ratio: 4 / 3; }
  .game-shell--wide .game-stage { aspect-ratio: 2 / 1; }
}
@media (max-width: 699px) {
  .game-stage { aspect-ratio: 4 / 3; }
  .game-shell--portrait .game-stage { aspect-ratio: 3 / 4; }
}

/* --- HUD ----------------------------------------------------------------- */
.game-hud {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; gap: .4rem; flex-wrap: wrap;
  padding: .5rem .6rem;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(6, 9, 14, .62), rgba(6, 9, 14, 0));
}
.hud-item {
  display: flex; flex-direction: column; line-height: 1.1;
  padding: .25rem .5rem; border-radius: 8px;
  background: rgba(8, 11, 17, .55);
  border: 1px solid rgba(255, 255, 255, .1);
  min-width: 58px;
}
.hud-label {
  font-size: .58rem; letter-spacing: .12em; text-transform: uppercase;
  color: rgba(255, 255, 255, .68); font-weight: 800;
}
.hud-value { font-size: 1rem; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; }
.hud-item--accent .hud-value { color: #ffb27a; }
.hud-spacer { margin-left: auto; }

/* --- State overlay ------------------------------------------------------- */
.game-overlay {
  position: absolute; inset: 0; z-index: 5;
  display: grid; place-items: center; padding: 1rem;
  background: radial-gradient(80% 80% at 50% 40%, rgba(10, 13, 19, .82), rgba(6, 8, 12, .94));
  text-align: center;
}
.game-overlay[hidden] { display: none; }
.overlay-card { max-width: 30rem; color: #f2f5f8; }
.overlay-eyebrow {
  font-size: .7rem; letter-spacing: .22em; text-transform: uppercase;
  color: #ff8b57; font-weight: 800; margin: 0 0 .35rem;
}
.overlay-title { font-size: clamp(1.3rem, 5vw, 2rem); margin: 0 0 .5rem; color: #fff; }
.overlay-text { font-size: .92rem; color: rgba(240, 244, 248, .82); margin: 0 0 1rem; }
.overlay-scores {
  display: flex; justify-content: center; gap: 1.5rem; margin: 0 0 1.15rem;
  padding: 0; list-style: none;
}
.overlay-scores li { margin: 0; }
.overlay-scores .lbl { display: block; font-size: .62rem; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.6); font-weight: 800; }
.overlay-scores .val { display: block; font-size: 1.6rem; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; }
.overlay-scores .val--best { color: #ffb27a; }
.overlay-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; }
.overlay-actions .btn--ghost { border-color: rgba(255,255,255,.35); color: #fff; background: rgba(255,255,255,.06); }
.overlay-actions .btn--ghost:hover { background: rgba(255,255,255,.14); }
.overlay-newbest {
  display: inline-block; margin: 0 0 .75rem; padding: .2rem .6rem;
  border-radius: 999px; background: #ff6f33; color: #fff;
  font-size: .68rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
}

/* --- Rotate hint --------------------------------------------------------- */
.rotate-hint {
  position: absolute; z-index: 6; left: 50%; bottom: .65rem; transform: translateX(-50%);
  display: flex; align-items: center; gap: .4rem;
  padding: .35rem .7rem; border-radius: 999px;
  background: rgba(8, 11, 17, .8); border: 1px solid rgba(255,255,255,.16);
  color: #fff; font-size: .74rem; font-weight: 600; white-space: nowrap;
  pointer-events: none;
}
.rotate-hint svg { width: 15px; height: 15px; }

/* --- Control bar --------------------------------------------------------- */
.game-bar {
  display: flex; flex-wrap: wrap; gap: .45rem; align-items: center;
  margin-top: .7rem;
}
.game-bar .btn { flex: 0 0 auto; }
.game-bar .bar-right { margin-left: auto; display: flex; gap: .45rem; }
.game-bar .icon-btn { border: 1px solid var(--border-strong); background: var(--surface); }
@media (max-width: 480px) {
  .game-bar .btn { flex: 1 1 auto; }
  .game-bar .bar-right { margin-left: 0; width: 100%; }
  .game-bar .bar-right .icon-btn { flex: 1 1 auto; }
}

/* --- Touch controls ------------------------------------------------------ */
.touch-controls {
  display: none;
  margin-top: .7rem;
  gap: .5rem;
  justify-content: space-between;
  align-items: flex-end;
}
.touch-controls.is-on { display: flex; }
.touch-cluster { display: flex; gap: .5rem; }
.touch-btn {
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  min-width: 68px; min-height: 62px;
  padding: .5rem .75rem;
  display: grid; place-items: center; gap: .1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text); cursor: pointer;
  font-weight: 800;
}
.touch-btn .glyph { font-size: 1.25rem; line-height: 1; }
.touch-btn .cap { font-size: .6rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); }
.touch-btn.is-down { background: var(--accent); border-color: var(--accent); color: #fff; }
.touch-btn.is-down .cap { color: rgba(255,255,255,.85); }
.touch-btn--wide { min-width: 96px; }
.touch-btn--primary { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }

/* --- Control hint / key legend ------------------------------------------- */
.control-legend {
  margin-top: .8rem; display: flex; flex-wrap: wrap; gap: .4rem .9rem;
  font-size: .82rem; color: var(--text-muted);
}
.control-legend .k {
  display: inline-block; min-width: 1.6rem; text-align: center;
  padding: .1rem .35rem; margin-right: .3rem;
  border: 1px solid var(--border-strong); border-bottom-width: 2px;
  border-radius: 5px; background: var(--surface);
  font-family: var(--font-mono); font-size: .76rem; color: var(--text);
}

/* --- Game page furniture ------------------------------------------------- */
.game-header { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: flex-start; justify-content: space-between; }
.game-header h1 { margin-bottom: .35rem; }
.game-meta-row { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-bottom: .5rem; }
.game-intro { color: var(--text-muted); max-width: 68ch; margin-bottom: 1.25rem; }

/* The favourite button on a game page is a normal button in the flow, not the
   floating circle used on cards. */
.fav-btn--inline {
  position: static;
  width: auto; height: auto;
  padding: .5rem .95rem;
  border-radius: 999px;
  gap: .45rem;
  display: inline-flex; align-items: center;
  font-weight: 700; font-size: .9rem;
  flex: 0 0 auto;
}
.fav-btn--inline svg { width: 18px; height: 18px; }

.game-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 1.25rem 0; }
.share-row { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.share-row .icon-btn { border: 1px solid var(--border); background: var(--surface); }
.copy-flash { font-size: .82rem; color: var(--signal); font-weight: 650; }

.spec-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; list-style: none; margin: 0 0 1.5rem; padding: 0; }
.spec-list > div { margin: 0; padding: .7rem .85rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.spec-list dt { font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); font-weight: 800; }
.spec-list dd { margin: .15rem 0 0; font-weight: 680; font-size: .95rem; }

.howto-list { counter-reset: step; list-style: none; padding: 0; }
.howto-list li {
  counter-increment: step; position: relative;
  padding-left: 2.1rem; margin-bottom: .6rem;
}
.howto-list li::before {
  content: counter(step); position: absolute; left: 0; top: .12rem;
  width: 1.5rem; height: 1.5rem; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-strong);
  display: grid; place-items: center; font-size: .78rem; font-weight: 800;
}

.tips-list { list-style: none; padding: 0; }
.tips-list li { position: relative; padding-left: 1.5rem; margin-bottom: .55rem; }
.tips-list li::before {
  content: ""; position: absolute; left: .1rem; top: .58rem;
  width: .5rem; height: .5rem; border-radius: 2px; background: var(--accent); transform: rotate(45deg);
}

.next-nav { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: space-between; margin: 1.5rem 0; }
