:root {
  --brick-red: #e11d2e;
  --brick-red-dark: #b10f1e;
  --stud-yellow: #f6c90e;
  --lego-blue: #0a5bd3;
  --ink: #1c1917;
  --muted: #57534e;
  --paper: #fff6ea;
  --card: #ffffff;
  --line: #eadfce;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: Outfit, 'Segoe UI', sans-serif;
  background-color: var(--paper);
  background-image: radial-gradient(circle, #f0e2cc 1.4px, transparent 1.5px);
  background-size: 22px 22px;
  line-height: 1.45;
  isolation: isolate;
}

h1,
h2,
h3,
.brand-name,
.button-primary,
.button-secondary {
  font-family: Fredoka, 'Trebuchet MS', sans-serif;
}

button,
input,
select {
  font: inherit;
}

:focus-visible {
  outline: 3px solid var(--lego-blue);
  outline-offset: 2px;
}

.wrap {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 250, 243, 0.94);
  border-bottom: 4px solid var(--brick-red);
  backdrop-filter: blur(8px);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 80px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 5px 0 #9d1020;
}

.brand-name,
.brand-tag {
  display: block;
}

.brand-name {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-tag,
.set-meta,
.results-meta,
.detour {
  color: var(--muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stats {
  margin: 0;
  font-weight: 700;
}

.site-banner,
.disclaimer {
  background: var(--stud-yellow);
  color: #1c1917;
  font-weight: 700;
}

.site-banner {
  margin: 0;
  padding: 10px 16px;
  text-align: center;
}

.disclaimer {
  border-radius: 14px;
  padding: 12px 14px;
}

.hero {
  position: relative;
  padding: 36px 0 8px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brick-red);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(2.4rem, 5vw, 4.4rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
}

.hero p,
.lightning-head p,
.steps p {
  max-width: 62ch;
}

.steps ol {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  background: var(--card);
  border-radius: 18px;
  padding: 16px 16px 8px;
  box-shadow: 0 10px 24px rgba(80, 40, 10, 0.06);
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--lego-blue);
  color: white;
  font-family: Fredoka, 'Trebuchet MS', sans-serif;
  font-weight: 700;
}

.steps-head,
.lightning h2,
.filters {
  margin-top: 28px;
}

.steps-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.steps-head h2 {
  margin: 0;
}

.steps-dismiss {
  flex: none;
}

.steps {
  transform-origin: top right;
}

.steps[hidden] {
  display: none !important;
}

.steps.is-collapsing {
  animation: how-shrink 220ms ease-in forwards;
}

.steps.is-expanding {
  animation: how-grow 220ms ease-out;
}

@keyframes how-shrink {
  to {
    opacity: 0;
    transform: scale(0.2);
  }
}

@keyframes how-grow {
  from {
    opacity: 0;
    transform: scale(0.2);
  }
}

.how-toggle {
  position: absolute;
  top: 24px;
  right: 0;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  padding: 4px;
  border: 3px solid var(--stud-yellow);
  border-radius: 50%;
  background: white;
  box-shadow: 0 4px 0 var(--lego-blue);
  cursor: pointer;
  transition: transform 120ms ease-out;
}

.how-toggle[hidden] {
  display: none;
}

.hero:has(.how-toggle:not([hidden])) h1 {
  padding-right: 64px;
}

.how-toggle:hover {
  border-color: var(--brick-red);
  transform: translateY(-2px);
}

.how-toggle:focus-visible {
  outline: 3px solid var(--lego-blue);
  outline-offset: 3px;
}

.how-toggle-icon {
  display: block;
  width: auto;
  height: 40px;
  pointer-events: none;
  user-select: none;
}

@media (prefers-reduced-motion: reduce) {
  .steps.is-collapsing,
  .steps.is-expanding {
    animation: none;
  }

  .how-toggle {
    transition: none;
  }

  .how-toggle:hover {
    transform: none;
  }
}

.lightning-head,
.sheet-head,
.bill-row,
.cart-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.price-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
}

.countdown {
  margin: 0;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--stud-yellow);
  font-weight: 700;
}

.lightning-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(220px, 240px);
  gap: 12px;
  overflow-x: auto;
  padding: 4px 2px 16px;
}

.search-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.filters input,
.filters select,
.address-field select {
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: white;
  color: var(--ink);
}

.filters input {
  font-size: 1.05rem;
}

.chips,
.filter-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.chips {
  overflow-x: auto;
  padding-bottom: 4px;
}

.filter-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  align-items: end;
}

