* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #10b981;
    --secondary-hover: #059669;
    --bg-color: #ffffff;
    --bg-secondary: #f8fafc;
    --text-color: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.1);
    --radius: 12px;
    --radius-lg: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.header {
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
}

.logo svg {
    width: 32px;
    height: 32px;
}

.nav {
    display: flex;
    gap: 24px;
}

.nav a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s;
}

.nav a:hover,
.nav a.active {
    color: var(--primary-color);
    background: rgba(59, 130, 246, 0.1);
}

.ad-top {
    background: var(--bg-color);
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.ad-slot {
    width: 100%;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-placeholder {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-placeholder span {
    color: var(--text-secondary);
    font-size: 14px;
}

.main {
    padding: 40px 0;
    margin-right: 320px;
}

.sidebar-ad {
    position: fixed;
    right: 20px;
    top: 120px;
    width: 300px;
    z-index: 50;
}

.sidebar-ad .ad-slot {
    height: 250px;
}

.hero {
    text-align: center;
    padding: 40px 0;
}

.hero h1 {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 12px;
}

.subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    max-width: 800px;
    margin: 0 auto;
}

.feature-card {
    background: var(--bg-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow);
    text-align: left;
    transition: transform 0.2s, box-shadow 0.2s;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-bottom: 16px;
}

.feature-card h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-color);
}

.feature-card p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    font-size: 16px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: var(--secondary-hover);
    transform: translateY(-2px);
}

.btn-large {
    padding: 16px 48px;
    font-size: 18px;
}

.how-it-works {
    padding: 60px 0;
    background: var(--bg-color);
}

.how-it-works h2 {
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 40px;
    color: var(--text-color);
}

.steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
}

.step {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-secondary);
    padding: 24px;
    border-radius: var(--radius);
    min-width: 280px;
}

.step-number {
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
}

.step-content h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-color);
}

.step-content p {
    font-size: 14px;
    color: var(--text-secondary);
}

.step-arrow {
    font-size: 24px;
    color: var(--border-color);
    font-weight: bold;
}

.features-list {
    padding: 60px 0;
}

.features-list h2 {
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 40px;
    color: var(--text-color);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
}

.grid-item {
    background: var(--bg-color);
    padding: 24px;
    border-radius: var(--radius);
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
}

.grid-item:hover {
    transform: translateY(-4px);
}

.grid-item svg {
    width: 40px;
    height: 40px;
    color: var(--primary-color);
    margin-bottom: 12px;
}

.grid-item h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-color);
}

.grid-item p {
    font-size: 14px;
    color: var(--text-secondary);
}

.ad-bottom {
    background: var(--bg-color);
    padding: 20px 0;
    border-top: 1px solid var(--border-color);
}

.ad-bottom .ad-slot {
    height: 120px;
}

.footer {
    background: var(--text-color);
    color: white;
    padding: 40px 0;
    margin-top: 40px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 32px;
    margin-bottom: 32px;
}

.footer-section h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
}

.footer-section p {
    font-size: 14px;
    color: #94a3b8;
    line-height: 1.8;
}

.footer-section ul {
    list-style: none;
}

.footer-section li {
    margin-bottom: 8px;
}

.footer-section a {
    color: #94a3b8;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.footer-section a:hover {
    color: white;
}

.footer-bottom {
    border-top: 1px solid #334155;
    padding-top: 20px;
    text-align: center;
}

.footer-bottom p {
    font-size: 14px;
    color: #64748b;
}

.footer-bottom a {
    color: #94a3b8;
    text-decoration: none;
    margin: 0 8px;
}

.footer-bottom a:hover {
    color: white;
}

.tool-section {
    padding: 20px 0;
}

.tool-header {
    text-align: center;
    margin-bottom: 32px;
}

.tool-header h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-color);
}

.tool-header p {
    font-size: 16px;
    color: var(--text-secondary);
}

.compression-panel,
.enhance-panel {
    background: var(--bg-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow);
    max-width: 800px;
    margin: 0 auto 32px;
}

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: var(--bg-secondary);
    margin-bottom: 24px;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(59, 130, 246, 0.05);
}

.upload-content svg {
    width: 48px;
    height: 48px;
    color: var(--primary-color);
    margin-bottom: 16px;
}

.upload-content p {
    font-size: 18px;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 8px;
}

.upload-content .hint {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 400;
}

