:root {
    --bg: #f4f5fb;
    --panel: #ffffff;
    --border: #dbe3ec;
    --text: #0f172a;
    --muted: #5f6b7a;
    --accent: #0ea5e9;
    --accent-strong: #0f766e;
    --danger: #ef4444;
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
    background: radial-gradient(circle at 20% 20%, #e0f2fe 0, transparent 35%), radial-gradient(circle at 80% 0%, #dcfce7 0, transparent 30%), var(--bg);
    color: var(--text);
}

.page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px 80px;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.page-header h1 {
    margin: 4px 0 8px;
    font-size: 32px;
}

.subtitle {
    margin: 0;
    color: var(--muted);
}

.eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 11px;
    color: var(--accent-strong);
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

button {
    cursor: pointer;
    border: 1px solid var(--accent);
    background: var(--accent);
    color: #fff;
    border-radius: 8px;
    padding: 10px 14px;
    font-weight: 600;
    transition: transform 0.05s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    box-shadow: 0 6px 20px rgba(14, 165, 233, 0.2);
}

button:hover {
    transform: translateY(-1px);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

button.ghost {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
    box-shadow: none;
}

button.compact {
    padding: 8px 10px;
    font-size: 13px;
    box-shadow: none;
}

button.primary {
    background: linear-gradient(120deg, var(--accent), var(--accent-strong));
    border-color: transparent;
    color: #fff;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 18px;
    box-shadow: var(--shadow);
}

.panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.muted {
    color: var(--muted);
    margin: 4px 0 0;
}

.badge-row {
    display: flex;
    gap: 6px;
}

.badge {
    background: #e0f2fe;
    color: #075985;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    align-items: flex-end;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field label {
    font-weight: 600;
}

input[type="text"],
input[type="url"] {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 15px;
    transition: border 0.2s ease, box-shadow 0.2s ease;
}

input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.2);
}

.hint {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
}

.source-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    background: #eef2ff;
    color: #4338ca;
}

.source-pill[data-source="env"] {
    background: #dcfce7;
    color: #166534;
}

.source-pill[data-source="default"] {
    background: #fef3c7;
    color: #92400e;
}

.filters {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--muted);
}

.games-list {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.games-list .header,
.games-list .row {
    display: grid;
    grid-template-columns: 2fr 1fr 1.4fr;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
}

.games-list .header {
    background: #f8fafc;
    font-weight: 700;
    color: var(--muted);
}

.games-list .row:nth-child(odd) {
    background: #fbfdff;
}

.games-list .row.disabled {
    opacity: 0.65;
}

.game-id {
    font-weight: 700;
}

.path {
    color: var(--muted);
    font-size: 12px;
    margin-top: 4px;
    word-break: break-all;
}

.mock-name-editor {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}

.mock-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
}

.mock-name-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.mock-name-controls input {
    width: min(320px, 100%);
}

.tag {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 8px;
    background: #eef2ff;
    color: #4338ca;
    font-size: 12px;
    font-weight: 700;
}

.actions-cell {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.status-chip {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    background: #ecfeff;
    color: #0f766e;
}

.status-chip.off {
    background: #fef2f2;
    color: #b91c1c;
}

.empty {
    padding: 18px;
    text-align: center;
    color: var(--muted);
}

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 10;
}

.overlay.hidden {
    display: none;
}

.editor-panel {
    background: var(--panel);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
}

.editor-header {
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}

.editor {
    flex: 1;
    min-height: 0;
}

.editor-actions {
    display: flex;
    gap: 10px;
}

.toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    background: var(--text);
    color: #fff;
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 20;
}

.toast.visible {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 768px) {
    .page {
        padding: 20px 16px 60px;
    }

    .games-list .header,
    .games-list .row {
        grid-template-columns: 1fr;
        align-items: flex-start;
    }
}
