/* 
  SENADO RACING - F1 Style Graphics Design System
  Color Palette:
  - Racing Red: #e10600
  - Carbon Black: #15151e
  - Asphalt Gray: #38383f
  - Pure White: #ffffff
  - Live Green: #00ff41
*/

:root {
    --f1-red: #e10600;
    --f1-black: #15151e;
    --f1-dark-gray: #1f1f27;
    --f1-medium-gray: #38383f;
    --f1-light-gray: #949498;
    --f1-white: #ffffff;
    --f1-green: #00ff41;
    --f1-yellow: #ffd700;
    --font-main: 'Outfit', sans-serif;
    --font-heading: 'Outfit', sans-serif;
}

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

body {
    background-color: var(--f1-black);
    color: var(--f1-white);
    font-family: var(--font-main);
    overflow-x: hidden;
    min-height: 100vh;
}


/* Header Section */
header {
    border-bottom: 4px solid var(--f1-red);
    padding: 1rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(21, 21, 30, 0.95);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-container h1 {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: 1px;
}

.header-controls {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    font-family: 'monospace';
    text-transform: uppercase;
    font-size: 0.9rem;
}

.zoom-control {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-right: 1rem;
}

#zoom-slider {
    width: 100px;
    accent-color: var(--f1-red);
    cursor: pointer;
}

.header-btn {
    border: none;
    padding: 8px 12px;
    font-weight: 900;
    font-family: var(--font-main);
    cursor: pointer;
    font-size: 0.85rem;
    border-radius: 4px;
    text-transform: uppercase;
    transition: transform 0.1s, filter 0.2s;
}

.header-btn:hover {
    filter: brightness(1.2);
    transform: scale(1.05);
}

.header-btn:active {
    transform: scale(0.95);
}

