/* --------------------------------------------------------------------------
   TRANSFER.NATHANT.SPACE — СТИЛИ ИНТЕРФЕЙСА
   -------------------------------------------------------------------------- */

:root {
    /* Цветовая палитра */
    --bg-base: #08080a;
    --bg-surface: #0e0e12;
    --bg-surface-hover: #14141a;
    --bg-card: #111116;
    --bg-input: #0a0a0d;

    /* Текст */
    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --text-dim: #52525b;

    /* Границы */
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(255, 255, 255, 0.2);
    --border-dashed: rgba(255, 255, 255, 0.14);

    /* Акценты */
    --accent-brand: #d4a373;
    --accent-brand-light: #e5c29f;
    --accent-emerald: #10b981;
    --accent-emerald-dim: rgba(16, 185, 129, 0.12);
    --accent-red: #ef4444;

    /* Типографика */
    --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;

    /* Радиусы */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-full: 9999px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* --------------------------------------------------------------------------
   СТРУКТУРА СТРАНИЦЫ
   -------------------------------------------------------------------------- */
.app-wrapper {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 24px;
    padding-top: max(24px, env(safe-area-inset-top));
    padding-bottom: max(24px, env(safe-area-inset-bottom));
    padding-left: max(24px, env(safe-area-inset-left));
    padding-right: max(24px, env(safe-area-inset-right));
    max-width: 1080px;
    margin: 0 auto;
}

/* --------------------------------------------------------------------------
   ШАПКА
   -------------------------------------------------------------------------- */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    transition: opacity 0.2s ease;
}

.brand:hover {
    opacity: 0.85;
}

.brand-title {
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}


/* --------------------------------------------------------------------------
   ОСНОВНОЙ КОНТЕНТ (РАБОЧАЯ СТАДИЯ И ЛЕЙАУТ)
   -------------------------------------------------------------------------- */
.main-stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
}

.stage-layout {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 0;
    width: 100%;
}

/* Фоновая плашка сервиса */
.transfer-card {
    flex: 0 0 540px;
    width: 540px;
    max-width: 540px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    position: relative;
    z-index: 2;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.transfer-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.55);
}

.view-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    animation: viewFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes viewFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-header {
    margin-bottom: 16px;
}

