@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css");

:root {
  --bg: #0d0f14; --bg2: #141821; --card: #181d28; --line: #262d3b; --text: #e8ebf2; --mute: #8b93a7; --dim: #5d6579;
  --acc: #7c9cff; --acc2: #a78bfa; --ok: #34d399; --warn: #fbbf24; --bad: #f87171; --chip: #1f2533;
  --shadow: 0 6px 24px rgba(0,0,0,.35); --r: 14px;
}
:root[data-theme="light"] {
  --bg: #f6f7fb; --bg2: #ffffff; --card: #ffffff; --line: #e3e6ee; --text: #161a23; --mute: #5d6476; --dim: #9aa1b2;
  --acc: #3f63e6; --acc2: #7c3aed; --chip: #eef1f7; --shadow: 0 6px 20px rgba(20,30,60,.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.55 "Pretendard Variable", Pretendard, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--acc); }
img { display: block; }

/* 머리 */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line); }
.top .in { max-width: 1600px; margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; gap: 22px; }
.logo { font-weight: 800; font-size: 19px; letter-spacing: -.3px; display: flex; align-items: center; gap: 8px; }
.logo b { background: linear-gradient(135deg, var(--acc), var(--acc2)); -webkit-background-clip: text; color: transparent; }
.logo i { font-style: normal; width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(135deg, var(--acc), var(--acc2));
  display: grid; place-items: center; color: #fff; font-size: 14px; }
.nav { display: flex; gap: 4px; }
.nav a { padding: 7px 12px; border-radius: 9px; color: var(--mute); font-weight: 600; font-size: 14px; }
.nav a.on, .nav a:hover { color: var(--text); background: var(--chip); }
.gsearch { flex: 1; max-width: 520px; margin-left: auto; position: relative; }
.gsearch input { width: 100%; padding: 9px 14px 9px 38px; border-radius: 11px; border: 1px solid var(--line); background: var(--bg2);
  color: var(--text); font: inherit; outline: none; }
.gsearch input:focus { border-color: var(--acc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--acc) 25%, transparent); }
.gsearch::before { content: "⌕"; position: absolute; left: 13px; top: 50%; transform: translateY(-52%); color: var(--dim); font-size: 18px; }
.iconbtn { border: 1px solid var(--line); background: var(--bg2); color: var(--mute); border-radius: 10px; padding: 7px 10px; cursor: pointer; font: inherit; }
.iconbtn:hover { color: var(--text); }

main { max-width: 1600px; margin: 0 auto; padding: 26px 24px 80px; }
h1 { font-size: 28px; margin: 0 0 6px; letter-spacing: -.5px; }
h2 { font-size: 19px; margin: 34px 0 14px; letter-spacing: -.3px; display: flex; align-items: baseline; gap: 10px; }
h2 small, .mute { color: var(--mute); font-weight: 500; font-size: 14px; }
.sub { color: var(--mute); margin: 0 0 18px; }

/* 숫자 카드 */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin: 18px 0 8px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; }
.stat b { font-size: 26px; letter-spacing: -.5px; display: block; }
.stat span { color: var(--mute); font-size: 13px; }