.btn-blue { background: #0055ff; color: white; }
.btn-dark { background: #333; color: white; font-size: 1.2rem; padding: 4px 10px; }
.btn-yellow { background: var(--f1-yellow, #ffd700); color: black; }
.btn-green { background: var(--f1-green); color: black; }
.btn-red { background: var(--f1-red); color: white; }

.ticker-item {
    display: flex;
    flex-direction: column;
    margin: 0 0.5rem;
}

.ticker-label {
    color: var(--f1-light-gray);
    font-size: 0.7rem;
}

.ticker-value {
    font-weight: bold;
    font-size: 1rem;
}

/* Dashboard Container */
main {
    padding: 2rem 5%;
    max-width: 1400px;
    margin: 0 auto;
}

.status-bar {
    background: #222;
    border-top: 1px solid #444;
    border-bottom: 1px solid #444;
    padding: 10px 15px;
    margin-bottom: 20px;
    font-family: var(--font-main);
    font-weight: bold;
    color: var(--f1-light-gray);
}

/* --- DIRECTOR'S HUD --- */
#director-hud {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 300px;
    background: rgba(15, 15, 20, 0.95);
    border: 1px solid var(--f1-medium-gray);
    border-left: 4px solid var(--f1-red);
    padding: 15px;
    z-index: 2000;
    box-shadow: -10px 10px 30px rgba(0,0,0,0.8);
    font-family: var(--font-main);
}

.hud-header {
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--f1-white);
    border-bottom: 2px solid var(--f1-medium-gray);
    padding-bottom: 5px;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.hud-item {
    background: #222;
    padding: 10px;
    margin-bottom: 8px;
    border-left: 3px solid var(--f1-light-gray);
    font-size: 1rem;
    display: flex;
    flex-direction: column;
}

.hud-item.live {
    border-left-color: var(--f1-green);
    background: rgba(0, 255, 65, 0.1);
}

.hud-item.warning {
    border-left-color: var(--f1-red);
    background: rgba(225, 6, 0, 0.1);
    animation: hudWarn 1s infinite alternate;
}

@keyframes hudWarn {
    from { background: rgba(225, 6, 0, 0.1); }
    to { background: rgba(225, 6, 0, 0.3); }
}

/* AV ROUTING TAGS */
.room-tag {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.95rem;
    font-weight: 900;
    margin-top: 2px;
    background: #444;
    color: white;
}

.room-blue { background: #0055ff; }
.room-green { background: #00aa00; }
.room-purple { background: #7700ff; }
.room-orange { background: #ff7700; }

/* TELEMETRY BLOCK WARNINGS */
.telemetry-block.warning-15m {
    border: 2px solid #ffcc00;
    animation: warnYellow 2s infinite alternate;
}

@keyframes warnYellow {
    from { box-shadow: 0 0 10px rgba(255, 204, 0, 0.2); }
    to { box-shadow: 0 0 30px rgba(255, 204, 0, 0.6); }
}

.telemetry-block.warning-5m {
    border: 2px solid var(--f1-red);
    animation: warnRed 0.5s infinite alternate;
}

@keyframes warnRed {
    from { box-shadow: 0 0 10px rgba(225, 6, 0, 0.5); background-color: rgba(225, 6, 0, 0.8) !important; }
    to { box-shadow: 0 0 40px rgba(225, 6, 0, 1); background-color: rgba(225, 6, 0, 1) !important; }
}

/* bg scanlines removed */


.grid-header {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding-left: 1rem;
    border-left: 4px solid var(--f1-light-gray);
}

.grid-header h2 {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    color: var(--f1-white);
}

/* Racing Cards (The Grid) */
.racing-grid {
    position: relative;
    min-height: 500px; /* JS sets exact height dynamically */
    width: 95%;
    max-width: 1300px;
    margin: 30px auto;
    background: #151515;
    border-left: 1px solid #444;
    border-right: 1px solid #444;
    border-bottom: 1px solid #444;
    display: flex;
}

.lane {
    flex: 1;
    height: 100%;
    border-right: 1px dashed rgba(255,255,255,0.05);
    position: relative;
    background: repeating-linear-gradient(0deg, #111, #111 200px, #151515 200px, #151515 400px);
}

.lane::before {
    position: sticky;
    top: 50px;
    display: block;
    text-align: center;
    font-size: 1.1rem;
    color: var(--f1-white);
    background: var(--f1-red);
    font-weight: 900;
    padding: 4px 0;
    z-index: 50;
    text-transform: uppercase;
}

.lane:nth-child(1)::before { content: "JANUX 1"; }
.lane:nth-child(2)::before { content: "JANUX 2"; }
.lane:nth-child(3)::before { content: "JANUX 3"; }
.lane:nth-child(4)::before { content: "JANUX 4"; }
.lane:nth-child(5)::before { content: "JANUX 5"; }
.lane:nth-child(6)::before { content: "JANUX 6"; }
.lane:nth-child(7)::before { content: "SECRET"; }


.lane:last-child {
    border-right: none;
}

/* Timeline/Finish Line (The Moving Bar) */
.timeline-marker {
    position: absolute; /* Moves along the track */
    left: -100px;
    width: 800px;
    height: 10px;
    background: #00f3ff;
    box-shadow: 0 0 30px #00f3ff, 0 0 60px rgba(0, 243, 255, 1);
    z-index: 1000;
    pointer-events: none;
    display: flex;
    align-items: center;
    transition: top 1s linear;
}



@keyframes markerNeon {
    from { filter: brightness(1) drop-shadow(0 0 5px #00f3ff); }
    to { filter: brightness(1.5) drop-shadow(0 0 15px #00f3ff); }
}


.timeline-marker::before {
    content: attr(data-label);
    position: absolute;
    left: 0;
    top: -25px;
    background: #00f3ff;
    color: #000;
    font-weight: 900;
    padding: 2px 10px;
    font-size: 0.7rem;
    clip-path: polygon(0 0, 90% 0, 100% 100%, 0 100%);
}

.timeline-marker::after {
    content: "";
    position: absolute;
    right: 0;
    width: 20px;
    height: 20px;
    background: #00f3ff;
    transform: rotate(45deg) translateX(50%);
}

/* CAR DESIGN */
.commission-card {
    background: transparent;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: auto;
    width: 100%;
    position: absolute;
    left: 0;
    transition: top 1s linear;
    cursor: pointer;
    z-index: 5;
}

.telemetry-block {
    width: 96%;
    position: relative;
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    padding: 8px;
    border: 2px solid rgba(255,255,255,0.4);
    border-left: 8px solid #fff; /* F1 accent line */
    overflow: hidden;
}

.block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.3);
    padding-bottom: 4px;
    margin-bottom: 4px;
}

.block-id {
    font-size: 1.6rem;
    font-weight: 900;
    color: white;
}

.block-time {
    font-size: 1.05rem;
    font-weight: bold;
    color: #fff;
    background: rgba(0,0,0,0.7);
    padding: 3px 8px;
    border-radius: 4px;
}

.block-title {
    font-size: 1.3rem;
    font-weight: 900;
    color: white;
    line-height: 1.2;
    flex-grow: 1;
    margin-top: 4px;
}

.block-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 4px;
}

.block-status {
    font-weight: 900;
    font-size: 1.2rem;
    color: #ffd700;
}

/* FIN Button */
.fin-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.6);
    font-family: var(--font-main);
    font-weight: 900;
    font-size: 0.7rem;
    padding: 4px 10px;
    cursor: pointer;
    border-radius: 3px;
    letter-spacing: 1px;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    text-transform: uppercase;
}

.fin-btn:hover {
    background: rgba(225, 6, 0, 0.4);
    border-color: var(--f1-red);
    color: white;
}

.fin-btn--active {
    background: rgba(0, 200, 80, 0.2) !important;
    border-color: #00c850 !important;
    color: #00c850 !important;
}

.fin-btn--active:hover {
    background: rgba(0, 200, 80, 0.4) !important;
    color: white !important;
}

/* Plenary Session Special Styling */
.telemetry-block.block-sala {
    border: 2px solid gold;
    border-left: 8px solid gold;
    background-color: #2a2005 !important;
}
.telemetry-block.block-sala .block-title {
    color: gold;
}

.commission-card.past {
    filter: grayscale(1) opacity(0.3);
}

.commission-card:hover .telemetry-block {
    filter: brightness(1.3);
}
/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: var(--f1-dark-gray);
    width: 100%;
    max-width: 800px;
    border-top: 5px solid var(--f1-red);
    padding: 3rem;
    position: relative;
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2rem;
    cursor: pointer;
    color: var(--f1-light-gray);
}

.modal-materia {
    margin-top: 2rem;
    line-height: 1.6;
    color: var(--f1-light-gray);
    font-size: 1.1rem;
}

/* SETUP PANEL */
#setup-panel {
    position: fixed;
    left: 0;
    top: 0;
    width: 350px;
    height: 100vh;
    background: #111;
    border-right: 2px solid var(--f1-medium-gray);
    z-index: 3000;
    padding: 20px;
    transform: translateX(0);
    transition: transform 0.3s ease;
    box-shadow: 10px 0 30px rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
}

#setup-panel.hidden {
    transform: translateX(-110%);
}

.setup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    color: var(--f1-white);
}

.setup-item {
    background: #1a1a1a;
    padding: 10px;
    margin-bottom: 10px;
    border-left: 3px solid var(--f1-yellow);
    display: flex;
    flex-direction: column;
}

.setup-item select {
    margin-top: 10px;
    padding: 5px;
    background: #333;
    color: white;
    border: 1px solid #555;
    font-family: var(--font-main);
}

.unassigned {
    background-color: #333 !important;
    opacity: 0.6;
    border-left: 6px solid #555 !important;
}

/* SPOTTER V3 UI ELEMENTS */
.collision-alert {
    background: repeating-linear-gradient(
        45deg,
        rgba(225, 6, 0, 0.9),
        rgba(225, 6, 0, 0.9) 10px,
        rgba(255, 204, 0, 0.9) 10px,
        rgba(255, 204, 0, 0.9) 20px
    ) !important;
    border: 3px solid #fff;
    animation: alertShake 0.5s infinite;
}

@keyframes alertShake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    50% { transform: translateX(0); }
    75% { transform: translateX(2px); }
    100% { transform: translateX(0); }
}

.hour-marker {
    position: absolute;
    left: 0;
    width: 100%;
    border-top: 1px dashed rgba(255,255,255,0.15);
    pointer-events: none;
    z-index: 10;
}

.hour-marker::after {
    content: attr(data-time);
    position: absolute;
    right: 5px;
    top: -10px;
    font-family: monospace;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.3);
    background: #000;
    padding: 0 5px;
}

#quick-assign-menu {
    position: absolute;
    background: rgba(15, 15, 20, 0.95);
    border: 1px solid var(--f1-light-gray);
    box-shadow: 0 5px 20px rgba(0,0,0,1);
    z-index: 5000;
    padding: 10px;
    border-radius: 4px;
    width: 180px;
}

