/* 꿀통몬 인사이트 v1 — 인스타·쓰레드 성과 대시보드
   Pretendard 자체 서브셋(로컬) + CDN 동적 서브셋(보조) + 시스템 폰트 순서로 한글을 선명하게. */

@font-face {
  font-family: "Pretendard Doosi";
  src: url("/assets/fonts/Pretendard-Doosi-Medium.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Pretendard Doosi";
  src: url("/assets/fonts/Pretendard-Doosi-Bold.woff2") format("woff2");
  font-weight: 700 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #f6f4ef;
  --card: #fffefb;
  --ink: #16130e;
  --ink-2: #3e3931;
  --muted: #7c766b;
  --muted-2: #9c968a;
  --line: #e7e2d6;
  --line-2: #f1ece1;
  --honey: #a9650a;
  --honey-soft: #fbefd8;
  --ig: #b8542c;
  --th: #2c4664;
  --good: #1c6b43;
  --good-soft: #e6f2ea;
  --bad: #9c2f1c;
  --bad-soft: #fbe9e4;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(22, 19, 14, .04), 0 10px 28px rgba(22, 19, 14, .05);
  --font: "Pretendard Doosi", "Pretendard Variable", -apple-system, BlinkMacSystemFont,
    "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 420px at 50% -240px, #fffaf0 0%, rgba(255, 250, 240, 0) 70%),
    var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 0;
}

h2, h3, h4 { margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
ol, ul { margin: 0; padding: 0; }
a { color: inherit; }

.skip {
  position: absolute; left: -9999px; top: 0; background: var(--ink); color: #fff;
  padding: 10px 14px; border-radius: 0 0 10px 0; z-index: 20;
}
.skip:focus { left: 0; }

/* ---------------------------------------------------------------- 상단 바 */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap;
  padding: 13px 28px;
  background: rgba(246, 244, 239, .86);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.mark {
  display: grid; place-items: center; width: 32px; height: 32px; flex: none;
  background: var(--honey-soft); color: var(--honey);
  border: 1px solid #f0dfbd; border-radius: 10px;
}
.brand-text b { display: block; font-size: 15.5px; font-weight: 700; letter-spacing: -0.02em; }
.brand-text small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 1px; }
.pilot {
  display: inline-block; margin-left: 5px; padding: 1px 6px; border-radius: 999px;
  background: #efe9dc; color: #6d6455; font-size: 10.5px; font-weight: 600;
  vertical-align: 1px;
}

.controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.field { display: flex; align-items: center; gap: 7px; }
.field-label { font-size: 11.5px; color: var(--muted); }
.select {
  appearance: none;
  font-family: inherit; font-size: 13px; font-weight: 600; color: var(--ink);
  padding: 7px 28px 7px 11px;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%237c766b' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 10px center;
  border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 1px 1px rgba(22, 19, 14, .03);
  cursor: pointer;
}
.select:focus-visible { outline: 2px solid var(--honey); outline-offset: 1px; }

.seg {
  display: inline-flex; gap: 2px; padding: 3px;
  background: #ece7db; border-radius: 999px;
}
.seg button {
  font-family: inherit; font-size: 13px; font-weight: 600; color: var(--ink-2);
  padding: 5px 13px; border: 0; border-radius: 999px; background: transparent;
  cursor: pointer; white-space: nowrap; transition: background .14s, color .14s, box-shadow .14s;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] {
  background: var(--card); color: var(--ink);
  box-shadow: 0 1px 2px rgba(22, 19, 14, .12);
}
.seg.small button { font-size: 12px; padding: 4px 10px; }

.fresh {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--ink-2);
  padding: 6px 11px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line);
}
.fresh .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--good); flex: none; }
.fresh.is-stale .dot { background: var(--honey); }

/* ---------------------------------------------------------------- 본문 */
main { max-width: 1180px; margin: 0 auto; padding: 22px 28px 48px; }

.notice[hidden] { display: none; }
.notice {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 16px; padding: 13px 16px;
  background: var(--bad-soft); border: 1px solid #f0cfc6; border-radius: 12px;
  color: var(--bad); font-size: 13px;
}
.notice button {
  margin-left: auto; font: inherit; font-weight: 600; color: var(--bad);
  background: #fff; border: 1px solid #edc8be; border-radius: 8px; padding: 5px 11px; cursor: pointer;
}

