:root {
  --bg: #0a0d1a;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-border: rgba(255, 255, 255, 0.09);
  --text: #e8eaf6;
  --muted: #9aa3c0;
  --green: #4ade80;
  --gold: #fbbf24;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Exo 2', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1100px 700px at 15% -10%, rgba(56, 70, 160, 0.35), transparent 60%),
    radial-gradient(900px 600px at 95% 10%, rgba(120, 40, 130, 0.22), transparent 60%),
    var(--bg);
}

header { text-align: center; padding: 34px 16px 10px; }

h1 {
  margin: 0;
  font-size: 44px;
  font-weight: 800;
  letter-spacing: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.logo {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, #22d3ee, #6366f1);
  box-shadow: 0 0 22px rgba(34, 211, 238, 0.55);
  position: relative;
}
.logo::after {
  content: '';
  position: absolute; inset: 9px;
  border-radius: 4px;
  background: var(--bg);
}

.sub { margin: 6px 0 0; color: var(--muted); font-size: 15px; }

main { max-width: 1100px; margin: 0 auto; padding: 22px 16px 40px; }

.players {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 20px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-top: 3px solid var(--accent, #888);
  border-radius: 16px;
  padding: 18px 20px;
  backdrop-filter: blur(6px);
}

.card-head { display: flex; align-items: center; gap: 10px; }
.card-head h3 {
  margin: 0; font-size: 22px; font-weight: 800; color: var(--accent);
  cursor: pointer;
}
.card-head h3:hover { text-decoration: underline; }
.status-text { margin-left: auto; color: var(--muted); font-size: 13px; }

.dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #555c74;
  flex-shrink: 0;
}
.dot.on {
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 4px var(--green); }
  50% { box-shadow: 0 0 12px var(--green); }
}

.now { margin-top: 14px; }
.now.idle { color: var(--muted); font-size: 15px; padding: 18px 0; text-align: center; }

.level-name { font-size: 19px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stars { color: var(--gold); font-size: 14px; font-weight: 600; }
.badge {
  font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px;
  background: rgba(251, 191, 36, 0.15);
  color: var(--gold);
  border: 1px solid rgba(251, 191, 36, 0.35);
}
.creator { color: var(--muted); font-size: 13px; margin-top: 2px; }

.bar {
  position: relative;
  height: 14px;
  margin-top: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.bar .fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), rgba(255, 255, 255, 0.55));
  transition: width 0.6s ease;
}
.bar .marker {
  position: absolute; top: -2px; bottom: -2px;
  width: 3px;
  background: #fff;
  border-radius: 2px;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
}
.bar-labels {
  display: flex; justify-content: space-between;
  margin-top: 5px;
  font-size: 12px; color: var(--muted);
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}
.mini-stats div {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 8px 4px;
  text-align: center;
}
.mini-stats b { display: block; font-size: 20px; }
.mini-stats span { font-size: 11px; color: var(--muted); }

.spark { width: 100%; height: 60px; margin-top: 12px; display: block; }
.spark-label { font-size: 11px; color: var(--muted); margin-top: 2px; }

.daily { margin-top: 16px; }
.daily h4 { margin: 0 0 6px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.daily-chart { width: 100%; height: 110px; display: block; }
.legend {
  display: flex; gap: 16px; margin-top: 4px;
  font-size: 11px; color: var(--muted);
  align-items: center;
}
.legend .sw {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 2px; margin-right: 5px; vertical-align: -1px;
  background: var(--accent); opacity: 0.75;
}
.legend .ln {
  display: inline-block; width: 14px; height: 0;
  border-top: 2px solid var(--gold); margin-right: 5px; vertical-align: 3px;
}

.levels { margin-top: 16px; }
.levels h4 { margin: 0 0 8px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.lvl {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) 1fr 44px 90px;
  gap: 10px;
  align-items: center;
  padding: 5px 0;
  font-size: 14px;
}
.lvl-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lvl-bar { height: 7px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden; }
.lvl-bar div { height: 100%; background: var(--accent); border-radius: 999px; }
.lvl-best { text-align: right; font-weight: 600; }
.lvl-att { text-align: right; color: var(--muted); font-size: 12px; }
.done-mark { color: var(--green); }

.day-stat {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--panel-border);
  color: var(--muted);
  font-size: 13px;
}
.day-stat b { color: var(--text); font-size: 15px; }

.feed-wrap { margin-top: 30px; }
.feed-wrap h2 { font-size: 18px; letter-spacing: 1px; }

.feed {
  list-style: none; margin: 0; padding: 0;
  max-height: 420px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}
.feed::-webkit-scrollbar { width: 8px; }
.feed::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }
.feed li {
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 14.5px;
}
.feed li:nth-child(odd) { background: rgba(255, 255, 255, 0.03); }
.feed .ico { flex-shrink: 0; }
.feed .who { font-weight: 700; }
.feed .when { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.feed .mult { color: var(--gold); font-size: 12px; font-weight: 600; }

.sp-toggle {
  background: none;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  color: var(--muted);
  font-family: inherit;
  font-size: 11px;
  padding: 1px 9px;
  margin-left: 6px;
  cursor: pointer;
}
.sp-toggle:hover { color: var(--text); border-color: rgba(255,255,255,0.3); }

.feed li.sp-details {
  padding: 6px 12px 8px 42px;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
  background: rgba(255,255,255,0.02);
}
.feed li.sp-details b { color: var(--text); }

.muted { color: var(--muted); }

footer {
  text-align: center;
  padding: 18px;
  color: var(--muted);
  font-size: 12px;
}

.modal-backdrop[hidden] { display: none; }
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(4, 6, 14, 0.75);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  padding: 20px;
}
.modal {
  width: 100%; max-width: 560px;
  max-height: 80vh;
  display: flex; flex-direction: column;
  background: #12162a;
  border: 1px solid var(--panel-border);
  border-top: 3px solid var(--accent, #888);
  border-radius: 16px;
  padding: 18px 20px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { margin: 0; font-size: 22px; font-weight: 800; color: var(--accent); }
.modal-close {
  background: none; border: none; color: var(--muted);
  font-size: 18px; cursor: pointer; padding: 4px 8px;
}
.modal-close:hover { color: var(--text); }

.tabs { display: flex; gap: 8px; margin-top: 14px; }
.tab {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  color: var(--muted);
  font-family: inherit; font-size: 14px; font-weight: 600;
  padding: 8px; cursor: pointer;
}
.tab.active {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(255,255,255,0.09);
}

.modal-body { margin-top: 12px; overflow-y: auto; scrollbar-width: thin; }
.modal-body .lvl { grid-template-columns: minmax(0, 1.3fr) 1fr 44px 90px; }
.modal-empty { color: var(--muted); text-align: center; padding: 24px 0; }

@media (max-width: 480px) {
  h1 { font-size: 34px; }
  .lvl { grid-template-columns: minmax(0, 1.2fr) 1fr 40px; }
  .lvl-att { display: none; }
}