#quick-assign-menu.hidden {
    display: none;
}

.qa-header {
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--f1-white);
    margin-bottom: 8px;
    text-align: center;
    border-bottom: 1px solid #444;
    padding-bottom: 4px;
}

.qa-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 5px;
}

.qa-grid button {
    background: #333;
    border: 1px solid #555;
    color: white;
    font-weight: 900;
    padding: 8px;
    cursor: pointer;
}

.qa-grid button:hover {
    background: var(--f1-red);
    border-color: white;
}

.qa-clear {
    grid-column: span 3;
    background: #222 !important;
    font-size: 0.75rem;
}

.qa-note {
    grid-column: span 3;
    background: var(--f1-yellow) !important;
    color: black !important;
    font-size: 0.8rem;
    margin-top: 5px;
}

.qa-note:hover {
    background: white !important;
}

/* Card Sticky Note */
.card-note {
    background: var(--f1-yellow);
    color: black;
    font-size: 0.85rem;
    font-weight: 900;
    padding: 4px 8px;
    margin-top: 6px;
    border-radius: 2px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
    white-space: pre-wrap;
    word-break: break-word;
    border-left: 4px solid black;
    position: relative;
}

#global-collision-banner {
    background: repeating-linear-gradient(
        45deg,
        rgba(225, 6, 0, 1),
        rgba(225, 6, 0, 1) 20px,
        rgba(255, 204, 0, 1) 20px,
        rgba(255, 204, 0, 1) 40px
    );
    color: black;
    font-family: var(--font-main);
    font-weight: 900;
    font-size: 1.5rem;
    text-transform: uppercase;
    text-align: center;
    padding: 15px;
    margin-top: 10px;
    border: 4px solid white;
    box-shadow: 0 0 30px rgba(225, 6, 0, 0.8);
    animation: alertShake 0.5s infinite;
}

