/* Hearts on the PocketPlay table template. Kit tokens (pp.css) and seats/sheets (table.css) come first;
   this file only lays out the felt, the trick and the hand, and draws the cards. */
.hx-main { width: min(100%, 1000px); margin: 0 auto; padding: 22px 20px 0; }
.hx-stage { display: grid; gap: 18px; }
.hx-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.hx-head h1 { margin: 0; font-size: clamp(26px, 4vw, 32px); font-weight: 700; letter-spacing: -.03em; color: var(--ink); }
.hx-lede { margin: 4px 0 0; color: var(--ink-2); font-size: 14.5px; }
body[data-entry="play"] .hx-lede { display: none; }
.hx-noscript { color: var(--ink-2); }

/* ── Felt ── */
.hx-game { --cw: clamp(42px, calc((100vw - 40px) / 8.1), 74px); --ch: calc(var(--cw) * 1.4); display: grid; gap: 10px; }
.hx-game[hidden] { display: none; }
.hx-felt {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); grid-template-rows: auto 1fr auto;
  grid-template-areas: ". top ." "left trick right" ". you ."; align-items: center; justify-items: center; gap: 10px 12px;
  padding: 14px; border-radius: var(--r-xl); color: #eef4ec;
  background: radial-gradient(120% 95% at 50% 38%, color-mix(in srgb, var(--accent) 92%, #fff 8%), color-mix(in srgb, var(--accent) 72%, #04150c));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .16), inset 0 2px 16px rgba(0, 0, 0, .22), var(--shadow-2);
}
.hx-seat { min-width: 0; max-width: 100%; }
.hx-seat--top { grid-area: top; }
.hx-seat--left { grid-area: left; justify-self: start; }
.hx-seat--right { grid-area: right; justify-self: end; }
.hx-seat--you { grid-area: you; }
.hx-seat .ppt-plate { border-color: transparent; }
.hx-seat .ppt-plate.is-away { opacity: .7; }
.hx-seat .ppt-plate__end { color: var(--accent-text); }
.hx-seat .ppt-plate.is-active { box-shadow: 0 0 0 3px #fff, 0 0 0 6px rgba(255, 255, 255, .28), var(--shadow-2); }

.hx-trick { grid-area: trick; position: relative; width: calc(var(--cw) * 3 + 28px); height: calc(var(--ch) * 2.25); }
.hx-slot { position: absolute; width: var(--cw); height: var(--ch); border-radius: calc(var(--cw) * .11); }
.hx-slot:empty { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); }
.hx-slot--top { top: 0; left: 50%; transform: translateX(-50%); }
.hx-slot--you { bottom: 0; left: 50%; transform: translateX(-50%); }
.hx-slot--left { top: 50%; left: 0; transform: translateY(-50%); }
.hx-slot--right { top: 50%; right: 0; transform: translateY(-50%); }
.hx-slot .card { cursor: default; animation: hx-in .22s var(--ease) both; }
.hx-slot.is-win .card { box-shadow: 0 0 0 3px #f2d27b, 0 8px 18px rgba(0, 0, 0, .3); }
.hx-center { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 6px; pointer-events: none; font-size: 13px; font-weight: 600; text-align: center; }
.hx-center.is-pass { color: #f3f7f0; }
.hx-arrow { width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 255, 255, .16); position: relative; }
.hx-arrow::before { content: ""; position: absolute; inset: 0; margin: auto; width: 10px; height: 10px; border: solid #fff; border-width: 2px 2px 0 0; transform: translateX(-2px) rotate(45deg); }
.hx-arrow--left::before { transform: translateX(2px) rotate(-135deg); }
.hx-arrow--top::before { transform: translateY(2px) rotate(-45deg); }
.hx-trick.is-score .hx-slot { visibility: hidden; }
.hx-center.is-score { inset: 0 -12%; z-index: 3; padding: 14px 18px; border-radius: var(--r-l, 14px); background: var(--surface); border: 1px solid var(--line); color: var(--ink); box-shadow: var(--shadow-3); pointer-events: auto; animation: hx-in .2s var(--ease) both; }
.hx-center.is-score b { font-size: 14px; }
.hx-center ol { display: grid; gap: 4px; min-width: 180px; margin: 0; padding: 0; list-style: none; font-weight: 500; }
.hx-center li { display: grid; grid-template-columns: 1fr 3em 3em; gap: 10px; align-items: baseline; text-align: left; }
.hx-center li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hx-center .hx-score-head em, .hx-center .hx-score-head strong { color: var(--ink-3); font: 500 11.5px/1.4 var(--font-sans); }
.hx-center li em { text-align: right; color: var(--accent-text); font-style: normal; font-family: var(--font-mono); font-size: 12px; }
.hx-center li strong { text-align: right; font-family: var(--font-mono); }

/* ── Status line and hand ── */
.hx-bar { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px 14px; min-height: 44px; text-align: center; }
.hx-status { margin: 0; color: var(--ink); font-size: 15px; font-weight: 600; }
.hx-action { min-width: 136px; }
.hx-hand { display: flex; justify-content: center; align-items: flex-end; min-height: calc(var(--ch) + 22px); padding: 18px 0 4px; }
.hx-hand .card + .card { margin-left: calc(var(--cw) * -.42); }
.hx-hand .card:hover, .hx-hand .card:focus-visible { z-index: 2; }
.hx-hand.is-turn .card.is-live { transform: translateY(-6px); }
.hx-hand.is-turn .card.is-dim { filter: grayscale(.75) brightness(.8); cursor: not-allowed; }
@media (hover: hover) {
  .hx-hand.is-turn .card.is-live:hover { transform: translateY(-14px); }
  .hx-hand.is-choosing .card:not(.is-selected):hover { transform: translateY(-6px); }
}
.hx-hand.is-choosing .card.is-selected { transform: translateY(-18px); box-shadow: 0 0 0 2px var(--accent), 0 10px 18px rgba(23, 21, 15, .22); }
.hx-hand .card.is-fresh::after { content: ""; position: absolute; top: -4px; right: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--surface); }
.hx-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--ink-3); font-size: 12.5px; }

