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

:root {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #242424;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --accent-blue: #3b82f6;
    --accent-green: #10b981;
    --border-color: #2a2a2a;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

.app-container {
    max-width: 420px;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
}

.screen {
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    flex: 1;
}

.screen.active {
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease forwards;
}

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

.app-header {
    padding: 20px 20px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo h1 {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.history-toggle {
    width: 40px;
    height: 40px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
}

.history-toggle:hover {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
}

.history-toggle svg {
    stroke: currentColor;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.content {
    padding: 24px 20px;
}

.form-group {
    margin-bottom: 28px;
}

.form-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.value-display {
    background: var(--bg-tertiary);
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 600;
    color: var(--accent-blue);
    font-size: 13px;
}

.select-wrapper {
    position: relative;
}

.select-wrapper::after {
    content: '';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid var(--text-secondary);
    pointer-events: none;
}

select {
    width: 100%;
    padding: 14px 40px 14px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 500;
    appearance: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

select:focus {
    outline: none;
    border-color: var(--accent-blue);
    background: var(--bg-tertiary);
}

input[type="range"] {
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--accent-blue);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
    transition: all 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--accent-blue);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.range-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.radio-group {
    display: flex;
    gap: 12px;
}

.radio-option {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.radio-option:hover {
    background: var(--bg-tertiary);
}

.radio-option input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.radio-option input[type="radio"]:checked ~ .radio-custom {
    border-color: var(--accent-blue);
}

.radio-option input[type="radio"]:checked ~ .radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background: var(--accent-blue);
    border-radius: 50%;
}

.radio-label {
    font-size: 15px;
    font-weight: 500;
}

.btn-primary,
.btn-secondary {
    width: 100%;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--accent-blue);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

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

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    margin-top: 12px;
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
}

.progress-container {
    padding: 40px 20px;
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.spinner {
    width: 64px;
    height: 64px;
    margin: 0 auto 32px;
    border: 4px solid var(--bg-tertiary);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.progress-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 32px;
    letter-spacing: -0.5px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 16px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), #60a5fa);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-status {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.progress-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent-blue);
}


.result-container {
    padding: 40px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.success-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
    animation: scaleIn 0.5s ease;
}

@keyframes scaleIn {
    from {
        transform: scale(0);
    }
    to {
        transform: scale(1);
    }
}

.result-container h2 {
    font-size: 24px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.result-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 32px;
    font-size: 15px;
}


.history-section {
    margin: 40px 0 20px;
}

.history-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.history-item:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-blue);
}

.history-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.history-platform {
    font-size: 15px;
    font-weight: 500;
}

.history-meta {
    font-size: 13px;
    color: var(--text-secondary);
}

.history-download {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-download:hover {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
}

.history-download svg {
    width: 18px;
    height: 18px;
    stroke: var(--text-primary);
}


.sidebar {
    position: fixed;
    top: 0;
    right: -100%;
    width: 320px;
    max-width: 85vw;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    z-index: 1001;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.sidebar.active {
    right: 0;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.sidebar-close {
    width: 36px;
    height: 36px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
}

.sidebar-close:hover {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.sidebar-history {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-history-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sidebar-history-item:hover {
    border-color: var(--accent-blue);
    transform: translateX(-4px);
}

.sidebar-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.sidebar-platform {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.sidebar-status {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 6px;
    background: var(--accent-green);
    color: white;
    font-weight: 600;
}

.sidebar-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-detail {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.sidebar-detail svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
}

.sidebar-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.sidebar-btn {
    flex: 1;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.sidebar-btn:hover {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
}

.sidebar-btn svg {
    width: 14px;
    height: 14px;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
}

.btn-clear-history {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-clear-history:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    color: #ef4444;
}

.sidebar-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.sidebar-empty svg {
    margin: 0 auto 16px;
    opacity: 0.3;
}

.sidebar-empty p {
    font-size: 14px;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 360px) {
    .app-header {
        padding: 16px;
    }
    
    .content {
        padding: 20px 16px;
    }
    
    .radio-group {
        flex-direction: column;
    }
}


.btn-primary:active,
.btn-secondary:active,
.radio-option:active,
.history-download:active {
    opacity: 0.8;
}

.sidebar-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.sidebar-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.sidebar-btn svg {
    opacity: 0.9;
}

.sidebar-btn.download {
    background: var(--accent, #3b82f6);
    color: white;
}

.sidebar-btn.download:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.sidebar-btn.send-tg {
    background: #0088cc;
    color: white;
}

.sidebar-btn.send-tg:hover {
    background: #0077b3;
    transform: translateY(-1px);
}

.sidebar-btn:active {
    transform: translateY(0);
}


.history-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #ffffff;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
  }
  
  .history-checkbox:checked {
    background: #ffffff;
  }
  
  .history-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    width: 4px;
    height: 8px;
    border: solid #000000;
    border-width: 0 2px 2px 0;
  }