#global-collision-banner.hidden {
    display: none;
    animation: none;
}

/* Status Overrides */
.qa-status-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    margin-top: 10px;
}

.qa-status-btn {
    border: none;
    padding: 8px 4px;
    font-family: var(--font-main);
    font-weight: 900;
    font-size: 0.7rem;
    cursor: pointer;
    border-radius: 2px;
    background: #333;
    color: white;
    transition: transform 0.1s;
}

.qa-status-btn:active {
    transform: scale(0.95);
}

.block-recess {
    border: 3px solid var(--f1-yellow) !important;
    animation: statusBlink 1s infinite alternate;
}

.block-forced-live {
    border: 3px solid var(--f1-green) !important;
}

@keyframes statusBlink {
    0% { opacity: 1; box-shadow: 0 0 5px var(--f1-yellow); }
    100% { opacity: 0.7; box-shadow: 0 0 20px var(--f1-yellow); }
}

/* === DRAG AND DROP === */

/* Card being dragged */
.commission-card.dragging {
    opacity: 0.35;
    cursor: grabbing;
}

/* Make cards feel draggable */
.commission-card {
    cursor: grab;
}
.commission-card:active {
    cursor: grabbing;
}

/* Lane lit up while a card hovers over it */
.lane.drop-target {
    background: repeating-linear-gradient(
        0deg,
        rgba(225, 6, 0, 0.08),
        rgba(225, 6, 0, 0.08) 200px,
        rgba(225, 6, 0, 0.14) 200px,
        rgba(225, 6, 0, 0.14) 400px
    );
    box-shadow: inset 0 0 40px rgba(225, 6, 0, 0.25);
    outline: 2px dashed rgba(225, 6, 0, 0.8);
    outline-offset: -2px;
    transition: background 0.1s ease, box-shadow 0.1s ease;
}

