/* Макет: чертёжный лист. Живая 3D-сцена в размерных линиях со «штампом»,
   под ней шаги и загрузка. Нейтрали — холодная бумага и графит, акцент
   один: зелёный луч лазерного уровня (активные состояния, прогресс). */
:root {
  --paper: #f3f4f1;
  --paper-2: #e8ebe6;
  --card: #fbfcfa;
  --ink: #141618;
  --graphite: #51575b;
  --line: #cfd5d0;
  --laser: #12a862;
  --laser-ink: #08784a;
  --stage: #101213;
  --danger: #b2391f;
  --font: "Geologica", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Martian Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --radius: 16px;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --shadow: 0 1px 2px rgba(20, 22, 24, .06), 0 10px 30px rgba(20, 22, 24, .07);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --paper: #0f1112; --paper-2: #171a1b; --card: #15181a; --ink: #eef0ec; --graphite: #a2a8a4; --line: #2b3032;
  --laser: #2fd27f; --laser-ink: #55e29a; --danger: #ff8a75; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .35); color-scheme: dark; } }
:root[data-theme="dark"] {
  --paper: #0f1112; --paper-2: #171a1b; --card: #15181a; --ink: #eef0ec; --graphite: #a2a8a4; --line: #2b3032;
  --laser: #2fd27f; --laser-ink: #55e29a; --danger: #ff8a75; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .35); color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 17px/1.55 var(--font); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
h1, h2, h3 { margin: 0; font-weight: 500; letter-spacing: -.02em; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
a { color: var(--laser-ink); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--laser); outline-offset: 3px; border-radius: 6px; }
.mono { font-family: var(--mono); font-size: .86em; letter-spacing: -.01em; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--card); padding: 8px 12px; }
.skip:focus { left: 12px; }
.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
[hidden] { display: none !important; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px;
  border-radius: 999px; border: 0; cursor: pointer; text-decoration: none; white-space: nowrap;
  font: 500 15px var(--font); color: var(--ink); background: transparent;
  transition: transform .15s ease-out, background-color .2s ease, color .2s ease, box-shadow .2s ease;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.ghost { box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.small { min-height: 40px; padding: 0 16px; font-size: 14px; background: var(--ink); color: var(--paper); }
.btn.big { min-height: 54px; font-size: 16px; width: 100%; }
@media (hover: hover) and (pointer: fine) {
  .btn.primary:hover:not(:disabled), .btn.small:hover { background: var(--laser-ink); color: #fff; }
  .btn.ghost:hover:not(:disabled) { box-shadow: inset 0 0 0 1.5px var(--ink); }
}

/* ---------- шапка ---------- */
.site-top {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; display: flex; align-items: center; gap: 24px;
  padding: 12px max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px));
  background: color-mix(in srgb, var(--paper) 86%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--paper); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 500; font-size: 18px; letter-spacing: -.02em; }
.mark { width: 26px; height: 11px; border: 2px solid var(--laser); border-radius: 50%; position: relative; }
.mark::after { content: ""; position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; border-radius: 50%; background: var(--laser); transform: translate(-50%, -50%); }
.site-nav { display: flex; gap: 22px; margin-left: auto; font-size: 15px; }
.site-nav a { color: var(--graphite); text-decoration: none; }
@media (hover: hover) and (pointer: fine) { .site-nav a:hover { color: var(--ink); } }
@media (max-width: 760px) { .site-nav { display: none; } .site-top .btn { margin-left: auto; } }

/* ---------- первый экран ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(28px, 4vw, 64px); align-items: center; padding-block: clamp(28px, 5vw, 64px) clamp(48px, 7vw, 96px); }
.hero-copy { display: grid; gap: 22px; min-width: 0; }
.hero h1 { font-size: clamp(38px, 5.2vw, 70px); line-height: 1.02; font-weight: 500; }
.lead { font-size: clamp(17px, 1.5vw, 20px); color: var(--graphite); max-width: 44ch; }
.cta { display: flex; flex-wrap: wrap; gap: 10px; }
.facts { display: flex; flex-wrap: wrap; gap: 10px 28px; margin: 8px 0 0; padding-top: 18px; border-top: 1px solid var(--line); }
.facts div { display: grid; gap: 2px; }
.facts dt { font: 400 11px var(--mono); color: var(--graphite); letter-spacing: .02em; }
.facts dd { margin: 0; font-size: 18px; font-weight: 500; font-variant-numeric: tabular-nums; }

/* лист с размерными линиями */
.sheet { position: relative; margin: 0; padding: 30px 0 0 34px; min-width: 0; }
.dim { position: absolute; color: var(--graphite); font: 400 11px var(--mono); }
.dim-x { left: 34px; right: 0; top: 6px; height: 14px; border-left: 1px solid; border-right: 1px solid; }
.dim-x::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid; }
.dim-x span { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: var(--paper); padding: 0 8px; }
.dim-y { left: 6px; top: 30px; bottom: 74px; width: 14px; border-top: 1px solid; border-bottom: 1px solid; }
.dim-y::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; border-left: 1px solid; }
.dim-y span { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-90deg); background: var(--paper); padding: 0 8px; white-space: nowrap; }
.stage {
  --stage: #101213;
  position: relative; aspect-ratio: 4 / 3; max-width: 100%; border-radius: 6px; overflow: hidden; background: var(--stage);
  touch-action: none; cursor: grab; box-shadow: var(--shadow); color: #f2f3ef;
}
.stage:active { cursor: grabbing; }
.stage canvas { display: block; width: 100% !important; height: 100% !important; }
.stage-loader { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; color: #a9aea8; font: 400 12px var(--mono); transition: opacity .4s; }
.stage-loader.done { opacity: 0; pointer-events: none; }
.loader-line { width: 160px; height: 1px; background: linear-gradient(90deg, transparent, #2fd27f, transparent); background-size: 200% 100%; animation: scan 1.4s linear infinite; }
@keyframes scan { to { background-position: -200% 0; } }
.stage::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; pointer-events: none; opacity: 0; background: linear-gradient(90deg, transparent, #2fd27f 18%, #2fd27f 82%, transparent); }
.stage.revealed::after { animation: level 1.6s var(--ease-out) forwards; }
@keyframes level { 0% { opacity: 0; transform: translateY(0); } 15%, 85% { opacity: 1; } 100% { opacity: 0; transform: translateY(var(--h, 400px)); } }
.open-full { position: absolute; right: 12px; top: 12px; z-index: 3; padding: 8px 12px; border-radius: 999px; background: rgba(16, 18, 19, .7); color: #f2f3ef; font-size: 13px; text-decoration: none; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.mini-stops { position: absolute; left: 12px; bottom: 12px; z-index: 3; display: flex; gap: 6px; margin: 0; padding: 0; list-style: none; }
.mini-stops button { width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer; background: rgba(16, 18, 19, .7); color: #a9aea8; font: 500 11px var(--mono); box-shadow: inset 0 0 0 1px rgba(242, 243, 239, .16); }
.mini-stops button[aria-current="true"] { color: #f2f3ef; box-shadow: inset 0 0 0 1.5px #2fd27f; }
.hotspots { position: absolute; inset: 0; pointer-events: none; z-index: 2; overflow: hidden; }
.hotspot { position: absolute; left: 0; top: 0; display: grid; justify-items: center; gap: 4px; padding: 4px; border: 0; background: none; cursor: pointer; pointer-events: auto; color: #f2f3ef; }
.hotspot::before { content: ""; width: 30px; height: 10px; border-radius: 50%; border: 2px solid #f2f3ef; background: rgba(242, 243, 239, .16); }
.hotspot span { font: 500 10px var(--mono); padding: 2px 6px; border-radius: 5px; background: rgba(16, 18, 19, .7); white-space: nowrap; }
.stamp { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; font: 400 11px/1.5 var(--mono); color: var(--graphite); }
.stamp b { color: var(--ink); font-weight: 500; }
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .sheet { order: -1; padding: 26px 0 0 26px; }
  .dim-x { left: 26px; } .dim-y { bottom: 92px; }
}

/* ---------- шаги ---------- */
section h2 { font-size: clamp(28px, 3.4vw, 44px); line-height: 1.08; }
.how { padding-block: clamp(40px, 7vw, 96px); border-top: 1px solid var(--line); }
.steps { list-style: none; margin: 32px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 3vw, 40px); }
.steps li { display: grid; align-content: start; gap: 10px; padding-top: 18px; border-top: 2px solid var(--ink); min-width: 0; }
.step-n { font: 500 13px var(--mono); color: var(--laser-ink); }
.steps h3 { font-size: 22px; }
.steps p { color: var(--graphite); font-size: 16px; }
.meta { font: 400 12px var(--mono); color: var(--ink); padding-top: 4px; }
.more { margin-top: 28px; }
@media (max-width: 820px) { .steps { grid-template-columns: 1fr; } }

/* ---------- загрузка ---------- */
.upload { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 6fr); gap: clamp(24px, 4vw, 56px); align-items: start; padding-block: clamp(40px, 7vw, 96px); border-top: 1px solid var(--line); }
.upload-head { display: grid; gap: 14px; position: sticky; top: 96px; }
.upload-head p { color: var(--graphite); }
.panel { grid-column: 2; display: grid; gap: 18px; padding: clamp(18px, 3vw, 32px); border-radius: calc(var(--radius) + 8px); background: var(--card); box-shadow: var(--shadow); min-width: 0; }
@media (max-width: 860px) { .upload { grid-template-columns: 1fr; } .upload-head { position: static; } .panel { grid-column: 1; } }
.drop {
  display: grid; justify-items: center; gap: 12px; padding: clamp(24px, 5vw, 44px) 16px; text-align: center; border-radius: var(--radius);
  border: 1.5px dashed var(--line); background: var(--paper); transition: border-color .2s ease, background-color .2s ease;
}
.drop.over { border-color: var(--laser); background: color-mix(in srgb, var(--laser) 8%, var(--paper)); }
.drop.has-file { border-style: solid; border-color: var(--laser); }
.drop-icon { width: 44px; height: 44px; color: var(--laser-ink); }
.drop-title { font-size: 18px; font-weight: 500; }
.drop-file { color: var(--graphite); min-height: 1.4em; overflow-wrap: anywhere; }
.field { display: grid; gap: 8px; font-size: 15px; font-weight: 500; }
.field .opt { font-weight: 400; color: var(--graphite); font-size: 13px; }
.field input { min-height: 48px; padding: 0 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--paper); color: var(--ink); font: 400 16px var(--font); }
.field input:focus { outline: none; border-color: var(--laser); }
.check { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 12px; align-items: start; font-size: 15px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--laser-ink); }
.fine { font-size: 13px; color: var(--graphite); }

.status h3, .result h3, .error h3 { font-size: 24px; }
.meter { height: 6px; border-radius: 3px; background: var(--paper-2); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--laser); transition: width .3s ease-out; }
.phases { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.phases li { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); color: var(--graphite); font-size: 15px; }
.phases li::before { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--line); justify-self: center; }
.phases li.active { color: var(--ink); }
.phases li.active::before { border-color: var(--laser); border-top-color: transparent; animation: spin .9s linear infinite; }
.phases li.done::before { background: var(--laser); border-color: var(--laser); }
.phases .t { font: 400 11px var(--mono); color: var(--graphite); font-variant-numeric: tabular-nums; }
@keyframes spin { to { transform: rotate(360deg); } }
.link-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.link-row input { min-height: 44px; padding: 0 12px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--paper); color: var(--ink); min-width: 0; }
.error { box-shadow: var(--shadow), inset 0 0 0 1.5px color-mix(in srgb, var(--danger) 50%, transparent); }
.error p { color: var(--ink); }

/* ---------- мои туры ---------- */
.mine { padding-block: 0 clamp(40px, 6vw, 80px); display: grid; gap: 18px; }
.mine-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.mine-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 14px; background: var(--card); box-shadow: var(--shadow); }
.mine-list a { color: var(--ink); font-weight: 500; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mine-list .mono { color: var(--graphite); font-size: 11px; }

/* ---------- вопросы ---------- */
.faq { padding-block: clamp(40px, 7vw, 96px); border-top: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 6fr); gap: clamp(24px, 4vw, 56px); }
.faq-list { display: grid; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { display: flex; justify-content: space-between; gap: 16px; padding: 18px 0; cursor: pointer; font-size: 18px; font-weight: 500; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font: 400 20px var(--mono); color: var(--graphite); transition: transform .2s ease; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding: 0 0 18px; color: var(--graphite); max-width: 62ch; }
@media (max-width: 860px) { .faq { grid-template-columns: 1fr; } }

.site-foot { display: grid; gap: 6px; padding-block: 28px calc(40px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); font-size: 13px; color: var(--graphite); }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 40; transform: translate(-50%, 8px); padding: 10px 18px; border-radius: 999px; background: var(--ink); color: var(--paper); font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s ease-out, transform .2s ease-out; max-width: calc(100vw - 32px); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- внутри Telegram: компактно, сразу к делу ---------- */
.tma .site-nav, .tma .facts, .tma .lead, .tma .how, .tma .site-foot, .tma .stamp, .tma .dim { display: none; }
.tma .hero { padding-block: 12px 24px; gap: 16px; }
.tma .hero h1 { font-size: 30px; }
.tma .sheet { padding: 0; }
.tma .site-top .btn { display: none; }

/* ---------- инструкция ---------- */
.doc { padding-block: clamp(28px, 5vw, 64px) clamp(48px, 7vw, 96px); display: grid; gap: clamp(28px, 4vw, 48px); }
.doc-head { display: grid; gap: 16px; max-width: 760px; }
.doc-head h1 { font-size: clamp(34px, 4.6vw, 58px); line-height: 1.04; }
.doc-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; counter-reset: s; }
.doc-steps > li { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 4px 20px; padding: clamp(18px, 3vw, 28px); border-radius: calc(var(--radius) + 4px); background: var(--card); box-shadow: var(--shadow); counter-increment: s; }
.doc-steps > li::before { content: counter(s, decimal-leading-zero); grid-column: 1; grid-row: 1 / span 8; font: 500 22px var(--mono); color: var(--laser-ink); }
.doc-steps > li > * { grid-column: 2; min-width: 0; }
.doc-steps h2 { font-size: clamp(21px, 2.2vw, 26px); }
.doc-steps p, .doc-steps li li { color: var(--graphite); font-size: 16px; }
.doc-steps ul { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 6px; }
.doc-steps .tip { margin-top: 8px; padding: 10px 14px; border-radius: 12px; background: var(--paper-2); color: var(--ink); font-size: 14px; }
.doc-figure { margin: 0; padding: 18px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); }
.doc-figure svg { display: block; width: 100%; height: auto; max-width: 560px; }
.doc-figure figcaption { margin-top: 10px; font: 400 12px var(--mono); color: var(--graphite); }
.doc-steps .doc-figure { margin-top: 10px; box-shadow: none; background: var(--paper); }
@media (max-width: 560px) { .doc-steps > li { grid-template-columns: 1fr; } .doc-steps > li::before { grid-row: auto; } .doc-steps > li > * { grid-column: 1; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .stage.revealed::after, .loader-line, .phases li.active::before { animation: none; }
  .btn, .toast, .drop, .meter i { transition: none; }
}
@media print {
  .site-top, .site-foot, .toast, .skip, .doc-head .cta { display: none; }
  body { background: #fff; color: #000; }
  .doc-steps > li, .doc-figure { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
}
