/* ============================================================
   Shared game-page chrome (used by every /games/*.php page)
   ============================================================ */

.game-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.game-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.6rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.fullscreen-btn {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 0.9rem;
  background: var(--surface);
  border: 2px solid var(--ink);
  color: var(--ink);
  border-radius: 999px;
  padding: 9px 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 0 rgba(34, 49, 74, 0.15);
  transition: transform 0.1s ease;
}
.fullscreen-btn:hover { transform: translateY(-2px); }
.fullscreen-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(34,49,74,0.15); }

.mute-btn {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 0.9rem;
  background: var(--surface);
  border: 2px solid var(--ink);
  color: var(--ink);
  border-radius: 999px;
  width: 40px;
  height: 40px;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 4px 0 rgba(34, 49, 74, 0.15);
  transition: transform 0.1s ease;
}
.mute-btn:hover { transform: translateY(-2px); }
.mute-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(34,49,74,0.15); }

/* --- Game toolbar: holds the mute/fullscreen buttons.
   Static by default (scrolls normally with the page); only becomes a
   floating/sticky overlay while the game is actually in fullscreen,
   so the Exit Full Screen button stays reachable no matter how far
   you've scrolled through a long level list or ruleset. --- */
.game-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  gap: 10px;
}
#game-stage:fullscreen .game-toolbar,
#game-stage.obg-fake-fullscreen .game-toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: transparent;
  padding: 4px 0 8px;
  margin-top: -4px;
  pointer-events: none;
}
#game-stage:fullscreen .game-toolbar .fullscreen-btn,
#game-stage.obg-fake-fullscreen .game-toolbar .fullscreen-btn,
#game-stage:fullscreen .game-toolbar .mute-btn,
#game-stage.obg-fake-fullscreen .game-toolbar .mute-btn {
  pointer-events: auto;
}

/* --- Game stage: everything that becomes fullscreen --- */
#game-stage {
  background: var(--bg-soft);
  border-radius: var(--radius-lg);
  border: 3px solid var(--ink);
  padding: 40px 24px 34px;
  margin: 28px 0 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
}

.scoreboard {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: center;
}
.score-chip {
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  padding: 10px 18px;
  text-align: center;
  min-width: 130px;
  box-shadow: var(--shadow);
}
.score-chip .label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--ink-soft);
  margin-bottom: 4px;
}
.score-chip .value {
  font-family: var(--font-score);
  font-size: 1.2rem;
  color: var(--pink-deep);
}
.score-chip.high .value { color: var(--purple-deep); }

.instructions {
  max-width: 440px;
  text-align: center;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.95rem;
}

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

@media (max-width: 480px) {
  .scoreboard { gap: 10px; }
  .score-chip { min-width: 110px; padding: 8px 12px; }
}

@media (max-width: 560px) {
  #game-stage { padding: 28px 10px 24px; }
}

/* --- Win / game-over overlay (used by any game) --- */
.win-overlay {
  position: fixed;
  inset: 0;
  background: rgba(34, 49, 74, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}
.win-overlay[hidden] {
  display: none;
}
.win-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 3px solid var(--ink);
  padding: 32px 28px;
  max-width: 380px;
  text-align: center;
  box-shadow: 0 16px 0 rgba(34,49,74,0.18);
}
.win-card h2 {
  font-family: var(--font-display);
  margin: 0 0 10px;
  font-size: 1.5rem;
}
.win-card p {
  color: var(--ink-soft);
  font-weight: 600;
  margin: 0 0 22px;
}
.win-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cta-btn {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  cursor: pointer;
  background: var(--simon-green);
  color: #fff;
}
.cta-btn.secondary {
  background: var(--surface);
  color: var(--ink);
}
.cta-btn:hover { filter: brightness(1.08); }
.cta-btn:disabled { opacity: 0.5; cursor: not-allowed; filter: none; }

.pill-btn {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 0.85rem;
  background: var(--surface);
  border: 2px solid var(--ink);
  color: var(--ink);
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(34, 49, 74, 0.12);
}
.pill-btn:hover { transform: translateY(-1px); }
.pill-btn:active { transform: translateY(1px); box-shadow: none; }
.pill-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.game-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}

/* --- Fake fullscreen fallback (used when the native Fullscreen API
   isn't available or refuses — notably some iPadOS/Safari versions).
   Games' own :fullscreen CSS rules should also target this class so
   board sizing etc. behaves the same way in both cases. --- */
.obg-fake-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  z-index: 9999 !important;
  width: 100vw !important;
  height: 100vh !important;
  margin: 0 !important;
  border-radius: 0 !important;
}
body.obg-fake-fullscreen-lock {
  overflow: hidden;
}

/* --- How to play (expandable rules panel, used by any game) --- */
.game-rules {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  padding: 6px 18px;
}
.game-rules summary {
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  padding: 10px 0;
  list-style: none;
}
.game-rules summary::-webkit-details-marker { display: none; }
.game-rules summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 8px;
  color: var(--teal-deep);
  transition: transform 0.15s ease;
}
.game-rules[open] summary::before {
  transform: rotate(90deg);
}
.game-rules h3 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--teal-deep);
  margin: 14px 0 6px;
}
.game-rules p,
.game-rules li {
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.5;
}
.game-rules ul {
  margin: 0 0 4px;
  padding-left: 20px;
}
.game-rules li + li {
  margin-top: 6px;
}
.game-rules li::marker {
  color: var(--teal-deep);
}
