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

[hidden] {
    display: none !important;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #0f1117;
    color: #e1e4e8;
    min-height: 100vh;
    line-height: 1.5;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

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

header h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #f0f2f5;
}

.subtitle {
    color: #8b949e;
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

/* Drop Zone */

.drop-zone {
    border: 2px dashed #30363d;
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: #58a6ff;
    background: rgba(88, 166, 255, 0.04);
}

.drop-icon {
    width: 40px;
    height: 40px;
    color: #484f58;
    margin-bottom: 0.75rem;
}

.drop-zone-content p {
    color: #8b949e;
    font-size: 0.95rem;
}

.browse-link {
    color: #58a6ff;
    text-decoration: underline;
    cursor: pointer;
}

.hint {
    font-size: 0.8rem !important;
    color: #484f58 !important;
    margin-top: 0.25rem;
}

/* Image Info Bar */

.image-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    margin-top: 1rem;
    background: #161b22;
    border-radius: 8px;
    font-size: 0.85rem;
}

.info-item {
    color: #8b949e;
}

.info-item::before {
    content: '\00b7';
    margin-right: 0.75rem;
    color: #30363d;
}

.info-item:first-child::before {
    display: none;
}

.badge {
    background: linear-gradient(135deg, #da6b00, #e8a020);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    letter-spacing: 0.02em;
    margin-left: auto;
}

/* Controls */

.controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: #161b22;
    border-radius: 8px;
}

.quality-control {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.quality-control label {
    font-size: 0.85rem;
    color: #8b949e;
    white-space: nowrap;
}

.quality-control input[type="range"] {
    flex: 1;
    max-width: 200px;
    accent-color: #58a6ff;
}

#qualityValue {
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
    color: #e1e4e8;
    min-width: 2ch;
    text-align: right;
}

.split-btn {
    background: #238636;
    color: #fff;
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.split-btn:hover {
    background: #2ea043;
}

.split-btn:disabled {
    background: #21262d;
    color: #484f58;
    cursor: not-allowed;
}

/* Error */

.error-msg {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid rgba(248, 81, 73, 0.3);
    border-radius: 8px;
    color: #f85149;
    font-size: 0.9rem;
}

/* Preview */

.preview-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1.5rem;
}

.preview-card {
    background: #161b22;
    border-radius: 8px;
    overflow: hidden;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    color: #8b949e;
    border-bottom: 1px solid #21262d;
}

.download-btn {
    color: #58a6ff;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.download-btn:hover {
    background: rgba(88, 166, 255, 0.1);
}

.preview-img {
    width: 100%;
    display: block;
    background: #0d1117;
}

/* Responsive */

@media (max-width: 600px) {
    .container {
        padding: 1rem;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .quality-control {
        justify-content: space-between;
    }

    .preview-section {
        grid-template-columns: 1fr;
    }
}
