/* NNOE 인터랙티브 온톨로지 — 공유 엔진 스타일.
   작품별 테마는 :root CSS 변수로 주입된다 (각 index.html). */
* { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: "Pretendard Variable", Pretendard, "Noto Sans KR", -apple-system, "Segoe UI", sans-serif;
  background: var(--bg); color: var(--ink);
  overflow-x: hidden; line-height: 1.6;
}
#scene { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.veil { position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: var(--veil, radial-gradient(ellipse at 50% 20%, transparent 0%, rgba(0,0,0,.4) 100%)); }
.shell { position: relative; z-index: 2; width: min(1180px, calc(100% - 32px)); margin: 0 auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.language-switch { display: inline-flex; align-items: center; justify-content: center; min-width: 48px; min-height: 44px;
  padding: 8px 13px; border: 1px solid var(--line); border-radius: 999px; color: var(--accent);
  background: color-mix(in srgb, var(--panel) 78%, transparent); text-decoration: none; font-size: .8rem;
  font-weight: 800; letter-spacing: .08em; }
.language-switch:hover, .language-switch:focus-visible { border-color: var(--accent); outline: none; }

/* ── 헤더 */
header.hero { min-height: 72vh; display: flex; flex-direction: column; justify-content: center; padding: 90px 0 40px; }
.crumb { font-size: .82rem; letter-spacing: .16em; color: var(--accent); text-transform: uppercase; font-weight: 700; }
.crumb a { color: inherit; text-decoration: none; opacity: .85; }
h1.title { font-family: var(--display, inherit); font-size: clamp(2.6rem, 8vw, 5.6rem);
  line-height: 1.04; letter-spacing: -.03em; margin: 14px 0 6px; color: var(--title, var(--ink)); }
.title-en { font-size: clamp(1rem, 2.4vw, 1.3rem); color: var(--muted); font-style: italic; }
.tagline { max-width: 640px; margin-top: 18px; font-size: clamp(1rem, 2.2vw, 1.18rem); color: var(--muted); }
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; }
.badge { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px;
  font-size: .8rem; color: var(--muted); background: color-mix(in srgb, var(--panel) 72%, transparent); backdrop-filter: blur(6px); }
.badge b { color: var(--accent); font-weight: 700; }

/* ── 섹션 공통 */
section { padding: 56px 0; }
.sec-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 22px; }
.sec-head h2 { font-family: var(--display, inherit); font-size: clamp(1.5rem, 3.6vw, 2.2rem); color: var(--title, var(--ink)); }
.sec-head .hint { color: var(--muted); font-size: .88rem; }
.section-nav { position: sticky; top: 0; z-index: 8; display: flex; gap: 8px; overflow-x: auto;
  margin: 0 -8px; padding: 10px 8px; scrollbar-width: none;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); }
.section-nav::-webkit-scrollbar { display: none; }
.section-nav a { flex: 0 0 auto; min-height: 40px; display: inline-flex; align-items: center; padding: 7px 12px;
  border: 1px solid var(--line); border-radius: 999px; color: var(--muted); text-decoration: none; font-size: .78rem; }
.section-nav a:hover, .section-nav a:focus-visible { color: var(--ink); border-color: var(--accent); outline: none; }

/* ── 관계 그래프 */
.graph-frame { position: relative; height: min(74vh, 640px); border: 1px solid var(--line);
  border-radius: 16px; background: color-mix(in srgb, var(--panel) 55%, transparent); overflow: hidden; }
.graph-tip { position: absolute; left: 14px; bottom: 12px; z-index: 3; padding: 7px 13px;
  border: 1px solid var(--line); border-radius: 999px; font-size: .82rem; color: var(--ink);
  background: color-mix(in srgb, var(--bg) 82%, transparent); opacity: 0; transition: opacity .25s;
  pointer-events: none; }
.graph-controls { display: flex; align-items: center; gap: 14px; margin-top: 12px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 72%, transparent); }
.graph-play { min-width: 44px; min-height: 44px; border-radius: 10px; border: 1px solid var(--accent);
  background: transparent; color: var(--accent); font-weight: 800; cursor: pointer; font-size: .9rem; }
.graph-position { min-width: 116px; font-weight: 800; color: var(--accent); font-size: .9rem; }
.graph-controls input[type=range] { flex: 1; min-width: 100px; accent-color: var(--accent); height: 32px; }
.graph-control-note { font-size: .74rem; color: var(--muted); }
.graph-note { color: var(--muted); font-size: .84rem; margin-top: 10px; max-width: 800px; }

/* ── 핵심 포인트 */
.links-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 14px; }
.link-card { position: relative; border: 1px solid var(--line); border-radius: 14px; padding: 18px;
  background: color-mix(in srgb, var(--panel) 82%, transparent); backdrop-filter: blur(8px);
  transition: transform .25s ease, border-color .25s ease; overflow: hidden; }
