:root {
  --bg: #07090f;
  --card: #0d111c;
  --card-2: #121827;
  --line: #1c2336;
  --text: #e8ebf4;
  --muted: #8a93a8;
  --accent: #6366f1;
  --accent-2: #818cf8;
  --win: #4f8cff;
  --win-bg: rgba(79, 140, 255, .08);
  --loss: #f0566a;
  --loss-bg: rgba(240, 86, 106, .07);
  --remake: #6b7280;
  --radius: 14px;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(900px 400px at 50% -120px, rgba(99, 102, 241, .10), transparent 70%),
    var(--bg);
  color: var(--text);
  font: 15px/1.5 'Plus Jakarta Sans', system-ui, sans-serif;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img { display: block; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.upper { text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.accent { color: var(--accent-2); }
.tag { color: var(--muted); font-weight: 500; margin-left: 2px; }
.icon { flex-shrink: 0; color: #fff; }

/* ---- Topbar ---- */
.topbar { border-bottom: 1px solid var(--line); background: rgba(7, 9, 15, .8); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 10; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 60px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.01em; white-space: nowrap; }
.logo-mark { width: 14px; height: 14px; border-radius: 4px; background: var(--accent); transform: rotate(45deg); box-shadow: 0 0 14px rgba(99, 102, 241, .45); }

/* ---- Suche ---- */
.search { display: flex; align-items: stretch; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; transition: border-color .15s; }
.search:focus-within { border-color: var(--accent); }
.search select, .search input, .search button { border: 0; background: transparent; color: var(--text); font: inherit; outline: none; }
.search select { padding: 0 10px; border-right: 1px solid var(--line); color: var(--muted); font-weight: 600; cursor: pointer; }
.search select option { background: var(--card); }
.search input { flex: 1; min-width: 0; padding: 10px 12px; }
.search button { padding: 0 14px; cursor: pointer; display: grid; place-items: center; }
.search button:hover { background: var(--card-2); }
.search-small { width: min(340px, 60vw); font-size: 14px; }
.search-small input { padding: 7px 10px; }
.search-big { max-width: 560px; margin: 28px auto 0; font-size: 16px; }
.search-big input { padding: 15px 14px; }
.search-big button { padding: 0 20px; background: var(--accent); }
.search-big button:hover { background: var(--accent-2); }

/* ---- Hero ---- */
.hero { text-align: center; padding: 72px 0 48px; }
.hero h1 { font-size: clamp(30px, 6vw, 52px); line-height: 1.1; margin: 0 0 14px; letter-spacing: -.03em; font-weight: 800; }
.hero p { margin: 0; }

/* ---- Karten ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.section-title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; margin: 0 0 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text); }
section, .columns { margin-top: 16px; }
.error-box { margin-top: 24px; border-color: rgba(240, 86, 106, .35); color: #ffc2ca; }

.player-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.player-chip { display: flex; gap: 12px; align-items: center; transition: border-color .15s, background .15s; }
.player-chip:hover { border-color: #2a3350; background: var(--card-2); }
.player-chip img { width: 42px; height: 42px; border-radius: 10px; }
.name { font-weight: 700; }

/* ---- Profil ---- */
.profile { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 24px; }
.profile-icon { position: relative; }
.profile-icon img { width: 76px; height: 76px; border-radius: 16px; border: 2px solid var(--line); }
.level { position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%); background: var(--card-2); border: 1px solid var(--line); border-radius: 99px; padding: 0 8px; font: 700 11px/18px var(--mono); }
.profile-main { flex: 1; min-width: 180px; }
.profile-main h1 { margin: 0; font-size: 26px; letter-spacing: -.02em; }
.sync-msg { flex-basis: 100%; color: var(--muted); min-height: 0; }
.sync-msg:empty { display: none; }
.sync-msg.is-error { color: #ffb3bd; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--card-2); color: var(--text); font: 600 14px 'Plus Jakarta Sans', sans-serif; padding: 10px 16px; border-radius: 10px; cursor: pointer; transition: background .15s, border-color .15s; }
.btn:hover { border-color: #2c3554; }
.btn:disabled { opacity: .6; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-ghost { background: transparent; }
.btn-wide { width: 100%; margin-top: 8px; }
.btn.is-loading .icon { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.loading-box { display: flex; gap: 14px; align-items: center; margin-top: 16px; }
.spinner { width: 22px; height: 22px; border: 2px solid var(--line); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; flex-shrink: 0; }

/* ---- Ränge ---- */
.ranks { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.rank-row { display: flex; align-items: center; gap: 14px; margin-top: 10px; }
.rank-name { font-weight: 700; font-size: 17px; }
.rank-wr { margin-left: auto; text-align: right; font-weight: 700; }
.tier-badge { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font: 800 18px var(--mono); background: var(--card-2); border: 1px solid var(--line); color: var(--muted); }
.tier-iron { color: #a19d94; } .tier-bronze { color: #c9895b; } .tier-silver { color: #b8c4d4; }
.tier-gold { color: #e8c15c; } .tier-platinum { color: #4fd1c5; } .tier-emerald { color: #3ecf8e; }
.tier-diamond { color: #7aa7ff; } .tier-master { color: #c084fc; } .tier-grandmaster { color: #f87171; }
.tier-challenger { color: #fcd34d; border-color: rgba(252, 211, 77, .35); }

/* ---- LP-Graph ---- */
.chart-head { display: flex; flex-wrap: wrap; gap: 0 12px; justify-content: space-between; align-items: baseline; }
.chart { position: relative; height: 140px; }
.chart svg { width: 100%; height: 100%; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.lp-line { fill: none; stroke: var(--accent-2); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.dot { position: absolute; width: 24px; height: 24px; margin: -12px 0 0 -12px; cursor: pointer; }
.dot::after { content: ''; position: absolute; inset: 8px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 0 2px var(--card); transition: transform .12s; }
.dot.active::after, .dot:hover::after { transform: scale(1.35); }
.tooltip { position: absolute; transform: translate(-50%, calc(-100% - 14px)); background: #fff; color: #0b0f19; font-size: 12px; font-weight: 600; padding: 5px 9px; border-radius: 8px; white-space: nowrap; pointer-events: none; }

/* ---- Tabs ---- */
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-top: 20px; padding-bottom: 2px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); font-weight: 600; font-size: 14px; white-space: nowrap; color: var(--muted); transition: color .15s, border-color .15s; }
.tab:hover { color: var(--text); }
.tab.active { color: #fff; border-color: var(--accent); background: rgba(99, 102, 241, .12); }
.tab .count { font: 600 12px var(--mono); opacity: .7; margin-left: 4px; }

/* ---- Kacheln ---- */
.stat-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.tile-value { font: 700 26px/1.2 var(--mono); margin: 4px 0; }
.bar { height: 5px; border-radius: 99px; background: var(--loss); opacity: .9; overflow: hidden; margin-top: 8px; }
.bar span { display: block; height: 100%; background: var(--win); border-right: 2px solid var(--card); }
.wr-high { color: #7cc0ff; }
.wr-mid { color: var(--text); }
.wr-low { color: #ff8a98; }

/* ---- Spalten ---- */
.columns { display: grid; grid-template-columns: 320px 1fr; gap: 16px; align-items: start; }
.columns aside { display: flex; flex-direction: column; gap: 16px; }
.columns aside section, .columns .matches { margin-top: 0; }

.champ-list, .mate-list { list-style: none; margin: 0; padding: 0; }
.champ-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.champ-list li:first-child { border-top: 0; }
.champ-list img { width: 38px; height: 38px; border-radius: 10px; }
.champ-main { flex: 1; min-width: 0; }
.champ-stats { text-align: right; font-weight: 700; }
.mate-list li { display: flex; justify-content: space-between; gap: 8px; padding: 7px 0; border-top: 1px solid var(--line); }
.mate-list li:first-child { border-top: 0; }
.mate-list a { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mate-list a:hover { color: var(--accent-2); }

/* ---- Matches ---- */
.match { padding: 0; margin-bottom: 8px; border-left: 3px solid var(--remake); overflow: hidden; }
.match.win { border-left-color: var(--win); background: linear-gradient(90deg, var(--win-bg), transparent 55%), var(--card); }
.match.loss { border-left-color: var(--loss); background: linear-gradient(90deg, var(--loss-bg), transparent 55%), var(--card); }
.match summary { list-style: none; display: grid; grid-template-columns: 112px 48px 22px 92px 1fr auto 16px; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; }
.match summary::-webkit-details-marker { display: none; }
.m-label { font-weight: 800; }
.win .m-label { color: var(--win); }
.loss .m-label { color: var(--loss); }
.remake .m-label { color: var(--muted); }
.m-champ { position: relative; }
.m-champ img { width: 48px; height: 48px; border-radius: 12px; }
.m-champ .lvl { position: absolute; right: -4px; bottom: -4px; background: var(--card-2); border: 1px solid var(--line); border-radius: 6px; font: 700 10px/16px var(--mono); padding: 0 4px; }
.m-spells { display: flex; flex-direction: column; gap: 3px; }
.m-spells img { width: 22px; height: 22px; border-radius: 5px; }
.kda-line { font: 700 15px var(--mono); white-space: nowrap; }
.deaths { color: var(--loss); }
.m-items { display: grid; grid-template-columns: repeat(7, 24px); gap: 3px; }
.m-items img, .m-items .empty { width: 24px; height: 24px; border-radius: 5px; background: var(--card-2); }
.m-toggle { color: var(--muted); transition: transform .15s; }
.match[open] .m-toggle { transform: rotate(180deg); }

.m-details { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; padding: 4px 14px 14px; border-top: 1px solid var(--line); }
.team-title { margin: 10px 0 6px; }
.team-row { display: flex; align-items: center; gap: 8px; padding: 3px 6px; border-radius: 8px; font-size: 13px; }
.team-row.me { background: rgba(255, 255, 255, .05); }
.team-row img { width: 24px; height: 24px; border-radius: 6px; }
.t-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.t-name:hover { color: var(--accent-2); }
.t-kda { font: 600 12px var(--mono); }
.t-dmg { width: 44px; text-align: right; }

/* ---- Footer ---- */
.footer { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: space-between; padding-top: 40px; padding-bottom: 32px; font-size: 12px; }

/* ---- Mobil ---- */
@media (max-width: 900px) {
  .columns { grid-template-columns: 1fr; }
  .stat-tiles { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .topbar-inner { height: auto; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
  .search-small { width: 100%; }
  .profile-actions { width: 100%; }
  .profile-actions .btn { width: 100%; }
  .match summary { grid-template-columns: 44px 1fr auto; grid-template-areas: "champ kda result" "items items items"; row-gap: 10px; gap: 10px; }
  .m-champ { grid-area: champ; }
  .m-champ img { width: 44px; height: 44px; }
  .m-kda { grid-area: kda; }
  .m-result { grid-area: result; text-align: right; }
  .m-items { grid-area: items; grid-template-columns: repeat(7, 30px); gap: 4px; }
  .m-items img, .m-items .empty { width: 30px; height: 30px; }
  .m-spells, .m-cs, .m-toggle { display: none; }
  .tile-value { font-size: 22px; }
}

/* ---- Match-Seite ---- */
.m-open { grid-column: 1 / -1; margin-top: 4px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; margin-top: 20px; }
.back-link:hover { color: var(--text); }
.match-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 12px; border-left: 3px solid var(--line); }
.match-head.win { border-left-color: var(--win); }
.match-head.loss { border-left-color: var(--loss); }
.match-head h1 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.m-label.big { font-weight: 800; font-size: 14px; text-transform: uppercase; letter-spacing: .06em; }
.match-head.win .m-label { color: var(--win); }
.match-head.loss .m-label { color: var(--loss); }
.score { font: 800 34px var(--mono); display: flex; gap: 10px; }
.score-blue { color: var(--win); }
.score-red { color: var(--loss); }

.scoreboard { padding: 0; overflow: hidden; }
.sb-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.team-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: var(--muted); flex-shrink: 0; }
.team-100 .team-dot { background: var(--win); }
.team-200 .team-dot { background: var(--loss); }
.objectives { display: flex; flex-wrap: wrap; gap: 12px; }
.obj { display: inline-flex; align-items: center; gap: 5px; font: 600 13px var(--mono); }
.bans { display: flex; align-items: center; gap: 6px; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.bans img { width: 24px; height: 24px; border-radius: 6px; filter: grayscale(1); opacity: .65; }

.sb-row { display: grid; grid-template-columns: 104px minmax(120px, 1fr) 124px 110px 60px 52px 56px 192px; gap: 12px; align-items: center; padding: 8px 16px; border-top: 1px solid var(--line); }
.sb-labels { border-top: 0; padding-top: 10px; padding-bottom: 4px; }
.sb-row.me { background: rgba(255, 255, 255, .045); }
.sb-champ { display: flex; gap: 6px; align-items: center; }
.sb-champ .m-champ img { width: 44px; height: 44px; }
.sb-loadout { display: grid; grid-template-columns: repeat(2, 20px); gap: 3px; }
.sb-loadout img, .sb-loadout .empty { width: 20px; height: 20px; border-radius: 5px; background: var(--card-2); }
.sb-loadout .rune { background: #000; border-radius: 50%; padding: 1px; }
.sb-name { min-width: 0; }
.sb-name .t-name { display: block; }
.sb-kda .kda-line { font-size: 14px; }
.dmg-bar { height: 6px; border-radius: 0 4px 4px 0; background: var(--card-2); margin-top: 4px; overflow: hidden; }
.dmg-bar span { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--muted); }
.team-100 .dmg-bar span { background: var(--win); }
.team-200 .dmg-bar span { background: var(--loss); }
.sb-items { display: grid; grid-template-columns: repeat(7, 24px); gap: 3px; }
.sb-items img, .sb-items .empty { width: 24px; height: 24px; border-radius: 5px; background: var(--card-2); }

.legend { display: flex; gap: 14px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sw.blue { background: var(--win); }
.sw.red { background: var(--loss); }
.gold-chart { position: relative; height: 200px; margin-top: 8px; touch-action: pan-y; }
.gold-chart svg { width: 100%; height: 100%; display: block; }
.gold-chart .grid { stroke: var(--line); stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
.gold-chart .zero { stroke: #3a4258; vector-effect: non-scaling-stroke; }
.area-blue { fill: rgba(79, 140, 255, .32); }
.area-red { fill: rgba(240, 86, 106, .30); }
.gold-line { fill: none; stroke: var(--text); stroke-width: 2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.axis-label { position: absolute; left: 4px; font-family: var(--mono); font-size: 11px; }
.axis-label.top { top: 0; }
.axis-label.bottom { bottom: 0; }
.axis-x { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11px; margin-top: 4px; }
.crosshair { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(255, 255, 255, .35); pointer-events: none; }
.cross-dot { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px var(--card); pointer-events: none; }
.gold-chart .tooltip { top: 8px; transform: translateX(-50%); }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button { background: transparent; border: 0; color: var(--muted); font: 600 12.5px 'Plus Jakarta Sans', sans-serif; padding: 6px 11px; cursor: pointer; }
.seg button.active { background: rgba(99, 102, 241, .14); color: #fff; }
.feed { list-style: none; margin: 8px 0 0; padding: 0; max-height: 520px; overflow-y: auto; }
.ev { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-top: 1px solid var(--line); font-size: 13.5px; }
.ev:first-child { border-top: 0; }
.ev[hidden] { display: none; }
.ev-time { font: 600 12px var(--mono); color: var(--muted); width: 42px; flex-shrink: 0; }
.ev .team-dot { margin-right: 0; }
.ev-icon { display: grid; place-items: center; width: 18px; }
.ev-text { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; min-width: 0; }
.ev-text img { width: 20px; height: 20px; border-radius: 5px; }

.arena-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.arena-team { position: relative; padding-top: 36px; }
.arena-team.top { border-color: rgba(79, 140, 255, .35); }
.arena-place { position: absolute; top: 12px; left: 16px; font: 800 14px var(--mono); color: var(--muted); }
.arena-team.top .arena-place { color: var(--win); }
.arena-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 10px; }
.arena-row.me { background: rgba(255, 255, 255, .045); }
.arena-row .ch { width: 40px; height: 40px; border-radius: 10px; }
.arena-main { flex: 1; min-width: 0; }
.arena-row .sb-items { width: 100%; padding-left: 50px; }

@media (max-width: 980px) {
  .sb-labels { display: none; }
  .sb-row { grid-template-columns: 90px 1fr auto; grid-template-areas: "champ name kda" "items items dmg"; row-gap: 8px; }
  .sb-champ { grid-area: champ; }
  .sb-name { grid-area: name; }
  .sb-kda { grid-area: kda; text-align: right; }
  .sb-dmg { grid-area: dmg; width: 90px; text-align: right; }
  .sb-items { grid-area: items; }
  .sb-cs, .sb-gold, .sb-vis { display: none; }
}
@media (max-width: 640px) {
  .match-head h1 { font-size: 20px; }
  .score { font-size: 26px; }
  .sb-row { padding: 8px 12px; gap: 8px; grid-template-columns: 76px 1fr auto; }
  .sb-champ .m-champ img { width: 36px; height: 36px; }
  .sb-loadout { grid-template-columns: repeat(2, 16px); gap: 2px; }
  .sb-loadout img, .sb-loadout .empty { width: 16px; height: 16px; }
  .sb-items { grid-template-columns: repeat(7, 22px); }
  .sb-items img, .sb-items .empty { width: 22px; height: 22px; }
  .gold-chart { height: 160px; }
  .arena-grid { grid-template-columns: 1fr; }
}
