/* ================= 基本 ================= */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-deep: #160f0a;
  --bg-paper: #24170e;
  --paper-light: #382515;
  --paper-tex: #4b321b;
  --ink: #fff4d4;
  --ink-dim: #d9c090;
  --gold: #d9a441;
  --gold-bright: #ffe08b;
  --red: #9c3428;
  --red-bright: #e5563c;
  --jade: #3e9b76;
  --purple: #6d3aa0;
  --sky: #57a7d8;
  --lotus: #e879a7;
  --leaf: #74b65b;
  --border: #6b5a47;
  --shadow: rgba(0,0,0,0.6);
}

body {
  font-family: "Noto Serif KR", "Nanum Myeongjo", serif;
  background:
    radial-gradient(130% 90% at 50% 0%, rgba(70,44,22,0.55), transparent 58%),
    radial-gradient(100% 70% at 85% 100%, rgba(60,30,30,0.35), transparent 60%),
    linear-gradient(180deg, #160f0a 0%, #241710 52%, #160f0a 100%);
  background-attachment: fixed;
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  line-height: 1.65;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255,244,212,0.04) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255,244,212,0.035) 1px, transparent 1px);
  background-size: 84px 84px;
  pointer-events: none;
  z-index: 0;
  mask-image: linear-gradient(180deg, black, transparent 80%);
}

/* ================= 배경 파티클 ================= */
#bg-particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    linear-gradient(115deg, transparent 0 45%, rgba(255,224,139,0.08) 48%, transparent 52%),
    linear-gradient(65deg, transparent 0 58%, rgba(116,182,91,0.06) 61%, transparent 64%);
  background-size: 260px 260px, 340px 340px;
  animation: paperDrift 26s linear infinite;
}

@keyframes paperDrift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 260px 260px, -340px 340px; }
}

/* ================= NSFW 토글 ================= */
#nsfw-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(36, 23, 14, 0.88);
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.28);
}

.nsfw-label {
  font-size: 13px;
  color: var(--ink-dim);
  letter-spacing: 0.1em;
}

.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--paper-tex);
  border: 1px solid var(--border);
  border-radius: 20px;
  transition: 0.3s;
}

.slider::before {
  content: "";
  position: absolute;
  height: 14px; width: 14px;
  left: 2px; top: 2px;
  background: var(--ink-dim);
  border-radius: 50%;
  transition: 0.3s;
}

input:checked + .slider { background: var(--red); }
input:checked + .slider::before { transform: translateX(20px); background: var(--gold); }

/* ================= VIEW 전환 ================= */
#app { position: relative; z-index: 1; }

.view {
  display: none;
  min-height: 100vh;
  padding: 64px 40px;
  animation: viewFade 0.5s ease-out;
}

.view.active { display: block; }

@keyframes viewFade {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ================= LANDING ================= */
#landing {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px 20px;
  position: relative;
  overflow: hidden;
}

#landing.active { display: flex; }

#landing::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(16,10,6,0.28), rgba(16,10,6,0.82)),
    url("https://an7rum.com/HMR/cover/cma.webp") center top / cover;
  transform: scale(1.04);
  animation: heroBreath 12s ease-in-out infinite alternate;
}

#landing::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 34vh;
  background: linear-gradient(180deg, transparent, rgba(22,15,10,0.96));
}

@keyframes heroBreath {
  from { transform: scale(1.04) translateY(0); filter: saturate(1.08); }
  to { transform: scale(1.1) translateY(-10px); filter: saturate(1.25); }
}

.landing-inner {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 800px;
  animation: landingIn 1.2s ease-out;
}

@keyframes landingIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.landing-ornament {
  display: flex;
  justify-content: center;
  margin: 30px 0;
}

.landing-ornament svg {
  width: 260px;
  height: 40px;
}

.main-title {
  margin: 20px 0;
}

.main-title .hanja {
  display: block;
  font-family: "Noto Serif KR", serif;
  font-size: clamp(56px, 10vw, 112px);
  color: var(--gold);
  text-shadow:
    0 0 20px rgba(201,166,84,0.4),
    0 0 40px rgba(201,166,84,0.22),
    0 6px 28px rgba(0,0,0,0.65);
  letter-spacing: 0.08em;
  line-height: 1;
  font-weight: 900;
}

.main-title .kor {
  display: block;
  font-size: clamp(18px, 3vw, 28px);
  color: #fff5d6;
  letter-spacing: 0.4em;
  margin-top: 10px;
}

.main-sub {
  color: #f6dfaa;
  font-size: 16px;
  letter-spacing: 0.1em;
  margin-bottom: 40px;
}

.enter-btn {
  background: linear-gradient(180deg, rgba(255,244,212,0.96) 0%, rgba(224,179,87,0.92) 100%);
  color: #4a2616;
  border: 1px solid #ffe08b;
  border-radius: 6px;
  padding: 14px 48px;
  font-family: inherit;
  font-size: 20px;
  letter-spacing: 0.5em;
  cursor: pointer;
  position: relative;
  transition: all 0.4s;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.enter-btn::before {
  content: "";
  position: absolute;
  inset: -4px;
  border: 1px solid rgba(201,166,84,0.3);
  pointer-events: none;
  transition: 0.3s;
}

.enter-btn:hover {
  color: #7c2d12;
  box-shadow: 0 0 30px rgba(255,224,139,0.36), inset 0 0 20px rgba(255,255,255,0.18);
}

.enter-btn:hover::before { inset: -8px; }

.btn-deco { width: 18px; height: 18px; }

.landing-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
}

.enter-btn.secondary {
  background: linear-gradient(180deg, rgba(72,48,26,0.92) 0%, rgba(32,20,12,0.96) 100%);
  color: var(--gold-bright);
  border-color: rgba(217,164,65,0.72);
}

