/* 애니 관리 — warm editorial theme (reference-inspired) */
:root {
  --bg: #fbf8f4;
  --bg-alt: #f4eee6;
  --card: #ffffff;
  --line: #e9e1d6;
  --line-soft: #f1eae0;
  --text: #2c2823;
  --sub: #7d7568;
  --muted: #a89e90;
  --accent: #dd6240;
  --accent-dark: #c24e2c;
  --accent-bg: #fdeee8;
  --serif: "Noto Serif KR", "Nanum Myeongjo", "Batang", Georgia, "Times New Roman", serif;
  --sans: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;

  --gray-bg: #f3ece2; --gray: #6f675c;
  --blue-bg: #eaf1f6; --blue: #3d5a70;
  --amber-bg: #fbf0dd; --amber: #7a5a22;
  --purple-bg: #f0eef7; --purple: #544a72;
  --red-bg: #fbe9e4; --red: #8a3a22;
  --green-bg: #ecf1e4; --green: #4a5a2e;
  --teal-bg: #e6f2ee; --teal: #2f5a4c;
}

:root[data-theme="dark"] {
    --bg: #17130f;
    --bg-alt: #1e1a15;
    --card: #221e18;
    --line: #362f26;
    --line-soft: #2a251e;
    --text: #f4ede2;
    --sub: #b8ae9f;
    --muted: #8b8172;
    --accent: #f08a63;
    --accent-dark: #ffa382;
    --accent-bg: #3a231a;
    --gray-bg: #2c2721; --gray: #cfc6b8;
    --blue-bg: #1e2b33; --blue: #a9c7d8;
    --amber-bg: #33281a; --amber: #e8c38c;
    --purple-bg: #272338; --purple: #c3bce6;
    --red-bg: #38221b; --red: #f0b19c;
    --green-bg: #26301d; --green: #bdd39a;
    --teal-bg: #1d2f2a; --teal: #9fd8c6;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.75 var(--sans);
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--text); text-decoration: none; }
a:hover { color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.02em; margin: 0; }
h2 { font-size: 25px; line-height: 1.3; }
h3 { font-size: 18px; }
img { max-width: 100%; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 28px; }

/* ---------- 상단 ---------- */
.topbar {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 28px; flex-wrap: wrap;
  padding: 26px 0 20px; border-bottom: 1px solid var(--line);
}
.brand { display: flex; flex-direction: column; gap: 6px; }
.kicker {
  font-size: 10px; letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.brand-name { font-family: var(--serif); font-size: 23px; font-weight: 600; letter-spacing: -0.01em; }
.brand-name:hover { color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }

nav { display: flex; gap: 22px; flex-wrap: wrap; align-items: center; padding-bottom: 3px; }
nav a {
  font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--sub); padding: 4px 0; border-bottom: 1px solid transparent;
}
nav a:hover { color: var(--text); border-color: var(--line); }
nav a.on { color: var(--accent); border-color: var(--accent); font-weight: 600; }
.count {
  font-size: 10px; letter-spacing: 0.04em; background: var(--bg-alt); color: var(--sub);
  border-radius: 20px; padding: 1px 7px; margin-left: 5px; vertical-align: 1px;
}

.msg {
  background: var(--card); border: 1px solid var(--line); border-left: 2px solid var(--accent);
  color: var(--text); border-radius: 3px; padding: 12px 16px; margin: 20px 0 0; font-size: 14px;
}

