/* Shared interface scaffolding for the felt games (rack-em, solitaire,
   four-connect, potion-pour, video-poker, eins, go-fish, skip-em, reversi).
   Also linked by cave-cart, jeweler, mahjong, and roselle-opoly for this
   overlay/button/reset layer only — they keep their own JS scaffolding and
   game-specific CSS, and set per-game accents in a small inline :root. Each game
   links this before its own inline <style>, which keeps game-specific UI
   (HUD overlays, #game-log, mode-button color variants) and sets per-game
   accents via these CSS variables:
     --felt           table / page background (default green felt)
     --title-color    welcome <h1> color
     --title-shadow   welcome <h1> text-shadow (offset + color)
     --title-size     welcome <h1> font-size
     --title-spacing  welcome <h1> letter-spacing
   A game only overrides the vars that differ from the gold-felt default. */

:root {
  --felt: #1a5c2a;
  --title-color: #f1c40f;
  --title-shadow: 3px 3px 0 #e67e22;
  --title-size: 56px;
  --title-spacing: normal;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  overflow: hidden;
  background: var(--felt);
  font-family: 'Segoe UI', Arial, sans-serif;
  -webkit-user-select: none;
  user-select: none;
}

canvas { display: block; position: absolute; top: 0; left: 0; touch-action: none; }

#ui-layer {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
#ui-layer > * { pointer-events: auto; }

.overlay {
  position: fixed;
  inset: 0;
  width: 100dvw; height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* safe center: center if content fits, else top-align so overflow is
     reachable via scroll. Without "safe", flex centering hides the top of
     overflowing content above the scroll area. */
  justify-content: safe center;
  background: rgba(0,0,0,0.75);
  z-index: 100;
  overflow-y: auto;
}
.overlay.hidden { display: none; }
.overlay h1 {
  font-size: var(--title-size);
  color: var(--title-color);
  text-shadow: var(--title-shadow);
  letter-spacing: var(--title-spacing);
  margin-bottom: 10px;
  text-align: center;
}
.overlay h2 {
  font-size: 36px;
  margin-bottom: 8px;
  text-align: center;
  color: #ddd;
}
.overlay h2.win  { color: #2ecc71; }
.overlay h2.lose { color: #e74c3c; }
.overlay p {
  color: #ddd;
  font-size: 18px;
  margin-bottom: 6px;
  text-align: center;
  max-width: 440px;
  line-height: 1.5;
}
.overlay .subtitle {
  color: #aaa;
  font-size: 15px;
  margin-bottom: 20px;
}
.overlay .rules {
  margin: 10px 0 18px;
  padding: 14px 18px;
  background: rgba(255,255,255,0.07);
  border-radius: 8px;
  max-width: 440px;
}
.overlay .rules p {
  font-size: 14px;
  color: #bbb;
  margin: 4px 0;
}

.mode-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 240px;
}
.mode-buttons button {
  padding: 14px 24px;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.2;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  color: #fff;
  transition: transform 0.12s, box-shadow 0.12s;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
.mode-buttons button:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}

.btn-primary {
  margin-top: 20px;
  padding: 14px 40px;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  background: linear-gradient(135deg, #3498db, #2980b9);
  color: #fff;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn-primary:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}
.btn-secondary {
  margin-top: 10px;
  padding: 8px 28px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 24px;
  cursor: pointer;
  background: rgba(255,255,255,0.1);
  color: #aaa;
  transition: transform 0.15s, background 0.15s;
}
.btn-secondary:hover {
  transform: scale(1.05);
  background: rgba(255,255,255,0.18);
  color: #eee;
}

#gameover-detail { white-space: pre-line; }

/* Multiplayer connection/error pill; only shown in network mode. */
#net-status {
  display: none;
  position: fixed;
  top: 8px; left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.6);
  color: #eee;
  font-size: 14px;
  padding: 6px 14px;
  border-radius: 16px;
  white-space: nowrap;
}
