.exchange-deck {
  --deck-ink: #294b3b;
  --deck-purple: #82719d;
  --deck-paper: #fbf8ef;
  --deck-edge: #d2d7c8;
  color: var(--deck-ink);
  width: 100%;
  min-width: 0;
}

.exchange-deck *,
.exchange-deck *::before,
.exchange-deck *::after { box-sizing: border-box; }

.exchange-deck button,
.exchange-deck a { -webkit-tap-highlight-color: transparent; }

.exchange-deck button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

.exchange-deck button:focus-visible,
.exchange-deck a:focus-visible {
  outline: 3px solid var(--deck-purple);
  outline-offset: 4px;
}

.exchange-deck .deck-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 8px;
}

.exchange-deck .deck-heading p {
  font-size: 13px;
  line-height: 1.45;
  margin: 0;
}

.exchange-deck .deck-deal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex: 0 0 auto;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid #d5cfdd;
  border-radius: 18px;
  background: #ede7f2;
  font-size: 12px;
  line-height: 1.25;
}

.exchange-deck .deck-deal:disabled { opacity: .5; cursor: default; }

.exchange-deck .deck-hand {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: clamp(4px, 1.2vw, 10px);
  max-width: 550px;
  margin: 0 auto;
  padding: 21px 13px 10px;
  perspective: 1100px;
}

.exchange-deck .deck-hand[data-card-count="1"] { grid-template-columns: minmax(0, 170px); justify-content: center; }
.exchange-deck .deck-hand[data-card-count="2"] { grid-template-columns: repeat(2, minmax(0, 170px)); justify-content: center; }
.exchange-deck .deck-slot { min-width: 0; --deck-angle: 0deg; --deck-lift: 0px; }
.exchange-deck .deck-slot-1 { --deck-angle: -5deg; --deck-lift: 7px; }
.exchange-deck .deck-slot-3 { --deck-angle: 5deg; --deck-lift: 7px; }

.exchange-deck .deck-card {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: .64;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  transform: translateY(var(--deck-lift)) rotate(var(--deck-angle));
  transition: transform 180ms ease;
  perspective: 900px;
  isolation: isolate;
}

.exchange-deck .deck-card-inner {
  position: absolute;
  inset: 0;
  display: block;
  transform-style: preserve-3d;
}

.exchange-deck .deck-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  border: 1px solid var(--deck-edge);
  border-radius: 12px;
  background: var(--deck-paper);
  box-shadow: 0 7px 12px #26433112, 0 1px 2px #26433110;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.exchange-deck .deck-back {
  padding: clamp(8px, 2.2vw, 16px) 6px;
  background: linear-gradient(125deg, #f8f4e9, #eeecdf);
  border-color: #9daa97;
}

.exchange-deck .deck-back::after {
  content: '';
  position: absolute;
  inset: 4px;
  border: 1px solid #bdc6b2;
  border-radius: 8px;
  pointer-events: none;
}

.exchange-deck .deck-back-name {
  font-size: clamp(10px, 2.8vw, 17px);
  font-weight: 600;
  letter-spacing: .16em;
  padding-left: .16em;
}

.exchange-deck .deck-back img {
  width: 88%;
  height: 58%;
  object-fit: contain;
  mix-blend-mode: multiply;
  opacity: .85;
}

.exchange-deck .deck-back-prompt {
  font-size: clamp(6px, 1.6vw, 9px);
  font-weight: 600;
  letter-spacing: .1em;
  line-height: 1.4;
  text-align: center;
}

.exchange-deck .deck-front {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 3px;
  padding: clamp(6px, 1.6vw, 12px);
  text-align: center;
  transform: rotateY(180deg);
}