.filter-row > .button-secondary {
  white-space: nowrap;
}

.filter-row label,
.address-field {
  font-weight: 700;
}

.chip,
.button-primary,
.button-secondary,
.text-button {
  border-radius: 999px;
  cursor: pointer;
}

.chip,
.button-secondary,
.text-button {
  border: 2px solid var(--line);
  background: white;
  color: var(--ink);
}

.chip {
  padding: 8px 14px;
  white-space: nowrap;
}

.chip[aria-pressed='true'] {
  background: var(--brick-red);
  border-color: var(--brick-red);
  color: white;
}

.button-primary,
.button-secondary {
  border: 0;
  padding: 10px 16px;
  font-weight: 700;
}

.button-primary {
  background: var(--brick-red);
  color: white;
  box-shadow: 0 4px 0 var(--brick-red-dark);
}

.button-primary:hover {
  background: var(--brick-red-dark);
}

.button-secondary {
  border: 2px solid var(--line);
}

.button-block {
  width: 100%;
  margin-top: 10px;
}

.button-primary small,
.button-label {
  display: block;
}

.button-primary small {
  font-family: Outfit, 'Segoe UI', sans-serif;
  font-weight: 600;
}

.set-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.set-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 100%;
  padding: 12px;
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 10px 24px rgba(80, 40, 10, 0.06);
}

.set-card.is-drop {
  outline: 3px solid var(--stud-yellow);
}

.set-photo {
  position: relative;
  display: grid;
  place-items: center;
  height: 160px;
  border-radius: 12px;
  background: #f7f1e6;
  overflow: hidden;
}

.set-photo img {
  max-width: 100%;
  max-height: 148px;
  object-fit: contain;
}

.photo-missing {
  color: var(--muted);
  font-weight: 700;
}

.drop-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--stud-yellow);
  font-size: 0.8rem;
  font-weight: 700;
}

.set-theme,
.set-meta,
.set-name,
.results-meta {
  margin: 0;
}

