/* ===== Hearts — game-specific styles =====
   Generic glass chrome comes from shared/css/glass.css (cards reuse .c-card
   wholesale). This file lays out the four-seat trick-taking table: three
   opponents along the top, the live trick in a diamond well in the middle
   (one slot per seat), and your 13-card overlapping hand at the bottom. */

:root {
  /* Hearts sits on the classic green felt like Big 2, but the primary action
     and the deck back wear a heart crimson so the game has its own identity. */
  --accent-1: #c8322f;
  --accent-2: #e8564f;
  --on-accent: #ffffff;
  --back-1: #b83232;
  --back-2: #6a1414;
  /* glass.css paints .c-app from these — same greens as the card table */
  --bg-1: #12764c;
  --bg-2: #083f29;
  --bg-glow-a: rgba(18, 118, 76, .55);
  --bg-glow-b: rgba(63, 191, 122, .22);
  /* green-tinted text tones instead of the indigo defaults */
  --c-text: #eaf3ee;
  --c-muted: #b7d3c2;
}

.c-app { --fpad: clamp(12px, 4vw, 36px); }
/* overscroll / letterbox behind the felt */
body { background: #083f29; }

.c-btn--primary { text-shadow: 0 1px 2px rgba(0, 0, 0, .35); }

/* glass.css hardcodes the frosted modal panel to an indigo tint; recolor it
   (and the backdrop) to dark felt-green so the Rules / hand-over modals match
   this table. Scoped here so no other game is affected. The panel never gets
   its own max-height/overflow — the full-screen overlay scrolls instead, so no
   scrollbar ever sits inside the card (see AGENTS.md modal policy). */
.c-modal__backdrop { background: rgba(3, 22, 14, .5); }
.c-modal__panel { background: rgba(9, 44, 29, .72); }

/* ---------- Table stack ---------- */
.hs-board {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(6px, 1.4vh, 14px);
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  flex: 1;
  min-height: 0;
}

/* ---------- Opponent seats ---------- */
.hs-opps { display: flex; justify-content: space-between; gap: 12px; width: 100%; }
.hs-seat { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; }
.hs-seat__label {
  font-size: 13px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--c-muted);
  display: flex; align-items: center; gap: 7px;
}
/* card-count and running-total pills */
.hs-count, .hs-total {
  min-width: 24px; padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--glass-line);
  background: var(--glass);
  color: #fff; font-size: 12px; font-weight: 800;
  text-align: center; letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}
.hs-total { border-color: rgba(255, 224, 107, .45); background: rgba(255, 224, 107, .12); color: #ffe387; }
.hs-flag { font-size: 11px; font-style: italic; letter-spacing: 0; text-transform: none; color: #ffd97a; min-height: 13px; }
.hs-flag:empty { display: none; }
/* gold ring marks whose turn it is */
.hs-seat--turn > .hs-seat__label { color: var(--accent-2); }
.hs-seat--turn .hs-backs { box-shadow: 0 0 0 2px rgba(232, 86, 79, .6), 0 0 16px rgba(232, 86, 79, .25); border-radius: 12px; }

/* Three overlapping card backs per opponent (fewer as cards run out).
   Card widths scale with the viewport but are vh-capped so a short window
   never overflows. */
.hs-backs {
  --cw: clamp(30px, min(5.6vw, 8vh), 48px);
  --ch: calc(var(--cw) * 1.42);
  position: relative;
  height: var(--ch);
  width: calc(var(--cw) * (1 + 2 * 0.4));
  transition: box-shadow .2s ease;
}
.hs-backs .c-card { transform: rotate(var(--r, 0deg)); }

/* ---------- Trick well (diamond of four seat slots) ---------- */
.hs-trick {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: 100%; flex: 1; min-height: 0; justify-content: center;
}
.hs-well { position: relative; transition: box-shadow .2s ease; }
.hs-well {
  --cw: clamp(42px, min(7.6vw, 12vh), 80px);
  --ch: calc(var(--cw) * 1.42);
  width: calc(var(--cw) * 3.1);
  height: calc(var(--ch) * 2.25);
}
/* an empty felt slot; the played card covers it exactly */
.hs-slot {
  position: absolute; width: var(--cw); height: var(--ch);
  border-radius: calc(var(--cw) * .09);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .05);
}
.hs-slot[data-seat="2"] { top: 0; left: 50%; transform: translateX(-50%); }
.hs-slot[data-seat="0"] { bottom: 0; left: 50%; transform: translateX(-50%); }
.hs-slot[data-seat="1"] { left: 0; top: 50%; transform: translateY(-50%); }
.hs-slot[data-seat="3"] { right: 0; top: 50%; transform: translateY(-50%); }
.hs-slot__tag {
  position: absolute; top: -15px; left: 50%; transform: translateX(-50%);
  font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--c-muted);
  white-space: nowrap;
}
.hs-slot .c-card { position: absolute; inset: 0; left: 0; }
/* the card that opened the trick owns the suit; discards of another suit
   cannot win, so they are read as side-of-table throws */