.enter-btn.copy-code {
  background: linear-gradient(180deg, rgba(34,80,62,0.94) 0%, rgba(14,38,31,0.98) 100%);
  color: #dff8cb;
  border-color: rgba(129,199,132,0.72);
  letter-spacing: 0.18em;
}

.enter-btn.copy-code.copied {
  color: #fff8c7;
  border-color: #ffe08b;
  box-shadow: 0 0 28px rgba(129,199,132,0.34), inset 0 0 18px rgba(255,255,255,0.16);
}

/* ================= WORLD GUIDE ================= */
.world-scroll {
  max-width: 1080px;
  color: #372415;
  background:
    radial-gradient(circle at 18% 12%, rgba(255,255,255,0.34), transparent 22%),
    linear-gradient(180deg, #f6dfaa 0%, #e1b56f 100%);
  border-color: #9a642d;
  box-shadow:
    0 30px 90px rgba(0,0,0,0.42),
    inset 0 0 0 1px rgba(255,245,208,0.46),
    inset 0 0 80px rgba(86,40,13,0.22);
  overflow: hidden;
}

.world-scroll::before {
  background:
    linear-gradient(90deg, #7d3b25 0%, #c88b3e 48%, #7d3b25 100%),
    repeating-linear-gradient(90deg, transparent 0 12px, rgba(255,244,212,0.16) 12px 14px);
}

.world-scroll::after {
  background:
    linear-gradient(90deg, #7d3b25 0%, #c88b3e 48%, #7d3b25 100%),
    repeating-linear-gradient(90deg, transparent 0 12px, rgba(255,244,212,0.16) 12px 14px);
}

.world-scroll > * {
  position: relative;
  z-index: 1;
}

.world-scroll .lore-block,
.world-scroll .lore-prologue {
  animation: loreRise 0.65s ease both;
}

.world-scroll .lore-block:nth-of-type(2) { animation-delay: 0.08s; }
.world-scroll .lore-block:nth-of-type(3) { animation-delay: 0.16s; }
.world-scroll .lore-block:nth-of-type(4) { animation-delay: 0.24s; }
.world-scroll .lore-block:nth-of-type(5) { animation-delay: 0.32s; }

@keyframes loreRise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

.world-hero {
  position: relative;
  min-height: 270px;
  margin: 0 0 34px;
  border: 1px solid rgba(104,55,25,0.64);
  border-radius: 8px;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  box-shadow: inset 0 -110px 92px rgba(0,0,0,0.74), 0 16px 34px rgba(77,38,14,0.28);
}

.world-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(29,16,7,0.54), transparent 52%),
    linear-gradient(180deg, rgba(255,214,128,0.08), rgba(0,0,0,0.76));
}

.world-hero-shine {
  position: absolute;
  inset: -40% -30%;
  background: linear-gradient(115deg, transparent 35%, rgba(255,224,139,0.24) 47%, transparent 58%);
  animation: heroShine 6s ease-in-out infinite;
}

.world-seal {
  position: absolute;
  right: 22px;
  top: 22px;
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  color: #ffe3b0;
  border: 2px solid rgba(255,227,176,0.78);
  font-family: "Ma Shan Zheng", "Noto Serif KR", serif;
  font-size: 42px;
  line-height: 1;
  transform: rotate(8deg);
  background: rgba(128,34,23,0.72);
  box-shadow: 0 10px 24px rgba(0,0,0,0.36);
  animation: sealDrop 0.72s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes sealDrop {
  from { opacity: 0; transform: translateY(-18px) scale(1.15) rotate(14deg); }
  to { opacity: 1; transform: translateY(0) scale(1) rotate(8deg); }
}

.world-hero-label {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 20px;
  color: #fff8df;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.6;
  letter-spacing: 0.08em;
  text-shadow: 0 2px 14px rgba(0,0,0,0.9);
}

.world-hero-label span {
  display: block;
  color: var(--gold-bright);
  font-family: "Ma Shan Zheng", "Noto Serif KR", serif;
  font-size: 36px;
  letter-spacing: 0.18em;
  line-height: 1.1;
  margin-bottom: 8px;
}

.world-hero-label strong {
  display: block;
  font-size: 17px;
  letter-spacing: 0.08em;
}

.lore-prologue {
  position: relative;
  margin: 0 0 34px;
  padding: 24px 28px;
  border: 1px solid rgba(87,50,22,0.26);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(128,34,23,0.08), transparent 26%, transparent 74%, rgba(128,34,23,0.08)),
    #fff0c7;
  box-shadow: 0 10px 26px rgba(84,42,15,0.12);
}

.lore-prologue::before,
.lore-prologue::after {
  content: "◆";
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: #8e2d22;
  font-size: 11px;
}

.lore-prologue::before { left: 10px; }
.lore-prologue::after { right: 10px; }

.lore-prologue p {
  color: #352214;
  font-size: 18px;
  line-height: 2;
  text-align: center;
  word-break: keep-all;
}

.lore-block {
  margin-bottom: 34px;
  padding: 22px 24px;
  border: 1px solid rgba(87,50,22,0.2);
  border-radius: 8px;
  background: rgba(255,242,204,0.92);
  box-shadow: 0 10px 24px rgba(84,42,15,0.1);
}

.lore-title {
  font-size: 19px;
  color: #7e271f;
  letter-spacing: 0.22em;
  padding-left: 16px;
  border-left: 3px solid #8e2d22;
  margin-bottom: 14px;
  text-shadow: 0 1px 0 rgba(255,240,196,0.68);
}

.lore-block p {
  color: #3a2818;
  line-height: 1.95;
  letter-spacing: 0.02em;
  padding-left: 19px;
  word-break: keep-all;
}

.history-timeline {
  position: relative;
  padding-left: 34px;
}

.history-timeline::before {
  content: "";
  position: absolute;
  top: 6px;
  bottom: 8px;
  left: 9px;
  width: 2px;
  background: linear-gradient(180deg, #8e2d22, #c8913d, #8e2d22);
  transform-origin: top;
  animation: inkLine 0.9s ease both;
}

@keyframes inkLine {
  from { transform: scaleY(0); opacity: 0.2; }
  to { transform: scaleY(1); opacity: 1; }
}

.history-entry {
  position: relative;
  padding: 14px 16px 16px;
  margin-bottom: 14px;
  border: 1px solid rgba(126,39,31,0.16);
  border-radius: 8px;
  background: #fff5d8;
  animation: loreRise 0.58s ease both;
}

.history-entry:nth-child(1) { animation-delay: 0.04s; }
.history-entry:nth-child(2) { animation-delay: 0.12s; }
.history-entry:nth-child(3) { animation-delay: 0.2s; }
.history-entry:nth-child(4) { animation-delay: 0.28s; }
.history-entry:nth-child(5) { animation-delay: 0.36s; }

.history-entry::before {
  content: "";
  position: absolute;
  left: -40px;
  top: 18px;
  width: 16px;
  height: 16px;
  border: 2px solid #8e2d22;
  background: #f4d69b;
  box-shadow: 0 0 0 4px rgba(142,45,34,0.08);
  transform: rotate(45deg);
}

.history-year {
  display: inline-block;
  color: #8e2d22;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  margin-bottom: 5px;
}

.history-entry h4 {
  color: #2d1b10;
  font-size: 19px;
  line-height: 1.45;
  margin-bottom: 5px;
}

.history-entry p {
  padding-left: 0;
  color: #4d3522;
  line-height: 1.82;
}

.term-list {
  padding-left: 19px;
}

.term-list div {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 18px;
  padding: 13px 14px;
  margin-bottom: 8px;
  border: 1px solid rgba(126,39,31,0.14);
  border-radius: 7px;
  background: #fff6da;
}

.term-list dt {
  color: #7e271f;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.term-list dd {
  color: #3a2818;
  line-height: 1.8;
}

.rank-table {
  padding-left: 19px;
}

.rank-row {
  display: grid;
  grid-template-columns: 148px 1fr;
  gap: 18px;
  align-items: start;
  padding: 12px 14px;
  margin-bottom: 8px;
  border: 1px solid rgba(126,39,31,0.14);
  border-radius: 7px;
  background: #fff6da;
}

.rank-row.highlight {
  margin: 4px 0;
  padding: 12px 14px;
  border: 1px solid rgba(126,39,31,0.22);
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(142,45,34,0.13), rgba(67,108,83,0.1));
}

.rank-row b {
  color: #7e271f;
  letter-spacing: 0.08em;
}

.rank-row span {
  color: #3a2818;
  line-height: 1.75;
}

.rank-note {
  margin-top: 14px;
  color: #694326 !important;
}

/* ================= BREADCRUMB ================= */
.breadcrumb {
  font-size: 13px;
  color: var(--ink-dim);
  margin-bottom: 20px;
  letter-spacing: 0.1em;
}

.breadcrumb a {
  color: var(--gold);
  cursor: pointer;
  text-decoration: none;
}

.breadcrumb a:hover { color: var(--gold-bright); }
.breadcrumb span { margin: 0 8px; }
.breadcrumb .current { color: var(--ink); }

.view-title {
  font-size: 36px;
  color: var(--gold);
  letter-spacing: 0.3em;
  text-align: center;
  margin: 20px 0;
  font-weight: 600;
  position: relative;
  padding-bottom: 20px;
}

.view-title::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.view-desc {
  text-align: center;
  color: var(--ink-dim);
  margin-bottom: 40px;
  letter-spacing: 0.05em;
  line-height: 1.8;
}

/* ================= CATEGORY GRID ================= */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.cat-card {
  background:
    linear-gradient(145deg, rgba(72,48,26,0.96) 0%, rgba(32,20,12,0.96) 100%);
  border: 1px solid var(--border);
  padding: 40px 30px;
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: 0.4s;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.24);
}

