:root {
  --bg: #0d0d10;
  --card: #17171c;
  --card2: #1f1f26;
  --line: #2c2c35;
  --text: #eceef2;
  --muted: #9aa0ac;
  --accent: #4f7cff;
  --ok: #2fbf71;
  --warn: #f0a92e;
  --bad: #e5544b;
  --radius: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard",
    "Noto Sans KR", "Malgun Gothic", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; text-decoration: none; }

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px calc(14px);
  background: rgba(13, 13, 16, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; letter-spacing: -.02em; font-size: 17px; }

.tabs {
  display: flex;
  gap: 4px;
  padding: 10px 12px;
  overflow-x: auto;
  scrollbar-width: none;
  position: sticky;
  top: 53px;
  z-index: 19;
  background: rgba(13, 13, 16, .92);
  backdrop-filter: blur(10px);
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--card);
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
}
.tabs a.on { background: var(--accent); color: #fff; }
.badge {
  display: inline-block;
  margin-left: 6px;
  min-width: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--bad);
  color: #fff;
  font-size: 12px;
  text-align: center;
}

main { padding: 8px 12px 96px; max-width: 720px; margin: 0 auto; }

.banner {
  margin: 6px 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(240, 169, 46, .12);
  border: 1px solid rgba(240, 169, 46, .35);
  color: #f4c778;
  font-size: 13px;
}

.flash {
  margin: 6px 0 12px;
  padding: 11px 13px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
}
.flash.ok { background: rgba(47, 191, 113, .14); color: #7ee0a8; border: 1px solid rgba(47, 191, 113, .3); }
.flash.error { background: rgba(229, 84, 75, .14); color: #ff9b93; border: 1px solid rgba(229, 84, 75, .3); }

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

.card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--muted);
}

