/* =================================================================================
   SECTION 1: ROOT & GLOBAL STYLES
================================================================================= */
:root {
    /* Fonts */
    --font-sans: 'Roboto', sans-serif;
    --font-header: 'Oswald', sans-serif;
    --font-mono: 'Roboto Mono', monospace;

    /* Colors */
    --bg-color: #F4F7F6;
    --panel-bg: #FFFFFF;
    --border-color: #DDE1E3;
    --text-primary: #1A1A1A;
    --text-secondary: #5C5C5C;
    --text-light: #9A9A9A;

    --color-home: #004A99;
    --color-away: #D50032;
    --color-accent: #FFC72C; /* A neutral accent for buttons etc */

    --star-color: #E6A800;
}

/* FIX 1: Set base font size to 12px (75% of 16px).
  This scales all `rem` units down globally.
*/
html {
    font-size: 12px;
    height: 100%;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    /* MODIFIED: Disable text selection globally */
    user-select: none;
    -webkit-user-select: none; /* Safari */
    -moz-user-select: none; /* Firefox */
    -ms-user-select: none; /* IE10+/Edge */
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    padding: 1.25rem;
    overflow-x: hidden;
}

/* =================================================================================
   SECTION 2: LAYOUT & PANELS
================================================================================= */
.console-grid {
    display: grid;
    /*
      FIX 1: Scaled all px values by 75%
      (e.g., 280px -> 210px, 700px -> 525px)
    */
    grid-template-columns: minmax(210px, 240px) minmax(375px, 525px) minmax(210px, 240px);
    gap: 1.25rem;
    width: 100%;
    max-width: 1020px; /* Scaled by 75% (was 1360px) */
    justify-content: center; /* Center the grid if viewport is > 1020px */
}

.console-column {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-width: 0; /* Prevents flex/grid items from overflowing */
}

.center-column {
    max-width: 100%; /* Ensure it doesn't overflow grid cell */
}

.panel {
    background-color: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    position: relative;
}

.panel-header {
    padding: 1rem 1.25rem;
    font-family: var(--font-header);
    font-size: 1.15rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center; /* MODIFICATION: Center all headers */
    position: relative; /* MODIFICATION: For absolute close button */
}

.panel-content {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Responsive Layout */

/* FIX 1: Scaled breakpoint by 75% (was 992px) */
@media (max-width: 900px) {
    .console-grid {
        /* This breakpoint is good. It stacks the center column. */
        grid-template-columns: 1fr 1fr;
        max-width: 100%;
    }
    .center-column {
        grid-column: 1 / -1;
        order: 1;
        /* min-width: 0 is still needed here for flex/grid children */
        min-width: 0; 
    }
    .left-column { order: 2; }
    .right-column { order: 3; }
}

@media (max-width: 450px) {
    body { padding: 0.5rem; }
    .console-grid {
        /* This breakpoint is also good. It stacks all columns. */
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .panel-content { padding: 1rem; }
    .panel-header { padding: 0.75rem 1rem; }
    .center-column {
         /* The order properties from 744px will carry over */
         min-width: 0;
     }

    .scoreboard-score {
        transform: scale(0.5);
    }

}

/* =================================================================================
   SECTION 3: SCOREBOARD & BOX SCORE (CENTER)
================================================================================= */

.combined-scoreboard-panel {
    padding: 0;
}

/* Rebuilt scoreboard styles for new HTML structure */
.scoreboard-main {
    display: grid; 

    grid-template-columns: minmax(0, 1fr) auto auto auto minmax(0, 1fr); 
    align-items: center;
    padding: 1.25rem 1.5rem;
    gap: 1rem; 
}

.scoreboard-name {
    font-family: var(--font-header);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%; 
}
#scoreboard-home-name {
    text-align: left;
    color: var(--color-home);
}
#scoreboard-away-name {
    text-align: right;
    color: var(--color-away);
}

.scoreboard-score {
    font-family: var(--font-header);
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.1;
    /* FIX 1: Scaled by 75% (was 90px) */
    min-width: 68px;
    text-align: center;
}

.scoreboard-info {
    text-align: center;
    margin-top: 0; 
    justify-self: center; 
}

