:root {
  --bg: #F6F7FB; --surface: #FFFFFF; --surface-sunken: #ECEEF5;
  --text: #15171C; --text-secondary: #585C68; --text-tertiary: #8D92A0;
  --border: #E2E5ED;
  /* Акцент переключается JS'ом на цвет выбранного материала (см. MATERIAL_ACCENTS в landing.js) —
     PLA ниже служит дефолтом до первого ответа /api/v1/material-rates. */
  --accent: #E64A1F; --accent-hover: #C93D15; --accent-tint: #FFE6DC;
  --success: #15875A; --success-tint: #DEF5EA; --danger: #D33D2C; --danger-tint: #FBE2DE;
  /* Палитра материалов — она же единственный источник «цветности» страницы, см. applyMaterialAccent(). */
  --mat-pla: #E64A1F; --mat-petg: #0E9488; --mat-abs: #5B4FE0; --mat-tpu: #E0266E; --mat-nylon: #1F74C9;
  --radius-sm: 8px; --radius-md: 12px; --radius-lg: 20px;
  --shadow-card: 0 1px 2px rgba(28,29,31,0.04), 0 8px 24px -12px rgba(28,29,31,0.12);
  --font-sans: 'IBM Plex Sans', system-ui, sans-serif; --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
/* Атрибут hidden должен побеждать любой display, который задают авторские правила ниже
   (.card/.result и т.п. ставят display:flex — без !important он молча перебивал бы hidden,
   и скрытые карточки оставались видны всегда). */
[hidden] { display: none !important; }
body { margin: 0; font-family: var(--font-sans); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; transition: color 0.2s; }
h1, h2, p { margin: 0; }

.topbar { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; }
.topbar-tags { display: flex; gap: 8px; }
.tag { font-size: 12px; font-weight: 600; color: var(--accent); background: var(--accent-tint); padding: 5px 10px; border-radius: 999px; }
@media (max-width: 640px) { .topbar-tags { display: none; } }

main { max-width: 880px; margin: 0 auto; padding: 0 20px 80px; display: flex; flex-direction: column; gap: 28px; }

/* ---- Hero ---- */
.hero {
  display: grid; grid-template-columns: 1.15fr 1fr; align-items: center; gap: 32px;
  padding: 56px 0 8px;
}
.hero-copy { display: flex; flex-direction: column; gap: 14px; }
.hero h1 { font-size: 34px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.18; }
.sub { color: var(--text-secondary); font-size: 15px; line-height: 1.6; }
.hero-art { display: flex; justify-content: center; position: relative; }
/* Статичное цветное «облако» за принтером — чтобы страница выглядела разноцветной уже в состоянии
   покоя, не дожидаясь, пока посетитель выберет материал и запустит динамический акцент ниже. Цвета
   буквально те же, что в списке материалов (PLA/PETG/ABS/TPU/нейлон) — это не декор ради декора,
   а визуальный намёк на «печатаем любым материалом/цветом». */
.hero-art::before {
  content: ""; position: absolute; inset: -10% -6%; z-index: -1; border-radius: 40%;
  filter: blur(38px); opacity: 0.45;
  background:
    radial-gradient(circle at 22% 24%, var(--mat-pla) 0%, transparent 55%),
    radial-gradient(circle at 80% 18%, var(--mat-petg) 0%, transparent 55%),
    radial-gradient(circle at 78% 82%, var(--mat-abs) 0%, transparent 55%),
    radial-gradient(circle at 18% 80%, var(--mat-tpu) 0%, transparent 55%);
}
.printer-svg { width: 100%; max-width: 320px; height: auto; overflow: visible; position: relative; }

.pr-frame { fill: var(--surface); stroke: var(--border); stroke-width: 2; }
.pr-rail { stroke: var(--text-tertiary); stroke-width: 3; stroke-linecap: round; opacity: 0.5; }
.pr-bed { fill: var(--text); opacity: 0.85; }
.pr-spool { fill: none; stroke: var(--accent); stroke-width: 3; transition: stroke 0.2s; }
.pr-spool-hub { fill: var(--accent); transition: fill 0.2s; }
.pr-filament { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 2 3; opacity: 0.6; transition: stroke 0.2s; }
.pr-head-body { fill: var(--accent); transition: fill 0.2s; }
.pr-head-nozzle { fill: var(--text); }
.pr-glow { fill: var(--accent); opacity: 0.55; transition: fill 0.2s; }
.pr-layer { fill: var(--accent-tint); stroke: var(--accent); stroke-width: 1.5; transition: fill 0.2s, stroke 0.2s; }

.pr-head { animation: prHeadMove 2.6s ease-in-out infinite; transform-box: fill-box; }
@keyframes prHeadMove {
  0%, 100% { transform: translateX(95px); }
  50% { transform: translateX(195px); }
}
.pr-layer { animation: prLayerGrow 5.2s ease-in-out infinite; }
@keyframes prLayerGrow {
  0%   { height: 1px; y: 190px; opacity: 0.9; }
  45%  { height: 64px; y: 126px; opacity: 1; }
  60%  { height: 64px; y: 126px; opacity: 1; }
  100% { height: 1px; y: 190px; opacity: 0.9; }
}
.pr-glow { animation: prGlowPulse 1.3s ease-in-out infinite; }
@keyframes prGlowPulse { 0%, 100% { opacity: 0.25; } 50% { opacity: 0.75; } }

@media (prefers-reduced-motion: reduce) {
  .pr-head, .pr-layer, .pr-glow { animation: none; }
}

@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; padding-top: 32px; text-align: center; }
  .hero-copy { align-items: center; }
  .hero h1 { font-size: 27px; }
  .hero-art { order: -1; max-width: 220px; margin: 0 auto; }
}