.cat-card::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(201,166,84,0.2);
  pointer-events: none;
  transition: 0.3s;
}

.cat-card::after {
  content: "";
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(201,166,84,0.1), transparent);
  transition: 0.6s;
}

.cat-card:hover {
  transform: translateY(-6px);
  border-color: var(--cat-color, var(--gold));
  box-shadow: 0 14px 42px rgba(0,0,0,0.36), 0 0 24px rgba(217,164,65,0.22);
}

.cat-card:hover::before { inset: 8px; }
.cat-card:hover::after { left: 100%; }

.cat-card .cat-hanja {
  font-size: 36px;
  color: var(--cat-color, var(--gold));
  line-height: 1;
  text-shadow: 0 0 20px rgba(201,166,84,0.3);
  font-weight: 900;
  letter-spacing: 0.08em;
}

.cat-card .cat-name {
  font-size: 22px;
  color: var(--ink);
  letter-spacing: 0.3em;
  margin: 16px 0 12px;
}

.cat-card .cat-desc {
  color: var(--ink-dim);
  font-size: 14px;
  line-height: 1.7;
  letter-spacing: 0.03em;
}

.cat-card .cat-count {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(201,166,84,0.2);
  color: var(--cat-color, var(--gold));
  font-size: 12px;
  letter-spacing: 0.2em;
}

/* ================= SECT GRID ================= */
.sect-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  max-width: 1280px;
  margin: 0 auto;
}

