:root {
  --bg: #f3f5f8;
  --panel: #ffffff;
  --panel2: #f7f9fc;
  --line: #e3e8ef;
  --text: #1a2332;
  --muted: #7a8699;
  --accent: #2f80ed;
  --hot: #e11d48;
  --gold: #f59e0b;
  --ok: #16a34a;
  --pink: #ec4899;
  --teal: #14b8a6;
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
  --rank1: #f59e0b;
  --rank2: #ec4899;
  --rank3: #14b8a6;
  --rankn: #fb923c;
}

html[data-theme="dark"] {
  --bg: #0b0f14;
  --panel: #121820;
  --panel2: #1a2230;
  --line: #2a3548;
  --text: #f3f5f8;
  --muted: #8b97a8;
  --accent: #3b9eff;
  --hot: #ff3b5c;
  --gold: #ffc107;
  --ok: #22c55e;
  --pink: #f472b6;
  --teal: #2dd4bf;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  --rank1: #f59e0b;
  --rank2: #ec4899;
  --rank3: #14b8a6;
  --rankn: #fb923c;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Noto Sans KR", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  min-height: 100vh;
  transition: background .2s, color .2s;
}
a { color: inherit; text-decoration: none; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 14px 40px; }

.topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
  position: sticky; top: 0; z-index: 40;
  box-shadow: var(--shadow);
}
.top-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 14px;
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between;
}
.logo { font-size: 1.4rem; font-weight: 900; color: var(--accent); letter-spacing: -0.03em; }
.logo span { color: var(--hot); }
.top-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
  flex: 1 1 320px;
  min-width: 0;
  justify-content: flex-end;
}
.search-engines { display: flex; flex-wrap: wrap; gap: 6px; }
.search-engines a {
  font-size: .72rem; font-weight: 700; padding: 6px 10px; border-radius: 8px;
  background: var(--panel2); border: 1px solid var(--line); color: var(--muted);
}
.search-engines a:hover { color: var(--text); border-color: var(--accent); }
.search-box {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 220px;
  max-width: 420px;
}
.search-box select, .search-box input, .field input, .field select, .field textarea {
  background: var(--panel2); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 8px 10px; font-family: inherit; font-size: .8125rem;
}
.search-box select { width: 84px; flex: 0 0 auto; }
.search-box input { flex: 1 1 auto; min-width: 0; }
.search-box .btn {
  flex: 0 0 auto;
  white-space: nowrap;
  min-width: 64px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel2); color: var(--text); font-weight: 700; font-size: .8125rem;
  cursor: pointer; font-family: inherit;
}
.btn:hover { filter: brightness(1.05); }
.btn-primary { background: var(--accent); color: #fff; border-color: transparent; }
.btn-danger { background: var(--hot); color: #fff; border-color: transparent; }
.theme-toggle {
  width: 40px; height: 36px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel2); cursor: pointer; font-size: 1rem;
}

.ticker {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  margin: 14px 0; padding: 10px 14px; display: flex; gap: 12px; align-items: center;
  overflow: hidden; box-shadow: var(--shadow);
}
.ticker-badge {
  flex-shrink: 0; background: var(--hot); color: #fff; font-size: .6875rem;
  font-weight: 800; padding: 4px 8px; border-radius: 999px;
}
.ticker-track { overflow: hidden; white-space: nowrap; flex: 1; }
.ticker-track p {
  display: inline-block; animation: slide 22s linear infinite;
  color: var(--gold); font-weight: 700; font-size: .875rem;
}
@keyframes slide {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
.hub-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin: 0 0 14px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--panel2);
  border: 1px solid var(--line);
  font-size: 0.82rem;
  color: var(--muted);
}
.hub-stats b { color: var(--text); font-weight: 800; }
.hub-stats-sep { opacity: 0.5; }
.trust-bar {
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 88%, #1a7f4c 12%);
  color: var(--text);
  font-size: .8125rem;
  line-height: 1.45;
}
.trust-bar b { color: var(--gold); }
.rank-list li.is-dead { opacity: .55; }
.rank-list li.is-dead .rank-name { text-decoration: line-through; }
.dead-tag {
  margin-left: 6px;
  font-size: .65rem;
  font-weight: 700;
  color: #c45c26;
  border: 1px solid #c45c26;
  border-radius: 4px;
  padding: 1px 5px;
  vertical-align: middle;
}