.set-theme {
  color: var(--lego-blue);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.set-name {
  font-size: 1.15rem;
  line-height: 1.2;
}

.price-retail {
  color: var(--muted);
  text-decoration: line-through;
}

.price-sale {
  font-size: 1.25rem;
  font-weight: 700;
}

.price-off {
  color: #1d8a3b;
  font-size: 0.82rem;
  font-weight: 700;
}

.add-button,
.stepper {
  margin-top: auto;
}

.stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.stepper button,
.cart-count {
  display: grid;
  place-items: center;
  min-width: 2rem;
  height: 2rem;
  border-radius: 999px;
}

.stepper button {
  border: 0;
  background: var(--ink);
  color: white;
  cursor: pointer;
  font-weight: 700;
}

.cart-count {
  display: inline-grid;
  background: white;
  color: var(--brick-red);
  font-size: 0.85rem;
}

.show-more {
  display: block;
  margin: 18px auto 8px;
}

.empty,
.payoff {
  font-weight: 700;
}

.payoff {
  font-family: Fredoka, 'Trebuchet MS', sans-serif;
  font-size: 1.4rem;
}

.sheet-root[hidden] {
  display: none;
}

.sheet-root {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  justify-items: end;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: rgba(28, 25, 23, 0.46);
  cursor: pointer;
}

.sheet-panel {
  position: relative;
  z-index: 1;
  width: min(460px, 100%);
  height: 100%;
  overflow: auto;
  padding: 18px 18px 32px;
  background: #fffaf3;
  box-shadow: -16px 0 40px rgba(28, 25, 23, 0.16);
}

.sheet-head {
  position: sticky;
  top: 0;
  z-index: 2;
  margin-bottom: 12px;
  padding-bottom: 8px;
  background: #fffaf3;
}

.sheet-head h2 {
  margin: 0;
}

.sheet-panel .disclaimer,
.card-fake,
.address-field,
.bill-row,
.checkout-lines,
.cart-lines,
.order-list {
  margin-top: 12px;
}

.card-fake {
  padding: 14px;
  border-radius: 14px;
  background: #1c1917;
  color: white;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.bill-you-pay {
  font-size: 1.35rem;
  font-weight: 700;
}

.cart-lines,
.checkout-lines,
.order-list,
.stage-list {
  margin: 12px 0;
  padding: 0;
  list-style: none;
}

.cart-line,
.order-card {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.order-card {
  display: grid;
  gap: 4px;
}

.order-id {
  margin: 0;
  font-weight: 700;
}

.ordered-items {
  margin: 4px 0 0;
}

.ordered-items-title {
  margin: 0 0 8px;
  font-size: 1rem;
}

.ordered-item-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ordered-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ordered-item-photo {
  display: grid;
  flex: 0 0 56px;
  place-items: center;
  width: 56px;
  height: 56px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7f1e6;
}

.ordered-item-photo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ordered-item-photo .photo-missing {
  padding: 4px;
  font-size: 0.65rem;
  line-height: 1.2;
  text-align: center;
}

.ordered-item-copy {
  min-width: 0;
}

.ordered-item-name,
.ordered-item-meta {
  margin: 0;
}

.ordered-item-name {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.ordered-item-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.fake-map-frame {
  position: relative;
}

.fake-map {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 16px;
}

.fake-map #track-store,
.fake-map #track-house {
  pointer-events: none;
}

.delivery-minifig {
  position: absolute;
  left: var(--courier-left);
  top: var(--courier-top);
  z-index: 1;
  height: 96px;
  width: auto;
  pointer-events: none;
  user-select: none;
  transform: translate(-50%, -100%);
  animation: delivery-bob 1.8s ease-in-out infinite;
}

@keyframes delivery-bob {
  0%,
  100% {
    transform: translate(-50%, -100%);
  }

  50% {
    transform: translate(-50%, calc(-100% - 6px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .delivery-minifig {
    animation: none;
  }
}

.stage {
  margin: 6px 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: white;
  color: var(--muted);
}

.stage.is-done {
  color: var(--ink);
}

.stage.is-current {
  background: #fff1a8;
  color: var(--ink);
  font-weight: 700;
}

.site-footer {
  margin-top: 48px;
  padding: 28px 0 40px;
  background: var(--ink);
  color: #fff6ea;
}

.site-footer p {
  margin: 0;
}

body:has(.sheet-root:not([hidden])) {
  overflow: hidden;
}

@media (max-width: 800px) {
  .header-inner,
  .steps ol,
  .filter-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .filter-row > .button-secondary {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .header-inner,
  .steps ol {
    grid-template-columns: 1fr;
  }

  .header-actions {
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto;
  }

  .falling-bricks {
    display: none;
  }
}

.falling-bricks {
  --brick-scale: 1;
  --brick-travel: 220px;
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.falling-brick {
  position: absolute;
  top: 0;
  display: block;
  width: calc(var(--brick-width) * var(--brick-scale));
  opacity: var(--brick-opacity);
  transform: translate3d(0, calc(-1 * var(--brick-travel)), 0);
  animation: brick-fall var(--fall-duration) linear var(--fall-delay) infinite;
  will-change: transform;
}

.falling-brick-image {
  display: block;
  width: 100%;
  height: auto;
  animation: brick-spin var(--spin-duration) linear var(--fall-delay) infinite
    var(--spin-direction);
  pointer-events: none;
  user-select: none;
}

.falling-brick:nth-child(1) {
  left: 2%;
  --brick-width: 108px;
  --brick-opacity: 0.34;
  --drift: 26px;
  --fall-duration: 36s;
  --fall-delay: -7s;
  --spin-duration: 22s;
  --spin-direction: normal;
}

.falling-brick:nth-child(2) {
  left: 16%;
  --brick-width: 78px;
  --brick-opacity: 0.4;
  --drift: -18px;
  --fall-duration: 28s;
  --fall-delay: -19s;
  --spin-duration: 30s;
  --spin-direction: reverse;
}

.falling-brick:nth-child(3) {
  left: 28%;
  --brick-width: 128px;
  --brick-opacity: 0.28;
  --drift: 34px;
  --fall-duration: 46s;
  --fall-delay: -12s;
  --spin-duration: 40s;
  --spin-direction: normal;
}

.falling-brick:nth-child(4) {
  left: 42%;
  --brick-width: 84px;
  --brick-opacity: 0.38;
  --drift: -24px;
  --fall-duration: 32s;
  --fall-delay: -25s;
  --spin-duration: 26s;
  --spin-direction: reverse;
}

.falling-brick:nth-child(5) {
  left: 54%;
  --brick-width: 72px;
  --brick-opacity: 0.42;
  --drift: 14px;
  --fall-duration: 24s;
  --fall-delay: -4s;
  --spin-duration: 18s;
  --spin-direction: normal;
}

.falling-brick:nth-child(6) {
  left: 63%;
  --brick-width: 96px;
  --brick-opacity: 0.32;
  --drift: -30px;
  --fall-duration: 40s;
  --fall-delay: -31s;
  --spin-duration: 34s;
  --spin-direction: reverse;
}

.falling-brick:nth-child(7) {
  left: 74%;
  --brick-width: 80px;
  --brick-opacity: 0.36;
  --drift: 18px;
  --fall-duration: 30s;
  --fall-delay: -16s;
  --spin-duration: 24s;
  --spin-direction: normal;
}

.falling-brick:nth-child(8) {
  left: 84%;
  --brick-width: 112px;
  --brick-opacity: 0.3;
  --drift: -12px;
  --fall-duration: 48s;
  --fall-delay: -22s;
  --spin-duration: 44s;
  --spin-direction: reverse;
}

.falling-brick:nth-child(9) {
  left: 10%;
  --brick-width: 76px;
  --brick-opacity: 0.4;
  --drift: 22px;
  --fall-duration: 27s;
  --fall-delay: -14s;
  --spin-duration: 20s;
  --spin-direction: reverse;
}

.falling-brick:nth-child(10) {
  left: 90%;
  --brick-width: 88px;
  --brick-opacity: 0.34;
  --drift: -20px;
  --fall-duration: 38s;
  --fall-delay: -9s;
  --spin-duration: 32s;
  --spin-direction: normal;
}

.falling-brick:nth-child(11) {
  left: 6%;
  --brick-width: 64px;
  --brick-opacity: 0.38;
  --drift: 16px;
  --fall-duration: 31s;
  --fall-delay: -24s;
  --spin-duration: 28s;
  --spin-direction: normal;
}

.falling-brick:nth-child(12) {
  left: 22%;
  --brick-width: 92px;
  --brick-opacity: 0.32;
  --drift: -26px;
  --fall-duration: 42s;
  --fall-delay: -3s;
  --spin-duration: 36s;
  --spin-direction: reverse;
}

.falling-brick:nth-child(13) {
  left: 35%;
  --brick-width: 68px;
  --brick-opacity: 0.4;
  --drift: 20px;
  --fall-duration: 26s;
  --fall-delay: -20s;
  --spin-duration: 22s;
  --spin-direction: reverse;
}

.falling-brick:nth-child(14) {
  left: 48%;
  --brick-width: 104px;
  --brick-opacity: 0.3;
  --drift: -16px;
  --fall-duration: 44s;
  --fall-delay: -38s;
  --spin-duration: 38s;
  --spin-direction: normal;
}

.falling-brick:nth-child(15) {
  left: 58%;
  --brick-width: 60px;
  --brick-opacity: 0.42;
  --drift: 24px;
  --fall-duration: 25s;
  --fall-delay: -11s;
  --spin-duration: 19s;
  --spin-direction: reverse;
}

.falling-brick:nth-child(16) {
  left: 69%;
  --brick-width: 116px;
  --brick-opacity: 0.28;
  --drift: -22px;
  --fall-duration: 50s;
  --fall-delay: -27s;
  --spin-duration: 46s;
  --spin-direction: normal;
}

.falling-brick:nth-child(17) {
  left: 79%;
  --brick-width: 74px;
  --brick-opacity: 0.38;
  --drift: 12px;
  --fall-duration: 29s;
  --fall-delay: -6s;
  --spin-duration: 25s;
  --spin-direction: normal;
}

.falling-brick:nth-child(18) {
  left: 95%;
  --brick-width: 70px;
  --brick-opacity: 0.36;
  --drift: -28px;
  --fall-duration: 34s;
  --fall-delay: -18s;
  --spin-duration: 30s;
  --spin-direction: reverse;
}

.falling-brick:nth-child(19) {
  left: 38%;
  --brick-width: 86px;
  --brick-opacity: 0.34;
  --drift: 30px;
  --fall-duration: 37s;
  --fall-delay: -33s;
  --spin-duration: 32s;
  --spin-direction: normal;
}

.falling-brick:nth-child(20) {
  left: 66%;
  --brick-width: 66px;
  --brick-opacity: 0.4;
  --drift: -14px;
  --fall-duration: 23s;
  --fall-delay: -13s;
  --spin-duration: 21s;
  --spin-direction: reverse;
}

@keyframes brick-fall {
  from {
    transform: translate3d(0, calc(-1 * var(--brick-travel)), 0);
  }

  to {
    transform: translate3d(var(--drift), calc(100vh + var(--brick-travel)), 0);
  }
}

@keyframes brick-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 700px) {
  .falling-bricks {
    --brick-scale: 0.6;
    --brick-travel: 140px;
  }
}