/* ---------- 버튼 ---------- */
button, .btn {
  font: inherit; font-size: 11.5px; letter-spacing: 0.12em; text-transform: uppercase;
  font-weight: 600; padding: 11px 20px; border-radius: 2px;
  border: 1px solid var(--line); background: transparent; color: var(--text);
  cursor: pointer; transition: background .18s, color .18s, border-color .18s;
  display: inline-block; text-align: center;
}
button:hover, .btn:hover { background: var(--bg-alt); color: var(--text); border-color: var(--text); }
button.primary, .btn-accent, .primary-btn {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
button.primary:hover, .btn-accent:hover, .primary-btn:hover {
  background: var(--accent-dark); border-color: var(--accent-dark); color: #fff;
}
button:disabled { opacity: .45; cursor: default; }
.btn-ghost { border-color: var(--line); color: var(--sub); }
.btn-ghost:hover { color: var(--text); }

/* ---------- 폼 ---------- */
input[type=text], input[type=password], input[type=number], input[type=email], select, textarea {
  font: inherit; font-size: 14px; width: 100%; padding: 11px 13px;
  border-radius: 2px; border: 1px solid var(--line); background: var(--card); color: var(--text);
  transition: border-color .18s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { min-height: 96px; }
label.f { display: block; font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); margin: 18px 0 6px; font-weight: 600; }
input[type=checkbox] { accent-color: var(--accent); }

.toolbar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-radius: 3px;
  padding: 14px 16px; margin: 0 0 30px;
}
.toolbar input[type=text] { max-width: 320px; border-color: transparent; background: var(--bg-alt); }
.toolbar input[type=text]:focus { background: var(--card); border-color: var(--accent); }
.toolbar select { width: auto; border-color: transparent; background: var(--bg-alt); }

/* ---------- 히어로 ---------- */
.hero {
  display: grid; grid-template-columns: 1.05fr .95fr; gap: 48px; align-items: center;
  padding: 64px 0 72px;
}
.hero h1 { font-size: clamp(38px, 5.4vw, 62px); line-height: 1.14; letter-spacing: -0.03em; margin: 16px 0 20px; }
.hero-sub { color: var(--sub); font-size: 15px; line-height: 1.85; max-width: 44ch; margin: 0 0 28px; }
.hero-actions { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.hero-note { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }

.hero-art { position: relative; height: 420px; }
.hero-poster {
  position: absolute; margin: 0; overflow: hidden; border-radius: 3px;
  background: var(--bg-alt); box-shadow: 0 26px 50px -30px rgba(66, 42, 22, .55);
  transition: transform .4s ease;
}
.hero-poster img { display: block; width: 100%; height: 100%; object-fit: cover; }
.hero-poster.hp1 { width: 46%; height: 100%; left: 0; top: 0; z-index: 3; }
.hero-poster.hp2 { width: 38%; height: 66%; right: 20%; top: 4%; z-index: 2; transform: rotate(3deg); }
.hero-poster.hp3 { width: 30%; height: 52%; right: 0; bottom: 2%; z-index: 1; transform: rotate(-4deg); }
.hero-art:hover .hero-poster.hp2 { transform: rotate(1deg) translateY(-6px); }
.hero-art:hover .hero-poster.hp3 { transform: rotate(-2deg) translateY(4px); }

/* ---------- 섹션 헤더 ---------- */
.section-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 20px;
  flex-wrap: wrap; padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 26px;
}
.section-head h2 { margin-top: 10px; }
.section-head .seg-tabs { display: flex; gap: 16px; }
.section-head .tab {
  font-size: 11.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted);
  padding-bottom: 6px; border-bottom: 1px solid transparent;
}
.section-head .tab.on { color: var(--text); border-color: var(--text); }
.section-head .tab:hover { color: var(--accent); }

