:root {
    --bg-main: #060a06; /* Very dark green/black */
    --panel-bg: #0b140b;
    --border-color: #1a3020;
    --text-main: #00ff88; /* Bright terminal green */
    --text-orange: #ffb84d; /* Drive result orange */
    --glow-green: 0 0 10px rgba(0, 255, 136, 0.4);
    --glow-orange: 0 0 10px rgba(255, 184, 77, 0.4);
    --font-mono: 'Share Tech Mono', monospace;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-mono);
    line-height: 1.4;
    overflow-x: hidden;
    padding: 20px;
    background-image: 
        radial-gradient(circle at 50% 0%, #112815 0%, transparent 50%),
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,255,136,0.02) 2px, rgba(0,255,136,0.02) 4px);
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(11, 20, 11, 0.85);
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
    min-height: 90vh;
}

/* Typography Helpers */
.text-glow { text-shadow: var(--glow-green); }
.text-orange { color: var(--text-orange); text-shadow: var(--glow-orange); }
.fade-text { color: rgba(0, 255, 136, 0.6); }

/* Top Nav */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 2px solid var(--border-color);
}
.nav-left { display: flex; align-items: center; gap: 15px; }
.logo-icon {
    font-size: 1.5rem;
    font-weight: bold;
    text-shadow: var(--glow-green);
}
h1 {
    font-size: 1.4rem;
    letter-spacing: 2px;
    text-shadow: var(--glow-green);
}
.nav-right { display: flex; gap: 20px; align-items: center; }
.nav-link {
    font-size: 0.9rem;
    color: rgba(0, 255, 136, 0.5);
    cursor: pointer;
    letter-spacing: 1px;
}
.nav-link.active {
    color: var(--text-orange);
    text-shadow: var(--glow-orange);
}

