:root {
    --bg: #eef1f6;
    --bg-dots: rgba(15, 23, 42, 0.06);
    --surface: #ffffff;
    --surface-2: #f4f6fa;
    --text: #0f172a;
    --muted: #5b6b83;
    --line: #d9e0ea;
    --accent: #e8590c;
    --accent-strong: #c2410c;
    --accent-soft: rgba(232, 89, 12, 0.12);
    --accent-2: #0e7490;
    --ok: #15803d;
    --danger: #dc2626;
    --shadow: 0 12px 32px -16px rgba(15, 23, 42, 0.25);
    --canvas-bg: #ffffff;
}

.dark {
    --bg: #0c1017;
    --bg-dots: rgba(255, 255, 255, 0.045);
    --surface: #151b26;
    --surface-2: #1c2432;
    --text: #e7edf5;
    --muted: #8b99ad;
    --line: #2a3547;
    --accent: #ff7a2f;
    --accent-strong: #ff8f52;
    --accent-soft: rgba(255, 122, 47, 0.14);
    --accent-2: #22d3ee;
    --ok: #4ade80;
    --danger: #f87171;
    --shadow: 0 16px 40px -18px rgba(0, 0, 0, 0.7);
    --canvas-bg: #10161f;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Manrope', system-ui, sans-serif;
    color: var(--text);
    background:
        radial-gradient(1000px 420px at 85% -10%, var(--accent-soft), transparent 60%),
        radial-gradient(var(--bg-dots) 1px, transparent 1px) 0 0 / 22px 22px,
        var(--bg);
    background-attachment: fixed;
    transition: background-color .3s, color .3s;
}

.font-display { font-family: 'Unbounded', 'Manrope', sans-serif; }

/* ---------- навигация ---------- */
.nav-bar {
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}

.logo {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: .02em;
    color: var(--text);
}
.logo span { color: var(--accent); }

.nav-link {
    color: var(--muted);
    font-weight: 600;
    font-size: .92rem;
    padding-bottom: 2px;
    border-bottom: 2px solid transparent;
    transition: color .18s, border-color .18s;
}
.nav-link:hover { color: var(--text); border-color: var(--accent); }

.theme-btn {
    width: 36px; height: 36px;
    display: grid; place-items: center;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--surface);
    font-size: 1rem;
    transition: transform .2s, border-color .2s;
}
.theme-btn:hover { transform: rotate(20deg) scale(1.08); border-color: var(--accent); }

/* ---------- базовые компоненты ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
}

.card-hover { transition: transform .2s, box-shadow .2s, border-color .2s; }
.card-hover:hover {
    transform: translateY(-4px);
    border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
    box-shadow: 0 20px 44px -18px rgba(0, 0, 0, 0.35);
}

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    font-weight: 700; font-size: .92rem;
    padding: .6rem 1.15rem;
    border-radius: 10px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform .15s, background .18s, box-shadow .18s, border-color .18s;
}
.btn:active { transform: scale(.97); }

.btn-accent {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 8px 20px -8px var(--accent);
}
.btn-accent:hover { background: var(--accent-strong); }

.btn-ghost {
    background: var(--surface);
    color: var(--text);
    border-color: var(--line);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn-danger { background: transparent; color: var(--danger); border-color: transparent; }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); }

.muted { color: var(--muted); }
.text-accent { color: var(--accent); }

.field {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: .55rem .8rem;
    font-size: .92rem;
    color: var(--text);
    transition: border-color .18s, box-shadow .18s;
}
.field:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.field::placeholder { color: var(--muted); opacity: .7; }

select.field option { background: var(--surface); color: var(--text); }

.chip {
    display: inline-flex; align-items: center;
    font-size: .72rem; font-weight: 700;
    letter-spacing: .04em; text-transform: uppercase;
    padding: .22rem .6rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: var(--muted);
    background: var(--surface-2);
}

.h-display {
    font-family: 'Unbounded', sans-serif;
    font-weight: 800;
    letter-spacing: -.01em;
    line-height: 1.15;
}

/* анимации появления */
@keyframes rise {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
}
.rise { animation: rise .45s cubic-bezier(.2, .7, .3, 1) both; }
.rise-1 { animation-delay: .06s; }
.rise-2 { animation-delay: .12s; }
.rise-3 { animation-delay: .18s; }