/* ① 오늘의 결론 */
.verdict {
  position: relative; overflow: hidden;
  background:
    radial-gradient(600px 200px at 88% -60px, rgba(169, 101, 10, .38), rgba(169, 101, 10, 0) 70%),
    #16130e;
  color: #f7f3e9;
  border-radius: 22px;
  padding: 24px 26px 6px;
  box-shadow: 0 16px 40px rgba(22, 19, 14, .16);
}
.verdict-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  flex-wrap: wrap; margin-bottom: 18px;
}
.verdict h2 { font-size: 15px; font-weight: 700; color: #f2e6cd; letter-spacing: .02em; }
.verdict-sub { color: #b8ae9b; font-size: 12.5px; margin-top: 5px; }
.verdict-note {
  font-size: 11.5px; color: #b8ae9b;
  padding: 5px 10px; border: 1px solid rgba(255, 255, 255, .14); border-radius: 999px;
}
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); }
.tile { padding: 2px 22px 22px 0; min-width: 0; }
.tile + .tile { padding-left: 22px; border-left: 1px solid rgba(255, 255, 255, .13); }
.tile-label {
  display: block; font-size: 11.5px; font-weight: 600; color: #cbb284;
  letter-spacing: .04em; margin-bottom: 9px;
}
.tile-main {
  display: block; font-size: 21px; line-height: 1.28; font-weight: 700;
  letter-spacing: -0.03em; color: #fffdf7;
  overflow-wrap: anywhere;
}
.tile-main .num { color: #f6c877; }

.tile-post-title {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; font-size: 16.5px; line-height: 1.4; letter-spacing: -0.02em;
}
.tile-sub { margin-top: 8px; font-size: 12.5px; line-height: 1.55; color: #b5ab98; }

/* ② KPI */
.kpis {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  margin-top: 16px;
}
.kpi {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 17px 18px 15px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; min-height: 142px;
}
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi-value {
  display: flex; align-items: baseline; gap: 4px;
  margin-top: 9px; font-size: 30px; font-weight: 700; letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums; line-height: 1.05;
}
.kpi-value .unit { font-size: 12.5px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.kpi-value.is-none { color: var(--muted-2); font-size: 22px; letter-spacing: -0.02em; }
.kpi-delta {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 7px;
  font-size: 12px; font-weight: 600;
}
.kpi-delta.up { color: var(--good); }
.kpi-delta.down { color: var(--bad); }
.kpi-delta.flat { color: var(--muted); }
.kpi-delta small { font-weight: 500; color: var(--muted); }
.kpi-foot {
  margin-top: auto; padding-top: 10px;
  border-top: 1px solid var(--line-2);
  font-size: 11.5px; line-height: 1.5; color: var(--muted);
}
.kpi-foot code { font-family: inherit; color: var(--ink-2); }

/* ③ 카드 공통 */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--shadow);
}
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  flex-wrap: wrap; margin-bottom: 16px;
}
.card-head h3 { font-size: 15px; font-weight: 700; }
.card-sub { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.card-sub.right { margin-top: 0; }
.card-note { font-size: 11.5px; color: var(--muted); margin-top: 12px; line-height: 1.6; }
.card-note b { color: var(--ink-2); }

.split {
  display: grid; grid-template-columns: minmax(0, 1.62fr) minmax(0, 1fr);
  gap: 14px; margin-top: 14px;
}
.split-notes {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px;
}
section.card { margin-top: 14px; }
.split > .card { margin-top: 0; }

/* 차트 */
.legend { display: flex; gap: 13px; flex-wrap: wrap; align-items: center; }
.key { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); }
.sw { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.sw.ig { background: var(--ig); }
.sw.th { background: var(--th); }
.sw.line { width: 12px; height: 0; border-top: 2px dashed var(--honey); border-radius: 0; }
.chart-wrap { position: relative; }
#chart { display: block; width: 100%; height: auto; overflow: visible; }
.tip {
  position: absolute; z-index: 3; pointer-events: none;
  transform: translate(-50%, calc(-100% - 10px));
  background: #16130e; color: #f7f3e9; border-radius: 10px;
  padding: 8px 11px; font-size: 11.5px; line-height: 1.55; white-space: nowrap;
  box-shadow: 0 10px 24px rgba(22, 19, 14, .24);
}
.tip b { color: #fff; font-weight: 700; }
.tip .t-row { display: flex; justify-content: space-between; gap: 14px; }
.tip .t-row span:first-child { color: #b5ab98; }
.chart-foot { font-size: 11.5px; color: var(--muted); margin-top: 10px; }

/* 시간대 바 */
.bars { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.bar-label { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.bar-label small { display: block; color: var(--muted-2); font-weight: 500; font-size: 10.5px; }
.track { height: 9px; border-radius: 999px; background: var(--line-2); overflow: hidden; }
.fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #d9b878, var(--honey)); }
.fill.weak { background: linear-gradient(90deg, #dcd6c8, #c3bcac); }
.bar-value { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 56px; text-align: right; }
.bar-value small { display: block; font-weight: 500; color: var(--muted); font-size: 10.5px; }

/* ④ 포맷 표 */
.ftable { display: grid; gap: 0; }
.fhead, .frow {
  display: grid; grid-template-columns: minmax(120px, 1.1fr) 46px minmax(90px, .8fr) minmax(120px, 1.2fr) 78px;
  gap: 12px; align-items: center;
}
.fhead {
  font-size: 11px; color: var(--muted-2); font-weight: 600; letter-spacing: .02em;
  padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.frow { padding: 11px 0; border-bottom: 1px solid var(--line-2); }
.frow.is-thin { opacity: .62; }
.frow.is-thin .fill { background: linear-gradient(90deg, #ded8cb, #c9c2b2); }
.frow.is-thin .fname::after {
  content: "표본 부족"; margin-left: 6px; font-size: 10px; font-weight: 600;
  color: var(--muted); background: #f2ede2; padding: 1px 5px; border-radius: 5px;
}
.frow:last-child { border-bottom: 0; }
.fname { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.fname .badge { font-size: 10.5px; font-weight: 600; color: var(--muted); background: #f2ede2; padding: 1px 6px; border-radius: 6px; }
.fnum { font-size: 13px; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.fnum.strong { font-weight: 700; color: var(--ink); }
.fbar { display: flex; align-items: center; gap: 8px; }
.fbar .track { flex: 1; }
.fbar span { font-size: 11.5px; font-weight: 600; color: var(--muted); min-width: 34px; text-align: right; }
.pill-best {
  font-size: 10.5px; font-weight: 700; color: #7a4a05; background: #fbeccd;
  border: 1px solid #f0dcb2; padding: 1px 7px; border-radius: 999px;
}

.next {
  margin-top: 18px; padding: 16px 18px;
  background: #fbf6ea; border: 1px dashed #e8d7b6; border-radius: 14px;
}
.next h4 { font-size: 12px; font-weight: 700; color: #7a4a05; letter-spacing: .02em; margin-bottom: 10px; }
#recs { list-style: none; counter-reset: rec; display: grid; gap: 11px; }
#recs li { counter-increment: rec; position: relative; padding-left: 26px; }
#recs li::before {
  content: counter(rec); position: absolute; left: 0; top: 1px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #efe0c0; color: #7a4a05;
  font-size: 10.5px; font-weight: 700; display: grid; place-items: center;
}
#recs b { display: block; font-size: 13px; margin-bottom: 3px; }
#recs p { font-size: 12.5px; color: var(--ink-2); line-height: 1.6; }
#recs .ev {
  display: inline-block; margin-top: 5px; font-size: 10.5px; color: #7a4a05;
  background: #f4e7cb; border-radius: 6px; padding: 1px 7px; font-variant-numeric: tabular-nums;
}

/* ⑤ 콘텐츠 행 */
.row-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rows { display: grid; }
.row {
  display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px;
  padding: 12px 4px; border-top: 1px solid var(--line-2);
  border-radius: 12px;
}
.row:first-child { border-top: 0; }
.row:hover { background: #fcfaf4; }
.row-main { display: flex; gap: 11px; min-width: 0; }
.thumb {
  width: 42px; height: 42px; flex: none; border-radius: 11px; overflow: hidden;
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
  background: var(--honey-soft); color: var(--honey); border: 1px solid #f0e3c9;
}
.thumb.threads { background: #e8edf3; color: var(--th); border-color: #dbe3ec; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.row-title { min-width: 0; }
.row-title a {
  display: block; font-size: 13.5px; font-weight: 600; line-height: 1.4;
  text-decoration: none; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row-title a:hover { text-decoration: underline; text-underline-offset: 2px; }
.row-meta { margin-top: 4px; font-size: 11.5px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tag {
  font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 6px;
  background: #f2ede2; color: var(--ink-2);
}
.tag.ig { background: #f8ece5; color: var(--ig); }
.tag.th { background: #e9eef4; color: var(--th); }
.row-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; align-content: center; }
.row-stats div { text-align: right; }
.row-stats span { display: block; font-size: 10.5px; color: var(--muted-2); }
.row-stats b { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.row-stats b.none { color: var(--muted-2); font-weight: 500; }
.chips { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 7px; }
.chip {
  font-size: 10.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  border: 1px solid transparent; white-space: nowrap;
}
.chip.good { color: var(--good); background: var(--good-soft); border-color: #cfe6d8; }
.chip.bad { color: var(--bad); background: var(--bad-soft); border-color: #f2d3ca; }
.chip.neutral { color: #6b6355; background: #f3eee3; border-color: #e8e0cf; }

/* ⑥ 방법·한계 */
.note-card h3 { font-size: 13.5px; font-weight: 700; margin-bottom: 11px; }
.bullets { list-style: none; display: grid; gap: 9px; }
.bullets li {
  position: relative; padding-left: 15px;
  font-size: 12.5px; line-height: 1.62; color: var(--ink-2);
}
.bullets li::before {
  content: ""; position: absolute; left: 0; top: 8px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--honey); opacity: .65;
}
.bullets.gaps li::before { background: #b9b2a4; }
.bullets code { font-family: inherit; font-size: 11.5px; color: var(--muted); }

footer {
  margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--muted);
}
footer code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: var(--ink-2); }

/* ---------------------------------------------------------------- 반응형 */
@media (max-width: 1080px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .split { grid-template-columns: 1fr; }
  .split-notes { grid-template-columns: 1fr; }
  .fhead, .frow { grid-template-columns: minmax(110px, 1.2fr) 40px minmax(80px, .8fr) minmax(110px, 1.1fr) 66px; }
}

@media (max-width: 760px) {
  .topbar { padding: 10px 16px; gap: 10px; }
  main { padding: 16px 16px 40px; }
  .controls {
    width: 100%; gap: 8px; flex-wrap: nowrap;
    overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 3px;
    scrollbar-width: none;
  }
  .controls::-webkit-scrollbar { display: none; }
  .controls > * { flex: none; }
  .field-label { display: none; }
  .seg button { padding: 5px 11px; }
  .fresh { order: -1; }
  .tiles { grid-template-columns: 1fr; }
  .tile { padding: 0 0 16px; }
  .tile + .tile { padding: 16px 0 16px; border-left: 0; border-top: 1px solid rgba(255, 255, 255, .13); }
  .verdict { padding: 18px 18px 2px; border-radius: 18px; }
  .tile-main { font-size: 19px; }
  .kpi { min-height: 0; padding: 14px 15px 13px; }
  .kpi-value { font-size: 25px; }
  .card { padding: 16px; border-radius: 16px; }
  .row { grid-template-columns: 1fr; gap: 8px; padding: 11px 2px; }
  .row-stats { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .row-stats div { text-align: left; }
  .row-stats span { font-size: 10px; }
  .row-stats b { font-size: 12.5px; }
  .thumb { width: 36px; height: 36px; border-radius: 9px; font-size: 10px; }
  .fhead { display: none; }
  .frow {
    grid-template-columns: 1fr auto; grid-template-areas: "name n" "bar bar" "meta meta";
    gap: 6px 10px; padding: 12px 0;
  }
  .frow .fname { grid-area: name; }
  .frow .fnum:nth-child(2) { grid-area: n; text-align: right; font-size: 12.5px; color: var(--muted); }
  .frow .fnum:nth-child(2)::after { content: "건"; margin-left: 2px; }
  .frow .fbar { grid-area: bar; }
  .frow .fnum:nth-child(3) { grid-area: meta; font-size: 11.5px; color: var(--muted); }
  .frow .fnum:nth-child(3)::before { content: "중앙 조회 "; }
  .frow .fnum:nth-child(5) { display: none; }
  footer { flex-direction: column; gap: 6px; }
}

@media (max-width: 420px) {
  .brand-text small { font-size: 10.5px; }
  .kpi-value { font-size: 23px; }
  .row-stats b { font-size: 12px; }
}

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

:focus-visible { outline: 2px solid var(--honey); outline-offset: 2px; border-radius: 6px; }
