:root {
    --bg: #111;
    --panel: #222;
    --panel2: #1b1b1b;
    --border: #333;
    --text: #eee;
    --muted: rgba(238, 238, 238, .82);
    --blue: #007bff;
    --blue2: #0056b3;
    --red: #b00020;
    --red2: #7f0016;
    --green: #116611;
    --darkred: #661111;
}

* {
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    text-align: center;
    padding: 14px;
    margin: 0;
}

h1 {
    margin: 6px 0 12px 0;
    font-size: clamp(1.25rem, 3.5vw, 2rem);
}

.container {
    width: min(1100px, 98vw);
    margin: 0 auto;
}


/* ==================================================
   VENUE SELECTOR
   ================================================== */

.venue-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 14px;
}

.venue-selector {
    display: inline-flex;
    background: #1b1b1b;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 4px;
    gap: 4px;
}

.venue-btn {
    background: transparent;
    color: #aaa;
    border: none;
    border-radius: 9px;
    padding: 10px 22px;
    min-width: 130px;
    cursor: pointer;
    transition:
        background .2s,
        color .2s;
}

.venue-btn:hover {
    background: #333;
    color: #fff;
}

.venue-btn.active {
    background: var(--blue);
    color: #fff;
}

.venue-btn.active:hover {
    background: var(--blue2);
}


/* ==================================================
   TOP CONTROL AREA
   ================================================== */

.bar {
    background: var(--panel);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

.bar-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: center;
}

.pill {
    display: inline-flex;
    align-items: center;
    padding: 7px 12px;
    border-radius: 999px;
    background: #333;
    font-weight: 700;
    letter-spacing: .3px;
    font-size: .95rem;
}

.pill.running {
    background: var(--green);
}

.pill.stopped {
    background: var(--darkred);
}

.small {
    opacity: .9;
    font-size: clamp(.95rem, 2.8vw, 1rem);
}


/* ==================================================
   INPUTS / BUTTONS
   ================================================== */

input,
button {
    padding: 10px 12px;
    font-size: clamp(1rem, 3.2vw, 1.05rem);
    border-radius: 10px;
    border: none;
}

input {
    background: var(--panel2);
    color: var(--text);
    outline: 1px solid var(--border);
    min-width: 110px;
}

input::placeholder {
    color: #aaa;
}

button {
    background: var(--blue);
    color: #fff;
    cursor: pointer;
    font-weight: 700;
}

button:hover {
    background: var(--blue2);
}

.btn-stop {
    background: var(--red);
}

.btn-stop:hover {
    background: var(--red2);
}

.btn-ghost {
    background: #333;
}

.btn-ghost:hover {
    background: #444;
}

.w-sm {
    width: 110px;
}

.w-md {
    width: min(520px, 92vw);
}


/* ==================================================
   CARDS
   ================================================== */

.card {
    background: var(--panel);
    border-radius: 12px;
    padding: 14px;
    text-align: left;
    margin-bottom: 12px;
}

.card h2 {
    margin: 0 0 6px 0;
    font-size: clamp(1.15rem, 3.4vw, 1.4rem);
}

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 16px;
    margin-top: 10px;
}

.kv p {
    margin: 6px 0;
    font-size: clamp(1rem, 3vw, 1.05rem);
}

.muted {
    color: var(--muted);
    font-size: .95rem;
}


/* ==================================================
   TABLE
   ================================================== */

.section-title {
    text-align: left;
    margin: 14px 0 8px 0;
    font-size: clamp(1.1rem, 3vw, 1.3rem);
}

.table-wrap {
    background: var(--panel);
    border-radius: 12px;
    padding: 8px;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

th,
td {
    padding: 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    font-size: 1rem;
    white-space: nowrap;
}

th {
    background: #1f1f1f;
    position: sticky;
    top: 0;
}

tr.highlight-row {
    background-color: var(--green);
    transition: background-color .6s;
}


/* ==================================================
   CARD ACTIONS
   ================================================== */

.card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 10px;
}


/* ==================================================
   TTS
   ================================================== */

.tts-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 8px;
}

.tts-row input {
    flex: 1 1 280px;
}


/* ==================================================
   MOBILE
   ================================================== */

@media (max-width: 520px) {

    body {
        padding: 10px;
    }

    .bar {
        padding: 10px;
    }

    .grid {
        grid-template-columns: 1fr;
    }

    .pill {
        width: 100%;
        justify-content: center;
    }

    .w-sm {
        width: 100%;
    }

    button {
        width: 100%;
    }

    .venue-selector {
        width: 100%;
    }

    .venue-btn {
        width: 50%;
        min-width: 0;
    }
}

.driver-card-header {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
}

.force-description {
    margin-top: 10px;
}