:root {
  --bg: #e8e1d5;
  --paper: #ffffff;
  --paper-deep: #f0e9dd;
  --surface: #fcf9f2;
  --surface-strong: #fffdf8;
  --ink: #23362e;
  --ink-soft: #4a5a51;
  --muted: #827e71;
  --line: #ddd3c2;
  --line-soft: #e9e1d3;
  --accent: #c76a4b;
  --accent-deep: #a95238;
  --accent-soft: #f2ded3;
  --green: #30363a;
  --green-mid: #454c50;
  --sage: #7f937c;
  --cream: #f4ecdd;
  --shadow-panel: 0 1px 2px rgba(43, 36, 25, 0.035), 0 16px 44px rgba(43, 36, 25, 0.055);
  --shadow-stage: 0 1px 2px rgba(43, 36, 25, 0.04), 0 20px 54px rgba(43, 36, 25, 0.09);
  --font-ui: "Segoe UI Variable Text", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI Semibold", "Segoe UI", Arial, sans-serif;
  --radius-panel: 24px;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input {
  margin: 0;
  color: inherit;
  font: inherit;
}

button {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

svg {
  display: block;
}

[hidden] {
  display: none !important;
}

::selection {
  color: var(--surface);
  background: var(--accent);
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body.modal-open {
  overflow: hidden !important;
}

/* ——— Верхняя панель ——— */

.app {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  height: 100dvh;
  min-height: 560px;
}

.topbar {
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  background: rgba(247, 243, 236, 0.86);
  border-bottom: 1px solid rgba(216, 206, 190, 0.8);
  backdrop-filter: blur(20px) saturate(1.08);
}

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

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  padding: 3px;
  overflow: hidden;
  background: var(--green);
  border: 1px solid rgba(48, 54, 57, 0.3);
  border-radius: 14px;
  box-shadow: 0 5px 14px rgba(48, 54, 57, 0.18);
}

.brand-mark svg {
  width: 42px;
  height: 42px;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.17em;
}

.brand-sub {
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.topbar-center {
  display: flex;
  grid-column: 2;
  align-items: center;
  justify-self: center;
  gap: 9px;
  padding: 8px 14px;
  color: var(--ink-soft);
  background: rgba(255, 253, 248, 0.52);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.035em;
}

.topbar-separator {
  width: 1px;
  height: 13px;
  background: var(--line);
}

.topbar-muted {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.live-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(199, 106, 75, 0.12);
  animation: livePulse 2.4s ease-out infinite;
}

.topbar-actions {
  display: flex;
  grid-column: 3;
  align-items: center;
  justify-self: end;
  gap: 9px;
}

.save-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  color: var(--muted);
  background: rgba(255, 253, 248, 0.64);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: color 180ms ease, border-color 180ms ease;
}

.save-dot {
  width: 5px;
  height: 5px;
  background: var(--sage);
  border-radius: 50%;
  transition: background 180ms ease;
}

.save-pill.is-saving {
  color: var(--ink-soft);
  border-color: rgba(199, 106, 75, 0.32);
}

.save-pill.is-saving .save-dot {
  background: var(--accent);
  animation: livePulse 1.2s ease-out infinite;
}

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--ink-soft);
  background: rgba(255, 253, 248, 0.56);
  border: 1px solid var(--line-soft);
  border-radius: 50%;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.icon-button:hover {
  color: var(--ink);
  background: var(--surface-strong);
  border-color: #cdbfac;
  transform: translateY(-1px);
}

.help-button {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
}

.project-toggle {
  display: none;
}

.project-toggle svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.45;
}

/* ——— Рабочая область и панели ——— */

.workspace {
  display: grid;
  grid-template-columns: 304px minmax(0, 1fr) 288px;
  gap: 14px;
  min-height: 0;
  padding: 14px 16px 16px;
}

.panel {
  min-height: 0;
  padding: 21px 20px;
  overflow-x: hidden;
  overflow-y: auto;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  scrollbar-color: #cabeab transparent;
  scrollbar-width: thin;
}

.panel::-webkit-scrollbar {
  width: 5px;
}

.panel::-webkit-scrollbar-thumb {
  background: #cabeab;
  border-radius: 10px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-deep);
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 0.18em;
  line-height: 1.2;
  text-transform: uppercase;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.panel-heading h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 31px;
  font-weight: 750;
  line-height: 1;
  letter-spacing: -0.045em;
}

.detail-count {
  display: inline-flex;
  height: 22px;
  align-items: center;
  padding: 0 9px;
  color: var(--muted);
  background: rgba(255, 253, 248, 0.72);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 650;
  white-space: nowrap;
}

.piece-section + .piece-section {
  margin-top: 17px;
}

.section-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 0 2px;
}

.section-line h2 {
  margin: 0;
  color: var(--ink-soft);
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 0.13em;
  line-height: 1;
  text-transform: uppercase;
}

.section-line > span {
  color: #9b9384;
  font-size: 9px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.section-note {
  margin: -2px 2px 9px;
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 550;
  letter-spacing: 0.02em;
  line-height: 1.35;
}

.piece-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.piece-card {
  position: relative;
  display: block;
  min-width: 0;
  padding: 6px 8px 8px;
  overflow: hidden;
  text-align: left;
  touch-action: none;
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.66), transparent 58%),
    linear-gradient(180deg, #fcf9f3, #f5efe5);
  border: 1px solid #e3d9c9;
  border-radius: 15px;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.piece-card:hover {
  z-index: 1;
  border-color: #cfb59f;
  box-shadow: 0 8px 20px rgba(54, 43, 31, 0.09);
  transform: translateY(-2px);
}

.piece-card:active {
  cursor: grabbing;
  transform: translateY(0) scale(0.985);
}

.piece-card.is-selected {
  background:
    radial-gradient(circle at 50% 28%, rgba(255, 255, 255, 0.84), transparent 58%),
    linear-gradient(180deg, #fffaf2, #f6e9dd);
  border-color: rgba(199, 106, 75, 0.66);
  box-shadow: 0 0 0 2px rgba(199, 106, 75, 0.12), 0 8px 18px rgba(84, 55, 39, 0.07);
}

.piece-card.is-selected::after {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 7px;
  height: 7px;
  content: "";
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(199, 106, 75, 0.13);
}

.piece-card.is-drag-source {
  opacity: 0.45;
}

.piece-card--wide {
  display: flex;
  min-height: 96px;
  grid-column: 1 / -1;
  align-items: center;
  gap: 10px;
  padding: 6px 11px 7px 8px;
}

.piece-card--wide .piece-preview {
  width: 50%;
  height: 49px;
  flex: 0 0 50%;
}

.piece-card--wide .piece-meta {
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 0;
}

.piece-card--wide .piece-name {
  white-space: normal;
}

.piece-preview {
  display: flex;
  height: 52px;
  align-items: center;
  justify-content: center;
}

.piece-preview svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 5px 4px rgba(60, 46, 34, 0.055));
}

.piece-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-width: 0;
  padding: 2px 2px 0;
}

.piece-name {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: normal;
}

