:root {
  color-scheme: light;
  --bg: #f4f4f2;
  --card: #ffffff;
  --ink: #1c1c1c;
  --ink-2: #4a4a48;
  --muted: #8b8b87;
  --line: rgba(0, 0, 0, 0.07);
  --tile: #f2f2f0;
  --tile-hover: #e9e9e6;
  --ok: #2f8f5b;
  --no: #c2483d;
  --ease: cubic-bezier(0.22, 0.8, 0.24, 1);
  --header: 56px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

a {
  color: inherit;
}

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

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

/* ---- Header ---------------------------------------------------------- */

.bar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 30;
  height: var(--header);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 20px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-self: start;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-size: 15px;
}

.logo svg {
  width: 26px;
  height: 26px;
}

.cats {
  display: flex;
  gap: 2px;
}

.cat {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  color: var(--muted);
  text-decoration: none;
  position: relative;
  transition: color 0.2s, background 0.2s;
}

.cat svg {
  width: 21px;
  height: 21px;
}

.cat:hover {
  color: var(--ink);
  background: rgba(0, 0, 0, 0.04);
}

.cat[aria-current="page"] {
  color: var(--ink);
}

.cat[aria-current="page"]::after {
  content: "";
  position: absolute;
  bottom: 1px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--ink);
}

.cat .tip {
  position: absolute;
  top: calc(100% + 6px);
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-3px);
  transition: opacity 0.15s, transform 0.15s;
}

.cat:hover .tip,
.cat:focus-visible .tip {
  opacity: 1;
  transform: none;
}

.about-btn {
  justify-self: end;
  color: var(--ink-2);
  font-size: 14px;
  padding: 6px 4px;
}

.about-btn:hover {
  color: var(--ink);
}

/* ---- Stage ----------------------------------------------------------- */

.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

.intro {
  position: absolute;
  top: calc(var(--header) + 4px);
  left: 50%;
  transform: translateX(-50%);
  width: min(560px, calc(100% - 32px));
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  transition: opacity 0.4s;
}

.intro h1 {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
}

.item {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translate3d(var(--x), var(--y), 0);
  width: var(--size);
  transition:
    transform 0.9s var(--ease),
    width 0.9s var(--ease),
    opacity 0.5s ease,
    filter 0.5s ease;
  will-change: transform, width;
}

.item .art {
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  transition: transform 0.25s var(--ease);
}

.item .art svg,
.item .art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.08));
}

.item:hover .art {
  transform: scale(1.06);
}

.item .label {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translate(-50%, 4px);
  width: max-content;
  max-width: 240px;
  text-align: center;
  line-height: 1.35;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.item .name {
  display: block;
  font-size: 14px;
  color: var(--ink);
}

.item .meta {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.item.featured .label,
.item:hover .label,
.item:focus-visible .label {
  opacity: 1;
}

.item:not(.featured):hover,
.item:not(.featured):focus-visible {
  z-index: 5;
}

.item:not(.featured) .label {
  padding: 5px 9px;
  border-radius: 8px;
  background: var(--card);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

/* First placement after a category switch: jump into place, only fade in. */
.item.instant {
  transition: opacity 0.6s ease;
}

.item.out {
  opacity: 0.16;
  filter: grayscale(1);
}

.item.out:hover {
  opacity: 0.5;
}

.item.gone {
  opacity: 0;
  pointer-events: none;
}

.item.featured {
  z-index: 2;
}

.item.featured .name {
  font-size: 15px;
}

.item.featured .meta {
  font-size: 13px;
}

/* ---- Question dock --------------------------------------------------- */

.dock {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 20;
  width: min(760px, calc(100% - 32px));
  transform: translateX(-50%);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.dock-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.05);
  padding: 18px 24px 16px;
}

.dock-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 26px;
}

.chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  min-width: 0;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--tile);
  color: var(--ink-2);
  font-size: 12px;
  transition: background 0.15s;
}

.chip:hover {
  background: var(--tile-hover);
}

.chip[aria-current="step"] {
  background: var(--ink);
  color: #fff;
}