/* ── Cards ── */
.hx-game .card {
  position: relative; flex: none; width: var(--cw); height: var(--ch); padding: 0; border-radius: calc(var(--cw) * .11);
  border: 1px solid #e2dccb; background: linear-gradient(180deg, #fffefa, #f8f4ea); color: #25302a; cursor: pointer; user-select: none;
  box-shadow: 0 1px 1px rgba(23, 21, 15, .14), 0 5px 12px rgba(23, 21, 15, .16); font-family: Georgia, "Songti SC", serif;
  transition: transform .14s var(--ease), box-shadow .14s, filter .14s, opacity .14s;
}
.hx-game .card.red { color: #b9423a; }
.hx-game .corner { position: absolute; top: 5%; left: 8%; display: flex; flex-direction: column; align-items: center; line-height: 1; font-size: calc(var(--cw) * .24); font-weight: 700; }
.hx-game .corner i { font-size: calc(var(--cw) * .2); }
.hx-game .corner.br { top: auto; left: auto; right: 8%; bottom: 5%; transform: rotate(180deg); }
.hx-game .corner i, .hx-game .pip, .hx-game .face i { font-style: normal; }
.hx-game .pips { position: absolute; inset: 22% 20%; }
.hx-game .pip { position: absolute; font-size: calc(var(--cw) * .2); line-height: 1; }
.hx-game .pip.n { top: 0; left: 50%; transform: translateX(-50%); }
.hx-game .pip.s { bottom: 0; left: 50%; transform: translateX(-50%) rotate(180deg); }
.hx-game .pip.w { top: 50%; left: 0; transform: translateY(-50%); }
.hx-game .pip.e { top: 50%; right: 0; transform: translateY(-50%); }
.hx-game .pip.c { top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: calc(var(--cw) * .32); }
.hx-game .pip.nw { top: 0; left: 0; } .hx-game .pip.ne { top: 0; right: 0; }
.hx-game .pip.sw { bottom: 0; left: 0; transform: rotate(180deg); } .hx-game .pip.se { bottom: 0; right: 0; transform: rotate(180deg); }
.hx-game .pip.cn { top: 20%; left: 50%; transform: translateX(-50%); } .hx-game .pip.cs { bottom: 20%; left: 50%; transform: translateX(-50%) rotate(180deg); }
.hx-game .pip.cw { top: 32%; left: 0; } .hx-game .pip.ce { top: 32%; right: 0; }
.hx-game .face { position: absolute; inset: 24% 18%; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 40% 40% 6px 6px; background: rgba(214, 196, 150, .16); font-size: calc(var(--cw) * .3); }
.hx-game .face b { font-family: Palatino, "Songti SC", serif; }
.hx-game .face i { display: none; }
.hx-game .card .mid { display: none; }
.hx-game .card:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ── Rules (page section and dialog) ── */
.hx-about { margin: 56px 0 0; padding: 24px 0 0; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 14.5px; line-height: 1.7; }
.hx-about h2 { margin: 0 0 8px; color: var(--ink); font-size: 18px; letter-spacing: -.02em; }
.hx-about h3, .hx-rules h3 { margin: 18px 0 6px; color: var(--ink); font-size: 14.5px; }
.hx-goal { margin: 0 0 8px; color: var(--ink); font-weight: 600; }
.hx-steps, .hx-rules-list { margin: 0; padding-left: 1.4em; list-style: decimal; }
.hx-rules-list { list-style: disc; }
.hx-tip { margin: 10px 0 0; color: var(--ink-3); }
.hx-rules { color: var(--ink-2); font-size: 14.5px; line-height: 1.7; }

/* ── Result sheet ── */
.hx-result { display: grid; gap: 18px; }
.hx-standings { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.hx-standings li { display: grid; grid-template-columns: 1.4em auto 1fr auto; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--r-m); background: var(--bg-2); }
.hx-standings li.is-win { background: var(--accent-tint); box-shadow: inset 0 0 0 1px var(--accent-line); }
.hx-standings .ppt-face { --size: 32px; }
.hx-rank { color: var(--ink-3); font: 600 13px/1 var(--font-mono); }
.hx-who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-weight: 600; }
.hx-standings strong { font: 700 15px/1 var(--font-mono); color: var(--ink); }
.hx-actions { display: grid; gap: 10px; }
.hx-wait { margin: 0; color: var(--ink-3); text-align: center; font-size: 14px; }

