:root {
  color-scheme: dark;
  --bg: #08060a;
  --paper: #0c0a0c;
  --surface: #16120f;
  --ink: #f0e9da;
  --muted: #968a76;
  --line: rgba(199, 154, 75, 0.22);
  /* 오방색 — 미술관급 절제: 황(성장·구조), 청(회복), 주(위기) */
  --hwang: #b98e44;
  --cheong: #3f8a86;
  --ju: #c0473a;
  --baek: #f0e9da;
  --blue: var(--hwang);
  --green: var(--cheong);
  --red: var(--ju);
  --gold: #c79a4b;
  --shadow: 0 30px 100px rgba(0, 0, 0, 0.42);
  --serif: "Cormorant Garamond", "Times New Roman", serif;
  --hangul-serif: "Nanum Myeongjo", "Cormorant Garamond", serif;
  --display: "Noto Sans KR", "Inter", system-ui, sans-serif;
  --sans: "Inter", "Noto Sans KR", system-ui, sans-serif;
  --cursor-x: 50vw;
  --cursor-y: 50vh;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(199, 154, 75, 0.09), rgba(5, 7, 11, 0) 28%, rgba(63, 138, 134, 0.05)),
    linear-gradient(180deg, #030508 0%, var(--bg) 42%, #080d14 100%);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.72;
}

body::before {
  position: fixed;
  top: 0;
  bottom: 0;
  left: var(--cursor-x);
  z-index: 4;
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(232, 222, 202, 0.22), transparent);
  pointer-events: none;
  opacity: 0;
  transition: opacity 180ms ease;
  content: "";
}

body.has-pointer::before {
  opacity: 0.5;
}

body::after {
  position: fixed;
  inset: 0;
  z-index: 2;
  background:
    radial-gradient(circle at var(--cursor-x) var(--cursor-y), rgba(232, 222, 202, 0.1), rgba(199, 154, 75, 0.035) 11rem, transparent 25rem);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
  content: "";
}

body.has-pointer::after {
  opacity: 1;
}

button,
a {
  font: inherit;
}

button {
  color: inherit;
}

a {
  color: var(--blue);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* 한지(韓紙) 결 — 차가운 그리드 위에 은은한 따뜻한 섬유 톤을 얹습니다. */
.paper-texture {
  position: fixed;
  inset: 0;
  z-index: 1;
  background-image:
    radial-gradient(circle at 18% 12%, rgba(242, 200, 91, 0.035), transparent 38%),
    radial-gradient(circle at 84% 82%, rgba(242, 200, 91, 0.028), transparent 42%),
    repeating-linear-gradient(94deg, rgba(244, 232, 208, 0.022) 0 1px, transparent 1px 6px),
    repeating-linear-gradient(0deg, rgba(199, 154, 75, 0.045) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(90deg, rgba(240, 233, 218, 0.02) 0 1px, transparent 1px 7px);
  opacity: 0.34;
  pointer-events: none;
}

.loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 26px;
  background:
    radial-gradient(circle at 50% 42%, rgba(199, 154, 75, 0.08), transparent 60%),
    #030508;
  color: var(--ink);
  text-align: center;
  transition: opacity 520ms ease, visibility 520ms ease;
}

.loader-mark {
  font-family: var(--display);
  font-size: clamp(4rem, 15vw, 9.5rem);
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: 0;
}

.loader-line {
  width: min(340px, 70vw);
  height: 2px;
  overflow: hidden;
  background: rgba(199, 154, 75, 0.16);
}

.loader-line span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--blue);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 220ms cubic-bezier(0.33, 1, 0.68, 1);
}