.card-body-centered {
    margin-top: auto;
    margin-bottom: auto;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.text-center {
    text-align: center;
}

.card-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* --------------------------------------------------------------------------
   ЗОНА ЗАГРУЗКИ (РАСТЯГИВАЕТСЯ ПО ВЫСОТЕ ВМЕСТЕ С ПАНЕЛЬЮ)
   -------------------------------------------------------------------------- */
.dropzone {
    border: 1px dashed var(--border-dashed);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    padding: 20px 18px;
    text-align: center;
    cursor: pointer;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100px;
    animation: dropzoneFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropzoneFadeIn {
    from {
        opacity: 0;
        transform: scale(0.985);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.dropzone:hover, .dropzone.is-dragover {
    border-color: rgba(255, 255, 255, 0.35);
    background: var(--bg-surface-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.dropzone-icon {
    width: 28px;
    height: 28px;
    margin: 0 auto 10px auto;
    color: var(--text-secondary);
    display: block;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.dropzone:hover .dropzone-icon {
    transform: translateY(-2px) scale(1.08);
    color: var(--text-primary);
}

.dropzone-title {
    font-size: 0.92rem;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.dropzone-link {
    color: var(--accent-brand);
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
    transition: color 0.15s ease;
}

.dropzone-link:hover {
    color: var(--text-primary);
}

.dropzone-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   ВЫБРАННЫЙ ФАЙЛ И СЛАЙДЕР СРОКА (РАСКРЫВАЮЩИЙСЯ БЛОК)
   -------------------------------------------------------------------------- */
.selected-file-wrapper {
    animation: expandDown 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes expandDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.selected-file-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    transition: all 0.2s ease;
}

.selected-file-box:hover {
    border-color: var(--border-focus);
    background: var(--bg-surface-hover);
}

.file-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    overflow: hidden;
}

.file-meta-icon {
    width: 22px;
    height: 22px;
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.selected-file-box:hover .file-meta-icon {
    transform: scale(1.08);
    color: var(--accent-brand);
}

.file-name-size {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.file-name {
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* Блок названия архива для нескольких файлов */
.archive-name-block {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    margin-bottom: 14px;
    transition: all 0.2s ease;
}

.archive-name-block:hover {
    border-color: var(--border-focus);
    background: var(--bg-surface-hover);
}

.archive-name-header {
    margin-bottom: 8px;
}

.archive-name-label {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.archive-input-group {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 2px 10px;
    transition: border-color 0.2s ease;
}

.archive-input-group:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.05);
}

.archive-name-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 500;
    padding: 6px 0;
}

.archive-ext-badge {
    color: var(--accent-brand);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 600;
    user-select: none;
    margin-left: 6px;
}

.archive-files-summary {
    font-size: 0.76rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-top: 8px;
}

/* Слайдер выбора срока */
.expire-slider-block {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    margin-bottom: 16px;
    transition: all 0.25s ease;
}

.expire-slider-block:hover {
    border-color: var(--border-focus);
    background: var(--bg-surface-hover);
}

.expire-slider-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.expire-label {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.expire-value-badge {
    font-size: 0.82rem;
    font-family: var(--font-mono);
    color: var(--accent-brand);
    background: rgba(212, 163, 115, 0.12);
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-weight: 500;
    transition: all 0.2s ease;
}

/* --------------------------------------------------------------------------
   КАСТОМНЫЙ ТАКТИЛЬНЫЙ СЛАЙДЕР СРОКА ХРАНЕНИЯ
   -------------------------------------------------------------------------- */
.custom-slider {
    position: relative;
    padding: 6px 0 2px 0;
    user-select: none;
    -webkit-user-select: none;
}

.slider-track-wrap {
    position: relative;
    margin: 0 20px;
    height: 24px;
    display: flex;
    align-items: center;
    cursor: pointer;
    touch-action: none;
}

.slider-track {
    position: relative;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    overflow: hidden;
    pointer-events: none;
}

.slider-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 25%;
    background: var(--accent-brand);
    border-radius: inherit;
    pointer-events: none;
}

.slider-thumb {
    position: absolute;
    top: 50%;
    left: 25%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffffff;
    cursor: grab;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.6);
    outline: none;
    z-index: 2;
    transition: box-shadow 0.15s ease;
}

/* Увеличенная зона захвата ползунка для тач-экранов (44x44px) */
.slider-thumb::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
}

.slider-thumb:hover {
    box-shadow: 0 0 10px rgba(212, 163, 115, 0.5);
}

.slider-thumb:active, .slider-thumb.is-dragging {
    cursor: grabbing;
    box-shadow: 0 0 12px rgba(212, 163, 115, 0.85);
}

.slider-ticks {
    position: relative;
    margin: 6px 20px 0 20px;
    height: 20px;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.slider-tick {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    white-space: nowrap;
    transition: color 0.15s ease;
}

.slider-tick:hover {
    color: var(--text-primary);
}

.slider-tick.active {
    color: var(--accent-brand);
    font-weight: 600;
}

.slider-tick[data-index="0"] { left: 0%; }
.slider-tick[data-index="1"] { left: 25%; }
.slider-tick[data-index="2"] { left: 50%; }
.slider-tick[data-index="3"] { left: 75%; }
.slider-tick[data-index="4"] { left: 100%; }

/* --------------------------------------------------------------------------
   ПРОГРЕСС И СКОРОСТЬ ЗАГРУЗКИ / СКАЧИВАНИЯ
   -------------------------------------------------------------------------- */
.progress-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 22px;
    margin-bottom: 18px;
    transition: all 0.25s ease;
}

.progress-panel:hover {
    border-color: var(--border-focus);
    background: var(--bg-surface-hover);
}

.progress-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 12px;
}

.speed-metric {
    font-family: var(--font-mono);
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--accent-emerald);
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    transition: color 0.3s ease;
}

.percent-metric {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.progress-track {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 14px;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: var(--accent-emerald);
    border-radius: var(--radius-full);
    transition: width 0.2s ease-out;
}

.progress-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* --------------------------------------------------------------------------
   РЕЗУЛЬТАТ: ССЫЛКА И ТАЙМЕР
   -------------------------------------------------------------------------- */
.share-box {
    margin-bottom: 18px;
}

.share-input-group {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 4px 6px 4px 14px;
    transition: all 0.2s ease;
}

.share-input-group:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 16px rgba(255, 255, 255, 0.05);
}

.share-link-input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.88rem;
}

.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    font-size: 0.82rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.copy-btn:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-focus);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.copy-btn:active {
    transform: scale(0.97);
}

.status-badge-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 14px;
    font-size: 0.82rem;
}

.timer-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent-brand);
    font-family: var(--font-mono);
    font-size: 0.82rem;
}

