/* v10 — crisp, readable cards; 10 faces; 10 backs; confirm dock; loupe */

.playing-card,
.playing-card .rk,
.playing-card svg {
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
  shape-rendering: geometricPrecision;
}
.playing-card {
  overflow: hidden;
}
.playing-card .card-face,
.playing-card .pips {
  overflow: hidden;
}
.playing-card svg { overflow: hidden; }
.playing-card[data-face="contrast"] .pips,
.playing-card[data-face="large"] .pips { inset: 16% 22%; }

/* Phone hand: keep cards large enough to read. Beat older shrink rules. */
@media (max-width: 430px) {
  body.in-game .durak-hand:not(.opp-hand) > .playing-card,
  body.in-game .durak-hand:not(.opp-hand) .fan-row > .playing-card,
  body.in-game .card-fan:not(.opp-hand) > .playing-card,
  body.in-game .card-fan:not(.opp-hand) .fan-row > .playing-card {
    width: 4.65rem !important;
    height: 6.55rem !important;
  }
  body.in-game .atk-pair { width: 5.1rem; min-height: 6.4rem; }
  body.in-game .atk-pair .playing-card,
  body.in-game .felt-table > .playing-card,
  body.in-game .felt-table .durak-hand:not(.opp-hand) .playing-card {
    width: 4.4rem;
    height: 6.2rem;
  }
  body.in-game .durak-hand:not(.opp-hand) { min-height: 7.2rem; padding-top: .5rem; padding-bottom: .35rem; }
  body.in-game .kl-tabs .playing-card,
  body.in-game .found-pile .playing-card,
  body.in-game .stock-pile .playing-card,
  body.in-game .sp-col .playing-card,
  body.in-game .card-stack .playing-card {
    width: 3.15rem !important;
    height: 4.45rem !important;
  }
  body.in-game .found-pile, body.in-game .stock-pile,
  body.in-game .kl-col { min-width: 3.15rem !important; min-height: 4.45rem; }
}

.fan-row {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: flex-end;
  width: 100%;
  min-height: 0;
}
.fan-row + .fan-row { margin-top: .7rem; }
.fan-row.fan-scroll {
  justify-content: flex-start;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  padding-bottom: .2rem;
  scrollbar-width: thin;
}
.card-fan.fan-multi, .durak-hand.fan-multi {
  flex-wrap: wrap !important;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-end;
}

/* Big, high-contrast indices on every face (the default contrast style goes further). */
.playing-card .corner {
  z-index: 2;
  line-height: 1;
  padding: .08rem .1rem 0;
}
.playing-card .corner .rk {
  font-family: var(--font-sans, var(--font-ui, sans-serif));
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -.03em;
  font-style: normal;
  line-height: .9;
  display: block;
}
.playing-card.rank-10 .corner .rk { font-size: .82rem; letter-spacing: -.05em; }
.playing-card .corner .sy {
  width: 1em;
  height: 1em;
  margin-top: .04rem;
}
.playing-card .corner.br { transform: rotate(180deg); transform-origin: center; }

/* Selected: integer-pixel lift, thick gold outline, check badge. No scale (blur). */
.playing-card.selected,
.domino-tile.selected {
  transform: translateY(-10px) !important;
  box-shadow:
    0 0 0 4px #f0d78c,
    0 0 0 6px #3a2414,
    0 0 22px rgba(232, 200, 120, .8),
    0 14px 22px rgba(0, 0, 0, .45) !important;
  z-index: 20 !important;
  filter: none;
}
.playing-card.selected .sel-badge {
  display: block;
  position: absolute;
  top: .18rem;
  right: .18rem;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  background: #e8c86a;
  box-shadow: 0 0 0 2px #3a2414, 0 2px 4px rgba(0,0,0,.35);
  z-index: 5;
  pointer-events: none;
}
.playing-card.selected .sel-badge::after {
  content: "";
  position: absolute;
  left: .32rem;
  top: .22rem;
  width: .38rem;
  height: .62rem;
  border: solid #1a1006;
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}
.sel-badge { display: none; }

