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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #efefef;
    color: #1a1a1a;
    font-size: 14px;
    line-height: 1.5;
}

.wrap {
    max-width: 660px;
    margin: 52px auto 60px;
    padding: 0 24px;
}

header {
    margin-bottom: 36px;
}

h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.4px;
}

.subtitle {
    margin-top: 4px;
    color: #888;
    font-size: 13px;
}

/* форма */

.field {
    margin-bottom: 18px;
}

label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #666;
    margin-bottom: 7px;
}

input[type="text"] {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d0d0d0;
    border-radius: 5px;
    font-size: 13px;
    font-family: 'Menlo', 'Consolas', monospace;
    background: #fff;
    color: #1a1a1a;
    transition: border-color 0.15s;
}

input[type="text"]:focus {
    outline: none;
    border-color: #5b8dee;
}

input[type="file"] {
    font-size: 13px;
    color: #444;
}

button {
    margin-top: 6px;
    padding: 9px 24px;
    background: #2c2c2c;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

button:hover {
    background: #111;
}

button:disabled {
    background: #aaa;
    cursor: not-allowed;
}

.mode-toggle {
    display: flex;
    gap: 18px;
}

.mode-option {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: #333;
    margin-bottom: 0;
    cursor: pointer;
}

.input-note {
    margin-top: 6px;
    font-size: 12px;
    color: #888;
}

.save-dir-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.save-dir-row .input-note {
    margin-top: 0;
}

.secondary-btn {
    margin-top: 0;
    padding: 7px 16px;
    background: #fff;
    color: #333;
    border: 1px solid #c8c8c8;
}

.secondary-btn:hover {
    background: #f2f2f2;
}

.secondary-btn:disabled {
    background: #f2f2f2;
    color: #999;
    border-color: #ddd;
}

.form-error {
    margin-top: 10px;
    font-size: 13px;
    color: #c0392b;
}

/* прогресс и результат */

#progress-block,
#result-block {
    margin-top: 36px;
    border-top: 1px solid #ddd;
    padding-top: 22px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #444;
    margin-bottom: 14px;
}

.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid #ccc;
    border-top-color: #555;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#log-output {
    background: #1e1e1e;
    color: #c8c8c8;
    font-family: 'Menlo', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.7;
    padding: 14px 16px;
    border-radius: 5px;
    min-height: 72px;
    max-height: 260px;
    overflow-y: auto;
    white-space: pre-wrap;
}

/* список модулей */

#module-list {
    margin-bottom: 14px;
}

.module-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 12px;
    background: #fff;
    border: 1px solid #e2e2e2;
    border-radius: 5px;
    margin-bottom: 5px;
}

.module-status {
    font-size: 12px;
    color: #888;
    white-space: nowrap;
}

.module-row.status-running {
    border-color: #b5cfff;
    background: #f4f8ff;
}

.module-row.status-done .module-status {
    color: #2e8b57;
}

.module-row.status-error {
    border-color: #f0c3bd;
    background: #fdf6f5;
}

.module-row.status-error .module-status {
    color: #c0392b;
}

/* файлы по модулям в результатах */

.module-files {
    margin-bottom: 18px;
}

.module-files-title {
    font-size: 13px;
    font-weight: 600;
    color: #444;
    margin-bottom: 8px;
}

.module-files-title.error {
    color: #c0392b;
}

/* список файлов */

.file-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 12px;
    background: #fff;
    border: 1px solid #e2e2e2;
    border-radius: 5px;
    margin-bottom: 6px;
}

.file-row.primary {
    border-color: #b5cfff;
    background: #f4f8ff;
}

.file-name {
    font-family: 'Menlo', 'Consolas', monospace;
    font-size: 12px;
    color: #333;
}

.file-row a {
    font-size: 12px;
    color: #3a7bd5;
    text-decoration: none;
    white-space: nowrap;
}

.file-row a:hover {
    text-decoration: underline;
}

.zip-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.zip-btn {
    display: inline-block;
    padding: 8px 16px;
    background: #2c2c2c;
    color: #fff;
    border-radius: 5px;
    font-size: 12px;
    text-decoration: none;
    transition: background 0.15s;
}

.zip-btn:hover {
    background: #111;
    text-decoration: none;
}

.blocks-toggle {
    margin-top: 8px;
    font-size: 12px;
    color: #888;
    cursor: pointer;
    user-select: none;
}

.blocks-toggle:hover {
    color: #444;
}

#blocks-list {
    margin-top: 6px;
}

.hint {
    margin-top: 14px;
    font-size: 12px;
    color: #aaa;
}

.hidden {
    display: none;
}
