:root {
    --bg-color: #f4f5f7;
    --card-bg: #ffffff;
    --primary: #4cafef;
    --primary-hover: #3a9be0;
    --text-color: #333;
    --radius: 12px;
    --shadow: 0 4px 20px rgba(0,0,0,0.1);
}

/* Базовые настройки */
html {
    font-size: 100%; /* 1rem = 16px */
    max-width: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    background: var(--bg-color);
    margin: 0;
    color: var(--text-color);
    max-width: 100%;
}

/* Верхняя панель */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    padding: 0.625rem 0;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    text-decoration: none;
}

.logo img {
    height: 3.125rem; /* 50px */
    width: auto;
    border-radius: 0.5rem;
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.logo-text .site-name {
    font-size: 1.25rem; /* 20px */
    font-weight: bold;
    color: var(--text-color);
}

.logo-text .tagline {
    font-size: 0.875rem; /* 14px */
    color: var(--text-color);
    opacity: 0.8;
}

/* Меню */
.menu > ul {
    list-style: none;
    display: flex;
    gap: 1.25rem; /* 20px */
    margin: 0;
    padding: 0;
}

.menu a {
    text-decoration: none;
    color: var(--text-color);
    transition: color 0.3s;
}

.menu a:hover {
    color: var(--primary);
}

/* Подменю */
.has-submenu {
    position: relative;
}

.submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--card-bg);
    box-shadow: var(--shadow);
    border-radius: var(--radius);
    list-style: none;
    margin: 0;
    padding: 0.625rem;
    min-width: 11.25rem; /* 180px */
    z-index: 1000;
}

.submenu li {
    padding: 0.3125rem 0; /* 5px */
}

.submenu a {
    display: block;
    color: var(--text-color);
    padding: 0.3125rem 0.625rem;
    border-radius: var(--radius);
}

.submenu a:hover {
    background: var(--primary);
    color: #fff;
}

/* Десктоп: показываем подменю при наведении */
@media (min-width: 1024px) {
    .has-submenu:hover .submenu {
        display: block;
    }
}

/* Бургер-меню */
.burger {
    display: none;
    font-size: 1.625rem
	    /* 26px */
    cursor: pointer;
    color: var(--text-color);
}

/* ===== Мобильная версия (≤767px) ===== */
@media (max-width: 767px) {
    .menu {
        display: none;
        position: absolute;
        top: 5.625rem; /* 90px */
        right: 0;
        background: var(--card-bg);
        border-radius: var(--radius);
        box-shadow: var(--shadow);
        padding: 1rem;
        z-index: 1000;
        width: 100%;
        font-size: 1.25rem; /* 20px */
    }

    .menu ul {
        flex-direction: column;
        margin: 0;
        padding: 0;
        list-style: none;
        gap: 0;
    }

    .menu ul li {
        background: var(--card-bg);
        padding: 0.75rem 0.75rem;
        border-bottom: 1px solid rgba(0,0,0,0.05);
    }

    .menu ul li a {
        color: var(--text-color);
        text-decoration: none;
        display: block;
    }

    /* Подменю в потоке */
    .submenu {
        display: block;
        position: static;
        background: #f0f0f0;
        padding: 0.3125rem 0;
        margin: 0;
        box-shadow: none;
    }

    .submenu li {
        padding: 0.5rem 1.5rem;
        border-bottom: 1px solid rgba(0,0,0,0.05);
    }

    .submenu li:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }

    .submenu a {
        color: var(--text-color);
        text-decoration: none;
        font-size: 1rem; 
    }

    .submenu a:hover {
        background: rgba(0,0,0,0.05);
        border-radius: var(--radius);
    }

    .burger {
        display: block;
        font-size: 2.5rem; /* 40px */
        cursor: pointer;
        color: var(--text-color);
    }

    .logo img {
        height: 3.75rem; /* 60px */
    }

    .logo-text .site-name {
        font-size: 1.5rem; /* 24px */
    }

    .logo-text .tagline {
        font-size: 1.125rem; /* 18px */
    }
}

/* ===== Планшеты (768px – 1023px) ===== */
@media (min-width: 768px) and (max-width: 1023px) {
    .menu {
        font-size: 1.125rem; /* 18px */
    }
    .logo img {
        height: 3.125rem; /* 50px */
    }
    .logo-text .site-name {
        font-size: 1.375rem; /* 22px */
    }
    .logo-text .tagline {
        font-size: 1rem; /* 16px */
    }
}

/* ===== Контейнер ===== */
.container {
    margin: auto;
    background: var(--card-bg);
    animation: fadeIn 0.4s ease-in-out;
}

@media (min-width: 1023px) {
.container {
	width: 100%;
    max-width: 62.5rem; /* 1000px */
	margin: auto;
    padding: 2.5rem; /* 40px */
	border-radius: var(--radius);
    animation: fadeIn 0.4s ease-in-out;
}
}

/* ===== Заголовки ===== */
h1 {
    text-align: center;
    font-size: 2.5rem; 
    margin-bottom: 1.3rem;
}
h2 {
    font-size: 2rem; 
    margin-bottom: 1rem; 
}
h3 {
    font-size: 1.5rem; 
    margin-bottom: 0.7rem;
}

/* ===== Кастомный инпут загрузки ===== */
input[type="file"] {
    display: none;
}
.upload-label {
    display: block;
    height: 10rem; /* 350px */
    border: 2px dashed #ccc;
    border-radius: var(--radius);
    background: #fafafa;
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--text-color);
    text-align: center;
    line-height: 10rem; /* по центру текста */
    transition: border-color 0.3s, background 0.3s;
    margin-bottom: 2rem; 
}
.upload-label:hover {
    border-color: var(--primary);
    background: #f0f9ff;
}