.sect-card {
  --accent: var(--gold);
  --accent-rgb: 217, 164, 65;
  background: var(--bg-paper);
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: 0.4s;
  aspect-ratio: 3/4;
  border-radius: 8px;
  box-shadow: 0 18px 48px rgba(0,0,0,0.32);
}

.sect-hs { --accent: #f29ab8; --accent-rgb: 242,154,184; }
.sect-am { --accent: #8bd3ff; --accent-rgb: 139,211,255; }
.sect-md { --accent: #8be0a4; --accent-rgb: 139,224,164; }
.sect-jc { --accent: #ff8a4c; --accent-rgb: 255,138,76; }
.sect-sl { --accent: #ffd56a; --accent-rgb: 255,213,106; }
.sect-ng { --accent: #61b7ff; --accent-rgb: 97,183,255; }
.sect-jg { --accent: #e7c76d; --accent-rgb: 231,199,109; }
.sect-dg { --accent: #b58cff; --accent-rgb: 181,140,255; }
.sect-nr { --accent: #89c45f; --accent-rgb: 137,196,95; }
.sect-hv { --accent: #4fc3df; --accent-rgb: 79,195,223; }
.sect-hd { --accent: #ff6b6b; --accent-rgb: 255,107,107; }
.sect-sy { --accent: #b9a7ff; --accent-rgb: 185,167,255; }
.sect-mg { --accent: #d45cff; --accent-rgb: 212,92,255; }
.sect-hp { --accent: #f6c86d; --accent-rgb: 246,200,109; }
.sect-gb { --accent: #d8b16a; --accent-rgb: 216,177,106; }
.sect-tp { --accent: #ffb86b; --accent-rgb: 255,184,107; }

.sect-card-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.52;
  transition: 0.5s;
  filter: saturate(1.05) contrast(1.05);
}

.sect-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.2) 0%, rgba(10,6,4,0.9) 100%);
  z-index: 1;
}

.sect-card::after {
  content: "";
  position: absolute;
  z-index: 2;
  left: -45%;
  top: 18%;
  width: 180%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb),0.9), transparent);
  transform: rotate(-18deg);
  opacity: 0.48;
  animation: bladeSweep 5.5s ease-in-out infinite;
}

.sect-card-aura {
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    linear-gradient(130deg, transparent 0 35%, rgba(var(--accent-rgb),0.22) 48%, transparent 62%),
    linear-gradient(0deg, rgba(var(--accent-rgb),0.14), transparent 42%);
  mix-blend-mode: screen;
  opacity: 0.72;
  animation: auraFlow 7s ease-in-out infinite alternate;
}

@keyframes bladeSweep {
  0%, 46% { transform: translateX(-22%) rotate(-18deg); opacity: 0; }
  56% { opacity: 0.62; }
  100% { transform: translateX(22%) rotate(-18deg); opacity: 0; }
}

@keyframes auraFlow {
  from { transform: translateY(0); filter: saturate(1); }
  to { transform: translateY(-10px); filter: saturate(1.35); }
}

.sect-card:hover {
  transform: translateY(-6px) scale(1.02);
  border-color: var(--accent);
  box-shadow: 0 14px 44px rgba(0,0,0,0.62), 0 0 34px rgba(var(--accent-rgb),0.34);
}

.sect-card:hover .sect-card-bg {
  opacity: 0.7;
  transform: scale(1.1);
}

.sect-card-inner {
  position: absolute;
  inset: 0;
  z-index: 3;
  padding: 30px 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.sect-card-top {
  text-align: center;
}

.sect-card-hanja {
  font-size: 30px;
  color: var(--accent);
  letter-spacing: 0.08em;
  line-height: 1.1;
  text-shadow: 0 0 20px rgba(0,0,0,0.9);
  font-weight: 900;
}

.sect-card-name {
  font-size: 18px;
  color: var(--ink);
  letter-spacing: 0.3em;
  margin-top: 8px;
}

.sect-card-bottom {
  border-top: 1px solid rgba(201,166,84,0.3);
  padding-top: 14px;
  text-align: center;
}

.sect-card-symbol {
  color: var(--ink-dim);
  font-size: 13px;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.sect-card-loc {
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.15em;
}

/* ================= SECT DETAIL (비급) ================= */
.scroll-paper {
  --accent: var(--gold);
  --accent-rgb: 217, 164, 65;
  max-width: 960px;
  margin: 0 auto;
  background:
    linear-gradient(180deg, rgba(99,63,32,0.98) 0%, rgba(53,32,18,0.98) 100%);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 36px 50px 60px;
  position: relative;
  animation: scrollOpen 0.35s ease-out;
  box-shadow: 0 28px 80px rgba(0,0,0,0.38), inset 0 0 60px rgba(var(--accent-rgb),0.06);
}

.scroll-paper::before,
.scroll-paper::after {
  content: "";
  position: absolute;
  left: -10px; right: -10px;
  height: 20px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--red) 50%, var(--accent) 100%);
  border: 1px solid var(--accent);
}

.scroll-paper::before { top: -20px; }
.scroll-paper::after { bottom: -20px; }

@keyframes scrollOpen {
  0% { transform: translateY(10px); opacity: 0.72; }
  100% { transform: translateY(0); opacity: 1; }
}

.sect-hero {
  position: relative;
  min-height: 220px;
  margin: 0 0 34px;
  border: 1px solid rgba(var(--accent-rgb),0.72);
  border-radius: 8px;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  box-shadow: inset 0 -90px 80px rgba(0,0,0,0.72), 0 12px 30px rgba(0,0,0,0.24);
}

.sect-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(0,0,0,0.38), transparent 46%),
    linear-gradient(180deg, transparent, rgba(0,0,0,0.62));
}

.sect-hero-shine {
  position: absolute;
  inset: -40% -30%;
  background: linear-gradient(115deg, transparent 35%, rgba(var(--accent-rgb),0.28) 47%, transparent 58%);
  animation: heroShine 6s ease-in-out infinite;
}

.sect-hero-label {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 18px;
  color: #fff8df;
  font-weight: 700;
  line-height: 1.6;
  letter-spacing: 0.08em;
  text-shadow: 0 2px 14px rgba(0,0,0,0.9);
}

@keyframes heroShine {
  from { transform: translateX(-18%); opacity: 0.2; }
  50% { opacity: 0.7; }
  to { transform: translateX(18%); opacity: 0.2; }
}

.sect-head {
  text-align: center;
  padding-bottom: 30px;
  border-bottom: 1px solid rgba(201,166,84,0.3);
  margin-bottom: 30px;
}

.sect-head .hanja-big {
  font-size: 46px;
  color: var(--accent);
  line-height: 1;
  letter-spacing: 0.08em;
  font-weight: 900;
}

.sect-head .name-kor {
  font-size: 28px;
  color: var(--ink);
  letter-spacing: 0.4em;
  margin-top: 12px;
}

.sect-head .meta {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 24px;
  font-size: 13px;
  color: var(--ink-dim);
}

.sect-head .meta span { letter-spacing: 0.05em; }
.sect-head .meta .label { color: var(--gold); margin-right: 6px; }

.sect-section {
  margin-bottom: 32px;
}

.sect-section-title {
  font-size: 18px;
  color: var(--accent);
  letter-spacing: 0.25em;
  padding-left: 16px;
  border-left: 3px solid var(--red);
  margin-bottom: 14px;
}

.sect-section-body {
  color: var(--ink);
  line-height: 1.9;
  letter-spacing: 0.02em;
  padding-left: 19px;
}

.sect-section-body ul { list-style: none; }

.sect-section-body li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 6px;
}

.sect-section-body li::before {
  content: "◇";
  position: absolute;
  left: 0;
  color: var(--gold);
  font-size: 10px;
}

.heart-item {
  background: rgba(10,6,4,0.34);
  border-left: 2px solid var(--accent);
  border-radius: 0 6px 6px 0;
  padding: 10px 14px;
  margin-bottom: 10px;
}

.heart-item .hi-name {
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.05em;
}

.heart-item .hi-desc {
  color: var(--ink-dim);
  font-size: 14px;
  margin-top: 4px;
  line-height: 1.6;
}

.legend-item {
  background: linear-gradient(90deg, rgba(139,43,30,0.15) 0%, transparent 100%);
  border-left: 2px solid var(--red);
  padding: 12px 16px;
  margin-bottom: 10px;
}

.legend-item .li-name {
  color: var(--red-bright);
  font-weight: 600;
  letter-spacing: 0.05em;
}

.legend-item .li-desc {
  color: var(--ink-dim);
  font-size: 14px;
  margin-top: 4px;
  line-height: 1.6;
}

/* NPC 칸 */
.sect-npcs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.npc-card {
  background: rgba(10,6,4,0.6);
  border: 1px solid var(--border);
  padding: 14px;
  cursor: pointer;
  transition: 0.3s;
  text-align: center;
  border-radius: 8px;
}

.npc-card:hover {
  border-color: var(--accent);
  background: rgba(10,6,4,0.9);
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(var(--accent-rgb),0.18);
}

.npc-cover {
  width: 100%;
  aspect-ratio: 1;
  background: var(--paper-tex);
  border: 1px solid var(--border);
  margin-bottom: 10px;
  background-size: cover;
  background-position: center top;
  border-radius: 6px;
}

.npc-name { color: var(--accent); font-size: 15px; font-weight: 600; letter-spacing: 0.1em; }
.npc-tier { color: var(--ink-dim); font-size: 11px; margin-top: 4px; letter-spacing: 0.1em; }

/* ================= CHARACTER SCROLL MODAL ================= */
.char-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.char-modal.active { display: flex; }

.char-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(6px);
  animation: fadeIn 0.3s;
}

@keyframes fadeIn { from {opacity:0} to {opacity:1} }

.char-scroll {
  position: relative;
  width: min(900px, 95vw);
  max-height: 92vh;
  background: linear-gradient(180deg, #1a1410 0%, #0d0907 50%, #1a1410 100%);
  border-left: 3px solid var(--gold);
  border-right: 3px solid var(--gold);
  border-radius: 8px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.95), inset 0 0 80px rgba(0,0,0,0.6);
  transform-origin: center;
  animation: scrollUnroll 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
}

@keyframes scrollUnroll {
  0% { transform: scaleY(0); opacity: 0; }
  100% { transform: scaleY(1); opacity: 1; }
}

.scroll-top, .scroll-bottom {
  flex-shrink: 0;
  height: 30px;
  background: linear-gradient(90deg, var(--red) 0%, var(--red-bright) 50%, var(--red) 100%);
  border: 2px solid var(--gold);
  border-left: none;
  border-right: none;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
  position: relative;
}

.scroll-top::before, .scroll-bottom::before {
  content: "";
  position: absolute;
  inset: 4px 10px;
  border-top: 1px solid rgba(201,166,84,0.4);
  border-bottom: 1px solid rgba(201,166,84,0.4);
}

.scroll-content {
  flex: 1;
  overflow-y: auto;
  padding: 40px;
  animation: contentFade 0.6s 0.3s both;
}

@keyframes contentFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.scroll-content::-webkit-scrollbar { width: 10px; }
.scroll-content::-webkit-scrollbar-track { background: rgba(0,0,0,0.3); }
.scroll-content::-webkit-scrollbar-thumb { background: var(--border); }
.scroll-content::-webkit-scrollbar-thumb:hover { background: var(--gold); }

.char-close {
  position: absolute;
  top: 50px;
  right: 20px;
  background: var(--bg-paper);
  color: var(--gold);
  border: 1px solid var(--gold);
  width: 36px; height: 36px;
  font-size: 16px;
  cursor: pointer;
  z-index: 10;
  transition: 0.3s;
}

.char-close:hover {
  background: var(--red);
  color: var(--ink);
  transform: rotate(90deg);
}

/* 캐릭터 컨텐츠 */
.char-head {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 30px;
  margin-bottom: 30px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(201,166,84,0.3);
}

.char-cover-big {
  width: 220px;
  height: 280px;
  background: var(--bg-paper);
  border: 2px solid var(--gold);
  background-size: cover;
  background-position: center top;
  box-shadow: 0 8px 30px rgba(0,0,0,0.6);
}

.char-info .c-name-hanja {
  font-size: 34px;
  color: var(--gold);
  line-height: 1.1;
  letter-spacing: 0.08em;
  font-weight: 900;
}

.char-info .c-name-kor {
  font-size: 24px;
  color: var(--ink);
  letter-spacing: 0.3em;
  margin-top: 6px;
}

.char-info .c-tier-badge {
  display: inline-block;
  margin-top: 14px;
  padding: 4px 12px;
  background: rgba(139,43,30,0.3);
  border: 1px solid var(--red-bright);
  color: var(--red-bright);
  font-size: 13px;
  letter-spacing: 0.2em;
}

.char-info .c-meta {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 13px;
  color: var(--ink-dim);
}

.char-info .c-meta .label { color: var(--gold); margin-right: 4px; }

.char-section {
  margin-bottom: 24px;
}

.char-section-title {
  font-size: 16px;
  color: var(--gold);
  letter-spacing: 0.25em;
  padding-left: 14px;
  border-left: 3px solid var(--red);
  margin-bottom: 12px;
}

.char-section-body {
  color: var(--ink);
  line-height: 1.9;
  padding-left: 17px;
  word-break: keep-all;
}

.persona-card .char-section-body {
  padding-left: 0;
}

.intro-body {
  font-size: 15px;
  color: var(--ink);
}

.persona-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.persona-grid label {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.persona-grid label.wide {
  grid-column: 1 / -1;
}

.persona-grid span {
  color: var(--gold);
  font-size: 13px;
  letter-spacing: 0.12em;
}

.persona-grid input,
.persona-grid select,
.persona-grid textarea {
  width: 100%;
  min-height: 40px;
  background: rgba(10,6,4,0.48);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
  letter-spacing: 0;
  line-height: 1.5;
  padding: 8px 10px;
  outline: none;
}

.persona-grid textarea {
  min-height: 86px;
  resize: vertical;
}

.persona-grid input:focus,
.persona-grid select:focus,
.persona-grid textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(201,166,84,0.14);
}

.persona-copy-btn {
  margin-top: 14px;
  min-height: 42px;
  background: linear-gradient(180deg, rgba(34,80,62,0.94) 0%, rgba(14,38,31,0.98) 100%);
  color: #dff8cb;
  border: 1px solid rgba(129,199,132,0.72);
  border-radius: 6px;
  font-family: inherit;
  font-size: 15px;
  letter-spacing: 0.12em;
  padding: 9px 16px;
  cursor: pointer;
  transition: 0.3s;
}

.persona-copy-btn:hover,
.persona-copy-btn.copied {
  color: #fff8c7;
  border-color: #ffe08b;
  box-shadow: 0 0 22px rgba(129,199,132,0.25), inset 0 0 14px rgba(255,255,255,0.12);
}

.skill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.skill-item {
  background: rgba(10,6,4,0.5);
  border-left: 2px solid var(--jade);
  padding: 12px 14px;
  border-radius: 0 6px 6px 0;
}

.skill-item .sk-name {
  color: var(--jade);
  font-weight: 600;
  letter-spacing: 0.05em;
  font-size: 14px;
}

.skill-item .sk-desc {
  color: var(--ink-dim);
  font-size: 13px;
  margin-top: 4px;
  line-height: 1.5;
}

/* 갤러리 */
.gallery-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.gallery-tab {
  background: var(--bg-paper);
  color: var(--ink-dim);
  border: 1px solid var(--border);
  border-bottom: none;
  padding: 8px 20px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 0.15em;
  transition: 0.3s;
}

.gallery-tab.active {
  background: var(--paper-light);
  color: var(--gold);
  border-color: var(--gold);
}

.gallery-tab.nsfw-tab {
  background: rgba(139,43,30,0.2);
  color: var(--red-bright);
  border-color: var(--red);
}

.gallery-tab.nsfw-tab.active {
  background: rgba(139,43,30,0.4);
  color: var(--red-bright);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.gallery-item {
  aspect-ratio: 3/4;
  background: var(--bg-paper);
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: 0.3s;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  transition: 0.5s;
}

.gallery-item:hover {
  border-color: var(--gold);
  transform: scale(1.05);
  z-index: 5;
}

.gallery-item:hover img { transform: scale(1.08); }

.gallery-item.broken { display: none; }

/* 이미지 복사 단추 및 토스트 스타일 */
.copy-img-code-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 32px;
  height: 32px;
  background: rgba(10, 6, 4, 0.88);
  color: var(--gold-bright);
  border: 1px solid var(--gold);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s;
  box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}
@media (min-width: 721px) {
  .copy-img-code-btn {
    opacity: 0;
  }
  .gallery-item:hover .copy-img-code-btn {
    opacity: 1;
  }
}
@media (max-width: 720px) {
  .copy-img-code-btn {
    opacity: 0.9;
    width: 38px;
    height: 38px; /* 터치 최적화 */
  }
}
.copy-img-code-btn:hover, .copy-img-code-btn:active {
  background: var(--gold);
  color: #0c0805;
  transform: scale(1.1);
}
.copy-img-code-btn svg {
  width: 16px;
  height: 16px;
}
.copy-toast {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(26, 20, 16, 0.96);
  color: var(--gold-bright);
  border: 1px solid var(--gold);
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 14px;
  letter-spacing: 0.1em;
  z-index: 9999;
  box-shadow: 0 10px 30px rgba(0,0,0,0.65);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
}
.copy-toast.active {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 이미지 lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(0,0,0,0.95);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 20px;
}

.lightbox.active { display: flex; }

.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border: 2px solid var(--gold);
  box-shadow: 0 20px 60px rgba(0,0,0,0.8);
}

/* ================= 반응형 ================= */
@media (max-width: 720px) {
  #nsfw-toggle {
    top: 10px;
    right: 10px;
    padding: 7px 10px;
  }
  .nsfw-label { font-size: 12px; }
  .view { padding: 56px 16px 36px; }
  .breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    line-height: 1.8;
  }
  .breadcrumb span { margin: 0 4px; }
  .category-grid,
  .sect-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .cat-card { padding: 30px 22px; }
  .cat-card .cat-hanja { font-size: 54px; }
  .cat-card .cat-name,
  .sect-card-name,
  .main-title .kor,
  .view-title,
  .sect-head .name-kor,
  .char-info .c-name-kor {
    letter-spacing: 0.08em;
  }
  .sect-card {
    aspect-ratio: 16/11;
    min-height: 250px;
  }
  .char-head {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 20px;
  }
  .char-cover-big { width: 180px; height: 230px; }
  .scroll-paper { padding: 28px 18px 44px; }
  .sect-hero {
    min-height: 170px;
    margin-bottom: 24px;
  }
  .sect-hero-label {
    left: 14px;
    right: 14px;
    bottom: 12px;
    font-size: 13px;
    letter-spacing: 0.02em;
  }
  .world-hero {
    min-height: 180px;
    margin-bottom: 24px;
  }
  .world-seal {
    width: 50px;
    height: 50px;
    right: 14px;
    top: 14px;
    font-size: 31px;
  }
  .world-hero-label {
    left: 14px;
    right: 76px;
    bottom: 12px;
    font-size: 14px;
    letter-spacing: 0.02em;
  }
  .world-hero-label span {
    font-size: 26px;
    letter-spacing: 0.08em;
  }
  .world-hero-label strong {
    font-size: 13px;
    letter-spacing: 0.02em;
  }
  .lore-prologue {
    padding: 18px 16px;
  }
  .lore-prologue p {
    font-size: 15px;
    line-height: 1.85;
    text-align: left;
  }
  .lore-title {
    letter-spacing: 0.08em;
  }
  .history-timeline {
    padding-left: 24px;
  }
  .history-entry::before {
    left: -27px;
    width: 13px;
    height: 13px;
  }
  .history-entry h4 {
    font-size: 16px;
  }
  .lore-block p,
  .term-list,
  .rank-table {
    padding-left: 0;
  }
  .term-list div,
  .rank-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .sect-head .hanja-big { font-size: 54px; }
  .sect-head .name-kor { font-size: 22px; }
  .sect-head .meta {
    justify-content: flex-start;
    gap: 8px;
  }
  .sect-section-body {
    padding-left: 0;
    line-height: 1.8;
    font-size: 15px;
  }
  .sect-section-title,
  .char-section-title {
    letter-spacing: 0.08em;
  }
  .scroll-content { padding: 68px 16px 24px; }
  .main-title .hanja { letter-spacing: 0.05em; }
  .view-title { font-size: 26px; letter-spacing: 0.15em; }
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  }
  .skill-grid {
    grid-template-columns: 1fr;
  }
  .persona-grid {
    grid-template-columns: 1fr;
  }
  .char-scroll {
    width: 100%;
    max-height: 96vh;
    border-left: none;
    border-right: none;
  }
  .char-close {
    top: 14px;
    right: 14px;
    width: 44px;
    height: 44px;
    font-size: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
  }
}

@media (max-width: 420px) {
  .view { padding-left: 12px; padding-right: 12px; }
  .main-sub {
    font-size: 14px;
    letter-spacing: 0.02em;
    line-height: 1.8;
  }
  .enter-btn {
    width: min(280px, 100%);
    justify-content: center;
    padding: 13px 20px;
  }
  .sect-card { min-height: 220px; }
  .sect-card-inner { padding: 22px 18px; }
  .sect-card-hanja { font-size: 38px; }
  .char-modal { padding: 8px; }
  .char-scroll { max-height: 97vh; }
  .scroll-content { padding: 64px 12px 20px; }
}

/* ===================== 상단 고정 내비 ===================== */
#topnav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 1500;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 54px;
  padding: 0 16px;
  background: linear-gradient(180deg, rgba(18,12,7,0.97), rgba(22,15,10,0.86));
  border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 6px 22px rgba(0,0,0,0.4);
}

