:root {
  --bg-0: #0a0e1a;
  --bg-1: #121729;
  --bg-2: #1a2035;
  --cyan: #5ce1e6;
  --cyan-2: #3ab7f0;
  --pink: #ff4d8d;
  --purple: #8b7cf6;
  --gold: #ffd24a;
  --orange: #ff8a3c;
  --green: #4ade80;
  --red: #ef4444;
  --border: #242b47;
  --muted: #7680a4;
  --text: #eef1ff;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg-0);
  color: var(--text);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", system-ui, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  padding: 20px 16px 80px;
  max-width: 520px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.logo {
  font-size: 18px;
  font-weight: 900;
  color: var(--cyan);
  letter-spacing: 0.02em;
}
.logo span { color: var(--text); }
.topbar nav { display: flex; gap: 12px; }
.topbar nav a { font-size: 11px; color: var(--muted); text-decoration: none; }

.search-form {
  display: flex;
  gap: 8px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 6px;
  margin-bottom: 4px;
}
.search-form input {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--text);
  padding: 12px 14px;
  font-size: 16px;
  font-weight: 600;
  outline: none;
}
.search-form input::placeholder { color: var(--muted); font-weight: 500; }
.search-form button {
  border: 0;
  padding: 0 22px;
  background: linear-gradient(135deg, var(--cyan) 0%, var(--cyan-2) 100%);
  color: #00131a;
  font-size: 14px;
  font-weight: 900;
  border-radius: 10px;
  cursor: pointer;
}

.tag-hint {
  margin-bottom: 20px;
}
.tag-hint summary {
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
}
.tag-hint img {
  width: 100%;
  border-radius: 8px;
  margin-top: 8px;
}

/* Profile */
.profile {
  background: linear-gradient(135deg, var(--bg-1) 0%, #161c2f 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}
.profile::before {
  content: "";
  position: absolute;
  top: -40px; right: -40px;
  width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(92,225,230,0.15) 0%, transparent 70%);
  pointer-events: none;
}
.avatar {
  width: 56px; height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--purple) 0%, var(--pink) 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 900; color: white;
}
.profile .name { font-size: 18px; font-weight: 900; color: var(--text); }
.profile .tag { font-size: 11px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.profile .club {
  display: inline-block;
  font-size: 10px; color: var(--cyan);
  background: rgba(92,225,230,0.1);
  border: 1px solid rgba(92,225,230,0.3);
  padding: 2px 8px; border-radius: 6px; margin-top: 6px; font-weight: 700;
}
.profile .level {
  text-align: center;
  padding: 6px 12px;
  background: rgba(139,124,246,0.15);
  border: 1px solid rgba(139,124,246,0.4);
  border-radius: 10px;
}
.profile .level span {
  display: block; font-size: 9px; color: var(--purple);
  letter-spacing: 0.1em; font-weight: 700;
}
.profile .level strong { font-size: 20px; color: var(--text); font-weight: 900; }

/* RANK HERO */
.rank-hero {
  background:
    radial-gradient(ellipse at top, rgba(255,210,74,0.15) 0%, transparent 60%),
    linear-gradient(180deg, #1a1530 0%, #0e1020 100%);
  border: 1px solid rgba(255,210,74,0.35);
  border-radius: 20px;
  padding: 24px 20px 20px;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
  text-align: center;
}
.rank-hero::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(255,138,60,0.12) 0%, transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(255,77,141,0.12) 0%, transparent 40%);
  pointer-events: none;
}

