* {
  box-sizing: border-box;
}

:root {
  --ink: #111;
  --paper: #fffbe6;
  --yellow: #f5e642;
  --green: #2fbf71;
  --red: #ff3b30;
  --blue: #2f80ed;
  --shadow: 5px 5px 0 #000;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-width: 320px;
  font-family: 'Inter', sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 18%, rgba(255,255,255,0.65) 0 8px, transparent 9px),
    repeating-linear-gradient(
      45deg,
      rgba(0,0,0,0.055) 0,
      rgba(0,0,0,0.055) 6px,
      transparent 6px,
      transparent 14px
    ),
    var(--yellow);
}

body.modal-open {
  overflow: hidden;
}

button,
a,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

/* layout */
.page {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 100dvh;
}

/* glitch */
.glitch {
  position: relative;
  display: inline-block;
  margin: 0;
  font-family: 'Rubik Mono One', sans-serif;
  font-size: clamp(22px, 4vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.03em;
  text-wrap: balance;
  text-shadow: 2px 2px 0 #fff, 4px 4px 0 rgba(0,0,0,0.14);
}

.glitch::after {
  content: attr(data-text);
  position: absolute;
  left: 2px;
  top: 0;
  color: var(--red);
  opacity: 0.28;
  pointer-events: none;
}

/* header */
.hero {
  text-align: center;
  padding: clamp(12px, 2.6vw, 24px) 14px 8px;
}

.sub {
  max-width: 780px;
  margin: 10px auto 0;
  font-size: clamp(12px, 2vw, 15px);
  line-height: 1.35;
}

#countdown {
  display: inline-block;
  margin-top: 8px;
  padding: 5px 9px;
  border: 2px solid #000;
  border-radius: 999px;
  background: rgba(255,255,255,0.72);
  box-shadow: 2px 2px 0 #000;
  font-size: 12px;
  font-weight: 600;
}

/* slider */
.carousel-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.slider {
  display: flex;
  width: 100%;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

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

.slide {
  flex: 0 0 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: clamp(10px, 2.6vw, 22px) clamp(14px, 6vw, 84px);
  scroll-snap-align: center;
}

/* card */
.card {
  width: min(100%, 980px);
  max-height: 100%;
  display: grid;
  grid-template-columns: minmax(240px, 0.95fr) minmax(260px, 1fr);
  gap: clamp(14px, 2.6vw, 28px);
  align-items: center;
  background: var(--paper);
  border: 3px solid #222;
  border-radius: 26px 18px 30px 16px;
  box-shadow: var(--shadow);
  padding: clamp(12px, 2vw, 20px);
  transform: rotate(-0.7deg);
}

.card:nth-child(even) {
  transform: rotate(0.7deg);
}

.image-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 3px solid #111;
  border-radius: 18px 14px 22px 12px;
  background:
    linear-gradient(135deg, rgba(0,0,0,0.08) 25%, transparent 25% 50%, rgba(0,0,0,0.08) 50% 75%, transparent 75%),
    #fff;
  background-size: 16px 16px;
}

.image-frame::after {
  content: "фото товара, не улика";
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 4px 7px;
  border: 2px solid #000;
  border-radius: 999px;
  background: #fff;
  font-size: 11px;
  font-weight: 600;
}

.card img {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}

.card-body {
  min-width: 0;
}

.eyebrow {
  display: inline-block;
  margin: 0 0 8px;
  padding: 4px 7px;
  background: var(--blue);
  color: #fff;
  border: 2px solid #000;
  border-radius: 9px;
  box-shadow: 2px 2px 0 #000;
  font-size: 11px;
  font-weight: 600;
  transform: rotate(1.2deg);
}

.card h2 {
  margin: 0;
  font-family: 'Rubik Mono One', sans-serif;
  font-size: clamp(21px, 3.2vw, 40px);
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.description {
  margin: 12px 0 0;
  font-size: clamp(14px, 1.7vw, 17px);
  line-height: 1.42;
}

.joy {
  margin: 14px 0 0;
  padding: 9px 10px;
  border: 2px dashed #000;
  border-radius: 12px;
  background: rgba(255,255,255,0.58);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(13px, 1.8vw, 16px);
  white-space: nowrap;
  overflow-x: auto;
}

.price {
  margin-top: 12px;
  font-size: clamp(20px, 2.8vw, 30px);
  font-weight: 700;
}

/* actions */
.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.buy-link,
.reserve-btn,
#confirm,
#close {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 11px 12px;
  border: 2px solid #000;
  border-radius: 13px 10px 14px 9px;
  color: #000;
  text-decoration: none;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.12;
  box-shadow: 3px 3px 0 #000;
}