.nav-brand { display: flex; align-items: center; gap: 9px; cursor: pointer; text-decoration: none; flex: 0 0 auto; }

.nav-brand-mark {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  font-family: "Ma Shan Zheng", "Noto Serif KR", serif;
  font-size: 22px; color: #ffe3b0;
  background: rgba(128,34,23,0.85);
  border: 1px solid rgba(255,227,176,0.7);
  border-radius: 6px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.4);
  transform: rotate(-2deg);
}

.nav-brand-text {
  font-family: "Noto Serif KR", serif;
  font-weight: 900; font-size: 18px;
  color: var(--gold-bright); letter-spacing: 0.14em;
}

.nav-links { display: flex; align-items: center; gap: 2px; margin: 0 auto; }

.nav-link {
  cursor: pointer; color: var(--ink-dim); text-decoration: none;
  font-size: 15px; letter-spacing: 0.18em;
  padding: 8px 14px; border-radius: 6px;
  position: relative; transition: 0.25s; white-space: nowrap;
}

.nav-link:hover, .nav-link.active { color: var(--gold-bright); }

.nav-link.active::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 3px;
  height: 2px; background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.nav-link.nav-code { color: #cfead0; }
.nav-link.nav-code.copied { color: #fff8c7; }

#topnav #nsfw-toggle {
  position: static; top: auto; right: auto;
  flex: 0 0 auto; padding: 6px 10px; gap: 8px;
  box-shadow: none; background: rgba(10,6,4,0.5);
}

.view { padding-top: 74px; }
#landing { padding-top: 54px; }
html { scroll-padding-top: 64px; }

/* ===================== 전체 인물 (로스터) ===================== */
.roster-filter {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 8px; max-width: 880px; margin: 0 auto 30px;
}

.rfilter-chip {
  --chip: var(--gold);
  cursor: pointer; font-family: inherit;
  font-size: 14px; letter-spacing: 0.12em;
  color: var(--ink-dim); background: rgba(10,6,4,0.5);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 7px 18px; transition: 0.25s;
}

.rfilter-chip:hover { border-color: var(--chip); color: var(--ink); }

.rfilter-chip.active {
  background: var(--chip); color: #17100a; border-color: var(--chip); font-weight: 700;
  box-shadow: 0 4px 16px color-mix(in srgb, var(--chip) 40%, transparent);
}

.roster-grid { max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 34px; }

.roster-group { animation: loreRise 0.5s ease both; }

.roster-group-head {
  display: flex; align-items: baseline; gap: 12px;
  border-bottom: 1px solid rgba(217,164,65,0.28);
  padding: 0 4px 10px; margin-bottom: 16px;
}

.roster-group-head .rg-name {
  font-family: "Noto Serif KR", serif; font-weight: 900; font-size: 21px; letter-spacing: 0.06em;
  color: var(--accent); position: relative; padding-left: 14px;
}

.roster-group-head .rg-name::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 4px; height: 20px; border-radius: 2px; background: var(--accent);
}

