/* 바닥가 — 쇼핑몰처럼 담백한 흰 바탕, 상품이 먼저 보이는 화면 */
:root {
  --ink: #16191f;      /* 글자 */
  --paper: #ffffff;
  --mist: #f4f6f9;     /* 옅은 바탕 */
  --line: #e3e7ed;
  --muted: #6a7280;
  --sale: #e5282c;     /* 할인 = 빨강 */
  --near: #2463eb;     /* 바닥 근처, 버튼 = 파랑 */
  --tag: #ffd60a;      /* 바닥가 노랑(로고, 판정) */
  --navy: #0e1b33;     /* 그래프의 바닥선 */
  --body: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.6;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 3px solid var(--near);
  outline-offset: 2px;
}
h1, h2 { font-weight: 700; line-height: 1.3; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 19px; }
p { margin: 0; }

.wrap { max-width: 1200px; margin-inline: auto; padding-inline: 16px; }
.block { margin-top: 40px; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.block > h2 { margin-bottom: 12px; }
.block-note { margin-top: 2px; font-size: 13px; color: var(--muted); }
.more { font-size: 13px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.more:hover { color: var(--ink); text-decoration: underline; }
.lead { color: var(--muted); max-width: 64ch; font-size: 15px; }
.stamp { white-space: nowrap; color: var(--ink); font-weight: 600; }
.empty { padding: 32px 0; color: var(--muted); }

/* ── 머리 ── */
.disclosure { background: var(--mist); color: var(--muted); font-size: 12px; line-height: 1.4; padding: 6px 16px; text-align: center; }
.top { border-bottom: 1px solid var(--line); }
.top-row { display: flex; align-items: center; gap: 14px; padding-block: 12px; }
.logo {
  font-weight: 800; font-size: 24px; line-height: 1.1; letter-spacing: -0.03em; text-decoration: none; flex: none;
  background: linear-gradient(var(--tag), var(--tag)) no-repeat 0 92% / 100% 38%;
  padding: 0 2px;
}
.search { display: flex; flex: 1; min-width: 0; max-width: 520px; margin-inline: auto; }
.search input {
  flex: 1; min-width: 0; height: 44px; padding: 0 16px; font: inherit; font-size: 16px;
  border: 1.5px solid var(--ink); border-right: 0; border-radius: 22px 0 0 22px; background: #fff; color: var(--ink);
}
.search button {
  height: 44px; padding: 0 18px 0 14px; font: inherit; font-weight: 700; cursor: pointer;
  border: 1.5px solid var(--ink); border-left: 0; border-radius: 0 22px 22px 0; background: var(--ink); color: #fff;
}
.nav { display: flex; gap: 20px; overflow-x: auto; padding-block: 10px; font-size: 14px; white-space: nowrap; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { text-decoration: none; color: var(--muted); }
.nav a:nth-child(-n+4) { color: var(--ink); font-weight: 700; }
.nav a:hover { color: var(--ink); text-decoration: underline; }

/* ── 홈 첫머리 ── */
.intro { margin-top: 28px; }
.intro h1 { font-size: 24px; }
.intro .lead { margin-top: 6px; }

/* ── 상품 카드 ── */
.card { display: flex; flex-direction: column; text-decoration: none; min-width: 0; }
.card-img { position: relative; display: block; aspect-ratio: 1; background: #fff; margin-bottom: 12px; }
.card-img img { width: 100%; height: 100%; object-fit: contain; }
.badge { position: absolute; left: 0; bottom: -8px; font-size: 12px; font-weight: 700; line-height: 1; padding: 5px 9px; border-radius: 11px; color: #fff; }
.b-floor { background: var(--sale); }
.b-near { background: var(--near); }
.b-top { background: var(--ink); }
.card-price { font-size: 19px; font-weight: 700; line-height: 1.35; letter-spacing: -0.01em; }
.card-off { font-size: 13px; line-height: 1.5; color: var(--sale); }
.card-off b { font-size: 15px; font-weight: 600; margin-right: 2px; }
.card-off.none { color: var(--muted); }
.card-name { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin-top: 4px; font-size: 14px; line-height: 1.4; color: #2b3038; }
.card:hover .card-name { text-decoration: underline; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 14px; }

/* ── 가로로 넘기는 상품 줄 ── */
.rail { position: relative; margin-top: 14px; }
.rail-track {
  display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none;
  margin-inline: -16px; padding: 0 16px 10px; scroll-padding-inline: 16px;
}
.rail-track::-webkit-scrollbar { display: none; }
.rail-track .card { flex: none; width: 42%; max-width: 190px; scroll-snap-align: start; }
.rail-btn { display: none; }

/* ── 순위·카테고리·설명 ── */
.how p { max-width: 64ch; margin-top: 10px; color: var(--muted); font-size: 15px; }
.how p:first-of-type { margin-top: 0; }

/* ── 목록 화면 ── */
.list-head { margin-top: 24px; }
.list-head h1 { font-size: 24px; }
.list-head .lead { margin-top: 6px; }
.list-head + .block { margin-top: 24px; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.crumbs a { color: var(--muted); }
.crumbs span { margin: 0 2px; }
.search-big { max-width: 560px; margin: 16px 0 12px; }

/* ── 상품 상세 ── */
.p-top { margin-top: 20px; }
.p-grid { display: grid; gap: 20px; }
.p-img { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; max-width: 420px; }
.p-img img { width: 100%; aspect-ratio: 1; object-fit: contain; }
.p-main h1 { font-weight: 600; font-size: 19px; line-height: 1.45; }
.p-rank { margin-top: 8px; font-size: 13px; font-weight: 600; }
.p-rank a { display: inline-block; text-decoration: none; background: var(--ink); color: #fff; padding: 3px 10px; border-radius: 11px; }
.p-price { font-weight: 800; font-size: 34px; line-height: 1.2; margin-top: 10px; letter-spacing: -0.02em; display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 2px; }
.p-price small { font-size: 22px; font-weight: 700; }
.chip { font-size: 12px; font-weight: 600; border: 1px solid var(--line); border-radius: 4px; padding: 2px 7px; margin-left: 8px; align-self: center; color: var(--muted); letter-spacing: 0; }
.verdict { margin-top: 14px; padding: 12px 14px; border-radius: 8px; background: var(--mist); font-size: 14px; color: #2b3038; }
.verdict b { display: block; font-weight: 800; font-size: 18px; line-height: 1.4; color: var(--ink); }
.verdict.v-floor { background: #fff6c2; }
.verdict.v-floor b { color: var(--sale); }
.verdict.v-near b { color: var(--near); }
.cta {
  display: flex; align-items: center; justify-content: center; min-height: 54px; margin-top: 16px; padding: 0 20px;
  background: var(--near); color: #fff; font-weight: 700; font-size: 17px; text-decoration: none; border-radius: 8px;
}
.cta:hover { background: #1a4fc4; }
.p-disclosure { margin-top: 10px; font-size: 13px; color: var(--muted); }
.p-stamp { margin-top: 4px; font-size: 13px; color: var(--muted); }
.notice { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--sale); border-radius: 8px; font-size: 14px; }
.caveat { margin-top: 12px; font-size: 13px; color: var(--muted); }

/* 살까 말까 게이지: 왼쪽 끝 = 추적 최저가, 오른쪽 끝 = 추적 최고가 */
.gauge { max-width: 640px; padding: 14px 14px 0; }
.gauge-ends { display: flex; justify-content: space-between; margin: 12px -14px 0; font-size: 14px; font-weight: 600; }
.meter { --pos: 0; position: relative; display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, #cfe0ff, #eceff3 50%, #ffd6d4); }
.meter i { position: absolute; top: 50%; left: calc(var(--pos) * 100%); width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; background: #fff; border: 4px solid var(--ink); }
.meter.on-floor i { background: var(--tag); }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 22px 0 0; border-top: 1px solid var(--ink); }
.stats div { padding: 12px 4px; border-bottom: 1px solid var(--line); }
.stats dt { font-size: 13px; color: var(--muted); }
.stats dd { margin: 0; font-size: 18px; font-weight: 700; }
.stats small { display: block; font-size: 13px; font-weight: 400; color: var(--muted); }

/* 그래프 기간 탭: 라디오 버튼으로 동작해서 스크립트가 필요 없다 */
.periods { display: flex; flex-wrap: wrap; gap: 6px; max-width: 640px; }
.periods input { position: absolute; opacity: 0; pointer-events: none; }
.periods label { font-size: 14px; padding: 5px 14px; border: 1px solid var(--line); border-radius: 16px; cursor: pointer; }
.periods label:hover { border-color: var(--ink); }
.periods input:checked + label { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }
.periods input:focus-visible + label { outline: 3px solid var(--near); outline-offset: 2px; }
.pane { display: none; flex-basis: 100%; margin-top: 8px; }
#pd-d30:checked ~ .pane-d30, #pd-d90:checked ~ .pane-d90, #pd-d365:checked ~ .pane-d365, #pd-all:checked ~ .pane-all { display: block; }
.chart { width: 100%; max-width: 640px; height: auto; display: block; color: var(--navy); }
.c-line { fill: none; stroke: var(--near); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.c-range { stroke: var(--line); stroke-width: 8; stroke-linecap: round; }
.c-dot { fill: #fff; stroke: var(--near); stroke-width: 3; }
.c-dot.c-low { fill: var(--tag); stroke: var(--navy); }
.c-floor { stroke: var(--navy); stroke-width: 3; }
.c-ground { opacity: 0.45; }
.c-hi { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 5 6; }
.c-x, .c-lab { font-family: var(--body); font-size: 20px; fill: var(--muted); }
.c-lab-floor { fill: var(--ink); font-weight: 700; }
.chart-empty { padding: 24px 0; color: var(--muted); }
.daily { margin-top: 14px; max-width: 640px; }
.daily summary { cursor: pointer; font-weight: 600; font-size: 14px; padding: 8px 0; }
.daily table { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 6px; }
.daily th, .daily td { text-align: right; padding: 8px 6px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.daily th:first-child, .daily td:first-child { text-align: left; }
.daily th { font-weight: 600; border-bottom: 1px solid var(--ink); }

.options { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.options a { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; font-weight: 600; font-size: 15px; }
.options a:hover { border-color: var(--ink); }
.options img { width: 40px; height: 40px; object-fit: contain; }
.options em { font-style: normal; background: var(--sale); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 9px; }

.faq { margin: 0; border-top: 1px solid var(--ink); max-width: 760px; }
.faq div { padding: 14px 0; border-bottom: 1px solid var(--line); }
.faq dt { font-weight: 600; }
.faq dd { margin: 6px 0 0; color: var(--muted); font-size: 15px; }

/* 휴대폰에서 화면 아래에 붙는 구매 버튼 */
.buybar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; transform: translateY(110%); transition: transform 0.2s; display: flex; align-items: center; gap: 12px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(22, 25, 31, 0.08); }
.buybar.show { transform: none; }
@media (prefers-reduced-motion: reduce) { .buybar { transition: none; } }
.buybar-price { font-weight: 700; font-size: 17px; line-height: 1.25; white-space: nowrap; }
.buybar-price small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
.buybar .cta { flex: 1; margin: 0; min-height: 48px; font-size: 16px; }
.pp .foot { padding-bottom: 84px; }

/* ── 글 화면 ── */
.prose { max-width: 760px; }
.prose h1 { font-size: 26px; margin-bottom: 16px; }
.prose h2 { margin: 30px 0 8px; font-size: 19px; }
.prose p, .prose li { color: #2b3038; font-size: 15px; }
.prose ul { padding-left: 20px; margin: 0; }
.prose li + li { margin-top: 6px; }

/* ── 바닥글 ── */
.foot { margin-top: 64px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); background: var(--mist); }
.foot .wrap { padding-block: 24px 40px; }
.foot p { max-width: 80ch; margin-top: 8px; }
.foot-logo { font-weight: 800; font-size: 17px; color: var(--ink); margin-top: 0; }

@media (min-width: 520px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rail-track .card { width: 30%; }
}
@media (min-width: 760px) {
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 40px 20px; }
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  h2 { font-size: 20px; }
  .intro h1, .list-head h1 { font-size: 28px; }
}
@media (min-width: 900px) {
  .p-grid { grid-template-columns: 420px minmax(0, 1fr); gap: 36px; align-items: start; }
  .p-main h1 { font-size: 22px; }
  .p-price { font-size: 40px; }
  .buybar { display: none; }
  .pp .foot { padding-bottom: 0; }
  .block { margin-top: 52px; }
  /* 넓은 화면: 한 줄에 6개, 좌우 버튼으로 넘긴다 */
  .rail-track { gap: 22px; margin-inline: 0; padding-inline: 0; scroll-padding-inline: 0; }
  .rail-track .card { width: calc((100% - 110px) / 6); max-width: none; }
  .rail-btn {
    display: block; position: absolute; z-index: 2; top: 0; width: 40px; height: 40px; margin-top: calc((100% - 110px) / 12 - 20px);
    border: 1px solid var(--line); border-radius: 50%; background: #fff; cursor: pointer;
    box-shadow: 0 2px 8px rgba(22, 25, 31, 0.14);
  }
  .rail-btn::before { content: ""; position: absolute; top: 50%; left: 50%; width: 10px; height: 10px; border-top: 2.5px solid var(--near); border-right: 2.5px solid var(--near); }
  .rail-btn.prev { left: -20px; }
  .rail-btn.prev::before { transform: translate(-30%, -50%) rotate(-135deg); }
  .rail-btn.next { right: -20px; }
  .rail-btn.next::before { transform: translate(-70%, -50%) rotate(45deg); }
  .rail-btn:disabled { display: none; }
}
@media (min-width: 1100px) {
  .grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 44px 22px; }
}
