:root {
    --bg-color: #111115;
    --text-color: #ffffff;
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
    --accent: #4a90e2;
    --accent-hover: #357abd;
    --glass-blur: 12px;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    min-height: 100vh;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    padding-top: 40px;
    /* Space for global nav if needed */
}

.app-header {
    text-align: center;
    margin-bottom: 30px;
}

.app-header h1 {
    font-weight: 300;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.app-header p {
    opacity: 0.7;
    font-size: 0.9rem;
}

/* Glass Panel Style */
.glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

/* Controls */
.controls-card {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    justify-content: center;
}

input[type="file"] {
    display: none;
}

.custom-file-upload {
    border: 1px solid var(--accent);
    background: rgba(74, 144, 226, 0.1);
    color: var(--accent);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.custom-file-upload:hover {
    background: var(--accent);
    color: white;
}

.action-btn {
    background-color: var(--accent);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
}

.action-btn:hover {
    background-color: var(--accent-hover);
}

.action-btn:disabled {
    background-color: #333;
    color: #666;
    cursor: not-allowed;
}

.action-btn.secondary {
    background-color: #2c3e50;
}

#fileCount {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-left: 10px;
}

/* Console Log */
.console-output {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    max-height: 150px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
}

.console-header {
    font-weight: bold;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 5px;
    margin-bottom: 5px;
    color: #aaa;
}

.log-entry {
    margin-bottom: 4px;
}

.log-error {
    color: #ff6b6b;
}

.log-success {
    color: #51cf66;
}

.log-info {
    color: #ced4da;
}

/* Grid Results */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.result-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.result-card h3 {
    font-size: 0.9rem;
    margin: 0 0 10px 0;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    width: 100%;
    text-align: center;
}

.preview-container {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 10px;
}

.preview-box {
    text-align: center;
}

.preview-box img {
    border: 1px solid #444;
    image-rendering: pixelated;
    /* Crucial for pixel art crispness */
    background: #222;
}

.preview-box span {
    display: block;
    font-size: 0.7rem;
    color: #888;
    margin-top: 4px;
}

/* Slider Controls */
.controls-row {
    width: 100%;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.controls-row label {
    font-size: 0.8rem;
    color: #ccc;
    width: 100%;
    display: flex;
    justify-content: space-between;
}

.threshold-slider {
    width: 100%;
    height: 6px;
    background: #333;
    border-radius: 5px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.threshold-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    transition: background 0.2s;
}

.threshold-slider::-webkit-slider-thumb:hover {
    background: var(--accent-hover);
}

.threshold-value {
    font-weight: bold;
    color: var(--accent);
}

/* Responsive */
@media (max-width: 600px) {
    .controls-card {
        flex-direction: column;
    }

    .custom-file-upload,
    .action-btn {
        width: 100%;
        text-align: center;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }
}