:root {
    --bg-color: #f0f2f5;
    --card-bg: #ffffff;
    --primary-color: #ca1d18;
    --secondary-color: #f9cf12;
    --text-color: #333;
    --pause-bg: rgba(220, 53, 69, 0.95);
}

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-color);
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Hauptcontainer: Flexbox für responsive Anordnung */
.container {
    display: flex;
    flex: 1; /* Füllt den verfügbaren Platz */
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 20px;
    flex-wrap: wrap; /* Wichtig für Mobile: Erlaubt Umbruch */
}

/* NEU: Design für den Veranstaltungstitel */
.event-title {
    text-align: center;
    padding: 20px 20px 0; /* Abstand oben/seitlich */
    font-size: clamp(1.5rem, 5vw, 3rem); /* Passt sich der Bildschirmgröße an */
    font-weight: 900;
    color: #222;
    text-transform: uppercase;
    letter-spacing: 1px;
    line-height: 1.2;
}

/* Die Karten für Wettkampf/Lauf */
.box {
    background: var(--card-bg);
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    text-align: center;
    padding: 20px;
    
    /* Responsive Breite */
    flex: 1 1 300px; /* Wachsen: Ja, Schrumpfen: Ja, Basis: 300px */
    max-width: 600px; /* Nicht zu breit auf riesigen Monitoren */
    min-width: 250px; /* Nicht zu schmal auf alten Handys */
    
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Überschriften responsive */
h1 {
    font-size: clamp(1.5rem, 4vw, 2.5rem); /* Skaliert zwischen 1.5rem und 2.5rem */
    margin: 0;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Die Zahlen: Massive Größe, die sich anpasst */
.number {
    font-size: clamp(5rem, 15vw, 10rem); /* Mindestens 5rem, maximal 10rem, sonst 15% der Breite */
    font-weight: 800;
    color: var(--primary-color);
    line-height: 1.1;
    margin: 10px 0;
    font-variant-numeric: tabular-nums; /* Verhindert Wackeln bei Zahlenänderung */
}

/* Pause Screen: Overlay */
.pause-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--pause-bg);
    color: white;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(5px); /* Schicker Unschärfe-Effekt im Hintergrund */
}

.pause-text {
    font-size: clamp(3rem, 15vw, 8rem);
    font-weight: 900;
    text-transform: uppercase;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

/* --- Admin Panel Spezifisches --- */
.admin-controls {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

button {
    touch-action: manipulation; /* Verbessert Touch-Reaktion */
    padding: 15px 25px; /* Größere Touch-Fläche */
    margin: 10px;
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: bold;
    border: none;
    cursor: pointer;
    transition: transform 0.1s;
}

button:active {
    transform: scale(0.95);
}

.btn-plus { background: #28a745; color: white; }
.btn-minus { background: #dc3545; color: white; }

/* Reset Button Breite angepasst, damit Margin nicht zum Überlauf führt */
.btn-reset { 
    background: #6c757d; 
    color: white; 
    font-size: 0.9rem; 
    padding: 10px; 
    min-width: 150px; /* Mindestbreite */
    width: auto;      /* Breite passt sich an */
    display: inline-block;
    margin-top: 10px;
}

.btn-pause { 
    background: #ffc107; 
    color: #000; 
    font-size: 1.2rem;
    padding: 20px;
    width: 100%;
    max-width: 600px;
    margin: 20px auto;
    display: block;
    font-weight: 800;
}

/* NEU: Live Indikator Badge */
.live-badge-container {
    text-align: center;
    margin-bottom: 5px;
    height: 30px; /* Feste Höhe verhindert Wackeln beim Einblenden */
}

.live-badge {
    display: inline-flex;
    align-items: center;
    background-color: #cc0000; /* Kräftiges Rot */
    color: white;
    padding: 5px 12px;
    border-radius: 4px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.blink-dot {
    width: 8px;
    height: 8px;
    background-color: white;
    border-radius: 50%;
    margin-right: 8px;
    animation: blinker 1.5s linear infinite;
}

@keyframes blinker {
    0% { opacity: 1; }
    50% { opacity: 0; }
    100% { opacity: 1; }
}

/* Button Stil für den Admin Bereich (Live Switch) */
.btn-live {
    background: #6c757d; /* Grau wenn aus */
    color: white;
    width: 100%;
    margin-top: 10px;
    transition: background 0.3s;
}

.btn-live.active {
    background: #cc0000; /* Rot wenn an */
    box-shadow: 0 0 10px rgba(204, 0, 0, 0.5);
}

/* NEU: Settings Button im Admin Panel */
.settings-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: #666;
    padding: 5px;
    transition: transform 0.3s, color 0.3s;
    text-decoration: none; /* Da es ein Link sein wird */
}

.settings-btn:hover {
    color: #007bff;
    transform: rotate(90deg);
}

/* NEU: Styles für Config Page */
.config-container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
}

.form-group input[type="text"] {
    width: 100%;
    padding: 10px;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 5px;
}

/* Tabelle für Wettkämpfe */
.wk-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.wk-table th, .wk-table td {
    border: 1px solid #ddd;
    padding: 10px;
    text-align: left;
}

.wk-table th {
    background-color: #f2f2f2;
}

.wk-table input {
    width: 100%;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.btn-remove {
    background: #dc3545;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8rem;
}

.btn-add {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    margin-right: 10px;
}

.btn-save {
    background: #007bff;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: bold;
    width: 100%;
    margin-top: 20px;
}