/* screen-game.css — Peg Rally mini-game on the welcome/login screen.
   The dialog is fullscreen; the canvas is integer-upscaled pixel art. */

/* "While you wait" tease under the login form */
.welcome__game-tease {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  text-align: center;
}
.welcome__game-tease .helper { margin-bottom: 10px; }

/* Fullscreen dialog */
.game-dialog {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  border: 0;
  padding: 0;
  margin: 0;
  background: var(--ink);
  color: var(--bg);
  display: none;
  flex-direction: column;
}
.game-dialog[open] { display: flex; }
.game-dialog::backdrop { background: rgba(42, 35, 27, 0.7); }

.game-dialog__bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(247, 242, 232, 0.18);
  flex: 0 0 auto;
}
.game-dialog__title {
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 2.5px;
  color: var(--gold);
  margin-right: auto;
}
.game-dialog__mute,
.game-dialog__close {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.5px;
  background: none;
  border: 1px solid rgba(247, 242, 232, 0.35);
  border-radius: var(--radius);
  color: var(--bg);
  padding: 6px 12px;
  cursor: pointer;
}
.game-dialog__mute:hover,
.game-dialog__close:hover { border-color: var(--gold); color: var(--gold); }

/* Stage: canvas centered, DOM UI layered on top */
.game-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  touch-action: none;
  overflow: hidden;
}
#gameCanvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: var(--bg);
  cursor: crosshair;
}

.game-ui {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none; /* canvas gets the swings; panels re-enable below */
}

/* Idle / game-over panel */
.game-panel {
  pointer-events: auto;
  background: rgba(42, 35, 27, 0.92);
  border: 1px solid rgba(202, 169, 107, 0.5);
  border-radius: var(--radius);
  padding: 26px 30px;
  width: min(420px, calc(100vw - 40px));
  max-height: calc(100% - 24px);
  overflow-y: auto;
  text-align: center;
  font-family: var(--font-mono);
}
.game-panel__title {
  font-size: 26px;
  letter-spacing: 6px;
  color: var(--gold);
  margin-bottom: 6px;
}
.game-panel__sub {
  font-size: 13px;
  color: rgba(247, 242, 232, 0.75);
  margin-bottom: 18px;
}
.game-panel__score {
  font-size: 18px;
  color: var(--bg);
  margin-bottom: 14px;
}
.game-panel__best {
  font-size: 12px;
  color: var(--ochre);
  margin: 10px 0;
}
.game-panel__play { margin-bottom: 16px; }
.game-panel__again { margin-top: 16px; }
.game-panel .btn { font-family: var(--font-mono); }
/* Ghost buttons are designed for light pages — restyle for the dark panel */
.game-panel .btn--ghost {
  color: var(--bg);
  border-color: rgba(247, 242, 232, 0.45);
  background: none;
}
.game-panel .btn--ghost:hover:not(:disabled) {
  color: var(--gold);
  border-color: var(--gold);
  background: none;
}
.game-panel__howto {
  font-size: 12px;
  line-height: 1.6;
  color: rgba(247, 242, 232, 0.65);
  margin-bottom: 18px;
}

/* Score submit form */
.game-submit {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.game-submit__name {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 13px;
}
.game-submit .btn { flex: 0 0 auto; padding: 10px 14px; font-size: 13px; }

/* Leaderboard */
.game-lb__title {
  font-size: 12px;
  letter-spacing: 3px;
  color: var(--gold);
  margin-bottom: 8px;
}
.game-lb__list {
  font-size: 13px;
  line-height: 1.7;
  color: var(--bg);
}
.game-lb__list--offline {
  color: rgba(247, 242, 232, 0.65);
  font-size: 12px;
  line-height: 1.6;
}
.game-lb__ol {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: rank;
  text-align: left;
}
.game-lb__ol li {
  display: flex;
  gap: 10px;
  counter-increment: rank;
  padding: 1px 4px;
}
.game-lb__ol li::before {
  content: counter(rank) ".";
  color: var(--ochre);
  width: 22px;
  flex: 0 0 auto;
}
.game-lb__ol li.is-you {
  background: rgba(202, 169, 107, 0.18);
  color: var(--gold);
}
.game-lb__name {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.game-lb__pts { flex: 0 0 auto; }

/* In-game HUD */
.game-hud {
  position: absolute;
  top: 12px;
  right: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-family: var(--font-mono);
  pointer-events: none;
}
.game-hud__score {
  font-size: 30px;
  color: var(--gold);
  text-shadow: 2px 2px 0 rgba(42, 35, 27, 0.6);
}
.game-hud__best {
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--ink-muted); /* sits over the cream sky, needs dark text */
}
.game-hud__paused {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 16px;
  letter-spacing: 2px;
  color: var(--gold);
  pointer-events: none;
}
.game-ui.is-paused .game-hud__paused { display: flex; }
