@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&display=swap');

/* Design-System bewusst identisch zum wm26-card-organizer (Patricks Vorlage):
   warmes Beige, Fredoka als Display-Font, Navy-Hero, iOS-Tab-Bar unten. */
:root {
  --bg-outer: #e7e3da;
  --bg-card: #faf8f2;
  --surface: #fff;
  --surface-btn: #f3efe6;
  --text: #1a1a1a;
  --text-muted: #6b6560;
  --text-faint: #a39d95;
  --border: #ece7dd;
  --border-soft: #e3ddd2;
  --border-dashed: #ddd6c9;
  --red: #E23B2E;
  --blue: #2E4EA4;
  --gold: #EAB000;
  --teal: #17876B;
  --green: #1F9D55;
  --orange: #EE7326;
  --purple: #6E3FA3;
  --font-display: 'Fredoka', sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body, #app { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
  background: var(--bg-outer);
  color: var(--text);
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::-webkit-scrollbar { width: 0; height: 0; }

@keyframes fadeup { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes sheetup { from { transform: translateY(100%); } to { transform: none; } }
@keyframes pop { 0% { transform: scale(.8); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes shake {
  10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); } 40%, 60% { transform: translateX(4px); }
}
.fadeup { animation: fadeup .35s ease; }
.shake { animation: shake .4s; }

/* ---------- app shell ---------- */
.app-shell { height: 100vh; height: 100dvh; display: flex; justify-content: center; background: var(--bg-outer); }
.phone {
  position: relative; width: 100%; max-width: 430px; height: 100%;
  background: var(--bg-card); display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 0 60px rgba(0,0,0,.12);
}
.app-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.app-content { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.loading-screen { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 14px; }

/* ---------- login ---------- */
.login-screen { position: relative; flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 32px 28px; overflow: hidden; }
.login-card { position: relative; background: var(--surface); border-radius: 26px; padding: 32px 26px 26px; box-shadow: 0 24px 60px rgba(26,26,26,.14); }
.login-crest { display: flex; align-items: center; justify-content: center; }
.login-title { text-align: center; margin-top: 12px; font-family: var(--font-display); font-weight: 600; font-size: 22px; }
.login-sub { text-align: center; margin-top: 4px; color: var(--text-muted); font-size: 14px; }
.pin-boxes { display: flex; gap: 12px; justify-content: center; margin: 26px 0 6px; }
.pin-box { width: 52px; height: 60px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 26px; color: var(--blue); background: var(--surface-btn); border: 2px solid transparent; }
.pin-box.filled { background: #eef1fb; border-color: var(--blue); }
.pin-msg { height: 18px; text-align: center; color: #c0392b; font-size: 13px; font-weight: 600; }
.keypad { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-top: 14px; }
.keypad button { height: 56px; border: none; border-radius: 16px; background: var(--surface-btn); font-family: var(--font-display); font-weight: 600; font-size: 24px; color: var(--text); }
.keypad button.ghost { background: transparent; cursor: default; }
.keypad button.del { font-size: 22px; color: var(--text-muted); font-family: inherit; font-weight: 400; }

/* ---------- header / hero ---------- */
.hero { position: relative; padding: 24px 22px 26px; background: linear-gradient(135deg,#2E4EA4,#6E3FA3); overflow: hidden; border-radius: 0 0 28px 28px; color: #fff; }
.hero-blob { position: absolute; border-radius: 100% 0 100% 100%; }
.hero-inner { position: relative; }
.hero .eyebrow { font-size: 13px; opacity: .85; }
.hero .title { font-family: var(--font-display); font-weight: 600; font-size: 26px; margin-top: 2px; }
.hero-stats { display: flex; gap: 10px; margin-top: 18px; }
.hero-stat { flex: 1; background: rgba(255,255,255,.15); border-radius: 14px; padding: 10px 12px; }
.hero-stat .n { font-family: var(--font-display); font-weight: 700; font-size: 22px; line-height: 1; }
.hero-stat .l { font-size: 11px; opacity: .85; margin-top: 3px; }

.screen-header { padding: 22px 20px 10px; display: flex; align-items: flex-start; gap: 12px; }
.screen-header .grow { flex: 1; min-width: 0; }
.screen-title { font-family: var(--font-display); font-weight: 600; font-size: 24px; }
.screen-sub { color: var(--text-muted); font-size: 14px; margin-top: 2px; }
.icon-btn { width: 38px; height: 38px; flex-shrink: 0; border-radius: 50%; border: 1px solid var(--border-soft); background: var(--surface); font-size: 17px; display: flex; align-items: center; justify-content: center; }

.section-title { padding: 20px 20px 8px; font-family: var(--font-display); font-weight: 600; font-size: 17px; display: flex; align-items: baseline; justify-content: space-between; }
.section-title .aside { font-family: inherit; font-weight: 500; font-size: 13px; color: var(--text-muted); }
.empty-state { margin: 8px 20px; padding: 30px; text-align: center; color: var(--text-faint); border: 1.5px dashed var(--border-dashed); border-radius: 18px; font-size: 14px; line-height: 1.5; }

/* ---------- buttons ---------- */
.btn { width: 100%; padding: 15px; border: none; border-radius: 16px; font-family: var(--font-display); font-weight: 600; font-size: 16px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn.primary { background: var(--blue); color: #fff; }
.btn.green { background: var(--green); color: #fff; }
.btn.red { background: var(--red); color: #fff; }
.btn.gold { background: var(--gold); color: #1a1a1a; }
.btn.ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border-soft); }
.btn.disabled, .btn:disabled { background: var(--border-soft); color: var(--text-faint); }
.btn-row { display: flex; gap: 10px; padding: 0 20px; }
.pad { padding: 0 20px; }
.pad-t { margin-top: 12px; }

/* ---------- spiele-liste ---------- */
.match-list { padding: 0 18px; display: flex; flex-direction: column; gap: 10px; }
.match-row { width: 100%; text-align: left; display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; }
.match-row .date { width: 46px; flex-shrink: 0; text-align: center; }
.match-row .date .d { font-family: var(--font-display); font-weight: 700; font-size: 18px; line-height: 1; }
.match-row .date .m { font-size: 11px; color: var(--text-muted); text-transform: uppercase; margin-top: 2px; }
.match-row .info { flex: 1; min-width: 0; }
.match-row .info .opp { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match-row .info .meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.match-score { font-family: var(--font-display); font-weight: 700; font-size: 20px; padding: 6px 12px; border-radius: 12px; background: var(--surface-btn); flex-shrink: 0; }
.match-score.win { background: #e6f5ec; color: var(--green); }
.match-score.loss { background: #fdeceb; color: var(--red); }
.match-score.live { background: #fdf1d6; color: #8a6400; }
.live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--red); margin-right: 5px; vertical-align: middle; animation: pop 1.2s infinite alternate; }

/* ---------- scoreboard (live) ---------- */
.board { margin: 0; padding: 20px 18px 22px; background: linear-gradient(135deg,#2E4EA4,#6E3FA3); color: #fff; border-radius: 0 0 28px 28px; position: relative; overflow: hidden; }
.board-top { position: relative; display: flex; align-items: center; justify-content: space-between; font-size: 13px; opacity: .9; }
.board-back { background: none; border: none; color: #fff; font-size: 14px; padding: 0; display: flex; align-items: center; gap: 4px; }
.board-score { position: relative; display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; }
.board-team { flex: 1; text-align: center; min-width: 0; }
.board-team .nm { font-weight: 600; font-size: 14px; opacity: .9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-team .sc { font-family: var(--font-display); font-weight: 700; font-size: 52px; line-height: 1; margin-top: 2px; }
.board-sep { font-family: var(--font-display); font-weight: 700; font-size: 30px; opacity: .5; }
.board-clock { position: relative; margin-top: 16px; display: flex; align-items: center; gap: 10px; }
.clock-face { flex: 1; background: rgba(255,255,255,.15); border-radius: 16px; padding: 10px 14px; display: flex; align-items: baseline; gap: 10px; }
.clock-time { font-family: var(--font-display); font-weight: 700; font-size: 28px; line-height: 1; font-variant-numeric: tabular-nums; }
.clock-meta { font-size: 12px; opacity: .85; }
.clock-btn { width: 56px; height: 52px; border-radius: 16px; border: none; background: #fff; color: var(--blue); font-size: 20px; flex-shrink: 0; }
.clock-btn.running { background: var(--gold); color: #1a1a1a; }

/* ---------- aktions-buttons live ---------- */
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 16px 18px 4px; }
.action-btn { padding: 16px 12px; border: none; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); text-align: left; }
.action-btn .ic { font-size: 22px; }
.action-btn .tt { font-family: var(--font-display); font-weight: 600; font-size: 15px; margin-top: 6px; }
.action-btn .ss { font-size: 12px; color: var(--text-muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.action-btn.vfb { border-color: #cfd8ee; background: #f4f6fd; }
.action-btn.opp { border-color: var(--border); }

/* ---------- timeline ---------- */
.timeline { padding: 0 18px; display: flex; flex-direction: column; gap: 8px; }
.tl-half { display: flex; align-items: center; gap: 10px; padding: 14px 2px 6px; }
.tl-half .lbl { font-family: var(--font-display); font-weight: 600; font-size: 13px; color: var(--text-muted); }
.tl-half .ln { flex: 1; height: 1px; background: var(--border-soft); }
.tl-row { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 11px 12px; }
.tl-row.opp { background: var(--bg-card); }
.tl-min { width: 42px; flex-shrink: 0; text-align: center; font-family: var(--font-display); font-weight: 700; font-size: 15px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.tl-ic { width: 34px; height: 34px; flex-shrink: 0; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 16px; background: var(--surface-btn); }
.tl-body { flex: 1; min-width: 0; }
.tl-body .t1 { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-body .t2 { font-size: 12px; color: var(--text-muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-del { width: 32px; height: 32px; flex-shrink: 0; border-radius: 10px; border: none; background: transparent; color: var(--text-faint); font-size: 16px; }

/* ---------- avatare ---------- */
.ava {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: 11px; object-fit: cover;
  background: var(--surface-btn); display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 14px; color: var(--text-muted);
}
.ava.num { background: var(--surface-btn); }
.player-row .ava { width: 44px; height: 44px; border-radius: 14px; }
.sheet-photo { display: flex; justify-content: center; padding: 6px 0 2px; }
.sheet-photo img { width: 130px; height: 130px; border-radius: 26px; object-fit: cover; box-shadow: 0 8px 24px rgba(26,26,26,.14); }

/* ---------- kader / chips ---------- */
.chip-wrap { padding: 0 18px; display: flex; flex-wrap: wrap; gap: 8px; }
.pchip { display: inline-flex; align-items: center; gap: 9px; padding: 7px 14px 7px 7px; border-radius: 16px; border: 1.5px solid var(--border-soft); background: var(--surface); font-size: 14px; font-weight: 600; color: var(--text-muted); text-align: left; }
.pchip .lbl { line-height: 1.2; }
.pchip .lbl b { font-family: var(--font-display); font-weight: 700; color: var(--blue); }
.pchip.on { border-color: var(--blue); background: #f4f6fd; color: var(--text); }
.pchip.on .ava.num { background: var(--blue); color: #fff; }
.pchip.start { border-color: var(--green); background: #eef8f2; color: var(--text); }
.pchip.start .ava.num { background: var(--green); color: #fff; }
.pchip.start .lbl b { color: var(--green); }
.pchip.dim { opacity: .45; }

/* ---------- einstellungen: spielerpool ---------- */
.player-row { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 10px 12px; }
.player-num { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex-shrink: 0; border-radius: 12px; background: var(--blue); color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 16px; }
.player-num.none { background: var(--surface-btn); color: var(--text-faint); }
.player-row .nm { flex: 1; font-weight: 600; font-size: 15px; min-width: 0; }
.player-row .warn { display: block; font-weight: 500; font-size: 12px; color: var(--orange); margin-top: 1px; }
.list-col { padding: 0 18px; display: flex; flex-direction: column; gap: 8px; }

/* ---------- formulare ---------- */
.field { padding: 0 20px; margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.field input, .field select {
  width: 100%; padding: 13px 14px; border: 1px solid var(--border-soft); border-radius: 14px;
  background: var(--surface); font-size: 16px; outline: none;
}
.field input:focus, .field select:focus { border-color: var(--blue); }
.field-row { display: flex; gap: 12px; padding: 0 20px; margin-bottom: 14px; }
.field-row > div { flex: 1; }
.field-row > div.narrow { flex: 0 0 96px; }
.field-row label { display: block; font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.field-row input { width: 100%; padding: 13px 14px; border: 1px solid var(--border-soft); border-radius: 14px; background: var(--surface); font-size: 16px; outline: none; }

/* ---------- minuten-stepper ---------- */
.minute-box { display: flex; align-items: center; gap: 14px; justify-content: center; margin: 6px 0 4px; }
.minute-val { font-family: var(--font-display); font-weight: 700; font-size: 46px; line-height: 1; min-width: 96px; text-align: center; font-variant-numeric: tabular-nums; }
.minute-val .u { font-size: 18px; color: var(--text-muted); margin-left: 2px; }
.round-btn { width: 50px; height: 50px; border-radius: 50%; border: 1px solid var(--border-soft); background: var(--surface); font-size: 24px; color: var(--text); display: flex; align-items: center; justify-content: center; }
.round-btn:disabled { color: var(--border-dashed); }
.minute-hint { text-align: center; font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }

/* ---------- bottom nav ---------- */
.bottom-nav {
  position: absolute; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,.94);
  backdrop-filter: blur(10px); border-top: 1px solid var(--border); display: flex;
  padding: 8px 6px calc(12px + env(safe-area-inset-bottom));
}
.nav-btn { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; background: none; border: none; padding: 4px 0; color: var(--text-faint); }
.nav-btn.active { color: var(--blue); }
.nav-btn .icon { font-size: 19px; line-height: 1; filter: grayscale(1) opacity(.7); }
.nav-btn.active .icon { filter: none; }
.nav-btn .label { font-size: 10px; font-weight: 600; }

/* ---------- sheet + toast ---------- */
.sheet-backdrop { position: absolute; inset: 0; background: rgba(26,26,26,.45); z-index: 20; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 21; background: var(--bg-card);
  border-radius: 24px 24px 0 0; padding: 8px 0 calc(24px + env(safe-area-inset-bottom));
  max-height: 88%; overflow-y: auto; animation: sheetup .28s ease;
}
.sheet-handle { width: 40px; height: 4px; background: var(--border-dashed); border-radius: 99px; margin: 8px auto 14px; }
.sheet-title { font-family: var(--font-display); font-weight: 600; font-size: 20px; padding: 0 20px 2px; }
.sheet-sub { font-size: 13px; color: var(--text-muted); padding: 0 20px 12px; }

.toast {
  position: absolute; left: 50%; bottom: 110px; transform: translateX(-50%); z-index: 30;
  background: var(--text); color: #fff; padding: 11px 20px; border-radius: 18px; font-size: 14px;
  font-weight: 600; animation: pop .3s ease; max-width: 84%; text-align: center; line-height: 1.4;
}
.toast.bad { background: var(--red); }

/* ---------- share preview ---------- */
.share-preview { padding: 0 18px; }
.share-preview img { width: 100%; border-radius: 18px; border: 1px solid var(--border); display: block; }