/* Green flash on successful drop */
.lane.drop-flash {
    animation: dropSuccess 0.4s ease-out forwards;
}

@keyframes dropSuccess {
    0%   { box-shadow: inset 0 0 60px rgba(0, 255, 65, 0.6); }
    100% { box-shadow: none; }
}

/* ================================================
   LIGHT MODE THEME
   Toggled via: body.light-mode
================================================ */

body.light-mode {
    background-color: #f2f2f7;
    color: #111118;
}

/* Header */
body.light-mode header {
    background: rgba(242, 242, 247, 0.96);
    border-bottom-color: var(--f1-red);
}
body.light-mode .header-btn.btn-dark {
    background: #555;
    color: #fff;
}
body.light-mode .ticker-label {
    color: #50505a;
}
body.light-mode .ticker-value {
    color: #111118;
}

/* Status bar */
body.light-mode .status-bar {
    background: #dcdce4;
    border-color: #bbbbc8;
    color: #444450;
}

/* Grid header */
body.light-mode .grid-header {
    border-left-color: #888;
}
body.light-mode .grid-header h2 {
    color: #111118;
}

/* Racing grid + lanes */
body.light-mode .racing-grid {
    background: #dddde8;
    border-color: #aaaabb;
}
body.light-mode .lane {
    background: repeating-linear-gradient(
        0deg,
        #f2f2f7,
        #f2f2f7 200px,
        #e8e8f0 200px,
        #e8e8f0 400px
    );
    border-right-color: rgba(0, 0, 0, 0.08);
}
body.light-mode .lane::before {
    background: var(--f1-red); /* keep red labels */
}

/* Hour markers */
body.light-mode .hour-marker {
    border-top-color: rgba(0, 0, 0, 0.12);
}
body.light-mode .hour-marker::after {
    color: rgba(0, 0, 0, 0.38);
    background: #f2f2f7;
}

/* Commission cards */
body.light-mode .telemetry-block {
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.14);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.09);
}
body.light-mode .block-header {
    border-bottom-color: rgba(0, 0, 0, 0.10);
}
body.light-mode .block-id {
    color: #111118;
}
body.light-mode .block-time {
    color: #111118;
    background: rgba(0, 0, 0, 0.07) !important;
}
body.light-mode .block-title {
    color: #111118;
}
body.light-mode .block-status {
    color: #967200 !important; /* dark gold — readable on white */
}
body.light-mode .fin-btn {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.12);
    color: #444;
}
body.light-mode .fin-btn:hover {
    background: rgba(225, 6, 0, 0.10);
    border-color: var(--f1-red);
    color: #111;
}

/* Unassigned cards */
body.light-mode .unassigned {
    background-color: #e0e0eb !important;
    border-left-color: #aaa !important;
    opacity: 0.75;
}

