/* 설탕 리포트 — 따뜻한 파스텔 톤. 색은 아래 토큰을 역할 이름으로만 쓴다 */

/* "구 플 뱅" 글꼴: 메이플스토리 서체 굵게. 저작권 (주)넥슨코리아.
   넥슨 서체는 웹 사용이 자유롭지만 파일 수정·재배포가 안 돼서 글자만 잘라 내지 않고
   눈누 CDN의 원본 파일(약 420KB, 1년 캐시)을 그대로 불러온다. 받는 동안은 기본 글꼴로 먼저 보인다. */
@font-face {
  font-family: "Maplestory";
  src: url("https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_20-04@2.1/MaplestoryOTFBold.woff") format("woff");
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --page: #fdf6ee;
  --cell: #fffaf5;            /* 방송 있는 칸 */
  --cell-border: #f1dccb;
  --empty-border: #f3e6da;    /* 방송 없는 칸 */
  --ink: #4b3a32;             /* 본문 글자 (칸 위 10.4:1) */
  --ink-2: #7a6558;           /* 보조 글자 (칸 위 5.3:1, 머리말 띠 위 4.7:1) */
  --muted: #806a5e;           /* 흐린 글자: 받은 #9b8478은 3.3:1이라 4.5:1 넘게 한 단계 진하게 */
  --meter-track: #fde6dc;
  --meter-fill: #f4a28c;
  --two-badge-bg: #fff0c2;
  --two-badge-ink: #7a5a12;   /* 5.6:1 */
  --gpb-ink: #5e4580;         /* 구 플 뱅 글자 (칸 위 8:1 이상) */
  --select-bg: #fffaf5;      /* 전환 버튼(안 고른 쪽) 바탕 */
  --select-border: #ecd8c8;  /* 전환 버튼 테두리 */
  --thumb-bg: #fbeee4;        /* 썸네일 자리 바탕(이미지 없을 때만 보임) */
  --focus: #f08f7a;
  --font: system-ui, -apple-system, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}

/* ---------- 기본 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  word-break: keep-all;
}
p { margin: 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.wide { width: min(100% - 32px, 1760px); margin-inline: auto; }
.status { padding: 48px 0; color: var(--ink-2); text-align: center; }
.status.err { color: var(--ink); }

/* ---------- 응원봉 포함/제외 전환 (달력 위 오른쪽, 자기 줄) ---------- */
/* 제목·요약 칩·응원봉 전환을 한 묶음으로 가운데에 모은다 */
.toolbar { display: flex; justify-content: center; align-items: center; gap: 20px; height: 40px; margin-bottom: 6px; }

/* 맨 위 왼쪽: 제목 + 한 달 요약 칩 */
.summary { display: flex; align-items: center; gap: 8px; min-width: 0; white-space: nowrap; }
.summary .title { margin: 0 6px 0 0; font-family: "Maplestory", var(--font); font-weight: 700; font-size: 24px; line-height: 1; color: var(--ink); }
.chip { display: inline-flex; align-items: baseline; gap: 4px; padding: 4px 11px; border-radius: 999px; background: var(--cell); border: 1px solid var(--cell-border); }
.chip-k { font-size: 12px; color: var(--ink-2); }
.chip-v { font-size: 15px; font-weight: 700; color: var(--ink); }
.chip-u { font-size: 12px; color: var(--ink-2); }
.sum-note { font-size: 12px; color: var(--ink-2); }
.seg { display: inline-flex; }
.seg button {
  font: inherit;
  font-size: 12px;
  line-height: 1;
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--select-border);
  background: var(--select-bg);
  color: var(--ink-2);
  cursor: pointer;
}
.seg button:first-child { border-radius: 14px 0 0 14px; }
.seg button:last-child { border-radius: 0 14px 14px 0; border-left-width: 0; }
.seg button[aria-pressed="true"] { background: var(--meter-fill); border-color: var(--meter-fill); color: var(--ink); font-weight: 600; cursor: default; }

main { padding-top: 6px; transition: opacity 0.15s; }
main.loading { opacity: 0.5; pointer-events: none; }

/* ---------- 달력 ----------
 * 칸 크기는 썸네일 폭 --tw 하나로 정해진다(app.js fitCalendar가 화면 높이에 맞춰 넣음).
 * 칸 폭 = --tw + 8px(안쪽 여백 3+3, 테두리 1+1). 그리드는 가운데 정렬. */
.cal-sec { overflow-x: auto; padding: 2px; } /* 창이 아주 좁으면 이 상자 안에서만 가로로 밀린다 */
.cal {
  --tw: 160px;
  display: grid;
  grid-template-columns: repeat(7, calc(var(--tw) + 8px));
  gap: 6px;
  justify-content: center;
}
.cal-wd { font-size: 11px; line-height: 14px; color: var(--muted); text-align: center; margin-bottom: -2px; }
.day {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 3px 3px 4px;
  border-radius: 8px;
  border: 1px solid var(--cell-border);
  background: var(--cell);
  text-align: center;
}
.day.off { background: transparent; border-color: var(--empty-border); }

