/* TriPeaks: three peaks drawn as overlapping rows. Every slot is placed by a
   class (--x in card widths, --row down), never an inline style: the CSP. Ten
   cards across is the width that sets the card size; the rows overlap so the
   peaks stand up. */
/* Ten cards across a phone: fanned with a 7px overlap so each card can be
   ~42-46px instead of 33 and still fit. The button is the whole card, so the
   tap target is the card's own width; what a neighbour covers goes to it. */
.turn-table.kind-tripeaks { --gap: -10px; --cw: min(84px, calc((100vw - 32px + 9 * 10px) / 10)); --ch: calc(var(--cw) * 1.4); --rowh: calc(var(--ch) * 0.56); }
/* narrow phones (360-400): a deeper fan keeps every card at least 44px wide */
@media (max-width: 400px) {
  .turn-table.kind-tripeaks { --gap: -14px; --cw: min(84px, calc((100vw - 32px + 9 * 14px) / 10)); }
}
.tp-peaks {
  position: relative; margin: 0 auto;
  width: calc(10 * var(--cw) + 9 * var(--gap));
  height: calc(3 * var(--rowh) + var(--ch));
}
.tp-slot {
  position: absolute; display: block; padding: 0; border: 0; background: none; min-height: 0;
  width: var(--cw); height: var(--ch); border-radius: calc(var(--cw) * 0.09);
  left: calc(var(--x) * (var(--cw) + var(--gap)));
  top: calc(var(--row) * var(--rowh));
  z-index: calc(1 + var(--row));           /* the row below sits on the one above */
}
.tp-slot .card { width: var(--cw); height: var(--ch); }
button.tp-slot.ok .card { box-shadow: 0 0 0 3px var(--good), 0 6px 14px rgba(0, 0, 0, 0.45); }
button.tp-slot.ok { transform: translateY(-4px); }
button.tp-slot:not(.ok) .card { opacity: 0.92; }
.tp-c0 { --x: 1.5; --row: 0; }
.tp-c1 { --x: 4.5; --row: 0; }
.tp-c2 { --x: 7.5; --row: 0; }
.tp-c3 { --x: 1; --row: 1; }
.tp-c4 { --x: 2; --row: 1; }
.tp-c5 { --x: 4; --row: 1; }
.tp-c6 { --x: 5; --row: 1; }
.tp-c7 { --x: 7; --row: 1; }
.tp-c8 { --x: 8; --row: 1; }
.tp-c9 { --x: 0.5; --row: 2; }
.tp-c10 { --x: 1.5; --row: 2; }
.tp-c11 { --x: 2.5; --row: 2; }
.tp-c12 { --x: 3.5; --row: 2; }
.tp-c13 { --x: 4.5; --row: 2; }
.tp-c14 { --x: 5.5; --row: 2; }
.tp-c15 { --x: 6.5; --row: 2; }
.tp-c16 { --x: 7.5; --row: 2; }
.tp-c17 { --x: 8.5; --row: 2; }
.tp-c18 { --x: 0; --row: 3; }
.tp-c19 { --x: 1; --row: 3; }
.tp-c20 { --x: 2; --row: 3; }
.tp-c21 { --x: 3; --row: 3; }
.tp-c22 { --x: 4; --row: 3; }
.tp-c23 { --x: 5; --row: 3; }
.tp-c24 { --x: 6; --row: 3; }
.tp-c25 { --x: 7; --row: 3; }
.tp-c26 { --x: 8; --row: 3; }
.tp-c27 { --x: 9; --row: 3; }

/* the score, where whose-turn would be in a table game */
.tp-strip {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.5rem 1rem;
  min-height: 56px; padding: 0.55rem 1rem; border-radius: 14px;
  background: rgba(0, 0, 0, 0.28); border: 1px solid rgba(255, 255, 255, 0.18);
}
.tp-score b { font-size: 1.7rem; color: var(--accent); font-variant-numeric: tabular-nums; }
.tp-score small { color: var(--muted); font-weight: 650; }
.tp-run { font-weight: 700; color: rgba(255, 255, 255, 0.85); }
.tp-run.hot { color: #fde047; }
.tp-daily { margin-left: auto; font-size: 0.85rem; font-weight: 700; color: #86efac; }
.tp-daily.muted { color: var(--muted); }

/* stock and waste */
.tp-piles { display: flex; justify-content: center; align-items: flex-end; gap: 1.6rem; --cw: clamp(64px, 18vw, 110px); --ch: calc(var(--cw) * 1.4); }
.tp-stock, .tp-waste { display: grid; justify-items: center; gap: 0.4rem; padding: 0; border: 0; background: none; min-height: 0; }
.tp-stock .card, .tp-waste .card { width: var(--cw); height: var(--ch); }
.tp-stock.ok .card { box-shadow: 0 0 0 3px var(--good), 0 6px 14px rgba(0, 0, 0, 0.45); }
.tp-empty { display: block; width: var(--cw); height: var(--ch); border-radius: 9px; border: 2px dashed rgba(255, 255, 255, 0.3); }
.tp-results { display: grid; gap: 0.5rem; justify-items: center; }
.tp-big b { font-size: 2.6rem; color: var(--accent); }
.tp-big span { color: var(--muted); font-weight: 650; }

/* the felt: a cool slate, so the cream cards and the green "playable" ring read */
body[data-kind="tripeaks"] {
  --panel: rgba(255, 255, 255, 0.075); --panel-line: rgba(147, 197, 253, 0.24);
  background:
    radial-gradient(70% 40% at 50% 100%, rgba(59, 130, 246, 0.28), transparent 70%),
    linear-gradient(180deg, #0f172a 0%, #1e293b 55%, #0f172a 100%) no-repeat, #0f172a;
}
body[data-kind="tripeaks"]::before { background-image: url("/static/felt-slate.webp?v=1"); opacity: 0.45; }
.tile[data-kind="tripeaks"] { --tile-felt: url("/static/felt-slate.webp?v=1"); --tile-line: rgba(147, 197, 253, 0.45); }
@media (min-width: 700px) {
  .turn-table.kind-tripeaks { --gap: 6px; --cw: min(78px, calc((min(100vw, 1100px) - 48px - 9 * 6px) / 10)); --rowh: calc(var(--ch) * 0.5); }
  .tp-piles { --cw: 92px; }
}
@media (min-width: 700px) and (orientation: landscape) and (max-height: 900px) {
  /* a tablet on its side: the whole game on one screen */
  .turn-table.kind-tripeaks { --cw: min(68px, calc((min(100vw, 1100px) - 48px - 9 * 6px) / 10)); --rowh: calc(var(--ch) * 0.48); }
  .tp-piles { --cw: 80px; }
  .tp-strip { min-height: 48px; padding: 0.4rem 1rem; }
}

/* the leaderboard sub-headings for a scored game */
.board-sub { margin: 0.8rem 0 0.3rem; font-size: 1rem; color: var(--muted); }

@media (max-width: 699px) {
  .tp-strip { min-height: 48px; padding: 0.4rem 0.8rem; }
  .turn-table.kind-tripeaks .small-note { margin: 0; }
}
