/* Marked store
   Palette is lifted from the logo and the package art:
   the navy matches the art backgrounds so item pictures sit flush on the page. */

:root {
  --night: #171c33;
  --hoard: #252c49;
  --hoard-raised: #2e3658;
  --line: #3a4370;
  --rose: #e8456b;
  --rose-deep: #b02a4d;
  --gold: #f6b93b;
  --emerald: #2fbf71;
  --blush: #ffe3e6;
  --mist: #b4bbdb;

  --display: "Lilita One", "Arial Rounded MT Bold", system-ui, sans-serif;
  --body: "Rubik", system-ui, -apple-system, "Segoe UI", sans-serif;

  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.563rem;
  --step-3: 1.953rem;
  --step-4: 2.441rem;
  --step-5: 3.052rem;

  --gutter: clamp(16px, 4vw, 40px);
  --max: 1180px;
  --page-scale: 1;
  color-scheme: dark;
}

@media (min-width: 861px) {
  :root { --page-scale: 0.9; }
}

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

html { scroll-behavior: smooth; scroll-padding-top: 140px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  zoom: var(--page-scale);
  background: var(--night);
  color: var(--blush);
  font-family: var(--body);
  font-size: var(--step-0);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
a { color: var(--gold); }

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
  border-radius: 6px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 50;
  background: var(--gold); color: var(--night);
  padding: 10px 16px; border-radius: 10px; font-weight: 700; text-decoration: none;
}
.skip:focus { top: 12px; }

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

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px;
  border: 0; border-radius: 14px;
  font-family: var(--display); font-size: var(--step-1); letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 80ms ease, box-shadow 80ms ease, background-color 120ms ease;
}
.btn-primary {
  background: var(--rose);
  color: #fff;
  box-shadow: 0 5px 0 var(--rose-deep);
  text-shadow: 0 2px 0 rgba(120, 20, 50, 0.45);
}
.btn-primary:hover { background: #f05479; }
.btn-primary:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--rose-deep); }
.btn-primary[disabled] { opacity: 0.6; cursor: progress; }
.btn-quiet {
  background: transparent; color: var(--blush);
  box-shadow: inset 0 0 0 2px var(--line);
  font-family: var(--body); font-weight: 500; font-size: var(--step-0);
  min-height: 44px;
}
.btn-quiet:hover { box-shadow: inset 0 0 0 2px var(--mist); }
.btn-wide { width: 100%; }

.icon-button {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px;
  border: 0; border-radius: 12px;
  background: var(--hoard-raised); color: var(--blush);
  font-size: 1.5rem; line-height: 1; cursor: pointer;
}
.icon-button:hover { background: var(--line); }

/* ---------- top bar ---------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 12px var(--gutter);
  background: rgba(23, 28, 51, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(58, 67, 112, 0.6);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--blush); text-decoration: none;
  font-family: var(--display); font-size: var(--step-2);
  margin-right: auto;
}
.brand img { width: 40px; height: 40px; object-fit: contain; }

.ip {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 14px;
  border: 0; border-radius: 12px;
  background: var(--hoard); color: var(--mist);
  font-weight: 500; cursor: pointer;
}
.ip:hover { color: var(--blush); }
.ip.copied { color: var(--emerald); }

.basket-button {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 8px 0 14px;
  border: 0; border-radius: 12px;
  background: var(--hoard-raised); font-weight: 500; cursor: pointer;
}
.basket-button:hover { background: var(--line); }
.count {
  display: inline-grid; place-items: center;
  min-width: 28px; height: 28px; padding: 0 6px;
  border-radius: 9px;
  background: var(--gold); color: var(--night);
  font-family: var(--display); font-size: var(--step-0);
}
.count.bump { animation: bump 380ms cubic-bezier(.3, 1.8, .5, 1); }
@keyframes bump { 40% { transform: scale(1.35); } }

/* ---------- hero ---------- */