/* ===== Блок выбора формата ===== */
.format-block {
    display: flex;
    flex-direction: column;
    gap: 0.5rem; /* 8px */
    margin-bottom: 2rem; 
}
.format-block label {
    font-weight: bold;
    font-size: 1.5rem; /* 40px */
}
.format-block select {
    padding: 1.2rem; 
    font-size: 1.5rem; 
    border-radius: var(--radius);
    border: 1px solid #ddd;
    background: #f9f9f9;
    transition: border-color 0.3s ease;
}
.format-block select:focus {
    border-color: var(--primary);
    outline: none;
}

/* ===== Кнопки ===== */
button {
    background: var(--primary);
    color: white;
    font-weight: bold;
    padding: 1.2rem;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    font-size: 2rem; 
    transition: background 0.3s ease, transform 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}
button:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

/* ===== Превью изображений ===== */
.preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr)); 
    gap: 0.625rem; 
    margin-bottom: 2rem; 
}
.preview div {
    background: #fff;
    border-radius: 0.75rem; /* 12px */
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 0.5rem;
    text-align: center;
    position: relative;
}
.preview img {
    width: 100%;
    height: 7rem;
    object-fit: cover;
    border-radius: 0.5rem;
    margin-bottom: 0.3125rem; /* 5px */
}
.preview p {
    font-size: 0.85em;
    word-break: break-word;
    margin: 0.3125rem 0;
}
.remove-btn {
    background: #ff4c4c;
    color: white;
    border: none;
    padding: 0.3rem 0.75rem;
    border-radius: 0.375rem; /* 6px */
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
}
.remove-btn:hover {
    background: #e04343;
}

/* ===== Прогресс-бар ===== */
.progress-container {
    width: 100%;
    background: #eee;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-top: 1.25rem; /* 20px */
}
.progress-bar {
    width: 0%;
    height: 1.25rem; /* 20px */
    background: var(--primary);
    transition: width 10s ease;
}

/* ===== Кнопка загрузки ZIP ===== */
.download-zip {
    display: block;
    text-align: center;
    margin-bottom: 2rem; 
}
.download-zip a {
    background: linear-gradient(to right, #4cafef, #3a9be0);
    color: white;
    padding: 1.2rem; 
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: bold;
    font-size: 2rem; 
    width: 100%;
    box-sizing: border-box;
    display: inline-block;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.download-zip a:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

/* ===== Карточки изображений ===== */
.result-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr)); /* 250px */
    gap: 0.625rem; /* 10px */
    margin-bottom: 2rem; /* 80px */
}
.result-preview div {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0.5rem;
    text-align: center;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.3s ease;
}
.result-preview img {
    width: 100%;
    height: 7rem; /* 250px */
    object-fit: cover;
    border-radius: 0.5rem;
    margin-bottom: 0.3125rem;
}
.result-preview a {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.3rem 0.75rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 1rem; 
    text-decoration: none;
    transition: background 0.3s;
    display: inline-block;
}
.result-preview a:hover {
    background: var(--primary-hover);
}

/* ===== Блок предупреждений ===== */
.warning {
    background: #fff3cd;
    border-left: 5px solid orange;
    padding: 0.9375rem; /* 15px */
    margin-top: 1.25rem; /* 20px */
    margin-bottom: 1.25rem;
    border-radius: var(--radius);
    font-size: 1em;
}
.warning b {
    color: #856404;
}
.warning ul {
    margin: 0.625rem 0 0 1.25rem; /* 10px 20px */
    padding: 0;
}

/* ===== Кнопка Назад ===== */
.back a {
    background: #ddd;
    color: var(--text-color);
    padding: 1.2rem; 
    border-radius: var(--radius);
    text-decoration: none;
    font-size: 2rem; 
    width: 100%;
    box-sizing: border-box;
    display: inline-block;
    text-align: center;
    transition: background 0.3s ease, transform 0.2s ease;
}
.back a:hover {
    background: #ccc;
    transform: translateY(-2px);
}

/* ===== Планшеты ===== */
@media (min-width: 768px) and (max-width: 1023px) {
    html { font-size: 90%; }
    .logo img { height: 3rem; }
    .logo-text .site-name { font-size: 1.25rem; }
    .logo-text .tagline { font-size: 1rem; }
    .menu { font-size: 1rem; }
    h1 { font-size: 2.5rem; }
    h2 { font-size: 2rem; }
    h3 { font-size: 1.75rem; }
}

/* ===== Смартфоны ===== */
@media (max-width: 767px) {
    html { font-size: 80%; }
    .container { padding: 1.3rem; }
    .logo img { height: 2.5rem; }
    .logo-text .site-name { font-size: 1rem; }
    .logo-text .tagline { font-size: 0.875rem; }
    .menu { width: 55%; font-size: 1.2rem; }
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    .upload-label { font-size: 1rem; height: auto; line-height: normal; padding: 4rem;
    text-align: center;
    margin-bottom: 1.5rem;
}
.format-block label {
    font-size: 1rem;
}
.format-block select {
    font-size: 1rem;
    padding: 1rem;
}
button {
    font-size: 1rem;
    padding: 1rem;
}
.preview {
    grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
    gap: 0.5rem;
}
.preview img {
    height: 6rem;
}
.remove-btn {
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
}
.download-zip a {
    font-size: 1rem;
    padding: 1rem;
}
.result-preview {
    grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
}
.result-preview img {
    height: 6rem;
}
.result-preview a {
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
}
.back a {
    font-size: 1rem;
    padding: 1rem;
}
.warning {
    font-size: 0.875rem;
}
}
