:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #16191f;
  --muted: #5d6573;
  --line: #dfe3e8;
  --accent: #1f5fbf;
  --accent-soft: #e6eefb;
  --hit: #d9480f;
  --hit-soft: #fff1e8;
  --warn-bg: #fff8e1;
  --warn-line: #f0c36d;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317;
    --surface: #1a1d23;
    --text: #e8eaee;
    --muted: #9aa3b2;
    --line: #2c313a;
    --accent: #6ea4ff;
    --accent-soft: #1d2a40;
    --hit: #ff8a4c;
    --hit-soft: #3a2418;
    --warn-bg: #2e2715;
    --warn-line: #7a6326;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}
.wrap { max-width: 920px; margin: 0 auto; padding: 0 16px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.top { background: var(--surface); border-bottom: 1px solid var(--line); padding: 20px 0 16px; }
.top h1 { margin: 0; font-size: 22px; }
.sub { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

.ask { display: flex; gap: 8px; margin-top: 20px; }
.ask input {
  flex: 1; min-width: 0;
  font: inherit; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--text);
}
.ask input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
button {
  font: inherit; font-weight: 600;
  padding: 10px 18px; border: 0; border-radius: 10px;
  background: var(--accent); color: #fff; cursor: pointer;
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.chips button {
  font-weight: 500; font-size: 13px; padding: 5px 10px;
  background: var(--accent-soft); color: var(--accent); border-radius: 999px;
}

.manual { margin-top: 14px; font-size: 14px; }
.manual summary { cursor: pointer; color: var(--muted); }
.manual-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-top: 10px; }
.manual-form label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); }
.manual-form select {
  font: inherit; padding: 6px 8px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
}

.result { margin-top: 22px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px; margin-bottom: 14px;
}
.card h2 { margin: 0 0 8px; font-size: 15px; color: var(--muted); font-weight: 600; }
.answer { font-size: 18px; font-weight: 600; margin: 0; }
.answer + .answer { margin-top: 6px; }
.detail { margin: 8px 0 0; color: var(--text); }
.note {
  margin-top: 12px; padding: 10px 12px; font-size: 14px;
  background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 10px;
}
.src { margin-top: 12px; font-size: 13px; color: var(--muted); }
.empty { color: var(--muted); }

.chart { width: 100%; }
.chart svg { display: block; width: 100%; height: auto; }
.chart text { fill: var(--muted); font-size: 11px; }
.chart .grid { stroke: var(--line); }
.chart .lineplot { stroke: var(--accent); stroke-width: 2; fill: none; }
.chart .dot { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.chart .dot.hit { fill: var(--hit); stroke: var(--hit); }
.chart .dot.live, .chart .bar.live { stroke-dasharray: 3 2; }
.chart .bar { fill: var(--accent); opacity: .75; }
.chart .bar.hit { fill: var(--hit); opacity: 1; }
.chart .bar.live { fill: none; stroke: var(--accent); stroke-width: 1.5; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 6px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: 14px; white-space: nowrap; }
th, td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: right; }
th { color: var(--muted); font-weight: 600; position: sticky; top: 0; background: var(--surface); }
th.l, td.l { text-align: left; }
tr.hit td { background: var(--hit-soft); }
.badge {
  display: inline-block; font-size: 11px; padding: 1px 6px; margin-left: 4px;
  border-radius: 6px; background: var(--accent-soft); color: var(--accent);
}

.needs h2 { color: var(--text); }
.needs ul { margin: 0; padding-left: 20px; }
.needs li { margin: 4px 0; font-weight: 600; }
.needs .hint { margin: 10px 0 0; font-size: 13px; color: var(--muted); }

.foot { margin: 30px 0 40px; font-size: 13px; color: var(--muted); }
.foot p { margin: 4px 0; }
.history { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); }
.history h2 { font-size: 14px; margin: 0 0 8px; color: var(--text); }
.history ol { list-style: none; margin: 0; padding: 0 0 0 16px; }
.history li { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.history .h-date { font-variant-numeric: tabular-nums; margin-right: 8px; color: var(--text); font-weight: 600; }
.history .h-what { color: var(--text); }
.history .h-sub, .history .h-by { display: block; margin-top: 2px; }
.history .h-by { color: var(--accent); overflow-wrap: anywhere; }
.history .h-by.none { color: var(--muted); }
.history details { margin-top: 6px; }
.history summary { cursor: pointer; padding: 4px 0; }
.history .h-cat { color: var(--text); font-weight: 600; }
.history .h-count { margin-left: 6px; }

@media (max-width: 560px) {
  .top h1 { font-size: 19px; }
  .answer { font-size: 16px; }
  .card { padding: 14px; }
  .ask button { padding: 10px 14px; }
}