.hero {
  position: relative;
  display: grid; justify-items: center;
  padding: clamp(24px, 5vw, 56px) var(--gutter) clamp(40px, 7vw, 80px);
  text-align: center;
  isolation: isolate;
}
.hero::before {
  /* the glow of the coin pile behind the logo */
  content: ""; position: absolute; z-index: -1;
  width: min(900px, 120vw); aspect-ratio: 1.6;
  top: 2%;
  background: radial-gradient(closest-side, rgba(246, 185, 59, 0.22), rgba(232, 69, 107, 0.08) 60%, transparent);
}
.hero-logo {
  width: min(620px, 92vw, 66svh * 1.43); height: auto;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.45));
  animation: drop-in 900ms cubic-bezier(.2, 1.4, .4, 1) both;
}
@keyframes drop-in {
  from { opacity: 0; transform: translateY(-40px) scale(0.92) rotate(-2deg); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) { .hero-logo { animation: none; } }

.hero h1 {
  margin: clamp(16px, 2vw, 24px) 0 clamp(24px, 3vw, 32px);
  max-width: 20ch;
  font-family: var(--display); font-weight: 400;
  font-size: clamp(var(--step-3), 5vw, var(--step-5));
  line-height: 1.05;
  text-wrap: balance;
}

/* player picker */

.player { width: min(560px, 100%); }
.player-form, .player-chosen {
  background: var(--hoard);
  border-radius: 22px;
  padding: 20px;
  box-shadow: inset 0 0 0 2px var(--line);
  text-align: left;
}
.edition { border: 0; margin: 0 0 12px; padding: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.edition legend {
  float: left; margin-right: auto;
  font-family: var(--display); font-size: var(--step-2);
}
.edition label { position: relative; }
.edition input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.edition span {
  display: inline-block; padding: 8px 16px; border-radius: 10px;
  background: var(--night); color: var(--mist); font-weight: 500;
}
.edition input:checked + span { background: var(--emerald); color: #0d2a1a; }
.edition input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }

.name-row { display: flex; gap: 10px; }
.name-row input {
  flex: 1; min-width: 0; min-height: 48px; padding: 0 16px;
  border: 0; border-radius: 14px;
  background: var(--night); color: var(--blush);
  box-shadow: inset 0 0 0 2px var(--line);
  font-size: var(--step-1);
}
.name-row input::placeholder { color: #7f88b0; }
.name-row input:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--gold); }
.name-row input[aria-invalid="true"] { box-shadow: inset 0 0 0 2px var(--rose); }

.help { margin: 10px 0 0; color: var(--mist); font-size: var(--step--1); }
.error { margin: 10px 0 0; color: #ff9db3; font-weight: 500; }

.player-chosen { display: flex; align-items: center; gap: 14px; }
.player-chosen img { width: 48px; height: 48px; border-radius: 10px; image-rendering: pixelated; background: var(--night); object-fit: contain; }
.player-chosen p { margin: 0 auto 0 0; font-size: var(--step-1); }
.player-chosen strong { font-family: var(--display); font-weight: 400; color: var(--gold); }

.player.attention .player-form { animation: nudge 420ms ease; box-shadow: inset 0 0 0 2px var(--gold); }
@keyframes nudge { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@media (prefers-reduced-motion: reduce) { .player.attention .player-form { animation: none; } }

/* ---------- section tabs ---------- */

.tabs {
  position: sticky; top: 69px; z-index: 15;
  display: flex; justify-content: center; gap: 6px;
  padding: 10px var(--gutter);
  background: rgba(23, 28, 51, 0.88);
  backdrop-filter: blur(10px);
}
.tabs a {
  padding: 8px 18px; border-radius: 12px;
  color: var(--mist); text-decoration: none;
  font-family: var(--display); font-size: var(--step-1);
}
.tabs a:hover { color: var(--blush); background: var(--hoard); }
.tabs a[aria-current="true"] { color: var(--night); background: var(--gold); }

/* ---------- catalog ---------- */

.catalog { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter) 40px; }
.catalog:focus { outline: none; }
.loading, .catalog-error { text-align: center; color: var(--mist); padding: 60px 0; }

.section { padding: 56px 0 24px; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 24px; margin-bottom: 28px; }
.section-head h2 {
  margin: 0;
  font-family: var(--display); font-weight: 400;
  font-size: clamp(var(--step-3), 4vw, var(--step-4));
  line-height: 1;
}
.section-head p { margin: 0; max-width: 60ch; color: var(--mist); }

.price {
  margin: 0;
  font-family: var(--display); font-size: var(--step-2);
  color: var(--gold);
  line-height: 1;
}
.price s { color: var(--mist); font-size: var(--step-0); margin-right: 6px; }

/* the rank staircase: each tier stands on a taller block */

.stairs {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(5, 1fr);
  align-items: end; gap: 14px;
}
.step { display: flex; flex-direction: column; align-items: stretch; }
.step-open {
  display: grid; justify-items: center; gap: 4px;
  padding: 0 4px 12px;
  border: 0; background: none; cursor: pointer; text-align: center;
}
.step-open img {
  width: 100%; max-width: 190px; aspect-ratio: 1; object-fit: cover;
  border-radius: 24px;
  transition: transform 160ms ease;
}
.step-open:hover img { transform: translateY(-6px) rotate(-1.5deg); }
.step-title { font-family: var(--display); font-size: var(--step-3); line-height: 1; color: var(--rank); margin-top: 8px; }
.step-sub { color: var(--mist); font-size: var(--step--1); }

.plinth {
  /* voxel block: lighter top face, solid front */
  --h: calc(84px + var(--tier) * 38px);
  min-height: var(--h);
  display: flex; flex-direction: column; justify-content: space-between; gap: 12px;
  padding: 18px 14px 14px;
  border-radius: 6px 6px 0 0;
  background: color-mix(in srgb, var(--rank) 26%, var(--hoard));
  border-top: 10px solid color-mix(in srgb, var(--rank) 70%, white 10%);
}
.plinth .tier { margin: 0; color: var(--blush); font-size: var(--step--1); opacity: 0.8; }
.plinth .btn { min-height: 44px; font-size: var(--step-0); padding: 0 14px; width: 100%; }

.stairs-floor {
  height: 12px; border-radius: 0 0 10px 10px;
  background: var(--hoard-raised);
}

/* shelves for coins and keys */

.shelf {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 18px;
}
.item {
  display: flex; flex-direction: column;
  background: var(--hoard);
  border-radius: 26px;
  overflow: hidden;
}
.item-open {
  display: grid; gap: 2px; padding: 0 0 4px;
  border: 0; background: none; cursor: pointer; text-align: left;
}
.item-open img { width: 100%; aspect-ratio: 1; object-fit: cover; transition: transform 160ms ease; }
.item-open:hover img { transform: scale(1.04); }
.item-title { padding: 6px 18px 0; font-family: var(--display); font-size: var(--step-2); line-height: 1.1; }
.item-sub { padding: 0 18px; color: var(--mist); font-size: var(--step--1); }
.item-buy { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px 16px 18px; margin-top: auto; }
.item-buy .btn { min-height: 42px; font-size: var(--step-0); padding: 0 16px; }

.in-basket { color: var(--emerald); font-weight: 500; font-size: var(--step--1); }

/* ---------- package dialog ---------- */

dialog { color: var(--blush); }
dialog::backdrop { background: rgba(8, 10, 22, 0.72); backdrop-filter: blur(3px); }

.package-dialog {
  width: min(760px, calc(100vw - 24px));
  max-height: calc(100dvh / var(--page-scale) - 24px);
  padding: 0; border: 0; border-radius: 28px;
  background: var(--hoard);
  box-shadow: inset 0 0 0 2px var(--line);
}
.package-dialog[open] { animation: rise 220ms ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
@media (prefers-reduced-motion: reduce) { .package-dialog[open], .drawer[open] { animation: none; } }

.dialog-close { position: absolute; top: 14px; right: 14px; z-index: 1; }
.pkg-layout { display: grid; grid-template-columns: 300px 1fr; gap: 0; }
.pkg-layout img { width: 100%; height: 100%; max-height: 420px; object-fit: cover; }
.pkg-body { padding: 28px 28px 8px; overflow: auto; max-height: 420px; }
.pkg-body h2 { margin: 0 48px 2px 0; font-family: var(--display); font-weight: 400; font-size: var(--step-4); line-height: 1; }
.pkg-sub { margin: 0 0 16px; color: var(--mist); }
.pkg-desc p { margin: 0 0 12px; max-width: 60ch; }
.pkg-desc ul { margin: 0 0 14px; padding-left: 1.2em; }
.pkg-desc li { margin-bottom: 6px; }
.pkg-desc li::marker { color: var(--gold); }

.pkg-buy {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 18px 28px 24px;
  border-top: 2px solid var(--line);
}
.pkg-buy .price { margin-right: auto; font-size: var(--step-3); }
.qty { display: flex; align-items: center; gap: 8px; }
.qty output { min-width: 2ch; text-align: center; font-family: var(--display); font-size: var(--step-2); }

/* ---------- basket drawer ---------- */

.drawer {
  margin: 0 0 0 auto; height: calc(100dvh / var(--page-scale)); max-height: none;
  width: min(440px, 100vw);
  padding: 0; border: 0;
  background: var(--hoard);
  box-shadow: -2px 0 0 var(--line);
  display: none; flex-direction: column;
}
.drawer[open] { display: flex; animation: slide 240ms ease-out; }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }

.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 20px 8px 24px; }
.drawer-head h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: var(--step-3); }
.drawer-for { margin: 0 24px 8px; color: var(--mist); }
.drawer-for strong { color: var(--gold); font-weight: 500; }

