/* Draussen, in der Sonne, von Kindern bedient.
 *
 * Daraus folgt fast alles hier: dunkler Grund mit hellem Text (weniger
 * Blendung und sparsamer fuer den Akku), kraeftige Farben, grosse Flaechen,
 * wenig Text. Knoepfe sind mindestens 56 px hoch -- die 44 px aus den
 * ueblichen Richtlinien gelten fuer ruhige Haende an einem Schreibtisch,
 * nicht fuer ein Kind im Gehen.
 *
 * Nur ein Farbschema. Eine App, die im Wald benutzt wird, hat keinen Grund
 * fuer eine helle Fassung -- und zwei Fassungen waeren zwei, die man
 * draussen pruefen muesste.
 */

:root {
    --grund:      #0f1f15;
    --flaeche:    #16321f;
    --flaeche-2:  #1e4129;
    --rand:       #2c5a3a;
    --text:       #f2f5ef;
    --text-leise: #9db8a6;
    --akzent:     #ff8a1f;   /* Orange: in der Sonne noch zu erkennen */
    --akzent-text:#1a1004;
    --gut:        #5fd38d;
    --warn:       #ff6b4a;

    --radius: 16px;

    /* Kerbe und Home-Leiste auf dem iPhone */
    --oben:  env(safe-area-inset-top, 0px);
    --unten: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
    margin: 0;
    background: var(--grund);
    color: var(--text);
    font: 400 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    -webkit-text-size-adjust: 100%;
    /* Kein Ueberdehnen beim Wischen -- das sieht in einer App, die wie eine
       App aussehen soll, nach Webseite aus. */
    overscroll-behavior: none;
}

h1 { font-size: 1.8rem; margin: 0 0 4px; }
h2 { font-size: 1.3rem; margin: 0 0 10px; }
h3 { font-size: 1.05rem; margin: 0 0 8px; }
p  { margin: 0 0 12px; }

.leise { color: var(--text-leise); font-size: .9rem; }

/* ------------------------------------------------------------- Schirme */
.schirm {
    display: flex; flex-direction: column;
    min-height: 100%;
    padding: calc(var(--oben) + 16px) 16px calc(var(--unten) + 20px);
    gap: 14px;
}
.schirm[hidden] { display: none !important; }

.kopf { text-align: center; }
.kopf-schmal {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; min-height: 44px;
}

/* ------------------------------------------------------------- Knoepfe */
.knopf {
    min-height: 56px;
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px; padding: 0 18px;
    border: 2px solid var(--rand); border-radius: var(--radius);
    background: var(--flaeche); color: var(--text);
    font: 600 1.05rem/1 inherit; cursor: pointer;
    touch-action: manipulation;
}
.knopf.gross { width: 100%; min-height: 64px; font-size: 1.15rem; }
.knopf-haupt { background: var(--akzent); color: var(--akzent-text); border-color: var(--akzent); }
.knopf:active { transform: scale(.98); }
.knopf[disabled] { opacity: .45; }
.knopf-leise {
    background: none; border: 0; color: var(--text-leise);
    font: 600 .95rem/1 inherit; padding: 12px 6px; cursor: pointer;
    min-height: 44px;
}
.knopf-reihe { display: flex; flex-direction: column; gap: 10px; }

button:focus-visible, input:focus-visible, select:focus-visible {
    outline: 3px solid var(--akzent); outline-offset: 2px;
}

/* -------------------------------------------------------------- Karten */
.karte {
    background: var(--flaeche); border: 1px solid var(--rand);
    border-radius: var(--radius); padding: 16px;
}
.liste { display: flex; flex-direction: column; gap: 10px; }

.jagd-knopf {
    display: block; width: 100%; text-align: left;
    background: var(--flaeche); border: 2px solid var(--rand);
    border-radius: var(--radius); padding: 16px; color: var(--text);
    font: inherit; cursor: pointer;
}
.jagd-knopf strong { display: block; font-size: 1.15rem; margin-bottom: 4px; }
.jagd-knopf .fortschritt-text { color: var(--akzent); font-weight: 600; font-size: .9rem; }

/* ------------------------------------------------- Offline-Bereitschaft */
.stand { display: flex; align-items: center; gap: 12px; }
.stand-punkt {
    width: 14px; height: 14px; border-radius: 50%;
    background: var(--text-leise); flex: none;
}
.stand-punkt.gut   { background: var(--gut); }
.stand-punkt.warn  { background: var(--warn); }

