:root {
  --bg: #0e1116;
  --surface: #161b22;
  --surface-2: #1d242d;
  --border: #2a323d;
  --text: #e6edf3;
  --muted: #8b98a8;
  --accent: #ff5a36;
  --accent-2: #ffb02e;
  --good: #3ecf8e;
  --radius: 12px;
  --max: 1080px;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7f8fa;
    --surface: #ffffff;
    --surface-2: #eef1f5;
    --border: #d9dee6;
    --text: #14181f;
    --muted: #5b6676;
    --accent: #e8431e;
    --accent-2: #b97700;
    --good: #12805a;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
header.site { border-bottom: 1px solid var(--border); background: var(--surface); }
header.site .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 58px; }
.brand { font-weight: 800; font-size: 20px; letter-spacing: -0.02em; color: var(--text); }
.brand span { color: var(--accent); }
nav.main { display: flex; gap: 18px; font-size: 15px; }
nav.main a { color: var(--muted); }
nav.main a:hover { color: var(--text); text-decoration: none; }
main { padding: 28px 0 56px; }
h1 { font-size: clamp(26px, 4vw, 38px); line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 10px; }
h2 { font-size: 22px; margin: 36px 0 12px; letter-spacing: -0.01em; }
h3 { font-size: 17px; margin: 22px 0 8px; }
p.lead { color: var(--muted); font-size: 18px; max-width: 70ch; margin: 0 0 20px; }
.muted { color: var(--muted); }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.grid-sets { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.set-tile { display: flex; flex-direction: column; gap: 8px; color: var(--text); }
.set-tile { transition: transform .15s, border-color .15s; }
.set-tile:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-2px); }
.set-tile img { height: 56px; width: auto; max-width: 100%; object-fit: contain; align-self: flex-start; }
.set-tile .name { font-weight: 700; }
.set-tile .meta { font-size: 13px; color: var(--muted); }
.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 11px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
select {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  max-width: 100%;
}
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.notice {
  border: 1px solid var(--accent-2);
  background: color-mix(in srgb, var(--accent-2) 10%, transparent);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 14px;
  margin: 14px 0;
}
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 14px; }
.crumbs a { color: var(--muted); }