.rank-letter-wrap {
  position: relative;
  display: block;
  width: fit-content;
  margin: 0 auto;
  padding: 0 20px;
}
.rank-letter-wrap::before,
.rank-letter-wrap::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 24px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold));
}
.rank-letter-wrap::before { left: -8px; transform: translateY(-50%); }
.rank-letter-wrap::after {
  right: -8px;
  transform: translateY(-50%) scaleX(-1);
}
.rank-letter {
  font-size: 100px;
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: -0.06em;
  background: linear-gradient(180deg, #fff4c4 0%, var(--gold) 40%, var(--orange) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 60px rgba(255,210,74,0.5);
  position: relative;
  font-family: "Impact", "Arial Black", sans-serif;
}
.rank-letter.long { font-size: 72px; letter-spacing: -0.08em; }
.rank-letter.long2 { font-size: 84px; letter-spacing: -0.07em; }

.rank-letter.s { --rank-color: var(--gold); }
.rank-letter.a { background: linear-gradient(180deg, #ffecb3 0%, #f59e0b 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.rank-letter.b { background: linear-gradient(180deg, #e0f2fe 0%, var(--cyan) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.rank-letter.c { background: linear-gradient(180deg, #ddd6fe 0%, var(--purple) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.rank-letter.d { background: linear-gradient(180deg, #fecaca 0%, var(--pink) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.rank-letter.f { background: linear-gradient(180deg, #d1d5db 0%, #6b7280 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }

.rank-label {
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 4px;
  position: relative;
}

.title-badge {
  display: block;
  width: fit-content;
  margin: 16px auto 0;
  padding: 8px 18px;
  background: rgba(255,210,74,0.1);
  border: 1px solid rgba(255,210,74,0.4);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 900;
  color: var(--gold);
  letter-spacing: 0.05em;
  position: relative;
}
.title-badge::before {
  content: "称号";
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 8px;
  color: var(--bg-0);
  background: var(--gold);
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.1em;
}

.meme {
  margin-top: 14px;
  font-size: 24px;
  font-weight: 900;
  color: var(--text);
  position: relative;
  letter-spacing: -0.01em;
}
.meme.small { font-size: 20px; }

.rank-progress {
  margin-top: 16px;
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.rank-progress .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold) 0%, var(--orange) 100%);
  border-radius: 4px;
  transition: width .5s ease;
  box-shadow: 0 0 12px rgba(255,210,74,0.6);
}
.rank-progress-text {
  display: flex; justify-content: space-between;
  margin-top: 6px;
  font-size: 10px;
  color: var(--muted);
  font-weight: 600;
  position: relative;
}

/* Percentile */
.percentile {
  background: linear-gradient(135deg, rgba(92,225,230,0.08) 0%, rgba(139,124,246,0.08) 100%);
  border: 1px solid rgba(92,225,230,0.25);
  border-radius: 16px;
  padding: 16px 18px;
  text-align: center;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}
.percentile .label {
  font-size: 10px; color: var(--muted);
  letter-spacing: 0.2em; font-weight: 700; text-transform: uppercase;
}
.percentile .big {
  margin-top: 2px;
  font-size: 38px; font-weight: 900; line-height: 1;
  background: linear-gradient(135deg, var(--cyan) 0%, var(--purple) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  letter-spacing: -0.03em;
}
.percentile .big .pct { font-size: 20px; vertical-align: super; margin-left: 2px; }
.percentile .sub {
  margin-top: 2px; font-size: 11px; color: var(--muted);
  font-weight: 600;
}

/* Stat grid */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.stat-grid .cell {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  position: relative;
  overflow: hidden;
}
.stat-grid .cell::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--cyan);
}
.stat-grid .cell.pink::before { background: var(--pink); }
.stat-grid .cell.purple::before { background: var(--purple); }
.stat-grid .cell.gold::before { background: var(--gold); }
.stat-grid .cell span {
  display: block; font-size: 10px; color: var(--muted);
  letter-spacing: 0.1em; font-weight: 700; text-transform: uppercase;
}
.stat-grid .cell strong {
  display: block; font-size: 22px; color: var(--text);
  font-weight: 900; margin-top: 4px;
}

/* Mode breakdown */
.section-title {
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
  margin: 20px 4px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::before {
  content: "";
  display: inline-block;
  width: 3px; height: 14px;
  background: var(--cyan);
  border-radius: 2px;
}

.modes {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}
.mode {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 12px;
  align-items: center;
}
.mode-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 900;
  color: white;
}
.mode-icon.gemGrab      { background: linear-gradient(135deg, #a855f7, #7e22ce); }
.mode-icon.brawlBall    { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.mode-icon.heist        { background: linear-gradient(135deg, #ec4899, #be185d); }
.mode-icon.bounty       { background: linear-gradient(135deg, #14b8a6, #0f766e); }
.mode-icon.knockout     { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.mode-icon.hotZone      { background: linear-gradient(135deg, #f97316, #c2410c); }
.mode-icon.showdown     { background: linear-gradient(135deg, #84cc16, #4d7c0f); }
.mode-icon.duoShowdown  { background: linear-gradient(135deg, #22c55e, #15803d); }
.mode-icon.other        { background: linear-gradient(135deg, #6b7280, #374151); }

.mode-body .mode-name {
  font-size: 13px; font-weight: 800; color: var(--text);
}
.mode-body .mode-bar {
  margin-top: 4px;
  height: 6px;
  background: var(--bg-2);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}
.mode-body .mode-bar .fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, var(--cyan) 0%, var(--purple) 100%);
  border-radius: 3px;
  transition: width .4s ease;
}
.mode-body .mode-count {
  font-size: 10px; color: var(--muted);
  font-weight: 600; margin-top: 2px;
}
.mode-wr {
  font-size: 16px;
  font-weight: 900;
  color: var(--cyan);
  min-width: 48px;
  text-align: right;
}
.mode-wr.low { color: var(--pink); }
.mode-wr.mid { color: var(--gold); }

/* Actions */
.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 20px;
}
.actions button {
  border: 0;
  padding: 16px 0;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
}
.actions .primary {
  background: linear-gradient(135deg, var(--gold) 0%, var(--orange) 100%);
  color: #1a1300;
  box-shadow: 0 8px 30px -8px var(--gold);
}
.actions .secondary {
  background: var(--bg-1);
  color: var(--cyan);
  border: 1px solid var(--border);
}

.loading, .error {
  padding: 20px;
  text-align: center;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.error { color: #ff7a7a; }
[hidden] { display: none !important; }

/* Footer */
.site-footer {
  text-align: center;
  color: var(--muted);
  padding: 32px 16px 0;
  font-size: 11px;
  line-height: 1.8;
}
.site-footer a {
  color: var(--muted);
  text-decoration: none;
}
.site-footer a:hover { color: var(--text); }
