/* „Das Duell“ – App-Styles. Mobil zuerst (360–430 px), Desktop zentriert mit max. 480 px. */

/* ---------- Schriften (selbst gehostet, DSGVO) ---------- */
@font-face { font-family: 'Fredoka'; src: url(../fonts/fredoka-latin-500.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Fredoka'; src: url(../fonts/fredoka-latin-600.woff2) format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Fredoka'; src: url(../fonts/fredoka-latin-700.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Nunito'; src: url(../fonts/nunito-latin-400.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Nunito'; src: url(../fonts/nunito-latin-600.woff2) format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Nunito'; src: url(../fonts/nunito-latin-700.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Nunito'; src: url(../fonts/nunito-latin-800.woff2) format('woff2'); font-weight: 800; font-display: swap; }

/* ---------- Tokens ---------- */
:root {
  --bg: #F3E9D7;
  --bg-dot: #E2D2B6;
  --card: #FBF6EC;
  --field: #FFFDF8;
  --ink: #3B2F25;
  --muted: #6B5A4A;
  --gold: #E8B04B;
  --silver: #DAD3C7;
  --bronze: #D9A57A;
  --flo: #2F6F8F;
  --mama: #E9875F;
  --papa: #7A9A5B;
  --sky: #DCEAF0;
  --error-bg: #F8DCD0;

  --font-head: 'Fredoka', 'Trebuchet MS', sans-serif;
  --font-body: 'Nunito', 'Trebuchet MS', sans-serif;
  --radius: 22px;
  --shadow: 4px 4px 0 var(--ink);
  --nav-h: 56px;
  color-scheme: light;
}

/* ---------- Grundlagen ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image: radial-gradient(var(--bg-dot) 1.5px, transparent 1.5px);
  background-size: 20px 20px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
}
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; line-height: 1.15; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
p { margin: 0 0 .75em; }
p:last-child { margin-bottom: 0; }
a { color: var(--flo); font-weight: 700; }
:focus-visible { outline: 3px solid var(--flo); outline-offset: 2px; }

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.has-nav .app { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 24px); }
.page-auth .app { padding-top: max(32px, env(safe-area-inset-top)); }

.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .9rem; margin-top: 12px; }

/* ---------- Icons ---------- */
.icon { width: 24px; height: 24px; flex: none; }

/* ---------- Kopf, Logo ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo-tile {
  width: 52px; height: 52px; flex: none;
  display: grid; place-items: center;
  background: var(--gold);
  border: 3px solid var(--ink);
  border-radius: 16px;
  box-shadow: 3px 3px 0 var(--ink);
}
.logo-tile .icon { width: 28px; height: 28px; }
.brand-title { font-family: var(--font-head); font-weight: 700; font-size: 1.5rem; line-height: 1.1; margin: 0; }
.brand-sub { color: var(--muted); font-weight: 700; font-size: .9rem; margin: 0; }
.icon-btn {
  position: relative;
  width: 48px; height: 48px;
  display: grid; place-items: center;
  color: var(--ink);
  background: var(--card);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
}
.icon-btn .dot {
  position: absolute; top: 8px; right: 9px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--mama); border: 2px solid var(--card);
}

/* ---------- Karten ---------- */
.card {
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card-center { text-align: center; }

/* ---------- Formulare ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.field > label, .field > legend { font-weight: 800; font-size: .95rem; padding: 0; }
input[type="text"], input[type="password"], input[type="number"], input[type="date"], select, textarea {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  font: inherit;
  font-size: 1.05rem; /* ≥ 16 px verhindert Zoom auf iOS */
  color: var(--ink);
  background: var(--field);
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  -webkit-appearance: none;
  appearance: none;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--flo); outline-offset: 1px; }

.check { display: flex; align-items: center; gap: 12px; min-height: 44px; font-weight: 700; cursor: pointer; }
.check input { width: 24px; height: 24px; accent-color: var(--ink); flex: none; margin: 0; }

.segmented { display: flex; gap: 8px; }
.segmented label { flex: 1; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: flex; align-items: center; justify-content: center;
  min-height: 48px;
  font-weight: 800;
  background: var(--field);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  cursor: pointer;
}
.segmented input:checked + span { background: var(--ink); color: var(--card); }
.segmented input:focus-visible + span { outline: 3px solid var(--flo); outline-offset: 2px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px;
  padding: 12px 20px;
  font: inherit; font-weight: 800; font-size: 1.05rem;
  text-decoration: none;
  border-radius: 999px;
  cursor: pointer;
}
.btn-primary {
  width: 100%;
  color: var(--card);
  background: var(--ink);
  border: 2.5px solid var(--ink);
  box-shadow: 3px 3px 0 var(--flo);
}
.btn-primary:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--flo); }
.btn-secondary { color: var(--ink); background: var(--card); border: 2.5px solid var(--ink); }
.btn-ghost { color: var(--muted); background: transparent; border: 0; min-height: 44px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.logout-form { display: flex; justify-content: center; }

/* ---------- Hinweise ---------- */
.notice {
  margin: 0 0 12px;
  padding: 12px 14px;
  font-weight: 700;
  background: var(--sky);
  border: 2px solid var(--ink);
  border-radius: 14px;
}
.notice-error { background: var(--error-bg); }

/* ---------- Pills & Badges ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px;
  font-weight: 800; font-size: .85rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--field);
}
.pill-gold { background: var(--gold); }

/* ---------- Unten-Navigation ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: var(--card);
  border-top: 3px solid var(--ink);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar ul {
  list-style: none; margin: 0 auto; padding: 4px 8px;
  max-width: 480px;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
}
.tabbar a {
  height: calc(var(--nav-h) - 8px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  color: var(--ink);
  text-decoration: none;
  font-size: .75rem; font-weight: 800;
  border-radius: 14px;
}
.tabbar a .icon { width: 22px; height: 22px; }
.tabbar a.active { background: var(--ink); color: var(--card); }

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