:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --border-color: #e2e8f0;
    --success-color: #22c55e;
    --error-color: #ef4444;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    margin: 0;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

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

h1 { margin-bottom: 0.5rem; }
p { color: var(--secondary-color); margin-top: 0; }

/* Cards */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
}

.card-header {
    padding: 15px 20px;
    background: #f1f5f9;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.card-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

.hidden {
    display: none;
}

/* Forms */
.form-group {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

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

.half { flex: 1; }
.third { flex: 1; }

label {
    font-weight: 500;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

input, select, textarea {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
}

input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--primary-color);
    border-color: transparent;
}

small {
    color: var(--secondary-color);
    font-size: 0.8rem;
    margin-top: 4px;
}

.code-font {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.9rem;
}

/* Buttons */
button {
    cursor: pointer;
    padding: 10px 20px;
    border-radius: 4px;
    border: none;
    font-weight: 600;
    transition: background 0.2s;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.primary-btn {
    background: var(--primary-color);
    color: white;
}
.primary-btn:hover:not(:disabled) { background: #1d4ed8; }

.secondary-btn {
    background: var(--secondary-color);
    color: white;
}

.danger-btn {
    background: var(--error-color);
    color: white;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin: 20px 0;
}

.results-scroll {
    overflow-x: auto;
}

.howto-list {
    margin: 0 0 10px 20px;
    padding: 0;
}

@media (max-width: 900px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    body {
        padding: 12px;
    }
    .container {
        max-width: 100%;
    }
    .card-body {
        padding: 16px;
    }
    .row {
        flex-direction: column;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .progress-container {
        margin-bottom: 12px;
    }
}

.stat-box {
    background: #f8fafc;
    padding: 10px;
    border-radius: 6px;
    text-align: center;
    border: 1px solid var(--border-color);
}

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

.stat-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    margin-top: 4px;
}

.error-text { color: var(--error-color); }

/* Progress Bar */
.progress-container {
    height: 10px;
    background: var(--border-color);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 20px;
}

.progress-bar {
    height: 100%;
    background: var(--success-color);
    transition: width 0.3s ease;
}

/* Console */
.log-container {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 15px;
    border-radius: 6px;
    font-family: monospace;
}

.log-container label {
    color: #a3a3a3;
    display: block;
    margin-bottom: 10px;
    border-bottom: 1px solid #404040;
    padding-bottom: 5px;
}

.console {
    height: 150px;
    overflow-y: auto;
    font-size: 0.85rem;
    white-space: pre-wrap;
}

.log-info { color: #60a5fa; }
.log-success { color: #4ade80; }
.log-error { color: #f87171; }
.log-warn { color: #fbbf24; }
