/* MISSION 500 · Team Lionheart · Design-Tokens laut DESIGN.md */
@font-face { font-family: "Unbounded"; src: url("/fonts/unbounded-300-900-latin.woff2") format("woff2"); font-weight: 300 900; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("/fonts/manrope-300-800-latin.woff2") format("woff2"); font-weight: 300 800; font-display: swap; }

:root {
  --bg: #0c0c0c; --bg-warm: #1a1410;
  --surface: #121212; --surface-2: #1a1a1a; --surface-3: #222;
  --text: #f4efe6; --text-muted: #a39d93; --text-dim: #6f6a62;
  --gold: #d4a24a; --gold-light: #fbc970; --gold-deep: #a8752a;
  --gold-border: rgba(212,162,74,.45); --gold-soft: rgba(212,162,74,.14);
  --red: #8b1a1a; --danger: #d6453a; --success: #4f9a63;
  --border: rgba(255,255,255,.08);
  --gold-grad: linear-gradient(135deg,#f6d58a 0%,#d4a24a 45%,#a8752a 100%);
  --silver-grad: linear-gradient(135deg,#f2f2f2 0%,#b9b9b9 50%,#7d7d7d 100%);
  --bronze-grad: linear-gradient(135deg,#e5a26b 0%,#b36a35 50%,#7a4420 100%);
  --r-card: 20px; --r-ctl: 14px;
  --display: "Unbounded", "Avenir Next", sans-serif;
  --body: "Manrope", "Avenir Next", sans-serif;
  --tabbar-h: 76px;
  --ease: cubic-bezier(.2,.7,.2,1);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; color: var(--text); font-family: var(--body); font-size: 16px; line-height: 1.5;
  background: radial-gradient(120% 50% at 50% -8%, #2a1c0b 0%, rgba(42,28,11,0) 60%), var(--bg);
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
img { display: block; max-width: 100%; }
a { color: var(--gold); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.app { max-width: 480px; margin: 0 auto; min-height: 100dvh; position: relative; }
.page { padding: 0 20px calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom)); }
.page > * + * { margin-top: 16px; }

/* Kopf */
.top { display: flex; align-items: center; gap: 10px; padding: calc(12px + env(safe-area-inset-top)) 20px 8px; }
.top .brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.top .logo { width: 40px; height: 40px; object-fit: contain; }
.wordmark { font-family: var(--display); font-weight: 700; font-size: 15px; letter-spacing: .24em; text-transform: uppercase;
  background: linear-gradient(90deg,#b8322a 0%,#d4a24a 28%,#f6d58a 62%,#d4a24a 100%); -webkit-background-clip: text; background-clip: text; color: transparent; white-space: nowrap; }
.top .back { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--text); }
.avatar-btn { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; }

/* Avatar */
.avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center; overflow: hidden;
  background: var(--surface-3); color: var(--gold-light); font-family: var(--display); font-weight: 700; font-size: 13px; letter-spacing: .04em;
  box-shadow: 0 0 0 1.5px var(--gold-border); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 84px; height: 84px; font-size: 26px; }

/* Hero */
.hero { position: relative; margin: 0 -20px; height: 330px; overflow: hidden; }
.hero > img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 35%; }
.hero .fade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(12,12,12,.35) 0%, rgba(12,12,12,0) 30%, rgba(12,12,12,.2) 60%, var(--bg) 100%); }
.hero .title { position: absolute; left: 20px; right: 20px; top: 54px; text-align: center; }
.hero .title img { margin: 0 auto; width: 78%; filter: drop-shadow(0 10px 18px rgba(0,0,0,.65)); }
.m500 { display: inline-block; text-align: center; transform: skewX(-6deg); filter: drop-shadow(0 3px 0 #6b4a12) drop-shadow(0 10px 18px rgba(0,0,0,.7)); }
.m500 .l1, .m500 .l2 { display: block; font-family: var(--display); font-weight: 900; text-transform: uppercase; line-height: .92;
  background: linear-gradient(180deg,#fff0bf 0%,#f6d58a 28%,#d4a24a 55%,#a8752a 78%,#f1cd7a 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.m500 .l1 { font-size: 46px; letter-spacing: .02em; }
.m500 .l2 { font-size: 78px; letter-spacing: .01em; margin-top: -2px; }
.hero + * { margin-top: -84px; position: relative; }

/* Karten */
.card { background: var(--surface); border: 1px solid var(--gold-border); border-radius: var(--r-card); padding: 20px; }
.card.plain { border-color: var(--border); }
.label { font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--text-muted); display: flex; align-items: center; gap: 8px; }
.label svg { width: 16px; height: 16px; color: var(--gold); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile .num { font-family: var(--display); font-weight: 800; font-size: 32px; line-height: 1.1; color: var(--gold-light); margin: 10px 0 2px; font-variant-numeric: tabular-nums; }
.tile .sub { color: var(--text-muted); font-size: 13px; }

/* Fortschritt */
.progress { display: grid; grid-template-columns: 104px 1fr; gap: 16px; align-items: center; margin-top: 14px; }
.ring { width: 104px; height: 104px; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { stroke: #2b2b2b; }
.ring .bar { stroke: url(#goldGrad); stroke-linecap: round; transition: stroke-dashoffset 1.1s var(--ease); }
.ring .pct { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 700; font-size: 21px; color: var(--text); letter-spacing: -.01em; }
.ring .pct small { font-size: 11px; font-weight: 600; margin-left: 2px; color: var(--text-muted); align-self: center; padding-top: 6px; }
.bignum { font-family: var(--display); font-weight: 800; font-size: 34px; line-height: 1; color: var(--gold-light); font-variant-numeric: tabular-nums; white-space: nowrap; letter-spacing: -.01em; }
.bignum .of { font-weight: 300; color: var(--text-muted); font-size: 22px; margin-left: 4px; letter-spacing: 0; }
.progress .sub { color: var(--text-muted); font-size: 14px; margin-top: 6px; }

/* Buttons */
.btn { display: flex; align-items: center; justify-content: center; gap: 10px; height: 56px; border-radius: var(--r-ctl); width: 100%;
  font-family: var(--display); font-weight: 700; font-size: 13px; letter-spacing: .16em; text-transform: uppercase; transition: transform .18s var(--ease), opacity .18s; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn-gold { background: var(--gold-grad); color: #1a1206; box-shadow: 0 10px 28px rgba(212,162,74,.22); }
.btn-ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-outline { background: transparent; color: var(--gold); border: 1px solid var(--gold-border); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid rgba(214,69,58,.4); }
.btn.sm { height: 44px; font-size: 11px; }
.btn svg { width: 18px; height: 18px; }
.link { color: var(--gold); font-weight: 600; font-size: 14px; }
.iconbtn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--text-muted); background: var(--surface-2); }
.iconbtn svg { width: 20px; height: 20px; }

/* Formulare */
.field { display: block; }
.field + .field { margin-top: 14px; }
.field > span { display: block; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 8px; }
.input { width: 100%; height: 54px; padding: 0 16px; border-radius: var(--r-ctl); background: var(--surface-2); border: 1px solid var(--border); color: var(--text); outline: none; transition: border-color .18s; }
.input:focus { border-color: var(--gold); }
.input::placeholder { color: var(--text-dim); }
input[type="date"].input { -webkit-appearance: none; appearance: none; min-width: 0; }
input[type="date"].input::-webkit-calendar-picker-indicator { filter: invert(80%) sepia(40%) saturate(400%) hue-rotate(350deg); }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.stepper { display: flex; align-items: center; justify-content: space-between; background: var(--surface-2); border: 1px solid var(--border); border-radius: 16px; padding: 8px; margin-top: 12px; }
.stepper button { width: 54px; height: 54px; border-radius: 50%; background: var(--surface-3); color: var(--gold); display: grid; place-items: center; }
.stepper button svg { width: 22px; height: 22px; }
.stepper input { width: 110px; text-align: center; background: transparent; border: 0; outline: none; font-family: var(--display); font-weight: 800; font-size: 40px; color: var(--text); -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.hint { font-size: 13px; color: var(--text-muted); margin-top: 10px; }
.hint.warn { color: var(--gold-light); }
.err { background: rgba(139,26,26,.18); border: 1px solid rgba(214,69,58,.45); color: #f2b8b2; padding: 12px 14px; border-radius: var(--r-ctl); font-size: 14px; }
.ok { background: rgba(79,154,99,.12); border: 1px solid rgba(79,154,99,.4); color: #b9e4c4; padding: 12px 14px; border-radius: var(--r-ctl); font-size: 14px; }

/* Titel */
.h1 { font-family: var(--display); font-weight: 800; font-size: 26px; letter-spacing: .06em; text-transform: uppercase; line-height: 1.15; margin: 8px 0 0;
  background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { color: var(--text); font-size: 16px; margin: 8px 0 0; }
.lead.muted { color: var(--text-muted); }
.h2 { font-family: var(--display); font-weight: 700; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted); margin: 0 0 12px; }
.center { text-align: center; }

/* Segmented */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface); border: 1px solid var(--gold-border); border-radius: var(--r-ctl); padding: 4px; }
.seg button { height: 40px; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--text-muted); transition: background .18s, color .18s; }
.seg button.on { background: var(--gold-grad); color: #1a1206; font-weight: 700; }

/* Leaderboard */
.list > * + * { margin-top: 10px; }
.lbrow { display: grid; grid-template-columns: 36px 44px 1fr auto; align-items: center; gap: 12px; padding: 12px 14px 12px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; min-height: 68px; }
.lbrow.me { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(212,162,74,.25), 0 8px 26px rgba(212,162,74,.12); }
.rank { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 13px; color: var(--text-muted); border: 1.5px solid var(--border); font-variant-numeric: tabular-nums; }
.rank.r1 { background: var(--gold-grad); color: #1a1206; border: 0; box-shadow: 0 4px 14px rgba(212,162,74,.35); }
.rank.r2 { background: var(--silver-grad); color: #1a1a1a; border: 0; }
.rank.r3 { background: var(--bronze-grad); color: #1a1206; border: 0; }
.lbrow .name { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lbrow .meta { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lbrow .count { text-align: right; }
.lbrow .count b { display: block; font-family: var(--display); font-weight: 700; font-size: 22px; color: var(--gold-light); line-height: 1.05; font-variant-numeric: tabular-nums; }
.lbrow .count span { font-size: 11px; color: var(--text-muted); }
.lbrow.clickable { cursor: pointer; }
.lbrow.inactive { opacity: .55; }
.pill { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; background: var(--gold-soft); color: var(--gold-light); }
.pill.grey { background: var(--surface-3); color: var(--text-muted); }

/* Einträge */
.entry { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.entry .d { font-weight: 600; }
.entry .d small { display: block; color: var(--text-muted); font-weight: 500; font-size: 12px; }
.entry .n { font-family: var(--display); font-weight: 700; font-size: 20px; color: var(--gold-light); font-variant-numeric: tabular-nums; }
.entry .n.zero { color: var(--text-muted); }

/* Tab-Leiste */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center; pointer-events: none; }
.tabbar .inner { pointer-events: auto; width: 100%; max-width: 480px; display: grid; grid-template-columns: repeat(4,1fr); height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: rgba(12,12,12,.9); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--gold-border); }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--text-muted); font-size: 11px; font-weight: 600; border-radius: 12px; transition: color .18s; }
.tab svg { width: 24px; height: 24px; }
.tab.on { color: var(--gold); }

/* Skeleton */
.sk { background: linear-gradient(90deg,#141414 25%,#1e1e1e 50%,#141414 75%); background-size: 200% 100%; animation: sk 1.3s linear infinite; border-radius: 10px; }
@keyframes sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.sk.line { height: 14px; } .sk.num { height: 34px; width: 60%; } .sk.row { height: 68px; border-radius: 16px; }

/* Leer / Fehler */
.empty { text-align: center; padding: 28px 16px; }
.empty .ic { width: 52px; height: 52px; border-radius: 50%; margin: 0 auto 12px; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold); }
.empty .ic svg { width: 24px; height: 24px; }
.empty p { margin: 0 0 14px; color: var(--text-muted); }

/* Sheet / Dialog */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 480px; max-height: 92dvh; overflow: auto; background: var(--surface); border: 1px solid var(--gold-border); border-bottom: 0; border-radius: 24px 24px 0 0; padding: 12px 20px calc(24px + env(safe-area-inset-bottom)); animation: up .32s var(--ease); }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--surface-3); margin: 0 auto 14px; }
.sheet > * + * { margin-top: 14px; }
@keyframes up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Toast */
.toast { position: fixed; left: 50%; top: calc(14px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 60; background: #1a1a1a; border: 1px solid var(--gold-border); color: var(--text); padding: 12px 18px; border-radius: 14px; font-size: 14px; font-weight: 600; box-shadow: 0 12px 30px rgba(0,0,0,.5); max-width: calc(100% - 40px); animation: up .25s var(--ease); display: flex; gap: 10px; align-items: center; }
.toast svg { width: 18px; height: 18px; color: var(--gold); flex: none; }
.toast.bad { border-color: rgba(214,69,58,.5); } .toast.bad svg { color: var(--danger); }

/* Auth */
.auth { min-height: 100dvh; display: flex; flex-direction: column; }
.auth .hero { height: 46dvh; min-height: 340px; }
.auth .brandline { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 8px; }
.auth .brandline img { width: 34px; height: 34px; }
.authbox { padding: 0 20px 32px; margin-top: -40px; position: relative; }
.authbox > * + * { margin-top: 14px; }

/* Einblend-Moment */
@media (prefers-reduced-motion: no-preference) {
  .fade-in > * { animation: in .45s var(--ease) both; }
  .fade-in > *:nth-child(2) { animation-delay: .06s; } .fade-in > *:nth-child(3) { animation-delay: .12s; }
  .fade-in > *:nth-child(4) { animation-delay: .18s; } .fade-in > *:nth-child(5) { animation-delay: .24s; } .fade-in > *:nth-child(n+6) { animation-delay: .3s; }
  @keyframes in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
}
.fade-in.settled > * { animation: none !important; opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Admin */
.switch { position: relative; width: 50px; height: 30px; border-radius: 15px; background: var(--surface-3); transition: background .18s; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .18s var(--ease); }
.switch.on { background: var(--gold); } .switch.on::after { transform: translateX(20px); }
.kv { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--text-muted); font-size: 14px; }
.kv .v { font-weight: 600; text-align: right; }
.mono { font-family: var(--display); font-weight: 700; letter-spacing: .12em; color: var(--gold-light); }
.divider { height: 1px; background: var(--border); margin: 4px 0; }
.muted { color: var(--text-muted); }
.small { font-size: 13px; }
.mt0 { margin-top: 0 !important; } .mt8 { margin-top: 8px !important; }

@media (min-width: 520px) {
  body { background: radial-gradient(120% 50% at 50% -8%, #2a1c0b 0%, rgba(42,28,11,0) 60%), #090909; }
  .app { box-shadow: 0 0 0 1px var(--border); min-height: 100dvh; }
}