/* ---- Steps ---- */
.steps { display: flex; gap: 8px; }
.step {
  flex: 1; display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600;
  color: var(--text-tertiary); padding: 10px 4px; border-bottom: 2px solid var(--border);
  transition: border-color 0.2s, color 0.2s;
}
.step-num {
  width: 20px; height: 20px; border-radius: 50%; background: var(--surface-sunken); color: var(--text-tertiary);
  font-size: 11px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: background 0.2s;
}
.step.active { color: var(--text); border-bottom-color: var(--accent); }
.step.active .step-num { background: var(--accent); color: #fff; }
.step.done { color: var(--text-secondary); border-bottom-color: var(--success); }
.step.done .step-num { background: var(--success); color: #fff; }
@media (max-width: 480px) { .step span:last-child { display: none; } .step { justify-content: center; } }

/* ---- Cards ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 28px; display: flex; flex-direction: column; gap: 18px; box-shadow: var(--shadow-card); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }
.field-row .field-narrow { flex: 0 0 110px; }
label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-tertiary); }

input[type="text"], select, textarea {
  font-family: var(--font-sans); font-size: 14px; padding: 11px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%239A9DA3' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
select { padding-right: 32px; cursor: pointer; }
#material-select { border-left: 4px solid var(--accent); transition: border-color 0.2s; }
textarea { resize: vertical; min-height: 64px; background-image: none; }
input[type="text"]:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.hint { font-size: 12px; color: var(--text-tertiary); }

/* file drop zone */
.file-drop {
  position: relative; display: flex; align-items: center; gap: 14px; padding: 20px;
  border: 1.5px dashed var(--border); border-radius: var(--radius-md); background: var(--surface-sunken);
  color: var(--text-tertiary); transition: border-color 0.15s, background 0.15s;
}
.file-drop:hover, .file-drop.drag-over { border-color: var(--accent); background: var(--accent-tint); }
.file-drop.has-file { border-style: solid; border-color: var(--success); background: var(--success-tint); }
.file-drop-icon { flex-shrink: 0; color: var(--accent); }
.file-drop.has-file .file-drop-icon { color: var(--success); }
.file-drop-title { font-size: 14px; font-weight: 600; color: var(--text); }
.file-drop-sub { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }
.file-drop input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

.btn {
  font-family: var(--font-sans); font-size: 15px; font-weight: 600; padding: 13px 20px; border-radius: var(--radius-sm);
  border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-primary { background: var(--accent); color: #fff; transition: background 0.2s, transform 0.1s; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:active:not(:disabled) { transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn.is-loading .btn-spinner { display: inline-block; }
.btn-spinner {
  display: none; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.note { font-size: 13px; color: var(--text); background: var(--accent-tint); border-radius: var(--radius-sm); padding: 10px 12px; }
.error { background: var(--danger-tint); color: var(--danger); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; }

.result { border-top: 1px solid var(--border); padding-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.result-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-tertiary); }
.result-price { font-family: var(--font-mono); font-size: 38px; font-weight: 600; line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; transition: color 0.2s; }
.result-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.result-chip { font-size: 13px; color: var(--text-secondary); background: var(--surface-sunken); padding: 5px 10px; border-radius: 999px; }
.result-chip strong { color: var(--text); font-weight: 600; }
.result-disclaimer { font-size: 12px; color: var(--text-tertiary); line-height: 1.5; }

.thanks { align-items: center; text-align: center; gap: 12px; }
.thanks-icon { width: 52px; height: 52px; border-radius: 50%; background: var(--success-tint); display: flex; align-items: center; justify-content: center; }
.thanks h2 { font-size: 19px; }

.foot { text-align: center; color: var(--text-tertiary); font-size: 12px; padding-top: 12px; }

@media (max-width: 480px) {
  .card { padding: 20px; border-radius: var(--radius-md); }
  .field-row { flex-direction: column; }
  .field-row .field-narrow { flex: 1; }
}