/* Plenary (Sala) cards — warm gold on light */
body.light-mode .telemetry-block.block-sala {
    background: #fffbea !important;
    border-color: #c8a800;
    border-left-color: #c8a800;
}
body.light-mode .telemetry-block.block-sala .block-title,
body.light-mode .telemetry-block.block-sala .block-id,
body.light-mode .telemetry-block.block-sala .block-time,
body.light-mode .telemetry-block.block-sala .block-status {
    color: #7a5c00 !important;
}

/* Director HUD */
body.light-mode #director-hud {
    background: rgba(242, 242, 247, 0.97);
    border-color: #ccccd8;
    border-left-color: var(--f1-red);
}
body.light-mode .hud-header {
    color: #111118;
    border-bottom-color: #ccccd8;
}
body.light-mode .hud-item {
    background: #e8e8f0;
    color: #111118;
}
body.light-mode .hud-item.live {
    background: rgba(0, 160, 50, 0.12);
    border-left-color: #00a832;
}
body.light-mode .hud-item.warning {
    background: rgba(225, 6, 0, 0.07);
}

/* Setup panel */
body.light-mode #setup-panel {
    background: #ededf5;
    border-right-color: #ccccd8;
}
body.light-mode .setup-header {
    color: #111118;
}
body.light-mode .setup-item {
    background: #ffffff;
    border-left-color: #b8860b;
    color: #111118;
}
body.light-mode .setup-item select {
    background: #ededf5;
    color: #111118;
    border-color: #ccc;
}
body.light-mode .close-btn {
    color: #444;
}

/* Quick-assign menu */
body.light-mode #quick-assign-menu {
    background: rgba(242, 242, 247, 0.98);
    border-color: #ccccd8;
}
body.light-mode .qa-header {
    color: #111118;
    border-color: #ccc;
}
body.light-mode .qa-grid button {
    background: #e2e2ec;
    border-color: #ccccd8;
    color: #111118;
}
body.light-mode .qa-grid button:hover {
    background: var(--f1-red);
    border-color: var(--f1-red);
    color: #fff;
}
body.light-mode .qa-status-btn {
    background: #e0e0eb;
    color: #111118;
}

/* Modal */
body.light-mode .modal-overlay {
    background: rgba(180, 180, 200, 0.88);
}
body.light-mode .modal-content {
    background: #f2f2f7;
}
body.light-mode #modal-title {
    color: #111118;
}
body.light-mode .modal-materia {
    color: #444450;
}
body.light-mode #modal-location {
    color: #50505a;
}
body.light-mode .close-modal {
    color: #666;
}
body.light-mode #day-start-hour,
body.light-mode #day-end-hour {
    background: #e0e0eb !important;
    color: #111118 !important;
    border-color: #bbb !important;
}

/* ================================================
   ELAPSED-TIME FILL
   Shades the "done" zone above the current time
================================================ */
#elapsed-fill {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.32);
    z-index: 2;
    pointer-events: none;
    transition: height 1s linear;
}
body.light-mode #elapsed-fill {
    background: rgba(0, 0, 0, 0.055);
}

/* ================================================
   CARD DROP ENTER ANIMATION
================================================ */
@keyframes cardEnter {
    from { opacity: 0; transform: translateY(-14px) scale(0.96); }
    to   { opacity: 1; transform: none; }
}
.card-entering {
    animation: cardEnter 0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* ================================================
   MOBILE LIST VIEW  (≤ 768px)
================================================ */
@media (max-width: 768px) {
    header {
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0.75rem 4%;
    }
    .header-controls {
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: flex-start;
    }
    #director-hud { display: none; }
    .racing-grid.mobile-list-mode {
        display: block !important;
        background: transparent;
        border: none;
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 0 4%;
    }
}

.mobile-hour-label {
    font-family: monospace;
    font-size: 0.8rem;
    font-weight: 900;
    background: var(--f1-red);
    color: #fff;
    padding: 4px 12px;
    margin: 16px 0 4px;
    letter-spacing: 2px;
    border-radius: 2px;
    display: inline-block;
}

.mobile-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--f1-dark-gray);
    border-left: 5px solid #555;
    border-radius: 4px;
    padding: 10px 12px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: filter 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.mobile-card:active { filter: brightness(1.2); }