.count {
  flex: none;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.count strong {
  color: var(--ink);
  font-weight: 600;
}

.question {
  margin: 14px 0 4px;
  text-align: center;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.detail {
  margin: 0 0 4px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  min-height: 1px;
}

.options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.option {
  min-height: 76px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--tile);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-align: center;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}

.option:hover {
  background: var(--tile-hover);
}

.option:active {
  transform: scale(0.98);
}

.option .opt-label {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.option .opt-hint {
  font-size: 12px;
  color: var(--muted);
}

.option .opt-count {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.option.selected {
  background: var(--ink);
  color: #fff;
}

.option.selected .opt-hint,
.option.selected .opt-count {
  color: rgba(255, 255, 255, 0.65);
}

.option.empty {
  opacity: 0.45;
}

.dock-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  font-size: 13px;
}

.link-btn {
  color: var(--muted);
  padding: 4px 2px;
  transition: color 0.15s;
}

.link-btn:hover {
  color: var(--ink);
}

.link-btn:disabled {
  visibility: hidden;
}

.dots {
  display: flex;
  gap: 5px;
}

.dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #dcdcd8;
  transition: background 0.2s, width 0.2s;
}

.dots span.done {
  background: #9d9d98;
}

.dots span.now {
  width: 16px;
  border-radius: 3px;
  background: var(--ink);
}

.finish-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}

.pill {
  height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--tile);
  font-weight: 600;
  transition: background 0.15s;
}

.pill:hover {
  background: var(--tile-hover);
}

.pill.dark {
  background: var(--ink);
  color: #fff;
}

.pill.dark:hover {
  background: #000;
}

/* ---- Product sheet --------------------------------------------------- */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(20, 20, 20, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.scrim.open {
  opacity: 1;
  pointer-events: auto;
}

.sheet {
  position: fixed;
  top: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 41;
  width: min(400px, calc(100% - 24px));
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.14);
  display: flex;
  flex-direction: column;
  transform: translateX(calc(100% + 24px));
  transition: transform 0.45s var(--ease);
  overflow: hidden;
}

.sheet.open {
  transform: none;
}

.sheet-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--tile);
  display: grid;
  place-items: center;
  font-size: 18px;
  line-height: 1;
}

.sheet-body {
  overflow-y: auto;
  padding: 24px;
}

.sheet-art {
  width: 70%;
  margin: 8px auto 12px;
  aspect-ratio: 1;
}

.sheet-art svg,
.sheet-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sheet h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.02em;
}

.sheet .sheet-sub {
  margin: 4px 0 0;
  color: var(--muted);
}

.sheet .price {
  margin: 14px 0 0;
  font-size: 20px;
  font-weight: 600;
}

.sheet h3 {
  margin: 22px 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.specs {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
}

.specs dt {
  color: var(--muted);
}

.specs dd {
  margin: 0;
  text-align: right;
}

.fit {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.fit li {
  display: flex;
  gap: 8px;
}

.fit .mark {
  flex: none;
  width: 16px;
  font-weight: 700;
}

.fit .yes .mark {
  color: var(--ok);
}

.fit .no .mark {
  color: var(--no);
}

.fit .no {
  color: var(--ink-2);
}

.fit .q {
  color: var(--muted);
  font-size: 12px;
}

.sheet-cta {
  margin: 24px 0 0;
  width: 100%;
  height: 46px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.sheet-cta:disabled {
  opacity: 0.35;
  cursor: default;
}

.sheet-note {
  margin: 8px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

/* ---- About ----------------------------------------------------------- */

.about {
  width: min(440px, calc(100% - 32px));
  border: 0;
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.16);
  color: var(--ink);
}

.about::backdrop {
  background: rgba(20, 20, 20, 0.2);
}

.about h2 {
  margin: 0 0 10px;
  font-size: 20px;
}

.about p {
  margin: 0 0 12px;
  color: var(--ink-2);
  line-height: 1.6;
}

/* ---- Small screens --------------------------------------------------- */

@media (max-width: 640px) {
  .bar {
    padding: 0 14px;
  }

  .logo span {
    display: none;
  }

  .cat {
    width: 32px;
  }

  .dock {
    width: 100%;
  }

  .dock-card {
    padding: 14px 16px 12px;
  }

  .question {
    font-size: 18px;
  }

  .options {
    grid-template-columns: 1fr 1fr;
  }

  .option {
    min-height: 60px;
  }

  .option .opt-label {
    font-size: 15px;
  }

  .item .label {
    max-width: 150px;
  }

  .item .name {
    font-size: 12px;
  }

  .item .meta {
    font-size: 11px;
  }

  .sheet {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 85vh;
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .item,
  .sheet {
    transition-duration: 0.01s;
  }
}