.netz-hinweis {
    position: fixed; top: var(--oben); left: 0; right: 0; z-index: 50;
    background: var(--akzent); color: var(--akzent-text);
    text-align: center; padding: 8px 16px; font-weight: 600; font-size: .9rem;
}

/* ---------------------------------------------------------- Navigation */
.posten-zahl { color: var(--text-leise); font-size: .95rem; }
.posten-name { text-align: center; margin: 0; }

/* Der Pfeil bekommt den ganzen uebrigen Platz. Er ist das Einzige, worauf
   im Gehen geschaut wird. */
.pfeil-feld {
    flex: 1;
    display: flex; align-items: center; justify-content: center;
    position: relative; min-height: 180px;
}
.pfeil {
    width: min(62vw, 260px); height: min(62vw, 260px);
    color: var(--akzent);
    /* Keine Uebergangszeit auf der Drehung: der Kompass liefert dauernd
       neue Werte, und eine Animation darauf laeuft der Wirklichkeit immer
       hinterher. Ruhig wird der Pfeil durch Glaetten in app.js. */
    transform: rotate(0deg);
    filter: drop-shadow(0 4px 14px rgba(0,0,0,.5));
}
.pfeil.blass { opacity: .25; }
.kein-kompass {
    position: absolute; text-align: center; color: var(--text-leise);
    font-weight: 600; line-height: 1.6;
}

.entfernung {
    text-align: center; font-size: 3.2rem; font-weight: 700;
    margin: 0; line-height: 1;
    font-variant-numeric: tabular-nums;
}
.entfernung.nah { color: var(--gut); }
.genauigkeit { text-align: center; color: var(--text-leise); font-size: .85rem; margin: 0; }
.genauigkeit.schlecht { color: var(--warn); }

.hinweis-text {
    background: var(--flaeche-2); border-left: 4px solid var(--akzent);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 14px 16px; margin: 0;
}

/* ------------------------------------------------------------- Aufgabe */
.treffer { color: var(--gut); font-weight: 700; font-size: 1.1rem; }
.aufgabe-text { font-size: 1.25rem; line-height: 1.5; }

input[type=text], input[type=number], select {
    width: 100%; min-height: 56px; padding: 12px 14px;
    border: 2px solid var(--rand); border-radius: var(--radius);
    background: var(--grund); color: var(--text);
    /* 17px, damit iOS beim Antippen nicht hineinzoomt -- darunter tut es
       das immer, und danach ist die halbe App aus dem Bild. */
    font: 400 17px/1.4 inherit;
}
.etikett { display: block; font-weight: 600; font-size: .9rem;
           color: var(--text-leise); margin: 14px 0 6px; }

.video-rahmen {
    border-radius: var(--radius); overflow: hidden;
    background: #000; aspect-ratio: 3 / 4; margin-bottom: 12px;
}
.video-rahmen video { width: 100%; height: 100%; object-fit: cover; display: block; }
#foto-vorschau { width: 100%; border-radius: var(--radius); margin-bottom: 12px; }

.meldung { border-radius: var(--radius); padding: 12px 14px; font-size: .95rem; }
.meldung.ok   { background: rgba(95,211,141,.15); color: var(--gut); }
.meldung.warn { background: rgba(255,107,74,.15); color: var(--warn); }

/* ------------------------------------------------------------- Galerie */
.galerie {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}
.galerie img { width: 100%; border-radius: 12px; display: block; }

/* ----------------------------------------------------------- Testmodus */
.test-feld {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: var(--flaeche); border-top: 2px solid var(--akzent);
    padding: 14px 16px calc(var(--unten) + 16px);
    max-height: 75vh; overflow-y: auto;
}
.test-feld[hidden] { display: none !important; }
.test-kopf { display: flex; justify-content: space-between; align-items: center; }
.test-zeile { display: flex; gap: 10px; }
input[type=range] { width: 100%; height: 44px; accent-color: var(--akzent); }

.fuss {
    margin-top: auto; display: flex; align-items: center;
    justify-content: space-between; color: var(--text-leise); font-size: .8rem;
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
    .knopf:active { transform: none; }
}

/* Fehlerstreifen. Siehe fehler_zeigen() in app.js: auf einem Handy, das
   vom Home-Bildschirm startet, gibt es keine Konsole -- ein Fehler muss
   auf den Schirm, sonst bleibt die App einfach stehen und niemand weiss,
   warum. */
.fehler-streifen {
    position: fixed; top: var(--oben); left: 0; right: 0; z-index: 70;
    background: var(--warn); color: #1a0a06;
    padding: 10px 16px; font-size: .85rem; font-weight: 600;
    word-break: break-word;
}