/* Simulator */
.sim { margin: 4px 0 0; }
.sim-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sim-controls select { flex: 1 1 260px; max-width: 420px; }
.sim-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn.sm { padding: 8px 12px; font-size: 14px; border-radius: 9px; }
.btn.big { padding: 14px 26px; font-size: 17px; border-radius: 12px; box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn.ghost:hover { color: var(--text); }
.center { display: flex; justify-content: center; margin-top: 18px; }

.stage {
  position: relative;
  min-height: 460px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 22px 8px;
  border-radius: var(--radius);
  background:
    radial-gradient(ellipse at 50% 35%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 62%),
    var(--stage-bg, #0a0d12);
  overflow: hidden;
}
@media (prefers-color-scheme: light) { .stage { --stage-bg: #1b2230; color: #e6edf3; } }
.stage .empty { color: #8b98a8; }

/* Sealed pack */
.pack-wrap { perspective: 900px; }
.pack {
  --tear: 0; --rx: 0deg; --ry: 0deg; --mx: 50%; --my: 30%;
  position: relative; width: 210px; aspect-ratio: 210 / 340;
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform .25s ease;
  cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
  filter: drop-shadow(0 18px 30px rgba(0,0,0,.55));
  animation: float 3.2s ease-in-out infinite;
}
.pack.tilting, .pack.pressing { animation: none; transition: transform .05s linear; }
.pack.pressing { cursor: grabbing; }
.pack:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 6px; border-radius: 14px; }
@keyframes float { 50% { transform: translateY(-8px) rotate(-1deg); } }
.pack-body, .pack-top {
  position: absolute; inset: 0; border-radius: 12px; overflow: hidden;
  background:
    linear-gradient(115deg, transparent 20%, rgba(255,255,255,.28) 38%, transparent 52%),
    conic-gradient(from 210deg at 30% 30%, #ff5a36, #ffb02e, #ffd86b, #6f5bff, #2bd2ff, #ff5a36);
}
.pack-body { clip-path: inset(15% 0 0 0 round 0 0 12px 12px); }
.pack-top { clip-path: inset(0 0 85% 0 round 12px 12px 0 0); transition: transform .5s cubic-bezier(.3,1.4,.5,1), opacity .5s; transform-origin: 90% 15%; }
/* crimped edges */
.pack-body::before, .pack-top::before {
  content: ""; position: absolute; left: 0; right: 0; height: 12px;
  background: repeating-linear-gradient(90deg, rgba(0,0,0,.25) 0 3px, rgba(255,255,255,.18) 3px 6px);
}
.pack-top::before { top: 0; }
.pack-body::before { bottom: 0; }
.pack-art { position: absolute; inset: 0; display: grid; place-items: center; }
.pack-art img { width: 78%; max-height: 32%; object-fit: contain; filter: drop-shadow(0 3px 6px rgba(0,0,0,.45)); }
.pack-name { color: #fff; font-weight: 900; font-size: 22px; text-align: center; padding: 0 16px; text-shadow: 0 2px 8px rgba(0,0,0,.5); }
.pack-brand { position: absolute; bottom: 22px; font-size: 12px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; color: rgba(255,255,255,.85); }
.pack-cut {
  position: absolute; left: 0; top: 15%; height: 3px; width: calc(var(--tear) * 100%);
  background: linear-gradient(90deg, #fff, #ffd86b); box-shadow: 0 0 12px #fff, 0 0 4px #ffb02e; border-radius: 2px;
  pointer-events: none;
}
.pack-cut::after { /* dashed guide where to tear */
  content: ""; position: absolute; left: 0; top: 1px; width: 210px; border-top: 2px dashed rgba(255,255,255,.55);
  opacity: calc(1 - var(--tear) * 4); z-index: -1;
}
.pack-glare {
  position: absolute; inset: 0; border-radius: 12px; pointer-events: none; mix-blend-mode: overlay;
  background: radial-gradient(circle at var(--mx) var(--my), rgba(255,255,255,.65), transparent 45%);
}
.pack.ripped { animation: none; }
.pack.ripped .pack-top { transform: translate(60px, -90px) rotate(24deg); opacity: 0; }
.pack.ripped .pack-body { transition: transform .45s .15s ease-in, opacity .45s .15s; transform: translateY(40px) scale(.96); opacity: 0; }
.pack.ripped .pack-cut, .pack.ripped .pack-glare { opacity: 0; }
.rip-hint { margin: 18px 0 0; font-size: 14px; color: #aab6c5; text-align: center; }
.rip-hint .swipe { display: inline-block; animation: swipe 1.6s ease-in-out infinite; color: var(--accent-2); font-weight: 800; margin-right: 6px; }
@keyframes swipe { 0%,100% { transform: translateX(-6px); opacity: .5; } 50% { transform: translateX(8px); opacity: 1; } }

/* Reveal */
.reveal { display: flex; gap: 26px; align-items: center; justify-content: center; flex-wrap: wrap; }
.stack { position: relative; width: 250px; aspect-ratio: 5 / 7; cursor: pointer; perspective: 900px; }
.stack:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 6px; border-radius: 12px; }
.card-back {
  position: absolute; inset: 0; border-radius: 11px;
  transform: translate(calc(var(--k) * 4px), calc(var(--k) * -4px));
  background:
    radial-gradient(circle at 50% 50%, rgba(255,255,255,.14) 0 22%, transparent 23%),
    repeating-linear-gradient(45deg, #2a3242 0 8px, #222938 8px 16px);
  border: 3px solid #3a4457; box-shadow: 0 10px 22px rgba(0,0,0,.45);
  display: grid; place-items: center; color: rgba(255,255,255,.75); font-weight: 900; letter-spacing: .06em;
  transition: transform .2s;
}
.stack:hover .card-back:first-child { transform: translate(-2px, -6px); }
.stack.last .card-back { animation: shake .5s ease-in-out infinite; }
.stack.glow .card-back { box-shadow: 0 0 0 2px #ffd86b, 0 0 34px 8px rgba(255, 196, 64, .7); animation: shake .35s ease-in-out infinite; }
@keyframes shake { 25% { rotate: -1.5deg; } 75% { rotate: 1.5deg; } }
.flipin { position: absolute; inset: 0; animation: flipin .42s cubic-bezier(.2,.9,.3,1.2); }
.flipin.big { animation: flipin-big .9s cubic-bezier(.2,.9,.3,1.1); }
.flipin .tcg { width: 100%; height: 100%; }
@keyframes flipin { from { transform: rotateY(90deg) scale(.9); } to { transform: none; } }
@keyframes flipin-big { 0% { transform: rotateY(180deg) scale(.7); filter: brightness(3); } 60% { transform: rotateY(0) scale(1.08); filter: brightness(1.4); } 100% { transform: none; } }
.reveal-side { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; max-width: 300px; }
.counter { font-size: 13px; color: #aab6c5; font-variant-numeric: tabular-nums; }
.strip { display: grid; grid-template-columns: repeat(5, 52px); gap: 6px; min-height: 73px; }

/* Card faces */
.tcg {
  --rx: 0deg; --ry: 0deg; --mx: 50%; --my: 50%;
  position: relative; border-radius: 4.5% / 3.2%; overflow: hidden; aspect-ratio: 5 / 7;
  background: #1d242d; transform: perspective(700px) rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform .3s ease, box-shadow .3s;
  box-shadow: 0 6px 16px rgba(0,0,0,.4);
}
.tcg.tilting { transition: transform .06s linear; }
.tcg img { width: 100%; height: 100%; object-fit: cover; display: block; user-select: none; -webkit-user-drag: none; }
.tcg .fallback { display: flex; flex-direction: column; justify-content: center; height: 100%; padding: 10px; font-size: 13px; font-weight: 700; color: #e6edf3; text-align: center; }
.tcg .fallback small { font-weight: 400; color: #8b98a8; margin-top: 4px; }
.tcg .shine { position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen; }
/* Foil: a rainbow band that sweeps across on its own; on tilt it follows the pointer and adds a glare. */
.tcg.reverse .shine, .tcg.rare-slot .shine, .tcg.hit .shine {
  background-image: linear-gradient(115deg, transparent 30%, rgba(255,90,54,.55) 38%, rgba(255,216,107,.65) 44%, rgba(107,255,157,.55) 50%, rgba(43,210,255,.65) 56%, rgba(179,107,255,.55) 62%, transparent 70%);
  background-size: 300% 300%;
  background-position: 100% 100%;
  animation: sheen 3.2s ease-in-out infinite;
}
.tcg.reverse .shine { opacity: .6; }
.tcg.rare-slot .shine { opacity: .45; }
.tcg.hit .shine { opacity: .8; animation-duration: 2.4s; }
.tcg.tilting .shine {
  animation: none; opacity: .9;
  background-image: radial-gradient(circle at var(--mx) var(--my), rgba(255,255,255,.45), transparent 40%),
    linear-gradient(115deg, transparent 30%, rgba(255,90,54,.55) 38%, rgba(255,216,107,.65) 44%, rgba(107,255,157,.55) 50%, rgba(43,210,255,.65) 56%, rgba(179,107,255,.55) 62%, transparent 70%);
  background-size: 100% 100%, 300% 300%;
  background-position: center, var(--mx) var(--my);
}
@keyframes sheen { 0% { background-position: 100% 100%; } 75%, 100% { background-position: 0% 0%; } }
.tcg.reverse { box-shadow: 0 0 0 2px rgba(160, 220, 255, .75), 0 0 16px rgba(120, 200, 255, .45), 0 6px 16px rgba(0,0,0,.4); }
.tcg.rare-slot { box-shadow: 0 0 0 2px #e6edf3, 0 0 14px rgba(255,255,255,.35), 0 6px 16px rgba(0,0,0,.4); }
.tcg.reverse .tag { background: linear-gradient(90deg, #2bd2ff, #b36bff); color: #fff; font-weight: 800; }
.tcg.rare-slot .tag { background: #e6edf3; color: #14181f; font-weight: 800; }
.tcg.hit { box-shadow: 0 0 0 2px #ffd86b, 0 0 22px rgba(255, 196, 64, .55), 0 8px 18px rgba(0,0,0,.45); }
.tcg.tier-3 { box-shadow: 0 0 0 2px #fff3c4, 0 0 34px 6px rgba(255, 196, 64, .8), 0 8px 18px rgba(0,0,0,.45); }
.tcg .tag {
  position: absolute; left: 6px; bottom: 6px; max-width: calc(100% - 12px);
  background: rgba(0,0,0,.75); color: #fff; font-size: 11px; padding: 2px 7px; border-radius: 6px; line-height: 1.35;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tcg.hit .tag { background: linear-gradient(90deg, #ff5a36, #ffb02e); color: #1a0f00; font-weight: 800; }
.tcg.xs { border-radius: 5px; box-shadow: none; }
.tcg.xs .tag { display: none; }

/* Result */
.result-line { font-size: clamp(19px, 2.4vw, 26px); font-weight: 900; letter-spacing: -0.01em; margin: 0 0 20px; text-align: center; color: #e6edf3; padding: 0 8px; }
.result-line.good { color: #ffd86b; }
.pack-result { display: grid; grid-template-columns: repeat(5, minmax(0, 172px)); gap: 20px 16px; justify-content: center; width: 100%; }
.rc { margin: 0; animation: pop .35s backwards; animation-delay: calc(var(--i, 0) * 40ms); }
.rc figcaption { margin-top: 8px; text-align: center; line-height: 1.3; }
.rc figcaption b { display: block; font-size: 14px; color: #e6edf3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc figcaption span { font-size: 12px; color: #8b98a8; }
.rc.hit figcaption b { color: #ffd86b; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }

.stats { display: flex; flex-wrap: wrap; gap: 26px; margin: 16px 0 0; font-size: 14px; color: var(--muted); }
.stat b { font-size: 22px; display: block; line-height: 1.1; color: var(--text); font-variant-numeric: tabular-nums; }
.sim-note { font-size: 13px; margin: 10px 0 0; }
.hit-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-top: 10px; }
.empty { color: var(--muted); padding: 40px 0; text-align: center; grid-column: 1 / -1; }
@media (max-width: 640px) {
  .stage { min-height: 420px; padding: 18px 4px; }
  .pack { width: 180px; }
  .pack-cut::after { width: 180px; }
  .stack { width: 190px; }
  .reveal { gap: 14px; flex-direction: column; }
  .reveal-side { align-items: center; }
  .pack-result { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 8px; }
  .pack-result .tcg .tag { display: none; }
  .rc figcaption b { font-size: 12px; }
  .rc figcaption span { font-size: 11px; }
  .strip { grid-template-columns: repeat(5, 44px); }
}
@media (prefers-reduced-motion: reduce) {
  .tcg .shine,
  .pack, .rip-hint .swipe, .stack.last .card-back, .stack.glow .card-back, .flipin, .pack-result .tcg { animation: none !important; }
  .rc { animation: none !important; }
}

/* Home hero */
.hero { text-align: center; padding: 18px 0 8px; }
.hero h1 { font-size: clamp(30px, 5vw, 50px); margin-bottom: 10px; }
.hero h1 em { font-style: normal; background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { margin: 0 auto 22px; }
.hero-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: -8px 0 22px; font-size: 13px; color: var(--muted); }
.hero-badges span { border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; background: var(--surface); }
.sim-shell { padding: 14px; }
@media (max-width: 640px) {
  main { padding-top: 14px; }
  .hero { padding: 4px 0 0; }
  .hero h1 { font-size: 27px; }
  .hero p.lead { font-size: 15px; margin-bottom: 12px; }
  .hero-badges { display: none; }
  .sim-shell { padding: 8px; }
  .sim-controls { gap: 6px; }
  .sim-actions { gap: 6px; }
  .btn.sm { padding: 7px 10px; font-size: 13px; }
}
.faq h3 { margin-top: 18px; }
.faq p { margin: 4px 0 0; color: var(--muted); max-width: 75ch; }
.set-hero { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 8px; }
.set-hero img { height: 64px; width: auto; max-width: 180px; object-fit: contain; }
.set-hero h1 { flex: 1 1 320px; margin: 0; }

/* Card list */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.cards-grid figure { margin: 0; }
.cards-grid img { width: 100%; height: auto; border-radius: 7px; display: block; background: var(--surface-2); aspect-ratio: 5 / 7; }
.cards-grid figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; }
.pill { display: inline-block; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; font-size: 13px; }
details > summary { cursor: pointer; font-weight: 700; padding: 6px 0; }
footer.site { border-top: 1px solid var(--border); padding: 22px 0 40px; color: var(--muted); font-size: 13px; }
footer.site p { margin: 0 0 8px; max-width: 80ch; }
@media (max-width: 560px) {
  nav.main { gap: 12px; font-size: 14px; }
  .pack-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
}
