/* Golf-App – mobiles Design im Golf-Look */
:root {
    --green-900: #14532d;
    --green-700: #15803d;
    --green-600: #16a34a;
    --green-100: #dcfce7;
    --sand: #fef9ec;
    --ink: #1c2a22;
    --muted: #64748b;
    --card: #ffffff;
    --line: #e2e8f0;
    --gold: #f59e0b;
    --red: #dc2626;
    --radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: linear-gradient(180deg, var(--sand) 0%, #f0f7f1 100%);
    color: var(--ink);
    min-height: 100vh;
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
}

/* Hintergrundbild (app/assets/hintergrund.jpg) mit hellem Schleier,
   damit Karten und Texte lesbar bleiben. Fehlt die Datei, bleibt der
   Farbverlauf des body sichtbar. */
body:not(.login-body)::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(180deg, rgba(254, 250, 240, .82) 0%, rgba(240, 247, 241, .78) 100%),
        url('hintergrund.jpg') center top / cover no-repeat;
}

.hidden { display: none !important; }

/* ---------- Login ---------- */
.login-body {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 24px;
    background: radial-gradient(circle at 30% 20%, #1c7a3f 0%, var(--green-900) 70%);
}

/* Login: Hintergrundbild mit dunkelgrünem Schleier für Stimmung + Lesbarkeit */
.login-body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    background:
        linear-gradient(180deg, rgba(16, 45, 28, .55) 0%, rgba(12, 35, 22, .75) 100%),
        url('hintergrund.jpg') center top / cover no-repeat;
}
.login-card { position: relative; z-index: 1; }
.login-card {
    background: var(--card); border-radius: 24px; padding: 36px 28px;
    width: 100%; max-width: 360px; text-align: center;
    box-shadow: 0 24px 60px rgba(0,0,0,.35);
}
.login-logo { font-size: 56px; }
.login-card h1 { margin: 8px 0 2px; color: var(--green-900); }
.login-sub { color: var(--muted); margin-bottom: 22px; }
.login-error { color: var(--red); margin-bottom: 12px; font-weight: 600; }
.login-card input {
    width: 100%; padding: 15px 16px; font-size: 18px; text-align: center;
    border: 2px solid var(--line); border-radius: 14px; margin-bottom: 12px;
}
.login-card input:focus { outline: none; border-color: var(--green-600); }
.login-card button {
    width: 100%; padding: 15px; font-size: 17px; font-weight: 700;
    background: var(--green-700); color: #fff; border: 0; border-radius: 14px;
}