.quarter-display {
    font-family: var(--font-header);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    background-color: var(--bg-color);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    text-transform: uppercase;
    white-space: nowrap;
    min-width: 105px; 
    text-align: center;
    display: inline-block;
}

.quarter-score-table {
    padding: 0.75rem 1.25rem 1rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-color);
}
.q-score-row {
    display: grid;
    grid-template-columns: 2fr repeat(5, 1fr) 1.2fr;
    text-align: center;
    padding: 0.35rem 0;
    font-family: var(--font-mono);
    font-size: 0.95rem;
}
.q-score-row.header {
    font-family: var(--font-header);
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-bottom: 0.25rem;
}
.q-score-row span:first-child {
    text-align: left;
    font-weight: 700;
    font-family: var(--font-header);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.q-score-row span:last-child {
    font-weight: 700;
}
.q-score-row .ot-col {
    display: none;
}
.q-score-row.show-ot .ot-col {
    display: block;
}
#home-q-score-row span:first-child { color: var(--color-home); }
#away-q-score-row span:first-child { color: var(--color-away); }


.box-score-panel {
    flex-grow: 1;
}
.box-score-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem 1.25rem 1.25rem;
}

.box-score-row {
    display: grid;
    /* FIX 1: Scaled by 75% (was 160px) */
    grid-template-columns: 1fr 120px 1fr;
    text-align: center;
    align-items: center;
}
.box-score-row.header {
    font-family: var(--font-header);
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
    /* FIX 1: Scaled by 75% (was 160px) */
    grid-template-columns: 1fr 120px 1fr;
}

.box-score-row .team-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.box-score-row .team-name:first-child { text-align: left; }
.box-score-row .team-name:last-child { text-align: right; }

/* === Font Improvement for Box Score Acronyms === */
.box-score-row.header .team-name {
    font-family: var(--font-mono);
    font-weight: 700;
}

.box-score-row .stat-name {
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 0.9rem; /* Made slightly larger */
    white-space: nowrap;
    color: var(--text-secondary);
}

/* === Font Improvement for Box Score Numbers === */
.box-score-row span:not(.stat-name) {
    font-family: var(--font-mono);
    font-size: 1.15rem;  /* Was 1.1rem */
    font-weight: 700;    /* Was 500 */
    white-space: nowrap; /* Prevents wrapping */
    overflow: hidden; /* Prevents horizontal overflow */
    text-overflow: ellipsis; /* Adds "..." if too small */
}
.box-score-row span:first-child { text-align: left; }
.box-score-row span:last-child { text-align: right; }

/* === NEW: Box Score Period Toggle === */
.box-score-period-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.period-arrow {
    background: none;
    border: none;
    font-family: var(--font-mono);
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0 0.25rem;
}
.period-arrow:hover { color: var(--text-primary); }
#box-period-display {
    font-family: var(--font-header); /* 'Oswald' */
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    /* FIX 1: Scaled by 75% (was 60px) */
    width: 45px; 
    text-align: center;
    text-transform: uppercase;
}


/* === Sim Controls Panel === */
.sim-controls {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
}

.sim-speed-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 0.75rem;
}

.sim-sub-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.btn-sim {
    font-family: var(--font-header);
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background-color: var(--color-home);
    color: #FFF;
    transition: all 0.2s ease;
}
.btn-sim:hover:not(:disabled) {
    background-color: #00336A;
}
.btn-sim:disabled {
    background-color: var(--text-light);
    cursor: not-allowed;
}

.btn-sim.secondary {
    font-size: 1rem;
    padding: 0.75rem 1rem;
    background-color: var(--panel-bg);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}
.btn-sim.secondary:hover:not(:disabled) {
    background-color: var(--bg-color);
    border-color: var(--text-secondary);
}