.day-head { display: flex; align-items: center; justify-content: center; gap: 4px; height: 15px; }
.day-num { font-size: 12px; font-weight: 600; line-height: 15px; }
.day.off .day-num { color: var(--muted); font-weight: 400; }
.day-badges { display: inline-flex; gap: 2px; }
.badge {
  display: inline-block; font-size: 10px; font-weight: 600; line-height: 14px; padding: 0 4px;
  border-radius: 3px; background: var(--two-badge-bg); color: var(--two-badge-ink); white-space: nowrap;
}

/* 썸네일: 16:9 그대로(320x180). 자르거나 덮지 않는다(안전망으로 contain) */
.day-thumbs { width: 100%; aspect-ratio: 16 / 9; border-radius: 5px; overflow: hidden; background: var(--thumb-bg); display: flex; align-items: center; }
.day-thumbs.multi { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; align-items: center; }
.day-thumbs.multi .thumb { border-radius: 3px; overflow: hidden; }
.thumb { display: block; width: 100%; min-width: 0; }
.thumb img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: contain; }
.no-img { display: flex; width: 100%; aspect-ratio: 16 / 9; align-items: center; justify-content: center; font-size: 11px; color: var(--muted); }

/* 늘 보이는 간략 통계: 분당 채팅(크게) / 얇은 막대 / 채팅·시간 한 줄. 가운데 정렬 */
.day-stats { display: flex; flex-direction: column; align-items: center; min-width: 0; padding: 0 2px; }
.day-cpm { display: flex; align-items: baseline; justify-content: center; gap: 4px; height: 18px; overflow: hidden; max-width: 100%; }
.day-cpm strong { font-size: clamp(15px, 1.8vh, 19px); font-weight: 650; line-height: 18px; color: var(--ink); }
.day-cpm span { font-size: 11px; color: var(--ink-2); white-space: nowrap; }
.meter { display: block; width: 100%; height: 3px; border-radius: 2px; background: var(--meter-track); overflow: hidden; margin: 1px 0 1px; text-align: left; }
.meter-fill { display: block; height: 100%; border-radius: 2px; background: var(--meter-fill); }
.day-line { max-width: 100%; font-size: 11px; line-height: 14px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 구 플 뱅(구독 플러스 방송, 통계 제외): 상자 없이 글자만 크게.
   높이는 통계 칸(분당 채팅 + 막대 + 한 줄)을 넘지 않게 잡아 한 화면 맞춤 계산이 흔들리지 않게 한다 */
.gpb { display: block; margin-top: 6px; font-family: "Maplestory", var(--font); font-size: clamp(17px, 2.1vh, 21px); font-weight: 700; line-height: 26px; color: var(--gpb-ink); white-space: nowrap; }
@media (min-height: 950px) {
  .day-cpm { height: 22px; }
  .day-cpm strong { line-height: 22px; }
  .day-cpm span, .day-line { font-size: 12px; }
  .day-line { line-height: 16px; }
}

/* ---------- 페이지 넘기기 ----------
 * app.js showPage가 .leaving(나가는 쪽) → .entering(.in) 순서로 붙인다. --dx는 이동 방향 24px */
.page { --dur: 480ms; transition: opacity var(--dur) ease-out, transform var(--dur) ease-out; }
.page.leaving, .page.entering { opacity: 0; transform: translateX(var(--dx, 0)); }
.page.entering.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .page { --dur: 200ms; }
  .page.leaving, .page.entering { transform: none; }
}
body.turning main { pointer-events: none; }

/* 양옆 화살표: 화면에 붙어 있어 달력 자리를 밀지 않는다 */
.nav-btn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--select-border);
  background: var(--select-bg);
  color: var(--ink);
  font: inherit;
  font-size: 28px;
  line-height: 1;
  padding: 0 0 4px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(75, 58, 50, 0.08);
}
.nav-btn.next { right: 16px; }
.nav-btn.prev { left: 16px; }
.nav-btn[hidden] { display: none; }

