:root {
    --bg: #0e0e10;
    --surface: #18181b;
    --surface2: #1f1f23;
    --border: #2f2f35;
    --text: #efeff1;
    --text-dim: #adadb8;
    --twitch: #9146ff;
    --twitch-hover: #772ce8;
    --green: #00c853;
    --yellow: #ffa726;
    --red: #ef5350;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

.hidden { display: none !important; }

/* Login */
.login-box {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: var(--surface);
    padding: 2.5rem;
    border-radius: 12px;
    text-align: center;
    width: 340px;
    border: 1px solid var(--border);
}

.login-box h1 {
    color: var(--twitch);
    margin-bottom: 0.25rem;
}

.login-box p {
    color: var(--text-dim);
    margin-bottom: 1.5rem;
}

input, textarea, select {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    font-size: 0.9rem;
    width: 100%;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--twitch);
}

button {
    background: var(--twitch);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s;
}

button:hover { background: var(--twitch-hover); }

.login-box input { margin-bottom: 1rem; }
.login-box button { width: 100%; }

.error { color: var(--red); margin-top: 0.75rem; font-size: 0.85rem; }
.msg { margin-top: 0.75rem; font-size: 0.85rem; color: var(--green); }

/* Header */
header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

header h1 {
    color: var(--twitch);
    font-size: 1.2rem;
    white-space: nowrap;
}

nav { display: flex; gap: 0.25rem; flex: 1; }

.tab {
    background: transparent;
    color: var(--text-dim);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.85rem;
}

.tab:hover { background: var(--surface2); color: var(--text); }
.tab.active { background: var(--surface2); color: var(--twitch); }

#logout-btn {
    background: transparent;
    color: var(--text-dim);
    font-size: 0.8rem;
}

#logout-btn:hover { color: var(--red); }

/* Tab content */
.tab-content {
    padding: 1.5rem;
    max-width: 900px;
    margin: 0 auto;
}

.tab-content h2 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: var(--text-dim);
}

/* Cards */
.cards {
    display: grid;
    gap: 0.75rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem 1.25rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.card-header h3 { font-size: 1rem; }

.card-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: var(--text-dim);
}

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-active { background: var(--green); color: #000; }
.badge-upcoming { background: var(--yellow); color: #000; }
.badge-watching { background: var(--twitch); color: white; }
.badge-offline { background: var(--surface2); color: var(--text-dim); }
.badge-auth { background: var(--green); color: #000; }
.badge-unauth { background: var(--red); color: white; }

/* Progress bar */
.progress-bar {
    background: var(--surface2);
    border-radius: 4px;
    height: 8px;
    margin-top: 0.5rem;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--twitch);
    border-radius: 4px;
    transition: width 0.3s;
}

/* Add form */
.add-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.add-form input { flex: 1; }

/* Config form */
.config-form {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
}

.config-form label {
    display: block;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: var(--text-dim);
}

.config-form label input,
.config-form label textarea {
    margin-top: 0.35rem;
}

/* Logs */
.log-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.log-controls select { width: 120px; }

.logs {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem;
    max-height: 500px;
    overflow-y: auto;
    font-family: "Cascadia Code", "Fira Code", monospace;
    font-size: 0.8rem;
    line-height: 1.6;
}

.log-entry { padding: 0.15rem 0.5rem; border-radius: 3px; }
.log-entry:hover { background: var(--surface2); }
.log-ts { color: var(--text-dim); }
.log-src { color: var(--twitch); }
.log-ERROR { color: var(--red); }
.log-WARNING { color: var(--yellow); }
.log-INFO { color: var(--text-dim); }

/* Modal */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    max-width: 400px;
}

.modal-content h3 { margin-bottom: 1rem; }
.modal-content p { margin-bottom: 0.75rem; color: var(--text-dim); }
.modal-content strong { color: var(--twitch); font-size: 1.5rem; letter-spacing: 0.15em; }
.modal-content a { color: var(--twitch); }

/* Card actions */
.card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}

.btn-danger { background: var(--red); }
.btn-danger:hover { background: #c62828; }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
}

.btn-outline:hover { border-color: var(--twitch); color: var(--twitch); }

/* Game tags */
.card-games {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-dim);
}

.card-games strong { margin-right: 0.35rem; }

.game-tag {
    display: inline-block;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.1rem 0.45rem;
    margin: 0.15rem 0.15rem;
    font-size: 0.75rem;
    color: var(--text);
}

.text-dim { color: var(--text-dim); font-size: 0.85rem; }

/* Game picker modal */
.modal-wide {
    max-width: 600px;
    width: 90vw;
    text-align: left;
}

.game-picker-grid {
    max-height: 400px;
    overflow-y: auto;
    margin: 1rem 0;
    padding: 0;
}

.game-checkbox {
    display: block;
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--text);
}

.game-checkbox:hover { background: var(--surface2); }

.game-checkbox input {
    accent-color: var(--twitch);
    margin-right: 0.5rem;
    vertical-align: middle;
}

.modal-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1rem;
}
