/* Hearts: a deep-red felt table, the card kit's cards, three friendly opponents. Phone first. */
.hz-page { --cb-felt-1: #a8334a; --cb-felt-2: #5a1222; --hz-cream: #fff4e6; --hz-cream-2: #f6d9cf; --hz-gold: #ffd166; --hz-ink: #2a1d17; }
.hz-page [hidden] { display: none !important; }
.hz-hero { margin-bottom: 10px; }
.hz { position: relative; min-width: 0; font-family: var(--cbx-body); }
.hz button { font-family: var(--cbx-body); -webkit-tap-highlight-color: transparent; }

/* ---- lobby ---- */
.hz-lobby { border-radius: 20px; padding: 18px 16px 16px; color: var(--hz-cream); box-shadow: inset 0 0 0 3px rgba(0,0,0,.18), inset 0 0 60px rgba(0,0,0,.25), 0 14px 30px rgba(90,18,34,.25); }
.hz-faces { display: flex; gap: 8px; font-size: 34px; line-height: 1; }
.hz-faces span { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,244,230,.16); box-shadow: inset 0 0 0 2px rgba(255,244,230,.35); }
.hz-lobby h2 { margin: 12px 0 2px; font: 900 28px/1.1 var(--cbx-display); color: #fff; }
.hz-lead { margin: 0 0 12px; font: 800 15px/1.4 var(--cbx-body); color: var(--hz-cream-2); }
.hz-label { margin: 12px 0 6px; font: 900 12px var(--cbx-body); letter-spacing: .12em; text-transform: uppercase; color: var(--hz-cream-2); }
.hz-seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.hz-seg.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.hz-seg button { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-height: 58px; padding: 8px 10px; text-align: left; border: 0; border-radius: 12px; cursor: pointer;
  background: rgba(255,244,230,.12); color: var(--hz-cream); box-shadow: inset 0 0 0 2px rgba(255,244,230,.25); }
.hz-seg button b { font: 900 16px var(--cbx-body); }
.hz-seg button small { font: 800 12px/1.25 var(--cbx-body); color: var(--hz-cream-2); }
.hz-seg button[aria-checked="true"] { background: var(--hz-cream); color: var(--hz-ink); box-shadow: 0 3px 0 rgba(0,0,0,.25); }
.hz-seg button[aria-checked="true"] small { color: #8a5a4e; }
.hz-lobby .cbx-btn { margin-top: 14px; }
.hz-lobby .cbx-btn + .cbx-btn { margin-top: 10px; }
.hz-lobby #newBtn:not(:first-of-type) { }
.hz-lobby .cbx-btn.alt { background: transparent; color: var(--hz-cream); box-shadow: inset 0 0 0 2px rgba(255,244,230,.5); }
.hz-stats { margin: 12px 0 0; text-align: center; font: 800 13px var(--cbx-body); color: var(--hz-cream-2); }
.hz-stats:empty { display: none; }

/* ---- top bar ---- */
.hz-bar { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.hz-info { flex: 1; min-width: 0; text-align: center; font: 900 13px var(--cbx-body); color: var(--cbx-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hz-chip { min-height: 38px; padding: 0 11px; border: 0; border-radius: 999px; background: var(--cbx-soft); color: var(--cbx-ink); font: 900 13px var(--cbx-body); cursor: pointer; white-space: nowrap; }
.hz-chip[aria-pressed="true"] { background: var(--cbx-accent); color: #fff; }

/* ---- the table ---- */
.hz-table { --cw: 48px; position: relative; display: grid; grid-template-columns: 66px minmax(0, 1fr) 66px; grid-template-areas: "top top top" "left trick right" "me me me" "hand hand hand";
  gap: 4px 4px; padding: 8px 8px 10px; border-radius: 20px; color: var(--hz-cream); overflow: hidden;
  box-shadow: inset 0 0 0 3px rgba(0,0,0,.18), inset 0 0 70px rgba(0,0,0,.3), 0 14px 30px rgba(90,18,34,.25); }
.hz-seat { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; text-align: center; }
.hz-seat.top { grid-area: top; flex-direction: row; justify-content: center; gap: 10px; }
.hz-seat.left { grid-area: left; align-self: center; }
.hz-seat.right { grid-area: right; align-self: center; }
.hz-face { position: relative; width: 44px; height: 44px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 26px; line-height: 1;
  background: rgba(255,244,230,.16); box-shadow: inset 0 0 0 2px rgba(255,244,230,.35); transition: box-shadow .2s; }
.hz-seat.now .hz-face { box-shadow: inset 0 0 0 2px var(--hz-gold), 0 0 0 3px rgba(255,209,102,.4), 0 0 16px rgba(255,209,102,.6); }
.hz-who { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; }
.hz-seat.top .hz-who { align-items: flex-start; }
.hz-name { font: 900 13px/1.1 var(--cbx-body); color: #fff; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hz-chips { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; }
.hz-score { padding: 1px 7px; border-radius: 999px; background: var(--hz-cream); color: var(--hz-ink); font: 900 12px/1.5 var(--cbx-body); font-variant-numeric: tabular-nums; }
.hz-pts { padding: 1px 6px; border-radius: 999px; background: rgba(0,0,0,.25); color: #ffd0d6; font: 900 12px/1.5 var(--cbx-body); font-variant-numeric: tabular-nums; }
.hz-pts.zero { color: rgba(255,244,230,.55); }
.hz-pts.queen { background: #1f2433; color: #fff; }
.hz-fan { --cw: 14px; display: flex; height: calc(var(--cw) * 1.4); margin-top: 2px; }
.hz-fan .cb-card { box-shadow: inset 0 0 0 1.5px #fff, 0 1px 2px rgba(0,0,0,.3); border-radius: 2px; }
.hz-fan .cb-card + .cb-card { margin-left: calc(var(--cw) * -.68); }
.hz-seat.top .hz-fan { --cw: 16px; }
.hz-passed { font: 800 11px var(--cbx-body); color: var(--hz-gold); }

/* the trick in the middle */
.hz-trick { grid-area: trick; position: relative; height: calc(var(--cw) * 1.4 * 2 + 34px); min-height: 150px; }
.hz-trick .cb-card { position: absolute; cursor: default; }
.hz-trick .t0 { left: 50%; bottom: 0; transform: translateX(-50%); }
.hz-trick .t2 { left: 50%; top: 0; transform: translateX(-50%); }
.hz-trick .t1 { left: 4%; top: 50%; transform: translateY(-50%) rotate(-6deg); }
.hz-trick .t3 { right: 4%; top: 50%; transform: translateY(-50%) rotate(6deg); }
.hz-trick .cb-card.in { animation: hz-in var(--hz-in, .28s) cubic-bezier(.2,.8,.3,1) both; }
.hz-trick .t0.in { --fx: 0px; --fy: 160px; } .hz-trick .t2.in { --fx: 0px; --fy: -140px; }
.hz-trick .t1.in { --fx: -140px; --fy: 0px; } .hz-trick .t3.in { --fx: 140px; --fy: 0px; }
@keyframes hz-in { from { translate: var(--fx) var(--fy); opacity: .2; } to { translate: 0 0; opacity: 1; } }
.hz-trick.sweep .cb-card { transition: translate var(--hz-sweep, .4s) ease-in, opacity var(--hz-sweep, .4s) ease-in; translate: var(--sx) var(--sy); opacity: 0; }
.hz-trick .win { box-shadow: 0 0 0 3px var(--hz-gold), 0 6px 14px rgba(0,0,0,.35); }
.hz-mid { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; pointer-events: none; font: 900 13px/1.35 var(--cbx-body); color: var(--hz-cream-2); width: 70%; }
.hz-mid b { display: block; font: 900 17px/1.2 var(--cbx-display); color: #fff; }
.hz-broken { position: absolute; right: 0; bottom: 0; font: 900 11px var(--cbx-body); color: #ffb3bf; opacity: .85; }

/* you */
.hz-me { grid-area: me; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 26px; }
.hz-me .hz-name { font-size: 14px; }
.hz-me.now .hz-name { color: var(--hz-gold); }

/* your hand: one overlapped row, or two on narrow screens (sizes set from hearts.js) */
.hz-hand { grid-area: hand; --hw: 60px; --ov: -.5; display: flex; flex-direction: column; align-items: center; padding-top: 10px; min-height: calc(var(--hw) * 1.4 + 10px); }
.hz-row { display: flex; justify-content: center; }
.hz-row + .hz-row { margin-top: calc(var(--hw) * -.72); }
.hz-hand .cb-card { --w: var(--hw); }
.hz-hand .cb-card + .cb-card { margin-left: calc(var(--hw) * var(--ov)); }
.hz-hand .cb-card.ok { transform: translateY(-9%); box-shadow: 0 0 0 2px var(--hz-gold), 0 5px 10px rgba(0,0,0,.3); }
.hz-hand .cb-card.sel { transform: translateY(-16%); }
.hz-hand .cb-card.dim { filter: brightness(.68) saturate(.6); }
.hz-hand .cb-card.got { box-shadow: 0 0 0 3px #7fd1ff, 0 4px 10px rgba(0,0,0,.3); }
.hz-hand .cb-card.got.sel, .hz-hand .cb-card.got.ok { box-shadow: 0 0 0 3px #7fd1ff, 0 6px 14px rgba(0,0,0,.3); }
.hz-hand .cb-card.shake { animation: hz-shake .35s; }
@keyframes hz-shake { 25% { translate: -4px 0; } 75% { translate: 4px 0; } }
.hz-hand.locked .cb-card { cursor: default; }

/* status and buttons under the table */
.hz-status, .cbx-card .hz-status { margin: 10px 0 0; min-height: 44px; text-align: center; font: 900 16px/1.35 var(--cbx-body); color: var(--cbx-ink); }
.hz-status small { display: block; font: 800 13px var(--cbx-body); color: var(--cbx-muted); }
.hz-status.oops { color: var(--cbx-bad); }
.hz-actions { margin-top: 6px; display: grid; gap: 8px; }
.hz-actions:not(:has(> :not([hidden]))) { display: none; }

/* ---- dialog (scores, end of hand, game over) ---- */
.hz-dlg { border: 0; padding: 0; border-radius: 22px; width: min(440px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); box-shadow: 0 30px 80px rgba(0,0,0,.35); color: var(--cbx-ink, #2a1d17); background: #fffaf3; }
.hz-dlg::backdrop { background: rgba(58, 12, 22, .5); }
.hz-dlg [hidden] { display: none !important; }
.hz-dlg-card { padding: 16px 16px 18px; font-family: 'Nunito', system-ui, sans-serif; }
.hz-dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.hz-dlg h2 { margin: 0; font: 900 24px/1.1 'Fraunces', Georgia, serif; }
.hz-x { width: 44px; height: 44px; flex: none; border: 0; border-radius: 50%; background: #f3e8da; color: #2a1d17; font: 400 28px/1 Georgia, serif; cursor: pointer; }
.hz-dlg p { margin: 0 0 10px; font: 800 15px/1.45 'Nunito', sans-serif; color: #7d685c; }
.hz-moon { margin: 0 0 10px; padding: 10px 12px; border-radius: 12px; background: #1f2433; color: #fff; font: 900 15px/1.4 'Nunito', sans-serif; }
.hz-sheet { width: 100%; border-collapse: collapse; margin: 4px 0 12px; font: 800 14px 'Nunito', sans-serif; font-variant-numeric: tabular-nums; }
.hz-sheet th { padding: 6px 2px; font: 900 13px 'Nunito', sans-serif; color: #2a1d17; text-align: center; }
.hz-sheet th span { display: block; font-size: 20px; line-height: 1.1; }
.hz-sheet td { padding: 5px 2px; text-align: center; border-top: 1px solid #eadccb; color: #4a3a30; }
.hz-sheet td:first-child, .hz-sheet th:first-child { text-align: left; color: #7d685c; font-size: 12px; white-space: nowrap; }
.hz-sheet tr.now td { background: #fff1e8; color: #2a1d17; }
.hz-sheet tr.total td { border-top: 2px solid #2a1d17; font: 900 17px 'Nunito', sans-serif; color: #2a1d17; }
.hz-sheet td.lead { color: #1f9d57; }
.hz-sheet td.moon::after { content: ' 🌙'; }
.hz-sheet-wrap { max-height: 46dvh; overflow-y: auto; }
.hz-over { text-align: center; }
.hz-over .crest { font-size: 48px; line-height: 1; margin-top: 2px; }
.hz-over h3 { margin: 6px 0 4px; font: 900 28px/1.1 'Fraunces', Georgia, serif; color: #2a1d17; }
.hz-rank { list-style: none; margin: 8px 0 14px; padding: 0; display: grid; gap: 6px; text-align: left; }
.hz-rank li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: #f3e8da; font: 900 15px 'Nunito', sans-serif; color: #2a1d17; }
.hz-rank li.me { background: #fff1e8; box-shadow: inset 0 0 0 2px #b3263c; }
.hz-rank li b { flex: 1; }
.hz-rank li span.f { font-size: 22px; }
.hz-dlg .cbx-btn + .cbx-btn { margin-top: 8px; }

@media (min-width: 560px) {
  .hz-table { --cw: 58px; grid-template-columns: 92px minmax(0, 1fr) 92px; padding: 12px 12px 14px; }
  .hz-face { width: 52px; height: 52px; font-size: 30px; }
  .hz-name { font-size: 14px; }
  .hz-fan { --cw: 16px; }
  .hz-seat.top .hz-fan { --cw: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .hz-trick .cb-card.in, .hz-hand .cb-card.shake { animation: none; }
  .hz-trick.sweep .cb-card { transition: opacity .2s; translate: 0 0; }
}
