:root {
  --bg: #0b0f1e;
  --bg2: #10162a;
  --card: #151c33;
  --card2: #1b2340;
  --line: rgba(255, 255, 255, 0.07);
  --text: #eef1fb;
  --muted: #8d97b8;
  --gold: #ffd040;
  --green: #3ee07a;
  --red: #ff5a6a;
  --purple: #a77bff;
  --cyan: #3cc8ff;
  --pink: #ff7ad9;
  --r: 18px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  font-variant-numeric: tabular-nums;
}
.hidden { display: none !important; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
h1, h2, .num, .stat-v, .hero-n, .top-name, .board-v, .tabs span { font-family: "Fredoka", -apple-system, sans-serif; }
h2 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: 0.2px; }
.muted { color: var(--muted); }
.small { font-size: 12px; margin-top: 8px; }

/* Login */
.login { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(120% 80% at 50% 0%, #2a1f5c 0%, var(--bg) 60%); }
.login-card { width: 100%; max-width: 340px; text-align: center; }
.login-icon { width: 96px; height: 96px; border-radius: 24px; box-shadow: 0 12px 40px rgba(167, 123, 255, 0.35); }
.login h1 { margin: 18px 0 4px; font-size: 30px; font-weight: 700; }
.login h1 span, .top-name span { color: var(--gold); }
.login p { margin: 0 0 22px; color: var(--muted); }
.login input { width: 100%; padding: 15px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--card);
  color: var(--text); font-size: 17px; outline: none; }
.login input:focus { border-color: var(--purple); }
.login button { width: 100%; margin-top: 12px; padding: 15px; border-radius: 14px; font-weight: 700; font-size: 17px;
  background: linear-gradient(180deg, #ffe066, #ffbf1f); color: #2a1c00; }
.login-err { color: var(--red); min-height: 20px; margin-top: 10px; font-size: 14px; }

/* App-Rahmen */
.app { min-height: 100vh; padding: calc(var(--safe-t) + 64px) 14px calc(var(--safe-b) + 86px); }
.top { position: fixed; top: 0; left: 0; right: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: calc(var(--safe-t) + 8px) 14px 10px; background: rgba(11, 15, 30, 0.82);
  backdrop-filter: saturate(160%) blur(18px); -webkit-backdrop-filter: saturate(160%) blur(18px); border-bottom: 1px solid var(--line); }
.top-icon { width: 36px; height: 36px; border-radius: 10px; }
.top-title { flex: 1; min-width: 0; }
.top-name { font-size: 18px; font-weight: 700; line-height: 1.1; }
.top-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-pill { display: flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 99px; background: rgba(62, 224, 122, 0.12);
  color: var(--green); font-weight: 700; font-family: "Fredoka", sans-serif; font-size: 16px; }
.live-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(62, 224, 122, 0.6);
  animation: ping 1.8s infinite; }
.live-pill.off { background: rgba(141, 151, 184, 0.12); color: var(--muted); }
.live-pill.off i { background: var(--muted); animation: none; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(62, 224, 122, 0.55); } 80%, 100% { box-shadow: 0 0 0 9px rgba(62, 224, 122, 0); } }

.view { display: none; animation: fade .25s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }

/* Held */
.hero { text-align: center; padding: 22px 16px 18px;
  background: radial-gradient(120% 120% at 50% 0%, rgba(167, 123, 255, 0.28), transparent 60%), var(--card); }
.hero-ring { width: 156px; height: 156px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; position: relative;
  background: conic-gradient(from 180deg, var(--purple), var(--cyan), var(--green), var(--gold), var(--pink), var(--purple)); padding: 5px; }
.hero-ring::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--card); }
.hero-ring::after { content: ""; position: absolute; inset: -8px; border-radius: 50%; border: 2px solid rgba(62, 224, 122, 0.4);
  animation: halo 2.4s infinite; }
