:root {
  --bg: #f8f7fc;
  --bg-soft: #efedf7;
  --surface: #ffffff;
  --line: #e2e6f0;
  --line-soft: #ecefF7;
  --ink: #0a0e1a;
  --ink-2: #454c60;
  --muted: #7d8499;
  --muted-2: #838ba1;
  --accent: #7069e8;
  --accent-ink: #5a52d6;
  --accent-soft: #f0efff;
  --accent-glow: rgba(112, 105, 232, 0.14);
  /* 링크 전용 색. 차트/카드의 보라 액센트와는 따로 두고,
     GitHub류 서비스에서 익숙한 파란 링크 톤을 살짝 빌려 왔다(정확한 GitHub 헥스코드는 아님) */
  --link: #2f6fb0;
  --link-ink: #24557f;
  --teal: #22b8a6;
  --teal-ink: #0c7a6d;
  --teal-soft: #e3f9f6;
  --up: #1cbf7e;
  --up-ink: #0c8054;
  --up-soft: #e6faf0;
  --down: #f0656d;
  --down-ink: #d43e48;
  --down-soft: #fdedee;
  --warn: #d99a2b;
  --warn-ink: #9c6b09;
  --warn-bg: #fff8e8;
  --warn-line: #f4dfa0;
  --label: 'Inter', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', system-ui, sans-serif;
  --sans: Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', system-ui, sans-serif;
  --display: 'Manrope', var(--sans);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.6;
  letter-spacing: -0.012em;
  -webkit-font-smoothing: antialiased;
}

.num { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; }
.mono { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 600; font-size: 0.92em; letter-spacing: -0.01em; }
a { color: var(--link); text-decoration: none; font-weight: 600; }
a:hover { color: var(--link-ink); text-decoration: underline; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

/* ── 상단 ────────────────────────────────────────── */
.spectrum {
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--accent) 0%,
    var(--up) 34%,
    var(--warn) 62%,
    var(--teal) 100%
  );
}
.top { border-bottom: 1px solid var(--line); background: var(--surface); }
.top-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.wordmark {
  font-family: var(--display);
  font-size: 23px;
  font-weight: 800;
  letter-spacing: 0.005em;
  display: inline-flex;
  align-items: center;
}
.wordmark i { color: var(--accent); font-style: normal; }

.wm-mark {
  color: var(--accent);
  flex-shrink: 0;
  width: 0;
  opacity: 0;
  margin-right: 0;
  overflow: hidden;
  transform: translateX(-4px);
  transition: opacity 0.18s ease, width 0.18s ease, margin-right 0.18s ease, transform 0.18s ease;
}
/* 헤더 어디에 올려도 아이콘은 나타난다 — "여기 뭔가 있다"는 넓은 힌트 */
.top:hover .wm-mark { opacity: 1; width: 15px; margin-right: 7px; transform: translateX(0); }
.wm-roll {
  display: inline-block;
  min-width: 4.6ch;
  font-variant-numeric: tabular-nums;
}
/* 실제 굴러가는 이벤트는 로고 텍스트를 정조준했을 때만 — 발견의 손맛은 여기 남긴다 */
.wordmark:hover .wm-roll { color: var(--accent-ink); }

/* ── 헤드라인 ────────────────────────────────────── */
.hero {
  min-height: 58vh;
  padding: 8vh 0 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  position: relative;
}
.eyebrow {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--muted-2);
  margin: 0 0 24px;
}
.eyebrow b { color: var(--accent-ink); font-weight: 800; }

.figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.value-line {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 12px;
  width: 100%; /* max-width만으론 안 됨: .figure의 align-items:center 때문에
                  이 줄이 자기 콘텐츠 크기로 쪼그라들어서, 실측 폭(clientWidth)이
                  항상 콘텐츠 폭(scrollWidth)과 같아져 버려 넘침 감지가 무력화됐다.
                  width:100%로 못박아야 실제 페이지 폭 기준으로 정확히 잰다. */
  min-width: 0;
}
.sub-line {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.info-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: var(--teal-soft);
  color: var(--teal-ink);
  font-family: var(--label);
  font-size: 12px;
  font-weight: 800;
  cursor: help;
  position: relative;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--teal-soft);
  align-self: center;
}
.info-badge:focus-visible { outline: 2px solid var(--teal-ink); outline-offset: 2px; }
.info-tip {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  width: 240px;
  background: var(--ink);
  color: #fff;
  font-family: var(--label);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.5;
  padding: 9px 11px;
  border-radius: 8px;
  text-align: left;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 5;
}
.info-badge:hover .info-tip,
.info-badge:focus-visible .info-tip { opacity: 1; }
.refresh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted-2);
  cursor: pointer;
  transition: background 0.13s ease, border-color 0.13s ease, color 0.13s ease;
}
.refresh-btn:hover:not([disabled]) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.refresh-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.refresh-btn .icon-refresh { display: inline-flex; }
.refresh-btn .icon-check { display: none; }
.refresh-btn.is-loading .icon-refresh { animation: spin 0.7s linear infinite; }
.refresh-btn.confirm { background: var(--up-soft); border-color: transparent; color: var(--up-ink); }
.refresh-btn.confirm .icon-refresh { display: none; }
.refresh-btn.confirm .icon-check { display: inline-flex; }
@keyframes spin { to { transform: rotate(360deg); } }