.loader p {
  margin: 0;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

body.is-ready .loader {
  visibility: hidden;
  opacity: 0;
}

.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 60;
  width: 100%;
  height: 3px;
  background: var(--blue);
  transform: scaleX(0);
  transform-origin: left;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 24px;
  padding: 18px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid rgba(232, 222, 202, 0.08);
  background: rgba(3, 5, 8, 0.62);
  backdrop-filter: blur(22px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  color: rgba(240, 233, 218, 0.84);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0;
  text-decoration: none;
}

.topbar-meta {
  margin-left: auto;
  border-left: 1px solid rgba(232, 222, 202, 0.12);
  padding-left: 18px;
  color: rgba(127, 140, 163, 0.82);
  font-size: 0.78rem;
  font-weight: 800;
}

/* 낙관(落款) 도장형 마크 — 사건 인장 마커와 같은 시각 언어 */
.brand-seal {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1.5px solid var(--ju);
  border-radius: 2px;
  background: rgba(192, 71, 58, 0.16);
  color: var(--ju);
  font-family: var(--hangul-serif);
  font-size: 0.92rem;
  font-weight: 800;
  transform: rotate(-3deg);
}

.brand-word {
  display: inline-grid;
  line-height: 1.18;
}

.brand-word b {
  font-family: var(--hangul-serif);
  font-size: 0.96rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.brand-word i {
  color: rgba(150, 138, 118, 0.92);
  font-size: 0.62rem;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.22em;
}

main {
  position: relative;
  z-index: 3;
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: calc(100svh - 66px);
  padding: clamp(64px, 9vw, 112px) 0 72px;
}

.hero::before {
  position: absolute;
  top: clamp(88px, 13vw, 150px);
  right: clamp(4px, 5vw, 82px);
  width: 1px;
  height: clamp(180px, 28vw, 360px);
  background: linear-gradient(180deg, transparent, rgba(240, 233, 218, 0.26), transparent);
  opacity: 0.76;
  content: "";
}

/* 세로쓰기 한국어 악센트 — 은은한 전통 낙관(落款) 느낌 */
.hero::after {
  position: absolute;
  top: clamp(88px, 13vw, 150px);
  right: clamp(16px, 6vw, 104px);
  color: rgba(242, 200, 91, 0.32);
  font-family: var(--hangul-serif);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.32em;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  pointer-events: none;
  content: "코스피 · 기록의 벽";
}

@media (max-width: 620px) {
  .hero::after {
    display: none;
  }
}

.hero-mast {
  position: relative;
  z-index: 2;
  width: min(1180px, 100%);
}

.hero-code,
.hero-subline,
.eyebrow,
.section-kicker {
  margin: 0;
  color: rgba(107, 229, 164, 0.86);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-code {
  display: inline-flex;
  border-bottom: 1px solid rgba(232, 222, 202, 0.18);
  padding-bottom: 8px;
  color: rgba(240, 233, 218, 0.72);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 1120px;
  margin: 24px 0 0;
  font-family: var(--display);
  font-size: clamp(4.1rem, 11vw, 10.8rem);
  font-weight: 700;
  line-height: 0.92;
  letter-spacing: 0;
}

h1 span {
  display: block;
}

.hero-subline {
  width: min(760px, 100%);
  margin-top: 28px;
  border-top: 1px solid rgba(232, 222, 202, 0.16);
  padding-top: 16px;
  color: rgba(240, 233, 218, 0.78);
  font-family: var(--sans);
  font-size: clamp(1rem, 1.35vw, 1.22rem);
  line-height: 1.8;
  text-transform: none;
}

.hero-visual {
  position: relative;
  z-index: 1;
  margin: clamp(42px, 7vw, 84px) 0 0;
}

.hero-visual svg {
  display: block;
  width: 100%;
  max-height: 46svh;
  border-top: 1px solid rgba(232, 222, 202, 0.1);
  border-bottom: 1px solid rgba(232, 222, 202, 0.08);
  background:
    radial-gradient(circle at 82% 30%, rgba(232, 222, 202, 0.08), transparent 24%),
    rgba(8, 13, 20, 0.28);
}

.hero-visual figcaption {
  margin-top: 12px;
  color: rgba(127, 140, 163, 0.82);
  font-size: 0.92rem;
  text-align: right;
}

.hero-signal-shadow,
.hero-signal {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hero-signal-shadow {
  stroke: rgba(199, 154, 75, 0.09);
  stroke-width: 8;
}

.hero-signal {
  stroke: url("#signalGradient");
  stroke-width: 2;
  stroke-dasharray: 1700;
  stroke-dashoffset: 1700;
  animation: drawLine 1800ms 650ms cubic-bezier(0.33, 1, 0.68, 1) forwards;
}

.hero-event circle {
  fill: #060b12;
  stroke-width: 2;
}

.hero-event-crisis circle {
  stroke: var(--red);
}

.hero-event-growth circle {
  stroke: var(--green);
}

.hero-event text {
  fill: var(--ink);
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 700;
}

.hero-bottom {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(520px, 620px);
  gap: clamp(42px, 7vw, 96px);
  align-items: start;
  margin-top: clamp(42px, 6vw, 72px);
}

.lead {
  max-width: 720px;
  color: #b9c6d8;
  font-size: clamp(1.02rem, 1.45vw, 1.22rem);
  line-height: 1.95;
  word-break: keep-all;
}

.market-pulse {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid rgba(232, 222, 202, 0.18);
  border-bottom: 1px solid rgba(232, 222, 202, 0.08);
}

.market-pulse > div {
  min-height: 128px;
  border-right: 1px solid rgba(232, 222, 202, 0.08);
  padding: 20px 18px 22px;
}

.market-pulse > div:last-child {
  border-right: 0;
}

.metric-label {
  display: block;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.5;
}

.market-pulse strong {
  display: block;
  color: var(--ink);
  font-family: var(--display);
  font-size: clamp(1.55rem, 2.6vw, 2.7rem);
  line-height: 1.08;
}

.market-pulse small {
  display: block;
  margin-top: 10px;
  color: var(--muted);
}

.chapter-wrap {
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  border-top: 1px solid rgba(232, 222, 202, 0.1);
  border-bottom: 1px solid rgba(232, 222, 202, 0.08);
  background:
    linear-gradient(90deg, rgba(199, 154, 75, 0.035), transparent 36%, rgba(63, 138, 134, 0.022)),
    rgba(3, 5, 8, 0.45);
}

.chapter-index {
  position: sticky;
  top: 86px;
  z-index: 4;
  display: flex;
  justify-content: flex-end;
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding-top: 20px;
  pointer-events: none;
}

.chapter-index span {
  border: 0;
  border-top: 1px solid rgba(232, 222, 202, 0.14);
  border-radius: 0;
  padding: 8px 0 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.story-chapter {
  position: relative;
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(0, 1fr);
  gap: clamp(28px, 6vw, 88px);
  align-items: center;
  width: min(1480px, calc(100% - 32px));
  min-height: 72svh;
  margin: 0 auto;
  border-bottom: 1px solid rgba(232, 222, 202, 0.08);
  padding: clamp(72px, 10vw, 132px) 0;
  opacity: 0.34;
  transition: opacity 360ms ease;
}

.story-chapter.is-current {
  opacity: 1;
}

.story-chapter:last-child {
  border-bottom: 0;
}

.chapter-word {
  color: transparent;
  font-family: var(--display);
  font-size: clamp(4rem, 11vw, 12rem);
  font-weight: 700;
  line-height: 0.92;
  -webkit-text-stroke: 1px rgba(232, 222, 202, 0.18);
  text-stroke: 1px rgba(232, 222, 202, 0.18);
}

.story-chapter h2 {
  max-width: 740px;
  margin: 10px 0 20px;
  font-family: var(--display);
  font-size: clamp(2rem, 4.4vw, 4.7rem);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: 0;
  word-break: keep-all;
}

.story-chapter p:not(.section-kicker) {
  max-width: 690px;
  margin: 0;
  color: #aebacd;
  font-size: clamp(1.02rem, 1.5vw, 1.18rem);
  line-height: 1.95;
  word-break: keep-all;
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  padding: 42px 0 36px;
}

.detail-panel {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.chart-panel {
  position: relative;
  min-width: 0;
  overflow: hidden;
  min-height: calc(100svh - 40px);
  border-top: 1px solid rgba(199, 154, 75, 0.38);
  border-bottom: 1px solid rgba(199, 154, 75, 0.16);
  background:
    radial-gradient(circle at 74% 28%, rgba(199, 154, 75, 0.075), transparent 34%),
    radial-gradient(circle at 23% 58%, rgba(63, 138, 134, 0.055), transparent 28%),
    linear-gradient(180deg, rgba(11, 17, 27, 0.88), rgba(5, 7, 11, 0.96)),
    repeating-linear-gradient(90deg, rgba(199, 154, 75, 0.026) 0 1px, transparent 1px 72px);
  padding: clamp(26px, 3.2vw, 46px) 0 12px;
}

.chart-panel::before,
.chart-panel::after {
  position: absolute;
  top: 112px;
  bottom: 0;
  z-index: 3;
  width: min(9vw, 110px);
  pointer-events: none;
  content: "";
}

.chart-panel::before {
  left: 0;
  background: linear-gradient(90deg, var(--bg), rgba(5, 7, 11, 0));
}

.chart-panel::after {
  right: 0;
  background: linear-gradient(270deg, var(--bg), rgba(5, 7, 11, 0));
}

.panel-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.chart-panel .panel-heading,
.ticker-tape {
  width: min(1480px, calc(100% - 32px));
  margin-right: auto;
  margin-left: auto;
}

.panel-heading h2,
.detail-panel h2,
.signal-console h2 {
  margin-bottom: 0;
  font-family: var(--display);
  font-size: clamp(1.5rem, 2vw, 2.25rem);
  font-weight: 700;
  line-height: 1.28;
  word-break: keep-all;
}

.data-note {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.data-note {
  border-left: 1px solid rgba(199, 154, 75, 0.38);
  padding: 4px 0 4px 12px;
}

.chart-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.chart-scroll {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  margin-top: 28px;
  height: clamp(760px, calc(100svh - 158px), 960px);
  min-height: 760px;
  border-top: 1px solid rgba(199, 154, 75, 0.1);
  border-bottom: 1px solid rgba(199, 154, 75, 0.1);
  padding: 4px 0 0;
  cursor: grab;
  mask-image: linear-gradient(90deg, transparent, black 4%, black 96%, transparent);
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  user-select: none;
}

/* 창살(창호) 격자 — 굵은 살 + 가는 살의 한국 전통 창 결을 은은히 */
.chart-scroll::before {
  position: absolute;
  inset: 4px 0 0;
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(242, 200, 91, 0.05) 0 1.4px, transparent 1.4px 100%),
    linear-gradient(180deg, rgba(242, 200, 91, 0.035) 0 1.4px, transparent 1.4px 100%),
    linear-gradient(90deg, rgba(240, 233, 218, 0.045) 0 1px, transparent 1px 100%),
    linear-gradient(180deg, rgba(240, 233, 218, 0.03) 0 1px, transparent 1px 100%);
  background-size: 360px 100%, 100% 276px, 120px 100%, 100% 92px;
  opacity: 0.5;
  pointer-events: none;
  content: "";
}

.chart-scroll.is-dragging {
  cursor: grabbing;
}

.chart-scroll::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.signal-console {
  position: absolute;
  top: clamp(160px, 17svh, 210px);
  right: clamp(16px, 4vw, 64px);
  z-index: 5;
  display: grid;
  gap: 12px;
  width: min(520px, calc(100% - 32px));
  max-height: none;
  border-top: 1px solid rgba(199, 154, 75, 0.24);
  border-bottom: 1px solid rgba(199, 154, 75, 0.12);
  border-left: 1px solid rgba(199, 154, 75, 0.28);
  padding: 18px 0 18px 22px;
  background:
    linear-gradient(90deg, rgba(3, 5, 8, 0.96), rgba(3, 5, 8, 0.58)),
    linear-gradient(180deg, rgba(199, 154, 75, 0.055), rgba(199, 154, 75, 0));
  box-shadow: none;
  backdrop-filter: blur(18px);
  pointer-events: none;
}

.signal-console.is-left {
  right: auto;
  left: clamp(16px, 4vw, 64px);
  border-right: 1px solid rgba(199, 154, 75, 0.28);
  border-left: 0;
  padding-right: 22px;
  padding-left: 0;
  background:
    linear-gradient(270deg, rgba(3, 5, 8, 0.96), rgba(3, 5, 8, 0.58)),
    linear-gradient(180deg, rgba(199, 154, 75, 0.055), rgba(199, 154, 75, 0));
}

.signal-console[hidden] {
  display: none;
}

.signal-console-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.5;
}

.signal-console-head span {
  color: var(--blue);
}

.signal-console #detail-date {
  margin: 0;
}

.signal-console .detail-signal {
  margin: 0;
  color: var(--ink);
  font-family: var(--hangul-serif);
  font-size: clamp(2rem, 3vw, 3.1rem);
  font-weight: 700;
  line-height: 1.22;
  word-break: keep-all;
}

.signal-console #detail-title {
  margin: 0;
}

.signal-console #detail-copy {
  margin: 4px 0 0;
  font-size: 0.98rem;
  line-height: 1.82;
}

.signal-console .detail-stats {
  margin-top: 12px;
}

.signal-console .detail-stats dd {
  font-size: 1.38rem;
}

.chart-moment-card {
  display: grid;
  gap: 7px;
  width: 100%;
  border: 0;
  border-top: 1px solid rgba(199, 154, 75, 0.22);
  border-radius: 0;
  padding: 14px 0 0;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  text-align: left;
  pointer-events: none;
}

.chart-moment-card span:first-child,
.chart-moment-card em {
  color: var(--muted);
  font-size: 0.8rem;
  font-style: normal;
  font-weight: 700;
  line-height: 1.5;
}

.chart-moment-card strong {
  display: block;
  font-size: 1rem;
  line-height: 1.5;
}

.chart-moment-card span:last-child {
  display: block;
  color: #aebacd;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.72;
  word-break: keep-all;
}

.chart-wrap {
  position: relative;
  z-index: 2;
  width: 3600px;
  min-height: 860px;
}

#kospi-chart {
  display: block;
  width: 3600px;
  height: 860px;
  overflow: visible;
}

.chart-tooltip {
  display: none;
}

.chart-tooltip strong {
  display: block;
  margin-bottom: 3px;
}

.ticker-tape {
  display: none;
  gap: 12px;
  overflow: hidden;
  border-top: 1px solid rgba(199, 154, 75, 0.18);
  padding-top: 14px;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 0.98rem;
  font-weight: 600;
  mask-image: linear-gradient(90deg, transparent, black 12%, black 88%, transparent);
  white-space: nowrap;
}

.ticker-tape span {
  flex: 0 0 auto;
  animation: tapeDrift 18s linear infinite;
}

.console-floor {
  display: none;
}

.detail-panel {
  position: relative;
  top: auto;
  display: block;
  min-height: auto;
  border-right: 1px solid rgba(199, 154, 75, 0.22);
  padding: 6px clamp(22px, 3vw, 42px) 10px 0;
}

.detail-signal {
  margin: 20px 0 14px;
  color: var(--ink);
  font-family: var(--hangul-serif);
  font-size: clamp(2rem, 4.2vw, 4rem);
  font-weight: 700;
  line-height: 1.2;
  word-break: keep-all;
}

#detail-date {
  margin: 12px 0 20px;
  color: var(--blue);
  font-weight: 800;
}

