:root {
    --ui-scale: 1; /* 1 = 100 %, wird per Slider geändert */
}

/* Basislayout */
* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    background: #e9ecef;
    color: #111;
}

#app {
    width: calc(100% / var(--ui-scale));
    max-width: 100%;
    margin: 0;
    padding: 14px 20px 24px 20px;
    transform: scale(var(--ui-scale));
    transform-origin: top left;
}

/* Info-Meldung (falls du später eine brauchst) */
.info-message {
    margin-top: 10px;
    padding: 10px 12px;
    background: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: 6px;
    font-size: 14px;
}

/* Topbar */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px;
    background: #ffffff;
    color: #000;
    border-bottom: 2px solid #ddd;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Marke / Logo-Bereich */
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    height: 50px;
    width: auto;
    object-fit: contain;
    background: #fff;
    padding: 3px 6px;
    border-radius: 6px;
    border: 0px solid #000;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.club-name {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.8;
}

.app-name {
    font-size: 18px;
    font-weight: 700;
}

/* Turniertitel */
.tournament-title {
    margin: 14px 0 8px 0;
    font-size: 26px;
    font-weight: 800;
    text-align: center;     /* zentriert */
    width: 100%;
    letter-spacing: 0.04em;
}

/* Burger-Menü */
.burger {
    position: relative;
    width: 32px;
    height: 24px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
}

.burger span {
    position: absolute;
    left: 0;
    right: 0;
    height: 3px;
    background: #000;
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease, top 0.2s ease, bottom 0.2s ease;
}

.burger span:nth-child(1) { top: 4px; }
.burger span:nth-child(2) { top: 11px; }
.burger span:nth-child(3) { bottom: 4px; }

/* Burger im offenen Zustand */
body.menu-open .burger span:nth-child(1) {
    top: 11px;
    transform: rotate(45deg);
}
body.menu-open .burger span:nth-child(2) {
    opacity: 0;
}
body.menu-open .burger span:nth-child(3) {
    bottom: 11px;
    transform: rotate(-45deg);
}

/* Menüpanel (Modus-Umschalter, Skalierung, Vollbild) */
.mode-toggle {
    position: absolute;
    top: 60px;
    right: 16px;
    background: #ffffff;
    border: 1px solid #ccc;
    padding: 10px;
    display: none;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
    border-radius: 6px;
    color: #000;
    min-width: 200px;
}

.mode-toggle button {
    padding: 8px 12px;
    border: 1px solid #ccc;
    background: #f7f7f7;
    color: #000;
    cursor: pointer;
    font-size: 14px;
    border-radius: 4px;
    text-align: left;
    width: 100%;
}

.mode-toggle button.active {
    background: #000;
    color: #fff;
    border-color: #000;
}

.mode-toggle .menu-btn {
    margin-top: 4px;
}

/* Skalierung */
.scale-control {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 4px;
}

.scale-control label {
    font-size: 12px;
}

.scale-control input[type="range"] {
    width: 100%;
}

/* Panel anzeigen, wenn Menü geöffnet */
body.menu-open #modeTogglePanel {
    display: flex;
}

/* Standard-Buttons */
button {
    padding: 6px 10px;
    font-size: 14px;
    cursor: pointer;
    border-radius: 4px;
    border: 1px solid transparent;
}

.btn-primary {
    background: #000;
    color: #fff;
    border-color: #000;
}
.btn-primary:hover {
    background: #fff;
    color: #000;
}

.btn-secondary {
    background: #fff;
    color: #000;
    border-color: #000;
}
.btn-secondary:hover {
    background: #000;
    color: #fff;
}

.btn-small {
    padding: 4px 8px;
    font-size: 12px;
}

/* Texte / Überschriften */
h2, h3, h4 {
    margin-top: 16px;
    margin-bottom: 8px;
}

p {
    margin-top: 4px;
    margin-bottom: 8px;
    font-size: 14px;
}

input, textarea {
    font-size: 14px;
    font-family: inherit;
}

.full-width {
    width: 100%;
}