.piece-dim {
  flex: 0 0 auto;
  margin-top: 1px;
  color: var(--muted);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.piece-price {
  margin-top: 1px;
  color: #8d5b48;
  font-size: 8.5px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  line-height: 1.2;
  white-space: nowrap;
}

.piece-extra {
  margin-top: 1px;
  color: #a49a8b;
  font-size: 8px;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
  white-space: nowrap;
}

.foundation-card {
  margin-top: 18px;
  padding: 12px;
  background: rgba(255, 252, 246, 0.6);
  border: 1px solid var(--line-soft);
  border-radius: 15px;
}

.foundation-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.foundation-option {
  display: grid;
  min-width: 0;
  justify-items: center;
  gap: 3px;
  padding: 6px 5px 5px;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.58);
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  cursor: pointer;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.foundation-option:hover {
  background: #fffdf8;
  border-color: rgba(184, 101, 75, 0.42);
  transform: translateY(-1px);
}

.foundation-option[aria-pressed='true'] {
  background: #fffaf3;
  border-color: rgba(171, 79, 55, 0.72);
  box-shadow: inset 0 0 0 1px rgba(171, 79, 55, 0.14);
}

.foundation-option--wide {
  grid-column: 1 / -1;
  grid-template-columns: 45px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 2px;
  align-items: center;
  justify-items: start;
  padding: 6px 10px;
}

.foundation-option--wide .foundation-visual {
  grid-row: 1 / span 2;
}

.foundation-option--wide .foundation-name,
.foundation-option--wide .foundation-meta {
  max-width: 100%;
  text-align: left;
  white-space: normal;
}

.foundation-visual {
  display: grid;
  width: 45px;
  height: 32px;
  place-items: center;
}

.foundation-visual svg {
  display: block;
  width: 44px;
  height: 32px;
}

.foundation-name {
  max-width: 100%;
  overflow: hidden;
  font-size: 8.5px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.foundation-meta {
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 7.5px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.foundation-option[aria-pressed='true'] .foundation-meta {
  color: #8d5b48;
}

.color-card {
  margin-top: 18px;
  padding: 12px;
  background: rgba(255, 252, 246, 0.6);
  border: 1px solid var(--line-soft);
  border-radius: 15px;
}

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

.color-head h2 {
  margin: 0;
  color: var(--ink-soft);
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.color-head strong {
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 600;
  white-space: nowrap;
}

.swatches {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
}

.material-option {
  display: flex;
  min-width: 0;
  min-height: 54px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 4px 2px;
  color: var(--ink-soft);
  background: rgba(255, 253, 248, 0.55);
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  font-size: 10px;
  font-weight: 600;
  transition:
    background 150ms ease,
    border-color 150ms ease,
    box-shadow 150ms ease;
}

.material-option:hover {
  background: var(--surface-strong);
  border-color: #cfbfa9;
}

.material-option.is-selected {
  color: var(--ink);
  background: #fffaf2;
  border-color: rgba(199, 106, 75, 0.56);
  box-shadow: 0 0 0 2px rgba(199, 106, 75, 0.1);
}

.material-chip {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border: 1px solid rgba(83, 67, 49, 0.16);
  border-radius: 7px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.material-chip--white {
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.96), transparent 46%),
    #f0ebe1;
}

.material-chip--wood {
  background:
    repeating-linear-gradient(
      101deg,
      rgba(83, 45, 19, 0.2) 0 1px,
      rgba(255, 223, 170, 0.1) 1px 4px,
      rgba(83, 45, 19, 0.08) 4px 5px,
      rgba(255, 255, 255, 0.04) 5px 9px
    ),
    linear-gradient(180deg, #ca9561, #ae7643);
}

.material-chip--shingle {
  background:
    repeating-linear-gradient(
      0deg,
      rgba(74, 43, 22, 0.32) 0 1px,
      transparent 1px 7px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(74, 43, 22, 0.24) 0 1px,
      transparent 1px 8px
    ),
    repeating-linear-gradient(
      0deg,
      rgba(255, 224, 178, 0.1) 0 1px,
      transparent 1px 2px
    ),
    linear-gradient(180deg, #b48661, #946746);
}

.material-chip--timber {
  background:
    repeating-linear-gradient(
      0deg,
      rgba(93, 56, 26, 0.28) 0 1px,
      rgba(255, 238, 204, 0.12) 1px 2px,
      transparent 2px 8px
    ),
    repeating-linear-gradient(
      94deg,
      rgba(93, 56, 26, 0.12) 0 1px,
      transparent 1px 5px
    ),
    linear-gradient(180deg, #d8ae7f, #c1915e);
}

.material-chip--fiber-cement {
  background:
    linear-gradient(
      90deg,
      transparent 0 47%,
      rgba(70, 80, 74, 0.3) 47% 49%,
      transparent 49% 100%
    ),
    linear-gradient(
      0deg,
      transparent 0 47%,
      rgba(70, 80, 74, 0.22) 47% 49%,
      transparent 49% 100%
    ),
    linear-gradient(140deg, #c8ccc6, #a8afa9 62%, #979f99);
}

.material-name {
  min-width: 0;
  overflow: visible;
  font-size: 7px;
  line-height: 1.1;
  text-align: center;
  white-space: normal;
}

.selection-swatch.is-wood {
  background:
    repeating-linear-gradient(
      101deg,
      rgba(83, 45, 19, 0.25) 0 1px,
      rgba(255, 223, 170, 0.1) 1px 4px,
      rgba(83, 45, 19, 0.08) 4px 5px,
      rgba(255, 255, 255, 0.04) 5px 9px
    ),
    #b57c49 !important;
}

.library-note {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin-top: 15px;
  padding: 12px 12px 11px;
  color: var(--muted);
  background: rgba(238, 230, 217, 0.64);
  border-radius: 13px;
}

.library-note-icon {
  display: grid;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--accent-deep);
  background: rgba(255, 252, 245, 0.72);
  border-radius: 50%;
}

.library-note-icon svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

.library-note p {
  margin: 0;
  font-size: 10.5px;
  line-height: 1.42;
}

.library-intro {
  margin-top: -6px;
  margin-bottom: 17px;
  padding: 0;
  gap: 8px;
  background: transparent;
}

.library-intro .library-note-icon {
  display: none;
}

.library-intro p {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.45;
}

/* ——— Сцена ——— */

.stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
  background: #fff;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.stage::before,
.stage::after {
  display: none;
}

.stage-ambient {
  display: none;
}

.scene-actions {
  position: absolute;
  top: 18px;
  left: 50%;
  z-index: 6;
  display: flex;
  gap: 8px;
  transform: translateX(-50%);
}

.scene-rotate,
.scene-edit {
  position: relative;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  padding: 0;
  color: var(--ink-soft);
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid var(--line-soft);
  border-radius: 50%;
  box-shadow: 0 8px 20px rgba(50, 40, 29, 0.08);
  cursor: pointer;
  transition:
    color 160ms ease,
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
  backdrop-filter: blur(10px);
}

.scene-rotate:hover,
.scene-edit:hover {
  color: var(--accent);
  background: #fffdf8;
  border-color: rgba(171, 79, 55, 0.38);
  transform: translateY(-1px);
}

.scene-rotate:active,
.scene-edit:active {
  transform: scale(0.97);
}

.scene-rotate.is-active,
.scene-edit.is-active {
  color: #f8f2e6;
  background: var(--green);
  border-color: var(--green);
  box-shadow: 0 9px 24px rgba(48, 54, 57, 0.22);
}

.scene-rotate.is-active:hover,
.scene-edit.is-active:hover {
  color: #fffaf0;
  background: var(--green-mid);
  border-color: var(--green-mid);
}

.scene-rotate svg,
.scene-edit svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.45;
}

.scene-rotate::after,
.scene-edit::after {
  position: absolute;
  top: calc(100% + 7px);
  left: 50%;
  z-index: 10;
  padding: 5px 8px;
  color: var(--cream);
  content: attr(data-tooltip);
  background: var(--green);
  border-radius: 6px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(-2px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.scene-rotate:hover::after,
.scene-edit:hover::after,
.scene-rotate:focus-visible::after,
.scene-edit:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 560px) {
  .scene-actions {
    top: 14px;
    gap: 6px;
  }

  .scene-rotate,
  .scene-edit {
    width: 32px;
    height: 32px;
  }

  .scene-rotate svg,
  .scene-edit svg {
    width: 14px;
    height: 14px;
  }
}

#sceneCanvas {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: default;
}

.stage.is-dragging #sceneCanvas {
  cursor: grabbing;
}

.stage.is-scene-rotating #sceneCanvas {
  cursor: ew-resize;
}

.stage.is-wall-editing #sceneCanvas {
  cursor: pointer;
}

.stage-topline {
  position: absolute;
  top: 19px;
  left: 20px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.stage-status,
.stage-size {
  display: inline-flex;
  height: 28px;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  color: var(--ink-soft);
  background: rgba(255, 252, 246, 0.68);
  border: 1px solid rgba(221, 211, 194, 0.8);
  border-radius: 999px;
  box-shadow: 0 5px 15px rgba(52, 41, 27, 0.035);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.035em;
  backdrop-filter: blur(12px);
}

.stage-status {
  text-transform: uppercase;
}

.stage-size {
  color: var(--muted);
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
}

.stage-toolbar {
  position: absolute;
  top: 19px;
  right: 20px;
  z-index: 7;
  display: flex;
  align-items: center;
  gap: 7px;
}

.tool-pill {
  display: flex;
  align-items: center;
  gap: 1px;
  height: 34px;
  padding: 3px;
  background: rgba(255, 252, 246, 0.78);
  border: 1px solid rgba(221, 211, 194, 0.84);
  border-radius: 11px;
  box-shadow: 0 8px 22px rgba(52, 41, 27, 0.055);
  backdrop-filter: blur(14px);
}

.tool-button {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  color: var(--ink-soft);
  border-radius: 8px;
  transition: color 140ms ease, background 140ms ease;
}

.tool-button:hover:not(:disabled) {
  color: var(--ink);
  background: rgba(237, 228, 215, 0.88);
}

.tool-button:disabled {
  cursor: default;
  opacity: 0.32;
}

.tool-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.zoom-readout {
  min-width: 38px;
  height: 27px;
  padding: 0 2px;
  color: var(--muted);
  border-radius: 7px;
  font-size: 9px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.zoom-readout:hover {
  color: var(--ink);
  background: rgba(237, 228, 215, 0.6);
}

.tool-button--solo {
  width: 34px;
  height: 34px;
  background: rgba(255, 252, 246, 0.78);
  border: 1px solid rgba(221, 211, 194, 0.84);
  border-radius: 11px;
  box-shadow: 0 8px 22px rgba(52, 41, 27, 0.055);
  backdrop-filter: blur(14px);
}

.empty-hint {
  position: absolute;
  top: 11.5%;
  left: 50%;
  z-index: 4;
  width: min(430px, 72%);
  text-align: center;
  pointer-events: none;
  transform: translateX(-50%);
  transition: opacity 240ms ease, transform 240ms ease;
  animation: hintFloat 5s ease-in-out infinite;
}

.stage.is-dragging .empty-hint,
.stage.has-blocks .empty-hint {
  opacity: 0;
  transform: translate(-50%, -6px);
}

.empty-kicker {
  display: block;
  margin-bottom: 7px;
  color: var(--accent-deep);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.empty-hint strong {
  display: block;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(17px, 1.55vw, 23px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.18;
}

.empty-copy {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.4;
}

.empty-arrow {
  position: absolute;
  top: 24%;
  left: 50%;
  z-index: 4;
  width: 58px;
  height: 33%;
  overflow: visible;
  fill: none;
  stroke: rgba(167, 81, 56, 0.54);
  stroke-dasharray: 4 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.3;
  pointer-events: none;
  transform: translateX(-50%);
  transition: opacity 240ms ease;
}

.stage.is-dragging .empty-arrow,
.stage.has-blocks .empty-arrow {
  opacity: 0;
}

.drag-badge {
  position: fixed;
  z-index: 80;
  display: flex;
  height: 34px;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  color: var(--cream);
  background: rgba(48, 54, 57, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(34, 46, 39, 0.25);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.02em;
  pointer-events: none;
  transform: translate(14px, 14px);
  backdrop-filter: blur(12px);
}

.drag-badge-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.09);
}

.drag-badge-state {
  color: rgba(244, 236, 221, 0.6);
  font-weight: 500;
}

.drag-badge.is-invalid .drag-badge-dot {
  background: #d56550;
}

.drag-badge.is-valid .drag-badge-dot {
  background: #8fbd98;
}

.stage-bottom {
  position: absolute;
  right: 18px;
  bottom: 15px;
  left: 18px;
  z-index: 10;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.stage-hint {
  display: flex;
  height: 34px;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  color: var(--muted);
  background: rgba(255, 252, 246, 0.78);
  border: 1px solid rgba(221, 211, 194, 0.82);
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(52, 41, 27, 0.05);
  font-size: 9.5px;
  font-weight: 550;
  letter-spacing: 0.015em;
  backdrop-filter: blur(14px);
  transition: opacity 160ms ease;
}

.stage.has-selection .stage-hint {
  opacity: 0;
  pointer-events: none;
}

.mouse-icon {
  display: grid;
  color: #928875;
  place-items: center;
}

.mouse-icon svg {
  width: 12px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.2;
}

.hint-separator {
  width: 1px;
  height: 11px;
  background: var(--line);
}

.hint-key {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

kbd {
  display: inline-flex;
  min-width: 16px;
  height: 16px;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  color: #6d6559;
  background: #f8f3e9;
  border: 1px solid #d9cfbe;
  border-bottom-color: #c8bba7;
  border-radius: 4px;
  box-shadow: 0 1px 0 rgba(75, 58, 38, 0.1);
  font-family: var(--font-ui);
  font-size: 8.5px;
  font-weight: 700;
  line-height: 1;
}

.selection-bar {
  display: flex;
  height: 46px;
  align-items: center;
  gap: 9px;
  padding: 5px 7px 5px 9px;
  color: var(--cream);
  background: rgba(48, 54, 57, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  box-shadow: 0 13px 36px rgba(30, 43, 36, 0.23);
  pointer-events: auto;
  animation: selectionIn 180ms ease both;
  backdrop-filter: blur(16px);
}

.selection-swatch {
  width: 25px;
  height: 25px;
  flex: 0 0 auto;
  border: 2px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.selection-copy {
  display: flex;
  min-width: 88px;
  flex-direction: column;
  gap: 1px;
}

.selection-copy strong {
  font-size: 10px;
  font-weight: 650;
  line-height: 1.2;
  white-space: nowrap;
}

.selection-copy span {
  color: rgba(244, 236, 221, 0.56);
  font-size: 8.5px;
  font-weight: 500;
  line-height: 1.2;
}

.selection-divider {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.13);
}

.mini-action {
  display: flex;
  height: 32px;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  color: rgba(244, 236, 221, 0.78);
  border-radius: 8px;
  font-size: 8.5px;
  font-weight: 550;
  transition: color 140ms ease, background 140ms ease;
}

.mini-action:hover {
  color: var(--cream);
  background: rgba(255, 255, 255, 0.09);
}

.mini-action svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.4;
}

.mini-action--danger:hover {
  color: #ffc5b7;
  background: rgba(197, 91, 68, 0.18);
}

.mini-action:disabled {
  cursor: default;
  opacity: 0.34;
}

.mini-action:disabled:hover {
  color: rgba(244, 236, 221, 0.78);
  background: transparent;
}

.block-delete,
.block-rotate {
  position: absolute;
  z-index: 12;
  display: grid;
  width: 31px;
  height: 31px;
  padding: 0;
  color: var(--cream);
  background: rgba(48, 54, 57, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  box-shadow:
    0 8px 20px rgba(30, 43, 36, 0.24),
    0 0 0 4px rgba(255, 252, 246, 0.4);
  cursor: pointer;
  place-items: center;
  transform: translate(-50%, -50%);
  transition:
    background 150ms ease,
    box-shadow 150ms ease,
    transform 150ms ease;
}

.block-delete:not([hidden]),
.block-rotate:not([hidden]) {
  animation: deletePop 170ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.block-delete:hover {
  background: #b4513e;
  box-shadow:
    0 10px 24px rgba(92, 42, 31, 0.28),
    0 0 0 4px rgba(255, 248, 239, 0.55);
  transform: translate(-50%, -50%) scale(1.08);
}

.block-rotate:hover {
  background: var(--green-mid);
  box-shadow:
    0 10px 24px rgba(30, 43, 36, 0.28),
    0 0 0 4px rgba(255, 248, 239, 0.55);
  transform: translate(-50%, -50%) scale(1.08);
}

.block-delete:active,
.block-rotate:active {
  transform: translate(-50%, -50%) scale(0.96);
}

.block-delete svg,
.block-rotate svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.drop-frame {
  position: absolute;
  inset: 11px;
  z-index: 8;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 72px;
  pointer-events: none;
  border: 1.5px dashed rgba(199, 106, 75, 0.68);
  border-radius: 19px;
  background: linear-gradient(180deg, rgba(199, 106, 75, 0.035), transparent 32%);
  opacity: 0;
  transition: opacity 150ms ease;
}

.stage.is-dragging .drop-frame {
  opacity: 1;
}

.drop-frame span {
  padding: 6px 11px;
  color: var(--accent-deep);
  background: rgba(255, 251, 244, 0.9);
  border: 1px solid rgba(199, 106, 75, 0.18);
  border-radius: 999px;
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.02em;
  box-shadow: 0 6px 18px rgba(88, 51, 37, 0.07);
}

/* ——— Панель проекта ——— */

.project {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.project-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  display: none;
  width: 30px;
  height: 30px;
  color: var(--muted);
  background: rgba(255, 252, 246, 0.72);
  border: 1px solid var(--line-soft);
  border-radius: 50%;
  place-items: center;
}

.project-close:hover {
  color: var(--ink);
  background: var(--surface-strong);
}

.project-close svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.5;
}

.project-heading {
  margin-bottom: 11px;
}

.project-heading .build-status {
  margin-top: 0;
}

.project-name {
  width: 100%;
  padding: 0 0 2px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 730;
  letter-spacing: -0.05em;
  line-height: 1.14;
  text-overflow: ellipsis;
  transition: border-color 160ms ease;
}

.project-name:hover {
  border-bottom-color: rgba(151, 138, 118, 0.3);
}

.project-name:focus {
  border-bottom-color: rgba(199, 106, 75, 0.55);
  outline: none;
}

.build-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 9px;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.025em;
}

.status-dot {
  width: 5px;
  height: 5px;
  background: var(--sage);
  border-radius: 50%;
}

.build-status[data-status="building"] .status-dot {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(199, 106, 75, 0.1);
}

.build-status[data-status="ready"] .status-dot {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(48, 54, 57, 0.1);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 16px;
}

.stat {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
  padding: 10px 9px 9px;
  background: rgba(255, 252, 246, 0.58);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
}

.stat strong {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.045em;
  line-height: 1;
}

.stat span {
  overflow: hidden;
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 550;
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.floor-areas {
  display: grid;
  gap: 3px;
  margin: -8px 2px 16px;
}

.floor-areas[hidden] {
  display: none;
}

.floor-area {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.4;
}

.floor-area strong {
  color: var(--ink-soft);
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  white-space: nowrap;
}

.plan-card {
  padding: 11px;
  margin-bottom: 16px;
  background: rgba(255, 252, 246, 0.52);
  border: 1px solid var(--line-soft);
  border-radius: 17px;
}

.plan-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 0 2px;
}

.plan-head h2 {
  margin: 0;
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.plan-head span {
  color: var(--muted);
  font-size: 8.5px;
  font-variant-numeric: tabular-nums;
}

.minimap-wrap {
  position: relative;
  width: 100%;
  height: 164px;
  overflow: hidden;
  background: #f3ede2;
  border: 1px solid rgba(212, 201, 184, 0.8);
  border-radius: 11px;
}

#minimap {
  width: 100%;
  height: 100%;
  display: block;
}

.plan-compass {
  position: absolute;
  top: 7px;
  right: 8px;
  display: grid;
  width: 17px;
  height: 17px;
  color: var(--muted);
  background: rgba(255, 252, 246, 0.76);
  border: 1px solid rgba(211, 200, 183, 0.8);
  border-radius: 50%;
  font-family: Georgia, serif;
  font-size: 8px;
  font-weight: 700;
  place-items: center;
}

.plan-caption {
  min-height: 24px;
  margin: 8px 2px 0;
  color: var(--muted);
  font-size: 8.5px;
  line-height: 1.4;
}

.readiness {
  order: 2;
  padding: 12px;
  margin-bottom: 10px;
  background: rgba(255, 252, 246, 0.52);
  border: 1px solid var(--line-soft);
  border-radius: 15px;
}

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

.readiness-head h2 {
  margin: 0;
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.readiness-head span {
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.readiness-track {
  height: 3px;
  overflow: hidden;
  background: #e6ddce;
  border-radius: 99px;
}

.readiness-track span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #d8946f);
  border-radius: inherit;
  transition: width 340ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.checklist {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 0;
  margin: 12px 0 0;
  list-style: none;
}

.checklist li {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  color: #958d7e;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.25;
  transition: color 160ms ease;
}

.check-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.check-value {
  margin-left: auto;
  color: #afa596;
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: color 160ms ease;
}

.check-price {
  min-width: 61px;
  color: #8e8577;
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  text-align: right;
  white-space: nowrap;
}

.checklist li.is-done .check-price {
  color: var(--ink-soft);
}

.estimate-extra {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding-top: 8px;
  margin-top: 10px;
  border-top: 1px dashed var(--line-soft);
}

.estimate-extra span {
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 650;
}

.estimate-extra small {
  margin-left: 3px;
  color: var(--accent);
  font-size: 8px;
  font-weight: 750;
}

.estimate-extra strong {
  color: var(--ink-soft);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.estimate-duration {
  padding-top: 4px;
  margin-top: 4px;
  border-top: 0;
}

.estimate-duration strong {
  color: var(--ink);
  font-weight: 700;
}

.estimate-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding-top: 9px;
  margin-top: 8px;
  border-top: 1px solid var(--line-soft);
}

.estimate-total span {
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.estimate-total strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.estimate-note {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.3;
}

.request-button {
  display: flex;
  order: 3;
  width: 100%;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
  margin: 0 0 5px;
  color: var(--cream);
  background: var(--green);
  border-radius: 11px;
  box-shadow: 0 8px 18px rgba(48, 54, 57, 0.16);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.025em;
  transition: background 150ms ease, transform 150ms ease;
}

.request-button:hover {
  background: var(--green-mid);
  transform: translateY(-1px);
}

.request-button:active {
  transform: translateY(0);
}

.request-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.4;
}

.plan-dims {
  display: block;
  margin: 7px 2px 0;
  color: var(--ink-soft);
  font-size: 8.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  text-align: center;
}

.plan-dims[hidden] {
  display: none;
}

.checklist li.is-done .check-value {
  color: #7b7468;
}

.check-dot {
  position: relative;
  display: inline-block;
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border: 1px solid #d2c6b4;
  border-radius: 50%;
  transition: background 160ms ease, border-color 160ms ease;
}

.check-dot::after {
  position: absolute;
  top: 2px;
  left: 3px;
  width: 3px;
  height: 5px;
  content: "";
  border: solid var(--cream);
  border-width: 0 1.4px 1.4px 0;
  opacity: 0;
  transform: rotate(42deg) scale(0.7);
  transition: opacity 160ms ease, transform 160ms ease;
}

.checklist li.is-done {
  color: var(--ink-soft);
}

.checklist li.is-done .check-dot {
  background: var(--green-mid);
  border-color: var(--green-mid);
}

.checklist li.is-done .check-dot::after {
  opacity: 1;
  transform: rotate(42deg) scale(1);
}

.project-actions {
  display: grid;
  order: 1;
  gap: 7px;
  margin-top: auto;
}

.example-variant {
  display: grid;
  gap: 4px;
  margin-bottom: 1px;
}

.example-variant span {
  color: var(--muted);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.example-variant select {
  width: 100%;
  height: 32px;
  padding: 0 28px 0 10px;
  color: var(--ink-soft);
  background: rgba(255, 252, 246, 0.7);
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  font: inherit;
  font-size: 9px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

.example-variant select:focus-visible {
  border-color: rgba(171, 79, 55, 0.55);
  box-shadow: 0 0 0 2px rgba(199, 106, 75, 0.12);
}

.button {
  display: inline-flex;
  height: 39px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.015em;
  white-space: nowrap;
  transition:
    transform 150ms ease,
    background 150ms ease,
    border-color 150ms ease,
    box-shadow 150ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

.button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.45;
}

.button--primary {
  color: var(--cream);
  background: var(--green);
  border-color: var(--green);
  box-shadow: 0 8px 18px rgba(48, 54, 57, 0.16);
}

.button--primary:hover {
  background: var(--green-mid);
  border-color: var(--green-mid);
  box-shadow: 0 11px 24px rgba(48, 54, 57, 0.2);
}

.button--quiet {
  color: var(--ink-soft);
  background: rgba(255, 252, 246, 0.5);
  border-color: var(--line);
}

.button--quiet:hover {
  background: var(--surface-strong);
  border-color: #cbbda9;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 0.72fr;
  gap: 7px;
}

.quick-tip {
  padding: 13px 13px 12px;
  margin-top: 11px;
  color: var(--cream);
  background:
    radial-gradient(circle at 100% 0, rgba(199, 106, 75, 0.28), transparent 53%),
    var(--green);
  border-radius: 16px;
}

.quick-tip-kicker {
  display: block;
  margin-bottom: 5px;
  color: #e5b6a2;
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.quick-tip p {
  margin: 0;
  color: rgba(244, 236, 221, 0.78);
  font-size: 9.5px;
  line-height: 1.46;
}

.quick-tip-shortcut {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 9px;
  color: rgba(244, 236, 221, 0.48);
  font-size: 8px;
}

.quick-tip kbd {
  color: rgba(244, 236, 221, 0.78);
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.12);
  border-bottom-color: rgba(255, 255, 255, 0.06);
  box-shadow: none;
}

/* ——— Модальные окна и уведомления ——— */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  padding: 24px;
  place-items: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 38, 33, 0.46);
  backdrop-filter: blur(8px);
  animation: fadeIn 180ms ease both;
}

.modal-card {
  position: relative;
  width: min(580px, 100%);
  max-height: calc(100dvh - 50px);
  padding: 29px 31px 27px;
  overflow-y: auto;
  background:
    radial-gradient(circle at 100% 0, rgba(238, 221, 205, 0.55), transparent 35%),
    #faf6ee;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 24px;
  box-shadow: 0 30px 90px rgba(24, 34, 29, 0.3);
  animation: modalIn 240ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  scrollbar-width: thin;
}

.modal-card--small {
  width: min(430px, 100%);
}

.modal-card h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 31px;
  font-weight: 730;
  letter-spacing: -0.045em;
  line-height: 1.12;
}

.modal-lead {
  margin: 10px 0 20px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.55;
}

.modal-close {
  position: absolute;
  top: 17px;
  right: 17px;
  display: grid;
  width: 31px;
  height: 31px;
  color: var(--muted);
  background: rgba(255, 252, 246, 0.7);
  border: 1px solid var(--line-soft);
  border-radius: 50%;
  place-items: center;
  transition: color 150ms ease, background 150ms ease;
}

.modal-close:hover {
  color: var(--ink);
  background: var(--surface-strong);
}

.modal-close svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.5;
}

.help-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.help-step {
  display: flex;
  gap: 10px;
  padding: 12px;
  background: rgba(255, 252, 246, 0.62);
  border: 1px solid var(--line-soft);
  border-radius: 13px;
}

.help-number {
  flex: 0 0 auto;
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.help-step strong {
  display: block;
  margin-bottom: 3px;
  font-size: 10.5px;
  font-weight: 700;
}

.help-step p {
  margin: 0;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.43;
}

.help-shortcuts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px 15px;
  margin: 17px 0;
  padding: 11px 0;
  color: var(--muted);
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  font-size: 9px;
}

.help-shortcuts span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.modal-cta {
  width: 100%;
  margin-top: 0;
}

.confirm-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 22px;
}

.confirm-actions .button {
  min-width: 104px;
}

.request-form {
  display: grid;
  gap: 11px;
}

.request-field {
  display: grid;
  gap: 5px;
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.025em;
}

.request-field input {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  color: var(--ink);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.request-field input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(199, 106, 75, 0.12);
}

.request-consent {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.4;
  cursor: pointer;
}

.request-consent input {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  margin: 1px 0 0;
  accent-color: var(--green);
}

.request-error {
  margin: 0;
  color: var(--accent-deep);
  font-size: 10px;
  line-height: 1.4;
}

.request-success {
  padding: 14px;
  margin: 0;
  color: var(--ink-soft);
  background: rgba(255, 252, 246, 0.72);
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  font-size: 12px;
  line-height: 1.45;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  z-index: 110;
  display: flex;
  max-width: min(430px, calc(100vw - 32px));
  min-height: 39px;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  color: var(--cream);
  background: rgba(48, 54, 57, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  box-shadow: 0 16px 42px rgba(31, 43, 36, 0.28);
  font-size: 10.5px;
  font-weight: 550;
  line-height: 1.35;
  pointer-events: none;
  transform: translateX(-50%);
  animation: toastIn 220ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  backdrop-filter: blur(16px);
}

.toast-icon {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  background: #9ac4a4;
  border-radius: 50%;
}

.toast.toast--error .toast-icon {
  background: #ec8d77;
}

.noscript {
  position: fixed;
  right: 20px;
  bottom: 20px;
  left: 20px;
  z-index: 200;
  padding: 16px;
  color: var(--cream);
  text-align: center;
  background: var(--green);
  border-radius: 14px;
}

/* ——— Адаптивность ——— */

@media (max-width: 1380px) {
  .workspace {
    grid-template-columns: 292px minmax(0, 1fr) 274px;
    gap: 11px;
    padding: 11px 12px 12px;
  }

  .panel {
    padding: 19px 17px;
  }

  .piece-preview {
    height: 48px;
  }

  .stage-bottom {
    bottom: 13px;
  }

  .empty-hint {
    top: 9.5%;
  }
}

@media (max-width: 1180px) {
  .app {
    grid-template-rows: 68px minmax(0, 1fr);
  }

  .topbar {
    padding: 0 17px;
  }

  .topbar-center {
    display: none;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 12px;
  }

  .brand-mark svg {
    width: 38px;
    height: 38px;
  }

  .workspace {
    grid-template-columns: 278px minmax(0, 1fr);
  }

  .project {
    position: fixed;
    top: 80px;
    right: 12px;
    bottom: 12px;
    z-index: 45;
    width: 286px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-panel);
    box-shadow: 0 24px 70px rgba(38, 33, 24, 0.24);
    transform: translateX(calc(100% + 26px));
    transition: transform 230ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  .project.is-open {
    transform: translateX(0);
  }

  .project-toggle {
    display: grid;
  }

  .project-close {
    display: grid;
  }

  .project-heading {
    padding-right: 28px;
  }

  .project-toggle svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.45;
  }

  .save-pill {
    display: none;
  }
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  .app {
    display: block;
    height: auto;
    min-height: 100dvh;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: 64px;
    padding: 0 13px;
  }

  .brand {
    gap: 9px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .brand-mark svg {
    width: 35px;
    height: 35px;
  }

  .brand-name {
    font-size: 15px;
  }

  .brand-sub {
    font-size: 8px;
  }

  .workspace {
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding: 9px;
  }

  .stage {
    order: 1;
    width: 100%;
    height: 66vh;
    min-height: 480px;
    border-radius: 20px;
  }

  .library {
    order: 2;
    overflow: visible;
    border-radius: 20px;
    padding: 18px 15px 17px;
  }

  .piece-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .piece-card {
    min-height: 100px;
  }

  .library-note {
    display: none;
  }

  .piece-section + .piece-section {
    margin-top: 15px;
  }

  .panel-heading {
    margin-bottom: 13px;
  }

  .panel-heading h1 {
    font-size: 27px;
  }

  .project {
    top: 73px;
    right: 9px;
    bottom: 9px;
    width: min(300px, calc(100vw - 18px));
    border-radius: 20px;
  }

  .empty-hint {
    top: 9%;
    width: 72%;
  }

  .stage-toolbar {
    top: 13px;
    right: 13px;
  }

  .stage-topline {
    top: 13px;
    left: 13px;
  }

  .stage-size {
    display: none;
  }

  .stage-hint {
    max-width: calc(100vw - 60px);
  }

  .hint-key {
    display: none;
  }

  .hint-separator {
    display: none;
  }

  .stage-bottom {
    right: 10px;
    bottom: 10px;
    left: 10px;
  }

  .selection-copy {
    min-width: 72px;
  }

  .mini-action {
    padding: 0 6px;
  }

  .drop-frame {
    display: none;
  }

  .modal {
    padding: 13px;
  }

  .modal-card {
    padding: 24px 20px 20px;
    border-radius: 20px;
  }

  .modal-card h2 {
    font-size: 26px;
  }

  .help-grid {
    grid-template-columns: 1fr;
  }

  .help-step {
    padding: 10px;
  }

  .confirm-actions {
    justify-content: stretch;
  }

  .confirm-actions .button {
    flex: 1;
  }
}

@media (max-width: 560px) {
  .piece-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .piece-card {
    min-height: 94px;
  }

  .piece-preview {
    height: 54px;
  }

  .stage {
    height: 62vh;
    min-height: 430px;
  }

  .stage-toolbar .tool-pill:first-child {
    display: none;
  }

  .empty-hint {
    top: 8.5%;
    width: 80%;
  }

  .empty-hint strong {
    font-size: 18px;
  }

  .empty-copy {
    font-size: 10.5px;
  }

  .empty-arrow {
    width: 80px;
    height: 33%;
  }

  .selection-bar {
    width: 100%;
    height: auto;
    gap: 6px;
    padding: 7px;
  }

  .selection-divider {
    display: none;
  }

  .selection-copy {
    flex: 1;
  }

  .mini-action {
    flex-direction: column;
    gap: 2px;
    font-size: 7.5px;
    white-space: nowrap;
  }

  #fitRoofBtn {
    padding: 0 4px;
    font-size: 7px;
  }

  .mini-action svg {
    width: 14px;
    height: 14px;
  }

  .stage-hint {
    font-size: 9px;
  }

  .modal-card h2 {
    font-size: 24px;
  }

  .help-shortcuts {
    gap: 7px 10px;
  }
}

@media (max-height: 780px) and (min-width: 901px) {
  .panel {
    padding-top: 17px;
    padding-bottom: 16px;
  }

  .panel-heading {
    margin-bottom: 14px;
  }

  .panel-heading h1 {
    font-size: 28px;
  }

  .piece-preview {
    height: 45px;
  }

  .piece-card {
    padding-top: 5px;
    padding-bottom: 7px;
  }

  .library-note {
    display: none;
  }

  .color-card {
    margin-top: 14px;
    padding: 10px;
  }

  .quick-tip {
    display: none;
  }

  .plan-card {
    padding: 9px;
    margin-bottom: 11px;
  }

  .minimap-wrap {
    height: 138px;
  }

  .stat {
    padding: 8px;
  }

  .stat strong {
    font-size: 20px;
  }

  .button {
    height: 36px;
  }
}

/* ——— Плоские боковые панели без фоновой заливки ——— */

.library,
.project {
  background: transparent;
  background-image: none;
  box-shadow: none;
}

.library .piece-card:not(.is-selected) {
  background: #fff;
  background-image: none;
}

.library .foundation-card,
.library .color-card {
  background: transparent;
  background-image: none;
  border: 0;
  box-shadow: none;
}

.library .library-intro {
  background: transparent;
  background-image: none;
  box-shadow: none;
}

#projectPanel,
#projectPanel .project-heading,
#projectPanel .stats-grid,
#projectPanel .stat,
#projectPanel .readiness,
#projectPanel .project-actions {
  background: transparent !important;
  background-image: none !important;
  backdrop-filter: none !important;
  box-shadow: none !important;
}

.project .plan-card {
  background: transparent;
  background-image: none;
  box-shadow: none;
}

.library .foundation-option,
.library .material-option {
  border-color: #e3d9c9;
  border-radius: 14px;
}

.library .foundation-option,
.library .foundation-option:hover,
.library .foundation-option[aria-pressed='true'] {
  background: transparent;
  background-image: none;
}

.library .material-option:not(:hover):not(.is-selected) {
  background: #fff;
  background-image: none;
  box-shadow: none;
}

.project .example-variant select {
  background: transparent;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ——— Анимации ——— */

@keyframes livePulse {
  0% {
    box-shadow: 0 0 0 0 rgba(199, 106, 75, 0.26);
  }
  60% {
    box-shadow: 0 0 0 6px rgba(199, 106, 75, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(199, 106, 75, 0);
  }
}

@keyframes hintFloat {
  0%,
  100% {
    transform: translate(-50%, 0);
  }
  50% {
    transform: translate(-50%, -5px);
  }
}

@keyframes selectionIn {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes deletePop {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.72);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Компактные квадратные карточки в горизонтальных рядах. */
.library .piece-grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 1px 1px 4px;
  scrollbar-width: thin;
}

.library .piece-grid::-webkit-scrollbar {
  height: 4px;
}

.library .piece-grid::-webkit-scrollbar-thumb {
  background: #cabeab;
  border-radius: 8px;
}

.library .piece-card,
.library .piece-card--wide {
  display: flex;
  width: 76px;
  height: 76px;
  min-width: 76px;
  min-height: 76px;
  flex: 0 0 76px;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
  padding: 4px;
  border-radius: 12px;
}

.library .piece-preview,
.library .piece-card--wide .piece-preview {
  width: 100%;
  height: 38px;
  min-height: 38px;
  flex: 0 0 38px;
}

.library .piece-meta,
.library .piece-card--wide .piece-meta {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 2px 0 0;
}

.library .piece-name,
.library .piece-card--wide .piece-name {
  display: -webkit-box;
  overflow: hidden;
  font-size: 8px;
  line-height: 1.08;
  white-space: normal;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.library .piece-dim {
  display: none;
}

.library .section-note {
  margin: 2px 0 6px;
  overflow: hidden;
  font-size: 7.5px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library .foundation-card,
.library .color-card {
  padding: 0;
  margin-top: 15px;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.library .foundation-options,
.library .swatches {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 1px 1px 4px;
  scrollbar-width: thin;
}

.library .foundation-option,
.library .foundation-option--wide {
  display: flex;
  width: 76px;
  height: 76px;
  min-width: 76px;
  min-height: 76px;
  flex: 0 0 76px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px;
  border-radius: 12px;
}

.library .foundation-visual,
.library .foundation-option--wide .foundation-visual {
  width: 34px;
  height: 27px;
}

.library .foundation-name,
.library .foundation-option--wide .foundation-name {
  max-width: 100%;
  overflow: hidden;
  font-size: 8px;
  line-height: 1.08;
  text-align: center;
  white-space: normal;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.library .foundation-meta {
  display: none;
}

.library .material-option {
  width: 76px;
  height: 76px;
  min-width: 76px;
  min-height: 76px;
  flex: 0 0 76px;
  gap: 5px;
  border-radius: 12px;
}

.library .material-chip {
  width: 34px;
  height: 34px;
}

.library .material-name {
  max-width: 100%;
  overflow: hidden;
  font-size: 8px;
  line-height: 1.08;
  text-align: center;
  text-overflow: ellipsis;
  white-space: normal;
}

/* Верхняя горизонтальная библиотека на всю ширину. */
.app {
  grid-template-rows: auto minmax(0, 1fr);
}

.library-top {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 8px;
  padding: 15px 20px 8px;
  overflow: hidden;
}

.library-head {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  gap: 28px;
}

.library-head .panel-heading {
  flex: 0 0 auto;
  margin: 0;
}

.library-head .panel-heading h1 {
  font-size: 31px;
  line-height: 1;
}

.library-head .library-intro {
  display: flex;
  max-width: 520px;
  align-items: flex-start;
  gap: 8px;
  padding: 3px 0 0;
  margin: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.library-head .library-intro p {
  margin: 0;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.45;
}

.library-deck {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  align-items: flex-start;
  gap: 24px;
  padding: 1px 2px 8px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-color: #cabeab transparent;
  scrollbar-width: thin;
}

.library-deck::-webkit-scrollbar {
  height: 5px;
}

.library-deck::-webkit-scrollbar-thumb {
  background: #cabeab;
  border-radius: 8px;
}

.library-deck .piece-section {
  width: max-content;
  flex: 0 0 auto;
  margin: 0;
}

.library-deck .piece-grid {
  width: max-content;
  overflow: visible;
  padding-bottom: 0;
}

.library-deck .section-note {
  max-width: 230px;
}

.library-deck .foundation-card,
.library-deck .color-card {
  width: max-content;
  flex: 0 0 auto;
  padding: 0;
  margin: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.library-deck .foundation-options,
.library-deck .swatches {
  width: max-content;
  overflow: visible;
  padding-bottom: 0;
}

.library-deck .color-head {
  margin-bottom: 7px;
}

.workspace {
  grid-template-columns: minmax(0, 1fr) 288px;
  gap: 14px;
  padding: 0 16px 16px;
}

@media (max-width: 1180px) {
  .library-top {
    padding: 12px 14px 7px;
  }

  .library-head {
    gap: 16px;
  }

  .library-head .panel-heading h1 {
    font-size: 27px;
  }

  .library-head .library-intro {
    display: none;
  }

  .library-deck {
    gap: 16px;
  }

  .workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 0 10px 10px;
  }
}

@media (max-width: 760px) {
  .library-top {
    padding: 10px 10px 6px;
  }

  .library-head .panel-heading h1 {
    font-size: 24px;
  }

  .library-deck {
    gap: 13px;
  }
}

/* Единая линия карточек во всех группах верхней панели. */
.library-deck .piece-section,
.library-deck .foundation-card,
.library-deck .color-card {
  display: grid;
  grid-template-rows: 20px 15px auto;
  align-content: start;
}

.library-deck .section-line,
.library-deck .color-head {
  grid-row: 1;
  min-height: 0;
  margin: 0;
}

.library-deck .section-note {
  grid-row: 2;
  height: 15px;
  margin: 0;
  line-height: 15px;
}

.library-deck .piece-grid,
.library-deck .foundation-options,
.library-deck .swatches {
  grid-row: 3;
}

.library-divider {
  width: 100%;
  height: 1px;
  flex: 0 0 1px;
  margin: 2px 0 1px;
  background: rgba(208, 196, 178, 0.72);
}

/* Подписи карточек: по центру, до двух строк. */
.library .piece-meta,
.library .piece-card--wide .piece-meta {
  display: flex;
  width: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
}

.library .piece-name,
.library .piece-card--wide .piece-name {
  width: 100%;
  min-height: 17px;
  margin: 0 auto;
  text-align: center;
}

.library .foundation-name,
.library .foundation-option--wide .foundation-name,
.library .material-name {
  margin-right: auto;
  margin-left: auto;
  text-align: center;
}

/* В карточке: название сверху, размер снизу. */
.library .piece-card,
.library .piece-card--wide {
  justify-content: flex-start;
}

.library .piece-preview,
.library .piece-card--wide .piece-preview {
  height: 32px;
  min-height: 32px;
  flex: 0 0 32px;
}

.library .piece-meta,
.library .piece-card--wide .piece-meta {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 1px;
  padding: 2px 0 0;
}

.library .piece-name,
.library .piece-card--wide .piece-name {
  width: 100%;
  min-height: 0;
  margin: 0;
  font-size: 7.5px;
  line-height: 1.05;
  text-align: center;
}

.library .piece-dim {
  display: block;
  width: 100%;
  margin-top: auto;
  overflow: hidden;
  color: var(--muted);
  font-size: 6.8px;
  line-height: 1.05;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library .foundation-meta {
  display: block;
  max-width: 100%;
  margin-top: auto;
  overflow: hidden;
  color: var(--muted);
  font-size: 6.5px;
  line-height: 1.05;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Размер в карточках — жирным. */
.library .piece-dim,
.library .foundation-meta {
  color: var(--ink-soft);
  font-weight: 700;
}

/* У компактного каркаса размер показываем внизу. */
.library .piece-card[data-piece='module-frame-compact'] .piece-dim {
  display: block;
}

.library .piece-card[data-piece='module-frame-compact'] .piece-meta {
  justify-content: space-between;
}

/* У окон, где размер уже есть в названии, вторая строка не нужна. */
.library .piece-card[data-opening='opening-window-low'] .piece-dim,
.library .piece-card[data-opening='opening-window-wide'] .piece-dim {
  display: none;
}

.library .piece-card[data-opening='opening-window-low'] .piece-meta,
.library .piece-card[data-opening='opening-window-wide'] .piece-meta {
  justify-content: center;
}

/* У двух окон размер идёт второй строкой сразу под названием. */
.library .piece-card[data-opening='opening-window-low'] .piece-dim,
.library .piece-card[data-opening='opening-window-wide'] .piece-dim {
  display: block;
  margin-top: 0;
}

.library .piece-card[data-opening='opening-window-low'] .piece-meta,
.library .piece-card[data-opening='opening-window-wide'] .piece-meta {
  justify-content: flex-start;
  gap: 1px;
}

/* У этих окон название — одной строкой, размер — второй. */
.library .piece-card[data-opening='opening-window-low'] .piece-name,
.library .piece-card[data-opening='opening-window-wide'] .piece-name {
  display: block;
  overflow: hidden;
  font-size: 6.8px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Единые горизонтальные линии для всех подписей. */
.library-deck .color-head {
  height: 20px;
  align-items: center;
}

.library-deck .color-head h2 {
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 750;
  line-height: 1;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.library-deck .color-head strong {
  color: var(--muted);
  font-size: 8px;
  font-weight: 650;
  line-height: 1;
}

.library-deck .foundation-option,
.library-deck .foundation-option--wide {
  justify-content: flex-start;
}

.library-deck .foundation-visual,
.library-deck .foundation-option--wide .foundation-visual {
  height: 32px;
  min-height: 32px;
  flex: 0 0 32px;
}

.library-deck .foundation-name,
.library-deck .foundation-option--wide .foundation-name {
  margin-top: 2px;
  font-size: 8px;
  line-height: 1.05;
}

.library-deck .foundation-meta {
  margin-top: auto;
  font-size: 6.5px;
  line-height: 1.05;
}

.library-deck .material-option {
  justify-content: flex-start;
}

.library-deck .material-chip {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
}

.library-deck .material-name {
  margin-top: 2px;
  font-size: 8px;
  line-height: 1.05;
}

/* Точная общая линия названий у фундамента и отделки. */
.library-deck .foundation-name {
  transform: translateY(-2px);
}

.library-deck .material-name {
  transform: translateY(-5px);
}

/* Лишние блоки правой панели скрыты. */
.project-heading,
.stats-grid,
.floor-areas,
.example-variant,
#exampleBtn {
  display: none !important;
}

/* Иконка в квадрате, подписи под квадратом. */
.library .piece-card,
.library .piece-card--wide {
  width: 76px;
  height: auto;
  min-width: 76px;
  min-height: 0;
  flex: 0 0 76px;
  gap: 3px;
  padding: 0;
  overflow: visible;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  transform: none !important;
}

.library .piece-card .piece-preview,
.library .piece-card--wide .piece-preview {
  width: 76px;
  height: 76px;
  min-height: 76px;
  flex: 0 0 76px;
  padding: 2px;
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.library .piece-card:hover .piece-preview {
  border-color: #cfb59f;
  box-shadow: 0 6px 14px rgba(54, 43, 31, 0.1);
  transform: translateY(-1px);
}

.library .piece-card.is-selected .piece-preview {
  background: #fffaf2;
  border-color: rgba(199, 106, 75, 0.66);
  box-shadow: 0 0 0 2px rgba(199, 106, 75, 0.12);
}

.library .piece-card.is-selected::after {
  top: 7px;
  right: 7px;
}

.library .piece-meta,
.library .piece-card--wide .piece-meta {
  width: 76px;
  min-height: 24px;
  padding: 1px 1px 0;
}

/* Фундамент: квадрат с иконкой, подписи ниже. */
.library .foundation-option,
.library .foundation-option--wide {
  width: 76px;
  height: auto;
  min-width: 76px;
  min-height: 0;
  flex: 0 0 76px;
  gap: 3px;
  padding: 0;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  transform: none !important;
}

.library .foundation-visual,
.library .foundation-option--wide .foundation-visual {
  display: grid;
  width: 76px;
  height: 76px;
  min-height: 76px;
  flex: 0 0 76px;
  padding: 4px;
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  place-items: center;
}

.library .foundation-option:hover .foundation-visual {
  border-color: #cfb59f;
  box-shadow: 0 6px 14px rgba(54, 43, 31, 0.1);
  transform: translateY(-1px);
}

.library .foundation-option[aria-pressed='true'] .foundation-visual {
  background: #fffaf3;
  border-color: rgba(171, 79, 55, 0.72);
  box-shadow: inset 0 0 0 1px rgba(171, 79, 55, 0.14);
}

.library .foundation-visual svg {
  width: 54px;
  height: 40px;
}

.library .foundation-name,
.library .foundation-option--wide .foundation-name {
  margin-top: 0;
  transform: none;
}

.library .foundation-meta {
  display: block;
  margin-top: auto;
  transform: none;
}

/* Отделка: квадрат с фактурой, подпись ниже. */
.library .material-option {
  width: 76px;
  height: auto;
  min-width: 76px;
  min-height: 0;
  flex: 0 0 76px;
  gap: 3px;
  padding: 0;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

.library .material-chip {
  width: 76px;
  height: 76px;
  flex: 0 0 76px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.library .material-option:hover .material-chip {
  border-color: #cfb59f;
  box-shadow: 0 6px 14px rgba(54, 43, 31, 0.1);
  transform: translateY(-1px);
}

.library .material-option.is-selected .material-chip {
  border-color: rgba(199, 106, 75, 0.66);
  box-shadow: 0 0 0 2px rgba(199, 106, 75, 0.12);
}

.library .material-name {
  margin-top: 0;
  transform: none;
}

/* Кнопка и окно проекта. */
.request-button {
  order: 4;
}

.project-button {
  display: flex;
  order: 3;
  width: 100%;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
  margin: 0;
  color: var(--ink);
  background: rgba(255, 252, 246, 0.72);
  border: 1px solid var(--line);
  border-radius: 11px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.025em;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.project-button:hover {
  background: #fffdf8;
  border-color: #cfbfa9;
  transform: translateY(-1px);
}

.project-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.35;
}

.modal-card--project {
  width: min(820px, 100%);
}

.project-views {
  width: 100%;
  margin-top: 2px;
  overflow: hidden;
  background: #fffdf8;
  border: 1px solid var(--line-soft);
  border-radius: 16px;
}

.project-views canvas {
  display: block;
  width: 100%;
  height: auto;
}

@media (max-width: 760px) {
  .modal-card--project {
    padding: 21px 16px 18px;
  }

  .project-views {
    border-radius: 12px;
  }
}

/* Окно проекта: белый фон без бежевой подложки. */
.modal-card--project {
  background: #fff !important;
  background-image: none !important;
}

.project-views {
  background: transparent;
  border: 0;
  border-radius: 0;
}

.project-views canvas {
  background: transparent;
}

/* Небольшой отступ между «Проект» и заявкой. */
.request-button {
  margin-top: 12px;
}

.piece-spec,
.foundation-spec {
  display: block;
  width: 100%;
  margin-top: 1px;
  overflow: hidden;
  color: #8a8175;
  font-size: 6.2px;
  font-weight: 650;
  line-height: 1.05;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Отдельные листы проекта и превью слева. */
.modal-card--project {
  width: min(920px, 100%);
}

.project-body {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.project-sheet-nav {
  display: flex;
  width: 78px;
  flex: 0 0 78px;
  flex-direction: column;
  gap: 7px;
}

.project-sheet-thumb {
  display: grid;
  width: 78px;
  padding: 3px;
  gap: 3px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 7px;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  transition: border-color 150ms ease, background 150ms ease;
}

.project-sheet-thumb canvas {
  display: block;
  width: 70px;
  height: auto;
  background: #fff;
  border: 1px solid rgba(199, 190, 176, 0.8);
  border-radius: 3px;
}

.project-sheet-thumb:hover,
.project-sheet-thumb.is-active {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

.project-views {
  min-width: 0;
  flex: 1 1 auto;
}

@media (max-width: 760px) {
  .project-body {
    flex-direction: column-reverse;
    gap: 8px;
  }

  .project-sheet-nav {
    width: 100%;
    flex: 0 0 auto;
    flex-direction: row;
    overflow-x: auto;
  }

  .project-sheet-thumb {
    width: 64px;
    flex: 0 0 64px;
  }

  .project-sheet-thumb canvas {
    width: 56px;
  }
}

/* Крупные превью листов A–D слева. */
.project-sheet-nav {
  width: 110px;
  flex: 0 0 110px;
  gap: 9px;
}

.project-sheet-thumb {
  width: 110px;
  padding: 4px;
  gap: 4px;
  border-radius: 10px;
  font-size: 8px;
}

.project-sheet-thumb canvas {
  width: 102px;
  border-radius: 4px;
}

@media (max-width: 760px) {
  .project-sheet-nav {
    width: 100%;
    flex: 0 0 auto;
  }

  .project-sheet-thumb {
    width: 76px;
    flex: 0 0 76px;
  }

  .project-sheet-thumb canvas {
    width: 68px;
  }
}

/* Индикатор процента масштаба скрыт. */
.zoom-readout {
  display: none !important;
}

/* Блок масштабирования полностью скрыт. */
.stage-toolbar > .tool-pill:first-child {
  display: none !important;
}

/* ——— Мобильная адаптация ——— */
.stage-toolbar .project-toggle {
  display: none;
}

@media (max-width: 1180px) {
  .stage-toolbar .project-toggle {
    display: grid;
  }
}

@media (max-width: 900px) {
  .library-top {
    padding-bottom: 4px;
  }

  .library-deck {
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 12px;
    scrollbar-width: none;
  }

  .library-deck::-webkit-scrollbar {
    display: none;
  }

  .library-deck .piece-section {
    scroll-snap-align: start;
  }

  .library-deck .piece-card {
    width: 86px;
  }

  .library-deck .piece-name {
    font-size: 8.5px;
    line-height: 1.1;
  }

  .library-deck .piece-dim {
    font-size: 7.5px;
  }

  .library-deck .piece-spec {
    font-size: 6.8px;
  }

  .library-deck .section-line h2 {
    font-size: 9px;
  }

  .stage {
    height: min(66vh, 560px);
    min-height: 430px;
  }

  .stage-toolbar {
    gap: 5px;
  }

  .stage-toolbar .tool-button--solo {
    width: 32px;
    height: 32px;
  }

  .stage-bottom {
    bottom: 8px;
    left: 8px;
    right: 8px;
  }

  .stage-hint {
    padding: 7px 10px;
    font-size: 8px;
  }

  .project {
    width: min(320px, calc(100vw - 18px));
  }

  .modal-card--project {
    padding: 18px 12px 14px;
  }

  .project-sheet-nav {
    overflow-x: auto;
    padding: 2px 2px 7px;
    scrollbar-width: none;
  }

  .project-sheet-nav::-webkit-scrollbar {
    display: none;
  }

  .project-sheet-thumb {
    flex: 0 0 76px;
  }

  .project-sheet-thumb canvas {
    width: 76px;
  }

  .project-views canvas {
    min-width: 0;
  }
}

@media (max-width: 430px) {
  .library-head .panel-heading h1 {
    font-size: 22px;
  }

  .library-deck .piece-card {
    width: 82px;
  }

  .stage-toolbar {
    right: 9px;
    top: 9px;
  }

  .stage-toolbar .tool-pill {
    height: 32px;
    padding: 2px;
  }

  .stage-toolbar .tool-button {
    width: 27px;
    height: 27px;
  }

  .empty-hint {
    top: 7%;
    width: 78%;
  }
}

/* Мобильная панель сметы — непрозрачная, на весь экран. */
@media (max-width: 1180px) {
  #projectPanel {
    left: 9px;
    right: 9px;
    width: auto;
    background: #fff !important;
    border: 1px solid var(--line) !important;
    box-shadow: 0 24px 70px rgba(38, 33, 24, 0.24) !important;
    padding-top: 16px;
  }

  #projectPanel::before {
    content: 'Смета';
    display: block;
    margin: 0 0 10px;
    padding-right: 36px;
    color: var(--ink);
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 730;
    letter-spacing: -0.05em;
    line-height: 1.1;
  }

  body.has-project-panel {
    overflow: hidden;
  }
}

@media (max-width: 900px) {
  #projectPanel .project-actions {
    margin-top: 12px;
  }

  .project-views {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }

  .project-views canvas {
    width: 700px !important;
    max-width: none !important;
  }

  #projectModal .project-body {
    overflow-x: hidden;
  }
}

@media (max-width: 760px) {
  .project-views {
    position: relative;
  }

  .project-views::after {
    content: 'Свайпните лист в сторону';
    position: absolute;
    right: 7px;
    bottom: 7px;
    padding: 4px 7px;
    color: #6f675c;
    background: rgba(255, 253, 248, 0.9);
    border: 1px solid rgba(216, 206, 190, 0.8);
    border-radius: 6px;
    font-size: 7px;
    font-weight: 650;
    pointer-events: none;
  }
}

/* Строка этажей под заголовком готовности. */
.floor-summary {
  margin: -2px 0 7px;
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 600;
  line-height: 1.4;
}

.floor-summary[hidden] {
  display: none;
}

@media (max-width: 900px) {
  .floor-summary {
    margin-top: -1px;
    font-size: 9px;
    line-height: 1.45;
  }
}

/* Логотип — максимально жирный. */
.library-head .panel-heading h1,
.library-head .panel-heading h1 strong {
  font-weight: 900 !important;
}

/* Кнопка PNG в панели сцены. */
.stage-toolbar .png-download-button {
  width: auto;
  min-width: 42px;
  padding: 0 9px;
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

@media (max-width: 900px) {
  .stage-toolbar .png-download-button {
    width: auto;
    min-width: 42px;
    height: 32px;
    padding: 0 8px;
  }
}

/* «Очистить» в панели сцены рядом с отменой/повтором. */
.stage-toolbar .clear-stage-button {
  display: flex;
  width: auto;
  min-width: 72px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 9px;
  color: var(--ink-soft);
  border: 1px solid rgba(221, 211, 194, 0.84);
  background: rgba(255, 252, 246, 0.78);
  box-shadow: 0 8px 22px rgba(52, 41, 27, 0.055);
  font-family: var(--font-display);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.02em;
}

.stage-toolbar .clear-stage-button svg {
  width: 13px;
  height: 13px;
}

@media (max-width: 900px) {
  .stage-toolbar .clear-stage-button {
    min-width: 64px;
    height: 32px;
    padding: 0 7px;
    font-size: 7.5px;
  }
}

@media (max-width: 430px) {
  .stage-toolbar .clear-stage-button {
    min-width: 58px;
    padding: 0 6px;
  }
}

@media (max-width: 900px) {
  .empty-hint {
    top: 58px;
  }
}

.stage-toolbar .png-download-button {
  min-width: 62px;
  padding: 0 8px;
  font-size: 8px;
}

@media (max-width: 900px) {
  .stage-toolbar .png-download-button {
    min-width: 64px;
    padding: 0 7px;
  }
}

.stage-toolbar .png-download-button {
  display: flex;
  min-width: 78px;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.stage-toolbar .png-download-button svg {
  width: 13px;
  height: 13px;
}

@media (max-width: 900px) {
  .stage-toolbar .png-download-button {
    min-width: 76px;
  }
}

@media (max-width: 900px) {
  .library-deck,
  .library-deck .piece-card,
  .library-deck .foundation-option,
  .library-deck .material-option,
  .library-deck .color-card,
  .library-deck button,
  .library-deck a {
    touch-action: manipulation;
  }
}

@media (max-width: 900px), (pointer: coarse) {
  .library-deck .piece-card,
  .library-deck .piece-card *,
  .library-deck .foundation-option,
  .library-deck .foundation-option *,
  .library-deck .material-option,
  .library-deck .material-option * {
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
    user-select: none;
  }
}

/* Карточка после удержания готова к переносу. */
@media (pointer: coarse) {
  .piece-card.is-hold-drag {
    opacity: 0.78;
    transform: scale(0.97);
    box-shadow: 0 0 0 2px rgba(199, 106, 75, 0.28);
  }
}

@media (pointer: coarse) {
  .library-deck .piece-card,
  .library-deck .piece-card * {
    touch-action: none;
  }
}

@media (max-width: 900px) {
  .library-deck .piece-card,
  .library-deck .piece-card * {
    touch-action: none;
  }
}

/* Сохранение в правом верхнем углу сайта. */
.library-head .site-save-button {
  display: flex;
  height: 36px;
  flex: 0 0 auto;
  align-self: flex-start;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 12px;
  margin-left: auto;
  color: var(--ink-soft);
  background: rgba(255, 252, 246, 0.9);
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  box-shadow: 0 8px 20px rgba(50, 40, 29, 0.06);
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.01em;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease;
}

.library-head .site-save-button:hover {
  color: var(--accent);
  background: #fffdf8;
  border-color: rgba(171, 79, 55, 0.36);
}

.library-head .site-save-button svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.45;
}

.scene-actions .tool-pill {
  height: 36px;
  background: rgba(255, 253, 248, 0.9);
  border-color: var(--line-soft);
  box-shadow: 0 8px 20px rgba(50, 40, 29, 0.08);
}

@media (max-width: 900px) {
  .library-head .site-save-button {
    height: 32px;
    padding: 0 8px;
    font-size: 7.5px;
  }

  .library-head .site-save-button svg {
    width: 13px;
    height: 13px;
  }
}

@media (max-width: 560px) {
  .scene-actions .tool-pill {
    height: 32px;
    padding: 2px;
  }
}

.scene-actions .clear-stage-button {
  display: flex;
  width: auto;
  min-width: 72px;
  height: 36px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 9px;
  color: var(--ink-soft);
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  box-shadow: 0 8px 20px rgba(50, 40, 29, 0.08);
  font-family: var(--font-display);
  font-size: 8px;
  font-weight: 750;
}

.scene-actions .clear-stage-button svg {
  width: 13px;
  height: 13px;
}

@media (max-width: 560px) {
  .scene-actions .clear-stage-button {
    min-width: 64px;
    height: 32px;
    padding: 0 7px;
    font-size: 7.5px;
  }
}

/* Печать сметы и листов проекта в PDF. */
.print-root {
  display: none;
}

@media print {
  @page {
    size: A4 landscape;
    margin: 8mm;
  }

  html,
  body {
    background: #fff !important;
  }

  body > *:not(.print-root) {
    display: none !important;
  }

  .print-root {
    display: block !important;
    color: #232323;
    font-family: "Segoe UI", Arial, sans-serif;
  }

  .print-page {
    position: relative;
    width: 100%;
    break-after: page;
    page-break-after: always;
    color: #232323;
    background: #fff;
  }

  .print-page:last-child {
    break-after: auto;
    page-break-after: auto;
  }

  .print-brand {
    color: #233c33;
    font-family: var(--font-display), "Segoe UI", Arial, sans-serif;
    font-size: 14pt;
    font-weight: 900;
    letter-spacing: 0.02em;
  }

  .print-brand span {
    margin-left: 6mm;
    color: #8a8175;
    font-size: 7pt;
    font-weight: 500;
    letter-spacing: 0.04em;
  }

  .print-kicker {
    margin: 11mm 0 3mm;
    color: #c76a4b;
    font-size: 7.5pt;
    font-weight: 800;
    letter-spacing: 0.18em;
  }

  .print-estimate h1 {
    margin: 0 0 5mm;
    font-family: var(--font-display), "Segoe UI", Arial, sans-serif;
    font-size: 28pt;
    font-weight: 800;
    letter-spacing: -0.04em;
  }

  .print-meta {
    margin: 0 0 2mm;
    color: #5f5a52;
    font-size: 9pt;
    line-height: 1.45;
  }

  .print-table {
    width: 100%;
    margin: 10mm 0 4mm;
    border-collapse: collapse;
  }

  .print-table th {
    padding: 2.5mm 2mm;
    color: #6b655c;
    border-bottom: 0.4mm solid #bfb7aa;
    font-size: 7.5pt;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-align: left;
    text-transform: uppercase;
  }

  .print-table th:nth-child(2),
  .print-table td:nth-child(2) {
    text-align: center;
  }

  .print-table th:last-child,
  .print-table td:last-child {
    text-align: right;
  }

  .print-table td {
    padding: 2.6mm 2mm;
    border-bottom: 0.25mm solid #e2ddd4;
    font-size: 9.5pt;
  }

  .print-extra,
  .print-total {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10mm;
    padding: 2.4mm 2mm;
    font-size: 9.5pt;
  }

  .print-extra {
    border-bottom: 0.25mm solid #e2ddd4;
  }

  .print-total {
    margin-top: 4mm;
    border-top: 0.5mm solid #8f8678;
    border-bottom: 0.5mm solid #8f8678;
    font-size: 13pt;
    font-weight: 800;
  }

  .print-note {
    margin-top: 3mm;
    color: #8a8175;
    font-size: 7.5pt;
  }

  .print-drawing-head {
    display: flex;
    justify-content: space-between;
    gap: 10mm;
    padding-bottom: 2.5mm;
    margin-bottom: 3mm;
    color: #5f5a52;
    border-bottom: 0.3mm solid #bdb5a8;
    font-size: 8pt;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .print-figure {
    display: flex;
    height: 176mm;
    align-items: center;
    justify-content: center;
  }

  .print-figure canvas {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 176mm;
  }
}

/* «Смета» справа от очистки. */
.scene-actions .project-toggle {
  display: none;
  width: auto;
  min-width: 66px;
  height: 36px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 9px;
  color: var(--ink-soft);
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  box-shadow: 0 8px 20px rgba(50, 40, 29, 0.08);
  font-family: var(--font-display);
  font-size: 8px;
  font-weight: 750;
}

.scene-actions .project-toggle svg {
  width: 13px;
  height: 13px;
}

@media (max-width: 1180px) {
  .scene-actions .project-toggle {
    display: flex;
  }
}

@media (max-width: 560px) {
  .scene-actions .project-toggle {
    min-width: 60px;
    height: 32px;
    padding: 0 7px;
    font-size: 7.5px;
  }
}

/* Логотип и «Сохранить» на одной горизонтальной оси. */
.library-head {
  align-items: center;
}

.library-head .site-save-button {
  align-self: center;
}

/* Цветные контуры кнопок. */
#clearBtn {
  border-color: rgba(179, 78, 59, 0.75) !important;
  border-width: 1.5px !important;
}

#clearBtn:hover {
  border-color: #b34e3b !important;
}

#projectToggleBtn {
  border-color: rgba(62, 100, 154, 0.75) !important;
  border-width: 1.5px !important;
}

#projectToggleBtn:hover {
  border-color: #3e649a !important;
}

@media (max-width: 900px), (pointer: coarse) {
  .library-deck .piece-card,
  .library-deck .piece-card * {
    touch-action: none !important;
  }
}

.drag-badge {
  height: 42px;
  gap: 7px;
  padding: 0 10px;
}

.drag-badge-icon {
  display: grid;
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  place-items: center;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 7px;
}

.drag-badge-icon svg {
  display: block;
  width: 26px;
  height: 26px;
}

@media (max-width: 900px), (pointer: coarse) {
  .library-deck .piece-card,
  .library-deck .piece-card * {
    touch-action: manipulation !important;
  }

  .library-deck .piece-preview,
  .library-deck .piece-preview * {
    touch-action: none !important;
  }

  .library-deck .piece-preview {
    position: relative;
    cursor: grab;
  }

  .library-deck .piece-preview::after {
    content: '↗';
    position: absolute;
    top: 4px;
    right: 4px;
    display: grid;
    width: 17px;
    height: 17px;
    place-items: center;
    color: #fffaf0;
    background: rgba(48, 54, 57, 0.72);
    border-radius: 6px;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    pointer-events: none;
  }
}

.library-deck .piece-preview::after {
  content: none !important;
  display: none !important;
}

/* Первичная анимация переноса модуля. */
html.intro-pending .empty-hint,
html.intro-pending .empty-arrow,
body.intro-running .empty-hint,
body.intro-running .empty-arrow {
  opacity: 0 !important;
  visibility: hidden !important;
}

.intro-drag-demo {
  position: fixed;
  z-index: 90;
  width: 76px;
  height: 76px;
  pointer-events: none;
  will-change: transform, opacity;
}

.intro-demo-icon {
  display: grid;
  width: 76px;
  height: 76px;
  place-items: center;
  background: #fffdf8;
  border: 1px solid rgba(208, 196, 178, 0.9);
  border-radius: 16px;
  box-shadow: 0 18px 35px rgba(48, 39, 28, 0.18);
}

.intro-demo-icon svg {
  width: 90%;
  height: 90%;
}

.intro-demo-hand {
  position: absolute;
  right: -20px;
  bottom: -24px;
  width: 52px;
  height: auto;
  filter: drop-shadow(0 5px 5px rgba(45, 37, 28, 0.24));
  transform: rotate(-12deg);
}

@media (max-width: 900px) {
  .intro-drag-demo {
    width: 68px;
    height: 68px;
  }

  .intro-demo-icon {
    width: 68px;
    height: 68px;
    border-radius: 14px;
  }

  .intro-demo-hand {
    right: -17px;
    bottom: -21px;
    width: 44px;
  }
}

/* Порядок фундаментов слева направо. */
#foundationOptions [data-foundation="road"] {
  order: 1;
}

#foundationOptions [data-foundation="piles"] {
  order: 2;
}

#foundationOptions [data-foundation="slab"] {
  order: 3;
}

/* Подпись под логотипом. */
.brand-tagline {
  margin: 3px 0 0;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 8px;
  font-weight: 650;
  letter-spacing: 0.12em;
  line-height: 1.15;
}

@media (max-width: 900px) {
  .brand-tagline {
    margin-top: 2px;
    font-size: 7px;
    letter-spacing: 0.09em;
  }
}

@media (max-width: 900px) {
  .project-views {
    overflow: hidden !important;
  }

  .project-views canvas {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
  }

  .project-views::after {
    display: none !important;
  }
}

/* Мобильные кнопки масштаба справа. */
@media (max-width: 900px) {
  .stage-toolbar {
    top: 80px;
    right: 10px;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
  }

  .stage-toolbar > .tool-pill:first-child {
    display: flex !important;
    height: auto;
    flex-direction: column;
    padding: 4px;
    border-radius: 14px;
    background: rgba(255, 252, 246, 0.9);
  }

  .stage-toolbar > .tool-pill:first-child .tool-button {
    width: 32px;
    height: 32px;
  }

  .stage-toolbar > .tool-pill:first-child .tool-button svg {
    width: 16px;
    height: 16px;
  }
}

@media (max-width: 900px) {
  .stage-toolbar > .tool-pill:first-child #zoomInBtn {
    order: 1;
  }

  .stage-toolbar > .tool-pill:first-child #zoomOutBtn {
    order: 2;
  }
}