.exchange-deck .deck-bottle {
  min-height: 0;
  height: 100%;
  width: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.exchange-deck .deck-wine-name {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(11px, 2.8vw, 17px);
  line-height: 1.15;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.exchange-deck .deck-wine-tag {
  font-size: clamp(8px, 1.8vw, 10px);
  line-height: 1.3;
  color: #596958;
}

.exchange-deck .deck-picked-mark {
  display: none;
  position: absolute;
  top: 5px;
  right: 5px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #355b44;
  color: #fff;
  font-size: 12px;
  line-height: 20px;
}

.exchange-deck .is-revealed .deck-card-inner { transform: rotateY(180deg); }
.exchange-deck .is-current .deck-front { border-color: #8d7ba4; }
.exchange-deck .is-picked .deck-front { border-color: #6c896e; background: #f2f5e9; }
.exchange-deck .is-picked .deck-picked-mark { display: block; }

.exchange-deck .deck-keep,
.exchange-deck .deck-turn-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 100%;
  min-height: 44px;
  margin: 13px 0 0;
  padding: 4px 2px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: center;
  font-size: clamp(10px, 2.4vw, 12px);
  line-height: 1.25;
}

.exchange-deck .deck-keep[aria-pressed="true"] { background: #e5eddd; }
.exchange-deck .deck-turn-hint { color: #6b7568; }
.exchange-deck .deck-empty { grid-column: 1 / -1; padding: 30px 10px; text-align: center; }

.exchange-deck .deck-detail {
  border-top: 1px solid #dddccf;
  padding: 17px 0 16px;
  min-height: 115px;
}

.exchange-deck .deck-eyebrow {
  display: block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .13em;
  line-height: 1.5;
  color: #69775f;
}

.exchange-deck .deck-detail h3 {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 25px;
  font-weight: 500;
  line-height: 1.15;
  margin: 6px 0 9px;
}

.exchange-deck .deck-detail p {
  margin: 7px 0 0;
  font-size: 14px;
  line-height: 1.55;
}

.exchange-deck .deck-source {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin-top: 4px;
  font-size: 11px;
  color: #635475;
  text-underline-offset: 3px;
}

.exchange-deck .deck-picks {
  padding: 14px;
  border-radius: 13px;
  background: #efeee5;
}

.exchange-deck .deck-pick-count { margin-left: 5px; }
.exchange-deck .deck-pick-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.exchange-deck .deck-pick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  max-width: 100%;
  padding: 8px 10px;
  border: 1px solid #c8d3be;
  border-radius: 12px;
  background: #f7f8ee;
  font-size: 12px;
  line-height: 1.3;
}

.exchange-deck .deck-pick-remove { margin-left: 3px; color: #78836e; }
.exchange-deck .deck-picks-note { margin: 7px 0 0; font-size: 11px; line-height: 1.45; color: #65705f; }

.exchange-deck .is-flipping .deck-card-inner { animation: inama-card-flip 480ms cubic-bezier(.2, .65, .3, 1) both; }
.exchange-deck.is-dealing .deck-slot { animation: inama-card-deal 400ms cubic-bezier(.2, .65, .3, 1) both; }
.exchange-deck.is-dealing .deck-slot-2 { animation-delay: 45ms; }
.exchange-deck.is-dealing .deck-slot-3 { animation-delay: 90ms; }

@keyframes inama-card-flip {
  from { transform: rotateY(0); }
  to { transform: rotateY(180deg); }
}

@keyframes inama-card-deal {
  from { opacity: 0; transform: translateY(9px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (hover: hover) {
  .exchange-deck .deck-card:hover { transform: translateY(calc(var(--deck-lift) - 5px)) rotate(var(--deck-angle)); }
  .exchange-deck .deck-keep:hover { background: #ecece2; }
  .exchange-deck .deck-deal:hover { background: #e3daec; }
}

@media (max-width: 400px) {
  .exchange-deck .deck-heading { gap: 8px; }
  .exchange-deck .deck-heading p { font-size: 12px; }
  .exchange-deck .deck-deal { font-size: 11px; padding: 6px 8px; }
  .exchange-deck .deck-hand { padding-left: 11px; padding-right: 11px; }
  .exchange-deck .deck-front { padding: 5px; }
  .exchange-deck .deck-detail p { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .exchange-deck *,
  .exchange-deck *::before,
  .exchange-deck *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  .exchange-deck .is-revealed .deck-card-inner { transform: rotateY(180deg); }
}