/* --------------------------------------------------------------------------
   КНОПКИ С РАСШИРЕННЫМ HOVER
   -------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    color: var(--text-primary);
    text-decoration: none;
}

.btn:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-focus);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.btn:active {
    transform: translateY(0) scale(0.99);
}

.btn-primary {
    background: #ffffff;
    border-color: #ffffff;
    color: #000000;
    font-weight: 600;
}

.btn-primary:hover {
    background: #e4e4e7;
    border-color: #e4e4e7;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(255, 255, 255, 0.18);
}

.btn-primary:active {
    transform: translateY(0) scale(0.99);
}

.btn-turbo {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.35);
    color: #34d399;
    font-weight: 600;
    width: 100%;
}

.btn-turbo:hover {
    background: rgba(16, 185, 129, 0.22);
    border-color: #34d399;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.25);
}

.btn-turbo:active {
    transform: translateY(0) scale(0.99);
}

.btn-full {
    width: 100%;
}

.download-actions-row {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.download-actions-row .btn {
    flex: 1;
}

.btn-danger-text {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.78rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.btn-danger-text:hover {
    color: var(--accent-red);
    background: rgba(239, 68, 68, 0.12);
}

.btn-danger-text:active {
    background: rgba(239, 68, 68, 0.2);
}

/* Единые квадратные подложки для кнопок действий в истории */
.btn-history-action,
.btn-history-delete,
.btn-history-copy {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    cursor: pointer;
    box-sizing: border-box;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-history-action:active,
.btn-history-copy:active,
.btn-history-delete:active {
    transform: scale(0.96);
}

.btn-history-copy:hover {
    color: var(--text-primary);
    border-color: var(--border-focus);
    background: var(--bg-surface-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.btn-history-delete:hover {
    color: var(--accent-red);
    border-color: rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.12);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.15);
}

.btn-history-delete:active {
    background: rgba(239, 68, 68, 0.2);
}

.icon-svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    flex-shrink: 0;
    pointer-events: none;
}

/* --------------------------------------------------------------------------
   ОКНО ИСТОРИИ (АВТОМАТИЧЕСКИ ПОЯВЛЯЕТСЯ ПРИ НАЛИЧИИ ФАЙЛОВ)
   -------------------------------------------------------------------------- */
.history-window {
    flex: 0 0 380px;
    width: 380px;
    max-width: 380px;
    margin-left: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
    overflow: hidden;
    box-sizing: border-box;
    opacity: 1;
    transform: translateX(0);
    visibility: visible;
    transition: flex-basis 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                max-width 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                width 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                margin-left 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                padding-left 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                padding-right 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.42s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.25s ease,
                visibility 0s linear;
}

.history-window:hover {
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.55);
}

.history-window > * {
    min-width: 330px;
    flex-shrink: 0;
}

.history-window.is-collapsed {
    flex: 0 0 0px !important;
    width: 0 !important;
    max-width: 0 !important;
    height: 0 !important;
    min-height: 0 !important;
    align-self: flex-start !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    border-width: 0 !important;
    border-color: transparent !important;
    box-shadow: none !important;
    opacity: 0 !important;
    transform: translateX(-50px) !important;
    pointer-events: none !important;
    visibility: hidden;
    transition: flex-basis 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                max-width 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                width 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                margin-left 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                padding-left 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                padding-right 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0s linear 0.45s;
}

.history-window-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.history-window-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.history-window-body {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 3px 4px 3px 2px;
    max-height: 316px; /* Вмещает ровно до 5 файлов без появления скролла */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.history-window-body::-webkit-scrollbar {
    width: 4px;
}

.history-window-body::-webkit-scrollbar-track {
    background: transparent;
}

.history-window-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.16);
    border-radius: var(--radius-full);
}

.history-window-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.history-window-footer {
    margin-top: auto;
    display: flex;
    justify-content: flex-end;
    padding-top: 12px;
}

.history-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-sizing: border-box;
    max-height: 90px;
    opacity: 1;
    transform: translateY(0);
    overflow: hidden;
    transition: opacity 0.32s cubic-bezier(0.16, 1, 0.3, 1),
                max-height 0.32s cubic-bezier(0.16, 1, 0.3, 1),
                padding-top 0.32s cubic-bezier(0.16, 1, 0.3, 1),
                padding-bottom 0.32s cubic-bezier(0.16, 1, 0.3, 1),
                margin-bottom 0.32s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.25s ease,
                background-color 0.2s ease,
                box-shadow 0.2s ease,
                transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

.history-item:hover {
    border-color: var(--border-focus);
    background: var(--bg-surface-hover);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

/* Начальное состояние плавного появления нового элемента в истории */
.history-item.is-entering {
    opacity: 0 !important;
    max-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-bottom: -8px !important;
    transform: translateY(-8px) !important;
    border-color: transparent !important;
    overflow: hidden !important;
    pointer-events: none !important;
}

/* Плавное удаление файла из истории */
.history-item.is-removing {
    opacity: 0 !important;
    max-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-bottom: -8px !important;
    transform: translateX(18px) scale(0.96) !important;
    border-color: transparent !important;
    overflow: hidden !important;
    pointer-events: none !important;
    transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1),
                max-height 0.3s cubic-bezier(0.16, 1, 0.3, 1) 0.04s,
                padding 0.3s cubic-bezier(0.16, 1, 0.3, 1) 0.04s,
                margin-bottom 0.3s cubic-bezier(0.16, 1, 0.3, 1) 0.04s,
                transform 0.22s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.2s ease !important;
}