/* Main Content */
.dashboard-content {
    padding: 20px 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Summary Row */
.summary-row {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
}
.summary-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.summary-card .label {
    font-size: 0.75rem;
    color: rgba(0, 255, 136, 0.7);
    letter-spacing: 1px;
}
.summary-card .value {
    font-size: 1.8rem;
    font-weight: bold;
    text-shadow: var(--glow-green);
}
.summary-card .value-orange {
    color: var(--text-orange);
    text-shadow: var(--glow-orange);
}
.summary-card .sub {
    font-size: 0.75rem;
    color: rgba(0, 255, 136, 0.5);
}

/* Dashboard Body Columns */
.dashboard-body {
    display: flex;
    gap: 20px;
}
.left-sidebar {
    width: 250px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.right-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Panels */
.panel {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    padding: 20px;
    position: relative;
}
.panel-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 15px;
    font-size: 0.85rem;
    letter-spacing: 1.5px;
    text-shadow: var(--glow-green);
}
.space-between {
    display: flex;
    justify-content: space-between;
}

/* Win Prob Panel */
.wp-content { display: flex; align-items: flex-end; gap: 10px; height: 100px; padding-top: 20px; }
.wp-bars { display: flex; align-items: flex-end; gap: 4px; height: 100%; flex: 1; }
.wp-bar {
    width: 6px;
    background: var(--text-main);
    box-shadow: var(--glow-green);
    opacity: 0.6;
    min-height: 2px;
}
.wp-bar.final {
    background: var(--text-orange);
    box-shadow: var(--glow-orange);
    opacity: 1;
}
.wp-total { font-weight: bold; font-size: 1.1rem; text-shadow: var(--glow-green); }

/* Tempo Panel */
.tempo-row { display: flex; justify-content: space-between; font-size: 0.75rem; margin-bottom: 8px; }
.progress-bar-container { background: #112015; height: 6px; width: 100%; position: relative; }
.progress-bar-fill { background: var(--text-main); box-shadow: var(--glow-green); height: 100%; }

/* Personnel Panel */
.personnel-cards { display: flex; flex-direction: column; gap: 10px; }
.personnel-card { background: rgba(0, 255, 136, 0.05); border: 1px solid var(--border-color); padding: 15px; text-align: center; }
.personnel-num { font-size: 1.5rem; text-shadow: var(--glow-green); margin-bottom: 5px; }
.personnel-pct { font-size: 0.7rem; color: rgba(0, 255, 136, 0.6); }

/* All Drives List */
.drives-list {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
}
.drives-list::-webkit-scrollbar {
    height: 6px;
}
.drives-list::-webkit-scrollbar-track {
    background: rgba(0, 255, 136, 0.05);
}
.drives-list::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 136, 0.3);
    border-radius: 3px;
}
.drive-box {
    flex: 0 0 auto;
    width: 86px;
    height: 86px;
    box-sizing: border-box;
    background: rgba(0, 255, 136, 0.05);
    border: 1px solid var(--border-color);
    padding: 6px;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 2px;
    font-size: 0.6rem;
    cursor: pointer;
    transition: all 0.2s ease;
}
.drive-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}
.drive-box.active {
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.6);
}
.drive-box.team-gb {
    background: rgba(0, 255, 136, 0.1);
    border-color: rgba(0, 255, 136, 0.4);
}
.drive-box.team-chi {
    background: rgba(255, 184, 77, 0.1);
    border-color: rgba(255, 184, 77, 0.4);
}
.drive-box .drive-team {
    font-weight: bold;
    font-size: 0.75rem;
}
.drive-box.team-gb .drive-team {
    color: var(--text-main);
    text-shadow: var(--glow-green);
}
.drive-box.team-chi .drive-team {
    color: var(--text-orange);
    text-shadow: var(--glow-orange);
}
.drive-box .drive-result {
    font-size: 0.55rem;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.drive-box .drive-meta {
    font-size: 0.5rem;
    color: rgba(0, 255, 136, 0.4);
    line-height: 1.1;
}
.drive-box.team-chi .drive-meta {
    color: rgba(255, 184, 77, 0.4);
}

/* Execution Log */
.execution-grid { position: relative; padding: 10px 0; border: 1px solid var(--border-color); border-left: none; border-right: none; }
.grid-lines { display: flex; justify-content: space-between; font-size: 0.7rem; color: rgba(0, 255, 136, 0.3); padding: 10px 0; }
.grid-lines span { width: 30px; text-align: center; }
.log-row { display: flex; align-items: center; margin: 8px 0; position: relative; height: 30px; }
.log-label { width: 100px; font-size: 0.7rem; opacity: 0.8; flex-shrink: 0; }
.log-track { flex: 1; position: relative; height: 100%; border-left: 1px dashed rgba(0, 255, 136, 0.1); margin-left:10px; }

/* Yardline calculation: total track width is 100%. start_yardline (0=own endzone, 100=opp endzone) */
.log-bar {
    position: absolute;
    height: 24px;
    top: 3px;
    display: flex;
    align-items: center;
    font-size: 0.65rem;
    padding: 0 8px;
    color: #000;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
}
.log-bar.pass { background: rgba(0, 255, 136, 0.8); box-shadow: 0 0 8px rgba(0, 255, 136, 0.5); }
.log-bar.rush { background: rgba(255, 184, 77, 0.8); box-shadow: 0 0 8px rgba(255, 184, 77, 0.5); }
.log-bar.field_goal { background: rgba(255, 255, 255, 0.8); box-shadow: 0 0 8px rgba(255, 255, 255, 0.5); }
.log-bar.punt { background: rgba(255, 0, 85, 0.8); box-shadow: 0 0 8px rgba(255, 0, 85, 0.5); }
.log-bar.penalty { background: rgba(180, 50, 255, 0.8); box-shadow: 0 0 8px rgba(180, 50, 255, 0.5); }
.legend { display: flex; gap: 20px; font-size: 0.7rem; margin-top: 15px; }
.legend-item { display: flex; align-items: center; gap: 8px; }
.legend-color { display: inline-block; width: 12px; height: 12px; }
.pass-color { background: var(--text-main); }
.rush-color { background: var(--text-orange); }
.fg-color { background: rgba(255, 255, 255, 0.8); }
.punt-color { background: rgba(255, 0, 85, 0.8); }

/* Line Chart Container */
.chart-container {
    width: 100%;
    height: 180px;
    margin-top: 10px;
}

/* Footer Tabs */
footer { display: flex; border-top: 1px solid var(--border-color); background: rgba(11, 20, 11, 0.9); border-bottom-left-radius: 8px; border-bottom-right-radius: 8px; margin-top: auto;}
.footer-btn { flex: 1; text-align: center; padding: 15px; font-size: 0.8rem; cursor: pointer; color: rgba(0, 255, 136, 0.5); border-right: 1px solid var(--border-color); }
.footer-btn:last-child { border-right: none; }
.footer-btn.active { color: var(--text-orange); text-shadow: var(--glow-orange); border-bottom: 3px solid var(--text-orange); }

/* ============================================
   Mobile Responsive Layouts
   ============================================ */

/* Tablet and smaller (<= 900px) */
@media (max-width: 900px) {
    body {
        padding: 10px;
    }
    .app-container {
        min-height: auto;
        border-radius: 6px;
    }

    /* Top Nav - stack title above status/nav links */
    .top-nav {
        flex-wrap: wrap;
        padding: 12px 16px;
        gap: 10px;
    }
    .nav-left {
        flex: 1 1 100%;
        flex-wrap: wrap;
        gap: 10px;
    }
    h1 {
        font-size: 1rem;
        letter-spacing: 1px;
    }
    .nav-right {
        flex: 1 1 100%;
        flex-wrap: wrap;
        gap: 12px;
        font-size: 0.75rem;
        justify-content: flex-start;
    }
    .nav-right #hud-matchup {
        font-size: 0.75rem;
    }

    /* Main Content */
    .dashboard-content {
        padding: 14px 14px;
        gap: 14px;
    }

    .panel {
        padding: 14px;
    }

    /* === Drive Tracker (index.html) === */

    /* Top Controls Row - stack filter panel above drives list */
    .top-controls-row {
        flex-direction: column !important;
        gap: 12px !important;
    }
    .filter-panel {
        width: 100% !important;
        padding: 10px 14px !important;
    }
    .filter-controls {
        flex-direction: row !important;
        flex-wrap: wrap;
        gap: 10px !important;
    }
    .filter-controls .tempo-row {
        flex: 1 1 auto;
        border-top: none !important;
        padding-top: 0 !important;
        margin-top: 0 !important;
    }
    .all-drives-panel {
        padding: 10px 14px !important;
    }

    /* Summary Row - wrap into 3 columns */
    .summary-row {
        flex-wrap: wrap;
        gap: 12px;
    }
    .summary-card {
        flex: 1 1 calc(33.333% - 12px);
        min-width: 0;
    }
    .summary-card .value {
        font-size: 1.25rem;
    }
    .summary-card .label {
        font-size: 0.7rem;
    }
    .summary-card .sub {
        font-size: 0.65rem;
    }

    /* Dashboard Body - stack sidebar below main column */
    .dashboard-body {
        flex-direction: column !important;
    }
    .left-sidebar {
        width: 100% !important;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 12px !important;
    }
    .left-sidebar .panel {
        flex: 1 1 calc(50% - 6px);
        min-width: 0;
    }
    .wp-panel {
        flex: 1 1 100% !important;
    }
    .wp-content {
        height: 120px;
    }

    /* Execution Log - tighten spacing */
    .execution-log-panel .panel-header {
        font-size: 0.75rem;
    }
    .log-label {
        width: 70px;
        font-size: 0.6rem;
    }
    .log-track {
        margin-left: 6px;
    }
    .log-bar {
        font-size: 0.55rem;
        padding: 0 4px;
    }
    .grid-lines {
        font-size: 0.6rem;
    }
    .grid-lines span {
        width: 22px;
    }
    .legend {
        flex-wrap: wrap;
        gap: 10px;
        font-size: 0.6rem;
    }

    /* Performance chart */
    .chart-container {
        height: 200px;
    }

    /* Footer */
    .footer-btn {
        padding: 12px 6px;
        font-size: 0.7rem;
    }

    /* === Player Card (playercard.html) === */

    .player-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 14px;
        padding: 16px !important;
    }
    .player-info h1 {
        font-size: 28px !important;
    }
    .player-info h1 .qb-num {
        font-size: 16px !important;
    }
    .player-info .season-team {
        font-size: 14px !important;
    }
    .season-filter {
        flex-wrap: wrap;
        gap: 8px !important;
        font-size: 12px;
    }
    .selectors {
        gap: 20px !important;
        flex-wrap: wrap;
        width: 100%;
    }
    .pos-toggle {
        margin-left: 0 !important;
        gap: 18px !important;
        flex-wrap: wrap;
        font-size: 13px !important;
    }

    .kpi-row {
        flex-wrap: wrap;
        gap: 12px !important;
        padding: 16px !important;
    }
    .kpi-container {
        flex: 1 1 calc(50% - 6px) !important;
        min-width: 0;
    }
    .kpi-card {
        padding: 12px !important;
    }
    .kpi-card .value {
        font-size: 28px !important;
    }
    .kpi-card .label {
        font-size: 12px !important;
    }

    .charts-row {
        flex-direction: column !important;
        height: auto !important;
        gap: 14px !important;
        padding: 0 16px !important;
    }
    .scatter-panel {
        flex: 0 0 auto !important;
        height: 320px;
    }
    .trends-panel {
        flex: 0 0 auto !important;
        gap: 14px !important;
    }
    .trend-chart {
        height: 200px;
    }

    .four-col {
        flex-wrap: wrap;
        height: auto !important;
        padding: 16px !important;
        gap: 14px !important;
    }
    .dot-plot-panel {
        flex: 1 1 calc(50% - 7px) !important;
        min-width: 0;
        height: 240px;
    }
}