.chip {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--card2);
  color: var(--text);
}
.chip.post { background: rgba(79, 124, 255, .18); color: #a5bcff; }
.chip.reply { background: rgba(47, 191, 113, .16); color: #8ce0b3; }
.chip.pending { background: rgba(240, 169, 46, .16); color: #f0c179; }
.chip.approved { background: rgba(79, 124, 255, .18); color: #a5bcff; }
.chip.published { background: rgba(47, 191, 113, .18); color: #8ce0b3; }
.chip.rejected { background: var(--card2); color: var(--muted); }
.chip.expired { background: var(--card2); color: var(--muted); }
.chip.src-ref { background: rgba(139, 92, 246, .18); color: #c4b1ff; }
.chip.src-mix { background: rgba(139, 92, 246, .12); color: #b3a3e8; }
.chip.src-web { background: rgba(79, 124, 255, .12); color: #9db4ff; }

.doc {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.doc:last-child { border-bottom: 0; }
.doc-main { flex: 1 1 100%; min-width: 0; }
.doc-name { font-size: 14.5px; font-weight: 600; word-break: break-all; color: var(--muted); }
.doc.on .doc-name { color: var(--text); }
.doc form { flex: 0 0 auto; }

/* product photo per link (v0.11.0) */
.img-row { display: flex; gap: 10px; align-items: flex-start; margin-top: 8px; }
.thumb {
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  border-radius: 9px;
  object-fit: cover;
  background: var(--card2);
  border: 1px solid var(--line);
}
.thumb-empty { display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--muted); }
.img-side { flex: 1 1 auto; min-width: 0; }
.img-form { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.img-form input { flex: 1 1 100%; min-height: 36px; font-size: 13px; }
.img-form button { width: auto; min-height: 34px; padding: 0 10px; font-size: 12.5px; }
.img-manual { margin-top: 6px; }
.img-manual summary { cursor: pointer; font-size: 12.5px; color: var(--muted); }

.post-img {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  border-radius: 10px;
  background: var(--card2);
  border: 1px solid var(--line);
  margin: 0 0 12px;
}

input[type=file] {
  width: 100%;
  padding: 11px;
  border-radius: 10px;
  border: 1px dashed var(--line);
  background: var(--card2);
  color: var(--muted);
  font: inherit;
  font-size: 14px;
}
input[type=file]::file-selector-button {
  margin-right: 10px;
  padding: 7px 12px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: 13px;
}

.chip.age { background: transparent; border: 1px solid var(--line); color: var(--muted); font-weight: 600; }
.chip.age.old { border-color: rgba(240, 169, 46, .5); color: var(--warn); }
.chip.failed { background: rgba(229, 84, 75, .18); color: #ff9b93; }

.card.stale { border-color: rgba(240, 169, 46, .45); }
.stale-note {
  margin: 0 0 12px;
  padding: 9px 11px;
  border-radius: 9px;
  background: rgba(240, 169, 46, .1);
  color: #f0c179;
  font-size: 13px;
  line-height: 1.5;
}

.quote {
  border-left: 3px solid var(--line);
  padding: 6px 0 6px 10px;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}
.quote b { color: var(--text); }

.post-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 15.5px;
  margin: 0 0 12px;
}

.sources { margin: 0 0 12px; }
.sources summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  list-style: none;
}
.sources summary::-webkit-details-marker { display: none; }
.sources summary::before { content: "출처 "; }
.sources ul { margin: 8px 0 0; padding-left: 18px; }
.sources li { font-size: 13px; margin-bottom: 4px; }
.sources a { color: #9db4ff; word-break: break-all; }

textarea {
  width: 100%;
  min-height: 150px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card2);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  resize: vertical;
}
input[type=text], input[type=password], input[type=url], select {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card2);
  color: var(--text);
  font: inherit;
  font-size: 16px;
}

.counter { font-size: 12px; color: var(--muted); text-align: right; margin-top: 4px; }
.counter.over { color: var(--bad); font-weight: 700; }

.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > * { flex: 1 1 0; }

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 46px;
  padding: 0 16px;
  border: 0;
  border-radius: 11px;
  background: var(--card2);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  width: 100%;
}
button.primary { background: var(--accent); color: #fff; }
button.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
button.danger { background: rgba(229, 84, 75, .14); color: #ff9b93; }
button:active { transform: translateY(1px); }

form { margin: 0; }
form + form { margin-top: 8px; }

.empty {
  text-align: center;
  padding: 56px 16px;
  color: var(--muted);
}
.empty .big { font-size: 40px; margin-bottom: 8px; }

.meta { font-size: 12.5px; color: var(--muted); }
.meta a { color: #9db4ff; }

.kv { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--muted); flex: 0 0 auto; }
.kv span:last-child { min-width: 0; text-align: right; overflow-wrap: anywhere; }

label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }

.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.toggle span { font-size: 15px; }

a.logrow { display: block; }
a.logrow:active { transform: translateY(1px); }
pre.log { margin: 8px 0 0; max-height: 340px; overflow: auto; }
details > summary { margin-bottom: 4px; }

.log { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--muted); white-space: pre-wrap; word-break: break-all; }

.login-wrap { max-width: 380px; margin: 12vh auto 0; padding: 0 16px; }
.login-wrap h1 { font-size: 20px; margin: 0 0 6px; }
.login-wrap p { color: var(--muted); font-size: 14px; margin: 0 0 20px; }

/* photo file upload per link (v0.11.3) */
.img-upload { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 8px; }
.file-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  overflow: hidden;
}
.file-btn.strong { background: var(--accent); border-color: var(--accent); color: #fff; }
.file-btn input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 0; }
.img-upload .meta { flex: 1 1 100%; font-size: 12px; }

/* v0.13.0 /links: segmented tabs (쿠팡 / 알리, 한국 / 해외), best-seller list, delete-all */
.seg { display: flex; gap: 4px; padding: 4px; margin: 8px 0 10px; background: var(--card2); border-radius: 11px; }
.seg button { min-height: 36px; padding: 0 10px; background: transparent; color: var(--muted); font-size: 14px; border-radius: 8px; }
.seg button.on { background: var(--accent); color: #fff; }
.best-cat { padding: 8px 0; border-bottom: 1px solid var(--line); }
.best-cat:last-child { border-bottom: 0; }
.best-head { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.best-item { display: flex; gap: 8px; font-size: 13.5px; padding: 3px 0; overflow-wrap: anywhere; }
.best-item { align-items: center; }
.best-item .rank { flex: 0 0 22px; color: var(--accent); font-weight: 700; text-align: right; }
.best-thumb { flex: 0 0 44px; width: 44px; height: 44px; border-radius: 7px; object-fit: cover; background: var(--card2); border: 1px solid var(--line); font-size: 10px; text-align: center; }
.thumb-link { flex: 0 0 64px; display: block; line-height: 0; }
.danger-zone { margin: 0 0 12px; }
.confirm-box { margin-top: 10px; padding: 12px; border: 1px solid rgba(229, 84, 75, .5); border-radius: 11px; background: rgba(229, 84, 75, .06); font-size: 14px; }
button.danger.strong { background: var(--bad); color: #fff; }

/* v0.13.0 review style: the self-reply under the main post */
.link-reply { margin: 8px 0 4px 10px; padding: 8px 10px; border-left: 2px solid var(--line, #333); color: var(--muted); font-size: 13px; white-space: pre-wrap; word-break: break-all; }
.link-reply-head { font-size: 12px; margin-bottom: 4px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* v0.15.0 public policy pages */
.policy h1 { font-size: 20px; margin: 0 0 4px; }
.policy h2 { font-size: 15px; margin: 18px 0 6px; }
.policy p, .policy li { font-size: 14px; line-height: 1.6; }
.policy ul, .policy ol { padding-left: 20px; margin: 6px 0; }
.policy a { color: #9db4ff; }
.policy hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0 12px; }
