/* Sportbox-Check - mobile-first, keine Abhaengigkeiten. */

:root {
    --bg:        #f6f5f2;
    --card:      #ffffff;
    --line:      #ddd9d2;
    --text:      #20201e;
    --muted:     #6c6a65;
    --brand:     #1f6f43;
    --brand-ink: #ffffff;
    --good:      #1f6f43;
    --good-bg:   #e6f2ea;
    --bad:       #a52a2a;
    --bad-bg:    #fbeaea;
    --info-bg:   #eef1f6;
    --radius:    14px;
    --tap:       3.5rem;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg:      #16171a;
        --card:    #1f2125;
        --line:    #32353b;
        --text:    #ecebe8;
        --muted:   #a3a19c;
        --brand:   #2f8f59;
        --good:    #65c38c;
        --good-bg: #1b2d22;
        --bad:     #ef8a8a;
        --bad-bg:  #2e1d1d;
        --info-bg: #212630;
    }
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    touch-action: manipulation;
}

/* ---------- Kopfzeile ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: .25rem;
    padding: max(.5rem, env(safe-area-inset-top)) .5rem .5rem;
    background: var(--brand);
    color: var(--brand-ink);
}

.topbar-title {
    flex: 1;
    text-align: center;
    font-weight: 600;
    font-size: 1.05rem;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.topbar-back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    flex: 0 0 2.75rem;
    color: var(--brand-ink);
    font-size: 1.4rem;
    text-decoration: none;
    border-radius: 50%;
}

a.topbar-back:active { background: rgba(255, 255, 255, .18); }

/* ---------- Grundgeruest ---------- */

.wrap {
    max-width: 34rem;
    margin: 0 auto;
    padding: 1rem .9rem calc(2.5rem + env(safe-area-inset-bottom));
}

.wrap.wide { max-width: 50rem; }

h1 { font-size: 1.45rem; line-height: 1.2; margin: .2rem 0 .6rem; }
h2 { font-size: 1.05rem; margin: 1.6rem 0 .5rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

.lead  { color: var(--muted); margin: 0 0 1.1rem; }
.hint  { color: var(--muted); font-size: .9rem; }
.opt   { color: var(--muted); font-weight: 400; }
code   { background: var(--info-bg); padding: .1rem .3rem; border-radius: 4px; font-size: .9em; }

.note {
    padding: .7rem .85rem;
    border-radius: var(--radius);
    margin: 0 0 1rem;
    font-size: .97rem;
}

.note-ok   { background: var(--good-bg); color: var(--good); }
.note-bad  { background: var(--bad-bg);  color: var(--bad); }
.note-info { background: var(--info-bg); }

/* ---------- Buttons ---------- */

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: var(--tap);
    padding: .75rem 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--text);
    font: inherit;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.btn:active { transform: translateY(1px); }

.btn-xl { min-height: 4.25rem; font-size: 1.15rem; }

.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-yes     { background: var(--good);  border-color: var(--good);  color: #fff; }
.btn-no      { background: var(--bad);   border-color: var(--bad);   color: #fff; }
.btn-danger  { background: transparent;  border-color: var(--bad);   color: var(--bad); }

.btn-quiet {
    background: transparent;
    border-color: transparent;
    color: var(--muted);
    font-weight: 500;
    min-height: 2.75rem;
}

.btn-icon {
    width: 2.6rem;
    height: 2.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--card);
    color: var(--text);
    font-size: .8rem;
    cursor: pointer;
}

.btn-icon:disabled { opacity: .3; }

/* ---------- Formulare ---------- */

.stack { display: flex; flex-direction: column; gap: 1rem; margin: 0 0 1.2rem; }

label, .field-label { display: block; font-weight: 600; font-size: .95rem; }

input[type=text], input[type=password], input[type=number], textarea {
    display: block;
    width: 100%;
    margin-top: .35rem;
    padding: .7rem .75rem;
    min-height: var(--tap);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--text);
    font: inherit;
}

textarea { min-height: 4.5rem; resize: vertical; }

input[type=file] {
    display: block;
    width: 100%;
    margin-top: .5rem;
    padding: .7rem;
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    background: var(--card);
    font: inherit;
    color: var(--muted);
}

.field { margin-bottom: 1rem; }

.check {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-top: .5rem;
    font-weight: 500;
}

.check input { width: 1.25rem; height: 1.25rem; }

.center-form { margin: 1.5rem 0 0; display: flex; justify-content: center; }

.danger-zone {
    margin-top: 2.5rem;
    padding-top: 1.2rem;
    border-top: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: .6rem;
}