#detail-copy {
  color: #aebacd;
  line-height: 1.86;
  word-break: keep-all;
}

.detail-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 26px 0 0;
}

.detail-stats div {
  border-top: 1px solid rgba(199, 154, 75, 0.22);
  padding-top: 14px;
}

.detail-stats dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.5;
}

.detail-stats dd {
  margin: 6px 0 0;
  font-family: var(--display);
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.35;
}

.sources {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  border-top: 1px solid rgba(232, 222, 202, 0.08);
  padding: 24px clamp(18px, 4vw, 56px) 56px;
  background: rgba(3, 5, 8, 0.72);
}

.sources p {
  max-width: 980px;
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.9;
}

.moment-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
}

.moment-modal[hidden] {
  display: none;
}

.modal-scrim {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.64);
  cursor: pointer;
}

/* 사주단변(四周單邊) — 전통 기록물의 사면 테두리 프레임 */
.modal-sheet {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  border: 1px solid rgba(199, 154, 75, 0.42);
  border-radius: 2px;
  padding: clamp(28px, 5vw, 46px);
  background:
    linear-gradient(180deg, rgba(22, 18, 15, 0.98), rgba(10, 8, 8, 0.98));
  box-shadow: 0 30px 110px rgba(0, 0, 0, 0.64);
}