@keyframes halo { 0% { transform: scale(0.94); opacity: 0.9; } 100% { transform: scale(1.12); opacity: 0; } }
.hero-n { position: relative; font-size: 64px; font-weight: 700; line-height: 1; }
.hero-n.bump { animation: bump .5s ease; }
@keyframes bump { 40% { transform: scale(1.18); color: var(--gold); } }
.hero-label { margin-top: 12px; font-weight: 600; }
.hero-meta { margin-top: 4px; font-size: 13px; color: var(--muted); }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; min-width: 0; }
.stat-k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; font-weight: 600; }
.stat-v { font-size: 26px; font-weight: 700; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-s { font-size: 12px; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat.gold .stat-v { color: var(--gold); }
.stat.green .stat-v { color: var(--green); }
.up { color: var(--green); }

.seg { display: inline-flex; background: var(--bg2); border-radius: 11px; padding: 3px; gap: 2px; }
.seg button { padding: 6px 11px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--card2); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); }
.seg.wide { display: flex; width: 100%; margin-bottom: 12px; overflow-x: auto; scrollbar-width: none; }
.seg.wide button { flex: 1; white-space: nowrap; }

.chart { height: 190px; position: relative; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart .tip { position: absolute; top: 0; pointer-events: none; background: var(--card2); border: 1px solid var(--line); border-radius: 10px;
  padding: 5px 9px; font-size: 12px; white-space: nowrap; transform: translateX(-50%); }

.srv-list { display: grid; gap: 8px; }
.srv { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--bg2); border-radius: 12px; font-size: 14px; }
.srv b { font-family: "Fredoka", sans-serif; font-size: 18px; }
.srv .bar { flex: 1; height: 6px; background: rgba(255, 255, 255, 0.06); border-radius: 9px; overflow: hidden; }
.srv .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--green), var(--gold)); border-radius: 9px; }

.badge { padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--card2); }
.badge.live { background: rgba(62, 224, 122, 0.14); color: var(--green); }

