/* Card */

.cd-status { max-width: 520px; margin: -6px auto 22px; text-align: center; color: var(--muted); font-weight: 700; line-height: 1.45; }
.cd-status b { color: var(--ink); }

.cd-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ------------------------------------------------------------ table: card + roller */

.cd-table {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin: 0 auto;
}

.cd-card-wrap {
  position: relative;
  flex: none;
  width: clamp(170px, 48vw, 232px);
  aspect-ratio: 250 / 350;
  perspective: 1100px;
  transition: opacity .15s, transform .15s;
}
.cd-card-wrap.gone { opacity: 0; transform: translateY(12px) scale(.96); }
.cd-card-wrap.deal { animation: cd-deal .5s cubic-bezier(.25, 1.3, .5, 1) both; }
@keyframes cd-deal { from { opacity: 0; transform: translate(70px, -50px) rotate(14deg) scale(.8); } }

.cd-tilt {
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform .2s ease-out;
}
.cd-tilt.up { animation: cd-up .45s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes cd-up { 40% { transform: scale(1.07) rotate(-2deg); } }

.cd-card {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform .55s cubic-bezier(.4, .1, .25, 1);
  cursor: default;
}
.cd-card.flipped { transform: rotateY(180deg); }
.cd-card.instant { transition: none; }
.cd-card[title] { cursor: pointer; }
.cd-app.quick .cd-card { transition-duration: .16s; }

.cd-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: 0 6px 0 rgba(29, 27, 22, .9), 0 18px 30px -14px rgba(29, 27, 22, .45);
  border-radius: 14px;
}
.cd-back { transform: rotateY(180deg); background: #fff; border: 2.5px solid var(--ink); overflow: hidden; }
.cd-svg { display: block; width: 100%; height: 100%; }

/* the front, shared by the big card and the little ones on the shelf */
.cd-front {
  position: absolute;
  inset: 0;
  background: #fff;
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  overflow: hidden;
  isolation: isolate;
}
.cd-front > * { position: absolute; inset: 0; }
.cd-front .cd-svg { position: relative; }

/* tier materials */
[data-tier=silver] .cd-front {
  background: linear-gradient(135deg, #f4f6f9 0%, #cdd3dc 28%, #fbfcfd 48%, #b7bfca 70%, #eef1f5 100%);
}
[data-tier=gold] .cd-front {
  background: linear-gradient(135deg, #fff3c2 0%, #f0c445 28%, #fff7d6 48%, #d9a21c 72%, #ffe596 100%);
}
[data-tier=diamond] .cd-front {
  background:
    repeating-linear-gradient(60deg, rgba(255, 255, 255, .55) 0 2px, transparent 2px 26px),
    repeating-linear-gradient(-60deg, rgba(120, 190, 255, .35) 0 2px, transparent 2px 26px),
    linear-gradient(135deg, #e6fbff 0%, #a9e6ff 28%, #ffffff 48%, #9ccfff 70%, #e3f3ff 100%);
}
/* dark matter (Dark Matter token only): violet, with stars, light enough in the middle that the pips still read */
[data-tier=darkmatter] .cd-front {
  background:
    radial-gradient(1.5px 1.5px at 18% 22%, #fff 99%, transparent),
    radial-gradient(1px 1px at 72% 14%, #fff 99%, transparent),
    radial-gradient(1.5px 1.5px at 84% 64%, #fff 99%, transparent),
    radial-gradient(1px 1px at 30% 80%, #fff 99%, transparent),
    radial-gradient(1px 1px at 60% 90%, #fff 99%, transparent),
    radial-gradient(1.5px 1.5px at 10% 55%, #fff 99%, transparent),
    radial-gradient(ellipse at 50% 50%, #f1ebff 0%, #cdb9ff 42%, #8a66ea 78%, #4b2a9c 100%);
}
[data-tier=silver] .cd-front::after,
[data-tier=gold] .cd-front::after,
[data-tier=diamond] .cd-front::after,
[data-tier=darkmatter] .cd-front::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .75) 48%, transparent 60%);
  background-size: 300% 100%;
  animation: cd-sweep 3.2s ease-in-out infinite;
  pointer-events: none;
}
[data-tier=diamond] .cd-front::after { animation-duration: 2.2s; }
[data-tier=darkmatter] .cd-front::after {
  background: linear-gradient(105deg, transparent 30%, rgba(199, 178, 255, .8) 44%, rgba(255, 255, 255, .9) 50%, rgba(123, 77, 255, .5) 56%, transparent 68%);
  background-size: 300% 100%;
  animation-duration: 1.8s;
}
@keyframes cd-sweep { 0% { background-position: 120% 0; } 60%, 100% { background-position: -20% 0; } }

/* holo: a tint that multiplies over the white of the card and drifts */
.cd-holo {
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: multiply;
  background-size: 260% 260%;
  transition: opacity .3s;
}
[data-holo] .cd-holo { opacity: 1; animation: cd-holo 4s ease-in-out infinite alternate; }
@keyframes cd-holo { from { background-position: 0% 0%; } to { background-position: 100% 100%; } }
[data-holo=glimmer] .cd-holo { background-image: linear-gradient(115deg, #fff 15%, #e6eeff 32%, #fff 48%, #fbe6ff 64%, #fff 80%, #e6fff6 95%); }
[data-holo=aqua] .cd-holo { background-image: linear-gradient(115deg, #d8fbff 10%, #9feaf2 30%, #e0fff8 50%, #8fd8f5 70%, #dcf7ff 90%); }
[data-holo=rose] .cd-holo { background-image: linear-gradient(115deg, #ffe0ec 10%, #ffb3cf 30%, #fff0f5 50%, #ffa3c4 70%, #ffe3ee 90%); }
[data-holo=emerald] .cd-holo { background-image: linear-gradient(115deg, #dcfbe6 10%, #8eeab4 30%, #e8fff0 50%, #6fdc9f 70%, #d5f9e2 90%); }
[data-holo=sunset] .cd-holo { background-image: linear-gradient(115deg, #ffe1b8 10%, #ffad9c 30%, #fff3b0 50%, #ff9fb8 70%, #ffd29a 90%); }
[data-holo=aurora] .cd-holo { background-image: linear-gradient(115deg, #b9fbc0 5%, #98f5e1 25%, #a3c4f3 45%, #f1c0e8 65%, #b9fbc0 85%); }
[data-holo=prism] .cd-holo { background-image: linear-gradient(115deg, #ffadad, #ffd6a5, #fdffb6, #caffbf, #9bf6ff, #a0c4ff, #bdb2ff, #ffc6ff, #ffadad); }
[data-holo=cosmic] .cd-holo {
  background-image:
    radial-gradient(circle at 20% 25%, #fff 0 1px, transparent 2px),
    radial-gradient(circle at 70% 60%, #fff 0 1px, transparent 2px),
    linear-gradient(115deg, #d8b4fe, #93c5fd, #f9a8d4, #fde68a, #a5f3fc, #c4b5fd, #f9a8d4, #d8b4fe);
  background-size: 34px 34px, 46px 46px, 260% 260%;
}

.cd-glare {
  pointer-events: none;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 30%), rgba(255, 255, 255, .7), transparent 45%);
  mix-blend-mode: soft-light;
  opacity: 0;
  transition: opacity .25s;
}
.cd-card-wrap:hover .cd-glare { opacity: .7; }
.cd-card-wrap:hover [data-holo] .cd-glare { opacity: 1; }

.cd-flash { pointer-events: none; background: #fff; opacity: 0; }

.cd-tilt.up .cd-flash { animation: cd-flash .5s ease-out; }
@keyframes cd-flash { from { opacity: .9; } }

/* ------------------------------------------------------------ the roller next to the card */

.cd-roller {
  flex: none;
  width: 104px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}
.cd-roll-label {
  font: 600 .92rem/1.2 var(--font-display);
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}
.cd-roll-note {
  min-height: 2.8em;
  font-weight: 700;
  font-size: .92rem;
  line-height: 1.35;
  color: var(--muted);
}
.cd-roll-note.ok { color: var(--good); }
.cd-roll-note.no { color: var(--bad); }

.cd-die {
  width: 74px;
  height: 74px;
  padding: 11px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  place-items: center;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 18px;
  box-shadow: 0 5px 0 var(--ink);
  transition: opacity .2s, outline-color .2s;
  outline: 4px solid transparent;
  outline-offset: 3px;
}
.cd-die i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ink);
  opacity: 0;
  transform: scale(.4);
}
.cd-die i.on { opacity: 1; transform: none; }
.cd-die[data-kind=silver] { background: linear-gradient(135deg, #f7f8fa, #c3cad4 45%, #f3f5f8 60%, #aeb6c2); }
.cd-die[data-kind=gold] { background: linear-gradient(135deg, #fff1b8, #edb92e 45%, #fff3c4 60%, #c8901a); }
.cd-die[data-kind=diamond] { background: linear-gradient(135deg, #e6fbff, #9ccfff 45%, #ffffff 60%, #7fb8ff); }
.cd-die.idle { opacity: .35; }
.cd-die.rolling { animation: cd-shake .16s linear infinite; }
.cd-die.land { animation: cd-land .35s cubic-bezier(.3, 1.6, .5, 1); }
.cd-die.pass { outline-color: var(--good); }
.cd-die.fail { outline-color: var(--bad); }
@keyframes cd-shake {
  0% { transform: translate(-3px, 1px) rotate(-9deg); }
  25% { transform: translate(2px, -3px) rotate(6deg); }
  50% { transform: translate(3px, 2px) rotate(10deg); }
  75% { transform: translate(-2px, -2px) rotate(-5deg); }
  100% { transform: translate(-3px, 1px) rotate(-9deg); }
}
@keyframes cd-land { 0% { transform: scale(1.25); } }

.cd-slot {
  min-width: 96px;
  height: 74px;
  padding: 0 8px;
  display: grid;
  place-items: center;
  font: 700 1.45rem/1 var(--font-display);
  white-space: nowrap;
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 18px;
  box-shadow: 0 5px 0 var(--ink);
  overflow: hidden;
}
.cd-slot.long { font-size: 1.05rem; }
.cd-slot-sym { width: 48px; height: 48px; }

/* ------------------------------------------------------------ buttons */

.cd-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin: 34px 0 30px;
}
.cd-options { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px 22px; }
.cd-quick { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; color: var(--muted); cursor: pointer; user-select: none; }
.cd-fun-btn { margin-top: -4px; }
.cd-fun-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; }
.cd-quick input { width: 18px; height: 18px; accent-color: var(--ink); margin: 0; }

/* ------------------------------------------------------------ result */

.cd-result-head { text-align: center; margin-bottom: 10px; }
.cd-name { font: 600 1.3rem/1.2 var(--font-display); }
.cd-value { font: 700 clamp(2.6rem, 10vw, 3.6rem)/1.05 var(--font-display); letter-spacing: -.02em; margin: 4px 0; }
.cd-standing { color: var(--muted); font-weight: 700; }
.cd-standing { margin: 6px 0 8px; }
.cd-standing .badge { font-size: .95rem; }
.cd-trillion { max-width: 460px; margin: 0 auto 8px; font-size: .95rem; color: var(--muted); }
.cd-trillion b, .cd-m-stand b { color: var(--ink); }
.cd-price { font-weight: 700; }
.muted { color: var(--muted); }
.ok { color: var(--good); }

/* keep / sell / auction / share, right after a roll */
.cd-after { text-align: center; }
.cd-after-q { margin: 0 0 10px; font: 600 1.1rem/1.2 var(--font-display); }
.cd-after-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

.cd-steps { list-style: none; margin: 0 0 14px; padding: 0; }
.cd-steps li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 2px;
  border-bottom: 1.5px dashed var(--line);
  animation: cd-step .25s ease both;
}
.cd-steps li:last-child { border-bottom: 0; }
.cd-steps .k { flex: none; width: 7.2em; font: 600 .95rem/1.2 var(--font-display); color: var(--muted); }
.cd-steps .v { flex: 1; min-width: 0; }
.cd-steps .ok { color: var(--good); }
.cd-steps .no { color: var(--bad); font-weight: 700; }
@keyframes cd-step { from { opacity: 0; transform: translateX(-8px); } }

.cd-math { width: 100%; border-collapse: collapse; font-size: .95rem; background: var(--soft); border-radius: 14px; overflow: hidden; }
.cd-math td { padding: 7px 12px; }
.cd-math td:nth-child(2) { color: var(--muted); font-weight: 700; }
.cd-math td:last-child { text-align: right; font: 600 1rem/1.2 var(--font-display); white-space: nowrap; }
.cd-math tr.none { opacity: .45; }
.cd-math tfoot td { border-top: 2px solid var(--ink); font: 700 1.2rem/1.2 var(--font-display); padding-top: 10px; padding-bottom: 10px; }

/* ------------------------------------------------------------ tabs: recent draws, my cards, auction house */

.cd-lists .tabs { margin-bottom: 16px; }
.cd-tab-note { margin: 0 0 16px; color: var(--muted); font-weight: 600; }
.cd-tab-note b, .cd-tab-note a { color: var(--ink); }
.cd-h3 { font: 600 1.15rem/1.2 var(--font-display); margin: 24px 0 10px; }
.cd-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 16px 12px; }
.cd-mini {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  font: 600 .9rem/1 var(--font-display);
  transition: transform .2s cubic-bezier(.3, 1.6, .5, 1);
}
.cd-mini:hover { transform: translateY(-4px) rotate(-2deg); }
.cd-mini:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; border-radius: 10px; }
.cd-mini-v { font: 700 .95rem/1 var(--font-display); }
.cd-mini-sub { font: 700 .72rem/1.2 var(--font-body, inherit); color: var(--muted); text-align: center; overflow-wrap: anywhere; }
.cd-mini-card { position: relative; width: 100%; aspect-ratio: 250 / 350; }
.cd-mini-card .cd-front,
.cd-back-flat { border-width: 2px; border-radius: 8px; box-shadow: 0 3px 0 var(--ink); }
.cd-back-flat { position: absolute; inset: 0; border: 2px solid var(--ink); overflow: hidden; background: #fff; }
.cd-mini-card.big { width: min(180px, 38vw); }
.cd-mini-card.big .cd-front,
.cd-mini-card.big .cd-back-flat { border-width: 2.5px; border-radius: 12px; box-shadow: 0 5px 0 var(--ink); }
.cd-pair { display: flex; justify-content: center; gap: 16px; margin: 4px 0 18px; }

.cd-auc-list { list-style: none; margin: 0; padding: 0; }
.cd-auc { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1.5px dashed var(--line); }
.cd-auc:last-child { border-bottom: 0; }
.cd-auc-card { flex: none; width: 58px; padding: 0; border: 0; background: none; cursor: pointer; }
.cd-auc-info { flex: 1; min-width: 0; line-height: 1.45; overflow-wrap: anywhere; }

/* one card, big (modal) */
.cd-m-sub { margin-top: -4px; color: var(--muted); font-weight: 600; }
.cd-m-sub b, .cd-m-sub a { color: var(--ink); }
.cd-m-stand { text-align: center; color: var(--muted); font-size: .95rem; }
.cd-m-btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.cd-m-note { margin-top: 16px; font-weight: 700; color: var(--muted); }
.cd-auc-box { margin-top: 16px; padding: 14px; background: var(--soft); border-radius: 14px; line-height: 1.5; }
.cd-bid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.cd-bid .input { width: 130px; flex: none; }
.cd-m-share { display: flex; gap: 8px; margin-top: 18px; }
.cd-m-share .input { flex: 1; min-width: 0; font-size: .85rem; }
.cd-lbl { display: block; margin: 0 0 12px; font-weight: 700; }
.cd-lbl .input { margin-top: 4px; width: 100%; }

/* ------------------------------------------------------------ odds */

.cd-odds { width: 100%; border-collapse: collapse; font-size: .95rem; }
.cd-odds td { padding: 5px 6px; border-bottom: 1px solid var(--line); }
.cd-odds td:first-child { font-weight: 700; }
.cd-odds td:nth-child(2) { color: var(--muted); font-weight: 700; }
.cd-odds td:last-child { text-align: right; }
.cd-odds-sym { width: 22px; height: 22px; vertical-align: -5px; margin-right: 4px; }
.cd-odds thead td { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-bottom: 2px solid var(--ink); }
.cd-odds + .cd-odds { margin-top: 14px; }
.cd-odds-note { font-size: .95rem; color: var(--muted); }
.cd-odds-note b { color: var(--ink); }
.modal h3 { font: 600 1.1rem/1.2 var(--font-display); margin: 20px 0 6px; }

@media (max-width: 560px) {
  .cd-table { gap: 12px; }
  .cd-roller { width: 96px; }
  .cd-steps .k { width: 6.2em; }
  .cd-math td { padding: 6px 8px; }
}

/* the small "this roll is for fun" line at the bottom of a fun roll */
.cd-fun-foot { margin: 14px 0 0; text-align: center; font-size: .85rem; color: var(--muted); }

/* ------------------------------------------------------------ tokens */

.cd-tchip { width: 22px; height: 22px; flex: none; vertical-align: middle; }
.cd-tokbar { width: 100%; max-width: 560px; margin: 0 auto; text-align: center; }
.cd-tokbar-h { margin-bottom: 6px; font-weight: 700; font-size: .9rem; }
.cd-tokbar-h .muted { font-weight: 600; }
.cd-tslots { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.cd-tslot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px 5px 6px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  line-height: 1.15;
  text-align: left;
}
.cd-tslot .cd-tchip { width: 28px; height: 28px; }
.cd-tslot small { display: block; color: var(--muted); font-weight: 700; font-size: .75rem; }
.cd-tslot.add { padding: 9px 16px; border-style: dashed; font-weight: 700; cursor: pointer; }
.cd-tslot.add:hover { background: var(--soft); }
.cd-tx { border: 0; background: none; color: var(--muted); font-size: 1.15rem; line-height: 1; padding: 2px 6px; cursor: pointer; border-radius: 50%; }
.cd-tx:hover { color: var(--ink); background: var(--soft); }
.cd-tpick { display: grid; gap: 8px; margin: 12px 0; }
.cd-tpick-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
}
.cd-tpick-row:hover { border-color: var(--ink); }
.cd-tpick-row .cd-tchip { width: 34px; height: 34px; }
.cd-tstep { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.cd-tstep .cd-tchip { width: 18px; height: 18px; }
.cd-odds-tok { margin-top: 16px; }
.cd-odds-tok summary { font: 600 1.05rem/1.3 var(--font-display); cursor: pointer; }
.cd-odds-tok .cd-odds td:nth-child(3), .cd-odds-tok .cd-odds td:nth-child(4) { white-space: nowrap; }

/* ------------------------------------------------------------ card details (right-click) */

.cd-adv-top { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 18px; margin-bottom: 14px; }
.cd-adv-top .cd-mini-card.big { width: min(150px, 34vw); flex: none; }
.cd-adv-info { flex: 1 1 220px; min-width: 0; }
.cd-adv-name { font: 600 1.25rem/1.2 var(--font-display); margin-bottom: 8px; }
.cd-sn { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.cd-sn code, .cd-adv code { padding: 2px 6px; border-radius: 6px; background: var(--soft); font-size: .9em; overflow-wrap: anywhere; }
.cd-sn code { font-size: 1.05rem; font-weight: 700; letter-spacing: .03em; }
.cd-sn-out { min-height: 1.4em; margin-top: 6px; font-weight: 700; }
.cd-sn-out.ok { color: var(--good); }
.cd-sn-out.no { color: var(--bad); }
.cd-adv-who { color: var(--muted); font-weight: 600; font-size: .92rem; line-height: 1.45; }
.cd-adv-parts td:nth-child(3) { white-space: nowrap; }
.cd-adv-combo { margin: 12px 0 0; }
.cd-adv-raw { margin-top: 12px; }
.cd-adv-raw summary { font-weight: 700; cursor: pointer; }
.cd-adv-raw pre { max-height: 260px; overflow: auto; margin: 8px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--soft); font-size: .8rem; line-height: 1.4; }
.cd-adv-check { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1.5px dashed var(--line); }
.cd-adv-check .cd-lbl { flex: 1 1 220px; margin: 0; }
.cd-adv-check .error { flex-basis: 100%; margin: 0; }
@media (max-width: 560px) {
  .cd-adv-parts { font-size: .85rem; }
  .cd-adv-parts td { padding: 4px 3px; }
  .cd-adv-parts td:nth-child(3) { display: none; } /* raw values are in Raw data below */
}
