/* =============================================================
   GAME: Tien Len — felt table, 3 computer seats, your hand below.
   Cards are absolutely positioned by tienlen.js (--cw / --ch).
   ============================================================= */
.board-tienlen {
  --tl-glow: var(--glow, #ff6b3d);
  --tl-red: #f2335a;
  --tl-black: #1b1736;
  width: 100%; max-width: 860px;
  touch-action: manipulation; -webkit-touch-callout: none;
}
.board-tienlen .tl-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.tl-table {
  position: relative; width: 100%; min-height: 280px; border-radius: 22px; isolation: isolate;
  background:
    radial-gradient(ellipse 62% 50% at 50% 50%, color-mix(in srgb, var(--tl-glow) 16%, transparent), transparent 72%),
    repeating-radial-gradient(circle at 30% 20%, rgba(255, 255, 255, .022) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, color-mix(in srgb, var(--c1, #5a1d0c) 55%, #0b0a1c), color-mix(in srgb, var(--c2, #160814) 85%, #07060f));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tl-glow) 30%, transparent), inset 0 0 50px rgba(0, 0, 0, .5);
}
/* the inner rail of the table */
.tl-table::before {
  content: ""; position: absolute; left: 13%; right: 13%; top: 20%; bottom: 34%; border-radius: 50%; pointer-events: none; z-index: 0;
  border: 1.5px solid color-mix(in srgb, var(--tl-glow) 30%, transparent);
  box-shadow: 0 0 22px color-mix(in srgb, var(--tl-glow) 18%, transparent), inset 0 0 26px color-mix(in srgb, var(--tl-glow) 10%, transparent);
}

/* ---- cards ---- */
.tl-card {
  position: absolute; left: 0; top: 0; width: var(--cw); height: var(--ch); transform-origin: 0 0;
  border-radius: calc(var(--cw) * .09); color: var(--tl-black);
  background: linear-gradient(160deg, #ffffff 0%, #f7f5ff 55%, #e9e5f8 100%);
  box-shadow: 0 1px 1.5px rgba(0, 0, 0, .45), 0 3px 8px rgba(4, 2, 16, .3), inset 0 0 0 1px rgba(40, 30, 90, .2), inset 0 1px 0 #fff;
  transition: transform .34s cubic-bezier(.3, .7, .3, 1), opacity .34s, filter .2s, box-shadow .2s;
  overflow: hidden; will-change: transform;
}
.tl-card.tl-red { color: var(--tl-red); }
.tl-idx {
  position: absolute; left: 7%; right: 7%; top: 3.5%; display: flex; justify-content: space-between; align-items: center;
  font: 800 calc(var(--cw) * .3) / 1 var(--font-body); letter-spacing: -.03em;
}
.tl-ten { letter-spacing: -.1em; margin-left: -.06em; }
.tl-sm { width: calc(var(--cw) * .24); height: calc(var(--cw) * .24); fill: currentColor; flex: none; }
.tl-pips { position: absolute; inset: 0; pointer-events: none; }
.tl-pip { position: absolute; width: calc(var(--cw) * .175); height: calc(var(--cw) * .175); fill: currentColor; transform: translate(-50%, -50%); }
.tl-pip.tl-inv { transform: translate(-50%, -50%) rotate(180deg); }
.tl-ace { position: absolute; left: 50%; top: 60%; width: calc(var(--cw) * .5); height: calc(var(--cw) * .5); fill: currentColor; transform: translate(-50%, -50%); }
.tl-big { display: none; position: absolute; left: 22%; bottom: 8%; width: 56%; height: 48%; fill: currentColor; }
.tl-art { position: absolute; left: 12%; top: 29.5%; width: 76%; height: 66%; }
.tl-compact .tl-pips { display: none; }
.tl-compact .tl-big { display: block; }
.tl-compact .tl-idx { left: 6%; right: 5%; top: 2.5%; font-size: calc(var(--cw) * .36); }
.tl-compact .tl-sm { width: calc(var(--cw) * .28); height: calc(var(--cw) * .28); }
.tl-compact .tl-art { left: 8%; width: 84%; top: 31%; height: 65%; }

/* face down: neon back in the game's colour */
.tl-card.tl-down {
  background:
    radial-gradient(ellipse at 50% 50%, color-mix(in srgb, var(--tl-glow) 32%, transparent), transparent 62%),
    repeating-linear-gradient(45deg, color-mix(in srgb, var(--tl-glow) 18%, transparent) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(-45deg, color-mix(in srgb, var(--tl-glow) 18%, transparent) 0 1px, transparent 1px 5px),
    linear-gradient(155deg, var(--c1, #5a1d0c), var(--c2, #160814));
  box-shadow: 0 1px 2px rgba(0, 0, 0, .6), inset 0 0 0 1.5px color-mix(in srgb, var(--tl-glow) 60%, transparent), inset 0 0 0 3px rgba(0, 0, 0, .3);
}
.tl-card.tl-down > * { display: none; }
.tl-card.tl-down::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: calc(var(--cw) * .34); height: calc(var(--cw) * .34);
  transform: translate(-50%, -50%) rotate(45deg); border-radius: 3px;
  border: 2px solid color-mix(in srgb, var(--tl-glow) 90%, #fff);
  box-shadow: 0 0 10px color-mix(in srgb, var(--tl-glow) 70%, transparent);
}
.tl-card.tl-dim { filter: brightness(.62) saturate(.7); }
.tl-card.tl-gone { opacity: 0; pointer-events: none; }
.tl-card[hidden] { display: none; }

/* your hand */
.tl-card.tl-mine { cursor: pointer; }
.tl-card.tl-mine:hover { box-shadow: 0 1px 1.5px rgba(0, 0, 0, .45), 0 6px 14px rgba(4, 2, 16, .4), inset 0 0 0 1.5px color-mix(in srgb, var(--tl-glow) 70%, transparent); }
.tl-card.tl-sel {
  box-shadow: 0 0 0 2px var(--t-gold), 0 0 18px color-mix(in srgb, var(--t-gold) 70%, transparent), 0 8px 16px rgba(4, 2, 16, .45);
}
.tl-card:focus { outline: none; }
.tl-card:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; z-index: 300 !important; }
.tl-card.tl-wait:not(.tl-sel) { filter: brightness(.9); }
.tl-notrans .tl-card { transition: none !important; }

/* ---- seats ---- */
.tl-seat {
  position: absolute; left: 0; top: 0; width: 96px; z-index: 40;
  display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; pointer-events: none;
}
.tl-ava {
  position: relative; display: block; width: 46px; height: 46px; border-radius: 50%; flex: none;
  box-shadow: 0 0 0 2px var(--seat), 0 0 14px color-mix(in srgb, var(--seat) 45%, transparent);
  transition: box-shadow .25s;
}
.tl-ava > svg, .tl-ava > img { display: block; width: 100%; height: 100%; border-radius: 50%; overflow: hidden; }
.tl-cnt {
  position: absolute; right: -8px; bottom: -4px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px;
  font: 800 .78rem/22px var(--font-body); color: #170d24; background: var(--seat); box-shadow: 0 0 0 2px #120c22;
}
.tl-name { font-weight: 700; font-size: .85rem; color: var(--ink); line-height: 1.15; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-pts { font-size: .74rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; line-height: 1.1; }
.tl-bubble {
  position: absolute; top: -2px; left: 50%; transform: translate(24px, 0); padding: 1px 8px; border-radius: 999px;
  font: 800 .7rem/1.5 var(--font-body); text-transform: uppercase; letter-spacing: .04em;
  color: #fff; background: rgba(15, 10, 30, .85); box-shadow: 0 0 0 1px var(--line);
}
.tl-bubble[hidden] { display: none; }
/* the right-hand seat shows its bubble on the inner side */
.tl-seat-1 .tl-bubble { left: auto; right: 50%; transform: translate(-24px, 0); }
.tl-turn .tl-ava { box-shadow: 0 0 0 3px var(--seat), 0 0 22px var(--seat); animation: tl-pulse 1.1s ease-in-out infinite alternate; }
@keyframes tl-pulse { to { box-shadow: 0 0 0 3px var(--seat), 0 0 30px var(--seat), 0 0 0 7px color-mix(in srgb, var(--seat) 22%, transparent); } }
.tl-out .tl-ava { filter: grayscale(.6) brightness(.75); }
.tl-winner .tl-ava { box-shadow: 0 0 0 3px var(--t-gold), 0 0 26px var(--t-gold); }

/* who played the top combination */
.tl-cap {
  position: absolute; left: 0; top: 0; z-index: 250; white-space: nowrap; pointer-events: none;
  padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; color: var(--ink);
  background: rgba(10, 6, 24, .72); box-shadow: 0 0 0 1px color-mix(in srgb, var(--tl-glow) 40%, transparent);
}
.tl-cap[hidden] { display: none; }

/* ---- action bar ---- */
.tl-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.tl-me { position: relative; display: flex; align-items: center; gap: 8px; min-width: 0; }
.tl-me .tl-ava { width: 38px; height: 38px; }
.tl-me-t { display: flex; flex-direction: column; min-width: 0; }
.tl-me .tl-bubble { left: 0; top: -8px; transform: translate(26px, 0); }
.tl-btns { display: flex; gap: 8px; margin-left: auto; }
.tl-btns .btn { min-width: 64px; }
.tl-pass.tl-urge:not(:disabled) { box-shadow: inset 0 0 0 1.5px var(--t-gold), 0 0 14px color-mix(in srgb, var(--t-gold) 45%, transparent); }

/* inline card names in the status bar */
.tl-ct { display: inline-flex; align-items: center; gap: 1px; font-weight: 800; color: var(--ink); }
.tl-ct.tl-red { color: #ff6b8a; }
.tl-ss { width: .95em; height: .95em; fill: currentColor; }
.tl-msg { color: var(--muted); font-weight: 600; }

@media (max-width: 600px) {
  .tl-table { border-radius: 16px; }
  .tl-table::before { left: 18%; right: 18%; top: 22%; bottom: 36%; }
  .tl-seat { width: 62px; }
  .tl-ava { width: 36px; height: 36px; }
  .tl-cnt { min-width: 19px; height: 19px; line-height: 19px; font-size: .7rem; right: -7px; }
  .tl-name { font-size: .74rem; }
  .tl-pts { font-size: .68rem; }
  .tl-bubble { font-size: .62rem; transform: translate(14px, -4px); }
  .tl-seat-1 .tl-bubble { transform: translate(-14px, -4px); }
  .tl-card { box-shadow: 0 1px 1.5px rgba(0, 0, 0, .5), inset 0 0 0 1px rgba(40, 30, 90, .25); }
  .tl-btns { gap: 6px; }
  .tl-btns .btn { min-width: 0; padding-left: 12px; padding-right: 12px; }
  .tl-cap { font-size: .7rem; }
}
@media (prefers-reduced-motion: reduce) {
  .tl-card { transition: none; }
  .tl-turn .tl-ava { animation: none; }
}
