*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { overflow-x: hidden; }
body { overflow-x: hidden; width: 100%; max-width: 100%; }

:root {
    --primary: #3B82F6;
    --primary-dark: #2563EB;
    --accent: #8B5CF6;
    --gradient: linear-gradient(135deg, #3B82F6 0%, #8B5CF6 100%);
    --success: #10B981;
    --danger: #EF4444;
    --text: #111827;
    --text-muted: #6B7280;
    --text-light: #9CA3AF;
    --border: #E5E7EB;
    --bg: #F3F4F6;
    --white: #FFFFFF;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.08);
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

img, input, textarea, select { max-width: 100%; }

/* ── HEADER ── */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255,255,255,0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}
.header-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
}
.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--gradient);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.logo-text { font-size: 1.05rem; font-weight: 700; }
.logo-domain { color: var(--primary); }

.lang-switcher {
    display: flex;
    background: var(--bg);
    border-radius: 100px;
    padding: 3px;
    gap: 2px;
}
.lang-btn {
    padding: 5px 14px;
    border: none;
    background: transparent;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-muted);
    font-family: inherit;
}
.lang-btn.active {
    background: var(--white);
    color: var(--primary);
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}

/* ── HERO ── */
.hero {
    background: linear-gradient(135deg, #EFF6FF 0%, #F5F3FF 100%);
    padding: 52px 24px 36px;
    text-align: center;
}
.hero h1 {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 800;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    line-height: 1.2;
}
.hero p {
    font-size: 1.05rem;
    color: var(--text-muted);
    max-width: 480px;
    margin: 0 auto;
}

/* ── GENERATOR ── */
.generator-section { padding: 36px 24px 56px; }
.generator-grid {
    max-width: 1120px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 24px;
    align-items: start;
}

/* карточки обязаны уметь сжиматься */
.generator-grid > * { min-width: 0; }

@media (max-width: 820px) {
    .generator-grid { grid-template-columns: 1fr; }
    .generator-section { padding: 20px 16px 40px; }
    .preview-card { position: static; }
    .features-section { padding: 4px 16px 40px; }
    .header-inner { padding: 0 16px; }
    .hero { padding: 36px 16px 28px; }
    .custom-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .generator-section { padding: 16px 12px 32px; }
    .card { padding: 18px 14px; }
    .type-tabs { gap: 4px; }
    .type-tab { padding: 5px 10px; font-size: 0.78rem; }
    .custom-grid { grid-template-columns: 1fr; }
    .qr-display { max-height: 260px; }
    .toast { left: 12px; right: 12px; bottom: 12px; }
}

/* ── CARD ── */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
}

/* ── TYPE TABS ── */
.type-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 24px; }
.type-tab {
    padding: 6px 16px;
    border: 1.5px solid var(--border);
    background: transparent;
    border-radius: 100px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s;
    color: var(--text-muted);
    font-family: inherit;
}
.type-tab:hover { border-color: var(--primary); color: var(--primary); }
.type-tab.active {
    background: var(--gradient);
    border-color: transparent;
    color: #fff;
}

/* ── FORMS ── */
.type-form { display: none; }
.type-form.visible { display: block; }

.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.85rem; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.form-input, .form-textarea, .form-select {
    width: 100%;
    padding: 10px 13px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text);
    background: var(--white);
    transition: border-color 0.18s, box-shadow 0.18s;
    outline: none;
    appearance: none;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
.form-textarea { resize: vertical; min-height: 96px; }
.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--text);
    cursor: pointer;
}
.checkbox-label input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }

/* ── CUSTOMIZATION ── */
.customization { border-top: 1px solid var(--border); padding-top: 20px; margin-top: 4px; margin-bottom: 20px; }
.custom-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-light);
    margin-bottom: 16px;
}
.custom-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.custom-grid > * { min-width: 0; }
.custom-item { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.custom-item > label { font-size: 0.8rem; font-weight: 500; color: var(--text-muted); }
.span-2 { grid-column: 1 / -1; }

.slider-row { display: flex; align-items: center; gap: 10px; }
.slider {
    flex: 1;
    -webkit-appearance: none;
    height: 4px;
    border-radius: 2px;
    background: var(--border);
    outline: none;
    cursor: pointer;
}
.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(59,130,246,0.4);
    transition: transform 0.15s;
}
.slider::-webkit-slider-thumb:hover { transform: scale(1.15); }
.slider-value { font-size: 0.8rem; font-weight: 600; color: var(--primary); min-width: 46px; text-align: right; }

