/* Shared look for the matching games (Pyramid, TriPeaks, Golf).
   Each game's own game.css only sets --cw/--ch. Loaded via game_deps in games.json. */

.game-app {
  --cw: 72px;                     /* overridden per game */
  --ch: calc(var(--cw) * 1.42);
  margin: 22px 0 8px;
}

.g-hud {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 12px;
}
.g-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.g-btn {
  font: inherit; font-size: 14px; font-weight: 600;
  padding: 7px 16px; border-radius: 8px; cursor: pointer;
  border: 1px solid #cfd6dd; background: #ffffff; color: #155e4a;
}
.g-btn:hover { background: #eef4f1; }
.g-btn-acc { background: #1e7a5f; border-color: #1e7a5f; color: #fff; }
.g-btn-acc:hover { background: #155e4a; }
.g-stats { display: flex; gap: 16px; flex-wrap: wrap; }
.g-stat { font-size: 13.5px; color: #52606d; }
.g-stat b { color: #1f2933; }

.g-board {
  position: relative;
  background: #1e7a5f;
  background-image: radial-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 22px 22px;
  border-radius: 14px;
  padding: 14px;
  min-height: 340px;
  overflow: hidden;
}
.g-hint {
  position: absolute; left: 0; right: 0; top: -20px;
  text-align: center; font-size: 13px; color: #ffe3a8; min-height: 18px;
}
.pile {
  width: var(--cw); height: var(--ch); position: relative;
  border-radius: calc(var(--cw) * 0.09);
  border: 2px dashed rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.13);
}
.pile[data-pile="stock"], .pile[data-pile="discard"] { cursor: pointer; }
.pile[data-pile="waste"] { border-style: solid; border-color: rgba(255, 214, 130, 0.5); }

.card {
  position: absolute; left: 0; top: 0;
  width: var(--cw); height: var(--ch);
  margin: 0;                      /* override the placeholder .card margins in style.css */
  border-radius: calc(var(--cw) * 0.09);
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  font-size: calc(var(--cw) * 0.28);
  user-select: none; -webkit-user-select: none;
  cursor: pointer;
  transition: left 0.18s ease, top 0.18s ease;
}
.card.no-anim { transition: none; }
.card.sel { outline: 3px solid #ffd682; outline-offset: 1px; }
.card.red { color: #c0392b; }
.card.black { color: #23272e; }
.card .corner {
  position: absolute; top: 3%; left: 7%;
  display: flex; flex-direction: column; align-items: center;
  line-height: 1.05; font-weight: 700;
}
.card .corner .cr { display: block; font-size: 0.92em; letter-spacing: -0.02em; }
.card .corner .cs { display: block; font-size: 0.85em; }
.card .corner-br { top: auto; left: auto; bottom: 3%; right: 7%; transform: rotate(180deg); }
.card .pip {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.1em;
}
.card.back {
  cursor: pointer; opacity: 0.72;
  border: 2px solid #f4f7fa;
  background-color: #2c5f9e;
  background-image: repeating-linear-gradient(45deg, #2c5f9e 0, #2c5f9e 5px, #3b74ba 5px, #3b74ba 10px);
}

.g-overlay {
  position: absolute; inset: 0; z-index: 3000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(21, 51, 41, 0.72);
  border-radius: 14px;
}
.g-overlay[hidden] { display: none; }
.g-panel {
  background: #ffffff; border-radius: 14px; padding: 30px 40px;
  text-align: center; box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
  border-top: 5px solid #ffd682;
}
.g-panel-over { border-top-color: #c0392b; }
.g-win-title { font-size: 24px; font-weight: 700; color: #155e4a; margin-bottom: 8px; }
.g-win-stats { font-size: 14.5px; color: #52606d; margin-bottom: 18px; }

@media (max-width: 640px) {
  .g-board { padding: 8px; }
  .g-hud { flex-direction: column; align-items: flex-start; gap: 8px; }
  .g-stats { width: 100%; justify-content: space-between; gap: 8px; }
  .g-hint { font-size: 12px; top: -18px; }
  .card { font-size: calc(var(--cw) * 0.26); }
  .g-panel { padding: 22px 26px; }
}
