:root {
  color-scheme: light;
  --bg: #ffffff;
  --text: #2a2a2a;
  --muted: #777777;
  --line: #d8d8d8;
  --line-strong: #9d9d9d;
  --soft: #f5f5f5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
select {
  font: inherit;
}

.product-page {
  width: min(1720px, calc(100% - 64px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 32px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 520px);
  gap: clamp(44px, 6vw, 108px);
  align-items: center;
}

.product-gallery {
  min-width: 0;
  display: block;
}

.canvas-shell {
  position: relative;
  width: 100%;
  max-width: min(780px, calc((100vh - 64px) * 0.667));
  background: #fff;
  overflow: hidden;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
}

.canvas-controls {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.canvas-controls:not([hidden]) {
  display: block;
}

.canvas-zone {
  position: absolute;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px;
  padding: 0 6px;
  pointer-events: none;
}

.canvas-zone__hit {
  height: 100%;
  min-height: 44px;
  pointer-events: auto;
  touch-action: pan-y;
  cursor: grab;
}

.canvas-zone__hit.is-dragging {
  cursor: grabbing;
}

.canvas-arrow {
  width: 20px;
  height: 78px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #9aa1a5;
  cursor: pointer;
  pointer-events: auto;
  transition: color 0.15s ease, opacity 0.15s ease;
}

.canvas-arrow svg {
  display: block;
  width: 100%;
  height: 100%;
}

.canvas-arrow path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.canvas-arrow:hover {
  color: #222;
}

.canvas-arrow:active {
  opacity: 0.55;
}

.canvas-zone--pillows {
  top: 18%;
  height: 13%;
}

.canvas-zone--duvet-cover {
  top: 43%;
  height: 14%;
}

.canvas-zone--blanket {
  top: 68%;
  height: 16%;
}

.loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.loading[hidden] {
  display: none;
}

.loading.is-error {
  color: #8a2f2f;
}

.product-info {
  padding-top: 0;
}

h1 {
  margin: 0 0 30px;
  font-size: 31px;
  line-height: 1.15;
  font-weight: 700;
}

.price {
  margin-bottom: 8px;
  font-size: 28px;
  line-height: 1.1;
}

.builder-note {
  max-width: 430px;
  margin: 18px 0 20px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.4;
}

.control-groups {
  display: grid;
  gap: 20px;
  margin-bottom: 22px;
}

.favorites {
  margin-bottom: 26px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

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

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

.favorites__add {
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}

.favorites__add.is-active {
  border-color: #222;
  background: #222;
  color: #fff;
}

.favorites__title {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
  font-weight: 400;
}

.favorites__count {
  color: var(--muted);
  font-size: 13px;
}

.favorites__save {
  margin-bottom: 14px;
}

.favorites__save-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.favorites__save-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 36px;
  gap: 8px;
  align-items: center;
}

.favorites__name-input {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-size: 15px;
}

.favorites__name-input:focus {
  outline: 2px solid #222;
  outline-offset: 1px;
}

.favorites__save-btn {
  height: 40px;
  padding: 0 16px;
  border: 1px solid #222;
  border-radius: 6px;
  background: #222;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  white-space: nowrap;
}

.favorites__cancel-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.favorites__gallery {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}

.favorites__gallery::-webkit-scrollbar {
  width: 4px;
}

.favorites__gallery::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}

.favorites__empty {
  margin: 0;
  padding: 14px 0 4px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.favorite-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  gap: 6px;
  align-items: center;
  padding: 10px 10px 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  transition: border-color 0.15s ease;
}

.favorite-card.is-new {
  border-color: #222;
}

.favorite-card__apply {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.favorite-card__chips {
  display: flex;
  gap: 4px;
}

.favorite-card__chip {
  width: 22px;
  height: 22px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 4px;
  flex-shrink: 0;
}

.favorite-card__name {
  font-size: 14px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.favorite-card__delete {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.favorite-card__delete:hover {
  color: #8a2f2f;
}

.favorite-card:hover {
  border-color: var(--line-strong);
}

.group {
  display: grid;
  gap: 10px;
}

.group__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.group__title {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
  font-weight: 400;
}

.group__selected {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.2;
  text-align: right;
}

.color-carousel {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 30px;
  gap: 8px;
  align-items: center;
}

.nav-button {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #9aa1a5;
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
}

.swatch-rail {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(6, 64px);
  gap: 8px;
}

.swatch {
  width: 58px;
  height: 58px;
  padding: 4px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
}

.swatch[aria-pressed="true"] {
  border-color: #222;
}

.swatch__chip {
  display: block;
  width: 100%;
  height: 100%;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

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

.active-color {
  display: none;
}

@media (max-width: 1120px) {
  .product-page {
    min-height: auto;
    padding: 28px 0 60px;
    grid-template-columns: 1fr;
    gap: 36px;
    align-items: start;
  }

  .product-info {
    padding-top: 0;
  }

  .product-gallery {
    width: min(760px, 100%);
    margin: 0 auto;
  }

  .canvas-shell {
    max-width: none;
  }
}

@media (max-width: 720px) {
  .product-page {
    width: calc(100% - 28px);
    padding-top: 18px;
  }

  .product-gallery {
    width: 100%;
  }

  h1 {
    font-size: 28px;
  }

  .swatch-rail {
    grid-template-columns: repeat(4, 58px);
  }

  .canvas-arrow {
    width: 24px;
    height: 92px;
  }

  .canvas-zone {
    padding: 0 2px;
  }
}