.figure .value {
  display: inline-block;
  flex-shrink: 0;
  min-width: 0;
  max-width: 100%;
  /* 숫자 중간에서 줄바꿈되는 걸 원천 차단한다.
     이게 없으면 박스가 좁아졌을 때 텍스트가 잘리는 대신 두 줄로 쪼개져 버린다. */
  white-space: nowrap;
  font-family: var(--display);
  /* 화면 대부분에서 안전하게 맞는 상한. nowrap과 JS 실측 보정이 함께 있어
     조금 더 과감하게 키워도 넘칠 걱정이 없다. */
  font-size: clamp(72px, 17vw, 264px);
  font-weight: 800;
  line-height: 0.88;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, var(--ink) 0%, var(--ink-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  cursor: default;
  transition: transform 0.15s ease;
}
.figure .value.is-scrambling { transform: scale(1.015); }
.figure .value.is-stale { background: linear-gradient(180deg, var(--muted-2), var(--muted-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.figure .value.is-stale.is-scrambling { transform: none; }
.figure .unit {
  flex-shrink: 0;
  font-family: var(--display);
  font-size: clamp(22px, 2.6vw, 32px);
  font-weight: 700;
  color: var(--muted-2);
  padding-bottom: 0.15em;
}
.figure .delta {
  font-family: var(--display);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: clamp(18px, 2.4vw, 28px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.figure .delta.up { color: var(--up-ink); }
.figure .delta.down { color: var(--down-ink); }
.figure .delta.flat { color: var(--muted-2); }
.figure .delta.none { color: var(--muted-2); font-size: 15px; font-weight: 500; }
.caret { font-size: 0.7em; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 700;
  border-radius: 5px;
  padding: 5px 11px;
  letter-spacing: -0.005em;
}
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent); }
.pill.fresh { color: var(--up-ink); background: var(--up-soft); }
.pill.stale { color: var(--warn-ink); background: var(--warn-bg); }

.meta {
  margin: 14px 0 0;
  font-family: var(--label);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted-2);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 16px;
}
.meta span { white-space: nowrap; }

details.detail { align-self: center; width: 100%; max-width: 620px; margin-top: 20px; text-align: left; }
details.detail > summary {
  list-style: none;
  cursor: pointer;
  font-family: var(--label);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--muted-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
details.detail > summary::-webkit-details-marker { display: none; }
details.detail > summary:hover { color: var(--accent-ink); }
details.detail[open] > summary .arrow { transform: rotate(180deg); }
.arrow { display: inline-block; font-size: 8px; transition: transform 0.15s ease; }
.detail-body {
  margin-top: 14px;
  padding: 16px 18px;
  background: var(--accent-soft);
  border-radius: 8px;
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 8px 14px;
  font-size: 12.5px;
}
.detail-body dt { color: var(--accent-ink); font-weight: 600; }
.detail-body dd { margin: 0; word-break: break-all; font-family: var(--label); font-size: 11.5px; color: var(--ink-2); }

/* ── 통계 카드 ───────────────────────────────────── */
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-top: 48px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.stat-cell { background: var(--surface); padding: 28px 24px; text-align: right; }
.stat-cell.accent { background: var(--accent-soft); }
.stat-cell.up { background: var(--up-soft); }
.stat-cell.down { background: var(--down-soft); }
.stat-cell.teal { background: var(--teal-soft); }
.stat-cell dt {
  font-family: var(--label);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--muted-2);
  text-align: right;
}
.stat-cell dd {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin: 8px 0 0;
}
.stat-cell dd .stat-figure {
  display: inline-block;
  white-space: nowrap;
  font-size: clamp(30px, 3.6vw, 46px);
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.stat-cell dd .stat-unit {
  font-size: 0.4em;
  font-weight: 700;
  letter-spacing: 0;
  margin-left: 2px;
}
.stat-cell dd small { font-size: 11px; font-weight: 600; color: var(--muted-2); margin-top: 4px; letter-spacing: 0; }
.stat-cell.accent dd { color: var(--accent-ink); }
.stat-cell.up dd { color: var(--up-ink); }
.stat-cell.down dd { color: var(--down-ink); }
.stat-cell.teal dd { color: var(--teal-ink); }

/* ── 차트 ────────────────────────────────────────── */
.chart-wrap { margin-top: 44px; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; }
svg.chart { display: block; max-width: none; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .grid.zero { stroke: var(--line-soft); }
.chart .axis { fill: var(--muted-2); font-family: var(--label); font-size: 13px; font-weight: 700; }
.chart .area { fill: url(#areaFill); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot-outer { fill: var(--surface); stroke: var(--accent); stroke-width: 3; }
.chart .dot-inner { fill: var(--accent); }
.chart .dot-label { fill: var(--ink); font-family: var(--display); font-size: 17px; font-weight: 800; }
.chart .placeholder { stroke: var(--line); stroke-width: 1.5; stroke-dasharray: 5 5; }
.chart .hint { fill: var(--muted-2); font-family: var(--sans); font-size: 13px; font-weight: 600; }

/* ── 구획 ────────────────────────────────────────── */
section { margin-top: 88px; }

/* ── 히스토리 스트립 (누적 기록 잔디) ─────────────────
   칸 수는 항상 '실제로 기록된 날 수'와 같다. 빈 칸을 미리 그리지 않으므로
   언제 봐도 꽉 찬 상태로 보인다. 색은 GitHub 잔디의 5단계 초록을 그대로 쓴다. */
.strip-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 18px; }
.strip-label { font-family: var(--label); font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.strip-count { font-family: var(--label); font-size: 12px; font-weight: 600; color: var(--muted-2); }

.history-strip {
  display: grid;
  grid-template-columns: 28px repeat(var(--week-count), 14px);
  grid-template-rows: repeat(7, 14px);
  gap: 5px;
  padding: 22px 24px 26px;
  margin-bottom: 40px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow-x: auto;
}
.strip-wd {
  grid-column: 1;
  width: 28px;
  height: 14px;
  font-family: var(--label);
  font-size: 10px;
  font-weight: 600;
  color: var(--muted-2);
  line-height: 14px;
  text-align: right;
  padding-right: 7px;
  white-space: nowrap;
}
.strip-cell {
  width: 14px;
  height: 14px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: #ebedf0;
  cursor: pointer;
  transition: transform 0.1s ease, outline-color 0.1s ease;
  outline: 2px solid transparent;
  outline-offset: 1px;
}
.strip-cell:hover, .strip-cell:focus-visible {
  transform: scale(1.35);
  outline-color: var(--accent);
}
.strip-cell.lvl-1 { background: #9be9a8; }
.strip-cell.lvl-2 { background: #40c463; }
.strip-cell.lvl-3 { background: #30a14e; }
.strip-cell.lvl-4 { background: #216e39; }

tr.row-highlight td { background: var(--accent-soft); }
tr.row-highlight td:first-child { border-radius: 0 0 0 8px; }
tr.row-highlight td:last-child { border-radius: 0 0 8px 0; }
.sec-head { display: flex; align-items: baseline; gap: 9px; margin-bottom: 14px; }
.sec-icon { align-self: center; color: var(--accent); flex-shrink: 0; }
.sec-head h2 {
  margin: 0;
  font-family: var(--label);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.sec-head p { margin: 0; font-size: 14px; font-weight: 600; color: var(--muted-2); }

/* ── 표 ──────────────────────────────────────────── */
.scroll { overflow-x: auto; }
.history-scroll { max-height: 430px; overflow-y: auto; }
.history-scroll thead th { position: sticky; top: 0; background: var(--bg); }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 13px 15px 13px 0; border-bottom: 1px solid var(--line-soft); white-space: nowrap; transition: background 0.12s ease; }
thead th {
  font-family: var(--label);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--muted-2);
  border-bottom-color: var(--line);
}
tbody tr:last-child td { border-bottom: 0; }
.date-note { display: block; margin-top: 2px; font-size: 11px; font-weight: 600; color: var(--muted-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.big { font-size: 18px; font-weight: 800; }
td.up { color: var(--up-ink); font-weight: 700; }
td.down { color: var(--down-ink); font-weight: 700; }
.empty { padding: 44px 0; color: var(--muted-2); font-size: 13.5px; font-weight: 600; white-space: normal; text-align: center; }

/* ── 실패 ────────────────────────────────────────── */
.failure {
  align-self: center;
  width: 100%;
  max-width: 620px;
  margin-top: 26px;
  text-align: left;
  padding: 18px 20px;
  border-left: 4px solid var(--warn-line);
  background: var(--warn-bg);
  border-radius: 0 8px 8px 0;
}
.failure h3 { margin: 0 0 7px; font-size: 14.5px; font-weight: 700; color: #7a5c00; }
.failure p { margin: 0 0 8px; font-size: 13.5px; font-weight: 500; color: #6b5200; }
.failure .next { font-weight: 700; }
.failure .tech { font-family: var(--label); font-size: 11.5px; margin-bottom: 0; opacity: 0.85; }
.failure button { margin-top: 14px; }

/* ── 버튼 ────────────────────────────────────────── */
button {
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 7px;
  padding: 7px 14px;
  cursor: pointer;
  transition: background 0.13s ease, border-color 0.13s ease, transform 0.08s ease;
}
button:hover:not([disabled]) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
button:active:not([disabled]) { transform: scale(0.98); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button[disabled] { opacity: 0.45; cursor: not-allowed; }
button.solid { background: var(--accent); border-color: var(--accent); color: #fff; }
button.solid:hover:not([disabled]) { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }
button.retry { background: var(--warn); border-color: var(--warn); color: #fff; }
button.retry:hover:not([disabled]) { background: #96700a; border-color: #96700a; color: #fff; }

/* ── FALLBACK ────────────────────────────────────── */
details.fallback { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
details.fallback > summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 14px;
  font-weight: 700;
}
details.fallback > summary::-webkit-details-marker { display: none; }
details.fallback > summary:hover { background: var(--bg); }
details.fallback > summary .sub { font-weight: 500; color: var(--muted-2); font-size: 12.5px; }
details.fallback > summary .grow { flex: 1; }
details[open].fallback > summary { border-bottom: 1px solid var(--line); }
details[open].fallback > summary .arrow { transform: rotate(180deg); }
.fallback-body { padding: 28px 24px; }
.note { margin: 0 0 20px; font-size: 12.5px; font-weight: 500; color: var(--muted-2); }

.controls { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 24px; }
.controls .break { flex-basis: 100%; height: 0; }

.timeline { display: flex; align-items: stretch; gap: 0; margin-bottom: 22px; overflow-x: auto; }
.step { flex: 1 1 0; min-width: 96px; position: relative; padding: 0 5px; }
.step .rail { height: 4px; border-radius: 2px; background: var(--line); margin-bottom: 10px; }
.step.ok .rail { background: var(--up); }
.step.err .rail { background: var(--warn-line); }
.step .id { font-family: var(--label); font-size: 12px; font-weight: 700; color: var(--muted-2); letter-spacing: -0.005em; display: block; }
.step .st { font-size: 13.5px; font-weight: 700; }
.step.ok .st { color: var(--up); }
.step.err .st { color: var(--warn); }

.state { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 20px; margin-bottom: 24px; }
.state dt { font-family: var(--label); font-size: 12.5px; font-weight: 700; letter-spacing: -0.005em; color: var(--muted-2); }
.state dd { margin: 4px 0 0; font-size: 23px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.state dd.sm { font-size: 13.5px; }

.foot {
  margin-top: 64px;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
}
.foot-inner {
  padding: 20px 24px 30px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  font-family: var(--label);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--muted-2);
}
.foot-dot { font-weight: 800; }

.skel {
  display: inline-block;
  width: 320px;
  height: clamp(84px, 14vw, 160px);
  border-radius: 10px;
  background: linear-gradient(90deg, #e8ecf6, #f6f8fc, #e8ecf6);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

@media (max-width: 760px) {
  .wrap { padding: 0 18px; }
  .foot-inner { padding: 18px 18px 26px; }
  .value-line { flex-wrap: wrap; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-body { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .detail-body dt { margin-top: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