/* 포스터 격자 */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px 14px; }
.grid.small { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.pcard { position: relative; }
.pcard .pic { aspect-ratio: 2/3; border-radius: 12px; overflow: hidden; background: var(--chip); border: 1px solid var(--line);
  transition: transform .15s ease, box-shadow .15s ease; }
.pcard:hover .pic { transform: translateY(-3px); box-shadow: var(--shadow); }
.pcard img { width: 100%; height: 100%; object-fit: cover; }
.pcard .noimg { width: 100%; height: 100%; display: grid; place-items: center; color: var(--dim); font-size: 13px; text-align: center; padding: 10px; }
.pcard .t { margin-top: 8px; font-weight: 650; font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcard .y { color: var(--mute); font-size: 12.5px; margin-top: 2px; }
.badges { position: absolute; top: 7px; left: 7px; display: flex; gap: 4px; flex-wrap: wrap; }
.b { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: rgba(10,12,18,.78); color: #fff; backdrop-filter: blur(4px); }
.b.v { background: rgba(52,211,153,.9); color: #062b1d; }
.b.s { background: rgba(124,156,255,.92); color: #0b1640; }
.b.n { background: rgba(229,9,20,.9); }
.b.d { background: rgba(17,60,207,.9); }

/* 사람 */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 18px 12px; }
.person { text-align: center; }
.person .av { width: 100%; aspect-ratio: 1; border-radius: 50%; overflow: hidden; background: var(--chip); border: 1px solid var(--line); margin: 0 auto; }
.person .av img { width: 100%; height: 100%; object-fit: cover; }
.person .av .noimg { width: 100%; height: 100%; display: grid; place-items: center; color: var(--dim); font-size: 26px; }
.person .nm { font-weight: 650; font-size: 13.5px; margin-top: 7px; line-height: 1.3; }
.person .ch { color: var(--mute); font-size: 12px; line-height: 1.3; margin-top: 2px; }

/* 상세 */
.hero { position: relative; border-radius: 20px; overflow: hidden; border: 1px solid var(--line); background: var(--bg2); margin-bottom: 8px; }
.hero .bd { position: absolute; inset: 0; background-size: cover; background-position: center top; opacity: .28; filter: blur(2px) saturate(1.1); }
.hero .bd::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, var(--bg2) 15%, transparent 80%), linear-gradient(0deg, var(--bg2), transparent 60%); }
.hero .in { position: relative; display: flex; gap: 28px; padding: 28px; }
.hero .poster { width: 220px; flex: none; align-self: flex-start; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); background: var(--chip); aspect-ratio: 2/3; }
.hero .poster img { width: 100%; height: 100%; object-fit: cover; }
.hero h1 { font-size: 32px; }
.hero .orig { color: var(--mute); margin-bottom: 12px; }
.facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.chip { background: var(--chip); border: 1px solid var(--line); padding: 4px 10px; border-radius: 999px; font-size: 13px; color: var(--text); }
.chip.ok { border-color: color-mix(in srgb, var(--ok) 55%, var(--line)); color: var(--ok); }
.chip.no { color: var(--dim); }
.syn { max-width: 920px; color: color-mix(in srgb, var(--text) 88%, var(--mute)); white-space: pre-line; }
.kv { display: grid; grid-template-columns: 90px 1fr; gap: 6px 14px; margin-top: 14px; font-size: 14px; }
.kv dt { color: var(--mute); }
.kv dd { margin: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags span { background: var(--chip); padding: 2px 9px; border-radius: 999px; font-size: 12.5px; }
.stills { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.stills img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 10px; background: var(--chip); }

/* 표 */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.tw { overflow: auto; max-height: 72vh; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { position: sticky; top: 0; background: var(--bg2); color: var(--mute); font-weight: 650; white-space: nowrap; z-index: 1; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td .cell { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td { white-space: nowrap; }
td.null { color: var(--dim); font-style: italic; }
tr:hover td { background: color-mix(in srgb, var(--acc) 6%, transparent); }
th a { color: inherit; }

/* 필터 · 양식 */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 12px; margin: 14px 0 20px; }
.filters input, .filters select, textarea, .field { background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 11px; font: inherit; font-size: 14px; outline: none; }
.filters input:focus, .filters select:focus, textarea:focus { border-color: var(--acc); }
.filters input.wide { min-width: 240px; flex: 1; }
.filters input.yr { width: 92px; }
.btn { background: linear-gradient(135deg, var(--acc), var(--acc2)); color: #fff; border: 0; border-radius: 9px; padding: 8px 16px; font: inherit;
  font-weight: 700; font-size: 14px; cursor: pointer; }
.btn.ghost { background: var(--chip); color: var(--text); border: 1px solid var(--line); }
.count { margin-left: auto; color: var(--mute); font-size: 13.5px; }
textarea { width: 100%; min-height: 160px; font-family: "JetBrains Mono", Consolas, monospace; font-size: 13.5px; line-height: 1.5; }
.err { background: color-mix(in srgb, var(--bad) 12%, var(--card)); border: 1px solid color-mix(in srgb, var(--bad) 45%, var(--line));
  color: var(--bad); border-radius: 10px; padding: 10px 14px; margin: 12px 0; white-space: pre-wrap; font-size: 13.5px; }
.note { color: var(--mute); font-size: 13px; margin: 8px 0; }

/* 쪽 넘기기 */
.pager { display: flex; gap: 6px; justify-content: center; margin: 28px 0 0; flex-wrap: wrap; }
.pager a, .pager span { min-width: 38px; text-align: center; padding: 7px 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--card); font-size: 14px; }
.pager .on { background: var(--acc); color: #fff; border-color: var(--acc); }
.pager .gap { border: 0; background: none; color: var(--dim); }

/* 표 목록 */
.tlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.tcard { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; justify-content: space-between; gap: 10px; }
.tcard:hover { border-color: var(--acc); color: inherit; }
.tcard b { font-family: Consolas, monospace; font-size: 14px; }
.tcard span { color: var(--mute); font-size: 12.5px; text-align: right; }

/* 로그인 */
.login { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 20% 0%, color-mix(in srgb, var(--acc) 18%, transparent), transparent),
  radial-gradient(900px 500px at 100% 100%, color-mix(in srgb, var(--acc2) 15%, transparent), transparent), var(--bg); }
.login form { width: min(380px, 92vw); background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 30px; box-shadow: var(--shadow); }
.login h1 { font-size: 24px; display: flex; align-items: center; gap: 10px; }
.login input { width: 100%; margin: 18px 0 12px; padding: 12px 14px; border-radius: 11px; border: 1px solid var(--line); background: var(--bg2); color: var(--text); font: inherit; }
.login .btn { width: 100%; padding: 12px; font-size: 15px; }

.empty { color: var(--mute); padding: 40px; text-align: center; background: var(--card); border: 1px dashed var(--line); border-radius: var(--r); }
footer { color: var(--dim); font-size: 12.5px; text-align: center; padding: 30px 0 10px; }
@media (max-width: 900px) {
  .top .in { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  .nav { order: 3; width: 100%; overflow-x: auto; }
  main { padding: 18px 14px 60px; }
  .hero .in { flex-direction: column; padding: 18px; }
  .hero .poster { width: 160px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}
