/* Formula1 Custom Fonts (via jsDelivr CDN) */
@font-face {
    font-family: 'Formula1';
    src: url('https://cdn.jsdelivr.net/gh/rahulbhatara/samcjgv-tools@main/assets/Formula1-Regular_web_0.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'Formula1';
    src: url('https://cdn.jsdelivr.net/gh/rahulbhatara/samcjgv-tools@main/assets/Formula1-Bold_web_0.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
}

@font-face {
    font-family: 'Formula1-Bold';
    src: url('https://cdn.jsdelivr.net/gh/rahulbhatara/samcjgv-tools@main/assets/Formula1-Bold_web_0.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-drag: none;
}

body {
    background-color: transparent !important;
    font-family: 'Formula1', sans-serif;
    color: #f8fafc;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

.raceroom-container {
    position: fixed;
    top: 24px;
    right: 24px;
    width: 400px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.7);
    overflow: hidden;
    font-size: 15px;
    letter-spacing: 0.3px;
    font-family: 'Formula1', sans-serif;
}

/* Dynamic Track Minimap (4:3 Aspect Ratio at Bottom) */
.track-minimap-section {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #080d1a;
    border-top: 1px solid #1e293b;
    overflow: hidden;
}

#track-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Header */
.race-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.4);
    border-bottom: 2px solid #ef4444;
}

.race-badge {
    background: #ef4444;
    color: #ffffff;
    font-family: 'Formula1-Bold', 'Formula1', sans-serif;
    font-weight: 700;
    font-size: 14px;
    padding: 4px 10px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.race-badge.circuit {
    background: #3b82f6;
}

.race-badge.sprint {
    background: #10b981;
}

.race-badge.endurance {
    background: #f59e0b;
}

.race-meta {
    display: flex;
    gap: 18px;
}

.meta-item {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.meta-label {
    font-family: 'Formula1', sans-serif;
    font-size: 11px;
    color: #94a3b8;
    font-weight: 700;
    letter-spacing: 0.8px;
}

.meta-val {
    font-family: 'Formula1-Bold', 'Formula1', sans-serif;
    font-size: 19px;
    font-weight: 700;
    color: #f1f5f9;
    letter-spacing: 0.5px;
}

/* Scoreboard Table */
.scoreboard-section {
    max-height: 480px;
    overflow-y: auto;
}

.scoreboard-table {
    width: 100%;
    border-collapse: collapse;
}

.scoreboard-table th {
    background: rgba(0, 0, 0, 0.28);
    padding: 8px 12px;
    font-family: 'Formula1-Bold', 'Formula1', sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: #94a3b8;
    text-align: left;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.scoreboard-table td {
    padding: 9px 12px;
    font-family: 'Formula1', sans-serif;
    font-size: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.scoreboard-table tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.scoreboard-table tr.is-me {
    background: rgba(59, 130, 246, 0.2);
    border-left: 3px solid #3b82f6;
    font-weight: 700;
}

.col-pos {
    width: 44px;
    font-family: 'Formula1-Bold', 'Formula1', sans-serif;
    font-weight: 700;
    font-size: 15px;
    text-align: center !important;
}

.pos-1 { color: #facc15; }
.pos-2 { color: #cbd5e1; }
.pos-3 { color: #f97316; }

.col-driver {
    max-width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Formula1-Bold', 'Formula1', sans-serif;
    font-weight: 700;
    font-size: 15px;
}

.col-lap {
    width: 58px;
    text-align: center !important;
    font-family: 'Formula1', sans-serif;
    color: #cbd5e1;
    font-size: 14px;
}

.col-time {
    width: 100px;
    text-align: right !important;
    font-family: 'Formula1-Bold', 'Formula1', sans-serif;
    color: #e2e8f0;
    font-size: 14px;
}

.leader-badge {
    display: inline-block;
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.4);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    font-family: 'Formula1-Bold', 'Formula1', sans-serif;
}

.placeholder-row td {
    text-align: center;
    color: #64748b;
    padding: 20px 12px;
    font-family: 'Formula1', sans-serif;
    font-size: 14px;
    font-style: italic;
}
