:root {
  --bg: #fff8f2;
  --panel: #ffffff;
  --ink: #2a1740;
  --muted: #7a6a8e;
  --line: #f1e3ee;
  --pink: #ff3d9a;
  --violet: #7a4dff;
  --sky: #2bb8ff;
  --gold: #ffb400;
  --cta: linear-gradient(100deg, #ff3d9a, #a44dff 55%, #5a6bff);
  --holo: linear-gradient(100deg, #ff3d9a, #ff9a3d, #ffd23d, #3ddc97, #2bb8ff, #a44dff, #ff3d9a);
  --pastel: linear-gradient(100deg, #ffd6ea, #ffe7c2, #d9ffe6, #cfeaff, #e6d9ff, #ffd6ea);
  --shadow: 0 10px 30px rgba(122, 77, 255, 0.12), 0 2px 6px rgba(42, 23, 64, 0.06);
  --card-radius: 4.75% / 3.4%;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font: 17px/1.5 "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  overflow-x: hidden;
}

@keyframes holo-slide { to { background-position: 200% 50%; } }
@keyframes sheen { 0% { background-position: 120% 0; } 100% { background-position: -80% 0; } }
@keyframes float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -10px; } }
@keyframes twinkle { 0%, 100% { scale: 0.6; opacity: 0.35; } 50% { scale: 1.15; opacity: 1; } }

.wrap { position: relative; max-width: 1020px; margin: 0 auto; padding: 0 18px; }
[hidden] { display: none !important; }

/* ---------- hero ---------- */
.top {
  position: relative;
  padding: 44px 0 110px;
  background:
    radial-gradient(600px 380px at 88% 10%, rgba(255, 255, 255, 0.85), transparent 65%),
    linear-gradient(120deg, #ffd0e6 0%, #ffe3c4 28%, #fff3c9 46%, #d3f7e4 64%, #cfe6ff 82%, #e2d6ff 100%);
  overflow: hidden;
}
.hero { display: grid; grid-template-columns: 1fr auto; gap: 28px; align-items: center; }
.top h1 {
  margin: 0;
  font: 800 clamp(2.3rem, 8vw, 4.7rem)/1.15 "Outfit", system-ui, sans-serif;
  padding-bottom: 0.12em;
  letter-spacing: -0.045em;
  background: linear-gradient(100deg, #ff2e93, #ff7a2e, #a44dff, #2b8cff, #ff2e93);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: holo-slide 7s linear infinite;
}
.tag { margin: 16px 0 0; font-size: clamp(1.5rem, 3.4vw, 2.1rem); font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; }
.sub { margin: 12px 0 0; max-width: 38ch; font-size: 1.12rem; color: #4d3a66; }
.fan { position: relative; width: 400px; height: 290px; animation: float 6s ease-in-out infinite; }
.fan .card { position: absolute; bottom: 0; left: 50%; width: 172px; margin-left: -86px; transform-origin: 50% 100%; }
.fan .card:nth-child(1) { rotate: -14deg; translate: -92px 16px; }
.fan .card:nth-child(2) { rotate: 0deg; z-index: 1; }
.fan .card:nth-child(3) { rotate: 14deg; translate: 92px 16px; }
.spark { position: absolute; color: #fff; font-size: 1.6rem; text-shadow: 0 0 12px #ffb400, 0 0 4px #ff7ad9; animation: twinkle 2.6s ease-in-out infinite; pointer-events: none; }
.spark:nth-of-type(1) { top: 8%; left: 46%; }
.spark:nth-of-type(2) { top: 62%; left: 55%; font-size: 1.1rem; animation-delay: 0.7s; }
.spark:nth-of-type(3) { top: 14%; right: 3%; font-size: 2rem; animation-delay: 1.3s; }
.spark:nth-of-type(4) { top: 78%; left: 2%; font-size: 1.2rem; animation-delay: 1.9s; }

/* ---------- cards and foil ---------- */
.card {
  position: relative;
  display: block;
  aspect-ratio: 146 / 204;
  border-radius: var(--card-radius);
  overflow: hidden;
  background: #e9def5;
  box-shadow: 0 12px 26px rgba(42, 23, 64, 0.28);
  transition: transform 0.25s, box-shadow 0.25s;
}
.card img { display: block; width: 100%; height: 100%; }
.card.shiny { box-shadow: 0 14px 30px rgba(42, 23, 64, 0.3), 0 0 0 3px #fff, 0 0 28px rgba(255, 61, 154, 0.35); }
a.card:hover { transform: translateY(-5px) scale(1.05) rotate(-1.5deg); }
.card.foil::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 20%, rgba(255, 122, 217, 0.6) 36%, rgba(255, 210, 87, 0.55) 44%, rgba(125, 255, 178, 0.5) 52%, rgba(111, 211, 255, 0.6) 60%, rgba(181, 140, 255, 0.55) 68%, transparent 82%);
  background-size: 250% 100%;
  mix-blend-mode: color-dodge;
  opacity: 0.6;
  animation: sheen 5s linear infinite;
  pointer-events: none;
}
.card.shiny::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 42%, rgba(255, 255, 255, 0.45) 50%, transparent 58%);
  background-size: 250% 100%;
  background-position: 120% 0;
  pointer-events: none;
}
.card.shiny:hover::after, .row:hover .card.shiny::after, .style:hover .card::after { animation: sheen 1.1s ease-out; }

/* ---------- panels and inputs ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 22px;
  margin: 16px 0;
  box-shadow: var(--shadow);
}
#inputPanel { margin-top: -78px; padding: 26px; border: 0; box-shadow: 0 24px 60px rgba(164, 77, 255, 0.22), 0 4px 10px rgba(42, 23, 64, 0.06); }
#inputPanel > label { font-size: 1.25rem; font-weight: 700; }
label, .label { font-weight: 600; }
.hint { font-weight: 400; color: var(--muted); }
textarea {
  width: 100%;
  margin-top: 10px;
  padding: 14px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: #fffafd;
  color: var(--ink);
  font: 0.95rem/1.45 ui-monospace, Consolas, monospace;
  resize: vertical;
}
textarea:focus { outline: none; border-color: var(--pink); box-shadow: 0 0 0 4px rgba(255, 61, 154, 0.15); }
select:focus, .btn:focus-visible, .chip:focus-visible { outline: 3px solid rgba(122, 77, 255, 0.45); outline-offset: 2px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 14px; }
#status { color: var(--violet); font-weight: 600; }

.btn {
  position: relative;
  display: inline-block;
  padding: 10px 18px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.btn:hover { border-color: var(--violet); transform: translateY(-2px); }
.btn:disabled { opacity: 0.6; cursor: wait; }
.btn.primary { border: 0; padding: 12px 20px; color: #fff; background: var(--cta); box-shadow: 0 8px 20px rgba(255, 61, 154, 0.35); }
.btn.primary:hover { box-shadow: 0 12px 28px rgba(164, 77, 255, 0.45); }
.btn.primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, 0.55) 50%, transparent 60%);
  background-size: 250% 100%;
  background-position: 120% 0;
}
.btn.primary:hover::after { animation: sheen 0.8s ease-out; }
.btn.big { padding: 16px 32px; font-size: 1.15rem; }
.btn.link { border: 0; background: none; color: var(--violet); padding: 8px 0; text-decoration: underline; text-underline-offset: 3px; }
.btn.small { padding: 6px 13px; font-size: 0.82rem; }

/* ---------- intro (before a deck is loaded) ---------- */
#intro h2 { margin: 44px 0 4px; font-size: 1.9rem; letter-spacing: -0.02em; text-align: center; }
#intro .lead { margin: 0 auto 20px; max-width: 52ch; text-align: center; color: var(--muted); }
.styles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 18px; }
.style { text-align: center; font-weight: 700; }
.style .card { margin-bottom: 12px; }
.style:nth-child(odd) .card { rotate: -2deg; }
.style:nth-child(even) .card { rotate: 2deg; }
.style:hover .card { transform: translateY(-6px) scale(1.04); }
.style small { display: block; font-weight: 400; color: var(--muted); }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 12px; }
.step { background: #fff; border-radius: 24px; padding: 22px; box-shadow: var(--shadow); }
.step b { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: #fff; font-size: 1.2rem; background: var(--cta); margin-bottom: 10px; }
.step h3 { margin: 0 0 4px; font-size: 1.15rem; }
.step p { margin: 0; color: var(--muted); }

/* ---------- progress ---------- */
.progress { display: flex; align-items: center; gap: 14px; margin: 26px 2px 6px; font-weight: 700; font-size: 1.05rem; }
.bar { flex: 1; height: 18px; background: #f3e8f6; border-radius: 99px; overflow: hidden; box-shadow: inset 0 2px 4px rgba(42, 23, 64, 0.08); }
#barFill {
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: var(--holo);
  background-size: 200% 100%;
  animation: holo-slide 4s linear infinite;
  transition: width 0.5s cubic-bezier(0.2, 1.4, 0.4, 1);
}

/* ---------- controls ---------- */
.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 26px; }
.control.wide { grid-column: 1 / -1; }
.control strong { color: var(--pink); font-size: 1.25rem; }
.control input[type="range"] { width: 100%; margin-top: 10px; accent-color: var(--pink); }
select {
  display: block; width: 100%; margin-top: 8px; padding: 10px 14px;
  border: 2px solid var(--line); border-radius: 14px;
  background: #fffafd; color: var(--ink); font: inherit;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chip {
  padding: 7px 15px; border-radius: 99px; border: 2px solid var(--line);
  background: #fff; color: var(--ink); font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer;
  transition: transform 0.12s, border-color 0.12s;
}
.chip:hover { transform: translateY(-2px); border-color: var(--pink); }
.chip[aria-pressed="true"] { border-color: transparent; color: #fff; background: var(--cta); box-shadow: 0 6px 14px rgba(255, 61, 154, 0.3); }
.check { font-weight: 400; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { accent-color: var(--pink); width: 18px; height: 18px; }

.summary { margin: 26px 2px 6px; font-size: 1.4rem; font-weight: 800; letter-spacing: -0.01em; }
.notice { margin: 6px 2px; color: var(--muted); }
.group { margin: 34px 2px 6px; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }

/* ---------- result rows ---------- */
.row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 6px 24px;
  align-items: center;
  background: var(--panel);
  border-radius: 24px;
  padding: 20px;
  margin: 16px 0;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}
.row:hover { transform: translateY(-3px); box-shadow: 0 18px 44px rgba(255, 61, 154, 0.18), 0 2px 6px rgba(42, 23, 64, 0.06); }
.row.dim { box-shadow: none; border: 2px dashed var(--line); background: transparent; }
.row.dim:hover { transform: none; box-shadow: none; }
.glowup { display: flex; align-items: center; gap: 12px; }
.glowup .before { width: 78px; filter: grayscale(0.7) opacity(0.75); box-shadow: 0 4px 10px rgba(42, 23, 64, 0.15); }
.glowup .after { width: 150px; }
.glowup .solo { width: 92px; }
.arrow { font-size: 1.5rem; background: var(--cta); -webkit-background-clip: text; background-clip: text; color: transparent; }
.row h3 { margin: 0; font-size: 1.45rem; font-weight: 800; letter-spacing: -0.02em; }
.qty { color: var(--muted); font-weight: 400; font-size: 1rem; }
.where { color: var(--muted); margin-top: 2px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tagpill {
  --c: 265;
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 0.82rem;
  font-weight: 700;
  color: hsl(var(--c) 75% 32%);
  background: hsl(var(--c) 100% 94%);
}
.t-foil, .t-special { color: var(--ink); background: var(--pastel); background-size: 200% 100%; animation: holo-slide 5s linear infinite; }
.t-etched { --c: 210; }
.t-borderless { --c: 270; }
.t-showcase { --c: 325; }
.t-extended { --c: 170; }
.t-fullart { --c: 200; }
.t-oldborder { --c: 32; }
.t-sld { --c: 355; }
.t-textless { --c: 235; }
.t-promo { --c: 140; }
.rowtools { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 16px; font-size: 0.92rem; }
.buy { display: flex; flex-direction: column; gap: 8px; min-width: 164px; text-align: center; }
.price { font-size: 2.4rem; font-weight: 800; line-height: 1; letter-spacing: -0.03em; }
.price small { display: block; margin-top: 6px; font-size: 0.82rem; font-weight: 400; letter-spacing: 0; color: var(--muted); }

.versions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 20px 16px;
  margin-top: 14px;
  padding-top: 18px;
  border-top: 2px solid var(--line);
}
.ver { font-size: 0.82rem; }
.ver .vprice { font-weight: 800; font-size: 1.1rem; margin-top: 10px; }
.ver .vset { color: var(--muted); }
.ver .vlinks { display: flex; gap: 10px; margin-top: 3px; }
.ver .vlinks a { color: var(--violet); font-weight: 600; }
.more { grid-column: 1 / -1; justify-self: center; }

.foot { margin-top: 56px; padding-bottom: 36px; color: var(--muted); font-size: 0.8rem; }
.foot p { margin: 6px 0; }

@media (max-width: 760px) {
  .top { padding-bottom: 100px; }
  .hero { grid-template-columns: 1fr; }
  .fan { width: 300px; height: 220px; margin: 0 auto; }
  .fan .card { width: 130px; margin-left: -65px; }
  .fan .card:nth-child(1) { translate: -70px 12px; }
  .fan .card:nth-child(3) { translate: 70px 12px; }
  .styles { grid-template-columns: repeat(2, 1fr); }
  .steps, .controls { grid-template-columns: 1fr; }
  .row { grid-template-columns: 1fr; justify-items: start; }
  .glowup .after { width: 130px; }
  .buy { flex-direction: row; flex-wrap: wrap; align-items: center; width: 100%; text-align: left; margin-top: 8px; }
  .buy .price { flex: 1 0 100%; }
  .buy .btn { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- decks ---------- */
.decks { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.deckpill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-radius: 99px; border: 2px solid var(--line);
  background: #fff; color: var(--ink); font: inherit; font-weight: 700; font-size: 0.95rem; cursor: pointer;
  transition: transform 0.12s, border-color 0.12s;
}
.deckpill:hover { transform: translateY(-2px); border-color: var(--pink); }
.deckpill[aria-pressed="true"] { border-color: transparent; color: #fff; background: var(--cta); box-shadow: 0 6px 14px rgba(255, 61, 154, 0.3); }
.deckpill .pct { padding: 1px 8px; border-radius: 99px; font-size: 0.78rem; background: rgba(122, 77, 255, 0.12); }
.deckpill[aria-pressed="true"] .pct { background: rgba(255, 255, 255, 0.28); }
.deckpill.add { border-style: dashed; color: var(--violet); }
.deckname {
  display: block; width: 100%; margin-bottom: 14px; padding: 4px 0;
  border: 0; border-bottom: 2px dashed var(--line); background: none;
  color: var(--ink); font: 800 1.7rem/1.2 "Outfit", system-ui, sans-serif; letter-spacing: -0.02em;
}
.deckname:focus { outline: none; border-bottom-color: var(--pink); }
.btn.quiet { margin-left: auto; color: var(--muted); font-weight: 400; font-size: 0.85rem; }

/* ---------- badges ---------- */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 14px 8px; margin-top: 14px; }
.badge { text-align: center; font-size: 0.85rem; line-height: 1.25; opacity: 0.55; }
.badge b { display: block; }
.badge small { display: block; color: var(--muted); font-size: 0.74rem; }
.medal {
  display: grid; place-items: center; width: 62px; height: 62px; margin: 0 auto 8px;
  border-radius: 50%; font-size: 1.7rem; background: #f3e8f6; filter: grayscale(1);
}
.badge.earned { opacity: 1; }
.badge.earned .medal {
  filter: none; background: var(--pastel); background-size: 200% 100%; animation: holo-slide 5s linear infinite;
  box-shadow: 0 0 0 3px #fff, 0 0 0 5px #ffc94d, 0 8px 18px rgba(255, 180, 0, 0.35);
}

#toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 10;
  padding: 14px 26px; border-radius: 99px; color: #fff; font-weight: 800; font-size: 1.05rem;
  background: var(--cta); box-shadow: 0 14px 34px rgba(164, 77, 255, 0.45);
  translate: -50% 140px; opacity: 0; transition: translate 0.45s cubic-bezier(0.2, 1.4, 0.4, 1), opacity 0.3s;
  pointer-events: none;
}
#toast.show { translate: -50% 0; opacity: 1; }

/* ---------- card blocks: every version on show ---------- */
.block { background: var(--panel); border-radius: 24px; padding: 22px; margin: 18px 0; box-shadow: var(--shadow); }
.block.dim { box-shadow: none; border: 2px dashed var(--line); background: transparent; }
.blockhead { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; }
.blockhead .solo { width: 58px; }
.block h3 { margin: 0; font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; }
.block .versions { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 26px 18px; margin-top: 18px; }
.ver { display: flex; flex-direction: column; font-size: 0.85rem; }
.ver .vprice { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; margin-top: 12px; }
.ver .tags { margin-top: 6px; gap: 4px; }
.ver .tagpill { padding: 2px 8px; font-size: 0.72rem; }
.ver .vbuy { display: flex; flex-direction: column; gap: 6px; margin-top: auto; padding-top: 10px; }
.ver .vbuy .btn:first-child { border: 0; color: #fff; background: var(--cta); box-shadow: 0 5px 12px rgba(255, 61, 154, 0.28); }
.ver .gotit { margin-top: 6px; border-style: dashed; color: var(--muted); font-weight: 600; }
.ver .gotit:hover { color: var(--ink); }
.check + .check { margin-left: 18px; }
@media (max-width: 760px) {
  .block { padding: 16px; }
  .block .versions { grid-template-columns: repeat(2, 1fr); gap: 20px 12px; }
}

/* finish toggle on a version tile */
.finish { display: flex; margin-top: 12px; padding: 3px; border-radius: 99px; background: #f3e8f6; }
.finish button {
  flex: 1; padding: 5px 6px; border: 0; border-radius: 99px; background: none;
  color: var(--muted); font: inherit; font-size: 0.8rem; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.finish button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 2px 6px rgba(42, 23, 64, 0.15); }
.finish button:focus-visible { outline: 3px solid rgba(122, 77, 255, 0.45); }
.finish.one { background: none; }
.finish.one span { flex: 1; padding: 5px 6px; text-align: center; color: var(--muted); font-size: 0.8rem; font-weight: 600; }

/* suggestions for names that matched nothing */
.miss { background: #fff; border-radius: 18px; padding: 14px 18px; margin: 10px 0; box-shadow: var(--shadow); color: var(--ink); }
.miss .chips { margin: 10px 0 2px; }