.btn-speed {
    font-family: var(--font-header);
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.75rem 0.5rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background: var(--panel-bg);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-speed:hover {
    background: var(--bg-color);
    border-color: var(--text-secondary);
}
.btn-speed.active {
    background: var(--text-primary);
    color: var(--panel-bg);
    border-color: var(--text-primary);
}


/* =================================================================================
   SECTION 4: STRATEGY PANELS (LEFT & RIGHT)
================================================================================= */
.team-logo {
    font-family: var(--font-header);
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 0;
    background-color: var(--bg-color);
    border-top-left-radius: 7px;
    border-top-right-radius: 7px;
}
#home-logo { color: var(--color-home); }
#away-logo { color: var(--color-away); }

.team-select {
    font-family: var(--font-header);
    font-size: 1.15rem;
    font-weight: 700;
    text-transform: uppercase;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    cursor: pointer;
    max-width: 100%;
    width: 100%;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}
#home-team-select { color: var(--color-home); }
#away-team-select { color: var(--color-away); }
.team-select:focus { outline: none; }
.team-select:disabled {
    background-color: var(--border-color);
    cursor: not-allowed;
    opacity: 0.7;
}


.ratings-display {
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
}
.ratings-table {
    margin: 0 auto;
    border-collapse: collapse;
    max-width: 300px;
}
.rating-item .rating-label {
    font-family: var(--font-header);
    font-size: 0.9rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    text-align: left;
    padding: 0.25rem 0;
    padding-right: 1rem;
}
.rating-item .rating-value {
    text-align: left;
    height: 1.2rem;
}
.star-rating {
    font-family: var(--font-mono);
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -1px;
    color: var(--star-color);
}
#home-ratings-display .star-rating { color: var(--color-home); }
#away-ratings-display .star-rating { color: var(--color-away); }

.ai-toggle-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}
.ai-toggle-group label {
    font-family: var(--font-header);
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
}
.ai-toggle {
    width: 20px;
    height: 20px;
    cursor: pointer;
}
.ai-toggle:disabled + label,
.ai-toggle:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.gameplan-header {
    font-family: var(--font-header);
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    text-align: center;
    letter-spacing: 0.05em;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.75rem;
}


.slider-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.slider-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 700;
}
.slider-label span:not(.slider-value) {
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: var(--font-header);
    flex-grow: 1;
}
.slider-value {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1rem;
    background-color: var(--bg-color);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 10px;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: var(--bg-color);
    border-radius: 5px;
    outline: none;
    border: 1px solid var(--border-color);
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--text-primary);
    border: 2px solid var(--panel-bg);
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
    cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--text-primary);
    border: 2px solid var(--panel-bg);
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
    cursor: pointer;
}

/* Active Slider Thumbs */
#home-controls input[type="range"]::-webkit-slider-thumb { background: var(--color-home); }
#home-controls input[type="range"]::-moz-range-thumb { background: var(--color-home); }
#away-controls input[type="range"]::-webkit-slider-thumb { background: var(--color-away); }
#away-controls input[type="range"]::-moz-range-thumb { background: var(--color-away); }

/* Disabled Sliders */
input[type="range"]:disabled::-webkit-slider-thumb {
    background: var(--text-light);
    cursor: not-allowed;
}
input[typeA="range"]:disabled::-moz-range-thumb {
    background: var(--text-light);
    cursor: not-allowed;
}
input[type="range"]:disabled {
    background: var(--border-color);
    opacity: 0.7;
}


.slider-description {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 500;
}

/* =================================================================================
   SECTION 5: TOOLTIPS
================================================================================= */
.tooltip {
    position: relative;
    display: inline-block;
    z-index: 5;
}

.tooltip > span {
    /* FIX 1: Scaled by 75% (was 16px) */
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--text-light);
    color: var(--panel-bg);
    font-size: 0.75rem;
    font-weight: 700;
    /* FIX 1: Scaled by 75% (was 16px) */
    line-height: 12px;
    text-align: center;
    cursor: help;
    display: block;
}
.slider-label .tooltip {
    order: -1;
    margin-right: 8px;
}
.ai-toggle-group .tooltip {
    margin-right: -4px;
}