/* ---------- Grundgerüst ---------- */
.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; justify-content: space-between; align-items: center;
    background: var(--green-900); color: #fff;
    padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
}
.topbar-title { font-weight: 800; font-size: 18px; letter-spacing: .3px; }
.topbar-logout { color: #bbf7d0; font-size: 13px; text-decoration: none; }

#main { padding: 16px; max-width: 560px; margin: 0 auto; }

h2 { color: var(--green-900); margin-bottom: 12px; font-size: 22px; }
.intro { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.mini-hint { color: var(--muted); font-size: 12px; margin-top: 10px; }
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 10px 0 6px; }

.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.badge {
    background: var(--green-100); color: var(--green-900);
    font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 999px;
}

.empty-hint { text-align: center; color: var(--muted); padding: 60px 20px; }
.empty-icon { font-size: 52px; margin-bottom: 12px; }

.warn { color: var(--red); font-weight: 600; margin-top: 10px; font-size: 14px; }

/* ---------- Buttons & Formulare ---------- */
.btn-primary {
    background: var(--green-700); color: #fff; border: 0;
    border-radius: 14px; font-weight: 700; font-size: 16px;
    padding: 12px 18px; cursor: pointer;
}
.btn-primary:active { transform: scale(.97); }
.btn-big { width: 100%; padding: 16px; font-size: 18px; margin-top: 14px; }

.select-big {
    width: 100%; padding: 14px; font-size: 16px; background: var(--card);
    border: 2px solid var(--line); border-radius: 14px;
}

.row-form { display: flex; gap: 8px; margin-bottom: 8px; }
.row-form input[type="text"] { flex: 1; min-width: 0; }
.row-form input { padding: 12px; font-size: 16px; border: 2px solid var(--line); border-radius: 12px; background: var(--card); }
.row-form input[type="number"] { width: 84px; }
.row-form button { width: 52px; font-size: 22px; }

/* ---------- Spieler-Liste ---------- */
.player-card {
    background: var(--card); border-radius: var(--radius); padding: 14px;
    margin-bottom: 10px; box-shadow: 0 2px 10px rgba(20,83,45,.06);
}
.player-top { display: flex; align-items: center; justify-content: space-between; }
.player-name { font-weight: 700; font-size: 16px; }
.player-hcp { color: var(--muted); font-size: 13px; }
.player-del { background: none; border: 0; color: #cbd5e1; font-size: 18px; padding: 4px 8px; }
.player-edit { display: flex; align-items: center; gap: 8px; }
.player-edit label { font-size: 12px; color: var(--muted); font-weight: 600; }
.player-edit input {
    width: 76px; margin-left: 4px; padding: 10px; font-size: 16px;
    border: 2px solid var(--line); border-radius: 10px; text-align: center;
}
.player-edit input:focus { outline: none; border-color: var(--green-600); }

/* Vorgaben-Vorschau bei der Auslosung */
.preview-box {
    background: var(--card); border-radius: var(--radius); padding: 12px;
    margin-top: 12px; box-shadow: 0 2px 10px rgba(20,83,45,.06);
}
.preview-title { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 8px; }
.preview-chip {
    display: inline-block; background: var(--green-100); color: var(--green-900);
    border-radius: 999px; padding: 6px 12px; margin: 3px 4px 3px 0; font-size: 13px;
}
.preview-chip b { color: var(--green-700); }

/* Segment-Umschalter (Gesamt / Tag 1 / Tag 2) */
.seg {
    display: flex; background: #e8efe9; border-radius: 12px; padding: 4px;
    margin-bottom: 14px; gap: 4px;
}
.seg-btn {
    flex: 1; border: 0; background: none; padding: 10px 4px;
    font-size: 14px; font-weight: 700; color: var(--muted);
    border-radius: 9px; cursor: pointer;
}
.seg-btn.active { background: #fff; color: var(--green-900); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.seg-btn:disabled { opacity: .4; cursor: default; }

/* Abschlag-Infos in der Platzpflege */
.tee-chips { margin-bottom: 10px; }
.tee-chip {
    display: inline-block; background: #f1f5f9; color: var(--ink);
    border-radius: 999px; padding: 5px 10px; margin: 2px 4px 2px 0; font-size: 12px; font-weight: 600;
}

/* ---------- Team-Karten ---------- */
.team-card {
    background: var(--card); border-radius: var(--radius);
    padding: 14px 16px; margin-bottom: 10px;
    display: flex; align-items: center; justify-content: space-between;
    box-shadow: 0 2px 10px rgba(20,83,45,.06);
}
.team-names { font-weight: 700; }
.team-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.team-vg {
    background: var(--green-100); color: var(--green-900); font-weight: 800;
    border-radius: 12px; padding: 8px 12px; text-align: center; min-width: 64px;
}
.team-vg small { display: block; font-weight: 600; font-size: 10px; color: var(--green-700); }

/* ---------- Leaderboard ---------- */
.board-row {
    background: var(--card); border-radius: var(--radius);
    padding: 12px 14px; margin-bottom: 8px;
    display: flex; align-items: center; gap: 12px;
    box-shadow: 0 2px 10px rgba(20,83,45,.06);
    transition: transform .3s;
}
.board-row.first { border: 2px solid var(--gold); }
.board-rank { font-size: 20px; font-weight: 800; width: 34px; text-align: center; color: var(--green-900); }
.board-main { flex: 1; min-width: 0; }
.board-team { font-weight: 700; font-size: 15px; }
.board-sub { color: var(--muted); font-size: 12px; }
.board-pts { text-align: center; }
.board-pts b { font-size: 22px; color: var(--green-700); }
.board-pts small { display: block; color: var(--muted); font-size: 10px; }

/* ---------- Scoring ---------- */
.score-summary {
    display: flex; gap: 8px; margin: 12px 0;
}
.sum-box {
    flex: 1; background: var(--card); border-radius: 12px; padding: 10px;
    text-align: center; box-shadow: 0 2px 10px rgba(20,83,45,.06);
}
.sum-box b { font-size: 20px; color: var(--green-900); display: block; }
.sum-box span { font-size: 11px; color: var(--muted); }

.hole-row {
    background: var(--card); border-radius: 12px; padding: 10px 12px;
    margin-bottom: 6px; display: flex; align-items: center; gap: 10px;
    box-shadow: 0 1px 6px rgba(20,83,45,.05);
}
.hole-no { width: 40px; text-align: center; }
.hole-no b { font-size: 17px; color: var(--green-900); display: block; }
.hole-no small { font-size: 10px; color: var(--muted); }
.hole-info { flex: 1; font-size: 12px; color: var(--muted); }
.hole-dots { color: var(--green-600); letter-spacing: 2px; }
.hole-ctrl { display: flex; align-items: center; gap: 6px; }
.hole-ctrl button {
    width: 40px; height: 40px; border-radius: 12px; border: 0;
    background: var(--green-100); color: var(--green-900);
    font-size: 20px; font-weight: 800;
}
.hole-ctrl button:active { background: var(--green-600); color: #fff; }
.hole-val { width: 30px; text-align: center; font-weight: 800; font-size: 18px; }
.hole-val.empty { color: #cbd5e1; }
.hole-pts {
    width: 40px; text-align: center; font-weight: 800; border-radius: 10px; padding: 6px 0;
    background: #f1f5f9; color: var(--muted); font-size: 14px;
}
.hole-pts.good { background: var(--green-100); color: var(--green-700); }

.h-map {
    background: none; border: 0; font-size: 20px; padding: 4px 2px 4px 0; cursor: pointer;
}

/* ---------- Passwort-Abfrage Auslosung ---------- */
.pin-overlay {
    position: fixed; inset: 0; z-index: 95;
    background: rgba(15, 40, 25, .55);
    display: flex; align-items: center; justify-content: center; padding: 24px;
}
.pin-card {
    background: #fff; border-radius: 20px; padding: 24px 20px;
    width: 100%; max-width: 340px; text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,.35);
}
.pin-icon { font-size: 40px; margin-bottom: 6px; }
.pin-card h3 { color: var(--green-900); margin-bottom: 6px; }
.pin-card p { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.pin-card input {
    width: 100%; padding: 13px; font-size: 17px; text-align: center;
    border: 2px solid var(--line); border-radius: 12px; margin-bottom: 14px;
}
.pin-card input:focus { outline: none; border-color: var(--green-600); }
.pin-actions { display: flex; gap: 10px; }
.pin-actions .btn-primary { flex: 1; }
.btn-plain {
    flex: 1; background: #f1f5f9; color: var(--ink); border: 0;
    border-radius: 14px; font-weight: 700; font-size: 16px; padding: 12px;
}

/* ---------- Bahn-Vollbildansicht ---------- */
.hole-overlay {
    position: fixed; inset: 0; z-index: 90;
    background: #fff; display: flex; flex-direction: column;
}
.hole-overlay-top {
    background: var(--green-900); color: #fff; font-weight: 800; font-size: 17px;
    padding: calc(12px + env(safe-area-inset-top)) 16px 12px; text-align: center;
}
.hole-overlay-scroll {
    flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
    display: flex; justify-content: center; background: #fff;
}
.hole-overlay-scroll img { width: 100%; max-width: 560px; height: auto; display: block; }
#hole-overlay-back {
    margin: 10px 16px calc(12px + env(safe-area-inset-bottom));
}

/* ---------- Plätze ---------- */
.course-card {
    background: var(--card); border-radius: var(--radius); padding: 14px;
    margin-bottom: 14px; box-shadow: 0 2px 10px rgba(20,83,45,.06);
}
.course-name-row { display: flex; gap: 8px; margin-bottom: 10px; }
.course-name-row input {
    flex: 1; padding: 12px; font-size: 16px; font-weight: 700;
    border: 2px solid var(--line); border-radius: 12px;
}
.holes-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.holes-table th { color: var(--muted); font-size: 11px; text-align: center; padding: 4px; }
.holes-table td { text-align: center; padding: 3px; }
.holes-table td.hnum { font-weight: 700; color: var(--green-900); }
.holes-table input {
    width: 52px; padding: 8px 4px; text-align: center; font-size: 15px;
    border: 1.5px solid var(--line); border-radius: 8px;
}
.course-save { margin-top: 10px; width: 100%; }

/* ---------- Untere Navigation ---------- */
.tabbar {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    display: flex; background: #fff;
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
}
.tab {
    flex: 1; background: none; border: 0; padding: 8px 0 10px;
    font-size: 11px; font-weight: 600; color: var(--muted);
    display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.tab span { font-size: 22px; }
.tab.active { color: var(--green-700); }

/* ---------- Auslosungs-Overlay ---------- */
.draw-overlay {
    position: fixed; inset: 0; z-index: 100;
    background: radial-gradient(circle at 50% 25%, #1c7a3f 0%, var(--green-900) 75%);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 24px; overflow: hidden;
}
#confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#draw-stage { position: relative; width: 100%; max-width: 420px; z-index: 2; }
#draw-close { max-width: 420px; z-index: 2; background: #fff; color: var(--green-900); }

.draw-title {
    text-align: center; color: #fff; font-size: 22px; font-weight: 800;
    margin-bottom: 18px; text-shadow: 0 2px 12px rgba(0,0,0,.4);
}

.chip-cloud { position: relative; height: 300px; }
.chip {
    position: absolute; padding: 10px 16px; background: #fff; border-radius: 999px;
    font-weight: 700; color: var(--green-900); white-space: nowrap;
    box-shadow: 0 6px 20px rgba(0,0,0,.35);
    transition: top 0.55s cubic-bezier(.34,1.3,.5,1), left 0.55s cubic-bezier(.34,1.3,.5,1), transform 0.55s;
}

.team-reveal {
    background: #fff; border-radius: 18px; padding: 16px;
    margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between;
    opacity: 0; transform: translateY(30px) scale(.9);
    transition: opacity .5s, transform .5s cubic-bezier(.34,1.4,.5,1);
    box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.team-reveal.shown { opacity: 1; transform: none; }
.team-reveal .tr-names { font-weight: 800; color: var(--ink); }
.team-reveal .tr-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.team-reveal .tr-vg {
    background: var(--green-100); color: var(--green-900); font-weight: 800; font-size: 18px;
    border-radius: 12px; padding: 8px 12px; min-width: 60px; text-align: center;
}
.team-reveal .tr-vg small { display: block; font-size: 9px; font-weight: 700; color: var(--green-700); }

/* ---------- Toast ---------- */
.toast {
    position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
    background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px;
    font-size: 14px; font-weight: 600; z-index: 200; max-width: 90%;
    box-shadow: 0 8px 24px rgba(0,0,0,.3); text-align: center;
}
.toast.error { background: var(--red); }
