:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #1d2331;
  --muted: #7c8698;
  --line: #e6ebf3;
  --primary: #5e69ff;
  --primary-soft: #eef1ff;
  --gold: #ffd564;
  --silver: #d7deea;
  --bronze: #ffc59e;
  --shadow: 0 14px 32px rgba(32, 45, 76, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Pretendard, sans-serif;
}

.app-shell {
  max-width: 460px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 20px 16px 92px;
}

.topbar, .hero-head, .toggle-row, .card-head, .bottom-nav, .stat-grid {
  display: flex;
}
.topbar, .hero-head, .card-head, .bottom-nav {
  justify-content: space-between;
  align-items: center;
}
.topbar { margin-bottom: 16px; }
.eyebrow { margin: 0 0 4px; color: var(--muted); font-size: 12px; letter-spacing: .08em; }
.hero-card, .rank-card {
  background: var(--card);
  border-radius: 24px;
  padding: 18px;
  box-shadow: var(--shadow);
  margin-top: 16px;
}
.hero-head { gap: 12px; align-items: flex-start; }
.mini-label { margin: 0 0 6px; color: var(--muted); font-size: 12px; }
h1, h2, h3 { margin: 0; }
h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; margin-bottom: 14px; }
.ghost-btn {
  border: 0; background: #eff2f8; color: var(--text); padding: 10px 12px; border-radius: 14px; text-decoration: none;
}
.segmented {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end;
}
.tab, .switch-btn {
  border: 0; border-radius: 999px; padding: 9px 14px; background: #eff2f8; color: var(--muted); font-weight: 700; cursor: pointer;
}
.tab.active, .switch-btn.active {
  background: var(--primary); color: #fff;
}
.stat-grid {
  gap: 12px; margin-top: 18px; flex-wrap: wrap;
}
.stat-box {
  flex: 1 1 calc(33.333% - 8px);
  min-width: 110px;
  border-radius: 18px; padding: 14px; background: #f7f9fd; border: 1px solid var(--line);
}
.stat-box span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.stat-box strong { font-size: 22px; }
.stat-box.accent { background: var(--primary-soft); border-color: #dfe4ff; }
.toggle-row {
  gap: 10px; margin-bottom: 18px;
}
.switch-btn { flex: 1; border-radius: 16px; padding: 12px; }
.hidden { display: none; }
.podium {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; align-items: end; margin-bottom: 18px;
}
.podium-card {
  border-radius: 18px; padding: 14px 10px; text-align: center; background: #f7f9fd; border: 1px solid var(--line);
}
.podium-card.rank-1 { background: linear-gradient(180deg, #fff8d8 0%, #fff 100%); border-color: #ffe187; min-height: 180px; }
.podium-card.rank-2 { background: linear-gradient(180deg, #f3f6fb 0%, #fff 100%); min-height: 150px; }
.podium-card.rank-3 { background: linear-gradient(180deg, #fff1e7 0%, #fff 100%); min-height: 135px; }
.podium-rank { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; font-weight: 800; }
.rank-1 .podium-rank { background: var(--gold); }
.rank-2 .podium-rank { background: var(--silver); }
.rank-3 .podium-rank { background: var(--bronze); }
.podium-name { margin-top: 10px; font-weight: 800; font-size: 15px; }
.podium-value { margin-top: 8px; color: var(--muted); font-size: 14px; }
.ranking-list {
  list-style: none; padding: 0; margin: 0; display: grid; gap: 12px;
}
.rank-item {
  display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: #fafbfd;
}
.rank-no {
  width: 34px; height: 34px; border-radius: 50%; background: #eef2f8; display: grid; place-items: center; font-weight: 800;
}
.rank-meta strong { display: block; margin-bottom: 4px; }
.rank-meta span { color: var(--muted); font-size: 13px; }
.rank-value { font-weight: 800; }
.log-box {
  margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: #fafbfd; white-space: pre-wrap; word-break: break-word;
}
.bottom-nav {
  position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); width: min(428px, calc(100% - 24px)); padding: 12px 16px; border-radius: 18px; background: rgba(255,255,255,.95); box-shadow: var(--shadow); backdrop-filter: blur(10px);
}
.bottom-nav a { color: var(--muted); text-decoration: none; font-size: 14px; }
.bottom-nav a.active { color: var(--primary); font-weight: 700; }