.tooltip .tooltip-text {
    visibility: hidden;
    /* FIX 1: Scaled by 75% (was 280px) */
    width: 210px;
    background-color: #1A1A1A;
    color: #FFF;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.5;
    text-align: left;
    text-transform: none;
    letter-spacing: 0;
    border-radius: 6px;
    padding: 0.75rem;

    position: absolute;
    z-index: 10;
    bottom: 125%;
    left: 50%;
    /* FIX 1: Scaled by 75% (was -140px) */
    margin-left: -105px;

    opacity: 0;
    transition: opacity 0.3s;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.tooltip .tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #1A1A1A transparent transparent transparent;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

.tooltip-text b {
    color: var(--color-accent);
}

/* =================================================================================
   SECTION 6: MODAL & ROSTER EDITOR
================================================================================= */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-panel {
    width: 100%;
    max-width: 600px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.modal-panel .panel-content {
    overflow-y: auto;
}

.modal-close {
    font-family: var(--font-sans);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    color: var(--text-light);
    background: none;
    border: none;
    cursor: pointer;
    /* margin-left: auto; */ /* MODIFICATION: Removed */
    padding: 0;
    position: absolute; /* MODIFICATION: Pulled from layout */
    right: 1.25rem; /* MODIFICATION: Positioned manually */
    top: 50%; /* MODIFICATION: Center vertically */
    transform: translateY(-50%); /* MODIFICATION: Center vertically */
}
.modal-close:hover {
    color: var(--text-primary);
}

.modal-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.modal-textarea {
    width: 100%;
    min-height: 250px !important;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    padding: 0.75rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    resize: vertical;
}
.modal-textarea:focus {
    outline: none;
    border-color: var(--color-home);
    box-shadow: 0 0 0 3px rgba(0, 74, 153, 0.2);
}

.modal-error {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-away);
    background-color: rgba(213, 0, 50, 0.05);
    border: 1px solid rgba(213, 0, 50, 0.2);
    padding: 0.75rem;
    border-radius: 6px;
}

/* =================================================================================
   SECTION 7: PLAY-BY-PLAY PANEL
================================================================================= */

.pbp-panel .panel-content {
    /* FIX 1: Scaled by 75% (was 250px) */
    height: 225px;
    overflow-y: scroll;
    padding: 0.75rem 1rem;
    gap: 0.75rem;
}

.pbp-entry {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    line-height: 1.4;
    color: var(--text-secondary);
    padding-bottom: 0.75rem;
    border-bottom: 1px dashed var(--border-color);
    text-align: center;
}

.pbp-panel .panel-content:first-child {
    padding-bottom: 0;
    border-bottom: none;
}

.pbp-entry.score {
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
}

.pbp-entry.home {
    border-left: 3px solid var(--color-home);
    padding-left: 0.5rem;
    text-align: center;
}

.pbp-entry.away {
    border-left: 3px solid var(--color-away);
    padding-left: 0.5rem;
    text-align: center;
}

.pbp-entry.system {
    font-weight: 700;
    text-align: center;
    color: var(--text-primary);
    border: none;
    padding-left: 0;
    padding-bottom: 0.75rem;
    border-bottom: 1px dashed var(--border-color);
}
/* =================================================================================
   SECTION 8: CHALLENGE MODE & MENU SCREENS
================================================================================= */

/* Challenge setup screen styles */
.challenge-step {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.challenge-step-header {
    font-family: var(--font-header);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.challenge-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 1rem 0;
}

.challenge-input-grid {
    display: grid;
    grid-template-columns: 1fr; /* Default to 1 column */
    gap: 0.75rem;
}

/* FIX 1: Scaled breakpoint by 75% (was 680px) */
@media (min-width: 510px) {
    .challenge-input-grid {
        /* This component-level media query is good practice. */
        grid-template-columns: 1fr 1fr;
    }
}


.challenge-input-group {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1rem;
    align-items: center;
}
.challenge-input-group label {
    font-family: var(--font-header);
    font-size: 1rem;
    font-weight: 500;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.challenge-team-name-input {
    font-family: var(--font-header);
    font-size: 1rem;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-color);
    color: var(--text-primary);
    transition: all 0.2s ease;
}
.challenge-team-name-input:focus {
    outline: none;
    border-color: var(--color-home);
    box-shadow: 0 0 0 3px rgba(0, 74, 153, 0.2);
}
#challenge-team-abbr {
    text-transform: uppercase;
}
#challenge-team-abbr::placeholder {
    text-transform: none;
}