.link-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.link-card.locked { filter: grayscale(.9); opacity: .45; }
.link-card.locked .link-label, .link-card.locked .link-why, .link-card.locked .qpair { filter: blur(5px); user-select: none; }
.link-card.locked::after { content: attr(data-lock-label); position: absolute; inset: auto 0 0 0;
  padding: 8px 18px; font-size: .82rem; color: var(--accent); background: color-mix(in srgb, var(--bg) 80%, transparent); }
.link-kind { display: inline-block; font-size: .74rem; font-weight: 700; letter-spacing: .08em;
  padding: 3px 10px; border-radius: 999px; margin-bottom: 10px; }
.link-kind.foreshadow_payoff { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent); }
.link-kind.reveal { background: rgba(233,182,95,.2); color: #e9b65f; }
.link-kind.authorial_contradiction { background: rgba(224,92,92,.2); color: #e05c5c; }
.link-label { font-size: 1.05rem; font-weight: 700; margin-bottom: 8px; color: var(--title, var(--ink)); }
.link-why { font-size: .88rem; color: var(--muted); margin-bottom: 12px; }
.qpair { display: grid; gap: 8px; font-size: .8rem; }
.qpair .q { border-left: 3px solid var(--line); padding: 6px 10px; color: var(--muted); font-style: italic; }
.qpair .q b { color: var(--accent); font-style: normal; font-weight: 700; margin-right: 6px; }

/* ── 타임라인 */
.timeline { position: relative; }
.tl-rail { position: absolute; left: 18px; top: 0; bottom: 0; width: 2px;
  background: linear-gradient(var(--accent), var(--line)); opacity: .5; }
.ch-block { position: relative; padding-left: 56px; margin-bottom: 8px; }
.ch-tag { position: sticky; top: 12px; z-index: 3; display: inline-block; margin: 14px 0;
  font-weight: 800; font-size: .92rem; color: var(--bg); background: var(--accent);
  padding: 5px 14px; border-radius: 999px; }
.ch-block.future { display: none; }
.ev { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px;
  background: color-mix(in srgb, var(--panel) 78%, transparent); cursor: pointer;
  transition: border-color .2s, transform .2s; }
.ev:hover { border-color: var(--accent); transform: translateX(4px); }
.ev.linked { border-left: 4px solid var(--accent); }
.ev .ev-type { font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.ev .ev-title { font-weight: 700; margin: 3px 0; }
.ev .ev-sum { font-size: .86rem; color: var(--muted); display: none; }
.ev.open .ev-sum { display: block; margin-top: 6px; }
.ev .ev-quote { display: none; margin-top: 8px; padding: 8px 12px; border-left: 3px solid var(--accent);
  font-style: italic; font-size: .82rem; color: var(--muted); }
.ev.open .ev-quote { display: block; }
.ev:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── 인물 보드 */
.ents { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.ent { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
  background: color-mix(in srgb, var(--panel) 78%, transparent); }
.ent.future { display: none; }
.ent .ent-name { font-weight: 700; }
.ent .ent-kind { font-size: .72rem; color: var(--muted); }
.ent .bar { height: 4px; border-radius: 2px; background: var(--line); margin-top: 8px; overflow: hidden; }
.ent .bar i { display: block; height: 100%; background: var(--accent); }

/* ── 상태 보드 */
.states { display: grid; gap: 8px; }
.st { display: grid; grid-template-columns: 150px 110px 1fr; gap: 10px; align-items: baseline;
  font-size: .86rem; border-bottom: 1px dashed var(--line); padding: 8px 4px; }
.st .st-sub { font-weight: 700; }
.st .st-field { color: var(--accent); font-size: .76rem; letter-spacing: .06em; }
.st .st-val { color: var(--muted); }

/* ── 슬라이더 독 */
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); }
.dock .shell { display: flex; align-items: center; gap: 16px; }
.dock .pos { min-width: 130px; font-weight: 800; color: var(--accent); font-size: .95rem; }
.dock input[type=range] { flex: 1; accent-color: var(--accent); height: 32px; min-width: 0; }
.dock .dock-note { font-size: .74rem; color: var(--muted); min-width: 150px; text-align: right; }
.unlock-toast { position: fixed; right: 18px; bottom: 84px; z-index: 11; padding: 12px 18px;
  border: 1px solid var(--accent); border-radius: 12px; background: color-mix(in srgb, var(--panel) 92%, transparent);
  color: var(--ink); font-size: .9rem; opacity: 0; transform: translateY(10px); pointer-events: none; }
.unlock-toast b { color: var(--accent); }

.work-nav { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 20px; }
.work-nav a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; }
.work-nav a:hover, .work-nav a:focus-visible { color: var(--ink); border-color: var(--accent); outline: none; }

footer { padding: 60px 0 120px; color: var(--muted); font-size: .82rem; }
footer a { color: var(--accent); }

@media (max-width: 720px) {
  .shell { width: min(100% - 24px, 1180px); }
  header.hero { min-height: 50svh; padding: 72px 0 28px; }
  h1.title { font-size: clamp(2.35rem, 13vw, 4rem); }
  .tagline { margin-top: 14px; }
  .badges { margin-top: 20px; gap: 6px; }
  section { padding: 38px 0; scroll-margin-top: 62px; }
  .sec-head { flex-direction: column; align-items: flex-start; gap: 3px; margin-bottom: 16px; }
  .sec-head .hint { line-height: 1.45; }
  .links-grid { grid-template-columns: 1fr; }
  .link-card { padding: 16px; }
  .tl-rail { left: 10px; }
  .ch-block { padding-left: 34px; }
  .ch-tag { top: 54px; margin: 10px 0; }
  .ev { padding: 14px; }
  .ev:hover { transform: none; }
  .ents { grid-template-columns: 1fr; }
  .st { grid-template-columns: 1fr; gap: 2px; padding: 11px 4px; }
  .graph-frame { height: min(54svh, 480px); min-height: 340px; border-radius: 14px; }
  .graph-controls { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 6px 12px; padding: 10px 12px; }
  .graph-position { min-width: 0; align-self: center; }
  .graph-controls input[type=range] { grid-column: 1 / -1; width: 100%; min-height: 44px; }
  .graph-control-note { grid-column: 1 / -1; }
  .graph-note { font-size: .86rem; line-height: 1.55; }
  .dock .shell { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; }
  .dock .pos { min-width: 0; font-size: .86rem; }
  .dock .dock-note { display: none; }
  .dock input[type=range] { width: 100%; min-height: 44px; }
  .unlock-toast { left: 12px; right: 12px; bottom: calc(82px + env(safe-area-inset-bottom)); text-align: center; }
  footer { padding: 42px 0 calc(112px + env(safe-area-inset-bottom)); }
}

@media (max-width: 390px) {
  .crumb { letter-spacing: .1em; }
  .language-switch { min-width: 44px; padding-inline: 10px; }
  .badge { padding-inline: 10px; }
}

/* ── 별자리 정보 패널 */
#graph-panel { position: absolute; top: 12px; right: 12px; bottom: 12px; z-index: 4;
  width: min(360px, 86%); overflow-y: auto; padding: 18px;
  border: 1px solid var(--line); border-radius: 14px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px);
  transform: translateX(calc(100% + 20px)); transition: transform .32s cubic-bezier(.2,.9,.3,1);
  -webkit-overflow-scrolling: touch; }
