/* Triples-only styles. The header, home, lobby, buttons, modal and toast come from /game-shell.css,
   shared with Loop Fence. */
:root { --t0: #d93a32; --t1: #1f9a4b; --t2: #2f6fd8; --card: #fffefb; --card-edge: #e3dfd5; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --card: #f4f2ec; --card-edge: #3a3a44; } }

/* Toasts sit near the top here, clear of the Triple! button at the bottom. */
.toast { top: 76px; bottom: auto; }

/* home */
.tp-feature .daily-text { min-width: 0; flex: 1; }
.tp-example { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 480px; margin: 12px 0 10px; }
.diff-list .tp-sub { font-weight: 400; font-size: 13px; color: var(--sub); margin-left: 4px; }
.tp-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 8px; vertical-align: 1px; }
.tp-features { margin: 0 0 12px; padding-left: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 16px; }

/* cards */
.tp-card { position: relative; display: block; width: 100%; aspect-ratio: 3 / 2; padding: 0; border: 1px solid var(--card-edge); border-radius: 12px; background: var(--card); box-shadow: var(--shadow-sm); cursor: pointer; transition: transform .12s, box-shadow .12s, border-color .12s; }
.tp-card:hover { background: var(--card); }
.tp-card svg { width: 100%; height: 100%; display: block; }
.tp-card.static { cursor: default; }
.tp-card:not(.static):hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.tp-card.picked { border-color: var(--claim, var(--ink)); box-shadow: 0 0 0 3px var(--claim, var(--ink)); transform: translateY(-3px); }
.tp-card.good { animation: tp-good .5s ease forwards; }
.tp-card.bad { animation: tp-bad .45s ease; }
.tp-card.deal { animation: tp-deal .32s ease backwards; }
@keyframes tp-good { 0% { box-shadow: 0 0 0 3px var(--success); } 60% { transform: scale(1.05); box-shadow: 0 0 0 6px var(--success); } 100% { transform: scale(.6); opacity: 0; } }
@keyframes tp-bad { 0%, 100% { transform: none; box-shadow: 0 0 0 3px var(--danger); } 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@keyframes tp-deal { from { transform: translateY(10px) scale(.9); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .tp-card, .tp-card.good, .tp-card.bad, .tp-card.deal { animation: none; transition: none; } }

/* game */
.tp-game { display: flex; flex-direction: column; gap: 12px; min-height: calc(100dvh - 70px); padding-bottom: 16px; }
.tp-status { position: relative; display: flex; align-items: center; justify-content: center; min-height: 42px; border-radius: 12px; font-size: 15.5px; color: var(--sub); overflow: hidden; }
.tp-status.claiming { color: var(--text); background: color-mix(in srgb, var(--pc) 12%, transparent); }
.tp-status b { color: var(--pc); }
.tp-status b.plain { color: var(--text); }
.tp-timer { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; }
.tp-timer i { display: block; height: 100%; background: var(--pc); transform-origin: left; transform: scaleX(0); }
/* Cards are sized for 5 rows (12 cards + room for 3 more), so dealing extra cards never moves anything. */
.tp-table { --rows: 5; flex: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-content: start; margin: 0 auto; width: min(100%, 760px, calc((100dvh - 290px) * 4.5 / var(--rows))); }
.tp-table.locked .tp-card:hover { transform: none; }

/* bottom bar: the Triple! button, centred (rooms), or counters (practice). Scores sit above the table. */
.tp-players { display: flex; justify-content: center; align-items: center; position: sticky; bottom: 0; padding: 8px 0 calc(4px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 30%); z-index: 2; }
.tp-call-btn { flex: 0 0 auto; min-width: 200px; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px 22px; border-radius: 16px; border: 0; background: var(--pc); color: #fff; font: 700 20px var(--font-display); touch-action: manipulation; user-select: none; box-shadow: 0 3px 0 color-mix(in srgb, var(--pc) 60%, #000); transition: transform .08s, box-shadow .08s, opacity .15s; }
.tp-call-btn:hover { background: var(--pc); filter: brightness(1.05); }
.tp-call-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 color-mix(in srgb, var(--pc) 60%, #000); }
.tp-call-btn kbd.kc { background: rgba(255,255,255,.2); border-color: rgba(255,255,255,.35); color: #fff; }
.tp-call-btn[aria-disabled="true"] { opacity: .4; cursor: default; box-shadow: none; font-size: 16px; }
.tp-call-btn.active { outline: 3px solid var(--pc); outline-offset: 3px; }
.tp-call-btn.nudge { animation: tp-nudge .5s ease; }
@keyframes tp-nudge { 30% { transform: translateY(-4px); } 60% { transform: translateY(2px); } }
.tp-scores { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.tp-scores:empty { display: none; }
.tp-scores .chip { overflow: visible; }
.tp-scores .chip.calling { border-color: var(--pc); box-shadow: 0 0 0 2px var(--pc); }
.tp-scores .wl { font-size: 18px; color: var(--pc); }
.tp-solo { position: relative; display: flex; align-items: center; justify-content: center; gap: 22px; color: var(--sub); width: 100%; }
.tp-solo span { white-space: nowrap; }
.tp-solo b { color: var(--text); font-size: 18px; }
.tp-float { position: absolute; right: 12px; top: -10px; font: 700 20px var(--font-display); pointer-events: none; animation: tp-float .9s ease forwards; }
.tp-float.up { color: var(--success); }
.tp-float.down { color: var(--danger); }
@keyframes tp-float { to { transform: translateY(-26px); opacity: 0; } }

/* results */
.tp-ranks { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 6px; }
.tp-ranks li { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.tp-ranks li:first-child { background: color-mix(in srgb, var(--pc) 14%, var(--surface)); }
.tp-ranks .tp-dot { margin: 0; }
.tp-ranks span:not(.tp-dot):not(.tp-final) { color: var(--sub); font-size: 13px; }
.tp-final { font: 700 22px var(--font-display); color: var(--pc); min-width: 28px; text-align: right; }

/* scoreboard: one row per player, one column per round */
.tp-board-wrap { overflow-x: auto; margin: 0 -4px 12px; padding: 0 4px; }
.tp-board { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 14px; }
.tp-board th, .tp-board td { padding: 7px 8px; text-align: center; white-space: nowrap; border-bottom: 1px solid var(--line); }
.tp-board thead th { font-size: 12px; font-weight: 500; color: var(--sub); }
.tp-board th.nm, .tp-board td.nm { text-align: left; position: sticky; left: 0; background: var(--surface); }
.tp-board td.nm .tp-dot { margin-right: 6px; }
.tp-board td.won { font-weight: 700; color: var(--pc); }
.tp-board td.won::after { content: '★'; font-size: 10px; margin-left: 2px; vertical-align: 3px; }
.tp-board td.latest, .tp-board th.latest { background: var(--surface-2); }
.tp-board .tot { font-weight: 700; border-left: 1px solid var(--line); }
.tp-board tr.gone td { color: var(--sub); }
.tp-board-h { font-size: 15px; margin: 4px 0 8px; }

@media (max-width: 720px) {
  .tp-feature .daily-text { width: 100%; }
  .tp-table { width: min(100%, calc((100dvh - 300px) * 4.5 / var(--rows))); gap: 8px; }
  .tp-card { border-radius: 9px; }
  .tp-call-btn { min-width: 0; width: min(100%, 360px); padding: 14px; }
  .tp-scores { gap: 6px; }
  .tp-solo { gap: 14px; font-size: 14px; }
}
@media (hover: none) { .tp-call-btn kbd { display: none; } }

/* countdown: cards stay hidden until it ends */
.tp-table.waiting .tp-card { visibility: hidden; }
.tp-game .game-head { grid-template-columns: auto 1fr auto auto auto auto; }

/* results card: winner first, big and simple */
.tp-result { text-align: center; }
.tp-trophy { font-size: 52px; line-height: 1; margin: 4px 0 6px; }
.tp-result h2 { font-size: 30px; margin: 0; }
.tp-result.won h2 { color: var(--success); }
.tp-result-sub { margin: 4px 0 16px; color: var(--sub); }
.tp-podium { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 6px; text-align: left; }
.tp-podium li { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 14px; background: var(--surface-2); border-left: 5px solid var(--pc); }
.tp-podium li.top { background: color-mix(in srgb, var(--pc) 16%, var(--surface)); padding: 12px 14px; }
.tp-podium .pl { font: 700 15px var(--font-display); color: var(--sub); }
.tp-podium .nm { font-weight: 600; }
.tp-podium .nm em { font-style: normal; font-weight: 400; color: var(--sub); margin-left: 4px; }
.tp-podium .sc { font: 800 22px var(--font-display); color: var(--pc); }
.tp-podium li.top .sc { font-size: 30px; }
.tp-tally { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 10px 0 8px; font-size: 14px; color: var(--sub); }
.tp-tally b { color: var(--pc); }
.tp-rounds { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.tp-rounds li { display: grid; grid-template-columns: 74px 1fr; gap: 8px; padding: 6px 10px; border-radius: 10px; background: var(--surface-2); font-size: 14px; }
.tp-rounds .rn { color: var(--sub); }
.tp-rounds .rs { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.tp-rounds .w { font-weight: 700; }
.tp-after { display: flex; gap: 10px; justify-content: center; }
.tp-after button { min-width: 140px; padding: 12px 18px; font-size: 16px; }
