/* Shared page layout and controls for the arcade games. */
:root {
  color-scheme: dark;
  --bg: #090a17;
  --panel: #111321;
  --line: #272a3b;
  --cyan: #67efff;
  --purple: #a97cff;
  --red: #ff668a;
  --text: #f4f4ff;
  --muted: #9a9daf;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse at 50% 20%, rgba(72, 50, 133, 0.14), transparent 36rem),
    var(--bg);
  color: var(--text);
  font-family: "Space Grotesk", Arial, sans-serif;
}

.game-header {
  height: 66px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 clamp(16px, 4vw, 54px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(13, 14, 27, 0.88);
}

.back-link,
.game-brand {
  color: #d7d7e5;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}

.back-link span {
  margin-right: 7px;
  color: var(--cyan);
}

.game-brand {
  font-family: "Oxanium", Arial, sans-serif;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.game-brand span {
  color: var(--purple);
}

.game-category {
  justify-self: end;
  padding: 6px 9px;
  border: 1px solid rgba(103, 239, 255, 0.24);
  border-radius: 5px;
  color: var(--cyan);
  font-family: "Oxanium", Arial, sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
}

.game-layout {
  width: min(1320px, 100%);
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 20px;
  margin: 0 auto;
  padding: 30px clamp(16px, 4vw, 54px);
}

.game-panel {
  min-width: 0;
}

.game-topline {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.eyebrow,
.side-label {
  margin: 0 0 6px;
  color: var(--cyan);
  font-family: "Oxanium", Arial, sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.5px;
}

.game-topline h1 {
  margin: 0;
  font-family: "Oxanium", Arial, sans-serif;
  font-size: 26px;
}

.scoreboard {
  display: flex;
  gap: 25px;
}

.scoreboard div {
  display: grid;
  gap: 3px;
  text-align: right;
}

.scoreboard span {
  color: var(--muted);
  font-family: "Oxanium", Arial, sans-serif;
  font-size: 8px;
  letter-spacing: 1px;
}

.scoreboard strong {
  color: var(--cyan);
  font-family: "Oxanium", Arial, sans-serif;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.scoreboard div:last-child strong {
  color: var(--purple);
}

.game-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid #303249;
  border-radius: 10px;
  background: #080a15;
  box-shadow: 0 14px 50px rgba(0, 0, 0, 0.36), 0 0 24px rgba(103, 239, 255, 0.04);
  overflow: hidden;
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.game-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(7, 8, 19, 0.52);
  backdrop-filter: blur(3px);
}

.game-overlay[hidden] {
  display: none;
}

.overlay-card {
  width: min(390px, 100%);
  padding: 28px;
  border: 1px solid rgba(179, 155, 255, 0.28);
  border-radius: 12px;
  background: rgba(15, 16, 32, 0.91);
  text-align: center;
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.35), 0 0 35px rgba(124, 92, 238, 0.12);
}

.overlay-kicker {
  margin: 0 0 10px;
  color: var(--cyan);
  font-family: "Oxanium", Arial, sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2px;
}

.overlay-card h2 {
  margin: 0;
  font-family: "Oxanium", Arial, sans-serif;
  font-size: clamp(28px, 4vw, 39px);
  line-height: 1.04;
}

.overlay-card h2 span {
  color: var(--purple);
}

.overlay-card > p:not(.overlay-kicker) {
  margin: 12px auto 19px;
  max-width: 290px;
  color: #a9a9bb;
  font-size: 12px;
  line-height: 1.6;
}

#start-button {
  min-width: 150px;
  height: 42px;
  border: 0;
  border-radius: 6px;
  background: linear-gradient(110deg, #6347d6, #8b4edb);
  color: white;
  font: 700 13px "Space Grotesk", Arial, sans-serif;
  cursor: pointer;
  box-shadow: 0 0 24px rgba(137, 78, 219, 0.25);
}

#start-button:hover {
  filter: brightness(1.15);
}

#start-button span {
  margin-left: 8px;
  color: var(--cyan);
  font-size: 10px;
}

.overlay-card small {
  display: block;
  margin-top: 16px;
  color: #89899b;
  font-size: 10px;
}

kbd {
  display: inline-grid;
  min-width: 23px;
  height: 22px;
  place-items: center;
  margin: 0 2px;
  border: 1px solid #424359;
  border-radius: 4px;
  background: #202133;
  color: #d5d4e5;
  font: 10px "Space Grotesk", Arial, sans-serif;
}

.game-controls {
  min-height: 45px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #aaa9b9;
  font-size: 11px;
}

.game-controls > span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.score-save-status {
  min-width: 0;
  margin-left: auto;
  padding: 0 12px;
  color: #aaa9b9;
  font-size: 10px;
  text-align: right;
}

.control-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #64e6ac;
  box-shadow: 0 0 8px #64e6ac;
}

