/* Tokens live on :root so both themes are always defined. Nothing is defined only
   inside a media query — that was the bug that shipped a half-dark site last time. */
:root {
  --bg: #f4f3ef;
  --panel: #ffffff;
  --panel-2: #efeee9;
  --ink: #14161b;
  --ink-dim: #5d6068;
  --line: #e0dfda;
  --accent: #1f9c5b;
  --accent-ink: #ffffff;
  --warn: #b4541f;
  --radius: 16px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Inter, sans-serif;
  color-scheme: light dark;
}

:root[data-theme="dark"],
:root:not([data-theme="light"]) {
  --bg: #0b0d10;
  --panel: #14171c;
  --panel-2: #1c2027;
  --ink: #eceef1;
  --ink-dim: #8c929c;
  --line: #262b33;
  --accent: #3ddc84;
  --accent-ink: #07120b;
  --warn: #ff9f45;
}

:root[data-theme="light"] {
  --bg: #f4f3ef;
  --panel: #ffffff;
  --panel-2: #efeee9;
  --ink: #14161b;
  --ink-dim: #5d6068;
  --line: #e0dfda;
  --accent: #1f9c5b;
  --accent-ink: #ffffff;
  --warn: #b4541f;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4f3ef;
    --panel: #ffffff;
    --panel-2: #efeee9;
    --ink: #14161b;
    --ink-dim: #5d6068;
    --line: #e0dfda;
    --accent: #1f9c5b;
    --accent-ink: #ffffff;
    --warn: #b4541f;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
}

h1,
h2 {
  margin: 0;
}
h2 {
  font-size: 17px;
  letter-spacing: 0.02em;
}

/* ------------------------------------------------------- the peeking cat
   The cat sits BEHIND the card; only the head above the card's top edge shows,
   and the bob animation makes it pop up and duck back down. */

.peek-wrap {
  position: relative;
  padding-top: 44px; /* headroom for the head */
}
.peek {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 108px;
  height: 108px;
  z-index: 0;
  pointer-events: none;
}
.peek svg {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}
.peek-wrap > .pane,
.peek-wrap > .gate-card {
  position: relative;
  z-index: 1;
}

/* ------------------------------------------------------------------ gate */

.gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(6px);
}
.gate[hidden] {
  display: none;
}
.gate-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px 30px 26px;
  text-align: center;
  width: min(90vw, 340px);
  box-shadow: 0 24px 60px rgb(0 0 0 / 0.28);
}
.gate h1 {
  font-size: 44px;
  letter-spacing: 0.14em;
  font-weight: 800;
}
.gate-check {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 18px 0 16px;
  cursor: pointer;
  user-select: none;
  font-size: 17px;
}
.gate-check input {
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ---------------------------------------------------------------- header */

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.brand-cat {
  width: 28px;
  height: 28px;
}
.brand-cat svg {
  display: block;
  width: 100%;
  height: 100%;
}
.top-right {
  display: flex;
  gap: 8px;
}

/* tabs: segmented control in the header; a bottom bar on phones */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
}
.tab {
  font: inherit;
  font-weight: 700;
  font-size: 13.5px;
  border: 0;
  background: transparent;
  color: var(--ink-dim);
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tab:hover {
  color: var(--ink);
}
.tab.active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.12);
}
.tab-count {
  font-family: var(--mono);
  font-size: 10.5px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 999px;
  padding: 0 6px;
  line-height: 16px;
}

@media (max-width: 760px) {
  .tabs {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 40;
    justify-content: space-between;
    box-shadow: 0 10px 30px rgb(0 0 0 / 0.25);
  }
  .tab {
    flex: 1;
    justify-content: center;
    padding: 9px 4px;
    font-size: 12.5px;
  }
  .brand-name {
    display: none;
  }
  main {
    padding-bottom: 96px;
  }
}

/* ---------------------------------------------------------------- layout */

main {
  max-width: 880px;
  margin: 0 auto;
  padding: 20px 16px 64px;
}
.panel[hidden] {
  display: none;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin: 22px 0 8px;
}
.section-head:first-child {
  margin-top: 0;
}

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