.modal-sheet::before {
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(199, 154, 75, 0.2);
  border-radius: 1px;
  pointer-events: none;
  content: "";
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(8, 13, 20, 0.92);
  color: var(--ink);
  cursor: pointer;
}

.modal-signal {
  margin: 18px 0 10px;
  font-family: var(--hangul-serif);
  font-size: clamp(2.4rem, 6vw, 5rem);
  font-weight: 800;
  line-height: 1.04;
  word-break: keep-all;
}

.modal-sheet h2 {
  margin-bottom: 16px;
}

#modal-copy {
  color: #b9c6d8;
  font-size: 1.05rem;
  line-height: 1.76;
  word-break: keep-all;
}

.modal-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 30px 0 0;
}

.modal-stats div {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.modal-stats dt {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.modal-stats dd {
  margin: 6px 0 0;
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 700;
}

.grid-line {
  stroke: rgba(199, 154, 75, 0.085);
  stroke-width: 0.62;
}

.axis-label {
  fill: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.area-fill {
  fill: url("#chartFill");
  opacity: 0.88;
}

body:not([data-filter-mode="all"]) .area-fill {
  opacity: 0.34;
}

.path-shadow {
  fill: none;
  stroke: rgba(199, 154, 75, 0.075);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.path-line {
  fill: none;
  stroke: var(--blue);
  stroke-dasharray: 3600;
  stroke-dashoffset: 3600;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.65;
  animation: drawLine 1400ms 220ms cubic-bezier(0.33, 1, 0.68, 1) forwards;
}

body:not([data-filter-mode="all"]) .path-line {
  opacity: 0.48;
}

/* 낙관(印章) 사건 마커 — 비어 있는 주(朱) 사각, 선택 시 "찍히는" 도장 */
.chart-point {
  fill: transparent;
  stroke: var(--blue);
  stroke-width: 1.4;
  cursor: pointer;
  transform-box: fill-box;
  transform-origin: center;
  transition: fill 160ms ease, stroke 160ms ease, opacity 160ms ease,
    filter 160ms ease, transform 160ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chart-cursor-line {
  opacity: 0;
  stroke: rgba(240, 233, 218, 0.32);
  stroke-dasharray: 3 8;
  stroke-width: 0.8;
  transition: opacity 140ms ease;
  pointer-events: none;
}

.chart-cursor-line.is-visible {
  opacity: 1;
}

.chart-point.crisis {
  stroke: var(--red);
}

.chart-point.recovery {
  stroke: var(--green);
}

.chart-point.growth {
  stroke: var(--blue);
}

.chart-point.is-selected,
.chart-point:hover {
  fill: currentColor;
  stroke: currentColor;
  filter: drop-shadow(0 0 6px currentColor);
  transform: scale(1.75) rotate(-4deg);
}

.chart-point.is-filter-match {
  fill: currentColor;
  opacity: 1;
  filter: drop-shadow(0 0 7px currentColor);
  transform: scale(1.5);
}

.chart-point.is-filtered-out {
  opacity: 0.14;
  transform: scale(0.88);
}

.event-label {
  fill: var(--ink);
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  transition: opacity 160ms ease;
  pointer-events: none;
}

.event-label.is-selected {
  opacity: 1;
}

.event-label.is-filter-match {
  opacity: 0.58;
}

.event-label.is-selected {
  opacity: 1;
}

@keyframes drawLine {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes tapeDrift {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(-220px);
  }
}

.chart-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.filter-chips {
  display: inline-flex;
  gap: 6px;
}

.nav-chip {
  border: 1px solid rgba(199, 154, 75, 0.28);
  border-radius: 999px;
  padding: 7px 15px;
  background: rgba(8, 13, 20, 0.6);
  color: rgba(240, 233, 218, 0.74);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.nav-chip:hover {
  color: var(--ink);
  border-color: rgba(199, 154, 75, 0.55);
}

.nav-chip.is-active {
  border-color: var(--blue);
  background: rgba(199, 154, 75, 0.16);
  color: var(--ink);
}

.tour-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(63, 138, 134, 0.4);
  border-radius: 999px;
  padding: 7px 16px;
  background: rgba(8, 13, 20, 0.6);
  color: rgba(240, 233, 218, 0.84);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.tour-btn:hover {
  border-color: var(--green);
  color: var(--ink);
}

.tour-icon {
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 8px solid var(--green);
}

.tour-btn.is-playing {
  border-color: var(--green);
  background: rgba(63, 138, 134, 0.16);
  color: var(--ink);
}

.tour-btn.is-playing .tour-icon {
  width: 8px;
  height: 10px;
  border: 0;
  background: linear-gradient(90deg, var(--green) 0 35%, transparent 35% 65%, var(--green) 65% 100%);
}

.chart-hint {
  width: min(1480px, calc(100% - 32px));
  margin: 14px auto 0;
  color: rgba(127, 140, 163, 0.78);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-align: center;
}

.chart-minimap {
  position: relative;
  z-index: 4;
  width: min(1480px, calc(100% - 32px));
  margin: 14px auto 0;
  border-top: 1px solid rgba(199, 154, 75, 0.16);
  padding-top: 12px;
}

#kospi-minimap {
  display: block;
  width: 100%;
  height: 78px;
  cursor: pointer;
  touch-action: none;
}

.minimap-area {
  fill: rgba(199, 154, 75, 0.1);
}

.minimap-line {
  fill: none;
  stroke: rgba(199, 154, 75, 0.62);
  stroke-width: 1.4;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.minimap-window {
  fill: rgba(240, 233, 218, 0.12);
  stroke: rgba(240, 233, 218, 0.5);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.minimap-marker {
  stroke: var(--blue);
  stroke-width: 1.4;
  vector-effect: non-scaling-stroke;
}

.phase-band {
  opacity: 0;
  transition: opacity 220ms ease;
  pointer-events: none;
}

.phase-band-crisis {
  fill: var(--red);
}

.phase-band-recovery {
  fill: var(--green);
}

.phase-band-growth {
  fill: var(--blue);
}

body[data-filter-mode="crisis"] .phase-band-crisis,
body[data-filter-mode="recovery"] .phase-band-recovery,
body[data-filter-mode="growth"] .phase-band-growth {
  opacity: 0.09;
}

.level-line {
  stroke: rgba(199, 154, 75, 0.07);
  stroke-dasharray: 2 10;
}

.grid-line.baseline {
  stroke: rgba(199, 154, 75, 0.16);
}

.detail-stats .stat-up,
.modal-stats .stat-up {
  color: var(--green);
}

.detail-stats .stat-down,
.modal-stats .stat-down {
  color: var(--red);
}

/* 제너러티브 입자 레이어 */
#market-particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  opacity: 0.5;
  mix-blend-mode: screen;
  pointer-events: none;
}

/* 국면 컬러 워시 */
.phase-wash {
  position: fixed;
  inset: 0;
  z-index: 6;
  opacity: 0;
  pointer-events: none;
  background: radial-gradient(circle at var(--cursor-x, 50vw) var(--cursor-y, 50vh), currentColor, transparent 62%);
  color: var(--blue);
}

.phase-wash[data-phase="crisis"] {
  color: var(--red);
}

.phase-wash[data-phase="recovery"] {
  color: var(--green);
}

.phase-wash[data-phase="growth"] {
  color: var(--blue);
}

.phase-wash.is-on {
  animation: phaseWash 900ms ease-out;
}

@keyframes phaseWash {
  0% {
    opacity: 0;
  }

  22% {
    opacity: 0.32;
  }

  100% {
    opacity: 0;
  }
}

/* 시네마틱 투어 레터박스 */
.cinema-bars {
  position: fixed;
  inset: 0;
  z-index: 49;
  pointer-events: none;
}

.cinema-bars::before,
.cinema-bars::after {
  position: absolute;
  left: 0;
  width: 100%;
  height: 8vh;
  background: #020407;
  transform: scaleY(0);
  transition: transform 520ms cubic-bezier(0.33, 1, 0.68, 1);
  content: "";
}

.cinema-bars::before {
  top: 0;
  transform-origin: top;
}

.cinema-bars::after {
  bottom: 0;
  transform-origin: bottom;
}

body.is-touring .cinema-bars::before,
body.is-touring .cinema-bars::after {
  transform: scaleY(1);
}

body.is-touring .chart-panel {
  box-shadow: inset 0 0 180px rgba(199, 154, 75, 0.16);
}

body.is-touring .signal-console {
  box-shadow: 0 0 60px rgba(199, 154, 75, 0.22);
}

/* 라인을 따라 흐르는 빛 */
.path-glow {
  fill: none;
  stroke: rgba(240, 233, 218, 0.9);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-dasharray: 34 9000;
  filter: drop-shadow(0 0 7px rgba(199, 154, 75, 0.85));
  opacity: 0.85;
  pointer-events: none;
  animation: glowTravel 7.5s linear infinite;
}

@keyframes glowTravel {
  from {
    stroke-dashoffset: 0;
  }

  to {
    stroke-dashoffset: -9034;
  }
}

body:not([data-filter-mode="all"]) .path-glow {
  opacity: 0.3;
}

/* 선택 지점 펄스 링 */
.chart-pulse {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  pointer-events: none;
}

.chart-pulse.is-on {
  animation: chartPulse 900ms ease-out;
}

@keyframes chartPulse {
  0% {
    opacity: 0.85;
    transform: scale(0.35);
  }

  100% {
    opacity: 0;
    transform: scale(6);
  }
}

/* 카운트업 강조 */
.detail-stats dd.is-counting,
.modal-stats dd.is-counting,
.market-pulse strong.is-counting {
  color: #ffffff;
  text-shadow: 0 0 16px rgba(199, 154, 75, 0.55);
}

/* 스크롤 속도 반응 타이포 (히어로 제목 한정) */
h1 {
  letter-spacing: calc(var(--scroll-vel, 0) * 0.16em);
  transform: skewX(calc(var(--scroll-vel, 0) * -3deg));
  transition: letter-spacing 240ms ease, transform 240ms ease;
}

/* 대 타이틀은 은은한 화이트 아웃라인 톤 유지 */
.chapter-word {
  transition: -webkit-text-stroke-color 480ms ease;
}

.story-chapter.is-current .chapter-word {
  -webkit-text-stroke-color: rgba(240, 233, 218, 0.32);
  text-stroke-color: rgba(240, 233, 218, 0.32);
}

/* 과장된 인장 강조 — 도장이 깊게 찍힌 듯 */
.chart-point.is-selected,
.chart-point:hover {
  filter: drop-shadow(0 0 13px currentColor);
  transform: scale(2) rotate(-5deg);
}

.chart-point.is-filter-match {
  filter: drop-shadow(0 0 12px currentColor);
  transform: scale(1.7);
}

.event-label.is-selected {
  font-size: 15px;
  fill: #ffffff;
}

@media (pointer: coarse) {
  #market-particles,
  .phase-wash {
    display: none;
  }

  .cinema-bars::before,
  .cinema-bars::after {
    height: 5vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  #market-particles,
  .phase-wash,
  .path-glow {
    display: none;
  }

  h1,
  .chapter-word {
    transform: none;
    letter-spacing: 0;
  }
}

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

@media (max-width: 980px) {
  .chart-meta {
    justify-content: flex-start;
  }

  .chart-tools {
    width: 100%;
    margin-top: 12px;
  }
}

@media (max-width: 620px) {
  .filter-chips {
    flex-wrap: wrap;
  }

  #kospi-minimap {
    height: 60px;
  }

  .chart-hint {
    font-size: 0.74rem;
  }
}

@media (pointer: coarse) {
  body::before,
  body::after {
    display: none;
  }
}

@media (max-width: 980px) {
  .topbar,
  .hero-bottom,
  .dashboard,
  .panel-heading {
    display: block;
  }

  .topbar-meta {
    display: none;
  }

  .market-pulse {
    margin-top: 34px;
  }

  .story-chapter {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .chapter-index {
    top: 118px;
  }

  .detail-panel {
    position: static;
    display: block;
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(199, 154, 75, 0.22);
    padding-right: 0;
    padding-bottom: 24px;
  }

  .console-floor {
    display: none;
    grid-template-columns: 1fr;
  }

  .chart-panel {
    margin-bottom: 0;
    min-height: calc(100svh - 24px);
  }

  .signal-console {
    position: relative;
    top: auto;
    right: auto;
    width: min(100% - 32px, 620px);
    margin: 22px auto 0;
    padding-left: 0;
    border-left: 0;
    border-top: 1px solid rgba(199, 154, 75, 0.22);
  }

  .signal-console.is-left {
    left: auto;
    padding-right: 0;
    border-right: 0;
  }

  .data-note {
    display: inline-block;
    margin-top: 12px;
  }

  .chart-moment-card {
    position: static;
    width: 100%;
    margin: 0;
  }
}

@media (max-width: 620px) {
  main {
    width: min(100% - 24px, 1480px);
  }

  .topbar {
    padding: 14px 12px;
  }

  h1 {
    font-size: 5rem;
  }

  .hero {
    padding-top: 42px;
  }

  .hero-visual svg {
    max-height: none;
  }

  .market-pulse {
    grid-template-columns: 1fr;
  }

  .market-pulse > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .market-pulse > div:last-child {
    border-bottom: 0;
  }

  .detail-panel {
    padding: 18px;
  }

  .chart-panel {
    padding-top: 24px;
  }

  .chart-scroll {
    height: min(760px, calc(100svh - 118px));
    min-height: 720px;
  }

  .chart-wrap {
    min-height: 760px;
  }

  #kospi-chart {
    height: 760px;
  }

  .signal-console .detail-signal {
    font-size: clamp(1.65rem, 8vw, 2.4rem);
  }

  .modal-stats {
    grid-template-columns: 1fr;
  }

  .chapter-word {
    font-size: 4.2rem;
  }
}
