@font-face {
    font-family: 'DINOT'; /*a name to be used later*/
    src: url("/static/DINOT.otf"); /*URL to font*/
}
@font-face {
    font-family: 'DINOT-Bold'; /*a name to be used later*/
    src: url("/static/DINOT-Bold.otf"); /*URL to font*/
}

:root { --accent: var(--logo-accent); --bg: var(--main-background); --tile-bg: var(--header); --edit: var(--logo-accent); --success: #2ed573; --error: #ff4757; }

/* FIX: Header fest, Body flexibel */
body {
    font-family: 'Segoe UI', sans-serif;
    background: var(--bg);
    color: white;
    margin: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

header {
    background: var(--header);
    padding: 15px 20px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Scroll-Container für den Content */
.scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    scroll-behavior: smooth;
}

.tile.active:hover {
    cursor: ew-resize;
}

#scrub-tooltip {
    position: fixed;
    background: var(--main-background);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'DINOT-Bold', sans-serif;
    font-size: 12px;
    pointer-events: none;
    display: none;
    z-index: 9999;
    transform: translate(-50%, -120%); /* Zentriert über der Maus */
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.toolbar {
    display: flex;
    gap: 15px;
    background: var(--header-button-hover);
    padding: 12px 20px;
    border-radius: 12px;
    align-items: center;
    /* Sorgt dafür, dass die Toolbar die Breite nutzt */
    width: 100%;
    max-width: 1200px;
    box-sizing: border-box;
}
.statusbar {
    display: grid;
    /* Drei Spalten: Links und Rechts nehmen 1fr (Restplatz) ein, Mitte passt sich an */
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    width: 100%;
    padding-top:5px;
    box-sizing: border-box;
    max-width: 1200px;
}

#event-title-input {
background: transparent;
border: 1px solid transparent;
color: var(--accent);
font-size: 1.2rem;
font-weight: bold;
text-align: left; /* Text beginnt links */
padding: 5px 10px;

/* Magie für die Dynamik */
flex-grow: 1;    /* Nimmt allen freien Platz ein */
min-width: 0;    /* Wichtig, damit Ellipsis in Flexbox funktioniert */

/* Abschneiden mit Punkten (...) */
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;

pointer-events: none;
}
.edit-mode #event-title-input {
    background: var(--dot-hover);
    border: 1px solid var(--dot-hover);
    border-radius: 6px;
    pointer-events: auto;
    text-overflow: clip; /* Während dem Tippen keine Punkte, damit man alles sieht */
}

.btn { padding: 10px; border-radius: 6px; background: var(--dot-hover); color: var(--text); outline: none; }

/* Verhindert die Pfeile bei Chrome/Safari/Firefox */
input[type=number] { -moz-appearance: textfield; width: 40px; }
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