.buy-link {
  background: #fff;
  border-style: dashed;
}

.buy-link--disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.reserve-btn {
  background: var(--green);
  cursor: pointer;
}

.buy-link:focus-visible,
.reserve-btn:focus-visible,
.arrow:focus-visible,
#confirm:focus-visible,
#close:focus-visible,
.modal-inner input:focus-visible {
  outline: 3px solid var(--red);
  outline-offset: 3px;
}

.reserve-btn.disabled,
.reserve-btn:disabled {
  background: #cfcfcf;
  cursor: not-allowed;
  opacity: 0.72;
}

/* arrows */
.arrow {
  position: absolute;
  top: 50%;
  z-index: 10;
  width: 46px;
  height: 58px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #000;
  color: #fff;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.3);
  cursor: pointer;
  transform: translateY(-50%);
}

.arrow-left { left: clamp(8px, 2vw, 18px); }
.arrow-right { right: clamp(8px, 2vw, 18px); }

/* footer */
.footer {
  text-align: center;
  font-size: 12px;
  padding: 8px 12px 12px;
}

#counter {
  font-weight: 600;
}

#status {
  margin-top: 4px;
  opacity: 0.7;
}

/* modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0,0,0,0.72);
}

.hidden {
  display: none;
}

.modal-inner {
  width: min(94vw, 520px);
  padding: clamp(20px, 4vw, 32px);
  border: 3px solid #000;
  border-radius: 28px 18px 34px 16px;
  background:
    repeating-linear-gradient(-8deg, rgba(0,0,0,0.045) 0 7px, transparent 7px 15px),
    var(--paper);
  box-shadow: 8px 8px 0 #000;
  transform: rotate(-0.7deg);
}

.modal-inner h3 {
  margin: 0 0 14px;
  font-family: 'Rubik Mono One', sans-serif;
  font-size: clamp(22px, 4vw, 32px);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.modal-inner input {
  width: 100%;
  min-height: 50px;
  margin-top: 10px;
  padding: 0 13px;
  border: 2px solid #000;
  border-radius: 13px;
  background: #fff;
  box-shadow: 3px 3px 0 #000;
  color: #000;
  font-size: 16px;
}

.modal-inner input[aria-invalid="true"] {
  border-color: var(--red);
}

.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 16px 0;
  font-size: 14px;
  line-height: 1.3;
}

.checkbox input {
  width: 18px;
  min-height: 18px;
  margin: 0;
  box-shadow: none;
  accent-color: var(--green);
}

#confirm,
#close {
  width: 100%;
  cursor: pointer;
}

#confirm {
  background: var(--green);
}

#close {
  margin-top: 10px;
  background: #fff;
}

@media (max-width: 760px) {
  .page {
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .hero {
    padding-top: 10px;
  }

  .glitch {
    font-size: clamp(20px, 7vw, 30px);
  }

  .sub {
    margin-top: 8px;
  }

  .slide {
    align-items: flex-start;
    padding: 10px 12px 14px;
  }

  .card {
    grid-template-columns: 1fr;
    gap: 12px;
    width: min(100%, 430px);
    padding: 12px;
    border-radius: 22px 15px 26px 14px;
  }

  .image-frame {
    max-height: min(45vh, 360px);
  }

  .description {
    margin-top: 9px;
  }

  .joy {
    margin-top: 10px;
  }

  .actions {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 12px;
  }

  .arrow {
    top: auto;
    bottom: 56px;
    width: 42px;
    height: 42px;
    padding: 0;
    border-color: #000;
    background: rgba(255,255,255,0.88);
    color: #000;
    transform: none;
  }

  .footer {
    padding-bottom: 10px;
  }
}

@media (max-width: 420px) {
  .hero br {
    display: none;
  }

  .card h2 {
    font-size: 20px;
  }

  .eyebrow,
  .image-frame::after {
    font-size: 10px;
  }

  .modal {
    align-items: flex-end;
    padding: 12px;
  }

  .modal-inner {
    width: 100%;
    border-radius: 24px 18px 18px 18px;
  }
}
