:root {
    /* Color Palette - "Pro Navy" Theme */
    --bg-app: #020617;        /* Ultra dark slate/black */
    --bg-card: #0f172a;       /* Deep Navy */
    --bg-surface: #1e293b;    /* Lighter element bg */
    --bg-header: #0f172a;     /* Header matches card for seamless look */
    
    --text-main: #f8fafc;     /* White-ish */
    --text-muted: #94a3b8;    /* Slate Gray */
    --text-dim: #64748b;      /* Darker Gray */
    
    --accent: #FFCB05;        /* Maize */
    --accent-glow: rgba(255, 203, 5, 0.15);
    
    --success: #10b981;       /* Emerald */
    --success-bg: rgba(16, 185, 129, 0.1);
    
    --danger: #ef4444;        /* Red */
    --danger-bg: rgba(239, 68, 68, 0.1);
    
    --info: #3b82f6;          /* Blue */
    --info-bg: rgba(59, 130, 246, 0.1);
    
    --border: #334155;
    
    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-app);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* --- Typography --- */
h1, h2, h3 { 
    font-weight: 800; 
    color: var(--text-main);
    letter-spacing: -0.025em; 
}

.text-maize { color: var(--accent); }
.text-muted { color: var(--text-muted); }
.font-mono { font-family: var(--font-mono); }

/* --- Inputs --- */
input {
    background: var(--bg-app);
    color: white;
    border: 1px solid var(--border);
    padding: 1rem;
    border-radius: 12px;
    width: 100%;
    font-size: 1.1rem;
    transition: border-color 0.2s;
}
input:focus { 
    outline: none; 
    border-color: var(--accent); 
    box-shadow: 0 0 0 4px var(--accent-glow);
}

/* --- Layout Components --- */
header {
    background-color: var(--bg-header);
    padding: 1rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
    z-index: 20;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

main {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    padding-bottom: 100px; /* Space for Floating Nav */
}

.view {
    display: none;
    padding: 1rem;
    max-width: 600px; /* Tighter width for better desktop readability */
    margin: 0 auto;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.view.active { display: block; }

@keyframes slideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Navigation (Floating Bar Style) --- */
nav {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 24px;
    display: flex;
    justify-content: space-around;
    padding: 0.5rem;
    z-index: 50;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

nav button {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.7rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 0.5rem 1rem;
    flex: 1;
    border-radius: 16px;
    transition: all 0.2s;
}

nav button.active { 
    background: var(--accent); 
    color: var(--bg-app); 
    font-weight: 800;
}
nav button svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2.5; }

/* --- Cards & Containers --- */
.card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
    margin-bottom: 1rem;
    border: 1px solid var(--border);
}

.banner-card {
    background: linear-gradient(135deg, var(--accent) 0%, #eab308 100%);
    color: var(--bg-app);
    border: none;
}

/* --- Buttons --- */

.btn {

    display: inline-flex;

    align-items: center;

    justify-content: center;

    padding: 0.8rem 1.2rem;

    border-radius: 10px;

    font-weight: 700;

    border: none;

    cursor: pointer;

    font-size: 0.9rem;

    width: 100%;

    gap: 8px;

    transition: transform 0.1s, opacity 0.2s, background-color 0.2s;

}

.btn:active { transform: scale(0.97); }



.btn-sm { padding: 0.5rem 0.8rem; font-size: 0.8rem; border-radius: 8px; }



.btn-primary { 

    background-color: var(--bg-surface); 

    color: white; 

    border: 1px solid var(--border);

}

.btn-accent { 

    background-color: var(--accent); 

    color: var(--bg-app); 

}

.btn-danger { 

    background-color: var(--danger-bg); 

    color: var(--danger); 

    border: 1px solid rgba(239, 68, 68, 0.4);

}

.btn-ghost { background: transparent; color: var(--text-muted); }



/* --- Roster List --- */

.roster-item {

    display: flex;

    align-items: center;

    justify-content: space-between;

    padding: 0.8rem 1.2rem; /* Compressed */

    background: var(--bg-card);

    border-bottom: 1px solid var(--border);

}



.player-badge {

    background: var(--bg-surface);

    color: var(--accent);

    width: 40px;

    height: 40px;

    border-radius: 10px;

    display: flex;

    align-items: center;

    justify-content: center;

    font-weight: 800;

    margin-right: 0.8rem;

    font-size: 1.1rem;

    border: 1px solid var(--border);

}



/* --- Active Game Interface --- */

.player-row {

    background: var(--bg-card);

    border-bottom: 1px solid var(--border);

    display: grid;

    grid-template-columns: 70px 1fr 55px; /* Compressed columns */

    height: 90px; /* Shorter height */

    align-items: center;

}



/* 1. Identity Column */

.player-id-col {

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    border-right: 1px solid var(--border);

    height: 100%;

    background: var(--bg-surface);

    padding: 0 4px;

}

.pid-num { font-size: 1.2rem; font-weight: 900; color: var(--text-main); line-height: 1; }

.pid-name { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; font-weight: 700; margin-top: 2px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; }

.pid-pts { font-size: 0.7rem; color: var(--accent); font-weight: 800; margin-top: 4px; background: rgba(255,203,5,0.1); padding: 1px 4px; border-radius: 4px; }



/* 2. Scrollable Action Strip */

.action-strip {

    display: flex;

    align-items: center;

    gap: 8px; /* Tighter gap */

    overflow-x: auto;

    padding: 0 10px;

    height: 100%;

    scroll-snap-type: x mandatory;

    scrollbar-width: none;

}



.act-btn {

    flex: 0 0 auto;

    width: 58px; /* Slightly smaller */

    height: 58px;

    border-radius: 14px;

    border: none;

    font-weight: 900;

    font-size: 1rem;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    scroll-snap-align: center;

    cursor: pointer;

    box-shadow: 0 3px 0 rgba(0,0,0,0.2);

}



.foul-col {

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    height: 100%;

    border-left: 1px solid var(--border);

    background: rgba(0,0,0,0.1);

}

.foul-badge {

    width: 32px;

    height: 32px;

    border-radius: 6px;

    border: 1.5px solid var(--border);

    color: var(--text-main);

    display: flex;

    align-items: center;

    justify-content: center;

    font-weight: 900;

    font-size: 1rem;

}

.foul-label { font-size: 0.6rem; color: var(--accent); font-weight: 900; margin-top: 2px; }



/* Active Foul State */
.foul-col.danger .foul-badge { 
    background: var(--danger); 
    border-color: var(--danger); 
    color: white; 
    box-shadow: 0 0 10px var(--danger);
}

/* --- History & Detail --- */
.history-item {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 16px;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border);
    transition: transform 0.2s;
}
.history-item:active { transform: scale(0.98); }

.stat-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.stat-table th { text-align: center; padding: 1rem 0.5rem; color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; border-bottom: 1px solid var(--border); }
.stat-table td { padding: 1rem 0.5rem; border-bottom: 1px solid var(--border); text-align: center; font-variant-numeric: tabular-nums; }
.stat-table td:first-child { text-align: left; }
.stat-table tr:last-child td { border-bottom: none; }

/* --- Toast --- */
#toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-150%);
    background: var(--text-main);
    color: var(--bg-app);
    padding: 0.8rem 2rem;
    border-radius: 50px;
    font-weight: 800;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    z-index: 100;
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    display: flex;
    align-items: center;
    gap: 8px;
}
#toast.show { transform: translateX(-50%) translateY(0); }