.roster-group-head .rg-cat { margin-left: auto; font-size: 12px; letter-spacing: 0.16em; color: var(--ink-dim); }

.rchar-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }

.rchar-card {
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(40,26,15,0.94), rgba(22,14,9,0.96));
  border: 1px solid var(--border); border-top: 3px solid var(--accent);
  border-radius: 10px; overflow: hidden; cursor: pointer; transition: 0.3s;
  box-shadow: 0 10px 26px rgba(0,0,0,0.32);
}

.rchar-card:hover {
  transform: translateY(-5px); border-color: var(--accent);
  box-shadow: 0 16px 40px rgba(0,0,0,0.5), 0 0 22px color-mix(in srgb, var(--accent) 34%, transparent);
}

.rchar-portrait {
  position: relative; aspect-ratio: 3/4;
  background: var(--bg-paper); background-size: cover; background-position: center top;
  transition: 0.4s;
}

.rchar-card:hover .rchar-portrait { filter: saturate(1.12) brightness(1.04); }

.rchar-portrait::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(12,8,5,0.85));
}

.rchar-tier, .rchar-sex {
  position: absolute; z-index: 2;
  font-size: 11px; letter-spacing: 0.06em; font-weight: 700;
  padding: 3px 8px; border-radius: 6px;
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}

