:root {
  --bg: #f6f6f4;
  --card: #ffffff;
  --text: #1d1d1f;
  --muted: #5f6368;
  --line: #d9d9d6;
  --accent: #1f6feb;
  --accent-text: #ffffff;
  --ok-bg: #e8f5ec;
  --ok-text: #1b5e33;
  --err-bg: #fdecec;
  --err-text: #8a1c1c;
  --bar: #1f6feb;
  --bar-dim: #c9d8f5;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121214;
    --card: #1c1c1f;
    --text: #ececef;
    --muted: #a3a3aa;
    --line: #34343a;
    --accent: #4c8dff;
    --ok-bg: #16301f;
    --ok-text: #9fe0b4;
    --err-bg: #3a1717;
    --err-text: #f4b0b0;
    --bar: #4c8dff;
    --bar-dim: #2a3a5a;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  line-height: 1.5;
  word-break: keep-all;
}

.wrap { max-width: 760px; margin: 0 auto; padding: 20px 16px 48px; }

.head h1 { margin: 0; font-size: 1.6rem; }
.sub { margin: 4px 0 12px; color: var(--muted); }
.privacy {
  display: inline-block;
  margin: 0;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--ok-bg);
  color: var(--ok-text);
  font-size: 0.9rem;
  font-weight: 600;
}

h2 { margin: 0 0 8px; font-size: 1.2rem; }
h3 { margin: 14px 0 8px; font-size: 1rem; }
.panel h3:first-child { margin-top: 0; }

.panel {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}

.hint { margin: 8px 0 0; color: var(--muted); }
.small { font-size: 0.85rem; }

.drop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 28px 16px;
  border: 2px dashed var(--line);
  border-radius: 14px;
  text-align: center;
  cursor: pointer;
}
.drop.over { border-color: var(--accent); }
.drop input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.drop-main {
  padding: 10px 22px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
}
.drop-sub { color: var(--muted); font-size: 0.85rem; }
.drop:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }

.progress { margin-top: 12px; }
.bar { height: 10px; border-radius: 999px; background: var(--bar-dim); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--bar); transition: width 0.2s; }

.error {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--err-bg);
  color: var(--err-text);
  font-weight: 600;
}

.how { margin-top: 12px; }
.how summary { cursor: pointer; font-weight: 600; }
.how ol { padding-left: 20px; }

.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-top: 8px; }
.field { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
select {
  min-width: 120px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font: inherit;
}
.switch { display: flex; align-items: center; gap: 8px; padding: 8px 0; font-weight: 600; cursor: pointer; }
.switch input { width: 20px; height: 20px; }

.btn {
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn:focus-visible, select:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 0; }
.totals div { padding: 10px 12px; border-radius: 10px; background: var(--bg); }
.totals dt { color: var(--muted); font-size: 0.85rem; }
.totals dd { margin: 2px 0 0; font-size: 1.15rem; font-weight: 800; }

.people { margin: 0; padding: 0; list-style: none; }
.people li { display: grid; grid-template-columns: minmax(70px, 30%) 1fr auto; gap: 10px; align-items: center; margin: 6px 0; }
.people .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.people .meter { height: 12px; border-radius: 999px; background: var(--bar-dim); overflow: hidden; }
.people .meter span { display: block; height: 100%; background: var(--bar); }
.people .n { color: var(--muted); font-size: 0.9rem; font-variant-numeric: tabular-nums; }

.awards { margin: 0; padding: 0; list-style: none; }
.awards li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.awards li:last-child { border-bottom: 0; }
.awards b { min-width: 64px; }
.awards .who { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.awards .n { color: var(--muted); font-variant-numeric: tabular-nums; }

.words { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.words li { padding: 6px 12px; border-radius: 999px; background: var(--bg); font-weight: 600; }
.words li span { margin-left: 6px; color: var(--muted); font-weight: 500; font-size: 0.85rem; }

.chart { display: flex; align-items: flex-end; gap: 3px; height: 110px; padding-bottom: 20px; position: relative; background: linear-gradient(var(--line), var(--line)) bottom 20px left / 100% 1px no-repeat; }
.chart.short { height: 90px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.chart .col i { display: block; width: 100%; border-radius: 4px 4px 0 0; background: var(--bar-dim); }
.chart .col.peak i { background: var(--bar); }
.chart .col small { position: absolute; bottom: 0; font-size: 0.7rem; color: var(--muted); }
.chart .col { position: relative; }
.chart .col small { transform: translateY(100%); }

.card { display: block; width: 100%; max-width: 420px; height: auto; margin: 0 auto; border-radius: 12px; }
.actions { justify-content: center; }

.ad { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); text-align: center; }
.ad-note { margin: 6px 0; color: var(--muted); font-size: 0.8rem; }
.ad-frame { display: block; width: 320px; max-width: 100%; height: 140px; margin: 8px auto; border: 0; }

.foot { margin-top: 20px; color: var(--muted); font-size: 0.85rem; text-align: center; }
.foot p { margin: 4px 0; }
.people li.more { display: block; color: var(--muted); font-size: 0.9rem; }
