:root {
    --primary: #2196F3;
    --primary-bg: #E3F2FD;
    --win: #4CAF50;
    --win-bg: #E8F5E9;
    --loss: #F44336;
    --loss-bg: #FFEBEE;
    --warning: #FF9800;
}

/* Base Styles (Desktop / Landscape) */
body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Prevents the whole page from bouncing */
}

.app-bar {
    background-color: #d1e4ff;
    padding: 10px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 10;
}

.app-bar h1 { margin: 0; font-size: 20px; color: #333; }

.game-container {
    display: flex;
    flex: 1;
    padding: 20px;
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden; /* Desktop columns will handle their own scrolling if needed */
}

.column { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    height: 100%;
}

.board-column, .dashboard {
    overflow-y: auto; /* Allows independent scrolling */
    padding-right: 4px; /* Space for scrollbar */
}

.spacer { flex: 1; }

/* Board Styling */
.board { display: flex; flex-direction: column; gap: 4px; padding-bottom: 20px; }
.board-row {
    height: 30px;
    border: 1px solid #ccc;
    border-radius: 4px;
    display: flex;
    align-items: center;
    background: #fafafa;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0; /* Prevents rows from squishing */
}

.board-row:hover { background: #eeeeee; }
.row-index { width: 30px; text-align: center; font-size: 10px; border-right: 1px solid #ddd; color: #888; }
.row-value { flex: 1; text-align: center; font-weight: bold; font-size: 14px; }

/* Dashboard Cards */
.card, .status-banner {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 12px;
    text-align: center;
}

.level-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.selector { display: flex; align-items: center; gap: 10px; }
.selector button { cursor: pointer; border: none; background: none; font-size: 18px; padding: 5px; }
#level-display { font-size: 18px; font-weight: bold; color: var(--primary); }

.status-banner { border: 1px solid var(--primary); background: var(--primary-bg); }
.big-number { font-size: 28px; font-weight: 900; }
.tiny-label { font-size: 10px; font-weight: bold; margin-bottom: 2px; }

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 10px;
}

.stat-tile {
    padding: 8px 4px;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.1);
    background: rgba(0,0,0,0.03);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.stat-label { font-size: 9px; font-weight: bold; color: #666; text-align: center; line-height: 1; margin-bottom: 4px; }
.stat-value { font-size: 14px; font-weight: bold; }

/* Colors */
.teal { color: #00796B; border-color: #B2DFDB; }
.orange { color: #E65100; border-color: #FFE0B2; }
.indigo { color: #303F9F; border-color: #C5CAE9; }
.blue { color: #1976D2; border-color: #BBDEFB; }
.purple { color: #7B1FA2; border-color: #E1BEE7; }
.red { color: #D32F2F; border-color: #FFCDD2; }

/* Buttons */
.btn {
    padding: 10px;
    border-radius: 8px;
    border: none;
    font-weight: bold;
    cursor: pointer;
    font-size: 13px;
    width: 100%;
}

.orange-btn { background: var(--warning); color: white; margin-bottom: 12px; }
.orange-btn:disabled { background: #e0e0e0; color: #9e9e9e; cursor: not-allowed; }
.outline-btn { background: none; border: 1px solid var(--primary); color: var(--primary); margin-top: auto; margin-bottom: 10px; }

.flex-spacer { flex: 1; }

/* Interactive classes added via JS */
.is-only { background: #fff9c4 !important; border-color: #fbc02d !important; }
.has-number { background: #e3f2fd !important; border-color: #2196f3 !important; }

/* --- MOBILE STYLES (Vertical/Portrait) --- */
@media (max-width: 600px) and (orientation: portrait) {
    .app-bar {
        display: none; /* Disappear on mobile */
    }

    .game-container {
        padding: 10px;
        gap: 10px; /* Tighter gap for mobile */
    }

    .spacer {
        display: none; /* Remove empty left space on mobile */
    }

    .column {
        flex: 1 1 50%; /* Forces 50/50 split */
        max-width: 50%;
    }

    .board-column, .dashboard {
        overflow-y: auto; /* Independent scrolling */
    }

    /* Shrink text slightly more for very narrow mobile columns */
    .stat-value { font-size: 13px; }
    .big-number { font-size: 24px; }
    .btn { font-size: 12px; padding: 8px; }
    
    .row-index { width: 25px; }
    .board-row { height: 35px; } /* Slightly taller rows for fingers */
}