
html {
    margin: 0;
    padding: 0;
    background-color: white;
    color: black;
    font-family: Arial, sans-serif;
    width: 100%;
    height: 100%;
    overflow: hidden;
}
body {
    margin: 0;
    padding: 0;
    background-color: white;
    color: black;
    font-family: Arial, sans-serif;
    width: 100%;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.5s, color 0.5s;
    overflow-x: hidden;
}
/* Uhransicht: keine Scrollbalken */
body.clock-active {
    overflow: hidden;
}
/* Terminansicht: Scrollen erlaubt */
body.appointments-active {
    overflow-x: hidden;
    overflow-y: auto;
}
/* Hauptcontainer */
.container {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    text-align: center;
    padding: 0.4rem 1rem 0.4rem 1rem;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    overflow: visible;
}
/* Ansicht-Umschalter */
.view-toggle {
    margin: 12px auto 10px auto;
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
    clear: both;
    max-width: 100%;
}
.view-toggle button {
    padding: 10px 22px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    background: #e5e5e5;
    color: #111;
}
.view-toggle button.active {
    background: #222;
    color: white;
}
/* Uhransicht */
#clockView {
    width: 100%;
    max-width: 100%;
    height: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    transform: translateY(8vh);
    box-sizing: border-box;
    overflow: hidden;
}
/* Terminansicht */
#appointmentsView {
    width: 100%;
    max-width: 760px;
    margin-top: 4vh;
    margin-bottom: 40px;
    box-sizing: border-box;
}
/* Titel */
.title {
    font-size: clamp(2rem, 5vh, 4.4rem);
    margin: 0 0 2vh 0;
    max-width: 100%;
}
/* Uhr */
.clock {
    font-size: clamp(4rem, 18vw, 17rem);
    max-width: 100%;
    word-wrap: break-word;
    font-weight: bold;
    color: black;
    line-height: 1;
}
/* Datum */
.date {
    font-size: clamp(1.3rem, 4vh, 3.4rem);
    color: #cc0000;
    margin-top: 2.5vh;
    margin-bottom: 6.4vh;
    max-width: 100%;
}
/* Countdown-Text / Nächster Termin */
.reminder-text {
    width: min(100%, 900px);
    max-width: 100%;
    margin: 0 auto 3vh auto;
    color: black;
    line-height: 1.25;
    text-align: center;
    box-sizing: border-box;
    padding: 0 0.5rem;
    overflow: hidden;
}
/* Zeile 1: NÄCHSTER TERMIN */
.next-appointment-title {
    display: block;
    width: 100%;
    max-width: 100%;
    font-size: clamp(1.3rem, 3vh, 3.4rem);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
}
/* Terminname */
.next-appointment-title span {
    white-space: nowrap;
}
/* Zeile 2: Countdown */
.next-appointment-countdown {
    display: block;
    width: 100%;
    max-width: 100%;
    margin-top: 0.45rem;
    font-size: clamp(1.3rem, 3vh, 3.4rem);
    font-weight: 800;
    opacity: 0.95;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
}
/* Countdown-Balken */
.progressbar {
    width: min(90vw, 900px);
    max-width: 100%;
    height: 30px;
    background-color: #eee;
    margin: 0 auto 3vh auto;
    border-radius: 999px;
    overflow: hidden;
    box-sizing: border-box;
}
.progress {
    height: 100%;
    width: 0%;
    transition: width 0.2s linear, background-color 0.2s linear;
    border-radius: 999px;
    background-color: green;
    background-image: linear-gradient(
        to right,
        rgba(255,255,255,0.18),
        rgba(0,0,0,0.12)
    );
}
/* Heutige Termine */
.today-appointments-count {
    max-width: 100%;
    margin-top: 0;
    margin-bottom: 0;
    font-size: clamp(0.9rem, 2vh, 1.25rem);
    font-weight: 400;
    line-height: 1.3;
    opacity: 0.85;
    box-sizing: border-box;
    padding: 0 0.5rem;
    overflow-wrap: break-word;
}
/* Schalter oben */
.top-controls {
    position: static;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px 18px;
    flex-wrap: wrap;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 14px auto 8px auto;
    padding: 0 12px;
    pointer-events: auto;
}
.mode-toggle,
.reminder-toggle,
.daily-focus-toggle {
    position: static;
    margin: 0;
    padding: 0;
    font-size: 1.05rem;
    line-height: 1.2;
    pointer-events: auto;
}
.mode-toggle label,
.reminder-toggle label,
.daily-focus-toggle label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 1.05rem;
    line-height: 1.2;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    pointer-events: auto;
}
.mode-toggle input,
.reminder-toggle input,
.daily-focus-toggle input {
    transform: scale(1.35);
    margin-right: 0.4rem;
    vertical-align: middle;
    cursor: pointer;
    pointer-events: auto;
    opacity: 1;
}
.daily-focus-toggle,
.daily-focus-toggle label,
#toggleDailyFocus {
    pointer-events: auto;
    cursor: pointer;
}
/* Terminbereich */
.appointment-panel {
    margin-top: 20px;
    padding: 22px;
    border-radius: 18px;
    background: #f4f4f4;
    color: #111;
    max-width: 760px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
    box-shadow: 0 10px 28px rgba(0,0,0,0.12);
}
.appointment-panel h2 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.6rem;
    text-align: center;
}
/* Formular */
.appointment-form {
    display: grid;
    gap: 10px;
    text-align: left;
    background: white;
    padding: 16px;
    border-radius: 14px;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
}
.appointment-form label {
    font-weight: bold;
}
.appointment-form input,
.appointment-form select,
.appointment-form button {
    width: 100%;
    padding: 11px;
    border-radius: 8px;
    border: 1px solid #ccc;
    font-size: 1rem;
    box-sizing: border-box;
}
.appointment-form button {
    cursor: pointer;
    font-weight: bold;
    background: #222;
    color: white;
    border: none;
    margin-top: 8px;
}
/* Terminliste */
.appointment-list {
    margin-top: 20px;
    text-align: left;
    background: white;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
}
.appointment-list p {
    margin: 0;
    padding: 16px;
    text-align: center;
    opacity: 0.7;
}
.appointment-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid rgba(0,0,0,0.12);
}
.appointment-item:last-child {
    border-bottom: none;
}
.appointment-info {
    line-height: 1.4;
}
.appointment-small {
    font-size: 0.85rem;
    opacity: 0.75;
}
.delete-btn {
    background: #b00020;
    color: white;
    border: none;
    padding: 7px 11px;
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
}
/* Export / Import */
.appointment-backup-panel {
    margin-top: 22px;
    padding: 16px;
    border-radius: 14px;
    background: white;
    text-align: left;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
}
.appointment-backup-panel h3 {
    margin-top: 0;
}
.appointment-backup-panel button,
.import-label {
    display: inline-block;
    margin-top: 8px;
    margin-right: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    border: none;
    background: #222;
    color: white;
    cursor: pointer;
    font-weight: bold;
}
.appointment-backup-panel button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.import-label input {
    display: block;
    margin-top: 8px;
    color: inherit;
    max-width: 100%;
}
.backup-info {
    font-size: 0.9rem;
    opacity: 0.85;
    line-height: 1.45;
}
/* Datenschutz-Hinweis */
.local-storage-info {
    margin-top: 20px;
    padding: 14px;
    border-radius: 14px;
    background: #fff3cd;
    color: #4a3600;
    font-size: 0.9rem;
    line-height: 1.45;
    text-align: left;
}
.local-storage-info a {
    color: inherit;
    font-weight: bold;
    text-decoration: underline;
}
/* Footer */
.legal-links {
    flex-shrink: 0;
    text-align: center;
    font-size: clamp(0.8rem, 1.8vh, 1.2rem);
    color: black;
    padding: 1vh 0;
    background-color: inherit;
}
.legal-links a {
    color: inherit;
    text-decoration: none;
    margin: 0 0.5em;
    opacity: 0.7;
    transition: opacity 0.3s;
}
.legal-links a:hover {
    opacity: 1;
    text-decoration: underline;
}
/* Dark Mode */
body.dark {
    background-color: #111;
    color: white;
}
body.dark .clock {
    color: white;
}
body.dark .date {
    color: #ff4444;
}
body.dark .reminder-text {
    color: white;
}
body.dark .progressbar {
    background-color: #333;
}
body.dark .legal-links {
    color: white;
}
body.dark .view-toggle button {
    background: #333;
    color: white;
}
body.dark .view-toggle button.active {
    background: white;
    color: #111;
}
body.dark .appointment-panel {
    background: #1d1d1d;
    color: white;
    box-shadow: 0 10px 28px rgba(0,0,0,0.45);
}
body.dark .appointment-form,
body.dark .appointment-list,
body.dark .appointment-backup-panel {
    background: #111;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12);
}
body.dark .appointment-form input,
body.dark .appointment-form select {
    background: #1b1b1b;
    color: white;
    border-color: #666;
}
body.dark .appointment-item {
    border-bottom-color: rgba(255,255,255,0.18);
}
body.dark .local-storage-info {
    background: rgba(255, 193, 7, 0.16);
    color: white;
}
/* Dark Mode: eigene weiße Icons für Datum und Uhrzeit */
body.dark .appointment-form input[type="date"],
body.dark .appointment-form input[type="time"] {
    color-scheme: dark;
    background-color: #1b1b1b;
    color: white;
    border-color: #666;
    padding-right: 44px;
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 20px 20px;
    cursor: pointer;
}
/* Kalender-Icon weiß */
body.dark .appointment-form input[type="date"] {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
}
/* Uhr-Icon weiß */
body.dark .appointment-form input[type="time"] {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpolyline points='12 6 12 12 16 14'/%3E%3C/svg%3E");
}
/* Native dunkle Browser-Icons ausblenden */
body.dark .appointment-form input[type="date"]::-webkit-calendar-picker-indicator,
body.dark .appointment-form input[type="time"]::-webkit-calendar-picker-indicator {
    opacity: 0;
    cursor: pointer;
}
/* Mobil */
@media (max-width: 600px) {
    html {
        overflow: hidden;
    }
    body {
        height: 100dvh;
        overflow: hidden;
    }
    body.appointments-active {
        overflow-y: auto;
    }
    .container {
        flex: 1 1 auto;
        min-height: 0;
        justify-content: flex-start;
        padding: 0.15rem 0.65rem 0.2rem 0.65rem;
    }
    .top-controls {
        display: grid;
        grid-template-columns: 1fr 1fr;
        justify-items: center;
        align-items: center;
        gap: 6px 8px;
        margin: 8px auto 6px auto;
        padding: 0 6px;
        width: 100%;
    }
    .daily-focus-toggle {
        grid-column: 1 / -1;
    }
    .mode-toggle,
    .reminder-toggle,
    .daily-focus-toggle {
        font-size: 0.82rem;
        line-height: 1.1;
    }
    .mode-toggle label,
    .reminder-toggle label,
    .daily-focus-toggle label {
        font-size: 0.82rem;
        gap: 4px;
        line-height: 1.1;
        white-space: nowrap;
    }
    .mode-toggle input,
    .reminder-toggle input,
    .daily-focus-toggle input {
        transform: scale(0.95);
        margin-right: 0.2rem;
    }
    .view-toggle {
        margin: 8px auto 4px auto;
        gap: 8px;
        flex-shrink: 0;
    }
    .view-toggle button {
        padding: 7px 18px;
        font-size: 0.9rem;
        border-radius: 999px;
    }
    #clockView {
        flex: 1 1 auto;
        width: 100%;
        min-height: 0;
        display: flex;
        flex-direction: column;
        justify-content: space-evenly;
        align-items: center;
        transform: none;
        overflow: hidden;
    }
    .title {
        font-size: clamp(1.75rem, 7.2vw, 2.5rem);
        margin: 0;
        line-height: 1.05;
    }
    .clock {
        font-size: clamp(4.3rem, 19vw, 6.4rem);
        line-height: 0.95;
    }
    .date {
        font-size: clamp(1.35rem, 6.2vw, 2rem);
        margin-top: -40px;
        line-height: 1.15;
        margin-bottom:-20px;
    }
    .reminder-text {
        width: 100%;
        max-width: 100%;
        padding: 0 0.25rem;
        margin: 0;
        box-sizing: border-box;
        line-height: 1.22;
    }
    .next-appointment-title {
        font-size: clamp(0.9rem, 1.5vw, 1.2rem);
        font-weight: 400;
        text-transform: uppercase;
        letter-spacing: 0.02em;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .next-appointment-countdown {
        margin-top: 0.4rem;
        font-size: clamp(0.8rem, 1.4vw, 1.1rem);
        font-weight: 800;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .progressbar {
        width: min(92vw, 900px);
        height: 18px;
        margin: 0;
    }
    .today-appointments-count {
        font-size: clamp(0.88rem, 4vw, 1.05rem);
        margin: 0;
        font-weight: 400;
        opacity: 0.85;
        line-height: 1.25;
    }
    .legal-links {
        flex-shrink: 0;
        font-size: 0.82rem;
        padding: 0.55rem 0 0.65rem 0;
    }
    #appointmentsView {
        margin-top: 3vh;
        max-width: 100%;
    }
    .appointment-panel {
        width: 100%;
        padding: 14px;
        border-radius: 14px;
        box-shadow: none;
    }
    .appointment-item {
        flex-direction: column;
        align-items: flex-start;
    }
    .delete-btn {
        align-self: flex-end;
    }
    .appointment-backup-panel button,
    .import-label {
        width: 100%;
        box-sizing: border-box;
        margin-right: 0;
    }
}
/* Sehr kleine Smartphones */
@media (max-width: 380px) {
    .top-controls {
        gap: 5px 6px;
        margin-top: 6px;
    }
    .mode-toggle label,
    .reminder-toggle label,
    .daily-focus-toggle label {
        font-size: 0.76rem;
    }
    .view-toggle button {
        padding: 6px 15px;
        font-size: 0.84rem;
    }
    .title {
        font-size: 1.55rem;
    }
    .clock {
        font-size: clamp(3.8rem, 18vw, 5.6rem);
    }
    .date {
        font-size: clamp(1.12rem, 5.7vw, 1.6rem);
    }
    .next-appointment-title {
        font-size: 1.18rem;
        font-weight: 900;
        text-transform: uppercase;
        letter-spacing: 0.02em;
    }
    .next-appointment-countdown {
        font-size: 1rem;
        font-weight: 800;
    }
    .progressbar {
        height: 14px;
    }
    .today-appointments-count {
        font-size: 0.8rem;
    }
}