.case-deck {
  --deck-ease: cubic-bezier(.22, .8, .25, 1);
  min-width: 0;
}

.deck-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: #7b7266;
  font-size: 8px;
  padding: 2px 0 12px;
}

.deck-stage {
  position: relative;
  isolation: isolate;
  width: 100%;
  aspect-ratio: 1.32;
  background: radial-gradient(ellipse at 50% 65%, #e1dcd1, #eae6de 60%, #efebe4);
  border: 1px solid #d9d2c6;
  border-radius: 4px;
  overflow: hidden;
}

.deck-card {
  --card-x: 0%;
  --card-y: 0px;
  --card-angle: 0deg;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 68%;
  height: 68%;
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 1px solid #f9f6ef;
  border-radius: 5px;
  background: #f9f6ef;
  box-shadow: 0 5px 12px #29201414, 0 16px 24px -12px #29201438;
  transform-origin: 50% 80%;
  transform: translate(-50%, -50%) translate(var(--card-x), var(--card-y)) rotate(var(--card-angle));
  transition: transform 380ms var(--deck-ease), box-shadow 250ms ease;
  overflow: hidden;
  text-align: left;
  cursor: pointer;
  touch-action: pan-y;
}

.deck-card:nth-child(1) {
  --card-x: -16%;
  --card-y: 13px;
  --card-angle: -10deg;
  z-index: 1;
}

.deck-card:nth-child(2) {
  --card-angle: -1deg;
  --card-y: -10px;
  z-index: 3;
}

.deck-card:nth-child(3) {
  --card-x: 16%;
  --card-y: 13px;
  --card-angle: 10deg;
  z-index: 2;
}

.deck-card.is-active {
  z-index: 10;
  transform-origin: 50% 50%;
  transform: translate(-50%, -50%) scale(1.36);
  box-shadow: 0 5px 15px #2920141c, 0 22px 28px -14px #2920144d;
}

.deck-card-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: 0 0 27px;
  padding: 0 10px;
  font: 9px var(--mono);
  letter-spacing: .03em;
  color: #544b3e;
}

.deck-card-bar > span:first-child { color: #938777; }
.deck-card-bar strong { flex: 1; font-weight: 400; }
.deck-card-bar > span:last-child { color: var(--carmine); }

.deck-card-image {
  display: block;
  width: 100%;
  min-height: 0;
  flex: 1;
  overflow: hidden;
  background: var(--card-paper);
}

.deck-card-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.deck-navigation {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-top: 13px;
}

.deck-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #bcb3a5;
  text-align: left;
  font-size: 12px;
  transition: background 150ms ease, color 150ms ease;
}

.deck-tab span { font: 8px var(--mono); color: #8f8373; }
.deck-tab[aria-pressed="true"] { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.deck-tab[aria-pressed="true"] span { color: #bcb5a8; }
.deck-tab:hover { border-color: var(--carmine); }

.deck-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  min-height: 46px;
}

.deck-bottom p { font-size: 10px; color: #746a5c; line-height: 1.5; }
.deck-touch-hint { display: none; }
#deck-reset { padding: 12px 0 12px 6px; font-size: 10px; white-space: nowrap; }
#deck-reset span { margin-left: 10px; color: var(--carmine); }
#deck-reset[aria-disabled="true"] { color: #968b7b; cursor: default; }

@media (max-width: 1050px) and (min-width: 701px) {
  .deck-stage { aspect-ratio: 1.1; }
  .deck-tab { font-size: 10px; gap: 6px; padding-inline: 8px; }
  .deck-bottom { align-items: flex-start; }
  .deck-bottom p { max-width: 180px; padding-top: 10px; }
}

@media (max-width: 700px) {
  .deck-stage { aspect-ratio: 1.05; }
  .deck-card { width: 68%; height: 68%; }
  .deck-card-bar { flex-basis: 23px; font-size: 8px; padding-inline: 7px; }
  .deck-tab { padding: 10px 8px; gap: 7px; font-size: 11px; }
  .deck-top { font-size: 7px; }
  .deck-bottom { gap: 10px; }
  .deck-bottom p { font-size: 9px; }
  #deck-reset { font-size: 9px; }
}

@media (hover: none), (pointer: coarse) {
  .deck-hover-hint { display: none; }
  .deck-touch-hint { display: inline; }
}

@media (prefers-reduced-motion: reduce) {
  .deck-card, .deck-tab { transition: none; }
}