.history-name {
    font-size: 0.86rem;
    color: var(--text-primary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.empty-state {
    text-align: center;
    padding: 36px 0;
    color: var(--text-muted);
    font-size: 0.88rem;
}

/* --------------------------------------------------------------------------
   ПОДВАЛ
   -------------------------------------------------------------------------- */
.app-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--text-dim);
    padding: 12px 0;
    border-top: 1px solid var(--border-subtle);
    font-family: var(--font-mono);
    user-select: none;
    -webkit-user-select: none;
    cursor: default;
}

.footer-links {
    display: flex;
    gap: 16px;
    user-select: none;
    -webkit-user-select: none;
}

.footer-links span {
    color: inherit;
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
    transition: color 0.2s ease;
}

.footer-links span:hover {
    color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   УТИЛИТЫ И АДАПТИВНОСТЬ
   -------------------------------------------------------------------------- */
.hidden {
    display: none !important;
}

.no-transition,
.no-transition * {
    transition: none !important;
}

.mobile-only-inline {
    display: none !important;
}

@media (max-width: 900px) {
    .stage-layout {
        flex-direction: column;
        align-items: center;
        gap: 0;
    }

    .transfer-card {
        width: 100%;
        max-width: 100%;
        flex: 1 1 auto;
    }

    .history-window {
        width: 100%;
        max-width: 100%;
        flex: 1 1 auto;
        margin-left: 0;
        margin-top: 20px;
    }

    .history-window > * {
        min-width: 0;
    }

    .history-window.is-collapsed {
        margin-top: 0 !important;
        margin-left: 0 !important;
        max-height: 0 !important;
        transform: translateY(-24px) !important;
    }
}

@media (max-width: 600px) {
    .app-wrapper {
        padding: 14px;
        padding-top: max(12px, env(safe-area-inset-top));
        padding-bottom: max(14px, env(safe-area-inset-bottom));
        padding-left: max(14px, env(safe-area-inset-left));
        padding-right: max(14px, env(safe-area-inset-right));
    }

    .main-stage {
        padding: 16px 0;
    }

    .app-header {
        padding: 8px 0 12px 0;
    }

    .brand-title {
        font-size: 1.05rem;
    }

    .transfer-card {
        padding: 20px 16px;
        border-radius: var(--radius-md);
    }

    .desktop-only-inline {
        display: none !important;
    }

    .mobile-only-inline {
        display: inline !important;
    }

    /* Предотвращение нежелательного зума в iOS Safari при фокусе */
    input, select, textarea,
    .archive-name-input,
    .share-link-input {
        font-size: 16px !important;
    }

    /* Полноразмерные кнопки для удобных тапов на экранах смартфонов */
    .btn {
        min-height: 46px;
        padding: 12px 18px;
        font-size: 0.92rem;
    }

    .download-actions-row {
        flex-direction: column;
        gap: 10px;
    }

    .download-actions-row .btn {
        width: 100%;
    }

    /* Увеличенные зоны нажатия для тактильного слайдера */
    .slider-track-wrap {
        height: 36px;
        margin: 0 14px;
    }

    .slider-ticks {
        margin: 4px 14px 0 14px;
    }

    /* Мобильный вид окна истории */
    .history-window {
        padding: 18px 16px;
        border-radius: var(--radius-md);
        margin-top: 14px;
    }

    .history-item {
        padding: 12px 14px;
    }

    .btn-history-action,
    .btn-history-copy,
    .btn-history-delete {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
    }

    .btn-danger-text {
        padding: 6px 10px;
    }

    /* Центрированный подвал на мобильных устройствах */
    .app-footer {
        flex-direction: column;
        gap: 8px;
        text-align: center;
        padding: 16px 0 8px 0;
    }

    .footer-links {
        justify-content: center;
        gap: 14px;
    }
}

@media (max-width: 380px) {
    .transfer-card {
        padding: 18px 12px;
    }

    .selected-file-box,
    .archive-name-block,
    .expire-slider-block,
    .progress-panel {
        padding: 12px 12px;
    }

    .slider-ticks {
        font-size: 0.7rem;
    }

    .speed-metric {
        font-size: 1.25rem;
    }
}
