/* ============================================================================
   TUNK — card table styles. High-tech dark HUD: glowing red, glass panels.
   Big touch-friendly cards, smooth animations, clear turn indicator.
   ========================================================================== */

/* ---------- setup bar ---------- */
.tk-setup{
  display:flex; flex-wrap:wrap; align-items:center; gap:10px;
  padding:12px 14px; margin:14px 0; border-radius:12px;
  background:linear-gradient(180deg, rgba(13,25,42,.92), rgba(7,12,20,.92));
  border:1px solid #e5323833; box-shadow:0 4px 24px rgba(0,0,0,.35);
}
.tk-setup .tk-setup-lbl{ font-weight:800; letter-spacing:.08em; font-size:13px; color:#ff8a94; text-transform:uppercase; }
.tk-count{ display:inline-flex; gap:6px; align-items:center; }
.tk-count label{
  display:inline-flex; align-items:center; gap:4px; padding:8px 12px; border-radius:20px;
  border:1px solid #e5323833; background:rgba(229,50,56,.06); cursor:pointer;
  font-weight:700; font-size:14px; color:#e8f2fa;
}
.tk-count label:has(input:checked){ background:rgba(229,50,56,.22); border-color:#e53238; color:#fff; box-shadow:0 0 14px #e5323844; }
.tk-count input{ accent-color:#e53238; }
.tk-setup .spacer{ flex:1; }

/* ---------- scoreboard / opponents ---------- */
.tk-scoreboard{
  display:grid; grid-template-columns:repeat(auto-fit, minmax(150px, 1fr)); gap:10px; margin:12px 0;
}
.tk-player{
  display:flex; flex-direction:column; align-items:center; gap:3px; text-align:center;
  padding:10px 8px; border-radius:14px; min-height:118px;
  background:rgba(11,22,38,.85); border:1px solid #e5323822;
  transition:box-shadow .3s, border-color .3s, transform .3s;
}
.tk-player.active{
  border-color:#e53238; box-shadow:0 0 22px #e5323855, inset 0 0 18px #e5323822;
  transform:translateY(-2px);
}
.tk-player.human.active{ border-color:#e53238; box-shadow:0 0 22px #e5323855, inset 0 0 18px #e5323822; }
.tk-skull{ width:64px; height:64px; display:block; position:relative; }
.tk-skull .skull-fallback{ width:100%; height:100%; object-fit:contain; }
.tk-skull .skull-emo{ position:absolute; right:-2px; bottom:-2px; font-size:18px; }
.tk-skull canvas{ width:100% !important; height:100% !important; }
.tk-skull.tk-player img{ width:64px; height:64px; border-radius:50%; object-fit:cover; border:2px solid #ff4fd8; box-shadow:0 0 14px #ff4fd866; }
.tk-pname{ font-weight:800; letter-spacing:.06em; font-size:15px; }
.tk-dealer{ font-size:10px; letter-spacing:.14em; color:#ffd166; }
.tk-phand, .tk-pscore{ font-size:13px; color:#9fb4c8; }
.tk-pscore b{ color:#ff8a94; }

/* ---------- turn banner ---------- */
.tk-turn{
  margin:10px 0; padding:12px 16px; border-radius:12px; text-align:center;
  font-weight:700; font-size:15px; color:#c8d8e8;
  background:rgba(11,22,38,.85); border:1px solid #e5323822;
}
.tk-turn.your{
  color:#ffffff; background:linear-gradient(90deg,#e53238,#ff8a94);
  box-shadow:0 0 26px #e5323866; animation:tkPulse 1.6s ease-in-out infinite;
}
@keyframes tkPulse{ 0%,100%{ transform:scale(1); } 50%{ transform:scale(1.015); } }

/* ---------- table: stock + discard ---------- */
.tk-piles{ display:flex; justify-content:center; align-items:flex-start; gap:28px; margin:14px 0 6px; }
.tk-pile{ display:flex; flex-direction:column; align-items:center; gap:6px; cursor:pointer; background:none; border:0; padding:0; }
.tk-pile-count{ font-size:12px; letter-spacing:.1em; text-transform:uppercase; color:#9fb4c8; font-weight:700; }
.tk-pile .tk-card{ cursor:pointer; }

/* ---------- cards ---------- */
.tk-card{
  position:relative; width:72px; height:102px; border-radius:10px;
  background:linear-gradient(160deg, #ffffff, #dfe8f2);
  border:1px solid #b8c6d6; box-shadow:0 4px 14px rgba(0,0,0,.45);
  color:#0b1626; font-family:inherit; cursor:pointer; padding:0;
  transition:transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  flex:0 0 auto; user-select:none; -webkit-tap-highlight-color:transparent;
}
.tk-card.red{ color:#d81f3c; }
.tk-card.black{ color:#0b1626; }
.tk-card .tk-rk{ position:absolute; top:6px; left:7px; font-size:20px; font-weight:900; line-height:1; }
.tk-card .tk-st{ position:absolute; inset:0; display:flex; align-items:center; justify-content:center; font-size:38px; }
.tk-card .tk-rk-b{ position:absolute; bottom:6px; right:7px; font-size:20px; font-weight:900; line-height:1; transform:rotate(180deg); }
.tk-card:disabled{ cursor:default; }
.tk-card:not(:disabled):hover{ transform:translateY(-8px); box-shadow:0 10px 22px rgba(0,0,0,.55), 0 0 16px #e5323855; }
.tk-card.sel{
  transform:translateY(-14px); border-color:#e53238; box-shadow:0 0 0 2px #e53238, 0 12px 26px rgba(0,0,0,.55), 0 0 22px #e5323888;
}
.tk-card.tk-back{
  background:linear-gradient(160deg, #3d0d12, #070b12);
  border:1px solid #e5323866; box-shadow:0 4px 14px rgba(0,0,0,.5), inset 0 0 22px #e5323833;
  display:flex; align-items:center; justify-content:center;
}
.tk-card.tk-back .tk-back-w{
  font-size:40px; font-weight:900; color:#e53238; text-shadow:0 0 16px #e53238;
}
.tk-card.tk-mini{ width:52px; height:74px; }
.tk-card.tk-mini .tk-rk, .tk-card.tk-mini .tk-rk-b{ font-size:15px; }
.tk-card.tk-mini .tk-st{ font-size:26px; }

/* ---------- spreads on the table ---------- */
.tk-table-lane{ margin:10px 0; min-height:60px; }
.tk-table-lane h3, .tk-hand-lane h3{
  margin:4px 0 8px; font-size:12px; letter-spacing:.24em; text-transform:uppercase; color:#e53238;
}
.tk-empty{ color:#7d93a8; font-size:14px; padding:8px 2px; }
.tk-spread{
  display:inline-block; vertical-align:top; margin:0 10px 10px 0; padding:8px 10px;
  border-radius:12px; background:rgba(229,50,56,.07); border:1px solid #e5323833; cursor:pointer;
  transition:box-shadow .2s, border-color .2s;
}
.tk-spread:hover{ border-color:#e53238; box-shadow:0 0 16px #e5323844; }
.tk-spread-lab{ display:block; font-size:12px; font-weight:700; color:#9fb4c8; margin-bottom:6px; }
.tk-spread-cards{ display:flex; gap:4px; }
.tk-spread-cards .tk-card{ width:52px; height:74px; }
.tk-spread-cards .tk-card .tk-rk, .tk-spread-cards .tk-card .tk-rk-b{ font-size:15px; }
.tk-spread-cards .tk-card .tk-st{ font-size:26px; }

/* ---------- player hand ---------- */
.tk-hand-lane{ margin:14px 0 6px; }
.tk-hand{
  display:flex; flex-wrap:wrap; gap:8px; min-height:110px; padding:12px;
  border-radius:14px; background:rgba(7,12,20,.7); border:1px solid #e5323822;
}
.tk-deadwood{ margin:8px 2px 0; font-size:14px; font-weight:700; color:#ffd166; }

/* ---------- action bar ---------- */
.tk-actions{ display:flex; flex-wrap:wrap; gap:8px; margin:12px 0; }
.tk-actions .btn{ padding:12px 18px; font-size:15px; }
.tk-actions .btn:disabled{ opacity:.38; cursor:not-allowed; box-shadow:none; }
.tk-actions .btn-danger{
  background:linear-gradient(180deg,#ff2d55,#b3122f); color:#fff; border:0;
  box-shadow:0 0 18px #ff2d5555;
}
.tk-hint{ margin:4px 2px 12px; font-size:14px; color:#9fb4c8; min-height:20px; }
.tk-hint:empty{ display:none; }

/* ---------- tips log ---------- */
.tk-log-wrap{ margin:14px 0; }
.tk-log-wrap h3{ margin:4px 0 8px; font-size:12px; letter-spacing:.24em; text-transform:uppercase; color:#e53238; }
.tk-log{
  max-height:190px; overflow-y:auto; padding:10px 12px; border-radius:12px;
  background:rgba(7,12,20,.75); border:1px solid #e5323822;
  font-size:14px; line-height:1.5; color:#c8d8e8;
  display:flex; flex-direction:column; gap:6px;
}
.tk-log-line{ animation:tkFadeIn .3s ease; }
@keyframes tkFadeIn{ from{ opacity:0; transform:translateY(-4px); } to{ opacity:1; transform:none; } }
.tk-dot{ display:inline-block; width:10px; height:10px; border-radius:50%; margin-right:6px; vertical-align:1px; }

/* ---------- rules ---------- */
.tk-rules{
  margin:16px 0; padding:14px 16px; border-radius:12px;
  background:rgba(11,22,38,.85); border:1px solid #e5323833; color:#c8d8e8;
}
.tk-rules summary{ cursor:pointer; font-weight:800; color:#ff8a94; letter-spacing:.06em; font-size:15px; }
.tk-rules h4{ color:#e8f2fa; margin:14px 0 4px; }
.tk-rules p, .tk-rules li{ font-size:14px; line-height:1.6; }
.tk-rules ul{ margin:6px 0 6px 18px; padding:0; }

/* ---------- showdown overlay ---------- */
.tk-overlay{
  position:fixed; inset:0; z-index:80; display:flex; align-items:center; justify-content:center;
  background:rgba(4,8,14,.88); backdrop-filter:blur(3px); padding:16px;
}
.tk-overlay[hidden]{ display:none; }
.tk-overlay-card{
  max-width:620px; width:100%; max-height:90vh; overflow:auto; text-align:center;
  background:linear-gradient(180deg,#0b1626,#070b12); border:1px solid #e5323855; border-radius:14px;
  padding:22px 24px; box-shadow:0 0 60px #e5323833; color:#e8f2fa;
}
.tk-overlay-card h3{ margin:4px 0 10px; font-size:26px; }
.tk-end-note{ color:#c8d8e8; font-size:15px; line-height:1.55; }
.tk-score-table{ width:100%; margin:12px auto; border-collapse:collapse; font-size:15px; }
.tk-score-table th, .tk-score-table td{ padding:8px 6px; border-bottom:1px solid #e5323822; text-align:center; }
.tk-score-table th{ color:#9fb4c8; font-size:12px; letter-spacing:.12em; text-transform:uppercase; }
.tk-score-table td:first-child{ text-align:left; font-weight:700; }
.tk-match-line{ color:#e53238; font-size:15px; }
.tk-overlay-btns{ margin-top:16px; display:flex; gap:10px; justify-content:center; flex-wrap:wrap; }

@media (max-width:560px){
  .tk-card{ width:60px; height:86px; }
  .tk-card .tk-rk, .tk-card .tk-rk-b{ font-size:17px; }
  .tk-card .tk-st{ font-size:30px; }
  .tk-hand{ gap:5px; padding:8px; }
  .tk-overlay-card h3{ font-size:21px; }
}
@media (prefers-reduced-motion: reduce){
  .tk-turn.your{ animation:none; }
  .tk-card{ transition:none; }
  .tk-log-line{ animation:none; }
}