.preview-panel {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.preview-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
}

#preview-count {
    font-size: 14px;
    color: var(--text-secondary);
}

.preview-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
    max-height: 400px;
    overflow-y: auto;
}

.preview-item {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-color);
    box-shadow: var(--shadow);
}

.preview-image {
    position: relative;
    width: 100%;
    padding-top: 100%;
    overflow: hidden;
}

.preview-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    color: white;
    font-size: 12px;
}

.preview-name {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.preview-size {
    opacity: 0.8;
}

.preview-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
}

.preview-remove:hover {
    background: #ef4444;
    transform: scale(1.1);
}

.settings-panel {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
}

.settings-panel h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-color);
}

.setting-group {
    margin-bottom: 20px;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 12px;
}

.radio-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.radio-label:hover {
    border-color: var(--primary-color);
}

.radio-label input[type="radio"] {
    display: none;
}

.radio-label input[type="radio"]:checked + span {
    color: var(--primary-color);
    font-weight: 600;
}

.radio-label input[type="radio"]:checked {
    border-color: var(--primary-color);
}

input[type="range"] {
    width: 100%;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    outline: none;
    appearance: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.model-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    margin-bottom: 24px;
    font-size: 14px;
}

.status-loading {
    color: var(--primary-color);
}

.status-ready {
    color: var(--secondary-color);
}

.loading-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.result-panel {
    background: var(--bg-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow);
    max-width: 1200px;
    margin: 0 auto;
}

.result-panel h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--text-color);
}

.result-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.result-item {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    overflow: hidden;
}

.compare-viewer {
    display: flex;
    align-items: stretch;
    gap: 16px;
    padding: 16px;
}

.compare-before,
.compare-after {
    flex: 1;
    text-align: center;
}

.compare-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 8px;
}

.compare-viewer img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: var(--radius);
    border: 2px solid var(--border-color);
}

.compare-meta {
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.compare-ratio {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    color: white;
    font-weight: 600;
    font-size: 12px;
}

.compare-arrow {
    display: flex;
    align-items: center;
    font-size: 24px;
    color: var(--primary-color);
    font-weight: bold;
}

.result-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-top: 1px solid var(--border-color);
}

.result-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 16px;
}

.result-actions .btn {
    padding: 8px 16px;
    font-size: 14px;
}

.result-summary {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.stat-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-color);
}

.stat-value.highlight {
    color: var(--secondary-color);
}

.before-after {
    padding: 40px 0;
    background: var(--bg-color);
}

.before-after h2 {
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 32px;
    color: var(--text-color);
}

.compare-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
}

.compare-item {
    text-align: center;
}

.compare-item h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-color);
}

.sample-image {
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.guide-section {
    padding: 40px 0;
}

.guide-section h2 {
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 32px;
    color: var(--text-color);
}

.guide-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.guide-step {
    display: flex;
    gap: 16px;
    background: var(--bg-color);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.step-num {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 20px;
    flex-shrink: 0;
}

.guide-step h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-color);
}

.guide-step p {
    font-size: 14px;
    color: var(--text-secondary);
}

@media (max-width: 1200px) {
    .main {
        margin-right: 0;
    }
    
    .sidebar-ad {
        display: none;
    }
}