/* ---------- 2페이지: 분당 채팅 Top 5 ---------- */
/* 양옆 화살표 자리(64px씩)를 비우고 가운데 */
.wide2 { width: min(100% - 160px, 1640px); margin-inline: auto; }
.p2-head { display: flex; align-items: baseline; gap: 12px; white-space: nowrap; }
.p2-head .title { margin: 0; font-family: "Maplestory", var(--font); font-weight: 700; font-size: 24px; line-height: 1; color: var(--ink); }
.p2-sub { font-size: 13px; color: var(--ink-2); }
.t5-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 320px));
  gap: 18px;
  justify-content: center;
  margin-top: 18px;
}
.t5-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.t5-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 10px 12px; border-radius: 12px;
  border: 1px solid var(--cell-border); background: var(--cell); text-align: center;
}
.t5-head { display: flex; align-items: center; justify-content: center; gap: 8px; }
.t5-rank {
  display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--meter-fill); color: var(--ink); font-weight: 700; font-size: 13px;
}
.t5-date { font-size: 13px; font-weight: 600; color: var(--ink); }
.t5-thumb { width: 100%; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: var(--thumb-bg); }
.t5-title {
  width: 100%; font-size: 13px; line-height: 1.4; color: var(--ink-2); min-height: 2.8em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.t5-cpm { display: flex; align-items: baseline; justify-content: center; gap: 5px; }
.t5-cpm strong { font-size: clamp(20px, 2.8vh, 28px); font-weight: 700; line-height: 1.1; color: var(--ink); }
.t5-cpm span { font-size: 12px; color: var(--ink-2); }
.t5-line { font-size: 12px; color: var(--ink-2); }
.t5-story { text-align: center; padding: 0 4px; }
.t5-topic { font-family: "Maplestory", var(--font); font-weight: 700; font-size: 16px; line-height: 1.35; color: var(--ink); }
.t5-desc { margin-top: 6px; font-size: 13px; line-height: 1.6; color: var(--ink-2); overflow-wrap: anywhere; }
.t5-wait { font-size: 13px; color: var(--muted); }
/* 주제 카드: 블록은 카드 아래 가운데, 안은 왼쪽 정렬. 분당 채팅 높은 순.
   두 줄(이름 / 종류·분당·다시보기) + 바닥의 옅은 막대(그 카드 1위 대비). 약 35px */
.t5-topics {
  list-style: none; margin: 6px auto 0; padding: 0; width: 100%; max-width: 300px;
  display: flex; flex-direction: column; gap: 3px; text-align: left; font-size: 12px; color: var(--ink-2);
}
.tp-card {
  position: relative; display: flex; flex-direction: column; gap: 0;
  padding: 2px 8px 5px; border-radius: 7px; border: 1px solid var(--cell-border); background: var(--cell);
  color: inherit; text-decoration: none; overflow: hidden;
}
.tp-row1, .tp-row2 { display: flex; align-items: center; gap: 5px; min-width: 0; line-height: 13px; }
.tp-label { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.tp-val { white-space: nowrap; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tp-go { margin-left: auto; white-space: nowrap; font-size: 10px; color: var(--muted); }
.tp-bar { position: absolute; left: 8px; right: 8px; bottom: 2px; height: 2px; border-radius: 1px; }
.tp-bar span { display: block; height: 100%; border-radius: 1px; background: var(--meter-track); }
.t5-topics li.best .tp-card { border-color: var(--meter-fill); }
.t5-topics li.best .tp-label, .t5-topics li.best .tp-val { font-weight: 700; color: var(--ink); }
.t5-topics li.best .tp-bar span { background: var(--meter-fill); }
.tp-best, .tp-kind {
  flex: none; display: inline-block; padding: 0 5px; border-radius: 999px;
  font-size: 10px; font-weight: 700; line-height: 13px;
}
.tp-best { background: var(--meter-track); color: #8a3b2b; } /* 6.4:1 */
/* 종류 꼬리표: 글자가 뜻을 말하고 색은 보조(모두 5.6:1 이상) */
.kind-song  { background: #ffe0d6; color: #8a3b2b; }
.kind-talk  { background: #dcecfb; color: #2d5277; }
.kind-game  { background: #d9f2e6; color: #23593f; }
.kind-event { background: #fff0c2; color: #7a5a12; }
.kind-watch { background: #ece4fb; color: #5e4580; }

/* 주제 설명 말풍선 (주제 카드에 마우스를 올리거나 키보드로 갔을 때만) */
.tp-pop {
  position: fixed; left: 0; top: 0; z-index: 30; max-width: 260px;
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--cell-border); background: #fffdfa;
  box-shadow: 0 6px 20px rgba(75, 58, 50, 0.14); font-size: 12px; line-height: 1.5; color: var(--ink-2);
  pointer-events: none; text-align: left;
}
.tp-pop[hidden] { display: none; }
.tp-pop-h { display: block; margin-bottom: 2px; font-size: 12px; color: var(--ink); }

/* 2페이지 세로 가운데: 화면보다 짧으면 가운데, 길면 그냥 아래로 스크롤 */
.page.p2:not([hidden]) { min-height: calc(100vh - 6px); display: flex; flex-direction: column; justify-content: center; padding: 12px 0; }
