/* ============================================================
   Schützenhaus Gnöd — style.css
   Starke Kontraste, klare Struktur
   ============================================================ */

:root {
  --blue:        #0f2d6b;
  --blue-hover:  #1a3f8f;
  --blue-light:  #ddeaff;
  --blue-mid:    #7aaaf0;
  --accent:      #c8000a;

  --text:        #0a0a0a;
  --text-muted:  #444444;
  --text-hint:   #777777;

  --bg:          #e8eaed;
  --bg-card:     #ffffff;
  --bg-input:    #ffffff;
  --bg-tertiary: #d0d3d8;

  --border:      #999999;
  --border-med:  #666666;

  --radius:      10px;
  --radius-sm:   6px;

  --green-bg:    #d4edda;
  --green-text:  #155724;
  --amber-bg:    #fff3cd;
  --amber-text:  #856404;

  --danger:      #b30000;
  --danger-bg:   #ffe5e5;
  --danger-border: #cc0000;

  --shadow:      0 2px 6px rgba(0,0,0,0.18);
  --shadow-card: 0 1px 4px rgba(0,0,0,0.12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --blue:        #4d8aff;
    --blue-hover:  #6fa0ff;
    --blue-light:  #1a2d4a;
    --blue-mid:    #3a6bbf;
    --accent:      #ff4d4d;

    --text:        #f0f0f0;
    --text-muted:  #b0b0b0;
    --text-hint:   #808080;

    --bg:          #111318;
    --bg-card:     #1e2128;
    --bg-input:    #252830;
    --bg-tertiary: #2a2e38;

    --border:      #555555;
    --border-med:  #777777;

    --green-bg:    #1a3a22;
    --green-text:  #7ed9a0;
    --amber-bg:    #3a2d00;
    --amber-text:  #ffc940;

    --danger:      #ff6b6b;
    --danger-bg:   #3a1010;
    --danger-border: #cc3333;
  }
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 19px;
  line-height: 1.5;
  overscroll-behavior: none;
}

/* ── App Shell ──────────────────────────────────────────────── */
.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  overflow: hidden;
  position: relative;
}

@media (min-width:1000px) {
  body {
    background: #d0d3d8;
  }
  .app {
    box-shadow: 0 0 60px rgba(0,0,0,0.18);
  }
}

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  background: var(--blue);
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.topbar h1 {
  font-size: 21px;
  font-weight: 600;
  color: #fff;
  flex: 1;
  letter-spacing: 0.01em;
}

.topbar-icon {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  line-height: 1;
}
.topbar-icon:active { background: rgba(255,255,255,0.3); }

/* ── Screens ────────────────────────────────────────────────── */
.screen {
  display: none;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex-direction: column;
  background: var(--bg);
}
.screen.active { display: flex; }
.pad { padding: 14px; }

/* ── Bottom Nav ─────────────────────────────────────────────── */
.bottomnav {
  display: flex;
  border-top: 2px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
  padding-bottom: env(safe-area-inset-bottom);
}

.tabnav {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  gap: 3px;
  border: none;
  background: none;
  border-top: 3px solid transparent;
  transition: color 0.15s;
}
.tabnav svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tabnav.active {
  color: var(--blue);
  border-top-color: var(--blue);
  background: var(--blue-light);
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-card);
}

/* ── Section Label ──────────────────────────────────────────── */
.section-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 14px 0 8px;
}

/* ── Tags ───────────────────────────────────────────────────── */
.tag {
  font-size: 15px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
  border: 1px solid transparent;
}
.tag-hsm  { background: var(--amber-bg);  color: var(--amber-text);  border-color: #d4a017; }
.tag-sm   { background: var(--green-bg);  color: var(--green-text);  border-color: #2d8a4e; }
.tag-blue { background: var(--blue-light); color: var(--blue);        border-color: var(--blue-mid); }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: block;
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-med);
  background: var(--bg-card);
  font-size: 19px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text);
  text-align: center;
  font-family: inherit;
  transition: background 0.15s;
}
.btn:active { opacity: 0.8; }
.btn + .btn { margin-top: 8px; }

.btn-primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
  font-weight: 600;
}
.btn-primary:active { background: var(--blue-hover); }

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-border);
  font-weight: 600;
}

