:root {
  --bg: #0f1419;
  --panel: #1a222c;
  --text: #e7ecf1;
  --muted: #8b9aab;
  --accent: #3d9bfd;
  --line: #2a3542;
  --err: #ff6b6b;
  font-family: "Pretendard", "Noto Sans KR", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(1200px 600px at 10% -10%, #1c2a3a, var(--bg));
  color: var(--text);
  min-height: 100vh;
}
.top {
  padding: 2rem 1.25rem 0.5rem;
  max-width: 960px;
  margin: 0 auto;
}
.top h1 { margin: 0.2rem 0; font-size: 1.75rem; letter-spacing: -0.02em; }
.sub, .muted, .crumb { color: var(--muted); }
.crumb a { color: var(--accent); text-decoration: none; }
.freshness {
  margin: 0.45rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}
.freshness time {
  color: var(--text);
  cursor: help;
  border-bottom: 1px dotted var(--line);
}
.reltime time {
  cursor: help;
  border-bottom: 1px dotted var(--line);
  white-space: nowrap;
}
tr.stale td,
.freshness.stale,
.stats .stale {
  opacity: 0.45;
}
.wrap { max-width: 960px; margin: 0 auto; padding: 1rem 1.25rem 3rem; }

.search {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.25rem;
}
.search label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.85rem; color: var(--muted); }
.search .grow { flex: 1 1 220px; }
select, input[type="search"] {
  background: #0c1117;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  font-size: 1rem;
}
button {
  background: var(--accent);
  color: #041018;
  border: 0;
  border-radius: 8px;
  padding: 0.65rem 1.1rem;
  font-weight: 700;
  cursor: pointer;
}
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
}
th, td { padding: 0.75rem 0.9rem; text-align: left; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 0.85rem; }
th.sort-active { color: var(--text); }
th .sort-link {
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}
th .sort-link:hover { color: var(--accent); }
td.price-low-sample,
.stats .price-low-sample strong {
  opacity: 0.45;
}
.sample-note {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 600;
  color: var(--muted);
  opacity: 1;
  letter-spacing: -0.01em;
}
.stats .sample-note {
  margin-top: 0.35rem;
}
tr:last-child td { border-bottom: 0; }
a { color: var(--text); text-decoration: none; }
a:hover { color: var(--accent); }
.id { color: var(--muted); font-size: 0.8rem; margin-left: 0.4rem; }
.err { color: var(--err); }
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.stats div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem 1rem;
}
.stats span { display: block; color: var(--muted); font-size: 0.8rem; margin-bottom: 0.35rem; }
.stats strong { font-size: 1.15rem; }
h2 { font-size: 1.05rem; margin: 1.5rem 0 0.75rem; }

.history {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.1rem 1.15rem;
  margin: 1.25rem 0;
}
.history-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}
.history-head h2 { margin: 0; }
.history-controls { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.seg {
  display: inline-flex;
  background: #0c1117;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
}
.seg button {
  background: transparent;
  color: var(--muted);
  border: 0;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}
.seg button.active {
  background: var(--accent);
  color: #041018;
}
.history-note { margin: 0.35rem 0 0.75rem; font-size: 0.85rem; }
.history-collecting {
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.8rem;
  border-radius: 8px;
  background: #243040;
  color: #d7e2ee;
  font-size: 0.9rem;
}
.hidden { display: none !important; }
.chart-wrap {
  position: relative;
  height: 320px;
  width: 100%;
}

.popular {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem 1.1rem 1rem;
  margin-bottom: 1.25rem;
}
.popular h2 { margin: 0 0 0.6rem; }
.popular ol {
  margin: 0;
  padding-left: 1.25rem;
  display: grid;
  gap: 0.35rem;
}
.popular li {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
}
.popular li .muted { margin-left: auto; }