#pause-button {
  padding: 5px 9px;
  border: 1px solid #37394e;
  border-radius: 5px;
  background: #171827;
  color: #c3c2d1;
  font: 11px "Space Grotesk", Arial, sans-serif;
  cursor: pointer;
}

#pause-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#pause-button kbd {
  height: 17px;
  min-width: 17px;
  margin-left: 6px;
  font-size: 9px;
}

.touch-controls {
  display: none;
  justify-content: center;
  gap: 14px;
  margin-top: 8px;
}

.touch-controls button {
  width: 72px;
  height: 46px;
  border: 1px solid #424359;
  border-radius: 10px;
  background: #1a1b2b;
  color: var(--cyan);
  font-size: 22px;
  touch-action: none;
}

.game-sidebar {
  display: flex;
  flex-direction: column;
  gap: 13px;
  padding-top: 53px;
}

.sidebar-card {
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: linear-gradient(145deg, #151626, #11121e);
}

.side-icon {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--purple);
  font-size: 21px;
}

.side-label {
  color: #8d89a2;
  font-size: 8px;
}

.sidebar-card h2 {
  margin: 7px 0;
  font-family: "Oxanium", Arial, sans-serif;
  font-size: 17px;
}

.sidebar-card > p:last-child {
  margin: 0;
  color: #9696a8;
  font-size: 11px;
  line-height: 1.65;
}

.controls-card > div {
  display: flex;
  align-items: center;
  margin-top: 10px;
  color: #a6a6b6;
  font-size: 11px;
}

.controls-card > div span {
  margin-left: 9px;
}

.back-card {
  padding: 14px;
  border: 1px solid rgba(103, 239, 255, 0.19);
  border-radius: 8px;
  color: #d8d7e5;
  font-size: 11px;
  text-decoration: none;
}

.back-card span {
  margin-right: 6px;
  color: var(--cyan);
}

.back-card:hover {
  border-color: rgba(103, 239, 255, 0.5);
}

.game-footer {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  color: #77778a;
  font-size: 10px;
}

.game-footer span {
  color: var(--purple);
}

@media (max-width: 850px) {
  .game-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .game-sidebar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-top: 0;
  }

  .back-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .game-header {
    height: 58px;
  }

  .game-layout {
    padding-top: 19px;
  }

  .game-topline h1 {
    font-size: 22px;
  }

  .scoreboard {
    gap: 13px;
  }

  .scoreboard strong {
    font-size: 15px;
  }

  .overlay-card {
    padding: 20px 16px;
  }

  .game-overlay {
    padding: 12px;
  }

  .touch-controls {
    display: flex;
  }

  .game-controls {
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0;
  }

  .score-save-status {
    flex: 1 1 100%;
    order: 1;
    margin: 0;
    padding: 0;
    text-align: left;
  }

  #pause-button {
    order: 2;
  }

  .game-sidebar {
    grid-template-columns: 1fr;
  }

  .back-card {
    grid-column: auto;
  }
}