/* Config-Bereich (Admin) */
.config-panel {
    background: #ffffff;
    border: 1px solid #d0d0d0;
    border-left: 4px solid #000;
    padding: 10px 12px;
    margin-top: 12px;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.config-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.config-row > div {
    min-width: 200px;
}

.config-actions {
    margin-top: 10px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Tabs */
.tabs {
    margin-top: 14px;
    margin-bottom: 0;
}

.tabs button {
    padding: 8px 14px;
    margin-right: 4px;
    border: 1px solid #000;
    border-bottom: none;
    background: #f5f5f5;
    border-radius: 6px 6px 0 0;
    font-size: 13px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #000;
}

.tabs button.active {
    background: #000;
    color: #fff;
    border-bottom: 1px solid #000;
    font-weight: 600;
}

/* Turnierbereich */
.tournament-area {
    background: #ffffff;
    border: 1px solid #ccc;
    border-radius: 0 6px 6px 6px;
    padding: 12px;
    margin-top: -1px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Headline mit Mannschaftsanzahl */
.headline-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
}

.badge {
    background: #000;
    color: #fff;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    white-space: nowrap;
}

/* Spielplan & Tabelle + Poster nebeneinander */
.content-row {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    width: 100%;
    align-items: stretch;
}

.column-poster {
    flex: 1;
    min-width: 0;
    display: flex;
}

.column-schedule {
    flex: 2;
    min-width: 0;
}

.column-table {
    flex: 1;
    min-width: 0;
}

/* Tabellen */
table {
    border-collapse: collapse;
    width: 100%;
    font-size: 13px;
}

th, td {
    border: 1px solid #000;
    padding: 3px 4px;
    text-align: center;
    line-height: 1.2;
}

th {
    background: #000;
    color: #fff;
    font-weight: 600;
}

/* Zebra-Streifen im Spielplan */
#schedule tr:nth-child(even) td {
    background: #f7f7f7;
}

/* Inputs in Tabelle */
#schedule input[type="number"] {
    width: 42px;
    padding: 2px;
    font-size: 12px;
    border: 1px solid #000;
    border-radius: 3px;
}

/* QR-Box */
.qr-box {
    border: 1px dashed #000;
    border-radius: 6px;
    padding: 6px;
    margin-top: 12px;
    text-align: center;
    background: #fafafa;
    display: none; /* wird per JS aktiviert */
}

.qr-box img {
    max-width: 120px;
    height: auto;
    background: #fff;
    padding: 4px;
    border-radius: 4px;
}

.qr-caption {
    font-size: 12px;
    margin-bottom: 4px;
}

/* URL-Text unter QR: ausgeblendet (falls vorhanden) */
.qr-link {
    display: none;
}

/* Poster-Box (Turnierplakat, nur Desktop) */
.poster-box {
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 6px;
    background: #fafafa;
    display: none;
    text-align: center;
    width: 100%;
    display: flex;
    flex-direction: column;
}

.poster-box h4 {
    margin-top: 0;
}

.poster-box img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 4px;
    object-fit: contain;
    flex: 1;
}

/* Responsive */
@media (max-width: 900px) {
    #app {
        padding: 10px 10px 18px 10px;
    }
    .content-row {
        flex-direction: column;
    }
    .brand-text .club-name {
        font-size: 11px;
    }
    .brand-text .app-name {
        font-size: 15px;
    }

    /* Plakat auf Mobil komplett ausblenden */
    .column-poster {
        display: none !important;
    }
    .column-schedule,
    .column-table {
        width: 100%;
    }
}

/* Admin-Menü auf ganz kleinen Screens größer */
@media (max-width: 480px) {
    .mode-toggle {
        right: 10px;
        min-width: 220px;
    }
    .mode-toggle button {
        font-size: 15px;
        padding: 9px 14px;
    }
    .scale-control label {
        font-size: 13px;
    }
}

/* Anzeige-Modus: Config ausblenden */
body.view-mode .config-panel {
    display: none;
}

body.view-mode #app {
    padding-top: 12px;
}