:root {
  --color-bg: #f5f7fb;
  --color-surface: #ffffff;
  --color-surface-alt: #f0f3fa;
  --color-text: #222634;
  --color-muted: #6c7386;
  --color-accent: #4164f5;
  --color-accent-soft: #ebefff;
  --color-border: #d9deea;
  --color-highlight: #2f8bff;
  --color-shadow: rgba(33, 45, 79, 0.12);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --transition-fast: 160ms ease;
  --transition-slow: 280ms ease;
  --max-width: min(1080px, calc(100vw - 48px));
  --font-family: 'Noto Sans KR', 'Pretendard', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  color: var(--color-text);
  background: radial-gradient(120% 120% at 50% 0%, #eef2ff 0%, var(--color-bg) 55%, #e6ecff 100%);
  min-height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-body {
  width: 100%;
  max-width: var(--max-width);
  margin: 32px auto;
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding-bottom: 64px;
}

h1, h2, h3 {
  margin: 0;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
  line-height: 1.6;
  color: var(--color-muted);
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-highlight);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
  background-color: rgba(245, 247, 251, 0.85);
  border-bottom: 1px solid rgba(217, 222, 234, 0.7);
}

.site-header__inner {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 18px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.site-brand {
  font-weight: 800;
  font-size: 20px;
  color: var(--color-text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-greeting {
  font-size: 15px;
  color: var(--color-muted);
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
}

.nav-btn {
  border-radius: var(--radius-sm);
  font-size: 15px;
  padding: 10px 18px;
  cursor: pointer;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}

.nav-primary {
  background: var(--color-accent);
  color: #fff;
  box-shadow: 0 8px 18px rgba(65, 100, 245, 0.25);
  border-color: transparent;
}

.nav-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(65, 100, 245, 0.32);
}

.nav-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
}

.nav-secondary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(33, 45, 79, 0.08);
}

.nav-logout {
  background: #f9f1f1;
  color: #d63b3b;
  border-color: rgba(214, 59, 59, 0.25);
}

.nav-logout:hover {
  background: #f5dede;
  box-shadow: 0 10px 20px rgba(214, 59, 59, 0.18);
  transform: translateY(-1px);
}

.eyebrow {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  color: var(--color-accent);
  margin-bottom: 12px;
}

.lead {
  font-size: 16px;
  margin-top: 16px;
  color: var(--color-muted);
}

.btn {
  border: none;
  cursor: pointer;
  border-radius: var(--radius-md);
  font-weight: 600;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn:disabled,
.btn.disabled {
  opacity: 0.5;
  pointer-events: none;
  box-shadow: none;
}

.btn-primary {
  background: linear-gradient(120deg, var(--color-accent) 0%, var(--color-highlight) 100%);
  color: #fff;
  box-shadow: 0 16px 32px rgba(65, 100, 245, 0.32);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 40px rgba(65, 100, 245, 0.38);
}

.btn-secondary {
  background: var(--color-surface-alt);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  box-shadow: 0 12px 24px rgba(33, 45, 79, 0.08);
}

.btn-secondary:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 32px rgba(33, 45, 79, 0.12);
}

.btn-lg {
  padding: 16px 28px;
  font-size: 18px;
}

.tips-list {
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
  color: var(--color-muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tips-list li {
  padding-left: 16px;
  position: relative;
}

.tips-list li::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-accent);
  position: absolute;
  left: 0;
  top: 10px;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.stats-board,
.rank-stats {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stats-board__grid,
.rank-stats__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.stats-board__subtitle,
.rank-stats__subtitle {
  color: var(--color-muted);
  font-size: 15px;
}

.stats-refresh-note {
  margin-top: -4px;
  font-size: 14px;
  color: var(--color-muted);
}

.stat {
  padding: 18px 22px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(217, 222, 234, 0.7);
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.stat:hover {
  transform: translateY(-2px);
  border-color: rgba(65, 100, 245, 0.35);
  box-shadow: 0 14px 24px rgba(35, 55, 110, 0.12);
}

.stat.highlight {
  background: rgba(65, 100, 245, 0.12);
  border-color: rgba(65, 100, 245, 0.3);
}

.stat .label {
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: 8px;
}

.stat .value {
  font-size: 32px;
  font-weight: 700;
  color: var(--color-text);
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 23, 42, 0.25);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.overlay .panel {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 28px 32px;
  min-width: 260px;
  text-align: center;
  box-shadow: 0 24px 45px rgba(15, 22, 42, 0.16);
}

.overlay .panel h3 {
  font-size: 18px;
  margin-bottom: 12px;
}

.overlay .panel p {
  margin: 0;
  color: var(--color-muted);
  font-size: 14px;
}

.loader {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 4px solid #dbe1f2;
  border-top-color: var(--color-accent);
  margin: 0 auto 18px;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.site-footer {
  margin-top: auto;
  background: transparent;
  padding: 32px 0 48px;
}

.site-footer__inner {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--color-muted);
  font-size: 14px;
}

.footer-link {
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  background: rgba(65, 100, 245, 0.12);
  color: var(--color-accent);
  font-weight: 600;
}

.footer-link:hover {
  background: rgba(65, 100, 245, 0.18);
}

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid rgba(217, 222, 234, 0.6);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 18px 36px rgba(33, 45, 79, 0.12);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 320px;
}

thead {
  background: rgba(240, 244, 255, 0.9);
}

thead th {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-muted);
  padding: 14px 16px;
  text-align: left;
}

tbody td {
  padding: 16px;
  border-top: 1px solid rgba(217, 222, 234, 0.5);
  font-size: 16px;
  transition: background var(--transition-fast);
}

tbody tr:nth-child(2n) td {
  background: rgba(244, 247, 255, 0.6);
}

tbody tr:hover td {
  background: rgba(230, 237, 255, 0.8);
}

.rank-row.top-1 td,
.rank-row.top-2 td,
.rank-row.top-3 td {
  background: #fff;
  font-weight: 700;
}

.rank-row.is-me td {
  background: rgba(46, 101, 255, 0.22);
  border-top: 1px solid rgba(46, 101, 255, 0.32);
  border-bottom: 1px solid rgba(46, 101, 255, 0.22);
  box-shadow: inset 0 0 0 1px rgba(46, 101, 255, 0.2);
  font-weight: 700;
}

.empty-state {
  padding: 32px;
  text-align: center;
  color: var(--color-muted);
}

@media (max-width: 720px) {
  .site-header__inner {
    padding: 16px 24px;
  }

  .page-body {
    margin: 24px auto;
    padding: 0 24px 48px;
    gap: 24px;
  }

  .site-nav {
    gap: 8px;
  }

  .nav-greeting {
    display: none;
  }

  .btn-lg {
    width: 100%;
  }

  .site-footer__inner {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
}


/* Inline spinner for refresh labels & inline loading */
.inline-spinner { width:14px; height:14px; border-radius:50%; border:2px solid #dbe1f2; border-top-color: var(--color-accent); display:inline-block; animation: spin 0.9s linear infinite; margin-right:6px; vertical-align:-2px; }
.inline-loading { display:none; font-size:14px; color: var(--color-muted); }
.inline-loading.visible { display:flex; align-items:center; gap:8px; }

.inline-spinner-rank { width:16px; height:16px; border-radius:50%; border:2px solid #e4e8fb; border-top-color: var(--color-highlight); display:inline-block; animation: spin 0.9s linear infinite; margin-right:6px; vertical-align:-2px; }
