/* 블카이브(blinkarea.synology.me)와 같은 톤: 흰 바탕 + 장미빛 핑크 + Pretendard */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --soft: #f4f5f7;
  --surface: #ffffff;
  --text: #1f1f1f;
  --text-2: #3a3a3c;
  --sub: #6b7280;
  --muted: #6b7280;
  --line: #e8e8ea;
  --line-2: #f0f0f2;
  --accent: #bf5580;
  --accent-ink: #a8436d;      /* 글자용 (대비 확보) */
  --accent-soft: #f9eef2;
  --on-accent: #ffffff;
  --mark: #bf5580;            /* 차트 막대 */
  --critical: #d03b3b; --on-critical: #ffffff;
  --warn-bg: #fff4d6; --warn-ink: #7a5200;
  --tag-bg: #f4f5f7; --tag-ink: #3a3a3c;
  --ok: #006300;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121214;
    --soft: #1f1f23;
    --surface: #18181b;
    --text: #ececee;
    --text-2: #d1d1d6;
    --sub: #9a9aa2;
    --muted: #9a9aa2;
    --line: #2a2a2e;
    --line-2: #232327;
    --accent: #e0559a;
    --accent-ink: #ff7ab8;
    --accent-soft: #2a1a22;
    --on-accent: #ffffff;
    --mark: #e0559a;
    --critical: #e66767; --on-critical: #111111;
    --warn-bg: #3a2c08; --warn-ink: #f5cf74;
    --tag-bg: #26262b; --tag-ink: #d1d1d6;
    --ok: #0ca30c;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; font-weight: 700; margin: 28px 0 14px; line-height: 1.35; letter-spacing: -0.3px; }
h2 { font-size: 17px; font-weight: 700; margin: 0 0 12px; letter-spacing: -0.2px; }
small { font-weight: 400; font-size: 13px; }
.muted { color: var(--muted); }
.error { color: var(--critical); }
.ok { color: var(--ok); font-weight: 600; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* ---- 상단: 블카이브와 같은 가운데 정렬 알약 메뉴 ---- */
.top { background: var(--surface); box-shadow: var(--shadow); position: relative; z-index: 2; }
.top-in { display: flex; flex-direction: column; align-items: center; padding: 14px 16px 12px; position: relative; }
.brand-sub { font-size: 13px; color: var(--muted); letter-spacing: 0.2px; margin-bottom: 8px; }
.brand-sub a { color: inherit; }
.top nav { display: flex; gap: 6px; flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.top nav::-webkit-scrollbar { display: none; }
.top nav a { white-space: nowrap; padding: 9px 18px; border-radius: 12px; color: var(--text); font-size: 17px; font-weight: 500; }
.top nav a:hover { text-decoration: none; background: var(--soft); }
.top nav a[aria-current] { color: var(--accent-ink); background: var(--accent-soft); font-weight: 700; }
.top nav a.home { color: var(--sub); font-weight: 500; }
.admin-link { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--sub); padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); }
.admin-link[aria-current], .admin-link.on { color: var(--accent-ink); border-color: var(--accent); }
.admin-link:hover { text-decoration: none; background: var(--soft); }
@media (max-width: 720px) {
  .top-in { padding: 10px 12px 8px; }
  .top nav { width: 100%; justify-content: flex-start; }
  .top nav a { padding: 7px 12px; font-size: 15px; }
  .admin-link { position: static; transform: none; margin-top: 6px; font-size: 12px; padding: 3px 9px; }
  .brand-sub { margin-bottom: 6px; }
}

/* ---- 필터 탭 ---- */
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin: 18px 0 16px; }
.filters a { padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--text-2); background: var(--surface); font-size: 14px; }
.filters a[aria-current] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600; }
.filters a:hover { text-decoration: none; border-color: var(--accent); }

