:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #64748b;
    --text-color: #f8fafc;
    --text-dark: #1e293b;
    --border-color: rgba(255, 255, 255, 0.1);
    --card-background: rgba(255, 255, 255, 0.08);
    --success-color: #10b981;
    --error-color: #ef4444;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
    --glass-blur: 12px;
    --glass-border: 1px solid rgba(255, 255, 255, 0.08);
}

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

html {
    font-size: 16px;
}

body {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1e293b, #334155);
    z-index: -2;
}

body::after {
    content: '';
    position: fixed;
    width: 400px;
    height: 400px;
    background: rgba(59, 130, 246, 0.05);
    border-radius: 50%;
    filter: blur(100px);
    bottom: -150px;
    right: -150px;
    z-index: -1;
}

.container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem;
    position: relative;
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

h1 {
    color: var(--text-color);
    font-size: 2.2rem;
    margin-bottom: 0.8rem;
    font-weight: 600;
    letter-spacing: -0.03em;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    font-weight: 300;
    margin-bottom: 1rem;
}

.card {
    background: var(--card-background);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-radius: 16px;
    border: var(--glass-border);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.card:hover {
    transform: translateY(-3px);
}

.card-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
}

.card-header h2 {
    font-size: 1.2rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-body {
    padding: 1.5rem;
}

#text-input {
    width: 100%;
    padding: 16px;
    background: rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    resize: vertical;
    min-height: 150px;
    font-family: inherit;
    margin-bottom: 1.5rem;
    transition: var(--transition);
    color: var(--text-color);
    font-size: 1rem;
    line-height: 1.7;
}

#text-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(0, 0, 0, 0.15);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

#text-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.button-group {
    display: flex;
    gap: 15px;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.file-label {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-color);
    padding: 12px 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    width: 100%;
    justify-content: center;
    text-align: center;
}

.file-label:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

#file-input {
    display: none;
}

#file-name {
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 1.5rem;
    display: block;
    font-size: 0.9rem;
    text-align: left;
}

.mode-selector {
    margin-bottom: 1.5rem;
    background: rgba(0, 0, 0, 0.1);
    padding: 1.25rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.mode-selector label {
    display: block;
    margin-bottom: 1rem;
    font-weight: 500;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
}

.mode-options {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.mode-option {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px 15px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    flex: 1;
    min-width: 130px;
}

.mode-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mode-option input {
    margin-right: 5px;
}

.ratio-container {
    margin-bottom: 1.5rem;
    background: rgba(0, 0, 0, 0.1);
    padding: 1.25rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.ratio-container label {
    display: block;
    margin-bottom: 1rem;
    font-weight: 500;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

#ratio-input {
    flex: 1;
    -webkit-appearance: none;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    outline: none;
}

#ratio-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 0 5px rgba(59, 130, 246, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.8);
}

#ratio-input::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 0 5px rgba(59, 130, 246, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.8);
}

#ratio-value {
    font-weight: 600;
    min-width: 50px;
    text-align: center;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    font-size: 1rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition);
    width: 100%;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.2);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.3);
}

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

.btn-primary:disabled {
    background: rgba(255, 255, 255, 0.1);
    cursor: not-allowed;
    box-shadow: none;
}

.btn-primary i {
    font-size: 1.1rem;
}

#loading-indicator {
    display: none;
    margin-top: 1.5rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
}

.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin-right: 12px;
}

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

#result-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 15px;
    margin-bottom: 1.5rem;
}

.stat {
    background: rgba(0, 0, 0, 0.1);
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.stat:hover {
    background: rgba(0, 0, 0, 0.15);
    transform: translateY(-3px);
}

.stat-label {
    display: block;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 6px;
}

.stat-value {
    font-weight: 600;
    font-size: 1.2rem;
}

.btn-secondary {
    background: rgba(0, 0, 0, 0.15);
    color: white;
    text-decoration: none;
    padding: 14px 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: var(--transition);
    border: 1px solid var(--border-color);
    font-weight: 500;
    font-size: 1rem;
}

.btn-secondary:hover {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.15);
}

.btn-secondary i {
    font-size: 1.1rem;
}

footer {
    text-align: center;
    margin-top: 3rem;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
    font-weight: 300;
}

@media (max-width: 475px) {
    html {
        font-size: 14px;
    }
    
    .container {
        padding: 1rem 0.75rem;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    .card-header {
        padding: 1rem 1.25rem;
    }
    
    .card-body {
        padding: 1.25rem 1rem;
    }
    
    #text-input {
        padding: 12px;
        min-height: 120px;
    }
    
    .mode-option {
        min-width: 100%;
    }
    
    .slider-container {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    #ratio-value {
        align-self: center;
    }
    
    .btn-primary, .btn-secondary {
        padding: 12px 20px;
    }
}

@media (min-width: 476px) and (max-width: 767px) {
    .container {
        padding: 1.5rem 1rem;
    }
    
    .card-header {
        padding: 1.25rem;
    }
    
    .card-body {
        padding: 1.25rem;
    }
    
    .mode-options {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .container {
        padding: 2rem 1.5rem;
    }
    
    #result-stats {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 992px) {
    .container {
        padding: 3rem 2rem;
    }
    
    h1 {
        font-size: 2.5rem;
    }
    
    .subtitle {
        font-size: 1.1rem;
    }
    
    .card-header {
        padding: 1.5rem 2rem;
    }
    
    .card-header h2 {
        font-size: 1.3rem;
    }
    
    .card-body {
        padding: 2rem;
    }
    
    .file-label {
        flex: 1;
        max-width: 300px;
    }
    
    #result-stats {
        grid-template-columns: repeat(3, 1fr);
    }
}
