/* ==========================================================================
   THE DURAK TABLE — the others round the top, the pack and the table in the
   middle, your hand at the bottom, big. Its own cloth (deep teal), so it is
   never mistaken for the poker felt; everything else is the same room.
   ========================================================================== */

:root {
  --dk-1: #237587;
  --dk-2: #155061;
  --dk-3: #0c3440;
  --att: #ff7a59;
  --def: #52b8ff;
  --hw: clamp(52px, 16.5vw, 70px);
}

.dk-felt { position: relative; flex: 1; min-height: 230px; }
.dk-cloth {
  position: absolute;
  border-radius: 50% 50% 34px 34px / 44% 44% 34px 34px;
  background: radial-gradient(90% 70% at 50% 40%, var(--dk-1) 0%, var(--dk-2) 60%, var(--dk-3) 100%);
  box-shadow:
    0 0 0 6px var(--rim),
    0 0 0 7px rgba(255, 255, 255, 0.06),
    0 18px 40px rgba(0, 0, 0, 0.55),
    inset 0 10px 40px rgba(0, 0, 0, 0.3);
}

.top-meta .suit { font-size: 15px; }
.suit.sH, .suit.sD, .dk-trump-suit.sH, .dk-trump-suit.sD { color: #ff6b6b; }
.suit.sS, .suit.sC { color: #f1f6f2; }

/* ---------------------------------------------------------------- seats */

.dk-seat {
  position: absolute;
  left: 50%;
  top: 15%;
  width: 92px;
  height: 86px;
  transform: translate(-50%, -50%) scale(var(--u, 1));
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 3;
  transition: opacity 0.25s;
}
.dk-seat.away { opacity: 0.45; }
.dk-seat .pod { position: relative; width: 44px; height: 44px; flex: none; }
.dk-seat.turn .av {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(46, 224, 140, 0.25), 0 0 22px var(--accent-glow);
  animation: pulse 1.3s ease-in-out infinite;
}
.dk-seat.def .av { border-color: var(--def); }
.dk-seat.att .av { border-color: var(--att); }
.dk-seat.fool .av { border-color: var(--gold); box-shadow: 0 0 22px rgba(242, 201, 107, 0.6); }
.dk-seat .info { max-width: 90px; }
.dk-seat .sub2 { font-size: 10px; color: var(--muted); font-weight: 700; white-space: nowrap; }
.dk-backs { position: absolute; left: 30px; top: 2px; display: flex; pointer-events: none; }
.dk-backs img { width: 15px; aspect-ratio: 200 / 280; border-radius: 2px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }
.dk-backs img + img { margin-left: -12px; }
.dk-backs img.b0 { rotate: -10deg; } .dk-backs img.b1 { rotate: -5deg; } .dk-backs img.b3 { rotate: 5deg; }
.dk-backs img.b4 { rotate: 10deg; }
.dk-count {
  position: absolute;
  right: -12px;
  bottom: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: #fff;
  color: #111;
  font-size: 12px;
  font-weight: 900;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
  z-index: 4;
}
.fool-mark { position: absolute; right: -8px; top: -8px; font-size: 14px; }
.dk-seat .plate { max-width: 118px; }
.plate.attacker { background: var(--att); color: #2a0b02; border-color: transparent; }
.plate.defender { background: var(--def); color: #03192a; border-color: transparent; }
.plate.taking { background: #ffb347; color: #2a1602; border-color: transparent; }
.plate.passed { color: var(--muted); }
.plate.thinking { color: var(--gold); border-color: rgba(242, 201, 107, 0.4); }
.plate.out { color: var(--muted); }
.plate.fool { background: var(--gold); color: var(--gold-ink); border-color: transparent; }

/* ---------------------------------------------------------- the middle */

.dk-mid {
  --dcw: calc(44px * var(--u, 1));
  --tcw: calc(50px * var(--u, 1));
  position: absolute;
  left: 0;
  right: 0;
  top: 40%;
  bottom: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: calc(8px * var(--u, 1));
  z-index: 2;
  pointer-events: none;
}
.dk-mid > * { pointer-events: auto; }
.dk-stock { display: flex; align-items: center; justify-content: center; gap: calc(26px * var(--u, 1)); }
.dk-deck { position: relative; width: calc(var(--dcw) * 1.75); height: calc(var(--dcw) * 1.4); }
.dk-trump { position: absolute; left: 0; top: 50%; transform: translateY(-50%); }
.dk-trump img { width: var(--dcw); rotate: 90deg; translate: calc(var(--dcw) * 0.15) 0; }
.dk-deck > img.deck { position: absolute; right: 0; top: 0; width: var(--dcw); }
.dk-deck-n {
  position: absolute;
  right: calc(var(--dcw) * -0.25);
  bottom: calc(var(--dcw) * -0.2);
  font-size: calc(12px * var(--u, 1));
  font-weight: 900;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.15);
  white-space: nowrap;
  z-index: 2;
}
.dk-trump-suit {
  width: calc(var(--dcw) * 1.4);
  height: calc(var(--dcw) * 1.4);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.3);
  border: 1.5px dashed rgba(255, 255, 255, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: calc(26px * var(--u, 1));
  line-height: 1;
}
.dk-trump-suit small { font-size: calc(9px * var(--u, 1)); color: var(--text-2); font-weight: 800; margin-top: 2px; }
.dk-discard { position: relative; width: calc(var(--dcw) * 1.2); height: calc(var(--dcw) * 1.4); display: grid; place-items: center; }
.dk-discard img { position: absolute; width: var(--dcw); rotate: 12deg; opacity: 0.85; }
.dk-discard img.d1 { rotate: -8deg; translate: -3px 2px; }
.dk-discard .dk-deck-n { right: calc(var(--dcw) * -0.45); }
.dk-empty {
  font-size: calc(10px * var(--u, 1));
  color: rgba(255, 255, 255, 0.35);
  font-weight: 800;
  border: 1.5px dashed rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  width: var(--dcw);
  height: calc(var(--dcw) * 1.4);
  display: grid;
  place-items: center;
}

.dk-pairs {
  display: grid;
  grid-template-columns: repeat(3, auto);
  justify-content: center;
  gap: calc(8px * var(--u, 1)) calc(12px * var(--u, 1));
  min-height: calc(var(--tcw) * 1.4 + 18px * var(--u, 1));
}
.dk-pairs[data-n="0"] { visibility: hidden; }
.dk-pair { position: relative; width: calc(var(--tcw) + 12px * var(--u, 1)); height: calc(var(--tcw) * 1.4 + 18px * var(--u, 1)); }
.dk-pair img { position: absolute; width: var(--tcw); }
.dk-pair img.att { left: 0; top: 0; }
.dk-pair img.def { left: calc(12px * var(--u, 1)); top: calc(18px * var(--u, 1)); rotate: 9deg; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5); }
.dk-pair.target img.att {
  box-shadow: 0 0 0 2px var(--gold), 0 0 18px rgba(242, 201, 107, 0.9);
  animation: best-glow 1.2s ease-in-out infinite;
}
.dk-line {
  font-size: max(11px, calc(13px * var(--u, 1)));
  font-weight: 800;
  color: rgba(255, 255, 255, 0.85);
  text-align: center;
  max-width: 92%;
  line-height: 1.25;
}

/* ------------------------------------------------------------- your hand */

.hero.dk-hero { flex-direction: column; align-items: stretch; gap: 8px; padding: 8px 10px 10px; min-height: 0; }
.dk-role {
  align-self: center;
  font-size: 12.5px;
  font-weight: 900;
  letter-spacing: 0.05em;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--panel-hi);
  border: 1px solid var(--line-hi);
  color: var(--text-2);
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dk-role.go { background: var(--accent); color: var(--accent-ink); border-color: transparent; animation: glow 1.3s ease-in-out infinite; }
.dk-role.go.def { background: var(--def); color: #03192a; }
.dk-role.go.urgent { background: var(--danger); color: #fff; }
.dk-role.fool { background: var(--gold); color: var(--gold-ink); border-color: transparent; }
.dk-role.won { color: var(--accent); }
.dk-hand {
  --ov: 0px;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  min-height: calc(var(--hw) * 1.4 + 16px);
  padding-top: 14px;
}
.dk-hand { flex-direction: column; align-items: stretch; row-gap: 6px; }
.dk-row { display: flex; justify-content: center; align-items: flex-end; }
.dk-empty-hand { align-self: center; color: var(--faint); font-size: 13px; }
.dk-hand.none {
  align-items: center;
  color: var(--faint);
  font-size: 13px;
  border: 1.5px dashed var(--line-hi);
  border-radius: 14px;
  min-height: calc(var(--hw) * 1.1);
  padding: 8px;
}
.dk-card { position: relative; flex: none; transition: transform 0.15s var(--ease); }
.dk-row .dk-card + .dk-card { margin-left: calc(var(--ov) * -1); }
.dk-card img.card { width: var(--hw); border-radius: 8px; box-shadow: 0 5px 14px rgba(0, 0, 0, 0.5); transition: filter 0.2s, translate 0.15s var(--ease), box-shadow 0.2s; }
.dk-card img.no { filter: brightness(0.5) saturate(0.6); }
.hero.turn .dk-card img.ok { box-shadow: 0 0 0 2px rgba(46, 224, 140, 0.9), 0 6px 16px rgba(0, 0, 0, 0.5); }
.hero .dk-card img.picked { translate: 0 -16px; box-shadow: 0 0 0 3px var(--gold), 0 0 20px rgba(242, 201, 107, 0.8); filter: none; }
.dk-card:active img { translate: 0 -6px; }

.dk-score { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; padding: 4px 0 2px; }
.dk-sc {
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding: 6px 12px;
  border-radius: 12px;
  background: var(--panel-hi);
  border: 1px solid var(--line);
  font-weight: 700;
  font-size: 14px;
}
.dk-sc.me { border-color: rgba(46, 224, 140, 0.4); }
.dk-sc b { color: var(--gold); font-size: 16px; }
.dk-sc-cap { width: 100%; text-align: center; font-size: 11.5px; color: var(--muted); font-weight: 700; }
.hero .dk-card img.ok { box-shadow: 0 0 0 1.5px rgba(46, 224, 140, 0.55), 0 5px 14px rgba(0, 0, 0, 0.5); }

.dk-fly { width: calc(var(--tcw, 44px) * 0.9); }

.seats-grid.six { grid-template-columns: repeat(3, 1fr); }
.rules p { margin: 0 0 10px; color: var(--text-2); line-height: 1.45; font-size: 14px; }

@media (max-height: 640px) {
  :root { --hw: clamp(46px, 14vw, 60px); }
}
@media (max-height: 560px) {
  :root { --hw: 42px; }
  .dk-role { font-size: 11px; padding: 3px 9px; }
  .dk-hand { padding-top: 10px; }
}
