:root {
  --bg: #f7f5f2;
  --card: #ffffff;
  --ink: #1c1b20;
  --muted: #6b6873;
  --line: #e6e2dc;
  --accent: #d6336c;
  --accent-ink: #ffffff;
  --accent-soft: #fdecf2;
  --ok: #2f9e6e;
  --ok-soft: #e6f6ee;
  --shadow: 0 1px 2px rgba(20, 15, 30, .05), 0 4px 16px rgba(20, 15, 30, .04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16151a;
    --card: #1f1e24;
    --ink: #eeecf2;
    --muted: #a19eaa;
    --line: #2f2d36;
    --accent: #f0609a;
    --accent-ink: #1a0b12;
    --accent-soft: #3a1a28;
    --ok: #4cc28f;
    --ok-soft: #173126;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #16151a; --card: #1f1e24; --ink: #eeecf2; --muted: #a19eaa; --line: #2f2d36;
  --accent: #f0609a; --accent-ink: #1a0b12; --accent-soft: #3a1a28; --ok: #4cc28f; --ok-soft: #173126;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Malgun Gothic", "Segoe UI", sans-serif;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
[hidden] { display: none !important; }
a { color: inherit; }
.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); font-weight: 400; }

/* 상단 */
.top {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; padding-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 10px; }
.logo {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); font-size: 20px; font-weight: 700;
}
h1 { font-size: 18px; margin: 0; letter-spacing: -.01em; }
.sub { margin: 0; font-size: 13px; color: var(--muted); }
h2 { font-size: 16px; margin: 0 0 10px; }

main { padding-top: 20px; padding-bottom: 24px; }

/* 버튼 */
.btn, .ghost {
  font: inherit; cursor: pointer; border-radius: 10px; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  min-height: 40px; padding: 0 14px; white-space: nowrap;
}
.btn { border: 1px solid var(--line); background: var(--card); color: var(--ink); font-weight: 600; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.ghost { border: 1px solid var(--line); background: transparent; color: var(--muted); }
.small { min-height: 34px; padding: 0 11px; font-size: 13px; }
.danger { color: #c0392b; }
.btn:focus-visible, .ghost:focus-visible, .drop:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* 파일 넣기 */
.drop {
  border: 2px dashed var(--line); border-radius: 18px; background: var(--card);
  padding: 32px 16px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s;
  box-shadow: var(--shadow);
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop.busy { opacity: .7; pointer-events: none; }
.drop-icon { font-size: 34px; }
.drop-title { font-weight: 700; font-size: 16px; margin: 6px 0 2px; }
.drop-sub { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.err {
  margin: 12px 0 0; padding: 12px 14px; border-radius: 12px;
  background: var(--accent-soft); color: var(--ink); font-size: 14px;
}

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px 18px; margin-top: 14px; box-shadow: var(--shadow);
}
.card ol, .card ul { margin: 0; padding-left: 20px; }
.card li { margin: 4px 0; }
.note { font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.tip p { margin: 4px 0; font-size: 13px; color: var(--muted); }
.tip b { color: var(--ink); }

/* 결과 */
.meta { margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 10px 8px; text-align: center; box-shadow: var(--shadow);
}
.stat b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }
.stat.hot b { color: var(--accent); }

.tabs {
  display: flex; gap: 4px; margin-top: 16px; padding: 4px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
}
.tabs button {
  flex: 1; font: inherit; font-size: 14px; border: 0; background: transparent; color: var(--muted);
  border-radius: 9px; min-height: 40px; cursor: pointer; padding: 0 6px;
}
.tabs button[aria-selected="true"] { background: var(--accent-soft); color: var(--ink); font-weight: 700; }
.tabs .n { display: block; font-size: 12px; line-height: 1.2; font-variant-numeric: tabular-nums; opacity: .8; }
.tabs button { line-height: 1.25; padding-top: 6px; padding-bottom: 6px; }
.tab-help { font-size: 13px; color: var(--muted); margin: 10px 2px; }

.tools { display: flex; gap: 8px; }
.tools input, .tools select {
  font: inherit; font-size: 15px; min-height: 42px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: 0 12px;
}
.tools input { flex: 1; min-width: 0; }
.tools select { flex: 0 0 auto; max-width: 46%; }
.tools2 { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 2px 0; font-size: 14px; }
.chk { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--muted); }
.chk input { width: 17px; height: 17px; accent-color: var(--accent); }

.progress { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 13px; color: var(--muted); }
.bar { flex: 1; height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--ok); border-radius: inherit; transition: width .3s; }
.next { width: 100%; margin-top: 12px; }

.list { list-style: none; padding: 0; margin: 12px 0 0; }
.item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 6px;
}
.item.flash { animation: flash 1.4s ease-out; }
@keyframes flash { from { box-shadow: 0 0 0 3px var(--accent); } to { box-shadow: 0 0 0 3px transparent; } }
.item.done { opacity: .55; }
.av {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: 15px; color: #fff;
  background: hsl(var(--h, 330) 55% 55%);
}
.info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.name { font-weight: 600; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.name:hover { text-decoration: underline; }
.item.seen .name { color: var(--muted); }
.when { font-size: 12px; color: var(--muted); min-height: 1em; }
.acts { display: flex; gap: 6px; flex: 0 0 auto; }
.toggle[aria-pressed="true"] { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.icon { min-width: 34px; padding: 0; font-size: 16px; color: var(--muted); }
.icon[aria-pressed="true"] { color: #e0a800; }
.empty { text-align: center; color: var(--muted); padding: 28px 0; }
.more { width: 100%; margin-top: 6px; }
.foot-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 18px; }

.foot { color: var(--muted); font-size: 12px; text-align: center; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 20;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px;
  max-width: calc(100% - 32px); transition: opacity .2s, transform .2s;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 520px) {
  .stats { gap: 6px; }
  .stat { padding: 8px 4px; }
  .stat b { font-size: 17px; }
  .stat span { font-size: 11px; }
  .tabs button { font-size: 13px; }
  .item { padding: 10px; gap: 10px; flex-wrap: wrap; }
  .info { flex-basis: calc(100% - 48px); }
  .acts { width: 100%; padding-left: 48px; }
  .acts .btn:not(.icon) { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