/* Phones (<= 560px) */
@media (max-width: 560px) {
    body {
        padding: 6px;
    }
    .dashboard-content {
        padding: 10px;
        gap: 12px;
    }
    .panel {
        padding: 12px;
    }

    h1 {
        font-size: 0.85rem;
        letter-spacing: 0.5px;
    }
    .nav-right {
        font-size: 0.7rem;
        gap: 10px;
    }

    /* Drive Tracker */
    .summary-card {
        flex: 1 1 calc(50% - 6px);
    }
    .summary-card .value {
        font-size: 1.1rem;
    }

    .left-sidebar {
        flex-direction: column;
    }
    .left-sidebar .panel {
        flex: 1 1 100%;
    }

    .drive-box {
        width: 76px;
        height: 80px;
    }

    .log-label {
        width: 56px;
        font-size: 0.55rem;
    }
    .grid-lines span {
        width: 16px;
        font-size: 0.55rem;
    }

    .footer-btn {
        padding: 10px 4px;
        font-size: 0.65rem;
    }

    /* Player Card */
    .player-info h1 {
        font-size: 24px !important;
    }
    .kpi-container {
        flex: 1 1 100% !important;
    }
    .kpi-card .value {
        font-size: 32px !important;
    }
    .dot-plot-panel {
        flex: 1 1 100% !important;
        height: 220px;
    }
    .scatter-panel {
        height: 280px;
    }
    .trend-chart {
        height: 180px;
    }
    .pos-toggle {
        gap: 14px !important;
        font-size: 12px !important;
    }
}