.rchar-tier {
  top: 8px; left: 8px; color: #1a120a;
  background: linear-gradient(180deg, #ffe08b, #d9a441);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.rchar-sex { top: 8px; right: 8px; border: 1px solid currentColor; background: rgba(10,6,4,0.6); }
.rchar-sex.sex-f { color: #ff9bc0; }
.rchar-sex.sex-m { color: #8cc4ff; }

.rchar-body { padding: 11px 13px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }

.rchar-name {
  font-family: "Noto Serif KR", serif; font-weight: 700; font-size: 17px;
  letter-spacing: 0.04em; color: var(--ink);
}

.rchar-role {
  font-size: 12.5px; line-height: 1.5; color: var(--ink-dim);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

@media (max-width: 1100px) { .rchar-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 820px)  { .rchar-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; } }
@media (max-width: 520px)  { .rchar-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } }

/* ===================== 그리드 대칭(중앙 정렬) ===================== */
.category-grid { grid-template-columns: repeat(auto-fit, 264px); justify-content: center; }
.sect-grid { grid-template-columns: repeat(auto-fit, 290px); justify-content: center; }

/* ===================== 내비/로스터 모바일 ===================== */
@media (max-width: 720px) {
  #topnav { height: 50px; padding: 0 10px; gap: 6px; }
  .category-grid, .sect-grid { grid-template-columns: 1fr; }
  .nav-brand-text { display: none; }
  .nav-links { gap: 0; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; -ms-overflow-style: none; }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-link { font-size: 13px; letter-spacing: 0.04em; padding: 7px 9px; }
  #topnav #nsfw-toggle { padding: 5px 7px; gap: 5px; }
  .view { padding-top: 62px; }
  .roster-group-head .rg-name { font-size: 18px; }
  .roster-filter { gap: 6px; }
  .rfilter-chip { font-size: 12.5px; padding: 6px 13px; }
}

@media (max-width: 380px) {
  .nav-link { font-size: 12px; padding: 6px 6px; letter-spacing: 0; }
  #topnav #nsfw-toggle .nsfw-label { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