.hs-slot .c-card.hs-led { box-shadow: 0 0 0 2px rgba(255, 255, 255, .5), 0 3px 8px rgba(0, 0, 0, .3); }
.hs-slot .c-card.hs-off { opacity: .72; filter: saturate(.72); }
.hs-slot .c-card.hs-win { box-shadow: 0 0 0 2.5px var(--gold), 0 4px 12px rgba(0, 0, 0, .4); }
/* only the card that has just landed pops in; the ones already on the table are
   redrawn in place. Every card sits dead centre in its slot so the felt
   placeholder and the led/win rings stay concentric */
.hs-slot .c-card.hs-new { animation: hsDrop .2s ease; }
@keyframes hsDrop {
  from { transform: translateY(-18px) scale(.86); opacity: 0; }
}
.hs-trick__caption { font-size: 13px; color: var(--c-muted); min-height: 17px; text-align: center; }

/* ---------- Center status ---------- */
.hs-mid { min-height: 32px; display: flex; align-items: center; }
.hs-status {
  padding: 7px 22px;
  border-radius: 999px;
  border: 1px solid var(--glass-line);
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 14px; font-weight: 700; letter-spacing: .01em;
  color: var(--c-text);
  text-align: center;
  transition: color .2s ease, border-color .2s ease;
}
.hs-status--win  { color: #7ef0a4; border-color: rgba(126, 240, 164, .5); }
.hs-status--lose { color: #ff8b94; border-color: rgba(255, 139, 148, .5); }
/* the table is holding a scored trick: invite the tap that starts the next one */
.hs-status--wait {
  color: #ffe9a8; border-color: rgba(255, 232, 150, .45);
  cursor: pointer;
  animation: hsWait 1.6s ease-in-out infinite;
}
@keyframes hsWait { 50% { opacity: .5; } }

/* ---------- Your hand ---------- */
.hs-side { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; }
.hs-well--hand {
  --cw: clamp(34px, min(5.6vw, 9.5vh), 64px);
  --ch: calc(var(--cw) * 1.42);
  width: 100%;
  min-width: var(--cw);
  height: var(--ch);
}
.hs-well--hand .c-card {
  box-shadow: 0 3px 8px rgba(0, 0, 0, .35), inset 0 0 0 1px var(--card-edge);
  cursor: pointer;
  transition: transform .12s ease;
}
/* cards that cannot be played right now sit dimmed */
.hs-well--hand .c-card.hs-dead { opacity: .42; cursor: default; filter: saturate(.5); }
/* lifted cards (during the pass) ride above the row */
.hs-well--hand .c-card.hs-sel { transform: translateY(-14px); }
.hs-well--hand .c-card.hs-sel::after {
  content: ""; position: absolute; inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 2.5px var(--accent-1);
}

/* ---------- Action row ---------- */
.hs-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; padding-bottom: 8px; }
.hs-actions .c-btn { min-width: 120px; text-align: center; font-size: 14px; padding: 9px 16px; }
.hs-actions .c-btn[hidden] { display: none; }

/* ---------- Result list in the hand-over modal ---------- */
.hs-results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.hs-results li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 7px 12px; border-radius: 10px;
  border: 1px solid var(--glass-line); background: var(--glass);
  font-size: 14px; font-weight: 600;
}
.hs-results .hs-moon { color: #7ef0a4; }
.hs-results .hs-pts { color: #ff8b94; font-variant-numeric: tabular-nums; }
.hs-results .hs-tot { color: #ffe387; font-variant-numeric: tabular-nums; margin-left: 8px; }

@media (max-width: 430px) {
  .hs-seat__label { font-size: 11px; gap: 4px; }
  .hs-slot__tag { font-size: 9.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .hs-slot .c-card.hs-new { animation: none; }
  .hs-status--wait { animation: none; }
  .hs-well--hand .c-card, .hs-well--hand .c-card.hs-sel { transition: none; }
}
