:root {
  --page-bg: #f4f7fb;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --text: #162033;
  --text-soft: #637083;
  --line: #e3e9f1;
  --line-strong: #d6deea;
  --primary: #2764e7;
  --primary-dark: #1748b3;
  --primary-soft: #eaf1ff;
  --success: #0b8f68;
  --danger: #ca3c4b;
  --shadow: 0 18px 50px rgba(27, 46, 78, 0.09);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 13px;
  --label-width: 290px;
  --prize-width: 150px;
  --chart-min-width: 1180px;
  --row-height: 64px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page-bg);
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 0%, rgba(39, 100, 231, 0.08), transparent 28rem),
    var(--page-bg);
  font-family: Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  min-height: 100vh;
}

.hero {
  color: #ffffff;
  background:
    linear-gradient(120deg, rgba(11, 35, 87, 0.96), rgba(31, 91, 220, 0.92)),
    linear-gradient(45deg, #173b8d, #2764e7);
  padding: 34px max(24px, calc((100vw - 1480px) / 2));
}

.hero__eyebrow {
  margin-bottom: 12px;
  color: rgba(255, 255, 255, 0.65);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.hero__main {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(26px, 3vw, 42px);
  line-height: 1.2;
  letter-spacing: -0.04em;
}

.hero p {
  margin: 10px 0 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 15px;
}

.refresh-button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 17px;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.refresh-button:hover {
  background: rgba(255, 255, 255, 0.2);
}

.refresh-button:active {
  transform: translateY(1px);
}

.refresh-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.refresh-button.is-loading .refresh-button__icon {
  animation: spin 0.8s linear infinite;
}

.content {
  width: min(1480px, calc(100% - 48px));
  margin: -18px auto 0;
  padding-bottom: 44px;
}

.dashboard-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.dashboard-toolbar,
.chart-guide {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 26px;
}

.dashboard-toolbar {
  border-bottom: 1px solid var(--line);
}

.tabs {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(96px, 1fr));
  padding: 5px;
  border-radius: 14px;
  background: var(--surface-muted);
}

.tab-button {
  min-height: 40px;
  padding: 0 22px;
  color: var(--text-soft);
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-weight: 800;
  cursor: pointer;
}

.tab-button.is-active {
  color: var(--primary-dark);
  background: var(--surface);
  box-shadow: 0 5px 16px rgba(27, 46, 78, 0.11);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 9px;
  width: min(360px, 100%);
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-box:focus-within {
  border-color: rgba(39, 100, 231, 0.6);
  box-shadow: 0 0 0 4px rgba(39, 100, 231, 0.1);
}

.search-box__icon {
  color: var(--text-soft);
  font-size: 20px;
}

.search-box input {
  width: 100%;
  min-width: 0;
  color: var(--text);
  border: 0;
  outline: 0;
  background: transparent;
}

.search-box input::placeholder {
  color: #9aa5b5;
}

.chart-guide {
  align-items: flex-end;
  padding-bottom: 18px;
}

.chart-guide h2 {
  margin: 0;
  font-size: 21px;
  letter-spacing: -0.03em;
}

.chart-guide p {
  margin: 7px 0 0;
  color: var(--text-soft);
  font-size: 13px;
}

.updated-at {
  color: var(--text-soft);
  font-size: 12px;
  white-space: nowrap;
}

.chart-viewport {
  max-height: min(68vh, 900px);
  overflow: auto;
  border-top: 1px solid var(--line);
  scrollbar-color: #b8c3d2 transparent;
  scrollbar-width: thin;
}

.member-chart {
  min-width: var(--chart-min-width);
  background: var(--surface);
}

.chart-axis,
.chart-row {
  display: grid;
  grid-template-columns: var(--label-width) minmax(0, 1fr) var(--prize-width);
}

.chart-axis {
  position: sticky;
  top: 0;
  z-index: 8;
  min-height: 52px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--surface-muted);
}

.axis-label {
  position: sticky;
  left: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  padding: 0 22px;
  color: var(--text-soft);
  border-right: 1px solid var(--line);
  background: var(--surface-muted);
  font-size: 12px;
  font-weight: 800;
}

.axis-prize {
  position: sticky;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  color: var(--text-soft);
  border-left: 1px solid var(--line);
  background: var(--surface-muted);
  box-shadow: -8px 0 18px rgba(27, 46, 78, 0.04);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.scale {
  position: relative;
  margin: 0 28px;
}

.scale::before,
.bar-track::before {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  background-image: repeating-linear-gradient(
    to right,
    rgba(141, 155, 176, 0.2) 0,
    rgba(141, 155, 176, 0.2) 1px,
    transparent 1px,
    transparent var(--step)
  );
}

.scale-tick {
  position: absolute;
  top: 50%;
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 700;
  transform: translate(-50%, -50%);
}

.scale-tick:first-child {
  transform: translate(0, -50%);
}

.scale-tick:last-child {
  transform: translate(-100%, -50%);
}

.chart-row {
  min-height: var(--row-height);
  border-bottom: 1px solid var(--line);
}

.chart-row:last-child {
  border-bottom: 0;
}

.chart-row:hover .row-label,
.chart-row:hover .bar-cell,
.chart-row:hover .prize-cell {
  background-color: #fbfdff;
}

.row-label {
  position: sticky;
  left: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.ranking {
  color: #93a0b2;
  font-size: 12px;
  font-weight: 800;
}

.ranking.is-top {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: var(--primary-dark);
  border-radius: 9px;
  background: var(--primary-soft);
}

.person-info {
  min-width: 0;
}

.person-info strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person-info span {
  display: block;
  overflow: hidden;
  margin-top: 4px;
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.count-badge {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  min-width: 48px;
  justify-content: flex-end;
  color: var(--primary-dark);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.count-badge small {
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 700;
}

.bar-cell {
  display: flex;
  align-items: center;
  padding: 0 28px;
  background: var(--surface);
}

.bar-track {
  position: relative;
  width: 100%;
  height: 22px;
  overflow: hidden;
  border: 1px solid #e3e9f2;
  border-radius: 999px;
  background: #f6f8fb;
}

.bar-fill {
  position: relative;
  z-index: 1;
  height: 100%;
  min-width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #2866e7 0%, #4a89ff 70%, #66a1ff 100%);
  box-shadow: 0 5px 14px rgba(39, 100, 231, 0.18);
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.bar-fill.is-zero {
  width: 4px !important;
  background: #c9d2df;
  box-shadow: none;
}

.bar-fill.is-over {
  background: linear-gradient(90deg, #0b8f68, #25b887);
}


.prize-cell {
  position: sticky;
  right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 3px;
  padding: 8px 12px;
  border-left: 1px solid var(--line);
  background: var(--surface);
  box-shadow: -8px 0 18px rgba(27, 46, 78, 0.035);
  text-align: center;
  white-space: nowrap;
}

.prize-cell strong {
  color: #95a0b0;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: -0.035em;
}

.prize-cell span {
  color: #a4adba;
  font-size: 10px;
  font-weight: 700;
}

.prize-cell.is-achieved {
  background: #fffafb;
}

.prize-cell.is-achieved strong {
  color: #e83962;
}

.prize-cell.is-achieved span {
  color: #b45a70;
}

.state-panel {
  display: grid;
  min-height: 310px;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 40px 24px;
  border-top: 1px solid var(--line);
  text-align: center;
}

.state-panel strong {
  font-size: 17px;
}

.state-panel p {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
}

.state-panel--error strong {
  color: var(--danger);
}

.state-panel button {
  min-height: 40px;
  margin-top: 8px;
  padding: 0 18px;
  color: #ffffff;
  border: 0;
  border-radius: 10px;
  background: var(--primary);
  font-weight: 800;
  cursor: pointer;
}

.spinner {
  width: 30px;
  height: 30px;
  border: 3px solid #dfe7f2;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.footer {
  display: flex;
  justify-content: center;
  gap: 18px;
  padding: 0 24px 28px;
  color: #8a96a7;
  font-size: 11px;
}

[hidden] {
  display: none !important;
}

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

@media (max-width: 980px) {
  :root {
    --label-width: 250px;
  }

}

@media (max-width: 680px) {
  :root {
    --label-width: 180px;
    --prize-width: 110px;
    --row-height: 60px;
  }

  .hero {
    padding: 26px 18px 34px;
  }

  .hero__main {
    align-items: flex-start;
  }

  .hero p {
    max-width: 250px;
    font-size: 13px;
    line-height: 1.55;
  }

  .refresh-button {
    width: 44px;
    padding: 0;
  }

  .refresh-button span:last-child {
    display: none;
  }

  .content {
    width: calc(100% - 24px);
    margin-top: -14px;
    padding-bottom: 30px;
  }

  .dashboard-card {
    border-radius: 18px;
  }

  .dashboard-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
  }

  .tabs,
  .search-box {
    width: 100%;
  }

  .chart-guide {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    padding: 18px 16px 14px;
  }

  .chart-guide h2 {
    font-size: 18px;
  }

  .updated-at {
    white-space: normal;
  }

  .chart-viewport {
    max-height: 64vh;
  }

  .axis-label {
    padding: 0 10px;
    font-size: 10px;
    line-height: 1.35;
  }

  .row-label {
    grid-template-columns: 24px minmax(0, 1fr) auto;
    gap: 5px;
    padding: 9px 8px;
  }

  .ranking.is-top {
    width: 23px;
    height: 23px;
  }

  .person-info strong {
    font-size: 13px;
  }

  .person-info span {
    font-size: 10px;
  }

  .count-badge {
    min-width: 32px;
    font-size: 15px;
  }


  .prize-cell {
    padding: 7px 8px;
  }

  .prize-cell strong {
    font-size: 13px;
  }

  .prize-cell span {
    font-size: 9px;
  }

  .bar-cell,
  .scale {
    margin-left: 0;
    margin-right: 0;
  }

  .bar-cell {
    padding: 0 18px;
  }

  .scale {
    margin: 0 18px;
  }

  .footer {
    align-items: center;
    flex-direction: column;
    gap: 5px;
    padding-bottom: 22px;
  }
}
