:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --success-color: #10b981;
    --error-color: #ef4444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    padding: 20px;
}

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

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

h1 {
    font-size: 2rem;
    color: var(--text-main);
}

.status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

.status.online { background-color: #d1fae5; color: var(--success-color); }
.status.offline { background-color: #fee2e2; color: var(--error-color); }

section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.controls-card label {
    font-weight: 600;
    margin-right: 10px;
}

select {
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-size: 1rem;
    outline: none;
    cursor: pointer;
}

select:focus { border-color: var(--primary-color); }

.leaderboard-card h2 {
    margin-bottom: 16px;
    font-size: 1.5rem;
}

.table-responsive { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: #f9fafb;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}

tbody tr:hover { background-color: #f9fafb; }

.loading {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 30px !important;
}

tbody tr:nth-child(1) td:first-child { font-weight: bold; color: #fbbf24; font-size: 1.2rem; }
tbody tr:nth-child(2) td:first-child { font-weight: bold; color: #9ca3af; font-size: 1.1rem; }
tbody tr:nth-child(3) td:first-child { font-weight: bold; color: #b45309; font-size: 1.1rem; }

.add-score-card h3 {
    margin-bottom: 16px;
    font-size: 1.25rem;
}

.form-group { margin-bottom: 16px; }
.form-group.row { display: flex; gap: 16px; }
.form-group.row input { flex: 1; }

input[type="text"], input[type="number"] {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

input:focus {
    border-color: var(--primary-color);
    outline: none;
}

.btn-submit {
    width: 100%;
    background-color: var(--primary-color);
    color: white;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-submit:hover { background-color: var(--primary-hover); }

.message-box {
    font-size: 1.1rem;
    font-family: 'Courier New', Courier, monospace;
    background: #e5e7eb;
    color: #111827;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 4px solid var(--primary-color);
    user-select: none; 
    -webkit-user-select: none;
    letter-spacing: 0.5px;
}

#type-input {
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 400px;
    margin: 0 auto;
}

.game-cell {
    background-color: #e5e7eb;
    border-radius: 12px;
    aspect-ratio: 1 / 1;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 3rem;
    cursor: pointer;
    transition: background-color 0.1s, transform 0.1s;
    user-select: none;
}

.game-cell:active {
    transform: scale(0.95);
}

.cell-success { background-color: #10b981 !important; color: white; }
.cell-error { background-color: #ef4444 !important; color: white; }