/* ---------- конструктор ---------- */
#app { min-height: 60vh; }

.constructor-canvas {
    position: relative;
    border: 2px dashed var(--line);
    border-radius: 12px;
    overflow: hidden;
    background: var(--canvas-bg);
    transition: border-color .2s;
}
.constructor-canvas:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }

.constructor-canvas img.mockup {
    width: 100%;
    display: block;
    pointer-events: none;
    user-select: none;
}

.constructor-canvas .layer-box {
    position: absolute;
    cursor: move;
    border: 2px solid transparent;
    transition: border-color .12s;
    touch-action: none;
}
.constructor-canvas .layer-box img {
    width: 100%; height: 100%;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
}
.constructor-canvas .layer-box.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.resize-handle {
    position: absolute;
    width: 14px; height: 14px;
    background: var(--accent);
    border: 2px solid #fff;
    border-radius: 50%;
    bottom: -7px; right: -7px;
    cursor: nwse-resize;
    box-shadow: 0 2px 6px rgba(0,0,0,.35);
    touch-action: none;
}

.layer-list-item {
    display: flex; align-items: center; gap: .6rem;
    padding: .45rem .6rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-2);
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.layer-list-item:hover { border-color: var(--accent); }
.layer-list-item.active {
    border-color: var(--accent);
    background: var(--accent-soft);
}
.layer-list-item img { width: 34px; height: 34px; object-fit: contain; border-radius: 6px; }

/* слайдеры */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 999px;
    background: var(--line);
    outline: none;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--accent);
    border: 3px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,.3);
    cursor: pointer;
    transition: transform .15s;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); }
input[type="range"]::-moz-range-thumb {
    width: 16px; height: 16px;
    border-radius: 50%;
    background: var(--accent);
    border: 3px solid #fff;
    cursor: pointer;
}

/* dropzone */
.dropzone {
    border: 2px dashed var(--line);
    border-radius: 12px;
    padding: 1.1rem;
    text-align: center;
    color: var(--muted);
    font-size: .88rem;
    cursor: pointer;
    transition: border-color .2s, background .2s, color .2s;
}
.dropzone:hover, .dropzone.drag-over {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
}

/* статус-трекер */
.step-dot {
    width: 2.1rem; height: 2.1rem;
    display: grid; place-items: center;
    border-radius: 50%;
    font-weight: 800; font-size: .85rem;
    border: 2px solid var(--line);
    color: var(--muted);
    background: var(--surface);
    transition: all .3s;
}
.step-dot.done { background: var(--accent); border-color: var(--accent); color: #fff; }
.step-line { flex: 1; height: 2px; background: var(--line); }
.step-line.done { background: var(--accent); }

/* таблицы */
.table-base { width: 100%; font-size: .88rem; }
.table-base th {
    text-align: left;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    padding: .6rem .8rem;
    border-bottom: 1px solid var(--line);
}
.table-base td {
    padding: .7rem .8rem;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
.table-base tr:last-child td { border-bottom: none; }
.table-base tbody tr { transition: background .15s; }
.table-base tbody tr:hover { background: var(--surface-2); }

/* ---------- мобильная адаптация ---------- */
.nav-scroll { scrollbar-width: none; -ms-overflow-style: none; }
.nav-scroll::-webkit-scrollbar { display: none; }

.mobile-nav-link {
    display: block;
    padding: .55rem .2rem;
    color: var(--muted);
    font-weight: 600;
    font-size: .95rem;
    border-bottom: 1px solid var(--line);
    transition: color .15s;
}
.mobile-nav-link:last-child { border-bottom: none; }
.mobile-nav-link:hover { color: var(--accent); }

#burger-btn.open { transform: rotate(90deg); }

@media (max-width: 640px) {
    .logo { font-size: 1.15rem; }
    .nav-link { font-size: .85rem; white-space: nowrap; }
    .field { font-size: 1rem; } /* 16px — iOS не зумит при фокусе */
    .btn { padding: .68rem 1rem; }
    .resize-handle { width: 26px; height: 26px; bottom: -13px; right: -13px; }
    input[type="range"]::-webkit-slider-thumb { width: 24px; height: 24px; }
    input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; }
}
