:root {
  --bg: #07111f;
  --panel: #10243f;
  --ink: #f4f7fb;
  --muted: #9bb0ce;
  --gold: #e7b23c;
  --line: rgba(255, 255, 255, 0.12);
  font-family: "Segoe UI", Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); }
img { max-width: 100%; }
button, input { font: inherit; color: inherit; }
a { color: inherit; }

.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; background: rgba(7, 17, 31, 0.92);
  border-bottom: 1px solid var(--line); backdrop-filter: blur(8px);
}
.brand { text-decoration: none; letter-spacing: 0.16em; font-size: 12px; }
.brand span { color: var(--gold); letter-spacing: 0; font-size: 16px; font-weight: 700; margin-left: 8px; }
.top-nav { display: flex; gap: 14px; align-items: center; }
.top-link { color: var(--muted); text-decoration: none; font-size: 14px; }

.hero {
  display: grid; gap: 28px; align-items: center;
  padding: 36px 18px 12px; max-width: 1080px; margin: 0 auto;
}
.kicker { color: var(--gold); letter-spacing: 0.2em; font-size: 12px; margin: 0 0 8px; }
h1 { font-size: 56px; line-height: 0.95; margin: 0 0 14px; letter-spacing: -0.03em; }
.story { color: #d5e2f5; font-size: 18px; line-height: 1.5; max-width: 38rem; margin: 0 0 12px; }
.donate-line { color: #9bb0ce; font-size: 12px; line-height: 1.4; margin: 2px 0 0; font-weight: 400; }
.story.note { color: var(--muted); font-size: 14px; }
.cta {
  display: inline-block; margin-top: 8px; margin-right: 8px; background: var(--gold); color: #14284b;
  text-decoration: none; font-weight: 700; padding: 12px 18px; border-radius: 999px;
}
.cta-quiet { background: transparent; color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.hero-card {
  width: min(280px, 70vw); justify-self: center; cursor: pointer;
  border: 4px solid var(--gold); border-radius: 18px; image-rendering: pixelated;
  background: #0c1c33; padding: 8px;
}
.hero-caption { margin: 8px 0 0; text-align: center; color: #d5e2f5; font-size: 13px; line-height: 1.4; }
.hero-caption strong { color: #fff; font-size: 15px; }

.gallery { max-width: 1100px; margin: 0 auto; padding: 28px 18px 48px; }
.gallery-head h2 { margin: 0 0 8px; font-size: 28px; }
.demo-banner {
  margin: 0; padding: 10px 12px; border: 1px solid rgba(231, 178, 60, 0.45);
  background: rgba(231, 178, 60, 0.1); border-radius: 12px; color: #f4e2b0; font-size: 14px;
}
.filters { display: flex; gap: 8px; overflow-x: auto; padding: 16px 0 8px; }
.filters button {
  border: 0; background: rgba(255,255,255,0.06); color: #c5d4ea;
  border-radius: 999px; padding: 8px 12px; white-space: nowrap; cursor: pointer;
}
.filters button[aria-selected="true"] { background: var(--gold); color: #14284b; font-weight: 700; }
.count { color: var(--muted); font-size: 14px; }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.card {
  background: var(--panel); border: 2px solid #8b93a7; border-radius: 16px;
  padding: 8px; text-align: left; cursor: pointer; color: inherit; width: 100%;
}
.card.super_rare { border-color: #e7b23c; }
.card.ultra_rare { border-color: #d7fff6; }
.card.rare { border-color: #4c8dff; }
.card.less_common { border-color: #3dce86; }
.card img, .idle { width: 100%; height: auto; aspect-ratio: 120 / 156; object-fit: contain; image-rendering: pixelated; border-radius: 10px; background: #0c1c33; }
.idle { position: relative; display: block; overflow: hidden; }
.idle-bg, .idle-char { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
.idle-bg { object-fit: contain; }
.idle-char {
  background-repeat: no-repeat;
  background-size: 100% 400%;
  background-position: 0 0;
}
.idle-bg-anim {
  background-repeat: no-repeat;
  background-size: 100% 800%;
  background-position: 0 0;
}
.idle-char.jump, .idle-char.celebrate, .idle-char.kick { background-size: 100% 800%; }
.idle.is-on .idle-char { animation: idle-frames 1.6s steps(1, end) infinite; }
.idle.is-on .idle-char.jump { animation: idle-bg 0.9s steps(1, end) infinite; }
.idle.is-on .idle-char.celebrate { animation: idle-bg 1.55s steps(1, end) infinite; }
.idle.is-on .idle-char.kick { animation: idle-bg 0.75s steps(1, end) infinite alternate; }
.idle.is-on .idle-bg-anim { animation: idle-bg 1.1s steps(1, end) infinite; }
.idle.is-on .idle-bg-anim.cosmos { animation-duration: 2.8s; }
.idle.is-on .idle-bg-anim.ultra { animation-duration: 1.8s; }
@keyframes idle-frames {
  0% { background-position: 0 0%; }
  25% { background-position: 0 33.333%; }
  50% { background-position: 0 66.666%; }
  75% { background-position: 0 100%; }
}
@keyframes idle-bg {
  0% { background-position: 0 0%; }
  12.5% { background-position: 0 14.286%; }
  25% { background-position: 0 28.571%; }
  37.5% { background-position: 0 42.857%; }
  50% { background-position: 0 57.143%; }
  62.5% { background-position: 0 71.429%; }
  75% { background-position: 0 85.714%; }
  87.5% { background-position: 0 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .idle.is-on .idle-char,
  .idle.is-on .idle-char.jump,
  .idle.is-on .idle-char.celebrate,
  .idle.is-on .idle-char.kick,
  .idle.is-on .idle-bg-anim,
  .idle.is-on .idle-bg-anim.cosmos,
  .idle.is-on .idle-bg-anim.ultra { animation: none; }
}
.sheet-art.idle { width: min(240px, 70vw); height: auto; aspect-ratio: 120 / 156; margin: 8px auto 12px; border-radius: 12px; }
.meta { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--muted); margin: 6px 2px; }
.tag { display: inline-flex; border-radius: 999px; padding: 2px 8px; font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.tag-one { background: #14110c; color: #e7b23c; box-shadow: inset 0 0 0 1px #e7b23c; }
.tag-ultra { background: #24143f; color: #d8c4ff; }
.tag-super { background: #3a2a08; color: #e7b23c; }
.tag-rare { background: #102848; color: #8eb6ff; }
.tag-less { background: #0d2a1c; color: #5ee0a0; }
.card h3 { margin: 0 6px 4px; font-size: 15px; }
.status {
  margin: 8px 2px 4px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  border-radius: 999px;
  padding: 8px 10px;
  -webkit-text-fill-color: currentColor;
}
.status.buy {
  background: var(--gold);
  color: #14284b;
  -webkit-text-fill-color: #14284b;
}
.status.owned {
  background: rgba(143, 208, 255, 0.16);
  color: #d7ecff;
  -webkit-text-fill-color: #d7ecff;
}
.status.offer {
  background: var(--gold);
  color: #14284b;
  -webkit-text-fill-color: #14284b;
}
.status.reserve {
  background: transparent;
  color: #e7b23c;
  -webkit-text-fill-color: #e7b23c;
  border: 1px solid rgba(231, 178, 60, 0.7);
}
.sheet {
  position: fixed; inset: 0; background: rgba(0,0,0,0.72);
  display: flex; align-items: flex-end; justify-content: center; z-index: 20;
  padding: 12px;
  padding-top: calc(56px + env(safe-area-inset-top, 0px));
  overflow: auto;
}
.sheet[hidden] { display: none; }
.sheet-card {
  background: #10243f; width: min(520px, 100%);
  max-height: min(92vh, calc(100dvh - 68px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)));
  overflow: auto; border-radius: 20px 20px 16px 16px; padding: 16px 16px 22px;
  border: 1px solid var(--line);
  scroll-padding-top: 0;
}
.modal-x {
  position: fixed;
  z-index: 40;
  top: calc(8px + env(safe-area-inset-top, 0px));
  right: calc(8px + env(safe-area-inset-right, 0px));
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #f4f7fb;
  color: #07111f;
  -webkit-text-fill-color: #07111f;
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}
.sheet[hidden] .modal-x { display: none; }
.box-open { position: relative; width: min(520px, 100%); margin: 12px auto 0; aspect-ratio: 1280 / 720; }
.box-open .box-bed { display: block; width: 100%; height: auto; border-radius: 12px; }
.sheet-art { width: min(240px, 60vw); display: block; margin: 8px auto 12px; image-rendering: pixelated; border-radius: 12px; }
.tier { color: var(--gold); letter-spacing: 0.12em; font-size: 12px; margin: 0; }
#sheet-title { margin: 4px 0; font-size: 28px; }
.price { margin: 0 0 6px; }
.guide { color: var(--muted); font-size: 14px; margin: 0 0 2px; }
.flavour {
  color: #e4ebf6;
  -webkit-text-fill-color: #e4ebf6;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.45;
  margin: 8px 0 14px;
  padding: 0 0 0 12px;
  border-left: 2px solid var(--gold);
}
.action { margin-top: 14px; display: grid; gap: 8px; }
.action button,
button.buy,
a.buy {
  background: var(--gold);
  color: #14284b;
  -webkit-text-fill-color: #14284b;
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 700;
  cursor: pointer;
}
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
input,
textarea {
  background: #07111f; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  color: inherit;
  font: inherit;
}
textarea {
  resize: vertical;
  min-height: 72px;
}
.warn { color: #ffb4a8; font-size: 13px; margin: 0; }
.owner-line { font-size: 14px; color: #c5d4ea; }
.demo-pay { margin: 0; color: #14284b; background: var(--gold); border-radius: 12px; padding: 10px 12px; font-weight: 700; }
.demo-done { margin: 0; color: #d5e2f5; font-size: 14px; }

.kit { max-width: 980px; margin: 0 auto; padding: 28px 18px 64px; }
.kit h1 { font-size: 40px; }
.kit-pick { display: grid; gap: 6px; max-width: 360px; color: var(--muted); font-size: 14px; margin: 16px 0; }
.kit-pick select, .kit-meta { background: #07111f; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--ink); }
.kit-meta { margin: 0 0 16px; }
.kit-meta .mono { font-family: ui-monospace, monospace; font-size: 12px; color: var(--muted); }
.kit-grid { display: grid; gap: 16px; }
.kit-piece { margin: 0; background: #10243f; border: 1px solid var(--line); border-radius: 18px; padding: 16px; }
.kit-piece figcaption { margin-top: 10px; text-align: center; color: #c5d4ea; font-size: 14px; }
.kit-card { display: block; width: min(220px, 70vw); height: auto; aspect-ratio: 120 / 156; object-fit: contain; margin: 0 auto; image-rendering: pixelated; border-radius: 12px; background: #0c1c33; }
.kit-box { display: block; width: min(360px, 100%); height: auto; margin: 8px auto; border-radius: 12px; }
.kit-wide { background: #f4f1ea; }
.kit-cert { display: block; width: min(420px, 100%); height: auto; margin: 0 auto; }
.kit-necklace { display: block; width: min(420px, 100%); height: auto; aspect-ratio: 1 / 1; margin: 0 auto; border-radius: 12px; }
.kit-wide figcaption { color: #3c4654; }
@media (min-width: 800px) {
  .kit-grid { grid-template-columns: 1fr 1fr; }
  .kit-wide { grid-column: 1 / -1; }
}

footer { border-top: 1px solid var(--line); padding: 22px 18px 40px; color: var(--muted); font-size: 13px; line-height: 1.5; max-width: 800px; margin: 0 auto; }

@media (min-width: 800px) {
  .hero { grid-template-columns: 1.3fr 0.7fr; padding-top: 64px; }
  h1 { font-size: 76px; }
  .grid { grid-template-columns: repeat(4, 1fr); }
  .sheet { align-items: center; }
  .sheet-card { border-radius: 20px; }
}
@media (min-width: 1100px) {
  .grid { grid-template-columns: repeat(5, 1fr); }
}

.rarity-note { max-width: 42rem; }
.not-included {
  display: inline-block;
  margin: 0 0 10px;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: transparent;
  color: #f0c14a;
  box-shadow: inset 0 0 0 1px #f0c14a;
}
.kit-extra { background: #10243f; text-align: center; }
.kit-extra figcaption { color: #c5d4ea; }
.share-row { margin-top: 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
button.share {
  background: transparent;
  color: #f4f7fb;
  -webkit-text-fill-color: #f4f7fb;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 700;
  cursor: pointer;
}
.share-copied { color: #3dce86; font-size: 13px; font-weight: 600; }
.rarity-modal { color: #c5d4ea; font-size: 14px; line-height: 1.5; margin: 10px 0 0; }