.lines { list-style: none; margin: 0; padding: 8px 16px; overflow: auto; flex: 1; }
.line {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center;
  padding: 10px 8px; border-radius: 16px;
}
.line + .line { border-top: 1px solid var(--line); border-radius: 0; }
.line img { width: 64px; height: 64px; border-radius: 14px; object-fit: cover; }
.line-title { margin: 0; font-family: var(--display); font-size: var(--step-1); line-height: 1.1; }
.line-meta { margin: 2px 0 0; color: var(--mist); font-size: var(--step--1); }
.line-side { display: grid; justify-items: end; gap: 6px; }
.line-side .price { font-size: var(--step-1); }
.remove {
  border: 0; background: none; color: var(--mist); cursor: pointer;
  font-size: var(--step--1); text-decoration: underline; text-underline-offset: 3px; padding: 4px;
}
.remove:hover { color: #ff9db3; }

.empty { padding: 24px; color: var(--mist); flex: 1; }
.totals { padding: 18px 24px 24px; border-top: 2px solid var(--line); }
.totals > p:first-child { display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 14px; font-size: var(--step-1); }
.totals strong { font-family: var(--display); font-weight: 400; font-size: var(--step-3); color: var(--gold); }
.fine { margin: 12px 0 0; color: var(--mist); font-size: var(--step--1); text-align: center; }

/* ---------- toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60;
  transform: translateX(-50%);
  width: max-content; max-width: calc(100vw - 32px);
  padding: 14px 20px; border-radius: 16px;
  background: var(--blush); color: var(--night);
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.toast.good { background: var(--emerald); color: #08210f; }
.toast.bad { background: #ff9db3; color: #3a0a17; }

/* ---------- footer ---------- */

.footer {
  max-width: var(--max); margin: 40px auto 0;
  padding: 32px var(--gutter) 48px;
  border-top: 1px solid var(--line);
  color: var(--mist); font-size: var(--step--1);
}
.footer p { margin: 0 0 10px; max-width: 75ch; }
.footer a { margin-right: 18px; color: var(--blush); }

/* ---------- small screens ---------- */

@media (max-width: 860px) {
  .stairs { grid-template-columns: 1fr; gap: 12px; }
  .step {
    display: grid; grid-template-columns: 112px 1fr; align-items: stretch;
    background: var(--hoard); border-radius: 22px; overflow: hidden;
  }
  .step-open { grid-row: span 2; padding: 0; justify-items: start; align-content: start; }
  .step-open img { max-width: none; border-radius: 0; }
  .step-open .step-title, .step-open .step-sub { display: none; }
  .plinth {
    min-height: 0; border-radius: 0;
    border-top: 0; border-left: 8px solid color-mix(in srgb, var(--rank) 70%, white 10%);
    background: color-mix(in srgb, var(--rank) 14%, var(--hoard));
  }
  .plinth-name { display: block !important; }
  .stairs-floor { display: none; }
  .pkg-layout { grid-template-columns: 1fr; }
  .pkg-layout img { max-height: 240px; }
  .pkg-body { max-height: none; }
}

.plinth-name { display: none; margin: 0; font-family: var(--display); font-size: var(--step-2); line-height: 1; color: var(--rank); }

@media (max-width: 560px) {
  .ip span { display: none; }
  .basket-button > span:not(.count) { display: none; }
  .tabs { top: 65px; justify-content: flex-start; overflow-x: auto; }
  .name-row { flex-direction: column; }
  .shelf { grid-template-columns: 1fr 1fr; gap: 12px; }
  .item-title { font-size: var(--step-1); padding: 6px 12px 0; }
  .item-sub { padding: 0 12px; }
  .item-buy { flex-direction: column; align-items: stretch; padding: 10px 12px 14px; }
  .pkg-buy { padding: 16px 20px 20px; }
  .pkg-buy .btn { width: 100%; }
}
