:root {
  --tg-bg: #f3efe8;
  --tg-text: #1f1b16;
  --tg-hint: #6f675e;
  --tg-button: #2f5d50;
  --tg-button-text: #ffffff;
  --tg-secondary: #fffdf8;
  --line: color-mix(in srgb, var(--tg-hint) 28%, transparent);
  --ok: #1f7a4d;
  --wait: #9a7b1a;
  --no: #a33b32;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--tg-bg);
  color: var(--tg-text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.top,
main {
  width: min(720px, calc(100% - 24px));
  margin: 0 auto;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 20px 0 14px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--tg-hint);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-weight: 600;
}

.count,
.status {
  color: var(--tg-hint);
}

.status {
  padding: 16px 0;
}

.status[data-kind="error"] {
  color: var(--no);
}

.list {
  list-style: none;
  margin: 14px 0 48px;
  padding: 0;
  display: grid;
  gap: 10px;
}

.card {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--tg-secondary);
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
  background: var(--line);
}

.thumb.empty {
  display: grid;
  place-items: center;
  color: var(--tg-hint);
  font-size: 11px;
}

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

.card .sub {
  margin: 4px 0 0;
  color: var(--tg-hint);
  font-size: 13px;
}

.card .price {
  font-size: 16px;
  white-space: nowrap;
  color: var(--tg-button);
}

.badge {
  display: inline-block;
  margin: 0 0 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
}

.badge.in-stock {
  background: #d7f0e1;
  color: var(--ok);
}

.badge.order {
  background: #f4e9c0;
  color: var(--wait);
}

.badge.not-in-stock {
  background: #f3d6d3;
  color: var(--no);
}

.modal {
  width: min(720px, calc(100% - 16px));
  max-height: calc(100% - 16px);
  padding: 0;
  border: none;
  border-radius: 16px;
  background: transparent;
}

.modal::backdrop {
  background: rgb(0 0 0 / 45%);
}

.sheet {
  position: relative;
  display: grid;
  background: var(--tg-secondary);
  color: var(--tg-text);
  overflow: auto;
  max-height: calc(100vh - 16px);
  border-radius: 16px;
}

.close {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--tg-secondary) 90%, transparent);
  color: var(--tg-text);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.gallery {
  background: #111;
  min-height: 220px;
}

.gallery img#hero {
  width: 100%;
  height: 260px;
  object-fit: contain;
  background: #111;
}

.thumbs {
  display: flex;
  gap: 8px;
  padding: 10px;
  overflow-x: auto;
}

.thumbs button {
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  background: none;
  cursor: pointer;
}

.thumbs button[aria-current="true"] {
  border-color: #fff;
}

.thumbs img {
  display: block;
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
}

.details {
  padding: 20px 20px 28px;
}

.details .price {
  margin: 8px 0 16px;
  font-size: 24px;
  color: var(--tg-button);
}

.meta {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 6px 12px;
  margin: 0 0 16px;
  color: var(--tg-hint);
}

.meta dt,
.meta dd {
  margin: 0;
}

.meta dd {
  color: var(--tg-text);
}

.desc :first-child {
  margin-top: 0;
}

@media (max-width: 520px) {
  .card {
    grid-template-columns: 64px 1fr;
  }

  .card .price {
    grid-column: 2;
  }
}