.mobile-card--live {
    border-left-color: var(--f1-green);
    background: rgba(0, 255, 65, 0.06);
}
.mobile-card--past {
    opacity: 0.4;
    filter: grayscale(0.8);
}
.mobile-card__time {
    font-family: monospace;
    font-size: 0.78rem;
    color: var(--f1-light-gray);
    white-space: nowrap;
    min-width: 90px;
}
.mobile-card__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.mobile-card__name {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--f1-white);
    line-height: 1.2;
}
.mobile-card__status {
    font-family: monospace;
    font-size: 0.75rem;
    font-weight: 900;
    color: var(--f1-yellow);
    white-space: nowrap;
}
.mobile-status--live  { color: var(--f1-green); }
.mobile-status--past  { color: var(--f1-light-gray); }

.mobile-past-summary { margin-top: 20px; }
.mobile-past-summary summary {
    font-size: 0.8rem;
    color: var(--f1-light-gray);
    cursor: pointer;
    padding: 8px 0;
    list-style: none;
    font-family: monospace;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.mobile-past-summary summary::-webkit-details-marker { display: none; }

/* Light mode — mobile */
body.light-mode .mobile-card { background: #fff; border-left-color: #bbb; }
body.light-mode .mobile-card--live { background: rgba(0,160,50,0.08); border-left-color: #00a832; }
body.light-mode .mobile-card__name { color: #111118; }
body.light-mode .mobile-card__status { color: #967200; }
body.light-mode .mobile-status--live { color: #00a832; }
body.light-mode .mobile-past-summary summary { color: #666; }

/* ================================================
   MOBILE DATE GROUPING
================================================ */

/* TODAY header */
.mobile-date-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    margin: 8px 0 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.8rem;
    font-weight: 900;
    letter-spacing: 1px;
    color: #fff;
    background: #1a1a1a;
    border-left: 4px solid #555;
}
.mobile-date-header--today {
    background: var(--f1-red);
    border-left-color: #fff;
    font-size: 0.85rem;
}

.mobile-today-badge {
    background: #fff;
    color: var(--f1-red);
    font-family: monospace;
    font-size: 0.7rem;
    font-weight: 900;
    padding: 2px 8px;
    border-radius: 10px;
    letter-spacing: 2px;
}

/* Collapsed other-date section */
.mobile-other-date {
    margin: 10px 0;
}
.mobile-date-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: #1e1e1e;
    border-left: 4px solid #444;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--f1-light-gray);
    cursor: pointer;
    list-style: none;
    letter-spacing: 1px;
}
.mobile-date-summary::-webkit-details-marker { display: none; }
.mobile-other-date[open] .mobile-date-summary {
    border-radius: 4px 4px 0 0;
    border-left-color: var(--f1-yellow);
    color: var(--f1-white);
}
.mobile-date-count {
    background: rgba(255,255,255,0.08);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
}
.mobile-other-date[open] .mobile-date-count {
    background: var(--f1-yellow);
    color: #000;
}

/* Light mode — date headers */
body.light-mode .mobile-date-header { background: #e8e8f0; color: #111118; border-left-color: #aaa; }
body.light-mode .mobile-date-header--today { background: var(--f1-red); color: #fff; }
body.light-mode .mobile-date-summary { background: #e8e8f0; color: #50505a; border-left-color: #ccc; }
body.light-mode .mobile-other-date[open] .mobile-date-summary { color: #111118; border-left-color: #b8860b; }
body.light-mode .mobile-date-count { background: rgba(0,0,0,0.07); }
