/* =========================================================
 * shared/duel.css — layout + overlays for the 2-player duel games
 * (tic-tac-toe/, reaction-duel/, paddle-duel/, balloon-duel/; overlays built by shared/duel.js)
 * Loaded after shared/style.css; pages use <html class="has-sitebar has-game-copy">.
 * ========================================================= */
:root {
  --p1: #ff7f50;   /* Player 1 / You: the site's orange */
  --p2: #4d9cfe;   /* Player 2 / Computer: blue */
}

/* The game fills the first screen under the site bar; .game-copy follows below it */
#app {
  position: fixed;
  top: var(--safe-top);
  bottom: var(--safe-bottom);
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#stage {
  position: relative;
  flex: 1;
  min-height: 0;
  touch-action: none; /* taps and drags on the board never scroll or zoom the page */
}

/* Top-of-screen HUD row: mute button + scores */
.duel-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  font-weight: 700;
}
.duel-hud .mute {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--card-bg);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
  font-size: 20px;
}
.duel-score {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
}
.duel-score b {
  font-size: 22px;
}
.duel-score.p1 { color: var(--p1); }
.duel-score.p2 { color: var(--p2); }

/* On a phone the two players usually sit face to face: the top player's text is turned
 * round. With a mouse / keyboard both players look from the same side, so it is not. */
@media (pointer: coarse) {
  .face-p2 {
    transform: rotate(180deg);
  }
}

/* ---------- overlays (start menu + result) ---------- */
.duel-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(245, 246, 250, 0.9);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  overflow-y: auto;
}
.duel-overlay.hidden {
  display: none;
}
.duel-box {
  width: 100%;
  max-width: 360px;
  margin: auto;
  padding: 22px 20px 14px;
  border-radius: 20px;
  background: var(--card-bg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  text-align: center;
  animation: duel-pop 0.2s ease-out;
}
.duel-box h2 {
  font-size: 24px;
  font-weight: 800;
}
.duel-winner.p1 { color: var(--p1); }
.duel-winner.p2 { color: var(--p2); }
.duel-tagline,
.duel-detail {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-sub);
}
.duel-modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}
.duel-mode {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 88px;
  padding: 12px 8px;
  border-radius: 14px;
  background: #f1f2f6;
  color: var(--text);
  box-shadow: inset 0 0 0 2px transparent;
}
.duel-mode.on {
  background: #fff4ee;
  box-shadow: inset 0 0 0 2px var(--primary);
}
.duel-mode-icon {
  font-size: 26px;
}
.duel-mode b {
  font-size: 15px;
}
.duel-mode small {
  font-size: 12px;
  color: var(--text-sub);
}
.duel-controls {
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-sub);
}
.duel-controls kbd {
  display: inline-block;
  min-width: 22px;
  padding: 1px 6px;
  border-radius: 6px;
  background: #f1f2f6;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.15);
  color: var(--text);
  font: inherit;
  font-weight: 700;
}
.duel-btn {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: 14px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
}
.duel-btn.secondary {
  margin-top: 10px;
  background: #f1f2f6;
  color: var(--text);
}
.duel-btn:active,
.duel-mode:active {
  transform: scale(0.97);
}
.duel-record {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-sub);
}
.duel-link {
  display: inline-block;
  margin-top: 6px;
  padding: 10px 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
}

/* Short-lived centred message on the stage ("Round 2", "Too early!") */
.duel-flash {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 10;
  transform: translate(-50%, -50%);
  padding: 10px 18px;
  border-radius: 14px;
  background: rgba(45, 52, 54, 0.85);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  white-space: nowrap;
  pointer-events: none;
}

@keyframes duel-pop {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