.hero {
  text-align: center;
  padding: 8px 0 18px;
}
.hero-parade {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 2px;
  height: 74px;
  overflow: hidden;
}
.hero-parade .pcat {
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
}
.hero-parade .pcat svg {
  display: block;
  width: 100%;
  height: 100%;
}
@media (max-width: 560px) {
  .hero-parade .pcat:nth-child(n + 6) {
    display: none;
  }
}
.hero-title {
  font-size: clamp(34px, 7vw, 56px);
  font-weight: 900;
  letter-spacing: 0.12em;
  margin-top: 6px;
}
.hero-tag {
  margin: 4px 0 16px;
  color: var(--ink-dim);
  font-size: 16px;
}
.progress-wrap {
  max-width: 560px;
  margin: 0 auto;
}
.progress {
  height: 10px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.6s ease;
}
.progress-nums {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-dim);
}

/* ----------------------------------------------------------------- panes */

.panes {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: stretch;
}
/* a pane sitting next to a peek-wrap needs the same headroom so their tops align */
.panes > .pad-head {
  padding-top: 44px;
}
.grow {
  flex: 1 1 300px;
  min-width: 0;
}
.pane {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.pane-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.countdown {
  font-family: var(--mono);
  font-size: 44px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.countdown.ready {
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse {
  50% {
    opacity: 0.5;
  }
}
.price {
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.1;
}
.price .unit {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-dim);
}
.big-num {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--mono);
  font-size: 38px;
  font-weight: 700;
  line-height: 1.1;
  flex-wrap: wrap;
}
.big-unit {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-dim);
}

.stepper {
  display: flex;
  align-items: center;
  gap: 10px;
}
.step-btn {
  width: 46px;
  height: 46px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
  border-radius: 12px;
}
.step-val {
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 700;
  min-width: 54px;
  text-align: center;
}

.hint {
  margin: 0;
  font-size: 13px;
  color: var(--ink-dim);
}
.hint b {
  color: var(--ink);
}

/* ---------------------------------------------------------- ladder strips */

.ladder-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 100%;
  margin-top: 18px;
  padding: 10px 6px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
  overflow: hidden;
}
.ladder-strip:hover {
  border-color: var(--accent);
}
.ladder-strip .lcat {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
}
.ladder-strip .lcat svg {
  display: block;
  width: 100%;
  height: 100%;
}
.ladder-strip .arrow {
  color: var(--ink-dim);
  font-size: 15px;
  flex: 0 0 auto;
}

.ladder-big {
  display: grid;
  gap: 8px;
}
.ladder-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 12px;
  flex-wrap: wrap;
}
.ladder-row .lcat {
  width: 52px;
  height: 52px;
}
.ladder-row .lcat.sm {
  width: 38px;
  height: 38px;
}
.ladder-row .lcat svg {
  display: block;
  width: 100%;
  height: 100%;
}
.ladder-row .lbl {
  font-size: 13px;
  color: var(--ink-dim);
}
.ladder-row .lbl b {
  color: var(--ink);
  display: block;
}
.ladder-row .consumed {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-dim);
  white-space: nowrap;
}

/* ------------------------------------------------------------------ cats */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
  margin: 10px 0;
  max-height: 420px;
  overflow-y: auto;
}
.cat {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  background: var(--panel);
  position: relative;
  padding: 0;
}
.cat:hover {
  border-color: var(--ink-dim);
}
.cat.sel {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px var(--accent);
}
.cat .art {
  display: block;
  width: 100%;
  aspect-ratio: 1;
}
.cat .art svg {
  display: block;
  width: 100%;
  height: 100%;
}
.cat .meta {
  font-family: var(--mono);
  font-size: 10px;
  padding: 4px 6px;
  display: flex;
  justify-content: space-between;
  gap: 4px;
  color: var(--ink-dim);
  border-top: 1px solid var(--line);
}
.cat .meta .t {
  color: var(--accent);
}
.cat .badge {
  position: absolute;
  top: 4px;
  right: 4px;
  font-family: var(--mono);
  font-size: 9px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 4px;
  padding: 1px 4px;
}
.cat.sel::before {
  content: "✓";
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 2;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 800;
  display: grid;
  place-items: center;
}

/* --------------------------------------------------------- ascension book */