.color-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.color-picker {
    width: 36px; height: 32px;
    flex-shrink: 0;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 2px; cursor: pointer; background: none;
}
.color-hex {
    flex: 1; min-width: 0; padding: 7px 10px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 0.8rem; font-family: monospace;
    color: var(--text); outline: none;
    transition: border-color 0.18s;
    width: 0;
}
.color-hex:focus { border-color: var(--primary); }

.ec-buttons { display: flex; gap: 5px; }
.ec-btn {
    flex: 1; padding: 6px 4px;
    border: 1.5px solid var(--border);
    background: transparent;
    border-radius: var(--radius-xs);
    font-size: 0.8rem; font-weight: 600;
    cursor: pointer;
    transition: all 0.18s;
    color: var(--text-muted);
    font-family: inherit;
}
.ec-btn:hover { border-color: var(--primary); color: var(--primary); }
.ec-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ── GENERATE BUTTON ── */
.btn-generate {
    width: 100%;
    padding: 13px 24px;
    background: var(--gradient);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem; font-weight: 600;
    cursor: pointer;
    transition: opacity 0.18s, transform 0.12s;
    font-family: inherit;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-generate:hover { opacity: 0.9; }
.btn-generate:active { transform: scale(0.99); }
.btn-generate:disabled { opacity: 0.6; cursor: wait; }

/* ── PREVIEW ── */
.preview-card { position: sticky; top: 84px; }
.qr-display {
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    border: 1.5px dashed var(--border);
    background: #FAFAFA;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 16px;
    transition: border-color 0.3s;
}
.qr-display.has-code { border-style: solid; border-color: #E5E7EB; background: #fff; }
.qr-placeholder { text-align: center; padding: 24px; }
.qr-placeholder svg { opacity: 0.18; margin-bottom: 14px; }
.qr-placeholder p { font-size: 0.9rem; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; }
.qr-placeholder span { font-size: 0.78rem; color: var(--text-light); display: block; line-height: 1.5; }
#qr-img { display: none; max-width: 100%; border-radius: 6px; }

.qr-actions { display: none; gap: 10px; margin-bottom: 10px; }
.btn-action {
    flex: 1; padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem; font-weight: 600;
    cursor: pointer;
    transition: all 0.18s;
    font-family: inherit;
    display: flex; align-items: center; justify-content: center; gap: 7px;
}
.btn-download { background: #EFF6FF; color: var(--primary); border: 1.5px solid transparent; }
.btn-download:hover { background: #DBEAFE; }
.btn-copy { background: transparent; border: 1.5px solid var(--border); color: var(--text-muted); }
.btn-copy:hover { border-color: var(--primary); color: var(--primary); }
.btn-svg { width: 100%; background: transparent; border: 1.5px solid var(--border); color: var(--text-muted); display: none; }
.btn-svg:hover { border-color: var(--accent); color: var(--accent); }

/* ── FEATURES ── */
.features-section { padding: 4px 24px 56px; }
.features-grid {
    max-width: 1120px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}
@media (max-width: 640px) { .features-grid { grid-template-columns: 1fr; } }
.feature-card { padding: 24px; background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); }
.feature-icon {
    width: 46px; height: 46px;
    background: linear-gradient(135deg, #EFF6FF, #F5F3FF);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 14px;
}
.feature-title { font-size: 0.95rem; font-weight: 700; margin-bottom: 6px; }
.feature-text { font-size: 0.85rem; color: var(--text-muted); line-height: 1.6; }

/* ── FOOTER ── */
.powered-by { text-align: center; padding: 20px; font-size: 0.85rem; color: #9CA3AF; }
.powered-by a { color: #3B82F6; text-decoration: none; }
.powered-by a:hover { text-decoration: underline; }

/* ── TOAST ── */
.toast {
    position: fixed; bottom: 24px; right: 24px;
    background: #111827; color: #fff;
    padding: 11px 18px; border-radius: var(--radius-sm);
    font-size: 0.875rem; font-weight: 500;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    transform: translateY(80px); opacity: 0;
    transition: all 0.28s cubic-bezier(0.34,1.56,0.64,1);
    z-index: 1000;
    display: flex; align-items: center; gap: 8px;
    pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { background: var(--danger); }