#graph-panel.open { transform: translateX(0); }
.gp-close { position: absolute; top: 10px; right: 12px; width: 32px; height: 32px;
  border-radius: 8px; border: 1px solid var(--line); background: transparent;
  color: var(--muted); font-size: 1.1rem; cursor: pointer; }
.gp-kind { font-size: .74rem; letter-spacing: .1em; color: var(--accent); font-weight: 700; }
.gp-name { font-family: var(--display, inherit); font-size: 1.5rem; margin: 4px 0 6px;
  color: var(--title, var(--ink)); }
.gp-sec { margin: 16px 0 8px; font-size: .78rem; font-weight: 800; letter-spacing: .08em;
  color: var(--muted); text-transform: uppercase; border-bottom: 1px solid var(--line);
  padding-bottom: 5px; }
.gp-state { font-size: .84rem; padding: 5px 0; color: var(--muted); }
.gp-state b { color: var(--accent); margin-right: 6px; }
.gp-state span { opacity: .7; margin-right: 6px; font-size: .76rem; }
.gp-rel { font-size: .86rem; padding: 7px 10px; margin: 4px 0; border: 1px solid var(--line);
  border-radius: 9px; cursor: pointer; transition: border-color .2s; }
.gp-rel:hover { border-color: var(--accent); }
.gp-rel span { color: var(--accent); font-weight: 700; margin-left: 4px; }
.gp-rel i { display: block; font-size: .76rem; color: var(--muted); font-style: normal; margin-top: 2px; }
.gp-link { font-size: .84rem; padding: 7px 10px; margin: 4px 0; border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent); border-radius: 0 8px 8px 0; }
.gp-link span { display: block; font-size: .74rem; color: var(--muted); }
.gp-ev { font-size: .84rem; padding: 6px 8px; margin: 3px 0; border-radius: 8px; cursor: pointer;
  color: var(--muted); transition: background .2s, color .2s; }
.gp-ev:hover { background: color-mix(in srgb, var(--panel) 90%, transparent); color: var(--ink); }
.gp-ev span { color: var(--accent); font-size: .74rem; font-weight: 700; margin-right: 6px; }
@media (max-width: 720px) {
  #graph-panel { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto;
    max-height: min(72dvh, 540px); padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
    transform: translateY(calc(100% + 20px)); }
  #graph-panel.open { transform: translateY(0); }
  .gp-close { width: 44px; height: 44px; top: 8px; right: 8px; }
  .gp-kind { padding-right: 46px; }
  .gp-rel, .gp-ev { min-height: 44px; display: flex; flex-wrap: wrap; align-items: center; }
}

@media (hover: none) {
  .link-card:hover { transform: none; }
  .gp-rel:hover { border-color: var(--line); }
}

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