.asc-book {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin: 12px 0;
}
@media (max-width: 560px) {
  .asc-book {
    grid-template-columns: repeat(5, 1fr);
  }
}
.slot {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  aspect-ratio: 1;
  position: relative;
  padding: 4px;
}
.slot svg {
  display: block;
  width: 100%;
  height: 100%;
}
.slot.missing {
  opacity: 0.28;
  filter: grayscale(0.65);
  border-style: dashed;
}
.slot.have {
  border-color: var(--accent);
}
.slot .n {
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-family: var(--mono);
  font-size: 8.5px;
  color: var(--ink-dim);
}

/* ----------------------------------------------------------------- stats */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  margin: 14px 0 10px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  display: grid;
  gap: 2px;
  min-width: 0;
}
.stat .k {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-dim);
}
.stat .v {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* --------------------------------------------------------------- controls */

.btn {
  font: inherit;
  font-weight: 700;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: transform 0.06s ease, opacity 0.15s ease;
}
.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
}
.btn.big {
  padding: 14px 22px;
  font-size: 16px;
}
.btn.wide {
  width: 100%;
}

.pill {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
}

/* ------------------------------------------------------------- empty state */

.empty {
  text-align: center;
  padding: 28px 0 10px;
}
.empty[hidden] {
  display: none;
}
.empty-cat {
  width: 140px;
  height: 140px;
  margin: 0 auto 6px;
}
.empty-cat svg {
  display: block;
  width: 100%;
  height: 100%;
}
.empty p {
  color: var(--ink-dim);
  margin: 6px 0 14px;
}

/* ------------------------------------------------------------- action bar */

.bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 18px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 10px 8px 18px;
  box-shadow: 0 16px 44px rgb(0 0 0 / 0.3);
  max-width: min(94vw, 720px);
}
.bar[hidden] {
  display: none;
}
.bar-info {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-dim);
  white-space: nowrap;
}
.bar-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.bar .btn {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13.5px;
}
@media (max-width: 760px) {
  .bar {
    bottom: calc(66px + env(safe-area-inset-bottom));
  }
}

/* --------------------------------------------------------- activation tiers */

.tiers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 8px;
  margin: 12px 0;
}
.tier {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
  cursor: pointer;
  min-width: 0;
  font: inherit;
  color: var(--ink);
}
.tier[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}
.tier.cur {
  opacity: 1;
  border-color: var(--accent);
}
.tier.cur .px {
  color: var(--ink-dim);
}
.tier.sel {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.tier .mult {
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 700;
}
.tier .nm {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-dim);
  margin-top: 2px;
}
.tier .px {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  margin-top: 4px;
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------- tier table */

.tier-table {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}
.tt {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  text-align: center;
}
.tt .mult {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 18px;
}
.tt .nm {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-dim);
}
.tt .px {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  margin-top: 4px;
}

/* -------------------------------------------------------------------- faq */

.faq {
  display: grid;
  gap: 6px;
}
.faq details {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 14px;
}
.faq summary {
  cursor: pointer;
  font-weight: 700;
  padding: 11px 0;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.faq summary::after {
  content: "+";
  font-family: var(--mono);
  color: var(--ink-dim);
  font-size: 16px;
}
.faq details[open] summary::after {
  content: "−";
}
.faq p {
  margin: 0 0 12px;
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
}

/* ------------------------------------------------------------------- misc */

.rules {
  margin: 0;
  padding-left: 18px;
  color: var(--ink-dim);
}
.rules li {
  margin: 3px 0;
}
.addrs {
  display: grid;
  gap: 4px;
  font-family: var(--mono);
  font-size: 11px;
  overflow-x: auto;
}
.addrs a {
  color: var(--ink-dim);
  text-decoration: none;
  white-space: nowrap;
}
.addrs a:hover {
  color: var(--accent);
}
.muted {
  color: var(--ink-dim);
}
.small {
  font-size: 12.5px;
}

footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin-top: 26px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-dim);
}

.toast {
  position: fixed;
  left: 50%;
  top: 64px;
  visibility: hidden;
  transform: translate(-50%, -180%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 13px;
  max-width: min(92vw, 440px);
  box-shadow: 0 14px 40px rgb(0 0 0 / 0.3);
  transition: transform 0.25s ease;
  z-index: 90;
  overflow-wrap: anywhere;
}
.toast.show {
  visibility: visible;
  transform: translate(-50%, 0);
}
.toast.bad {
  border-color: var(--warn);
}