/* Spielerlisten */
.plist { display: grid; gap: 6px; }
.prow { display: flex; align-items: center; gap: 11px; padding: 9px 4px; border-bottom: 1px solid var(--line); }
.prow:last-child { border-bottom: 0; }
.ava { width: 44px; height: 44px; border-radius: 50%; background: var(--card2); flex: none; object-fit: cover; }
.pinfo { flex: 1; min-width: 0; }
.pname { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pname small { color: var(--muted); font-weight: 400; }
.pmeta { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.pval { text-align: right; font-family: "Fredoka", sans-serif; font-weight: 600; font-size: 16px; color: var(--green); }
.pval small { display: block; font-family: -apple-system, sans-serif; font-weight: 400; font-size: 11px; color: var(--muted); }
.tag { display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: 10px; font-weight: 800; letter-spacing: 0.5px; margin-left: 5px; vertical-align: 2px; }
.tag.run { background: var(--red); color: #fff; animation: blink 1s infinite; }
.tag.new { background: var(--gold); color: #2a1c00; }
.tag.studio { background: var(--purple); color: #fff; }
@keyframes blink { 50% { opacity: 0.55; } }
.empty { padding: 22px 8px; text-align: center; color: var(--muted); }

/* Bestenliste */
.board { display: grid; gap: 4px; }
.brow { display: flex; align-items: center; gap: 12px; padding: 9px 4px; border-bottom: 1px solid var(--line); }
.brow:last-child { border-bottom: 0; }
.rank { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; font-family: "Fredoka", sans-serif;
  font-weight: 700; background: var(--card2); flex: none; }
.brow:nth-child(1) .rank { background: linear-gradient(180deg, #ffe680, #ffb81f); color: #3a2800; }
.brow:nth-child(2) .rank { background: linear-gradient(180deg, #eef2ff, #aab3cf); color: #222a40; }
.brow:nth-child(3) .rank { background: linear-gradient(180deg, #ffc08a, #c97a3a); color: #3a1c00; }
.board-n { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-v { font-weight: 600; font-size: 17px; color: var(--gold); }

/* Feed */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar, .seg.wide::-webkit-scrollbar { display: none; }
.chips button { padding: 8px 14px; border-radius: 99px; background: var(--card); border: 1px solid var(--line); white-space: nowrap;
  font-size: 14px; font-weight: 600; color: var(--muted); }
.chips button.on { background: var(--text); color: var(--bg); }
.feed { display: grid; gap: 8px; }
.ev { display: flex; gap: 12px; padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.ev-ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 19px; flex: none; background: var(--card2); }
.ev-ic.purchase { background: rgba(62, 224, 122, 0.15); }
.ev-ic.rare { background: rgba(255, 208, 64, 0.16); }
.ev-ic.garage_theft { background: rgba(255, 90, 106, 0.15); }
.ev-ic.error { background: rgba(255, 90, 106, 0.2); }
.ev-ic.join { background: rgba(60, 200, 255, 0.14); }
.ev-b { flex: 1; min-width: 0; }
.ev-t { font-weight: 600; }
.ev-s { font-size: 13px; color: var(--muted); margin-top: 1px; word-break: break-word; }
.ev-time { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* Umsatz */
.bars { display: flex; align-items: flex-end; gap: 5px; height: 120px; padding-top: 18px; }
.bars div { flex: 1; position: relative; background: linear-gradient(180deg, var(--green), rgba(62, 224, 122, 0.35)); border-radius: 6px 6px 3px 3px; min-height: 3px; }
.bars div.zero { background: rgba(255, 255, 255, 0.07); }
.bars div span { position: absolute; top: -17px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--muted); white-space: nowrap; }
.bars-x { display: flex; gap: 5px; margin-top: 4px; }
.bars-x span { flex: 1; text-align: center; font-size: 10px; color: var(--muted); }
.rev-items { margin-top: 12px; display: grid; gap: 6px; }
.rev-item { display: flex; justify-content: space-between; font-size: 14px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.rev-item:last-child { border-bottom: 0; }
.rev-item b { color: var(--green); font-family: "Fredoka", sans-serif; }

/* Einstellungen */
.btn { display: block; width: 100%; text-align: center; padding: 13px; border-radius: 13px; font-weight: 700; margin-top: 8px;
  background: linear-gradient(180deg, #b88cff, #8a5cf0); color: #fff; text-decoration: none; }
.btn.ghost { background: var(--card2); color: var(--text); }
.btn.danger { background: rgba(255, 90, 106, 0.14); color: var(--red); }
.hint { padding: 12px; border-radius: 12px; background: rgba(255, 208, 64, 0.1); color: #ffe6a0; font-size: 14px; margin-bottom: 6px; }
.prefs { margin-top: 10px; display: grid; }
.pref { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--line); }
.pref:last-child { border-bottom: 0; }
.pref small { display: block; color: var(--muted); font-size: 12px; }
.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #39405c; border-radius: 99px; transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 27px; height: 27px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::before { transform: translateX(20px); }

/* Tab-Leiste */
.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: flex; padding: 6px 6px calc(var(--safe-b) + 6px);
  background: rgba(11, 15, 30, 0.86); backdrop-filter: saturate(160%) blur(18px); -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-top: 1px solid var(--line); }
.tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; color: var(--muted); position: relative; }
.tabs svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tabs span { font-size: 11px; font-weight: 600; }
.tabs button.on { color: var(--gold); }
.tabs .dot { position: absolute; top: 4px; right: calc(50% - 16px); width: 9px; height: 9px; border-radius: 50%; background: var(--red);
  border: 2px solid var(--bg); }

@media (min-width: 720px) {
  .app { max-width: 760px; margin: 0 auto; }
  .grid { grid-template-columns: repeat(4, 1fr); }
}

.link-warn { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 90, 106, 0.14); color: #ffb3bb; font-size: 13px; text-align: left; }