/* ── Form ───────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }

.form-label {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 19px;
  font-family: inherit;
  background: var(--bg-input);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.form-input:focus { border-color: var(--blue); }

.form-select {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 18px;
  font-weight: 500;
  font-family: inherit;
  background: var(--bg-input);
  color: var(--text);
  outline: none;
}
.form-select:focus { border-color: var(--blue); }

/* ── Score List ─────────────────────────────────────────────── */
.score-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1.5px solid var(--border);
}
.score-thumb {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--blue-light);
  border: 1.5px solid var(--blue-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.score-thumb svg { width: 20px; height: 20px; stroke: var(--blue); fill: none; stroke-width: 2; }
.score-info { flex: 1; }
.score-name { font-size: 18px; font-weight: 600; color: var(--text); }
.score-meta { font-size: 16px; color: var(--text-muted); font-weight: 500; }
.score-total { font-size: 19px; font-weight: 700; color: var(--blue); white-space: nowrap; }

/* ── Passe Block ────────────────────────────────────────────── */
.passe-block {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 10px;
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}
.passe-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 3px; }
.passe-title  { font-size: 18px; font-weight: 700; color: var(--text); }
.passe-total  { font-size: 18px; font-weight: 700; color: var(--blue); }
.passe-meta   { font-size: 16px; font-weight: 500; color: var(--text-muted); margin-bottom: 10px; }

/* ── Score Input ────────────────────────────────────────────── */
.schuss-cols { display: flex; gap: 4px; flex-wrap: nowrap; overflow-x: auto; align-items: flex-start; padding-bottom: 4px; }



.schuss-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex: 0 0 calc((100% - 5 * 4px) / 6) !important;
  width: calc((100% - 5 * 4px) / 6) !important;
  min-width: 0 !important;
}

.pt-btn {
  width: 100% !important;
  height: 54px !important;
  font-size: 14px;
}
.schuss-col-header {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-muted);
  height: 24px;
  display: flex;
  align-items: center;
}
.schuss-val {
  width: 100%;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--blue-mid);
  background: var(--blue-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--blue);
}
.schuss-val.empty {
  background: var(--bg-tertiary);
  border: 2px dashed var(--border);
  color: var(--text-hint);
  font-weight: 400;
}
.pt-btn {
  width: 100%;
  min-width: 0;
  height: 44px;
  border-radius: 4px;
  border: 1.5px solid var(--border);
  font-size: 14px;
  font-weight: 600;
  background: var(--bg-card);
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.1s;
}
.pt-btn:active { opacity: 0.7; }
.pt-btn.sel {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.3);
  font-weight: 800;
}

/* Ausgewählter Wert oben in der Spalte */
.schuss-val:not(.empty) {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
  font-weight: 700;
}

/* ── Image Slots ────────────────────────────────────────────── */
.img-row { display: flex; gap: 4px; margin-top: 10px; }
.img-slot {
  flex: 0 0 calc((100% - 5 * 4px) / 6);
  width: calc((100% - 5 * 4px) / 6);
  height: 48px;
  border-radius: var(--radius-sm);
  border: 2px dashed var(--border-med);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  cursor: pointer;
  transition: border-color 0.15s;
}
.img-slot:active { opacity: 0.7; }
.img-slot.filled {
  background: var(--blue-light);
  border: 2px solid var(--blue-mid);
}
.img-slot svg { width: 20px; height: 20px; stroke: var(--text-muted); fill: none; stroke-width: 2; }
.img-slot.filled svg { stroke: var(--blue); }

/* ── Total Bar ──────────────────────────────────────────────── */
.total-bar {
  background: var(--blue);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 0 12px;
}
.total-label { font-size: 17px; font-weight: 600; color: rgba(255,255,255,0.85); }
.total-val   { font-size: 24px; font-weight: 700; color: #fff; }

/* ── Signature ──────────────────────────────────────────────── */
.sig-canvas {
  width: 100%;
  height: 156px;
  border: 3px solid var(--blue);
  border-radius: var(--radius-sm);
  background: #ffffff;
  cursor: crosshair;
  touch-action: none;
  display: block;
}
.sig-clear {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 0;
  text-decoration: underline;
}

/* ── Kontakt ────────────────────────────────────────────────── */
.kontakt-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1.5px solid var(--border);
}
.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--blue);
  border: 2px solid var(--blue-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }

/* ── Kalender ───────────────────────────────────────────────── */
.kal-item {
  padding: 11px 0;
  border-bottom: 1.5px solid var(--border);
}
.kal-date  { font-size: 15px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.kal-title { font-size: 19px; font-weight: 700; margin: 3px 0 2px; color: var(--text); }
.kal-time  { font-size: 17px; font-weight: 500; color: var(--text-muted); margin-bottom: 6px; }
.kal-tags  { display: flex; gap: 4px; flex-wrap: wrap; }

/* ── Timer ──────────────────────────────────────────────────── */
.timer-display {
  font-size: 92px;
  font-weight: 700;
  text-align: center;
  padding: 20px 0 4px;
  color: var(--text);
  letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.timer-display.running { color: var(--blue); }
.timer-display.urgent  { color: var(--danger); }

.zeit-grid { display: grid; grid-template-columns: repeat(5,1fr); gap: 6px; margin: 8px 0; }
.zeit-chip {
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 4px;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  background: var(--bg-card);
  color: var(--text);
  font-family: inherit;
}
.zeit-chip.sel {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.timer-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }

/* ── Login ──────────────────────────────────────────────────── */
.login-wrap {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  flex: 1;
  padding: 32px 24px;
  background: var(--bg);
}
.login-logo  { font-size: 60px; margin-bottom: 10px; }
.login-title { font-size: 26px; font-weight: 700; color: var(--blue); margin-bottom: 4px; }
.login-sub   { font-size: 18px; color: var(--text-muted); font-weight: 500; margin-bottom: 32px; }
.login-form  { width: 100%; max-width: 340px; }

.error-msg {
  background: var(--danger-bg);
  color: var(--danger);
  border: 2px solid var(--danger-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 12px;
  display: none;
}

/* ── Admin ──────────────────────────────────────────────────── */
.admin-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1.5px solid var(--border);
  cursor: pointer;
}
.admin-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--blue-light);
  border: 1.5px solid var(--blue-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.admin-icon svg { width: 20px; height: 20px; stroke: var(--blue); fill: none; stroke-width: 2; }
.admin-label { font-size: 19px; font-weight: 600; color: var(--text); }
.admin-sub   { font-size: 16px; font-weight: 500; color: var(--text-muted); }
.chevron { width: 18px; height: 18px; stroke: var(--text-hint); fill: none; stroke-width: 2.5; margin-left: auto; }

/* ── Loader ─────────────────────────────────────────────────── */
.loader { display: flex; align-items: center; justify-content: center; flex: 1; min-height: 80px; }
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ──────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%);
  background: #111;
  color: #fff;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 17px;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  z-index: 999;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.toast.show { opacity: 1; }

/* ── Overlay / Modal ────────────────────────────────────────── */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 100;
  align-items: flex-end;
}
.overlay.show { display: flex; }
.modal {
  background: var(--bg-card);
  border-radius: 20px 20px 0 0;
  border-top: 3px solid var(--blue);
  padding: 20px 16px 32px;
  width: 100%;
  max-height: 85dvh;
  overflow-y: auto;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.25);
}
.modal-handle {
  width: 40px;
  height: 5px;
  background: var(--border-med);
  border-radius: 3px;
  margin: 0 auto 16px;
}
.modal-title { font-size: 22px; font-weight: 700; margin-bottom: 16px; color: var(--text); }

/* ── Rangliste ──────────────────────────────────────────────── */
.rang-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1.5px solid var(--border);
}
.rang-nr        { width: 26px; font-size: 18px; font-weight: 700; color: var(--text-muted); flex-shrink: 0; }
.rang-nr.gold   { color: #b8860b; }
.rang-nr.silver { color: #606060; }
.rang-info      { flex: 1; }
.rang-name      { font-size: 18px; font-weight: 600; color: var(--text); }
.rang-detail    { font-size: 16px; font-weight: 500; color: var(--text-muted); }
.rang-score     { font-size: 19px; font-weight: 700; color: var(--blue); }

/* ── Offene Termine ─────────────────────────────────────────── */
.termin-datum {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 2px;
}