.challenge-stars-display {
    text-align: center;
    font-size: 1.2rem;
    font-family: var(--font-header);
    font-weight: 500;
    margin-top: 1rem;
}

#challenge-builder-sliders {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-top: 1rem;
}

/* FIX 1: Scaled breakpoint by 75% (was 680px) */
@media (min-width: 510px) {
    #challenge-builder-sliders {
        /* This component-level media query is good practice. */
        grid-template-columns: 1fr 1fr;
    }
}


/* Roadmap grid */
#roadmap-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    border-radius: 6px;
    background-color: var(--bg-color);
    /* FIX 1: Scaled by 75% (was 400px) */
    max-height: 300px;
    overflow-y: auto;
}

/* FIX 1: Scaled breakpoint by 75% (was 600px) */
@media (max-width: 450px) {
    #roadmap-grid {
        /* This component-level media query is good practice. */
        grid-template-columns: 1fr;
    }
}

.roadmap-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background-color: var(--panel-bg);
    border-radius: 4px;
    border: 1px solid var(--border-color);
    opacity: 0.6;
    transition: all 0.2s ease;
    flex-wrap: wrap;
}

.roadmap-logo {
    font-family: var(--font-header);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-secondary);
    min-width: 40px;
    flex-shrink: 0;
    text-align: center;
}

.roadmap-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    flex-grow: 1;
}

.roadmap-item.beaten {
    opacity: 1;
    background-color: var(--bg-color);
}
.roadmap-item.beaten .roadmap-name {
    text-decoration: line-through;
    color: var(--text-light);
}
.roadmap-item.beaten .roadmap-logo {
    color: var(--text-light);
}

.roadmap-item.next {
    opacity: 1;
    border-color: var(--color-home);
    box-shadow: 0 0 0 3px rgba(0, 74, 153, 0.2);
}
.roadmap-item.next .roadmap-name {
    font-weight: 700;
    color: var(--text-primary);
}
.roadmap-item.next .roadmap-logo {
    color: var(--color-home);
}

.roadmap-score {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    margin-left: auto;
}

.roadmap-score.win {
    background-color: var(--color-home);
    color: white;
}

.roadmap-item.lost {
    opacity: 1;
    background-color: rgba(213, 0, 50, 0.05); /* Faint red */
    border-color: var(--color-away);
}
.roadmap-item.lost .roadmap-name {
    font-weight: 700;
    color: var(--color-away);
}
.roadmap-item.lost .roadmap-logo {
    color: var(--color-away);
}

.roadmap-score.loss {
    background-color: var(--color-away);
    color: white;
}

#btn-roadmap-next-game:disabled {
    background-color: var(--text-light);
    border-color: var(--border-color);
    cursor: not-allowed;
}

/* Star Rating Styles for Challenge Setup */
.challenge-rating-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--bg-color);
    padding: 0.75rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}
.challenge-rating-label {
    font-family: var(--font-header);
    font-size: 1rem;
    font-weight: 500;
    text-transform: uppercase;
    color: var(--text-secondary);
}
.challenge-stars-container {
    display: flex;
    gap: 0.25rem;
}
.challenge-stars-container .star {
    font-size: 2rem;
    color: var(--border-color);
    cursor: pointer;
    transition: all 0.1s ease;
}
.challenge-stars-container .star:hover {
    color: var(--star-color);
    opacity: 0.7;
}
.challenge-stars-container .star.active {
    color: var(--star-color);
    opacity: 1;
}

/* =================================================================================
   SECTION 9: WIN PROBABILITY CHART
================================================================================= */

.wp-panel-content {
    padding: 1rem 1rem;
}

.wp-chart-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem; /* MODIFICATION: Increased gap */
    width: 100%;
}

#wp-chart {
    display: block;
    height: 75pt;
    max-width: 300px;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    flex: 1 1 auto; /* MODIFICATION: Allow canvas to flex */
    min-width: 0; /* MODIFICATION: Allow canvas to shrink */
}

.wp-label {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 700;
    text-align: center;
    min-width: 50px;
    flex: 0 0 50px; /* MODIFICATION: Constrain label width */
}

.wp-label.home { color: var(--color-home); }
.wp-label.away { color: var(--color-away); }

