/* Compact stacks fit a player's existing battlefield row without adding height. */
.tabletop-shell .duel-player { grid-template-columns:172px minmax(0,1fr) 78px; }
.tabletop-shell .duel-player > .duel-pile-rail { grid-column:3; grid-row:1 / -1; }
.duel-pile-rail {
  --pile-width:78px;
  display:grid; grid-template-rows:repeat(2,minmax(0,1fr)); gap:7px;
  inline-size:var(--pile-width); min-width:0; min-height:0; padding:3px 6px 3px 0;
}
.duel-pile {
  position:relative; display:grid; grid-template-rows:minmax(0,1fr) 13px; gap:3px; align-items:stretch; justify-items:stretch;
  width:62px; height:100px; max-height:100%; min-width:0; min-height:0; padding:0;
  border:0; border-radius:4px; background:transparent; color:#c8d1d5;
  box-shadow:none; text-align:center; font-size:10px; font-weight:700; line-height:1.2;
}
.duel-pile-rail > .duel-pile { width:100%; height:auto; }
.duel-pile-surface { display:flex; align-items:center; justify-content:center; min-width:0; min-height:0; padding:0 5px 5px 0; }
.duel-pile-stack { position:relative; display:block; height:100%; max-height:78px; max-width:100%; aspect-ratio:5 / 7; isolation:isolate; transition:transform .15s ease; }
.duel-pile-layer,.duel-pile-face { position:absolute; display:block; inset:0; border:1px solid #adb8bd; border-radius:3px; box-sizing:border-box; }
.duel-pile-layer {
  transform:translate(calc(var(--pile-layer) * 1.4px),calc(var(--pile-layer) * 1.6px));
  background:linear-gradient(90deg,#e1dfd4,#9ca6a7); box-shadow:0 1px 1px #091119a6;
}
.duel-pile-face { overflow:hidden; background:#e5e1d5; box-shadow:0 3px 6px #0007; }
.duel-pile-deck .duel-pile-face {
  display:grid; place-items:center; border:2px solid #9daeb7;
  background:repeating-linear-gradient(45deg,#243849 0 3px,#1c2b38 3px 6px);
  box-shadow:0 3px 7px #0008,inset 0 0 0 2px #1b2a36,inset 0 0 0 3px #788c9a;
}
.duel-pile-back-seal { width:35%; height:51%; border:1px solid #d7c4a2b3; border-radius:2px; transform:rotate(12deg); background:#263b4bcc; box-shadow:0 0 0 3px #172d3a; }
.duel-pile-art { display:block; width:100%; height:100%; object-fit:cover; filter:grayscale(1); }
.duel-pile-card-name { position:absolute; bottom:0; inset-inline:0; overflow:hidden; padding:2px 2px 3px; background:#eee9daeb; color:#23313a; font-size:7px; font-weight:700; line-height:1.2; white-space:nowrap; text-overflow:ellipsis; }
.duel-pile-art-placeholder { display:grid; place-items:center; height:100%; color:#58656b; font-size:23px; }
.duel-pile-count { position:absolute; z-index:1; right:-7px; bottom:-4px; display:grid; place-items:center; min-width:22px; min-height:20px; padding:2px 4px; border:1px solid #aebdc3; border-radius:4px; background:#172530; box-shadow:0 2px 5px #0008; color:#f3e8d1; font-size:12px; font-weight:800; line-height:1; font-variant-numeric:tabular-nums; }
.duel-pile-label { display:block; color:#b9c8d1; font-size:9px; line-height:13px; letter-spacing:.06em; }
.duel-pile.is-empty .duel-pile-face { border:1px dashed #7f939e7d; background:#12202a5e; box-shadow:none; }
.duel-pile-empty-mark { display:grid; place-items:center; height:100%; color:#a2b2bc; font-size:9px; font-weight:400; }
.duel-pile.is-empty .duel-pile-count { color:#9fb1bc; border-color:#71889470; background:#14222d; box-shadow:none; }
button.duel-pile:hover,button.duel-pile:active { background:transparent; color:inherit; transform:none; }
button.duel-pile:focus-visible { outline:2px solid #edbd78; outline-offset:3px; }
button.duel-pile:focus-visible .duel-pile-face { border-color:#edbd78; }
@media (hover:hover) and (pointer:fine) {
  button.duel-pile:hover .duel-pile-stack { transform:translateY(-2px); }
  button.duel-pile:hover .duel-pile-face { border-color:#edbd78; }
}
@media (max-width:700px) {
  .tabletop-shell .duel-player { grid-template-columns:106px minmax(0,1fr) 56px; }
  .duel-pile-rail { --pile-width:56px; gap:5px; padding:2px 3px 2px 0; }
  .duel-pile { grid-template-rows:minmax(0,1fr) 11px; gap:2px; }
  .duel-pile-surface { padding:0 3px 4px 0; }
  .duel-pile-label { font-size:8px; line-height:11px; }
  .duel-pile-count { min-width:19px; min-height:17px; right:-5px; bottom:-3px; padding:2px 3px; font-size:10px; }
  .duel-pile-card-name { display:none; }
  .duel-pile-empty-mark { font-size:8px; }
}
@media (max-width:700px) and (max-height:690px) {
  .tabletop-shell .duel-player { grid-template-columns:90px minmax(0,1fr) 48px; }
  .duel-pile-rail { --pile-width:48px; gap:4px; }
}
@media (min-width:701px) and (max-height:600px) {
  .tabletop-shell .duel-player { grid-template-columns:112px minmax(0,1fr) 100px; }
  .duel-pile-rail { --pile-width:100px; grid-template-columns:repeat(2,minmax(0,1fr)); grid-template-rows:minmax(0,1fr); gap:6px; padding:2px 4px 2px 0; }
  .duel-pile { grid-template-rows:minmax(0,1fr) 11px; gap:2px; }
  .duel-pile-label { font-size:8px; line-height:11px; }
  .duel-pile-count { min-width:19px; min-height:17px; right:-5px; bottom:-3px; font-size:10px; }
  .duel-pile-card-name { display:none; }
}
@media (min-width:701px) and (max-width:1100px) and (min-height:601px) {
  .tabletop-shell .duel-player { grid-template-columns:140px minmax(0,1fr) 78px; }
}
@media (prefers-reduced-motion:reduce) {
  .duel-pile-stack { transition:none; }
  button.duel-pile:hover .duel-pile-stack { transform:none; }
}