/* home category grid */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.cat-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
.cat-box-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-bottom: 1px solid var(--line);
  cursor: pointer; user-select: none;
  background: var(--panel2);
  text-decoration: none;
  color: inherit;
}
.cat-box-head:hover { background: color-mix(in srgb, var(--accent) 8%, var(--panel2)); }
.cat-box-head .ico { font-size: 1.05rem; line-height: 1; }
.cat-logo {
  width: 26px; height: 26px; border-radius: 8px; object-fit: cover; flex-shrink: 0;
  display: block;
  box-shadow: 0 0 0 1px rgba(255,255,255,.14), 0 2px 10px rgba(0,0,0,.4);
}
.cat-box-head h2 { flex: 1; font-size: .9rem; font-weight: 800; }
.cat-box-head .plus {
  width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--line);
  display: grid; place-items: center; font-weight: 900; color: var(--muted);
  background: var(--panel); font-size: .9rem;
}
.rank-list { list-style: none; padding: 6px 8px 10px; }
.rank-list li {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 4px; border-radius: 8px;
}
.rank-list li:hover { background: var(--panel2); }
.rank-list a {
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0;
  font-size: .8125rem; font-weight: 600;
}
.rank-list a.hot { color: var(--hot); }
.rank-list a.tone2 { color: var(--accent); }
.rank-list a.tone3 { color: var(--teal); }
.rank-img {
  width: 22px; height: 22px; flex-shrink: 0;
  object-fit: contain; display: block;
}
.rank-num {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; color: #fff; font-size: .68rem; font-weight: 800;
  background: var(--rankn);
}
.rank-num.r1 {
  background: linear-gradient(135deg, #ffe08a, #f59e0b 45%, #b45309);
  box-shadow: 0 0 0 2px rgba(245,158,11,.35), 0 0 14px rgba(245,158,11,.75);
  transform: scale(1.08);
}
.rank-num.r2 {
  background: linear-gradient(135deg, #fda4d0, #ec4899 45%, #9d174d);
  box-shadow: 0 0 0 2px rgba(236,72,153,.35), 0 0 14px rgba(236,72,153,.7);
  transform: scale(1.06);
}
.rank-num.r3 {
  background: linear-gradient(135deg, #99f6e4, #14b8a6 45%, #0f766e);
  box-shadow: 0 0 0 2px rgba(20,184,166,.35), 0 0 14px rgba(20,184,166,.65);
  transform: scale(1.04);
}
.rank-list li.top-rank {
  background: linear-gradient(90deg, color-mix(in srgb, var(--gold) 10%, transparent), transparent);
  border-radius: 8px;
}
.rank-list li.top-rank.r2-row {
  background: linear-gradient(90deg, color-mix(in srgb, var(--pink) 10%, transparent), transparent);
}
.rank-list li.top-rank.r3-row {
  background: linear-gradient(90deg, color-mix(in srgb, var(--teal) 10%, transparent), transparent);
}
.rank-list a.hot { color: var(--hot); text-shadow: 0 0 12px rgba(255,59,92,.25); }
.link-tile.top-shine {
  border-color: color-mix(in srgb, var(--gold) 50%, var(--line));
  box-shadow: 0 0 0 1px rgba(245,158,11,.2), 0 8px 24px rgba(245,158,11,.12);
}
.link-tile.top-shine.s2 {
  border-color: color-mix(in srgb, var(--pink) 45%, var(--line));
  box-shadow: 0 0 0 1px rgba(236,72,153,.2), 0 8px 24px rgba(236,72,153,.12);
}
.link-tile.top-shine.s3 {
  border-color: color-mix(in srgb, var(--teal) 45%, var(--line));
  box-shadow: 0 0 0 1px rgba(20,184,166,.2), 0 8px 24px rgba(20,184,166,.12);
}
.link-tile-plain {
  padding: 10px 12px;
}
.link-tile-plain .link-tile-title {
  display: flex; align-items: center; gap: 8px;
}
.link-tile-plain .link-tile-title .rank-img {
  width: 20px; height: 20px;
}

.seo-block {
  margin: 22px 0 10px; padding: 22px 18px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow);
}
.seo-block h2 { font-size: 1.15rem; margin-bottom: 10px; }
.seo-block h3 { font-size: .98rem; margin: 18px 0 8px; }
.seo-block h4 { font-size: .88rem; margin: 12px 0 4px; color: var(--accent); }
.seo-block p, .seo-block li { color: var(--muted); font-size: .875rem; line-height: 1.7; }
.seo-block ul { padding-left: 18px; margin-bottom: 8px; }
.seo-keywords { font-size: .78rem !important; opacity: .9; }
.seo-note { margin-top: 12px; font-size: .75rem !important; }
.rank-favicon {
  width: 18px; height: 18px; border-radius: 4px; flex-shrink: 0;
  background: var(--panel2); border: 1px solid var(--line);
  display: grid; place-items: center; font-size: .55rem; font-weight: 800; color: var(--muted);
  overflow: hidden;
}
.rank-favicon img { width: 100%; height: 100%; object-fit: cover; }
.rank-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.banner-cta {
  display: block; margin: 14px 0; padding: 14px 16px; border-radius: 12px;
  background: linear-gradient(90deg, var(--accent), #56ccf2);
  color: #fff; font-weight: 800; text-align: center; font-size: .95rem;
  box-shadow: var(--shadow);
}
.banner-cta:hover { filter: brightness(1.05); }

footer {
  margin-top: 20px; padding: 20px 12px; text-align: center;
  border-top: 1px solid var(--line); color: var(--muted); font-size: .75rem;
}
footer .cs {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 10px;
  background: #229ed9; color: #fff; font-weight: 800; padding: 10px 16px; border-radius: 10px;
}

/* modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, .55);
  display: none; align-items: flex-start; justify-content: center;
  padding: 40px 12px; overflow-y: auto;
}
.modal-backdrop.open { display: flex; }
.modal {
  width: min(1100px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,.35);
  margin-bottom: 40px;
}
.modal-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 2px solid var(--pink);
}
.modal-head .ico { font-size: 1.3rem; display: inline-flex; align-items: center; }
.modal-head h2 { flex: 1; font-size: 1.05rem; font-weight: 900; }
.modal-meta {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; color: var(--muted); font-size: .8125rem; font-weight: 600;
  border-bottom: 1px solid var(--line);
}
.modal-close {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel2); cursor: pointer; font-size: 1.1rem; color: var(--text);
}
.modal-body { padding: 16px; }
.link-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}
.link-tile {
  display: block; border-radius: 12px; overflow: hidden;
  background: var(--panel2); border: 1px solid var(--line);
  transition: .15s ease;
}
.link-tile:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow); }
.link-thumb {
  aspect-ratio: 16 / 9; background: linear-gradient(135deg, #334155, #1e293b);
  display: grid; place-items: center; color: #fff; font-weight: 900; font-size: 1.1rem;
  overflow: hidden;
}
.link-thumb img { width: 100%; height: 100%; object-fit: cover; }
.link-tile-body { padding: 8px 9px 10px; }
.link-tile-title {
  display: flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 800;
  margin-bottom: 4px;
}
.link-tile-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-votes {
  font-size: .72rem; color: var(--pink); font-weight: 700;
  display: flex; align-items: center; gap: 4px;
}

/* user notice popups */
.notice-popups {
  z-index: 120;
  align-items: flex-start;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 48px 12px;
}
.notice-popups.open { display: flex; }
.notice-card {
  width: min(360px, 92vw);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,.4);
}
.notice-card img {
  display: block; width: 100%; max-height: 420px; object-fit: contain; background: #000;
}
.notice-card .notice-actions {
  display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line);
}
.notice-card .notice-actions button,
.notice-card .notice-actions a {
  flex: 1; text-align: center; min-height: 36px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel2); color: var(--text);
  font-weight: 700; font-size: .8rem; cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center;
}
.notice-card .notice-actions .primary {
  background: var(--accent); color: #fff; border-color: transparent;
}
.notice-card .notice-actions .danger {
  background: transparent; color: #e11d48; border-color: #fda4af; font-weight: 800;
}
.notice-media {
  display: block; position: relative; padding: 0; margin: 0; border: 0; background: #000;
  width: 100%; cursor: pointer; font: inherit; color: inherit; text-align: left;
}
.notice-media img { pointer-events: none; }
.bookmark-trigger { cursor: pointer; }
.linknow-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: rgba(15, 10, 30, .92); color: #fff; border: 1px solid rgba(167, 139, 250, .5);
  padding: 12px 16px; border-radius: 999px; font-size: .85rem; font-weight: 800;
  z-index: 200; opacity: 0; pointer-events: none; transition: .25s ease; max-width: 90vw;
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
}
.linknow-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.btn-bookmark {
  background: linear-gradient(135deg, #7c3aed, #db2777);
  color: #fff !important; border: none !important; font-weight: 800;
}
.btn-bookmark:hover { filter: brightness(1.08); }

/* admin leftovers */
.admin-shell { max-width: 1100px; margin: 0 auto; padding: 16px 12px 48px; }
.admin-login {
  max-width: 380px; margin: 80px auto; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 24px; box-shadow: var(--shadow);
}
.admin-login h1 { font-size: 1.2rem; margin-bottom: 8px; }
.admin-login p { color: var(--muted); font-size: .8125rem; margin-bottom: 16px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: .75rem; color: var(--muted); margin-bottom: 6px; font-weight: 700; }
.field input, .field select, .field textarea { width: 100%; }
.field textarea { min-height: 80px; resize: vertical; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.admin-bar {
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin-bottom: 16px; align-items: center;
}
.flash {
  padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; font-size: .8125rem;
  background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok);
  border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent);
}
.flash.err {
  background: color-mix(in srgb, var(--hot) 12%, transparent); color: var(--hot);
  border-color: color-mix(in srgb, var(--hot) 30%, transparent);
}
.drag-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.drag-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 10px;
  cursor: grab;
}
.drag-item.dragging { opacity: .55; border-style: dashed; }
.drag-handle { color: var(--muted); font-weight: 900; width: 22px; text-align: center; user-select: none; }
.drag-item .meta { flex: 1; min-width: 0; }
.drag-item .meta b { display: block; font-size: .875rem; }
.drag-item .meta small { color: var(--muted); font-size: .7rem; word-break: break-all; }
.badge {
  font-size: .625rem; font-weight: 800; padding: 2px 6px; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent);
}
.badge.hot { background: color-mix(in srgb, var(--hot) 15%, transparent); color: var(--hot); }
.badge.ad { background: color-mix(in srgb, var(--muted) 20%, transparent); color: var(--muted); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs button.on { background: var(--accent); color: #fff; border-color: transparent; }
.muted { color: var(--muted); font-size: .8125rem; }
.hidden { display: none !important; }
.section {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  margin-bottom: 14px; overflow: hidden; box-shadow: var(--shadow);
}
.section-head {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.section-head h2 { font-size: .95rem; font-weight: 800; }
.section-head .tag {
  font-size: .6875rem; font-weight: 700; color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  padding: 3px 8px; border-radius: 999px;
}
.section-body { padding: 12px; }
.admin-thumb {
  width: 72px; height: 42px; object-fit: cover; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel2); display: block;
}
.admin-thumb.hidden { display: none; }
.drag-item .admin-thumb { width: 56px; height: 34px; flex-shrink: 0; }
.admin-link-name {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.admin-link-name:hover { filter: brightness(1.1); }
.admin-link-url {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}
.admin-link-url:hover { color: var(--accent); }

.src-group { margin-bottom: 14px; }
.src-group-head {
  display: flex; align-items: center; gap: 8px;
  font-size: .85rem; font-weight: 800; color: var(--muted);
  margin: 4px 0 8px; padding: 0 2px;
}
.src-group .drag-item { margin-bottom: 8px; }
.src-stale {
  border-color: color-mix(in srgb, var(--hot) 40%, var(--line)) !important;
}

/* 어드민 링크: 카테고리 아코디언 */
.link-acc {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 10px;
  overflow: hidden;
}
.link-acc-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--panel2);
  border: 0;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font: inherit;
}
.link-acc-head:hover { background: color-mix(in srgb, var(--accent) 10%, var(--panel2)); }
.link-acc-chevron {
  width: 18px;
  color: var(--muted);
  font-size: .85rem;
  transition: transform .15s ease;
}
.link-acc.open .link-acc-chevron { transform: rotate(90deg); color: var(--accent); }
.link-acc-head strong { flex: 1; font-size: .9rem; font-weight: 800; }
.link-acc-head .tag {
  font-size: .6875rem; font-weight: 700; color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  padding: 3px 8px; border-radius: 999px;
}
.link-acc-body { padding: 10px 12px 12px; border-top: 1px solid var(--line); }
.link-acc-body[hidden] { display: none !important; }

@media (max-width: 1100px) {
  .cat-grid { grid-template-columns: repeat(3, 1fr); }
  .link-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 800px) {
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
  .link-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 520px) {
  .cat-grid { grid-template-columns: 1fr; }
  .link-grid { grid-template-columns: repeat(2, 1fr); }
  .top-actions { flex-wrap: wrap; justify-content: stretch; }
  .search-box {
    max-width: none;
    width: 100%;
    flex: 1 1 100%;
    flex-direction: row;
    flex-wrap: nowrap;
  }
}
