:root {
  --paper: #EEF1F5;
  --sheet: #FFFFFF;
  --ink: #17202E;
  --muted: #6B7585;
  --line: #D9DEE6;
  --shorts: #E0393E;
  --long: #3346C8;
  --rise: #12804A;
  --fall: #8A93A2;
  --display: "Black Han Sans", "Pretendard Variable", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --text: "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.55 var(--text);
  padding-bottom: env(safe-area-inset-bottom);
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--long); outline-offset: 2px; border-radius: 4px; }
a { color: inherit; }

/* ── 머리 ─────────────────────────── */
.top {
  position: sticky; top: 0; z-index: 5;
  background: var(--ink); color: var(--paper);
  padding-top: env(safe-area-inset-top);
}
.top-inner, .tabs, main, .foot, .notice { max-width: 720px; margin: 0 auto; padding-left: 20px; padding-right: 20px; }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; padding-bottom: 10px; }
.brand { margin: 0; font: 400 clamp(16px, 4.6vw, 20px)/1.2 var(--display); letter-spacing: -0.01em; white-space: nowrap; }
.day { display: flex; align-items: center; gap: 4px; }
.day-label { min-width: 92px; text-align: center; line-height: 1.15; }
.date { display: block; font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; }
.weekday { display: block; font-size: 12px; color: #AEB6C3; }
.step {
  width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: transparent; font-size: 26px; line-height: 1; cursor: pointer;
}
.step:hover:not(:disabled) { background: rgba(255,255,255,.08); }
.step:disabled { opacity: .25; cursor: default; }

.tabs { display: flex; gap: 22px; }
.tabs button {
  border: 0; background: none; padding: 8px 0 11px; cursor: pointer;
  font-weight: 600; font-size: 15px; color: #AEB6C3;
  border-bottom: 3px solid transparent;
}
.tabs button[aria-selected="true"] { color: var(--paper); border-bottom-color: var(--shorts); }

.notice { margin-top: 12px; font-size: 14px; color: var(--ink); }
.notice p { margin: 0; padding: 10px 14px; background: #FFF4D6; border-left: 4px solid #E0A800; }

main { padding-top: 18px; padding-bottom: 24px; }
.summary { margin: 0 0 10px; color: var(--muted); font-size: 14.5px; }
.summary strong { color: var(--ink); font-weight: 700; }

.split { display: flex; height: 6px; border-radius: 3px; overflow: hidden; margin-bottom: 22px; background: var(--line); }
.split[hidden] { display: none; }
.split i { display: block; height: 100%; }
.split .s { background: var(--shorts); }
.split .l { background: var(--long); }

/* ── 전체 · 쇼츠 · 롱폼 ─────────────── */
.kinds { display: inline-flex; margin: 0 0 14px; padding: 3px; gap: 3px; background: var(--line); border-radius: 999px; }
.kinds button {
  border: 0; border-radius: 999px; padding: 6px 16px; cursor: pointer;
  background: transparent; font-weight: 600; font-size: 14.5px; color: var(--muted);
}
.kinds button[aria-pressed="true"] { background: var(--sheet); color: var(--ink); box-shadow: 0 1px 2px rgba(23,32,46,.12); }
.kinds button[data-kind="shorts"][aria-pressed="true"] { color: var(--shorts); }
.kinds button[data-kind="long"][aria-pressed="true"] { color: var(--long); }
.kinds button.missing { opacity: .45; }

/* ── 순위 ─────────────────────────── */
.ranking { list-style: none; margin: 0; padding: 0; }
.row { border-top: 1px solid var(--line); }
.row:last-child { border-bottom: 1px solid var(--line); }
.row-head {
  display: grid; grid-template-columns: 34px 1fr auto; align-items: center; column-gap: 12px;
  width: 100%; padding: 14px 0 12px; border: 0; background: none; text-align: left; cursor: pointer;
}
.rank { font: 400 22px/1 var(--display); color: var(--muted); font-variant-numeric: tabular-nums; }
.row:nth-child(-n+3) .rank { color: var(--ink); }
.word-wrap { min-width: 0; }
.word {
  display: block; font: 400 clamp(26px, 7.2vw, 40px)/1.08 var(--display); letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.row:nth-child(n+4) .word { font-size: clamp(22px, 5.6vw, 31px); }
.members { display: block; margin-top: 3px; font-size: 14px; font-weight: 600; color: var(--muted); line-height: 1.35; }
.bar { display: flex; height: 8px; margin-top: 9px; border-radius: 4px; overflow: hidden; background: transparent; }
.bar i { display: block; height: 100%; }
.bar .s { background: var(--shorts); }
.bar .l { background: var(--long); }
.nums { text-align: right; line-height: 1.2; white-space: nowrap; }
.ch { display: block; font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; }
.ch small { font-weight: 500; font-size: 12px; color: var(--muted); margin-left: 1px; }
.move { display: inline-block; margin-top: 4px; font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.move.up { color: var(--rise); }
.move.down { color: var(--fall); }
.move.same { color: var(--fall); font-weight: 500; }
.move.new { color: var(--sheet); background: var(--rise); padding: 1px 6px; border-radius: 3px; }

.detail { padding: 2px 0 18px 46px; }
.detail[hidden] { display: none; }
.detail h3 { margin: 14px 0 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.detail h3:first-child { margin-top: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.chips li { padding: 3px 10px; background: var(--sheet); border: 1px solid var(--line); border-radius: 999px; font-size: 14px; }
.facts { margin: 0; font-size: 14.5px; }
.spark { display: block; width: 100%; max-width: 360px; height: 64px; }
.spark-note { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.videos { list-style: none; margin: 0; padding: 0; }
.videos li + li { margin-top: 10px; }
.videos a { display: block; text-decoration: none; padding: 10px 12px; background: var(--sheet); border-left: 4px solid var(--long); }
.videos a.shorts { border-left-color: var(--shorts); }
.videos a:hover .vt { text-decoration: underline; }
.vt { display: block; font-weight: 600; font-size: 15px; line-height: 1.4; }
.vm { display: block; margin-top: 3px; font-size: 13px; color: var(--muted); }

.legend { margin: 16px 0 0; font-size: 13px; color: var(--muted); }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 4px 0 0; vertical-align: -1px; }
.sw.s { background: var(--shorts); }
.sw.l { background: var(--long); margin-left: 10px; }

.empty { padding: 36px 0; }
.empty h2 { margin: 0 0 6px; font: 400 24px/1.2 var(--display); }
.empty p { margin: 0; color: var(--muted); }

/* ── 14일 흐름 ─────────────────────── */
.flow-wrap { overflow-x: auto; margin: 6px -20px 0; padding: 0 20px 8px 0; }
.flow { border-collapse: separate; border-spacing: 3px; font-variant-numeric: tabular-nums; }
.flow th { font-size: 12px; font-weight: 600; color: var(--muted); padding: 0 2px 4px; text-align: center; white-space: nowrap; }
.flow th.kw {
  position: sticky; left: 0; z-index: 1; background: var(--paper);
  text-align: left; font: 400 17px/1.2 var(--display); color: var(--ink); padding: 0 10px 0 20px; white-space: nowrap;
}
.flow td { padding: 0; }
.flow td button, .flow td span {
  display: block; width: 34px; height: 30px; border: 0; border-radius: 4px;
  font-size: 13px; font-weight: 700; line-height: 30px; text-align: center; cursor: pointer;
}
.flow td span { background: transparent; cursor: default; }
.flow td span.nodata { background: repeating-linear-gradient(45deg, transparent 0 4px, var(--line) 4px 5px); }

.foot { padding-top: 8px; padding-bottom: 28px; font-size: 12.5px; color: var(--muted); }
.foot p { margin: 0; }

@media (prefers-reduced-motion: no-preference) {
  .bar i { transition: width .5s cubic-bezier(.2,.7,.2,1); }
}
@media (min-width: 640px) {
  .row-head { grid-template-columns: 44px 1fr auto; }
  .detail { padding-left: 56px; }
}
