:root {
  --paper: #f5f0e6;
  --paper-deep: #ece4d6;
  --ink: #211d18;
  --muted: #7c7366;
  --line: #d8cdb9;
  --accent: #b4482a;
  --accent-soft: #f0d9cd;
  --card: #fffdf8;
  --radius: 14px;
  --shadow: 0 14px 30px rgba(60, 45, 25, 0.08);
  --sans: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --serif: "Nanum Myeongjo", "Noto Serif KR", Georgia, serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 12% 0%, #fbf7ee 0%, transparent 45%),
    radial-gradient(circle at 88% 12%, #f0e6d5 0%, transparent 40%),
    var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 18px clamp(20px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
  background: rgba(245, 240, 230, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  font-family: var(--serif);
  font-size: 20px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand em { font-style: normal; color: var(--accent); }

.nav { display: flex; gap: 18px; font-size: 14px; color: var(--muted); }
.nav a:hover { color: var(--ink); }

.quick-search {
  margin-left: auto;
  display: flex;
  gap: 8px;
}
.quick-search input {
  flex: 1 1 auto;
  min-width: 0;
  width: min(260px, 40vw);
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font: inherit;
  font-size: 14px;
}
.quick-search button {
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.page {
  padding: clamp(28px, 2.6vw, 44px) clamp(18px, 2.2vw, 48px) 72px;
  max-width: none;
  margin: 0 auto;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 32px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 26px;
}
.hero.compact { padding-bottom: 18px; }
.hero h1 {
  font-family: var(--serif);
  font-size: clamp(30px, 4vw, 46px);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 6px 0 8px;
}
.eyebrow {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}
.lede { margin: 0; color: var(--muted); max-width: 56ch; }

.stat-row {
  display: flex;
  gap: 28px;
  margin: 0;
  flex-wrap: wrap;
}
.stat-row div { min-width: 64px; }
.stat-row dt { font-size: 11px; color: var(--muted); letter-spacing: 0.08em; }
.stat-row dd { margin: 2px 0 0; font-family: var(--serif); font-size: 26px; }
.stat-row.small dd { font-size: 20px; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
  padding: 16px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 28px;
}
.filters label { display: flex; flex-direction: column; gap: 5px; font-size: 11px; color: var(--muted); }
.filters select, .filters input {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefb;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
}
.filters .check { flex-direction: row; align-items: center; gap: 7px; font-size: 13px; }
.filters .check input { width: auto; }

button, .primary {
  font: inherit;
  cursor: pointer;
}
button.primary, a.primary {
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
}
button.primary:hover, a.primary:hover { background: var(--accent); border-color: var(--accent); }

.masonry {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 22px;
  align-items: start;
}
.masonry.narrow { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 0;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 20px 40px rgba(60, 45, 25, 0.12); }
.card-media {
  position: relative;
  display: block;
  background: var(--paper-deep);
  aspect-ratio: 4 / 3;
  overflow: hidden;
}
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.placeholder {
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  background:
    repeating-linear-gradient(45deg, rgba(180, 72, 42, 0.07) 0 10px, transparent 10px 20px),
    var(--paper-deep);
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.06em;
}
.badge {
  position: absolute;
  left: 10px;
  top: 10px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.92);
  font-size: 11px;
  color: var(--accent);
}
.card-body { padding: 14px 16px 16px; }
.card-body h2 {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card .summary {
  margin: 0 0 8px;
  color: #4a443b;
  font-size: 13px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.panel .summary { margin: 0 0 14px; color: #4a443b; font-size: 14px; }

.load-more {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 26px 0 8px;
}
.load-more[hidden] { display: none; }
.load-more .primary:disabled { opacity: 0.55; cursor: default; }
.load-more .hint { margin: 0; min-height: 16px; }
.meta { margin: 0; color: var(--muted); font-size: 12px; }
.meta span { margin: 0 3px; }
.star { color: var(--accent); margin-left: 4px; }

.empty { padding: 60px 20px; text-align: center; color: var(--muted); }

.detail { max-width: 1360px; margin: 0 auto; }
.back { color: var(--muted); font-size: 13px; }
.detail-head { margin: 18px 0 26px; }
.detail-head h1 {
  font-family: var(--serif);
  font-size: clamp(26px, 3.4vw, 40px);
  line-height: 1.3;
  margin: 6px 0 6px;
  letter-spacing: -0.02em;
}
.original-title { margin: 0 0 8px; color: var(--muted); font-size: 14px; }

.inline { display: inline-flex; gap: 8px; align-items: center; margin-top: 10px; }
.tag-form { width: 100%; }
.tag-form input { flex: 1; margin-bottom: 0; }
.tag-form button, .panel form button { white-space: nowrap; }
.panel form select { margin-bottom: 9px; }
.pill {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 13px;
}
.pill.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.viewer { margin-bottom: 26px; }
.viewer-stage {
  display: grid;
  place-items: center;
  background: #1c1a17;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  min-height: 240px;
}
.viewer-slide { display: none; margin: 0; width: 100%; justify-content: center; }
.viewer-slide.active { display: flex; }
.viewer-slide img {
  max-height: min(78vh, 900px);
  width: auto;
  max-width: 100%;
  object-fit: contain;
  cursor: zoom-in;
}
.viewer-slide video { max-height: min(78vh, 900px); width: auto; max-width: 100%; }
.viewer-slide .link-only { padding: 56px 28px; text-align: center; color: #eee6d8; }
.viewer-slide .link-only a { color: #f0b39a; font-size: 13px; }
.viewer-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 10px 0 4px;
}
.viewer-nav {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 17px;
  line-height: 1;
}
.viewer-counter { font-size: 12px; color: var(--muted); min-width: 64px; text-align: center; }
.viewer-thumbs {
  list-style: none;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 0 4px;
  margin: 0;
}
.viewer-thumb {
  width: 68px;
  height: 52px;
  padding: 0;
  border-radius: 8px;
  border: 2px solid transparent;
  background: var(--paper-deep);
  overflow: hidden;
}
.viewer-thumb.active { border-color: var(--accent); }
.viewer-thumb img { width: 100%; height: 100%; object-fit: cover; }
.viewer-thumb .thumb-label { font-size: 10px; color: var(--muted); }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 14, 12, 0.94);
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 94vw;
  max-height: 92vh;
  width: auto;
  height: auto;
  object-fit: contain;
  cursor: zoom-out;
}
.lightbox-close,
.lightbox-nav {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
  color: #f5efe4;
  border-radius: 999px;
  width: 44px;
  height: 44px;
  font-size: 22px;
  line-height: 1;
}
.lightbox-close { top: 18px; right: 18px; }
.lightbox-nav { top: 50%; transform: translateY(-50%); }
.lightbox-nav.prev { left: 18px; }
.lightbox-nav.next { right: 18px; }
body.lightbox-open { overflow: hidden; }

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
  gap: 22px;
  align-items: start;
}
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 18px;
}
.panel h2 {
  font-family: var(--serif);
  font-size: 17px;
  margin: 0 0 12px;
}
.panel h3 { font-size: 12px; letter-spacing: 0.06em; color: var(--muted); margin: 18px 0 7px; text-transform: uppercase; }

.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; }
.chips li {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--paper-deep);
  font-size: 12px;
}
.ideas { margin: 0; padding-left: 18px; font-size: 14px; }
.ideas li { margin-bottom: 5px; }
.muted { color: var(--muted); }
.tag-note { font-size: 10px; color: var(--accent); letter-spacing: 0.04em; margin-left: 6px; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.tags span { font-size: 12px; color: var(--muted); }
.original { white-space: pre-wrap; font-size: 13px; color: #4a443b; }
details summary { cursor: pointer; font-size: 13px; color: var(--accent); }

textarea, input[type="text"], input[type="number"], select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fffefb;
  font: inherit;
  font-size: 14px;
  margin-bottom: 9px;
}
textarea { resize: vertical; }
.hint { font-size: 11px; color: var(--muted); margin: 4px 0 10px; }
.notice {
  padding: 11px 16px;
  background: var(--accent-soft);
  border-radius: 10px;
  color: #7d2f18;
  font-size: 13px;
  margin-bottom: 18px;
}
.plain { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.plain li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--line); }

.collections-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 26px; align-items: start; }
.collection-list { list-style: none; padding: 0; margin: 18px 0 0; }
.collection-list a { display: flex; justify-content: space-between; padding: 8px 10px; border-radius: 8px; font-size: 13px; }
.collection-list li.active a, .collection-list a:hover { background: var(--paper-deep); }
.section-title { font-family: var(--serif); font-size: 22px; margin: 0 0 6px; }
.section-title span { font-family: var(--sans); font-size: 12px; color: var(--muted); margin-left: 8px; }

.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.panel.wide { margin-top: 4px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 11px; letter-spacing: 0.06em; border-bottom: 1px solid var(--line); padding: 8px 6px; }
.table td { padding: 9px 6px; border-bottom: 1px solid #eee6d8; }
.mono { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 12px; }
.status { padding: 2px 8px; border-radius: 999px; background: var(--paper-deep); font-size: 11px; }
.status.committed { background: #dcecd9; color: #2f5a2b; }
.status.conflict, .status.blocked_rights, .status.blocked_storage { background: var(--accent-soft); color: #7d2f18; }

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 22px clamp(20px, 4vw, 56px) 40px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; gap: 12px; }
  .quick-search { width: 100%; margin-left: 0; }
  .quick-search input { width: 100%; }
  .detail-grid, .collections-layout { grid-template-columns: 1fr; }
  .viewer-slide img, .viewer-slide video { max-height: 58vh; }
  .viewer-thumb { width: 56px; height: 44px; }
  .hero { flex-direction: column; align-items: flex-start; }
  .stat-row { gap: 18px; }
  .masonry { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .card { border-radius: 10px; }
  .card-body { padding: 11px 12px 13px; }
  .card-body h2 { font-size: 14px; }
  .page { padding: 22px 16px 48px; }
}

@media (max-width: 520px) {
  .masonry { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .filters { gap: 10px; }
  .filters label { flex: 1 1 45%; }
}
