.btn { padding: 13px 24px; font-size: 14px; }
.btn:active { transform: scale(.95); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }

.page-head { padding-top: 26px; padding-bottom: 8px; }
.page-head h1 { font-size: 30px; font-weight: 600; margin-bottom: 8px; }
.page-head p { color: var(--muted); font-size: 14.5px; max-width: 480px; }

.builder-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; padding-top: 24px; padding-bottom: 100px; align-items: start; }

/* ---------- превью комнаты ---------- */
.preview-wrap { position: sticky; top: 96px; }
.room-stage {
  position: relative; aspect-ratio: 1/1;
  background: linear-gradient(var(--line) 1px, transparent 1px) 0 0/26px 26px, linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0/26px 26px, var(--card);
  border: 1px solid var(--card-line); border-radius: 20px; padding: 20px;
}
.floor { position: absolute; inset: 22%; border-radius: 4px; border: 2px solid var(--ink); background: none; overflow: visible; }
/* Слой отделки (цвет+текстура) для пола и стен на холсте — позади предметов,
   обрезан по скруглению ячейки. Сам .panel-surface даёт текстуру и overflow. */
.panel-fill { position: absolute; inset: 0; z-index: 0; border-radius: inherit; }
.placed-item { position: absolute; background: var(--paper); border: 1.5px solid var(--ink); border-radius: 5px; display: flex; align-items: center; justify-content: center; cursor: grab; touch-action: none; opacity: 0; transform: scale(.6); animation: itemIn .3s cubic-bezier(.2,.9,.3,1.4) forwards; }
.placed-item.dragging { cursor: grabbing; border-color: var(--orange); z-index: 20; }
@keyframes itemIn { to { opacity: 1; transform: scale(1); } }
.remove-x { position: absolute; top: -8px; right: -8px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink); color: var(--paper); font-size: 9px; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .15s ease; }
.placed-item:hover .remove-x { opacity: 1; }
.ghost-drag { position: fixed; z-index: 500; pointer-events: none; background: var(--paper); border: 1.5px solid var(--orange); border-radius: 6px; display: flex; align-items: center; justify-content: center; }

.wall-slot { position: absolute; border-radius: 4px; border: 2px dashed var(--card-line); transition: border-color .2s ease, background .2s ease; cursor: default; }
.wall-slot.filled { border-style: solid; border-color: var(--ink); cursor: pointer; }
.wall-slot.filled::after { content: '✕'; position: absolute; top: -8px; right: -8px; width: 18px; height: 18px; border-radius: 50%; background: var(--ink); color: var(--paper); font-size: 10px; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .15s ease; }
.wall-slot.filled:hover::after { opacity: 1; }
/* Тап-цель слота стены на плане (mobile-instructions/03 п.4) — визуальная
   толщина линии на диаграмме остаётся как есть, увеличиваем только зону
   попадания пальцем невидимым ::before (тот же приём, что у крестика Telegram
   и корзины). Крестик удаления заполненной стены — тоже был hover-only,
   на тач невидим навсегда (см. п.2), показываем его тоже. */
.wall-slot::before { content: ''; position: absolute; inset: -14px; }
@media (hover: none) {
  .wall-slot.filled::after { opacity: 1; }
}
.slot-n { top: 22%; left: 22%; right: 22%; height: 16px; transform: translateY(-50%); }
.slot-s { bottom: 22%; left: 22%; right: 22%; height: 16px; transform: translateY(50%); }
.slot-w { left: 22%; top: 22%; bottom: 22%; width: 16px; transform: translateX(-50%); }
.slot-e { right: 22%; top: 22%; bottom: 22%; width: 16px; transform: translateX(50%); }
.wall-slot.stuck { animation: stickFlash .35s ease; }
@keyframes stickFlash { 0% { border-color: var(--orange); } 100% { border-color: var(--ink); } }

