:root {
  --cream: #fffbf5;
  --paper: #ffffff;
  --ink: #1a1a2e;
  --muted: #6b6878;
  --line: #ece4d8;
  --gold: #d4a855;
  --sage: #4c8c64;
  --sage-dark: #3d7552;
  --coral: #e07a5f;
  --radius: 14px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
h1, h2, h3 { font-family: Georgia, 'Times New Roman', serif; font-weight: 400; margin: 0; }

.top { display: flex; justify-content: center; padding: 18px 16px 6px; }
.wordmark { height: 26px; width: auto; }
.is-tg .top { display: none; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 8px 16px 40px; }

.eyebrow {
  margin: 0 0 6px;
  font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--gold); font-weight: 600;
}

/* ---------- вступление ---------- */
.intro { max-width: 620px; margin: 24px auto 0; text-align: center; }
.intro h1 { font-size: clamp(28px, 5vw, 40px); line-height: 1.15; }
.lead { color: var(--muted); margin: 14px 0 22px; }
.actions { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.privacy { font-size: 14px; color: var(--sage-dark); margin: 18px 0 8px; }
.tips {
  list-style: none; padding: 0; margin: 14px 0 0;
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
}
.tips li {
  font-size: 13px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 99px; padding: 4px 12px; background: var(--paper);
}

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border-radius: 99px;
  border: 1px solid var(--ink); background: var(--paper); color: var(--ink);
  font: 500 15px/1 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; cursor: pointer; text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.btn-main { background: var(--sage); border-color: var(--sage); color: #fff; width: min(100%, 360px); }
.btn-main:hover { background: var(--sage-dark); }
.btn-ghost { border-color: var(--line); width: min(100%, 360px); }
.stage-actions .btn-ghost { width: auto; }
.btn-small { min-height: 40px; padding: 0 16px; font-size: 14px; }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- студия ---------- */
.studio { display: grid; gap: 20px; margin-top: 8px; }
@media (min-width: 820px) {
  .studio { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; gap: 32px; }
  .panel { position: sticky; top: 16px; }
}

.stage {
  position: relative; width: 100%; aspect-ratio: 3 / 4; margin: 0 auto;
  border-radius: var(--radius); overflow: hidden; background: #eee6da;
  touch-action: pan-y; user-select: none; cursor: ew-resize;
}
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.handle {
  position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px;
  background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.08); display: none; pointer-events: none;
}
.handle span {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: #fff; color: var(--ink); font-size: 12px; white-space: nowrap;
  padding: 6px 10px; border-radius: 99px; box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.stage.split .handle { display: block; }

.spinner {
  position: absolute; inset: 0; display: none;
  background: rgba(255,251,245,.55);
}
.spinner::after {
  content: ''; position: absolute; top: 50%; left: 50%; width: 36px; height: 36px; margin: -18px;
  border: 3px solid var(--line); border-top-color: var(--sage); border-radius: 50%;
  animation: spin .8s linear infinite;
}
.stage.busy .spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

.status { margin: 10px 0 0; font-size: 14px; color: var(--muted); text-align: center; }
.status.error { color: var(--coral); }
.stage-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }

.shade-name { font-size: 28px; margin-bottom: 14px; min-height: 1.2em; }
.group + .group { margin-top: 14px; }
.group-label { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.swatch {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 8px 4px; border: 1px solid transparent; border-radius: 12px;
  background: none; cursor: pointer; color: var(--ink); font: 12px/1.2 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
.swatch .dot {
  width: 44px; height: 44px; border-radius: 50%;
  background:
    linear-gradient(160deg, rgba(255,255,255,.45), rgba(255,255,255,0) 45%),
    linear-gradient(0deg, rgba(0,0,0,.25), rgba(0,0,0,0) 55%),
    var(--c);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}
.swatch.on { border-color: var(--ink); background: var(--paper); }
.swatch-name { text-align: center; }

.strength { display: flex; align-items: center; gap: 12px; margin-top: 18px; font-size: 14px; color: var(--muted); }
.strength input { flex: 1; accent-color: var(--sage); }

/* ---------- уход ---------- */
.care {
  margin-top: 32px; padding: 24px 20px; border-radius: var(--radius);
  background: var(--paper); border: 1px solid var(--line);
}
.care h2 { font-size: clamp(24px, 4vw, 30px); }
.care-text { color: var(--muted); max-width: 680px; margin: 10px 0 18px; }
.products { display: grid; gap: 12px; }
@media (min-width: 720px) { .products { grid-template-columns: repeat(3, 1fr); } }
.product {
  display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: start;
  padding: 12px; border-radius: 12px; background: var(--cream);
}
@media (min-width: 720px) { .product { grid-template-columns: 1fr; text-align: center; } .product img { margin: 0 auto; } }
.product img { width: 96px; height: 96px; object-fit: contain; border-radius: 8px; }
@media (min-width: 720px) { .product img { width: 140px; height: 140px; } }
.product .line { font-size: 11px; letter-spacing: .08em; color: var(--gold); font-weight: 600; }
.product h3 { font-size: 18px; margin: 2px 0 4px; }
.product p { font-size: 13px; color: var(--muted); margin: 0 0 10px; }
.to-care { display: flex; margin: 14px auto 0; }
@media (min-width: 820px) { .to-care { display: none !important; } }
.btn-buy { white-space: nowrap; min-height: 40px; font-size: 14px; background: var(--ink); color: #fff; border-color: var(--ink); }

.note { margin: 28px auto 0; max-width: 620px; text-align: center; font-size: 12px; color: var(--muted); }

/* ---------- текст для поиска ---------- */
.seo { max-width: 720px; margin: 48px auto 0; }
.seo h2 { font-size: clamp(22px, 3.6vw, 28px); margin: 32px 0 12px; }
.seo p, .seo li { color: #3a3848; }
.seo ol { padding-left: 20px; }
.seo li + li { margin-top: 8px; }
.seo a { color: var(--sage-dark); }
.seo details { border-top: 1px solid var(--line); padding: 12px 0; }
.seo details:last-of-type { border-bottom: 1px solid var(--line); }
.seo summary { cursor: pointer; font-weight: 500; }
.seo details p { margin: 8px 0 0; }
.foot { margin-top: 40px; text-align: center; font-size: 14px; color: var(--muted); }
.foot a { color: var(--muted); }
.is-tg .seo, .is-tg .foot { display: none; }

/* ---------- окно «сохранить» ---------- */
.sheet {
  position: fixed; inset: 0; z-index: 10; background: rgba(26,26,46,.6);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.sheet[hidden] { display: none; }
.sheet-box { background: var(--cream); border-radius: var(--radius); padding: 14px; max-width: 480px; text-align: center; }
.sheet-box img { width: 100%; max-height: 70vh; object-fit: contain; border-radius: 8px; }
.sheet-box p { font-size: 14px; color: var(--muted); }