@media (hover: hover) and (pointer: fine) {
  .playing-card.playable:hover:not(.selected) {
    transform: translateY(-6px);
  }
}
@media (hover: none), (pointer: coarse) {
  .playing-card.playable:hover:not(.selected),
  [data-gfx="high"] .playing-card.playable:hover:not(.selected),
  [data-gfx="high"] .playing-card.selected,
  [data-gfx="high"] .durak-hand .playing-card.selected {
    transform: translateY(-10px) !important;
  }
  [data-gfx="high"] .playing-card:not(.selected) { transform: none !important; }
  [data-gfx="high"] body.in-game .game-mount.felt-table { transform: none !important; }
}

/* ---------- Confirm dock + loupe ---------- */
.card-pick-dock {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 8.5rem;
  z-index: 85;
  display: none;
  align-items: center;
  gap: .65rem;
  padding: .45rem .7rem;
  max-width: min(28rem, 96vw);
  background: rgba(8, 24, 18, .96);
  border: 2px solid #e8c86a;
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(0,0,0,.45);
  pointer-events: auto;
}
.card-pick-dock.on { display: flex; }
.card-pick-dock .pick-preview,
.card-pick-dock .playing-card {
  width: 5.5rem !important;
  height: 7.7rem !important;
  margin: 0 !important;
  transform: none !important;
  flex: 0 0 auto;
  z-index: 1 !important;
}
.card-pick-dock .sel-badge { display: none; }
.pick-meta { min-width: 0; }
.pick-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: #f6e7b2;
  margin-bottom: .4rem;
  line-height: 1.15;
}
.pick-actions { display: flex; flex-wrap: wrap; gap: .35rem; }
.card-loupe {
  position: fixed;
  z-index: 80;
  display: none;
  pointer-events: none;
  filter: drop-shadow(0 10px 18px rgba(0,0,0,.5));
}
.card-loupe.on { display: block; }
.card-loupe .playing-card {
  width: 6.6rem !important;
  height: 9.2rem !important;
  margin: 0 !important;
  transform: none !important;
}