.wall-palette { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.wall-piece { width: 56px; height: 56px; background: var(--paper); border: 2px solid var(--ink); border-radius: 8px; display: flex; align-items: center; justify-content: center; cursor: grab; touch-action: none; flex-shrink: 0; }
.wall-piece.dragging { cursor: grabbing; border-color: var(--orange); position: fixed; z-index: 200; transition: none !important; }
.wall-piece.hidden { display: none; }
.drag-hint { font-size: 12.5px; color: var(--muted); }

.total-bar { margin-top: 18px; padding: 20px 22px; background: var(--ink); color: var(--paper); border-radius: 16px; }
.total-row { display: flex; justify-content: space-between; font-size: 13px; color: #b8b6b0; margin-bottom: 8px; }
.total-row b { color: var(--paper); }
.total-track { height: 8px; border-radius: 100px; background: #2c2d31; overflow: hidden; margin-bottom: 8px; }
.total-fill { height: 100%; width: 0%; background: var(--orange); transition: width .25s ease, background .25s ease; }
.overage-line { font-size: 12.5px; color: var(--orange); min-height: 16px; margin-bottom: 10px; }
.total-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.reset-link { background: none; border: none; font-size: 12px; color: #8b8a85; text-decoration: underline; }

/* ---------- панель конфигурации ---------- */
.step { margin-bottom: 34px; }
.step h3 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.step .hint { font-size: 12.5px; color: var(--muted); margin-bottom: 14px; }

.wall-config { background: var(--card); border: 1px solid var(--card-line); border-radius: 14px; padding: 16px; margin-bottom: 12px; }
.wall-config .wc-head { font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.swatch-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.swatch-btn { display: flex; flex-direction: column; align-items: center; gap: 5px; border: none; background: none; }
.swatch-dot { width: 32px; height: 32px; border-radius: 50%; border: 2px solid transparent; }
.swatch-btn.active .swatch-dot { border-color: var(--orange); }
.swatch-btn span.sw-name { font-size: 10px; color: var(--muted); }
.show-all-link { font-size: 12px; color: var(--orange-dark); background: none; border: none; text-decoration: underline; margin-left: 4px; }

.option-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.option-item { position: relative; background: var(--card); border: 1.5px solid var(--card-line); border-radius: 12px; padding: 12px 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.option-item.selected { border-color: var(--orange); background: #fff6f1; }
.option-item.selected::after { content: '✓'; position: absolute; top: 6px; right: 6px; width: 16px; height: 16px; border-radius: 50%; background: var(--orange); color: #fff; font-size: 10px; display: flex; align-items: center; justify-content: center; }
.option-item span.oi-name { font-size: 11.5px; font-weight: 600; }
.option-item span.oi-price { font-size: 10.5px; color: var(--muted); }

.toast { z-index: 400; }

@media (max-width: 860px) {
  .builder-grid { grid-template-columns: 1fr; }
  .option-grid { grid-template-columns: repeat(3, 1fr); }
}

/* mobile-instructions (реальный телефон, 6 проблем, п.3): раньше на мобильном
   .preview-wrap терял sticky (position:static) — весь десктопный layout просто
   ставился в столбец, и холст уходил на ~900px скролла выше списка мебели,
   физически недотащить одним жестом. Держим холст (уменьшенный) прибитым
   к верху вместе с бюджетом, пока пролистываются стены/пол/мебель/аксессуары
   ниже — тот же sticky-приём, что уже работает на десктопе (top: 96px), просто
   с высотой мобильной шапки и уменьшенными внутренними отступами. */
@media (max-width: 640px) {
  /* Заголовок+описание — статичный текст, не сам инструмент; на телефоне
     он забирал ~200px до начала холста ("пустое пространство между меню и
     конструктором"). Сжимаем, не убираем — описание всё ещё нужно. */
  .page-head { padding-top: 12px; padding-bottom: 4px; }
  .page-head h1 { font-size: 21px; margin-bottom: 4px; }
  .page-head p { font-size: 12.5px; line-height: 1.35; }

  .preview-wrap {
    top: 66px;
    z-index: 40;
    background: var(--paper);
    padding-bottom: 10px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--line);
  }
  /* Холст крупнее (168 -> 224px) — освободили место сверху (page-head) и
     снизу (total-bar), см. соседние правки в этом же блоке. */
  .room-stage { width: 224px; margin: 0 auto; padding: 10px; }
  .wall-palette { margin-top: 8px; gap: 8px; }
  .wall-piece { width: 38px; height: 38px; }
  /* total-bar тут — вторичная информация (бюджет), а не главный элемент
     экрана, пока пролистываются списки стен/пола/мебели/аксессуаров ниже.
     Сжимаем сильнее прежнего: подпись и цифра в одну плотную строку,
     тоньше трек, компактнее кнопки. */
  .total-bar { margin-top: 8px; padding: 8px 12px; }
  .total-row { font-size: 11px; margin-bottom: 4px; }
  .total-track { height: 5px; margin-bottom: 4px; }
  .overage-line { font-size: 10.5px; min-height: 11px; margin-bottom: 4px; }
  .total-foot { margin-top: 4px; }
  .total-foot .reset-link { font-size: 11px; }
  .total-foot .btn { padding: 8px 16px; font-size: 12.5px; }
}