button { cursor: pointer; border: none; font-weight: bold; transition: all 0.2s; }
.btn-add { background: var(--success); color: #000; display: none; }
.btn-edit {}
.btn-login { background: var(--edit); color: #000;}

.main-controls {
    grid-column: 2;
    display: flex;
    justify-content: center;
    gap: 15px;
}
.btn-next { background: var(--success); color: #000; font-size: 1rem; padding: 10px 20px; min-width: 100px; }
.btn-back { padding: 10px 20px; font-size: 1rem; min-width: 100px;}
/* Den Button im Edit-Mode ausblenden */
body.edit-mode .btn-speaker {
    display: none !important;
}
/* Das originale Layout-Gefüge */
.layout {
    display: flex;
    gap: 25px;
    width: 100%;
    max-width: 900px;
    align-items: stretch;
    padding-bottom: 60px;
}
.track { width: 10px; background: var(--tile-bg); border-radius: 5px; position: relative; overflow: hidden; min-height: 100%; }
#progress-fill { width: 100%; background: var(--accent); position: absolute; top: 0; height: 0%; border-radius: 5px; z-index: 2; transition: height 0.2s ease, transform 0.1s ease;}

.start-time{
    font-family: DINOT-Bold;
    font-size: 1.1rem;
    padding: 5px;
    border: none;
    cursor: text;
}

.tiles {
    flex: 1;
    display: flex;
    flex-direction:
    column;
    gap: 12px;
}
.tile {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 50px;
    background: var(--tile-bg);
    border-radius: 12px;
    padding: 0px 15px;
    /* Verhindert, dass der Inhalt bei Sticky abgeschnitten wird */
    overflow: visible !important;
    border: 2px solid var(--dot-hover);
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    touch-action: auto;
    -webkit-user-select: none;
    user-select: none;
}

.tile:active {
    transform: scale(0.995); /* Minimales haptisches Feedback beim Klicken */
    cursor: default; /* Das aktive Tile braucht keinen Pointer */
}
.edit-mode .tile {
    cursor: grab;
}

.sticky-wrapper {
    position: -webkit-sticky;
    position: sticky;
    top: 0px;
    bottom: 0px;

    /* Zentrierung */
    margin-top: auto;
    margin-bottom: auto;

    /* DER BUFFER: */
    /* Anstatt margin-top nutzen wir padding. Das sorgt dafür,
     *      dass der Inhalt (Text/Handle) innerhalb des Wrappers
     *      immer diesen Abstand zum Kachelrand wahrt, wenn auto-margin greift. */
    padding-top: 15px;
    padding-bottom: 15px;

    display: flex;
    align-items: center;
    width: 100%;
    box-sizing: border-box; /* Wichtig, damit Padding die Höhe nicht addiert */
}
.edit-mode .sticky-wrapper {
    padding-top: 5px;
    padding-bottom: 5px;
}
.progress-mask {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 11px; /* Eine Nuance kleiner wegen des Kachel-Borders */
    overflow: hidden;    /* Hier ist das Hidden erlaubt! */
    z-index: 0;          /* Hinter dem Text */
    pointer-events: none;
}
.tile-progress {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0%;
    background: rgba(46, 213, 115, 0.25);
    z-index: 0;
    pointer-events: none;
}
.tile.active { border-color: var(--success); }

@keyframes pulse-warning {
    0% {
        box-shadow: 0 0 5px rgba(255, 71, 87, 0.4);
    }
    50% {
        /* Hier wird der Schatten intensiver und breiter */
        box-shadow: 0 0 20px rgba(255, 71, 87, 0.8);
    }
    100% {
        box-shadow: 0 0 5px rgba(255, 71, 87, 0.4);
    }
}
.tile.overtime { border-color: var(--error) !important; animation: pulse-warning 2s infinite ease-in-out; }
.tile.overtime .tile-progress {
    background: rgba(255, 71, 87, 0.4) !important; /* Deutliches Rot */
    width: 100% !important;
}
.tile.dragging { opacity: 0.3; border: 1px dashed var(--accent); }

.handle { width: 20px; height: 30px; cursor: grab; display: none; margin-right: 5px; background-image: radial-gradient(#666 2px, transparent 2px); background-size: 5px 5px; flex-shrink: 0; z-index: 2; }
.edit-mode .handle { display: block; cursor: grab;}
.tile-input {
    font-family: 'DINOT-Bold';
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 1.1rem;
    width: 100%;
    pointer-events: none;
    z-index: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3; /* Max. 3 Zeilen, dann kommen Punkte */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;

    width: 100%;
    outline: none;
    line-height: 1.2;

    /* Im Normalmodus kein Rahmen, wirkt wie Text */
    resize: none;
    white-space: normal; /* Erlaubt Umbrüche */

}
.edit-mode .tile-input { margin-left: 10px; background: var(--header-button-hover);; border: 1px solid var(--dot-hover); padding: 6px 1px; border-radius: 6px; pointer-events: auto; }

.status-late { color: var(--error) !important; }
.status-ok { color: var(--success) !important; }
.edit-mode .btn-add { display: inline-block; }
#delete-timeline-btn{padding: 10px; border-radius: 6px; background: var(--dot-hover); color: black; outline: none; display: none; background: var(--error);}
.delete-btn {
    display: none !important;
    color: var(--error);
    cursor: pointer;
    margin-left: 15px;
    font-weight: bold;
    font-size: 2rem;
    z-index: 10;
}
body.edit-mode .delete-btn {
    display: inline-block !important;
}
.edit-mode .delete-btn { display: inline; }
.main-controls {
    display: flex;
    justify-content: center; /* Zentriert alles, was sichtbar ist */
    align-items: center;
    gap: 15px;
    width: 100%; /* Wichtig, damit die Mitte der ganzen Breite berechnet wird */
}
.edit-mode .main-controls,
#delay-info{
    grid-column: 1;
    justify-self: start;
    white-space: nowrap;
    padding-left: 25px;
    padding-right:25px;
    font-size: 1rem;
}
.edit-mode #delay-info {
    display: none !important;
}


/* Redner Ansicht*/

@keyframes pulse-warning-2 {
    0% {
        opacity: .45;
    }
    50% {
        opacity: .7;
    }
    100% {
        opacity: .45;
    }
}

 .speaker-container { margin: 0; height: 100vh; overflow: scroll; background: #000; display: flex;justify-content: center;align-items: center;min-width: 1vh;}
 /* Transition für den Balken hinzugefügt für smoothe Bewegungen */
 #bg-p { position: absolute; left: 0; top: 0; height: 100%; width: 0%; background: var(--success); opacity: 0.7; transition: width .3s linear, background-color 0.5s; }
 .content { position: relative; z-index: 10; text-align: center; width: 90%; }
 #timer { font-family: DINOT-Bold;font-size: 48vh; font-weight: bold; line-height: 1; font-variant-numeric: tabular-nums; margin-bottom: 10vh;}
 #title { font-family: DINOT-Bold; font-size: 12vh; color: white; opacity: .7; text-transform: uppercase; margin-bottom: 2vh; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
 .over-bg { background-color: var(--error)!important; opacity: 0.45; animation: pulse-warning-2 3s infinite ease-in-out;}
 .over-txt { color: white;}
 #global-delay { position: absolute; bottom: 3vh; right: 3vh; font-family: DINOT-Bold; font-size: 6vh; color: var(--error); font-weight: bold; display: none; border: .7vh solid #ff4757; padding: 10px 25px; border-radius: 10px; background: rgba(0,0,0,0.5); }