/* ---- 숫자 타일 ---- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.tile-label { color: var(--sub); font-size: 14px; }
.tile-value { font-size: 30px; font-weight: 700; line-height: 1.25; margin-top: 2px; letter-spacing: -0.5px; }
.tile-sub { color: var(--muted); font-size: 12px; }

/* ---- 카드·차트 ---- */
.card, .chart { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 0 0 16px; }
.chart figcaption { font-weight: 700; font-size: 17px; margin-bottom: 14px; letter-spacing: -0.2px; }
.cap-sub { display: block; font-weight: 400; font-size: 12px; margin-top: 2px; color: var(--muted); letter-spacing: 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.two > * { min-width: 0; }
@media (max-width: 760px) { .two { grid-template-columns: 1fr; } }

.cols { position: relative; height: 170px; margin-left: 34px; }
.ygrid { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.ygrid span { border-top: 1px solid var(--line-2); position: relative; height: 0; }
.ygrid span:last-child { border-top-color: var(--line); }
.ygrid span::before { content: attr(data-v); position: absolute; right: calc(100% + 6px); top: -9px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bars { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: var(--gap, 2px); align-items: end; }
.chart { overflow: hidden; }
.col { height: 100%; display: flex; align-items: flex-end; justify-content: center; outline: none; cursor: default; }
.col .bar { width: min(24px, 100%); background: var(--mark); border-radius: 4px 4px 0 0; position: relative; }
.col.on .bar, .col:focus-visible .bar { filter: brightness(1.12); }
.col:focus-visible { box-shadow: inset 0 0 0 2px var(--sub); border-radius: 4px; }
.col-lab { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--text-2); padding-bottom: 2px; white-space: nowrap; }
.xlabels { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); margin: 4px 0 0 34px; color: var(--muted); text-align: center; }
.xlabels span { white-space: nowrap; font-size: 10.5px; overflow: visible; }

.hbars { display: grid; gap: 10px; }
.hrow { display: grid; grid-template-columns: minmax(96px, 38%) 1fr auto; align-items: center; gap: 10px; outline: none; }
.hrow:focus-visible { box-shadow: 0 0 0 2px var(--sub); border-radius: 4px; }
.hlabel { font-size: 14px; min-width: 0; }
.hlabel > * { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hlabel .sub { font-size: 12px; color: var(--muted); }
.htrack { height: 12px; }
.hbar { height: 100%; background: var(--mark); border-radius: 0 4px 4px 0; min-width: 2px; }
.hrow.on .hbar { filter: brightness(1.12); }
.hval { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; min-width: 2.5em; }
.hval small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; white-space: nowrap; }
@media (max-width: 560px) {
  .hrow { grid-template-columns: 1fr auto; grid-template-areas: "l v" "t t"; row-gap: 4px; }
  .hlabel { grid-area: l; } .hval { grid-area: v; } .htrack { grid-area: t; height: 10px; }
  .hval small { display: inline; margin-left: 6px; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
}

.tableview { margin-top: 12px; font-size: 13px; }
.tableview summary { cursor: pointer; color: var(--muted); }
table.grid { border-collapse: collapse; width: 100%; font-size: 13px; margin-top: 6px; }
table.grid th, table.grid td { border-bottom: 1px solid var(--line); padding: 7px 8px; text-align: left; font-variant-numeric: tabular-nums; }
table.grid th { color: var(--sub); font-weight: 600; }
.tip { position: absolute; z-index: 10; background: var(--text); color: var(--bg); font-size: 13px; font-weight: 600; padding: 5px 9px; border-radius: 8px; pointer-events: none; white-space: nowrap; }

/* 순위 */
ol.rank { margin: 0; padding: 0; list-style: none; counter-reset: r; }
ol.rank li { counter-increment: r; display: grid; grid-template-columns: 28px 1fr auto; grid-template-areas: "n t v" "n m v"; column-gap: 8px; padding: 11px 0; border-top: 1px solid var(--line-2); }
ol.rank li:first-child { border-top: 0; }
ol.rank li::before { content: counter(r); grid-area: n; color: var(--accent-ink); font-weight: 700; font-variant-numeric: tabular-nums; }
ol.rank li > a { grid-area: t; font-weight: 600; color: var(--text); }
.rank-meta { grid-area: m; font-size: 13px; color: var(--sub); }
.rank-val { grid-area: v; align-self: center; white-space: nowrap; }

/* ---- 검색 (블카이브 검색창과 같은 회색 알약) ---- */
.search { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.search input[type=search] { flex: 1 1 220px; }
input, select, textarea, button { font: inherit; color: inherit; }
input[type=search], input[type=password], input.secret, input[type=number], input[type=date], select, textarea {
  background-color: var(--soft); border: 1px solid transparent; border-radius: 12px; padding: 10px 14px; width: 100%;
}
input[type=search] { border-radius: 999px; padding-left: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%239ca3af' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 14px 50%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); background-color: var(--surface); }
.search select { width: auto; }
textarea { resize: vertical; line-height: 1.5; }
button { background: var(--accent); color: var(--on-accent); border: 0; border-radius: 999px; padding: 10px 18px; cursor: pointer; font-weight: 600; }
button:hover { filter: brightness(1.06); }
button.ghost { background: transparent; color: var(--text-2); border: 1px solid var(--line); }
.hint { color: var(--muted); font-size: 13px; margin: 4px 0 10px; }
.finder { margin-top: 22px; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.92em; background: var(--soft); padding: 1px 6px; border-radius: 6px; }
.howto { padding-left: 18px; color: var(--text-2); font-size: 14px; }
.howto li { margin: 5px 0; }
.notice { background: var(--accent-soft); color: var(--accent-ink); padding: 11px 16px; border-radius: 12px; font-size: 14px; }
.scroll { overflow-x: auto; }
table.writers .sub { display: block; font-size: 12px; color: var(--muted); }

/* ---- 글 목록: 블카이브 게시판처럼 줄로 구분 ---- */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list > .muted { padding: 18px; margin: 0; }
.item { padding: 18px 20px; border-top: 1px solid var(--line-2); }
.item:first-child { border-top: 0; }
.item-cat { font-size: 14px; color: var(--accent-ink); font-weight: 500; }
.item-cat span + span::before { content: " · "; color: var(--muted); }
.item-title { margin: 3px 0 0; font-size: 19px; font-weight: 500; line-height: 1.45; letter-spacing: -0.2px; }
.item-title a { color: var(--text); }
.item-title a::after { content: " ▾"; color: var(--muted); font-size: 12px; }
.item-title a[aria-expanded="true"]::after { content: " ▴"; }
.url { display: block; font-size: 13px; color: var(--accent-ink); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; word-break: break-all; margin-top: 2px; }
.meta { display: flex; flex-wrap: wrap; gap: 2px 0; font-size: 14px; color: var(--sub); margin-top: 6px; }
.meta > * + *::before { content: "·"; margin: 0 7px; color: var(--muted); }
.meta .down { font-weight: 700; color: var(--text-2); }
.writer { color: var(--text); font-weight: 600; }
.ip, .uid { font-weight: 400; color: var(--sub); }
.uid { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.92em; }
.carrier.vpn { color: var(--critical); font-weight: 600; }
.kind { font-size: 11px; font-weight: 600; border: 1px solid var(--line); border-radius: 6px; padding: 0 5px; color: var(--sub); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.badges:empty { display: none; }
.badge { font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--tag-bg); color: var(--tag-ink); }
.item-body { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 14px; }
.item-links { font-size: 13px; margin: 8px 0 0; }
.ai { font-size: 14px; margin: 0 0 10px; color: var(--text-2); }
.ai b { color: var(--accent-ink); }
.shot { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.noshot { padding: 16px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); font-size: 14px; text-align: center; margin-top: 8px; }
.bodytext { border: 1px solid var(--line); border-radius: 10px; background: var(--soft); padding: 12px 14px; }
.bodytext-label { margin: 0 0 6px; font-size: 12px; color: var(--muted); }
.bodytext-in { white-space: pre-wrap; word-break: break-word; font-size: 14px; line-height: 1.7; }
.bodytext .media { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
@media (max-width: 600px) {
  .item { padding: 16px; }
  .item-title { font-size: 17px; }
  .shotlink { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .shotlink .shot { max-width: none; width: 640px; }
}

/* 단어 칩 */
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { display: inline-flex; align-items: baseline; gap: 5px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--text); background: var(--surface); line-height: 1.4; }
.chip b { font-size: 12px; color: var(--sub); font-variant-numeric: tabular-nums; }
.chip:hover { text-decoration: none; border-color: var(--accent); }
.chip.l1 { font-size: 13px; }
.chip.l2 { font-size: 14px; background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.chip.l3 { font-size: 16px; background: color-mix(in srgb, var(--accent) 16%, var(--surface)); font-weight: 600; }
.chip.l4 { font-size: 18px; background: color-mix(in srgb, var(--accent) 26%, var(--surface)); font-weight: 700; }

/* ---- 상세 ---- */
.crumb { margin: 22px 0 0; font-size: 14px; }
.detail .item-cat { margin-top: 14px; }
.detail h1 { margin-top: 4px; }
.urlbox { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 12px 0; padding: 10px 14px; background: var(--soft); border-radius: 12px; }
.urlbox .url { flex: 1 1 260px; margin: 0; font-size: 14px; }
.urlbox button { padding: 7px 14px; font-size: 13px; }
table.kv { border-collapse: separate; border-spacing: 0; width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 16px; font-size: 14px; }
table.kv th { text-align: left; width: 140px; color: var(--sub); font-weight: 600; background: var(--soft); }
table.kv th, table.kv td { padding: 9px 14px; border-top: 1px solid var(--line); vertical-align: top; }
table.kv tr:first-child th, table.kv tr:first-child td { border-top: 0; }
@media (max-width: 520px) { table.kv th { width: 92px; } }
form.inline { margin: 12px 0; }
.detail h2 { margin-top: 26px; }

/* ---- 관리자 ---- */
.stack { display: grid; gap: 14px; }
.stack label { display: grid; gap: 5px; font-weight: 600; }
.stack label.check { display: flex; gap: 8px; align-items: center; }
.narrow { max-width: 360px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.row form { margin: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) { .row2 { grid-template-columns: 1fr; } }

.pager { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; margin: 22px 0; }
.pager a, .pager span { padding: 7px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; color: var(--text-2); }
.pager span[aria-current] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.pager a:hover { text-decoration: none; border-color: var(--accent); }

.foot { color: var(--muted); font-size: 12px; padding-top: 28px; padding-bottom: 44px; text-align: center; }
.foot p { margin: 4px 0; }
.topwords a { display: inline-block; font-size: 13px; padding: 1px 8px; margin: 1px 2px 1px 0; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); }
.topwords a:hover { text-decoration: none; filter: brightness(0.97); }
.two > .card { margin-bottom: 16px; }

/* 비밀번호·API 키 입력칸: 일반 입력칸이지만 화면에서는 점으로 가림 (브라우저 비밀번호 저장 창이 뜨지 않도록) */
.secret { -webkit-text-security: disc; text-security: disc; }

/* 블카이브 화면 안에 끼워 넣어 볼 때 (?embed=1): 사이트 이름 머리말 없이, 메뉴만 본문 맨 위(검색칸 위)에 */
.embed-nav { display: flex; justify-content: center; gap: 6px; padding-top: 14px; padding-bottom: 6px; overflow-x: auto; scrollbar-width: none; }
.embed-nav::-webkit-scrollbar { display: none; }
.embed-nav a { white-space: nowrap; padding: 9px 18px; border-radius: 12px; color: var(--text); font-size: 17px; font-weight: 500; }
.embed-nav a:hover { text-decoration: none; background: var(--soft); }
.embed-nav a[aria-current] { color: var(--accent-ink); background: var(--accent-soft); font-weight: 700; }
html.embed main.wrap { padding-top: 6px; }
html.embed .foot { padding-bottom: 24px; }
@media (max-width: 560px) { .embed-nav { justify-content: flex-start; } .embed-nav a { padding: 8px 12px; font-size: 16px; } }

/* 요주의 인물: 공통 탭 표 (폰에서는 옆으로 밀어서 봄) */
.table-wrap { overflow-x: auto; }
table.grid td.num, table.grid.poi-common th:not(:first-child) { text-align: right; }
table.grid.poi-common td:first-child { white-space: nowrap; }

/* 유해폐기물 → 소각대상: 제목만 보여 주는 목록 */
.burn-list { list-style: none; margin: 8px 0 0; padding: 0; }
.burn-list li { padding: 10px 2px; border-bottom: 1px solid var(--line); }
.burn-list li > a { font-weight: 600; }
.burn-list .muted { display: block; font-size: 13px; margin-top: 2px; }
/* 소각대상 IP 표: 대역 이름은 IP 아래 작은 글씨로 (길어서 옆에 두면 숫자 칸이 눌림) */
table.grid.burn-ips td { white-space: nowrap; }
table.grid.burn-ips td:first-child { white-space: normal; min-width: 8em; }
table.grid.burn-ips td:first-child small { display: block; font-size: 12px; line-height: 1.35; }
/* 통계 '최근 악플 떡밥': 설명·예시 글은 잘리지 않게 줄바꿈 */
.hlabel .sub.topic-sum, .hlabel .sub.topic-ex { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.45; }