/* =================================================================================
   SECTION 10: USER-SELECT FIX
================================================================================= */

/* Re-enable text selection for textareas */
textarea {
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

textarea,
input[type="text"] {
    user-select: text;
    -webkit-user-select: text; /* Safari */
    -moz-user-select: text; /* Firefox */
    -ms-user-select: text; /* IE10+/Edge */
}

/* =================================================================================
   SECTION 11: DRAFT MODE
================================================================================= */

#draft-player-choices {
    display: grid;
    /* FIX 1: Scaled by 75% (was 250px) */
    grid-template-columns: repeat(auto-fit, minmax(188px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.draft-player-card {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.draft-player-card:hover {
    border-color: var(--color-home);
    box-shadow: 0 0 0 3px rgba(0, 74, 153, 0.2);
    transform: translateY(-2px);
}

.draft-card-name {
    font-family: var(--font-header);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.draft-card-pos {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    display: block;
    margin-bottom: 0.75rem;
}

.draft-card-ratings {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.draft-card-ratings li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 500;
}

.draft-card-ratings li span:first-child {
    color: var(--text-secondary);
    font-weight: 700;
}

.draft-card-ratings .star-rating {
    font-size: 1.1rem; /* Make stars in cards slightly smaller */
    color: var(--star-color);
}


/* =================================================================================
   SECTION 12: ROSTER SUMMARY
================================================================================= */
.roster-summary-header {
    font-family: var(--font-header);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-home);
    text-transform: uppercase;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-top: 0.5rem;
}
.roster-summary-header:first-of-type {
    margin-top: 0;
}

.roster-summary-list {
    list-style: none;
    padding: 0;
    margin: 0.75rem 0 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.roster-summary-list li {
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 500;
    background-color: var(--bg-color);
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}
.roster-summary-list li span {
    font-family: var(--font-header);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-left: 0.5rem;
}

/* Add to style.css */
.roster-adjustment-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1rem;
    margin-bottom: 1.5rem;
}

.roster-column h4 {
    font-family: var(--font-header);
    text-align: center;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
}

.roster-adjust-list {
    list-style: none;
    padding: 0.75rem;
    margin: 0;
    background-color: var(--bg-color);
    border: 1px dashed var(--border-color);
    border-radius: 6px;
    /* FIX 1: Scaled by 75% (was 200px) */
    min-height: 150px; /* Ensure drop zone is always visible */
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.roster-player-item {
    background-color: var(--panel-bg);
    border: 1px solid var(--border-color);
    padding: 0.6rem 1rem;
    border-radius: 4px;
    cursor: grab;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.roster-player-item:active {
    cursor: grabbing;
    opacity: 0.7;
}
.roster-player-item span { /* Style for Position */
    font-family: var(--font-header);
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-left: 0.5rem;
    background: var(--bg-color);
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
}

/* Drag feedback */
.roster-adjust-list.drag-over {
    border-color: var(--color-home);
    background-color: #e8f0fe; /* Light blue */
}
.roster-player-item.dragging {
    opacity: 0.5;
    border-style: dashed;
}

/* This is the visual indicator for where the item will be dropped */
.roster-player-item.drag-over-indicator {
    border-top: 3px solid var(--color-home);
}

@media (max-width: 450px) {
    .roster-adjustment-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 400px) {
    
    .scoreboard-main {
    display: grid; 
    grid-template-columns: auto auto auto auto auto; 
    align-items: center;
    padding: 1rem 1rem;
    }

    .scoreboard-score {
        min-width: 0;
    }

    .quarter-display {
        font-size: 80%;
        min-width: 50pt;
    }
}
/* =================================================================================
   SECTION 13: ENHANCED ROSTER MODAL
================================================================================= */

#roster-modal .modal-panel {
    max-width: 900px;
}

.modal-content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    width: 100%;
}

.modal-editor-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.modal-editor-header {
    font-family: var(--font-header);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-align: center;
}

#roster-modal .modal-textarea {
    min-height: 400px; /* Give more space */
    flex-grow: 1;
}

@media (max-width: 768px) {
    .modal-content-grid {
        grid-template-columns: 1fr;
    }
    #roster-modal .modal-textarea {
        min-height: 180px;
    }
}

/*FOOTBALL EXTRA*/

.down-distance-display {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
    margin-bottom: 0.25rem;
    min-height: 1.2em; /* Prevents layout jump when text is empty */
}

@media (max-width: 400px) {
    .down-distance-display {
        font-size: 70%;
    }
}

@media (max-width: 600px) {
    .down-distance-display {
        font-size: 80%;
    }
}

/* [ADD] to the end of style.css SECTION 3 */
.box-score-row .stat-name.indented {
    padding-left: 1.5rem;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.box-score-row.divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 0.5rem 0;
    padding: 0;
}

/* =================================================================================
   SECTION 14: MOBA BOX SCORE GRID
================================================================================= */

.champ-stats-grid {
    display: grid;
    grid-template-columns: 2fr 1.2fr 1fr 1fr; /* Name, KDA, CS, Gold */
    gap: 0.75rem;
    padding: 0.35rem 0;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 1.1rem;
}

.champ-stats-grid span:first-child {
    font-family: var(--font-header);
    font-weight: 700;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.champ-stats-grid.header {
    font-family: var(--font-header);
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-bottom: 0.25rem;
}

.champ-stats-grid.header span {
    font-family: var(--font-header);
    font-weight: 700;
    font-size: 0.85rem;
}

.champ-stats-grid.blue span:first-child { 
    color: var(--color-home); 
}

.champ-stats-grid.red span:first-child { 
    color: var(--color-away); 
}

/* Add this to style.css */
.champ-select {
    font-family: var(--font-header);
    font-size: 1.15rem;
    font-weight: 700;
    text-transform: uppercase;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    cursor: pointer;
    max-width: 100%;
    width: 100%;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}
.champ-select:focus { outline: none; }
.champ-select:disabled {
    background-color: var(--border-color);
    cursor: not-allowed;
    opacity: 0.7;
}

.champ-stats-grid {
    display: grid;
    /* OLD: grid-template-columns: 2fr 1.2fr 1fr 1fr; */
    /* NEW: */
    grid-template-columns: 2fr 1.2fr 0.8fr 0.8fr 0.8fr 0.8fr 0.8fr; /* Name, KDA, CS, Gold, Dmg, Twr, DmgTkn */
    gap: 0.75rem;
    padding: 0.35rem 0;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 1.1rem;
}

.champ-stats-grid.header {
    /* ... (other styles) ... */
    font-size: 0.8rem; /* Make header text a bit smaller to fit */
}

/* =================================================================================
   SECTION 15: BOX SCORE STAT BARS
================================================================================= */
.stat-bar-container {
    position: relative;
    width: 100%;
    height: 1.5rem; /* 18px */
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    font-family: var(--font-mono);
    font-weight: 700;
}

.stat-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background-color: var(--text-light);
    transition: width 0.3s ease;
    min-width: 2px; /* Ensure bar is visible even at 0% */
}

.stat-bar-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.9rem; /* 11px */
    color: var(--text-primary);
    /* This blend mode makes the text color invert against the bar behind it */
    mix-blend-mode: exclusion;
    filter: invert(1);
    white-space: nowrap;
}

/* Bar Colors */
.dmg-bar { background-color: var(--color-accent); } /* Yellow */
.twr-dmg-bar { background-color: var(--color-home); } /* Blue */
.dmg-tkn-bar { background-color: var(--color-away); } /* Red */

#btn-roadmap-quit {
    display: none;
}

.pbp-entry.home {
    /* ... existing styles ... */
    color: var(--color-home);
    font-weight: 500;
}

.pbp-entry.away {
    /* ... existing styles ... */
    color: var(--color-away);
    font-weight: 500;
}

/* These will color team names inside system messages */
.log-blue {
    color: var(--color-home);
    font-weight: 700;
    font-style: normal; /* Overrides the .system's italic style */
}

.log-red {
    color: var(--color-away);
    font-weight: 700;
    font-style: normal; /* Overrides the .system's italic style */
}

@media (max-width: 450px) {
    .champ-stats-grid {
        font-size: 80% !important;
    }
    .stat-bar-value {
        font-size: 55%;
    }
}