/* ---------- 카드 그리드 ---------- */
.rel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(212px, 1fr)); gap: 26px; }
.rel-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 3px;
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.rel-card:hover {
  transform: translateY(-4px); border-color: var(--line);
  box-shadow: 0 22px 42px -28px rgba(66, 42, 22, .5);
}
.rel-poster { position: relative; aspect-ratio: 2 / 3; background: var(--bg-alt); overflow: hidden; }
.rel-poster img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s ease; }
.rel-card:hover .rel-poster img { transform: scale(1.035); }
.rel-noposter {
  height: 100%; display: flex; align-items: center; justify-content: center; padding: 16px;
  text-align: center; color: var(--muted); font-family: var(--serif); font-size: 15px;
}
.rel-ep {
  position: absolute; top: 10px; left: 10px;
  font: 600 10px/1 var(--sans); letter-spacing: 0.12em; text-transform: uppercase;
  background: var(--accent); color: #fff; padding: 6px 8px; border-radius: 2px;
}
.rel-state { position: absolute; top: 10px; right: 10px; }
.rel-body { padding: 15px 16px 16px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.rel-ko {
  font-family: var(--serif); font-weight: 600; font-size: 16px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.rel-orig {
  font-size: 11.5px; color: var(--muted); line-height: 1.4; letter-spacing: 0.02em;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.rel-tags { display: flex; gap: 4px; flex-wrap: wrap; margin: 3px 0 1px; }
.rel-meta {
  font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
  margin-top: 2px;
}
.rel-meta a { color: var(--muted); border-bottom: 1px solid var(--line); }
.rel-meta a:hover { color: var(--accent); border-color: var(--accent); }
.rel-action { margin-top: auto; padding-top: 12px; }
.rel-action .btn { display: block; width: 100%; padding: 10px 12px; }
.rel-card .rel-action .btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- 알약 ---------- */
.pill {
  display: inline-block; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  border-radius: 2px; padding: 4px 8px; white-space: nowrap; font-weight: 600;
}
.pill.gray { background: var(--gray-bg); color: var(--gray); }
.pill.blue { background: var(--blue-bg); color: var(--blue); }
.pill.amber { background: var(--amber-bg); color: var(--amber); }
.pill.purple { background: var(--purple-bg); color: var(--purple); }
.pill.red { background: var(--red-bg); color: var(--red); }
.pill.green { background: var(--green-bg); color: var(--green); }
.pill.teal { background: var(--teal-bg); color: var(--teal); }

/* ---------- 패널 ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 3px; padding: 22px;
}
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 22px; align-items: start; }
.group-title {
  font-size: 10.5px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted);
  font-weight: 600; margin: 34px 0 12px; display: flex; align-items: center; gap: 10px;
}
.group-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.empty { text-align: center; color: var(--muted); padding: 56px 0; font-family: var(--serif); }

/* ---------- 목록 행 ---------- */
.row {
  display: grid; grid-template-columns: 78px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 14px 4px; border-bottom: 1px solid var(--line-soft);
}
.row:last-child { border-bottom: none; }
.ep {
  font: 600 11px/1 var(--sans); letter-spacing: 0.08em; background: var(--bg-alt); color: var(--sub);
  border-radius: 2px; padding: 7px 6px; text-align: center;
}
.title { font-family: var(--serif); font-weight: 600; font-size: 15.5px; overflow-wrap: anywhere; }
.sub { font-size: 12.5px; color: var(--sub); letter-spacing: 0; }
.muted { color: var(--muted); }
.err { font-size: 13px; color: var(--red); }
.path { font: 12.5px ui-monospace, monospace; color: var(--muted); overflow-wrap: anywhere; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.actions form { margin: 0; }
.actions .btn, .actions button { padding: 7px 12px; }

.erow {
  display: flex; gap: 12px; align-items: center; padding: 11px 4px;
  border-bottom: 1px solid var(--line-soft); flex-wrap: wrap;
}
.erow:last-child { border-bottom: none; }
.erow .ep { flex: none; min-width: 66px; display: flex; flex-direction: column; gap: 3px; }
.erow .ep small { color: var(--teal); font-size: 10px; }
.einfo { flex: 1 1 160px; min-width: 0; display: flex; flex-wrap: wrap; gap: 5px 10px; align-items: center; font-size: 13px; }
.etitle { font-weight: 600; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.einfo .err { width: 100%; }
.erow .actions { flex: none; margin-left: auto; }
.row-done .title a { color: var(--sub); }
.row-done img { filter: saturate(.55); }

table.logs { width: 100%; border-collapse: collapse; font-size: 13px; }
table.logs td { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }

.seg { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 2px; overflow: hidden; }
.seg label { margin: 0; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; text-align: center; padding: 11px 8px; font-size: 13px; color: var(--sub); }
.seg label + label span { border-left: 1px solid var(--line); }
.seg input:checked + span { background: var(--text); color: var(--bg); font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }

.tmdb-row { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; margin: 0 0 8px; padding: 7px; }
.tmdb-row img, .tmdb-row .noimg { width: 42px; height: 62px; object-fit: cover; border-radius: 2px; background: var(--bg-alt); flex: none; }
.tmdb-row b { display: block; font-family: var(--serif); font-weight: 600; }
.tmdb-row small { color: var(--muted); }
.upload input[type=file] { display: none; }

/* ---------- 배너 ---------- */
.banner {
  margin: 56px 0 0; padding: 62px 24px; border-radius: 3px;
  background:
    radial-gradient(circle at 18% 22%, rgba(221, 98, 64, .10), transparent 42%),
    radial-gradient(circle at 82% 78%, rgba(120, 104, 80, .12), transparent 46%),
    var(--bg-alt);
  border: 1px solid var(--line);
  display: flex; justify-content: center;
}
.banner-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 3px;
  padding: 34px 40px; max-width: 520px; text-align: center;
  box-shadow: 0 30px 60px -40px rgba(66, 42, 22, .5);
}
.banner-card h2 { font-size: 27px; margin: 12px 0 10px; }
.banner-card p { color: var(--sub); font-size: 13.5px; margin: 0 0 22px; }

.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; margin: 56px 0 0; }
.duo-card {
  display: grid; grid-template-columns: 150px 1fr; gap: 20px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 3px; padding: 18px;
  transition: border-color .2s, transform .25s;
}
.duo-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.duo-thumb {
  aspect-ratio: 1 / 1; background: var(--bg-alt); border-radius: 2px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 30px; color: var(--accent);
}
.duo-card h3 { margin: 4px 0 6px; }
.duo-card p { margin: 0; font-size: 13px; color: var(--sub); }

/* ---------- 푸터 ---------- */
.foot { margin-top: 84px; background: var(--bg-alt); border-top: 1px solid var(--line); }
.foot-inner {
  display: grid; grid-template-columns: 1.6fr 1fr 1fr 1.4fr; gap: 40px;
  padding: 54px 28px 42px; max-width: 1180px; margin: 0 auto;
}
.foot h4 {
  font-size: 10.5px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted);
  margin: 0 0 16px; font-weight: 600; font-family: var(--sans);
}
.foot-brand { font-family: var(--serif); font-size: 26px; font-weight: 600; margin: 0 0 12px; }
.foot p { color: var(--sub); font-size: 13px; line-height: 1.85; margin: 0; max-width: 34ch; }
.foot ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.foot ul a { font-size: 13px; color: var(--sub); }
.foot ul a:hover { color: var(--accent); }
.foot form { display: flex; gap: 8px; margin-top: 4px; }
.foot form input { background: var(--card); }
.foot form button { white-space: nowrap; }
.foot-bottom {
  border-top: 1px solid var(--line); padding: 18px 28px 26px; max-width: 1180px; margin: 0 auto;
  display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted);
}

/* ---------- 반응형 ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 34px; padding: 44px 0 52px; }
  .hero-art { height: 320px; order: -1; }
  .duo { grid-template-columns: 1fr; }
  .foot-inner { grid-template-columns: 1fr 1fr; gap: 30px; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 18px; }
  .topbar { flex-direction: column; align-items: stretch; padding: 16px 0 12px; gap: 12px; min-width: 0; }
  .topbar-right { width: 100%; min-width: 0; flex-wrap: nowrap; gap: 10px; align-items: center; }
  .topbar-right .icon-btn, .topbar-right .fx-toggle { flex: none; }
  nav {
    flex: 1 1 0; min-width: 0; flex-wrap: nowrap; gap: 16px; overflow-x: auto;
    scrollbar-width: none; -ms-overflow-style: none;
  }
  nav::-webkit-scrollbar { display: none; }
  nav a { font-size: 11px; white-space: nowrap; }
  .rel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .rel-ko { font-size: 14px; }
  .rel-body { padding: 11px 12px 13px; }
  .rel-meta { font-size: 9.5px; letter-spacing: 0.05em; }
  .row { grid-template-columns: 64px minmax(0, 1fr); }
  .row .actions { grid-column: 1 / -1; justify-content: flex-start; }
  .hero h1 { font-size: 34px; }
  .hero-art { height: 260px; }
  .banner { padding: 34px 14px; }
  .banner-card { padding: 26px 20px; }
  .duo-card { grid-template-columns: 96px 1fr; }
  .foot-inner { grid-template-columns: 1fr; padding: 38px 18px 30px; }
  .foot-bottom { padding: 16px 18px 22px; }
}

/* ---------- 배경 파티클 (WebGPU) ---------- */
#fx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; display: block; }
.icon-btn, .fx-toggle {
  margin-left: 0; font-size: 13px; line-height: 1; padding: 7px 11px; border-radius: 999px;
  background: transparent; border: 1px solid var(--line); color: var(--accent); cursor: pointer;
  text-transform: none; letter-spacing: 0;
}
.icon-btn:hover, .fx-toggle:hover { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
.fx-toggle[aria-pressed="false"] { color: var(--muted); }

/* ---------- 오른쪽 아래 사이트 전환 위젯 ---------- */
.site-switch { position: fixed; right: 22px; bottom: 22px; z-index: 80; }
.site-switch-btn {
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; padding: 0;     /* 전역 button 패딩(11px 20px) 무시 */
  border: 1px solid var(--line); background: var(--card); color: var(--accent);
  font: 600 17px/1 var(--sans); cursor: pointer;
  box-shadow: 0 8px 24px rgba(44, 40, 35, .14);
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.site-switch-btn:hover, .site-switch.open .site-switch-btn {
  background: var(--accent-bg); border-color: var(--accent); transform: translateY(-2px);
}
.site-switch-panel {
  position: absolute; right: 0; bottom: 58px; width: 268px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 20px 46px rgba(44, 40, 35, .18);
  padding: 8px 8px 10px;
  max-height: min(72vh, 560px); overflow: auto;
  opacity: 0; visibility: hidden; transform: translateY(6px);
  transition: opacity .16s ease, transform .16s ease, visibility .16s ease;
}
.site-switch:hover .site-switch-panel,
.site-switch.open .site-switch-panel { opacity: 1; visibility: visible; transform: translateY(0); }
.site-switch-panel::after {          /* 버튼과 패널 사이 빈 곳에서도 hover 유지 */
  content: ""; position: absolute; left: 0; right: 0; bottom: -16px; height: 16px;
}
.ss-head {
  margin: 8px 8px 4px; font-size: 10px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.site-switch-panel a {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px; border-radius: 9px; color: var(--text);
}
.site-switch-panel a:hover { background: var(--bg-alt); color: var(--text); }
.ss-glyph {
  flex: 0 0 28px; width: 28px; height: 28px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--bg-alt); color: var(--sub); font-size: 12px; font-weight: 600;
}
.site-switch-panel a:hover .ss-glyph { background: var(--accent-bg); color: var(--accent); }
.ss-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.32; }
.ss-text b { font-size: 13.5px; font-weight: 600; }
.ss-text small { font-size: 11px; color: var(--muted); }
@media (max-width: 640px) {
  .site-switch { right: 14px; bottom: 14px; }
  .site-switch-panel { width: min(78vw, 268px); }
}