@media (max-width: 768px) {
    html {
        -webkit-tap-highlight-color: transparent;
    }
    
    .header-content {
        flex-direction: column;
        gap: 12px;
    }
    
    .nav {
        gap: 8px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .nav a {
        padding: 10px 20px;
        font-size: 15px;
        min-width: 80px;
        text-align: center;
    }
    
    .hero h1 {
        font-size: 26px;
    }
    
    .subtitle {
        font-size: 15px;
    }
    
    .features {
        grid-template-columns: 1fr;
    }
    
    .feature-card {
        padding: 24px;
    }
    
    .steps {
        flex-direction: column;
    }
    
    .step {
        min-width: 100%;
        padding: 20px;
    }
    
    .step-arrow {
        transform: rotate(90deg);
        margin: 16px 0;
    }
    
    .grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }
    
    .compression-panel,
    .enhance-panel {
        padding: 16px;
        margin: 0 8px 24px;
    }
    
    .upload-area {
        padding: 40px 12px;
        min-height: 200px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .upload-content svg {
        width: 56px;
        height: 56px;
    }
    
    .upload-content p {
        font-size: 17px;
        margin-bottom: 10px;
    }
    
    .upload-content .hint {
        font-size: 13px;
    }
    
    .preview-panel {
        padding: 16px;
    }
    
    .preview-list {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 12px;
    }
    
    .preview-image {
        padding-top: 100%;
    }
    
    .preview-info {
        padding: 6px;
    }
    
    .preview-name {
        font-size: 11px;
    }
    
    .preview-size {
        font-size: 10px;
    }
    
    .preview-remove {
        width: 28px;
        height: 28px;
        font-size: 18px;
        top: 4px;
        right: 4px;
    }
    
    .settings-panel {
        padding: 20px 16px;
    }
    
    .setting-group label {
        font-size: 15px;
        margin-bottom: 14px;
    }
    
    .radio-group {
        flex-direction: column;
        gap: 12px;
    }
    
    .radio-label {
        padding: 14px 20px;
        font-size: 15px;
        min-height: 48px;
        align-items: center;
        justify-content: center;
    }
    
    input[type="range"] {
        height: 10px;
    }
    
    input[type="range"]::-webkit-slider-thumb {
        width: 28px;
        height: 28px;
    }
    
    .btn {
        min-height: 48px;
        padding: 14px 24px;
        font-size: 16px;
        min-width: 120px;
    }
    
    .btn-large {
        padding: 16px 32px;
        font-size: 17px;
        min-height: 52px;
        width: 100%;
    }
    
    .model-status {
        padding: 14px;
        font-size: 14px;
        min-height: 56px;
        align-items: center;
    }
    
    .result-panel {
        padding: 20px 16px;
        margin: 0 8px;
    }
    
    .result-panel h3 {
        font-size: 18px;
        margin-bottom: 20px;
    }
    
    .compare-viewer {
        flex-direction: column;
        gap: 16px;
    }
    
    .compare-before,
    .compare-after {
        width: 100%;
    }
    
    .compare-viewer img {
        height: 150px;
        max-width: 100%;
    }
    
    .compare-arrow {
        transform: rotate(90deg);
        margin: 8px 0;
        font-size: 20px;
    }
    
    .compare-label {
        font-size: 14px;
        margin-bottom: 8px;
    }
    
    .compare-meta {
        font-size: 12px;
        margin-top: 6px;
    }
    
    .compare-ratio {
        padding: 2px 6px;
        font-size: 11px;
    }
    
    .result-list {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .result-item {
        padding: 16px;
    }
    
    .result-actions {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
    
    .result-name {
        margin-right: 0;
        font-size: 14px;
        white-space: normal;
    }
    
    .result-actions .btn {
        width: 100%;
        max-width: 200px;
        margin: 0 auto;
    }
    
    .summary-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    .stat-item {
        padding: 12px;
        background: var(--bg-secondary);
        border-radius: var(--radius);
    }
    
    .stat-label {
        font-size: 12px;
    }
    
    .stat-value {
        font-size: 18px;
    }
    
    .guide-steps {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .guide-step {
        padding: 20px;
    }
    
    .step-num {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    .ad-top {
        padding: 8px 0;
    }
    
    .ad-slot {
        height: 60px;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 24px;
        text-align: center;
    }
    
    .footer-bottom p {
        font-size: 12px;
        line-height: 1.6;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 12px;
    }
    
    .header-content {
        padding: 12px 0;
    }
    
    .logo {
        font-size: 18px;
    }
    
    .logo svg {
        width: 28px;
        height: 28px;
    }
    
    .nav a {
        padding: 8px 14px;
        font-size: 14px;
    }
    
    .hero h1 {
        font-size: 22px;
    }
    
    .subtitle {
        font-size: 14px;
    }
    
    .feature-card {
        padding: 20px;
    }
    
    .upload-area {
        padding: 32px 8px;
        min-height: 180px;
    }
    
    .upload-content svg {
        width: 48px;
        height: 48px;
    }
    
    .upload-content p {
        font-size: 16px;
    }
    
    .preview-list {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 10px;
    }
    
    .preview-remove {
        width: 24px;
        height: 24px;
        font-size: 16px;
    }
    
    .radio-label {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .btn-large {
        padding: 14px 24px;
        font-size: 16px;
    }
    
    .compare-viewer img {
        height: 120px;
    }
    
    .summary-stats {
        grid-template-columns: 1fr;
    }
    
    .guide-step {
        padding: 16px;
    }
    
    .step-num {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
}