/* Zuhause – Bedienoberflaeche.
   Grundsatz: Farbe erscheint nur dort, wo tatsaechlich etwas laeuft.
   Alles Ruhende bleibt grau. So ist auf einen Blick erkennbar, was an ist. */

:root {
    --grund:      #eef1f4;
    --flaeche:    #ffffff;
    --kante:      #d4dae1;
    --schrift:    #10141a;
    --gedaempft:  #5c6874;
    --warm:       #a8480f;
    --warm-feld:  #fdf0e6;
    --kalt:       #12667f;
    --kalt-feld:  #e6f3f7;
    --stoerung:   #97210f;
    --radius:     14px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --grund:     #14171b;
        --flaeche:   #1c2026;
        --kante:     #2e343c;
        --schrift:   #e8ebef;
        --gedaempft: #909ba7;
        --warm:      #f0a163;
        --warm-feld: #33210f;
        --kalt:      #6ec6e0;
        --kalt-feld: #112a33;
        --stoerung:  #f08b7c;
    }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
    background: var(--grund);
    color: var(--schrift);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 17px;
    line-height: 1.45;
    max-width: 640px;
    margin-inline: auto;
}

h1 { font-size: 1.3rem; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
h2 { font-size: 1.05rem; font-weight: 600; margin: 0; color: var(--gedaempft); }

/* --- Kopfzeile --- */

.kopf {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.verbindung {
    margin: 0;
    font-size: 0.85rem;
    color: var(--gedaempft);
    display: flex;
    align-items: center;
    gap: 7px;
}

.verbindung::before {
    content: "";
    width: 9px; height: 9px;
    border-radius: 50%;
    background: var(--gedaempft);
    flex: none;
}

.verbindung[data-zustand="online"]::before { background: #2f8f4e; }
.verbindung[data-zustand="offline"]::before { background: var(--stoerung); }
.verbindung[data-zustand="offline"] { color: var(--stoerung); }

/* --- Kacheln --- */

.kacheln { display: grid; gap: 14px; }

.kachel {
    background: var(--flaeche);
    border: 1px solid var(--kante);
    border-radius: var(--radius);
    padding: 18px;
    transition: background-color .35s ease, border-color .35s ease;
}

.kachel-kopf { margin-bottom: 16px; }

/* Der Zustand ist die wichtigste Angabe auf der Kachel und deshalb gross. */
.lage {
    margin: 2px 0 0;
    font-size: 1.9rem;
    font-weight: 650;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.kachel[data-an="1"][data-akzent="warm"] { background: var(--warm-feld); border-color: var(--warm); }
.kachel[data-an="1"][data-akzent="warm"] .lage { color: var(--warm); }
.kachel[data-an="1"][data-akzent="kalt"] { background: var(--kalt-feld); border-color: var(--kalt); }
.kachel[data-an="1"][data-akzent="kalt"] .lage { color: var(--kalt); }

.kachel[data-wartet="1"] { opacity: .62; }

.kachel-tasten { display: flex; gap: 10px; flex-wrap: wrap; }

button {
    flex: 1 1 auto;
    min-height: 54px;
    padding: 12px 18px;
    font: inherit;
    font-weight: 600;
    color: var(--flaeche);
    background: var(--schrift);
    border: 1px solid var(--schrift);
    border-radius: 10px;
    cursor: pointer;
    touch-action: manipulation;
}

button.sekundaer {
    background: transparent;
    color: var(--schrift);
    border-color: var(--kante);
}

button:disabled { opacity: .45; cursor: default; }
button:active:not(:disabled) { transform: translateY(1px); }

:focus-visible { outline: 3px solid var(--kalt); outline-offset: 2px; }

.notiz {
    margin: 12px 0 0;
    font-size: 0.85rem;
    color: var(--gedaempft);
    min-height: 1.2em;
}

/* --- Fuss --- */

.fuss { margin-top: 22px; color: var(--gedaempft); font-size: 0.85rem; }
.fuss p { margin: 4px 0; }
.fuss a { color: inherit; }
#meldung:not(:empty) { color: var(--schrift); font-weight: 500; }
#meldung.stoerung { color: var(--stoerung); }

/* --- Anmeldung --- */

.anmeldung { max-width: 340px; margin: 12vh auto 0; }
.anmeldung h1 { margin-bottom: 22px; }
.anmeldung form { display: grid; gap: 6px; }
.anmeldung label { font-size: 0.85rem; color: var(--gedaempft); margin-top: 10px; }

.anmeldung input {
    font: inherit;
    padding: 13px;
    background: var(--flaeche);
    color: var(--schrift);
    border: 1px solid var(--kante);
    border-radius: 10px;
}

.anmeldung button { margin-top: 20px; }
.fehler { color: var(--stoerung); margin: 0 0 8px; }

@media (min-width: 620px) {
    .kacheln { grid-template-columns: 1fr 1fr; }
    body { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}
