/* ===== Hokm + Mench (cards.js) ===== */
.g-hokm, .g-mench { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.g-hokm .banner, .g-mench .banner { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; }
.g-hokm .banner.g-hokm-my, .g-mench .banner.g-mench-my { color: var(--accent); box-shadow: var(--glow); }
.g-hokm-timer, .g-mench-timer { font-variant-numeric: tabular-nums; font-weight: 800; min-width: 34px; text-align: center; padding: 0 10px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); color: var(--ink); }
.g-hokm-timer:empty, .g-mench-timer:empty { display: none; }
.g-hokm-timer.low, .g-mench-timer.low { color: var(--bad); border-color: var(--bad); }

/* ---- score strip */
.g-hokm-score { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: stretch; }
.g-hokm-team { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; padding: 6px 8px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); border-top: 3px solid #3b82f6; line-height: 1.4; min-width: 0; }
.g-hokm-team.t1 { border-top-color: #f59e0b; }
.g-hokm-team.mine { box-shadow: var(--glow); }
.g-hokm-team .lbl { font-size: 12px; color: var(--sub); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-hokm-team b { font-size: 17px; font-variant-numeric: tabular-nums; }
.g-hokm-team small { font-size: 11px; color: var(--sub); }
.g-hokm-trump { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 64px; padding: 4px 8px; border-radius: 14px; background: #fffdf6; border: 2px solid #d9b45a; line-height: 1.2; }
.g-hokm-trump small { font-size: 11px; color: #5b5646; }
.g-hokm-trump b { font-size: 28px; line-height: 1.1; }
.g-hokm-trump.red b { color: #c81e1e; }
.g-hokm-trump.blk b { color: #111827; }

/* ---- playing card (ivory face, independent of theme) */
.g-hokm-card { width: 46px; height: 64px; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; border-radius: 8px; background: #fffdf6; border: 1px solid #cfc7ae; box-shadow: 0 2px 5px rgba(0, 0, 0, .35); font-family: system-ui, 'Segoe UI', sans-serif; direction: ltr; line-height: 1; user-select: none; }
.g-hokm-card b { font-size: 22px; font-weight: 800; }
.g-hokm-card i { font-style: normal; font-size: 26px; }
.g-hokm-card.red { color: #c81e1e; }
.g-hokm-card.blk { color: #111827; }
.g-hokm-card.win { box-shadow: 0 0 0 3px var(--good), 0 0 16px var(--good); transform: scale(1.08); }

/* ---- table */
.g-hokm-table { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) minmax(0, 1fr); grid-template-rows: auto minmax(150px, auto) auto; grid-template-areas: 't t t' 'l c r' 'b b b'; gap: 8px; padding: 10px; direction: ltr; }
.g-hokm-seat { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 4px 6px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); border-bottom: 3px solid #3b82f6; direction: rtl; min-width: 0; line-height: 1.3; font-size: 12px; }
.g-hokm-seat.tb { border-bottom-color: #f59e0b; }
.g-hokm-seat .nm { font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-hokm-seat .tags { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.g-hokm-seat em { font-style: normal; font-size: 11px; color: var(--sub); }
.g-hokm-seat em.hk { color: #1f1500; background: var(--warn); border-radius: 8px; padding: 0 7px; font-weight: 800; }
.g-hokm-seat.turn { border-color: var(--accent); box-shadow: var(--glow); }
.g-hokm-seat.turn .nm { color: var(--accent); }
.g-hokm-seat.st { grid-area: t; justify-self: center; min-width: 40%; }
.g-hokm-seat.sb { grid-area: b; justify-self: center; min-width: 40%; }
.g-hokm-seat.sl { grid-area: l; align-self: center; }
.g-hokm-seat.sr { grid-area: r; align-self: center; }
.g-hokm-center { grid-area: c; position: relative; min-height: 150px; border-radius: 50% / 40%; background: radial-gradient(closest-side, var(--panel-2), transparent); }
.g-hokm-slot { position: absolute; transition: transform .2s; }
.g-hokm-slot .g-hokm-card { width: 42px; height: 58px; }
.g-hokm-slot .g-hokm-card b { font-size: 19px; }
.g-hokm-slot .g-hokm-card i { font-size: 22px; }
.g-hokm-slot.t { top: 0; left: 50%; margin-left: -21px; }
.g-hokm-slot.b { bottom: 0; left: 50%; margin-left: -21px; }
.g-hokm-slot.l { left: 0; top: 50%; margin-top: -29px; }
.g-hokm-slot.r { right: 0; top: 50%; margin-top: -29px; }
.g-hokm-slot.t .g-hokm-card { transform: rotate(-3deg); }
.g-hokm-slot.l .g-hokm-card { transform: rotate(-8deg); }
.g-hokm-slot.r .g-hokm-card { transform: rotate(8deg); }
.g-hokm-slot.b .g-hokm-card { transform: rotate(3deg); }
.g-hokm-slot .g-hokm-card.win { transform: scale(1.1); }

/* ---- message + trump chooser */
.g-hokm-msg { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 10px; }
.g-hokm-msg[hidden] { display: none; }
.g-hokm-suits { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; width: 100%; }
.g-hokm-suit.btn { flex-direction: column; gap: 0; min-height: 64px; padding: 4px; background: #fffdf6; border: 2px solid #d9b45a; line-height: 1.2; }
.g-hokm-suit b { font-size: 28px; }
.g-hokm-suit span { font-size: 12px; font-weight: 700; color: #3b3626; }
.g-hokm-suit.red b { color: #c81e1e; }
.g-hokm-suit.blk b { color: #111827; }
.g-hokm-suit.btn:active { transform: scale(.94); }

/* ---- hand: overlapped, wraps into rows so every card stays visible and >= 42px wide */
.g-hokm-hand { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 0; padding: 14px 22px 4px 2px; min-height: 80px; }
.g-hokm-hc { position: relative; flex: none; width: 64px; height: 90px; margin: 0 -22px 0 0; padding: 0; border: 0; background: transparent; border-radius: 9px; transition: transform .12s, filter .12s; }
.g-hokm-hc .g-hokm-card { width: 64px; height: 90px; align-items: flex-start; justify-content: flex-start; padding: 6px 0 0 6px; gap: 2px; border-radius: 9px; }
.g-hokm-hc .g-hokm-card b { font-size: 22px; }
.g-hokm-hc .g-hokm-card i { font-size: 24px; }
.g-hokm-hc.ok { transform: translateY(-10px); }
.g-hokm-hc.ok .g-hokm-card { box-shadow: 0 0 0 2px var(--good), 0 0 12px var(--good); }
.g-hokm-hc.dim { filter: brightness(.55) saturate(.6); cursor: default; }
.g-hokm-hc:focus-visible .g-hokm-card { outline: 2px solid var(--accent); }
.g-hokm-hc.ok:active { transform: translateY(-16px) scale(1.04); z-index: 2; }

/* ===== Mench ===== */
.g-mench-players { display: flex; flex-wrap: wrap; gap: 6px; }
.g-mench-pl { flex: 1 1 calc(50% - 6px); min-width: 0; display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); font-size: 13px; }
.g-mench-pl .dot { width: 14px; height: 14px; border-radius: 50%; flex: none; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.g-mench-pl .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.g-mench-pl small { color: var(--sub); font-variant-numeric: tabular-nums; }
.g-mench-pl.turn { border-color: var(--accent); box-shadow: var(--glow); }
.g-mench-pl.turn .nm { color: var(--accent); }
.g-mench-board { padding: 8px; overflow: hidden; }
.g-mench-board svg { width: 100%; height: auto; max-width: 100%; }
.g-mench-board svg text { font-family: inherit; }
.g-mench-board svg circle { transform-box: fill-box; transform-origin: center; }
@keyframes g-mench-pulse { 0%, 100% { transform: scale(.85); opacity: .55; } 50% { transform: scale(1.25); opacity: 1; } }

.g-mench-ctl { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); min-height: 76px; }
.g-mench-dice { width: 60px; height: 60px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 50px; line-height: 1; border-radius: 14px; background: #fffdf6; color: #111827; border: 1px solid #cfc7ae; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); font-family: system-ui, 'Segoe UI Symbol', sans-serif; }
.g-mench-dice.pop { animation: g-mench-dice-pop .45s ease-out; }
@keyframes g-mench-dice-pop { 0% { transform: rotate(-200deg) scale(.4); } 70% { transform: rotate(12deg) scale(1.15); } 100% { transform: rotate(0) scale(1); } }
.g-mench-info { display: flex; flex-direction: column; gap: 0; line-height: 1.5; min-width: 0; }
.g-mench-info small { color: var(--sub); font-size: 12px; }
.g-mench-info small.cap { color: var(--bad); font-weight: 700; }
.g-mench-roll.btn { min-width: 112px; min-height: 48px; flex: none; box-shadow: var(--glow); }

.g-mench-tk { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.g-mench-tk:empty { display: none; }
.g-mench-tb { min-height: 52px; padding: 4px 2px; border-radius: 12px; border: 2px solid var(--line); background: var(--panel-2); color: var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.35; opacity: .55; cursor: default; }
.g-mench-tb b { font-size: 13px; }
.g-mench-tb small { font-size: 10.5px; color: var(--sub); }
.g-mench-tb.ok { opacity: 1; cursor: pointer; box-shadow: var(--glow); animation: g-mench-tb-pulse 1s ease-in-out infinite; }
.g-mench-tb.ok:active { transform: scale(.95); }
@keyframes g-mench-tb-pulse { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }

@media (prefers-reduced-motion: reduce) {
  .g-mench-dice.pop, .g-mench-tb.ok { animation: none; }
}