@keyframes hx-in { from { opacity: 0; transform: translateY(6px) scale(.97); } }

@media (max-width: 640px) {
  .hx-main { padding: 16px 14px 0; }
  .hx-felt { padding: 10px 8px; gap: 8px 6px; }
  .hx-seat--left .ppt-plate, .hx-seat--right .ppt-plate { flex-direction: column; gap: 4px; padding: 6px 6px 7px; border-radius: var(--r-m); text-align: center; }
  .hx-seat--left .ppt-plate__text, .hx-seat--right .ppt-plate__text { justify-items: center; }
  .hx-seat--left .ppt-plate__text b, .hx-seat--right .ppt-plate__text b { max-width: 72px; font-size: 12px; }
  .hx-seat--left .ppt-plate__text b .ppt-tag, .hx-seat--right .ppt-plate__text b .ppt-tag { display: table; margin: 2px auto 0; }
  .hx-seat--left .ppt-plate__end, .hx-seat--right .ppt-plate__end { margin: 0; }
  .hx-game .pips, .hx-game .face { display: none; }
  .hx-game .card .mid { display: grid; position: absolute; inset: 0; place-items: center; font-size: calc(var(--cw) * .5); padding-top: 8%; }
  .hx-status { font-size: 14px; }
  .hx-center.is-score { inset: -6% -24%; padding: 10px 12px; }
  .hx-center ol { min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .hx-game .card, .hx-slot .card, .hx-center.is-score { transition: none; animation: none; }
}