/* ---------- 10 face styles ---------- */
/* 1. contrast (default) — maximum readability */
.playing-card[data-face="contrast"].face {
  background: #fffef8;
  color: #121212;
}
.playing-card[data-face="contrast"] .corner .rk {
  font-size: 1.38rem;
  font-weight: 800;
  font-family: var(--font-sans, sans-serif);
}
.playing-card[data-face="contrast"].rank-10 .corner .rk { font-size: 1.08rem; }
.playing-card[data-face="contrast"] .corner .sy { width: 1.25em; height: 1.25em; }
.playing-card[data-face="contrast"].red, .playing-card[data-face="contrast"].suit-h,
.playing-card[data-face="contrast"].suit-d { color: #c40000; }
.playing-card[data-face="contrast"].black, .playing-card[data-face="contrast"].suit-s,
.playing-card[data-face="contrast"].suit-c { color: #0a0a0a; }
.playing-card[data-face="contrast"].face::before {
  border: 2px solid #121212;
}

/* 2. classic — warm ivory, traditional */
.playing-card[data-face="classic"].face {
  background: linear-gradient(165deg, #fffefb 0%, #f7f1e0 58%, #efe4c8 100%);
}

/* 3. large-index */
.playing-card[data-face="large"] .corner .rk {
  font-size: 1.28rem;
  font-weight: 800;
}
.playing-card[data-face="large"].rank-10 .corner .rk { font-size: 1rem; }
.playing-card[data-face="large"] .corner .sy { width: 1.15em; height: 1.15em; }

/* 4. four-color */
.playing-card[data-face="fourcolor"].suit-s { color: #152033; }
.playing-card[data-face="fourcolor"].suit-h { color: #9b1c1c; }
.playing-card[data-face="fourcolor"].suit-d { color: #d06000; }
.playing-card[data-face="fourcolor"].suit-c { color: #0a7a3a; }

/* 5. modern minimal */
.playing-card[data-face="modern"].face {
  background: #fbfbfb;
  box-shadow: 0 1px 0 #ddd, 2px 3px 0 #888, 6px 10px 14px rgba(0,0,0,.28);
  border-radius: .2rem;
}
.playing-card[data-face="modern"].face::before { border: 0; }
.playing-card[data-face="modern"] .corner .rk {
  font-family: var(--font-sans, sans-serif);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -.04em;
}
.playing-card[data-face="modern"] .style-center {
  position: absolute;
  inset: 18% 10% 14%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .1rem;
}
.playing-card[data-face="modern"] .style-center .face-mono {
  font-family: var(--font-sans, sans-serif);
  font-weight: 800;
  font-size: 2.1rem;
  line-height: 1;
}
.playing-card[data-face="modern"] .style-center .face-suit { width: 2.2rem; height: 2.2rem; }
.playing-card[data-face="modern"] .style-center .face-suit svg { width: 100%; height: 100%; }

/* 6. vintage */
.playing-card[data-face="vintage"].face {
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255,255,255,.35), transparent 50%),
    linear-gradient(180deg, #f3e4c4, #e4d0a0 60%, #d7c08a);
}
.playing-card[data-face="vintage"].face::before {
  border: 2px double rgba(90, 50, 16, .55);
  inset: 5px;
}
.playing-card[data-face="vintage"] .corner .rk {
  font-family: var(--font-display);
  font-weight: 700;
  font-style: italic;
  font-size: 1.12rem;
}
.playing-card[data-face="vintage"].red { color: #7a1a14; }
.playing-card[data-face="vintage"].black { color: #2a2218; }

/* 7. art deco */
.playing-card[data-face="deco"].face {
  background: linear-gradient(180deg, #f7f0dc, #efe2b8);
}
.playing-card[data-face="deco"].face::before {
  border: 2px solid #c9a227;
  inset: 4px;
  border-radius: 0;
  box-shadow: inset 0 0 0 1px #1a1006;
}
.playing-card[data-face="deco"] .corner .rk {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: .06em;
  font-size: 1.12rem;
}
.playing-card[data-face="deco"] .deco-sun {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 70%;
  height: 70%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: .22;
  background: repeating-conic-gradient(from 0deg, #c9a227 0 8deg, transparent 8deg 16deg);
  border-radius: 50%;
  z-index: 0;
}
.playing-card[data-face="deco"] .pips { z-index: 1; }

/* 8. neon dark */
.playing-card[data-face="neon"].face {
  background: radial-gradient(circle at 50% 30%, #1a2438, #07080d 72%);
  color: #e8f6ff;
}
.playing-card[data-face="neon"].face::before {
  border: 1px solid rgba(80, 220, 255, .55);
  box-shadow: inset 0 0 12px rgba(40, 180, 255, .25);
}
.playing-card[data-face="neon"] .corner .rk {
  font-family: var(--font-sans, sans-serif);
  font-weight: 800;
  font-size: 1.18rem;
  text-shadow: 0 0 6px currentColor;
}
.playing-card[data-face="neon"].suit-h,
.playing-card[data-face="neon"].suit-d,
.playing-card[data-face="neon"].red { color: #ff4d6d; }
.playing-card[data-face="neon"].suit-s,
.playing-card[data-face="neon"].suit-c,
.playing-card[data-face="neon"].black { color: #5ce1ff; }
.playing-card[data-face="neon"] svg { filter: drop-shadow(0 0 3px currentColor); }

/* 9. pixel / retro */
.playing-card[data-face="pixel"].face {
  background: #f4efe2;
  border-radius: 0;
  box-shadow: 2px 2px 0 #1a1006, 4px 4px 0 #c9a227;
  image-rendering: pixelated;
}
.playing-card[data-face="pixel"].face::before { border: 2px solid #1a1006; border-radius: 0; }
.playing-card[data-face="pixel"] .corner .rk {
  font-family: ui-monospace, "Cascadia Mono", "Courier New", monospace;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: 0;
}
.playing-card[data-face="pixel"] svg { shape-rendering: crispEdges; }

/* 10. Russian ornamental */
.playing-card[data-face="ornament"].face {
  background:
    radial-gradient(circle at 80% 10%, rgba(201,162,39,.2), transparent 40%),
    linear-gradient(180deg, #fff8e8, #f3e0b8);
}
.playing-card[data-face="ornament"].face::before {
  border: 3px solid #9b1c1c;
  box-shadow: inset 0 0 0 2px #c9a227;
}
.playing-card[data-face="ornament"] .corner .rk {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.18rem;
  color: inherit;
}
.playing-card[data-face="ornament"].red { color: #8a1010; }
.playing-card[data-face="ornament"].black { color: #1a1006; }
.playing-card[data-face="ornament"] .orn-mark {
  position: absolute;
  width: 28%;
  height: 20%;
  pointer-events: none;
  opacity: .9;
  z-index: 0;
}
.playing-card[data-face="ornament"] .orn-mark svg { width: 100%; height: 100%; }
.playing-card[data-face="ornament"] .orn-mark.tl { top: 14%; left: 6%; }
.playing-card[data-face="ornament"] .orn-mark.br { bottom: 14%; right: 6%; transform: rotate(180deg); }

/* ---------- 10 original backs ---------- */
.card-back, .playing-card.back {
  background: #4a1520;
}
.back-pattern {
  position: absolute;
  inset: .22rem;
  border-radius: .2rem;
  border: 2px solid rgba(232, 212, 139, .5);
  overflow: hidden;
}
.back-motif {
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  pointer-events: none;
}

.playing-card[data-card-back="burgundy"] .back-pattern {
  background:
    repeating-linear-gradient(45deg, rgba(232,212,139,.16) 0 5px, transparent 5px 10px),
    repeating-linear-gradient(-45deg, rgba(232,212,139,.12) 0 5px, transparent 5px 10px),
    #6b1e2e;
}
.playing-card[data-card-back="burgundy"] .back-motif {
  background:
    radial-gradient(circle at 50% 50%, transparent 42%, rgba(232,212,139,.55) 43% 52%, transparent 53%),
    conic-gradient(from 0deg, rgba(232,212,139,.5) 0 12%, transparent 12% 25%);
}

.playing-card[data-card-back="ink"] .back-pattern {
  background-image:
    radial-gradient(circle at 50% 50%, rgba(232, 212, 139, .18) 0 18%, transparent 19%),
    repeating-linear-gradient(30deg, rgba(200, 220, 255, .12) 0 5px, transparent 5px 12px);
  background-color: #0c1424;
  border-color: rgba(160, 190, 230, .45);
}
.playing-card[data-card-back="ink"] .back-motif {
  border: 2px solid rgba(160, 190, 230, .5);
  background: radial-gradient(circle, rgba(160,190,230,.25), transparent 60%);
  border-radius: 4px;
  transform: rotate(45deg);
}

.playing-card[data-card-back="ivory"] .back-pattern {
  background-image: repeating-linear-gradient(135deg, rgba(120, 80, 30, .12) 0 8px, transparent 8px 16px);
  background-color: #efe4c8;
  border-color: rgba(120, 80, 30, .45);
}
.playing-card[data-card-back="ivory"] .back-motif {
  background: radial-gradient(circle at 50% 50%, #c9a227 0 18%, transparent 19% 40%, #8a5a18 41% 48%, transparent 49%);
}

.playing-card[data-card-back="navy"] .back-pattern {
  background-color: #16325a;
  background-image:
    linear-gradient(90deg, rgba(232,212,139,.15) 1px, transparent 1px),
    linear-gradient(0deg, rgba(232,212,139,.15) 1px, transparent 1px);
  background-size: 10px 10px;
  border-color: rgba(232, 212, 139, .45);
}
.playing-card[data-card-back="navy"] .back-motif {
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  background: rgba(232, 212, 139, .45);
}

.playing-card[data-card-back="forest"] .back-pattern {
  background-color: #1a4a32;
  background-image: radial-gradient(circle at 20% 20%, rgba(232,212,139,.2) 0 2px, transparent 3px);
  background-size: 12px 12px;
  border-color: rgba(180, 220, 160, .45);
}
.playing-card[data-card-back="forest"] .back-motif {
  background: radial-gradient(circle at 50% 80%, rgba(180,220,160,.5) 0 20%, transparent 21%),
    linear-gradient(180deg, rgba(180,220,160,.4), transparent);
  clip-path: polygon(50% 8%, 61% 38%, 95% 38%, 67% 58%, 78% 92%, 50% 72%, 22% 92%, 33% 58%, 5% 38%, 39% 38%);
}

.playing-card[data-card-back="midnight"] .back-pattern {
  background-color: #12101c;
  background-image:
    radial-gradient(circle at 30% 30%, #e8d48b 1px, transparent 1.5px),
    radial-gradient(circle at 70% 60%, #e8d48b 1px, transparent 1.5px);
  background-size: 16px 16px, 22px 22px;
  border-color: rgba(180, 170, 220, .4);
}
.playing-card[data-card-back="midnight"] .back-motif {
  background: radial-gradient(circle, rgba(180,170,220,.35), transparent 70%);
}

.playing-card[data-card-back="gold"] .back-pattern {
  background-color: #7a5a12;
  background-image: repeating-linear-gradient(90deg, rgba(255, 230, 140, .25) 0 3px, transparent 3px 8px);
  border-color: rgba(255, 230, 140, .6);
}
.playing-card[data-card-back="gold"] .back-motif {
  border: 2px solid rgba(255, 230, 140, .7);
  background: conic-gradient(from 45deg, #e8c86a, #fff4c0, #c9a227, #e8c86a);
}

.playing-card[data-card-back="damask"] .back-pattern {
  background-color: #4a2040;
  background-image:
    radial-gradient(circle at 30% 30%, rgba(255,255,255,.2) 0 2px, transparent 3px),
    repeating-linear-gradient(45deg, rgba(232,212,139,.25) 0 8px, transparent 8px 16px);
  border-color: rgba(232, 180, 200, .45);
}
.playing-card[data-card-back="damask"] .back-motif {
  background: radial-gradient(circle at 50% 50%, rgba(232,180,200,.5) 0 20%, transparent 21% 40%, rgba(232,180,200,.4) 41% 52%, transparent 53%);
}

.playing-card[data-card-back="emerald"] .back-pattern {
  background-color: #0e4a3a;
  background-image: repeating-linear-gradient(-30deg, rgba(200, 255, 210, .12) 0 6px, transparent 6px 14px);
  border-color: rgba(180, 255, 200, .45);
}
.playing-card[data-card-back="emerald"] .back-motif {
  border: 2px solid rgba(180, 255, 200, .5);
  border-radius: 6px;
  background: linear-gradient(135deg, rgba(180,255,200,.35), transparent);
}

.playing-card[data-card-back="stars"] .back-pattern {
  background-color: #14203a;
  background-image: radial-gradient(circle, #e8d48b 1px, transparent 1.5px);
  background-size: 10px 10px;
  border-color: rgba(232, 212, 139, .5);
}
.playing-card[data-card-back="stars"] .back-motif {
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  background: #e8d48b;
}

/* ---------- Style picker grids ---------- */
.style-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(4.8rem, 1fr));
  gap: .45rem;
  margin: .35rem 0 .7rem;
}
.style-grid.faces { grid-template-columns: repeat(auto-fill, minmax(5.4rem, 1fr)); }
.style-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  padding: .35rem .2rem .4rem;
  background: rgba(0,0,0,.25);
  border: 2px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  color: inherit;
  min-height: 0;
}
.style-tile.active {
  border-color: #e8c86a;
  box-shadow: 0 0 0 1px #e8c86a, 0 0 12px rgba(232,200,120,.35);
}
.style-tile .playing-card {
  width: 3.6rem !important;
  height: 5.05rem !important;
  margin: 0 !important;
  transform: none !important;
  pointer-events: none;
}
.style-tile .lab {
  font-size: .72rem;
  font-weight: 650;
  text-align: center;
  line-height: 1.15;
  max-width: 100%;
}
.style-preview { min-height: 8rem; }
.styles-modal .modal-card { max-width: 28rem; width: 96vw; max-height: 90vh; overflow: auto; }
.styles-modal h2 { margin: 0 0 .4rem; }

@media (max-width: 360px) {
  body.in-game .durak-hand:not(.opp-hand) > .playing-card,
  body.in-game .durak-hand:not(.opp-hand) .fan-row > .playing-card,
  body.in-game .card-fan:not(.opp-hand) .fan-row > .playing-card {
    width: 4.35rem !important;
    height: 6.15rem !important;
  }
  .card-pick-dock { padding: .35rem .45rem; gap: .4rem; }
  .card-pick-dock .playing-card { width: 4.8rem !important; height: 6.7rem !important; }
  .pick-name { font-size: 1.02rem; }
}


/* v13 — solitaire / OFC fit 360–390px */
.soli-top {
  display: flex;
  flex-wrap: nowrap;
  gap: .28rem;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  align-items: flex-end;
  padding-bottom: .2rem;
}
.soli-found {
  display: flex;
  flex-wrap: nowrap;
  gap: .28rem;
  margin-inline-start: auto;
}
.kl-tabs {
  display: flex;
  gap: .28rem;
  margin-top: 1rem;
  align-items: flex-start;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: .4rem;
}
.kl-col, .fc-col {
  flex: 1 1 0;
  min-width: 0;
}
.poker-ofc, .poker-ofc > * { max-width: 100%; }
.poker-ofc h2, .poker-disclaimer { max-width: 100%; overflow-wrap: anywhere; }
.ofc-rows { max-width: 100%; box-sizing: border-box; }
.ofc-label { white-space: normal; line-height: 1.15; }

@media (max-width: 430px) {
  body.in-game .soli-top .playing-card,
  body.in-game .soli-found .playing-card,
  body.in-game .soli-top .found-pile .playing-card,
  body.in-game .soli-top .stock-pile .playing-card,
  body.in-game .kl-tabs .playing-card,
  body.in-game .found-pile .playing-card,
  body.in-game .stock-pile .playing-card,
  body.in-game .sp-col .playing-card,
  body.in-game .card-stack .playing-card,
  body.in-game .fc-col .playing-card {
    width: 2.55rem !important;
    height: 3.6rem !important;
  }
  body.in-game .found-pile,
  body.in-game .stock-pile,
  body.in-game .kl-col,
  body.in-game .fc-col,
  body.in-game .card-stack {
    min-width: 0 !important;
    min-height: 3.6rem;
  }
  body.in-game .soli-top .found-pile,
  body.in-game .soli-top .stock-pile {
    min-width: 2.55rem !important;
    width: 2.55rem;
    min-height: 3.6rem;
  }
  .kl-tabs { gap: .16rem; }
  .ofc-row { gap: .12rem; padding: .2rem; width: 100%; max-width: 100%; box-sizing: border-box; }
  .ofc-label { width: 4.2rem; font-size: .75rem; }
  .poker-ofc .playing-card,
  .ofc-row .playing-card {
    width: 2.15rem !important;
    height: 3.05rem !important;
    flex: none;
  }
}
@media (max-width: 360px) {
  body.in-game .soli-top .playing-card,
  body.in-game .soli-found .playing-card,
  body.in-game .soli-top .found-pile .playing-card,
  body.in-game .soli-top .stock-pile .playing-card,
  body.in-game .kl-tabs .playing-card,
  body.in-game .found-pile .playing-card,
  body.in-game .stock-pile .playing-card,
  body.in-game .sp-col .playing-card,
  body.in-game .card-stack .playing-card,
  body.in-game .fc-col .playing-card {
    width: 2.35rem !important;
    height: 3.3rem !important;
  }
  body.in-game .soli-top .found-pile,
  body.in-game .soli-top .stock-pile {
    min-width: 2.35rem !important;
    width: 2.35rem;
    min-height: 3.3rem;
  }
  .kl-tabs, .soli-top { gap: .12rem; }
  .ofc-label { width: 3.6rem; font-size: .68rem; }
  .poker-ofc .playing-card,
  .ofc-row .playing-card {
    width: 1.95rem !important;
    height: 2.75rem !important;
  }
}

/* OFC: keep the tray and the player's rows on a phone screen */
@media (max-width: 430px) {
  .poker-ofc { gap: .28rem; width: 100%; }
  .poker-ofc h2 { font-size: 1.05rem; margin: 0; }
  .poker-ofc .poker-disclaimer, .poker-ofc .bot-seat { margin: 0; }
  .poker-ofc .ofc-rows { gap: .18rem; }
  .poker-ofc .ofc-row { min-height: 0; padding: .12rem .16rem; gap: .1rem; }
  .poker-ofc .ofc-label { width: 3.4rem; font-size: .68rem; }
  .poker-ofc .poker-hold-row {
    flex-wrap: wrap;
    justify-content: center;
    gap: .12rem;
    max-width: 100%;
    position: sticky;
    bottom: 0;
    z-index: 6;
    padding: .25rem 0 .1rem;
    background: linear-gradient(180deg, transparent, rgba(8,24,18,.92) 30%);
  }
  body.in-game .play-wrap { overflow-y: auto; }
}

@media (max-width: 430px) {
  .bridge-shell > .play-actions,
  .king-shell > .play-actions {
    max-height: 32vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    justify-content: center;
  }
}

/* v17 — short-desktop play area: scroll the wrap, cap the poker oval, keep tray/actions reachable. */
body.in-game {
  height: 100%;
  height: 100dvh;
  overflow: hidden;
}
body.in-game #app {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: calc(.35rem + env(safe-area-inset-bottom, 0px));
}
body.in-game #main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body.in-game .play-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
  padding-bottom: var(--host-safe-bottom, 2.6rem);
}
body.in-game .poker-table-wrap {
  width: min(52rem, 100%, calc(min(26rem, 100dvh - 20rem) * 1.55));
  max-width: 52rem;
  margin-inline: auto;
}
body.in-game .poker-table {
  max-height: min(26rem, calc(100dvh - 20rem));
}
body.in-game .poker-actions {
  position: sticky;
  bottom: 0;
  z-index: 7;
  background: linear-gradient(180deg, transparent, rgba(8, 18, 14, .94) 26%);
  padding-bottom: max(.4rem, env(safe-area-inset-bottom, 0px));
}
.poker-ofc .ofc-tray,
.poker-ofc .poker-hold-row {
  position: sticky;
  bottom: 0;
  z-index: 6;
  padding: .25rem 0 .15rem;
  background: linear-gradient(180deg, transparent, rgba(8, 24, 18, .92) 28%);
}
@media (min-width: 800px) {
  .poker-ofc {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-auto-flow: dense;
    align-items: start;
    gap: .4rem 1.1rem;
    width: 100%;
    max-width: 64rem;
  }
  .poker-ofc > * { grid-column: 1 / -1; max-width: 100%; }
  .poker-ofc > .ofc-rows { max-width: none; width: 100%; }
  .poker-ofc > .ofc-rows.ofc-villain { grid-column: 1; }
  .poker-ofc > .ofc-rows.ofc-hero { grid-column: 2; }
}
/* Flatten cards on mouse too — rotateX made elementFromPoint miss the face. */
[data-gfx="high"] .playing-card:not(.selected) {
  transform: none !important;
}
[data-gfx="high"] .durak-hand,
[data-gfx="high"] .card-stack {
  perspective: none;
}

.play-actions:empty,
.game-shell > .play-actions:empty {
  display: none !important;
  padding: 0 !important;
  min-height: 0 !important;
}

.dummy-hand { min-height: 0; padding: .15rem 0; }
.dummy-hand.fan-multi { flex-wrap: nowrap !important; flex-direction: row !important; }
.dummy-hand .playing-card { width: 2.25rem !important; height: 3.15rem !important; }

/* Dice poker: keep dice + roll above the scoresheet fold on short phones. */
.yahtzee-shell {
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: .35rem;
}
.yahtzee-sheet {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.yahtzee-dock {
  position: relative;
  bottom: auto;
  z-index: 16;
  flex: 0 0 auto;
  background: linear-gradient(180deg, transparent, rgba(8, 18, 14, .94) 16%, rgba(8, 18, 14, .98));
  padding: .3rem .1rem max(.5rem, calc(env(safe-area-inset-bottom, 0px) + var(--host-safe-bottom, 2.6rem)));
  box-shadow: 0 -8px 18px rgba(0, 0, 0, .3);
}
.yahtzee-dock .play-actions { position: relative; bottom: auto; background: none; padding: .25rem 0 0; }
.yahtzee-dice { display: flex; justify-content: center; gap: .25rem; }


/* 2.2 OFC short-phone: keep hero rows + tray above the host badge */
@media (max-height: 900px) and (max-width: 500px) {
  body.in-game .play-wrap:has(.poker-ofc) {
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  body.in-game .play-wrap:has(.poker-ofc) .game-mount {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .poker-ofc {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: .12rem;
    overflow: hidden;
  }
  .poker-ofc > h2 { font-size: 1rem; margin: 0; flex: 0 0 auto; }
  .poker-ofc > .poker-disclaimer,
  .poker-ofc > .bot-seat { display: none; }
  .poker-ofc > .game-status { flex: 0 0 auto; margin: 0; font-size: .82rem; }
  .poker-ofc > .fine { display: none; }
  .poker-ofc > .ofc-rows {
    flex: 1 1 auto;
    min-height: 0;
    gap: .08rem;
    overflow: hidden;
  }
  .poker-ofc .ofc-row { min-height: 0; padding: .06rem .1rem; gap: .08rem; }
  .poker-ofc .ofc-label { width: 2.8rem; font-size: .62rem; }
  .poker-ofc .playing-card,
  .poker-ofc .ofc-row .playing-card,
  .poker-ofc .ofc-tray .playing-card {
    width: 1.7rem !important;
    height: 2.35rem !important;
  }
  .poker-ofc .ofc-tray,
  .poker-ofc .poker-hold-row {
    position: relative;
    flex: 0 0 auto;
    bottom: auto;
    margin-top: .1rem;
    padding: .1rem 0 .05rem;
  }
}


/* 2.2 poker: keep hero hand and action bar unobscured on short viewports */
@media (max-height: 920px) {
  body.in-game .play-wrap:has(.poker-shell:not(.poker-ofc)) {
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  body.in-game .play-wrap:has(.poker-shell:not(.poker-ofc)) .game-mount {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .poker-shell:not(.poker-ofc) {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    gap: .12rem;
  }
  .poker-shell:not(.poker-ofc) > .poker-topbar,
  .poker-shell:not(.poker-ofc) > .poker-disclaimer,
  .poker-shell:not(.poker-ofc) > .poker-hero-hand,
  .poker-shell:not(.poker-ofc) > .poker-hint,
  .poker-shell:not(.poker-ofc) > .poker-actions {
    flex: 0 0 auto;
  }
  body.in-game .poker-shell:not(.poker-ofc) .poker-table-wrap {
    flex: 1 1 auto;
    min-height: 8rem;
    width: min(52rem, 100%);
    max-width: 52rem;
  }
  body.in-game .poker-shell:not(.poker-ofc) .poker-table {
    max-height: 100%;
    height: 100%;
  }
  body.in-game .poker-shell:not(.poker-ofc) .poker-actions {
    position: relative;
    bottom: auto;
    z-index: 7;
    background: var(--bg, #08120e);
    padding-bottom: .25rem;
  }
  .poker-shell:not(.poker-ofc) > .poker-log {
    display: none;
  }
}