/* ---------- Kacheln (Startseite) ---------- */

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin: 1.2rem 0; }

.tile {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    padding: .9rem;
    min-height: 5rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    text-decoration: none;
    color: var(--text);
}

.tile-title { font-weight: 600; }
.tile-sub   { color: var(--muted); font-size: .85rem; }

/* ---------- Listen ---------- */

.list { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-direction: column; gap: .5rem; }

.row {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem .6rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
}

.row-main {
    display: flex;
    align-items: center;
    gap: .7rem;
    flex: 1;
    min-width: 0;
    min-height: 3rem;
    color: inherit;
    text-decoration: none;
}

.row-text  { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.row-sub   { color: var(--muted); font-size: .87rem; }
.row-actions { display: flex; gap: .3rem; }
.row-actions form { margin: 0; }
.row-muted { opacity: .55; }
.row-ok    { border-left: 4px solid var(--good); }
.row-bad   { border-left: 4px solid var(--bad); background: var(--bad-bg); }
.row-open  { border-left: 4px solid var(--line); }

.state { width: 1.4rem; text-align: center; font-size: 1.1rem; }
.row-ok .state  { color: var(--good); }
.row-bad .state { color: var(--bad); }
.qty { font-weight: 400; color: var(--muted); font-size: .9em; }

.badge {
    flex: 0 0 auto;
    padding: .25rem .6rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-ok   { background: var(--good-bg); color: var(--good); }
.badge-bad  { background: var(--bad-bg);  color: var(--bad); }
.badge-open { background: var(--info-bg); color: var(--muted); }

/* ---------- Bilder ---------- */

.thumb {
    width: 3.25rem;
    height: 3.25rem;
    flex: 0 0 3.25rem;
    object-fit: cover;
    border-radius: 10px;
    background: var(--info-bg);
}

.preview {
    display: block;
    width: 100%;
    max-height: 14rem;
    object-fit: contain;
    margin-top: .5rem;
    border-radius: var(--radius);
    background: var(--info-bg);
}

.photo-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-weight: 700;
}

/* ---------- Check-Durchlauf ---------- */

.progress {
    position: relative;
    height: 1.6rem;
    border-radius: 999px;
    background: var(--info-bg);
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-bar { height: 100%; background: var(--brand); opacity: .25; transition: width .2s; }

.progress-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .85rem;
    font-weight: 600;
    color: var(--text);
}

.subject { text-align: center; margin-bottom: 1rem; }

.subject-photo {
    display: block;
    width: 100%;
    height: 42vh;
    object-fit: contain;
    border-radius: var(--radius);
    background: var(--card);
    border: 1px solid var(--line);
}

span.subject-photo { height: 42vh; font-size: 3rem; }

.subject-name { font-size: 1.6rem; margin: .7rem 0 .2rem; }
.subject-qty  { margin: 0; color: var(--muted); }

.answer { display: flex; flex-direction: column; gap: .7rem; }

.no-box { border: 0; }
.no-box > summary { list-style: none; }
.no-box > summary::-webkit-details-marker { display: none; }
.no-box[open] > summary { min-height: 3rem; font-size: 1rem; border-radius: var(--radius) var(--radius) 0 0; }

.no-body {
    display: flex;
    flex-direction: column;
    gap: .7rem;
    padding: .9rem;
    border: 1px solid var(--bad);
    border-top: 0;
    border-radius: 0 0 var(--radius) var(--radius);
    background: var(--card);
}

.chips { display: flex; flex-wrap: wrap; gap: .4rem; }

.chip {
    padding: .5rem .7rem;
    min-height: 2.5rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-size: .88rem;
    cursor: pointer;
}

.sticky-bar {
    position: sticky;
    bottom: 0;
    padding: .7rem 0 calc(.7rem + env(safe-area-inset-bottom));
    margin-top: 1rem;
    background: linear-gradient(to bottom, transparent, var(--bg) 35%);
}

.sticky-bar form { margin: 0; }

@media (min-width: 40rem) {
    .subject-photo, span.subject-photo { height: 20rem; }
}

/* ---------- Hinweis-Box (z. B. Website-Einbindung) ---------- */

.hint-box {
    margin: 0 0 1.2rem;
    padding: .7rem .85rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
}

.hint-box summary {
    cursor: pointer;
    font-weight: 600;
}

.hint-box p { margin: .6rem 0; }

.embed-code {
    display: block;
    width: 100%;
    margin: .4rem 0;
    padding: .6rem .7rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--bg);
    color: var(--text);
    font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    resize: vertical;
}
