:root {
    --primary: #00B894;
    --primary-hover: #00A383;
    --secondary: #55EFC4;
    --accent: #FDCB6E;
    --bg: #0A1A14;
    --surface: #132A22;
    --surface-hover: #19362C;
    --text-primary: #FFFFFF;
    --text-secondary: #A0B9AE;
    --border: rgba(85, 239, 196, 0.2);
    --border-focus: rgba(85, 239, 196, 0.6);
    --radius: 12px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --transition: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg);
    background-image:
        radial-gradient(circle at 15% 50%, rgba(0, 184, 148, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(85, 239, 196, 0.05) 0%, transparent 50%);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

.app-container {
    width: 100%;
    max-width: 1000px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Glassmorphism Helpers */
.glass-panel {
    background: rgba(19, 42, 34, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* Header */
.header {
    text-align: center;
    padding: 1rem 0;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.accent-text {
    color: var(--accent);
    font-style: italic;
    opacity: 0.9;
}

.header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Main Content */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.panel {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

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

.panel-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--secondary);
}

.title-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.gzip-icon {
    background: rgba(253, 203, 110, 0.2);
    color: var(--accent);
}

.brotli-icon {
    background: rgba(0, 184, 148, 0.2);
    color: var(--primary);
}

/* Controls */
.controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.controls label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
    width: 100px;
}

input[type="range"]::-webkit-slider-runnable-track {
    background: rgba(255, 255, 255, 0.1);
    height: 6px;
    border-radius: 3px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: var(--secondary);
    margin-top: -5px;
    box-shadow: 0 0 10px rgba(85, 239, 196, 0.4);
    transition: var(--transition);
}

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

input[type="range"]:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 3px rgba(85, 239, 196, 0.3);
}

#level-display {
    font-family: monospace;
    font-size: 0.9rem;
    color: var(--secondary);
    font-weight: 600;
    min-width: 1ch;
    text-align: right;
}

/* Input Area */
#source-text {
    width: 100%;
    min-height: 200px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    transition: var(--transition);
    outline: none;
}

#source-text:focus {
    border-color: var(--border-focus);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 2px rgba(85, 239, 196, 0.1);
}

#source-text::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.stats {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.stat-value {
    color: var(--text-primary);
    font-weight: 600;
    font-family: monospace;
}

/* Results Area */
.results-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.result-panel {
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.result-panel:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    border-color: var(--border-focus);
}

.copy-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.copy-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.copy-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.result-stats {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 0.5rem;
}

.stat-box {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 8px;
}

.primary-stat {
    align-items: center;
    padding: 1.5rem 1rem;
}

.stat-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.stat-box-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    font-weight: 600;
}

.stat-box-value {
    font-size: 1.25rem;
    font-weight: 700;
    font-family: monospace;
}

.primary-stat .stat-box-value {
    font-size: 2rem;
    color: var(--primary);
}

.gzip-panel .primary-stat .stat-box-value {
    color: var(--accent);
}

.stat-box-value.highlight {
    color: var(--secondary);
}

.gzip-panel .stat-box-value.highlight {
    color: #FFEAA7;
}

/* Progress Bars */
.progress-bar-container {
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
    margin-top: auto;
    overflow: hidden;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
}

.progress-bar {
    height: 100%;
    border-radius: 2px;
    transition: width 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

.gzip-panel .progress-bar {
    background: var(--accent);
}

.brotli-panel .progress-bar {
    background: var(--primary);
}

/* Footer & Toast */
.footer {
    text-align: center;
    margin-top: auto;
    color: rgba(160, 185, 174, 0.6);
    font-size: 0.85rem;
    padding-top: 1rem;
}

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--surface-hover);
    color: var(--secondary);
    padding: 0.75rem 1.5rem;
    border-radius: 24px;
    font-weight: 500;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    opacity: 0;
    transition: all 300ms cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
}

.toast.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .results-container {
        grid-template-columns: 1fr;
    }

    .app-container {
        padding: 1rem;
    }

    .header h1 {
        font-size: 2rem;
    }
}