/* Wireframe design system — system colors, 8px radius, no shadows */

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

:root {
  --bg:        #f2f2f7;
  --card:      #ffffff;
  --border:    #d1d1d6;
  --gray4:     #c7c7cc;
  --gray5:     #e5e5ea;
  --label:     #000000;
  --secondary: #8e8e93;
  --primary:   #007aff;
  --radius:    8px;
  --header-h:  76px;
  --sidebar-w: 320px;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--label);
  -webkit-font-smoothing: antialiased;
}

/* ── App shell ── */

#app {
  display: grid;
  grid-template-rows: var(--header-h) 1fr;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ── Header ── */

.header {
  display: flex;
  align-items: center;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  gap: 0;
}

.header-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--label);
  white-space: nowrap;
  flex-shrink: 0;
}

/* clock — centered */
.header-clock {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.clock-time {
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--label);
  line-height: 1;
}

.clock-date {
  font-size: 13px;
  color: var(--secondary);
  font-weight: 500;
}

/* right side: event pill + refresh badge */
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.countdown-pill {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 14px;
  gap: 2px;
}

.pill-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--secondary);
}

.pill-value {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--label);
  line-height: 1;
}

.refresh-ring {
  position: relative;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}

.ring-svg {
  width: 48px;
  height: 48px;
  transform: rotate(-90deg);
}

.ring-track {
  fill: none;
  stroke: var(--gray5);
  stroke-width: 3;
}

.ring-progress {
  fill: none;
  stroke: var(--secondary);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 87.96;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear;
}

.ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--secondary);
  font-variant-numeric: tabular-nums;
}

/* ── Main layout ── */

.main-layout {
  display: grid;
  grid-template-columns: 1fr var(--sidebar-w);
  overflow: hidden;
}

/* ── Content column ── */

.content-col {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 24px 32px;
  gap: 16px;
}

/* ── Podium ── */

.podium-section {
  flex-shrink: 0;
}

.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  height: 200px;
}

.podium-place {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  max-width: 220px;
}

.podium-info {
  text-align: center;
  padding-bottom: 10px;
  width: 100%;
}

.podium-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.1);
  margin: 0 auto 6px;
}

.podium-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--label);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.podium-pts {
  font-size: 13px;
  color: var(--secondary);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.podium-col {
  width: 100%;
  border-radius: var(--radius) var(--radius) 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-bottom: none;
}

.podium-rank {
  font-size: 28px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* Heights and tints */
.place-1 .podium-col {
  height: 120px;
  background: var(--card);
  border-color: var(--primary);
}
.place-1 .podium-rank { color: var(--primary); font-size: 36px; }

.place-2 .podium-col {
  height: 90px;
  background: var(--card);
  border-color: var(--gray4);
}
.place-2 .podium-rank { color: var(--secondary); }

.place-3 .podium-col {
  height: 65px;
  background: var(--card);
  border-color: var(--gray4);
}
.place-3 .podium-rank { color: var(--secondary); }

/* podium base bar */
.podium-section::after {
  content: '';
  display: block;
  height: 4px;
  background: var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  margin: 0 0 4px;
}

/* ── Rest of leaderboard (4th+) ── */

.rest-list {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rest-list::-webkit-scrollbar { display: none; }

.row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 20px;
  border: 1px solid var(--gray5);
}

.rank-badge {
  font-size: 15px;
  font-weight: 700;
  color: var(--secondary);
  width: 36px;
  text-align: center;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.row-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(0,0,0,0.08);
}

.row-name {
  flex: 1;
  font-size: 17px;
  font-weight: 600;
  color: var(--label);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-pts {
  font-size: 17px;
  font-weight: 700;
  color: var(--secondary);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* ── Error / empty states ── */

.message-box {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid var(--gray5);
}

.message-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 6px;
}

.message-body {
  font-size: 15px;
  color: var(--secondary);
}

.empty-row {
  text-align: center;
  padding: 32px 0;
  color: var(--secondary);
  font-size: 15px;
}

/* ── Events sidebar ── */

.events-sidebar {
  background: var(--card);
  border-left: 1px solid var(--border);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  scrollbar-width: none;
}

.events-sidebar::-webkit-scrollbar { display: none; }

.sidebar-heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--secondary);
}

.events-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.event-card {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 14px 16px;
  border: 1px solid var(--gray5);
}

.event-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--label);
  margin-bottom: 6px;
  line-height: 1.3;
}

.event-time {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 2px;
}

.event-location {
  font-size: 12px;
  color: var(--secondary);
}

/* ── Skeleton ── */

@keyframes shimmer {
  from { opacity: 1; }
  to   { opacity: 0.3; }
}

.skeleton {
  animation: shimmer 0.9s ease-in-out infinite alternate;
  pointer-events: none;
  border-color: var(--gray5) !important;
}

.skeleton-block {
  background: var(--gray5);
  border-radius: 4px;
  display: inline-block;
}

.rank-badge.skeleton-block { height: 16px; }
.dot-skel  { width: 10px; height: 10px; border-radius: 50% !important; }
.name-skel { height: 16px; width: 180px; }
.pts-skel  { height: 16px; width: 52px; }

/* ── Utility ── */

.hidden { display: none !important; }
