/* mrchaeplin.com
   기존 사이트(mrchaeplin.github.io)의 아이덴티티를 그대로 따른다:
   검정 배경 + GitHub 다크 계열 보더, Pretendard/Inter, 중앙 정렬 네비,
   전체 폭 에쿼티 곡선 아래 2단 분할(Posts / Dashboard).
   추가한 것: 손익 색(이익 초록, 손실 빨강), 다크/라이트 토글. */

/* Pretendard 가변폰트 self-host(v1.3.9). CDN(버전 미고정) 대신 static으로 직접 호스팅 —
   공급망 리스크 제거 + 제3자 출처 제거로 CSP 단순화. 한 파일로 100~900 전 굵기 커버. */
@font-face {
  font-family: 'Pretendard';
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  src: url("fonts/PretendardVariable.302ec55f5b43.woff2") format('woff2');
}

:root {
  /* 다크(기본): 기존 사이트(mrchaeplin.github.io)와 같은 검정 + GitHub 다크 계열 보더.
     라이트는 아래 :root[data-theme='light'] (theme.js 토글). 포인트는 블루, 소형 라벨은 샌드. */
  --bg: #000;
  --text: #e6edf3;
  --accent: #2f6bff;
  --sand: #d8cbb3;
  --border: #30363d;
  --dim: 0.78;
  --radius: 2px;
  --up: #3fb950;   /* 이익 = 초록 */
  --down: #f85149; /* 손실 = 빨강 */
  --card-bg: rgba(255, 255, 255, 0.045);
  --card-hover: rgba(255, 255, 255, 0.08);
  --box-bg: rgba(255, 255, 255, 0.02);
  --box-hover: rgba(255, 255, 255, 0.05);
  --card-border-hover: rgba(255, 255, 255, 0.2);
  --row-hover: rgba(255, 255, 255, 0.03);
  --tip-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  --sans: 'Pretendard', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  /* 모바일 헤더·드로어(C안) 전용 */
  --m-bg: #0d0f12;
  --m-text: #e8eaed;
  --m-text-strong: #fff;
  --m-text-muted: #9aa3ad;
  --m-line: #2a3038;
  --m-line-soft: #232931;
  --m-panel: #12151a;
  color-scheme: dark;
}

/* 라이트(토글): 기존 사이트의 화이트 + GitHub 라이트 계열 보더.
   초록·빨강·샌드는 흰 배경에서도 읽히도록 진하게 쓴다. */
:root[data-theme='light'] {
  --bg: #fff;
  --text: #111;
  --border: #d0d7de;
  --sand: #6b5a3e;
  --up: #1a7f37;
  --down: #cf222e;
  --card-bg: rgba(0, 0, 0, 0.035);
  --card-hover: rgba(0, 0, 0, 0.06);
  --box-bg: rgba(0, 0, 0, 0.02);
  --box-hover: rgba(0, 0, 0, 0.04);
  --card-border-hover: rgba(0, 0, 0, 0.18);
  --row-hover: rgba(0, 0, 0, 0.03);
  --tip-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  --m-bg: #fff;
  --m-text: #1f2328;
  --m-text-strong: #000;
  --m-text-muted: #57606a;
  --m-line: #d0d7de;
  --m-line-soft: #eaeef2;
  --m-panel: #fff;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
  /* 같은 사이트 안 링크 이동을 흰 깜빡임 없이 크로스페이드로 잇는다.
     미지원 브라우저는 그냥 평소처럼 넘어간다. */
  @view-transition {
    navigation: auto;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.7;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

a {
  color: inherit;
  text-decoration: none;
}
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius);
}

.up {
  color: var(--up);
}
.down {
  color: var(--down);
}
.empty {
  opacity: 0.4;
  font-size: 0.9rem;
}

/* ── 헤더 ──────────────────────────────────────────────── */
.site-header {
  position: relative;
  z-index: 100;
  background: var(--bg);
}
.nav {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  margin: 0; /* 홈에서는 h1으로 들어온다 */
  font-family: var(--mono);
  font-size: clamp(1.15rem, 0.9rem + 1.1vw, 1.75rem);
  font-weight: 700;
  letter-spacing: 0.04em; /* 모노는 자간을 벌려야 워드마크로 읽힌다 */
  white-space: nowrap;
}
.nav-links {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  pointer-events: none;
}
.nav-links a {
  pointer-events: auto;
}
.lang-switch {
  display: flex;
  gap: 0.15rem;
}
.lang-switch form {
  display: contents;
} /* 버튼마다 폼이 따로라도 배치는 그대로 */
.lang-switch button {
  padding: 0.35rem 0.45rem;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  opacity: 0.5;
  cursor: pointer;
}
.lang-switch button:hover,
.lang-switch button[aria-pressed='true'] {
  opacity: 1;
}
/* KO·EN + 테마 버튼을 한 묶음으로: .nav의 space-between이 둘을 벌려 놓지 않게 */
.nav-tools {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: auto;
  height: 2rem;
  padding: 0 0 0 0.35rem; /* 오른쪽 여백 0: 아이콘 끝 = 헤더 오른쪽 세로선 */
  border: none;
  border-radius: var(--radius);
  background: none;
  color: inherit;
  opacity: 0.6;
  cursor: pointer;
}
.theme-toggle:hover {
  opacity: 1;
}
.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* 지금 테마의 아이콘만 보인다: 다크=달, 라이트=해 */
.theme-toggle .icon-sun,
:root[data-theme='light'] .theme-toggle .icon-moon {
  display: none;
}
:root[data-theme='light'] .theme-toggle .icon-sun {
  display: block;
}
.nav-links a {
  position: relative;
  padding: 0.5rem 0;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.015em;
  opacity: var(--dim);
}
.nav-links a:hover {
  opacity: 1;
}
.nav-links a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 100%;
  height: 2px;
  background: currentColor;
  opacity: 0;
  transform: scaleX(0);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.nav-links a.active {
  opacity: 1;
}
.nav-links a.active::after {
  opacity: 1;
  transform: scaleX(1);
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}

/* ── 히어로: 탭 줄 + 에쿼티 곡선 ────────────────────────── */
.hero-area {
  padding: 0 1.5rem;
}
/* 홈 탭 줄(_tab_bar.html, 대시보드와 같은 것)의 자리.
   헤더(.nav)와 같은 기준선: 1000px 상자에서 좌우 1.5rem 안쪽. 창 폭과 무관하게 일치 */
.toggles {
  max-width: calc(1000px - 3rem);
  margin: clamp(1.5rem, 6vh, 3rem) auto -0.25rem;
}
.toggles .dash-bar {
  margin: 0;
}
.hero-curve {
  max-width: calc(1000px - 3rem); /* .toggles 와 같은 상자 → 곡선 양 끝 = 탭 줄 양 끝 */
  margin: 0 auto;
}
.home-banner {
  max-width: calc(1000px - 3rem); /* 곡선과 같은 폭 */
  margin: 0 auto;
}

/* 곡선 그림은 1200 폭 안에서 양옆 40씩 비우고 그린다(PAD_X). 상자를 그 비율만큼 바깥으로 넓혀
   곡선의 시작·끝이 부모 상자의 왼쪽·오른쪽 끝(= 로고·탭 글자 세로선)과 정확히 겹치게 한다. 1200/1120 = 15/14 */
.hero-line-wrap {
  position: relative;
  width: calc(100% * 15 / 14);
  margin-left: calc(-100% / 28);
  color: var(--text); /* 곡선·면적·축 글자가 모두 이 색(currentColor)을 따른다 */
}
.hero-line {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.line-main {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  opacity: 0.95;
}
.line-shadow {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  opacity: 0.15;
  filter: blur(1px);
  transform: translateY(1.5px);
}
.line-area {
  fill: currentColor;
  opacity: 0.05;
  stroke: none;
}
.zero-baseline {
  stroke: currentColor;
  stroke-width: 1;
  opacity: 0.12;
  stroke-dasharray: 5 5;
}
.x-axis-labels {
  font-size: 13px; /* 기본값. JS(chart.js fitLabels)가 실제 폭에 맞춰 이 값을 다시 계산해 화면에서 약 11px로 보이게 한다 */
}
.x-axis-labels text {
  fill: currentColor;
  opacity: 0.45;
  letter-spacing: 0.02em;
}

/* 호버 인디케이터 — 커서를 따라가는 크로스헤어와 점 */
.hover-overlay {
  fill: transparent;
}
.hover-vline {
  stroke: currentColor;
  stroke-width: 1;
  stroke-dasharray: 4 4;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.08s ease;
}
.hover-dot {
  fill: var(--bg);
  stroke: currentColor;
  stroke-width: 2;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.08s ease;
}
.is-hovering .hover-vline,
.is-hovering .hover-dot {
  opacity: 1;
}

.equity-tooltip {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: var(--tip-shadow);
  z-index: 10;
}
.equity-tooltip[hidden] {
  display: none;
}
.tt-pnl {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}
.tt-meta {
  font-size: 0.7rem;
  opacity: 0.4;
  line-height: 1;
}

/* ── 홈 아래: Posts (실적 곡선 아래, 전체 폭) ───────────────── */
.home-split {
  padding: 0 1.5rem clamp(2rem, 6vh, 4rem);
  margin-top: clamp(2rem, 6vh, 3.5rem);
}
.home-split-inner {
  /* 헤더(.nav)·탭 줄과 같은 기준선: 1000px 상자에서 좌우 1.5rem 안쪽 */
  max-width: calc(1000px - 3rem);
  margin: 0 auto;
}

.section-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--sand);
  opacity: 0.7;
  margin: 0 0 1.5rem;
}
.section-label a:hover {
  opacity: 1;
}

/* 홈 실적 제목 줄: DASHBOARD (왼쪽) … 자세히 보기 → (오른쪽 끝, 탭 줄 오른쪽 선과 같은 선) */
.home-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
  margin-bottom: 0.9rem;
}
.home-head .section-label {
  margin: 0;
}
.home-more {
  margin-left: auto;
  white-space: nowrap;
}
.home-empty {
  margin: 1.5rem 0 0;
}

.recent-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
}
.recent-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}
.recent-item:first-child {
  border-top: 1px solid var(--border);
}
.recent-title {
  font-size: 0.95rem;
  font-weight: 500;
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recent-title:hover {
  opacity: 1;
}
.recent-date {
  font-size: 0.75rem;
  opacity: 0.4;
  flex-shrink: 0;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}
.metric-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1.1rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--box-bg);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.metric-card:hover {
  background: var(--box-hover);
  border-color: var(--card-border-hover);
}
.metric-value {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}
.metric-label {
  font-size: 0.72rem;
  opacity: 0.5;
  letter-spacing: 0.02em;
}

/* ── 하위 페이지 ───────────────────────────────────────── */
.page-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 1.5rem;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0 0 1.5rem;
}
.tabs a {
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.85rem;
  opacity: 0.4;
}
.tabs a:hover {
  opacity: 0.75;
}
.tabs a[aria-current] {
  opacity: 1;
  color: var(--text);
  background: rgba(47, 107, 255, 0.18); /* --accent(#2f6bff) 18% — 홈·대시보드 공통 선택 표시 */
}

/* 계정 탭(왼쪽)과 기간 탭(오른쪽)을 한 줄에. 좁아서 넘치면 기간 탭만 다음 줄 오른쪽으로 */
.dash-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1rem;
  margin: 0 0 1.5rem;
}
.dash-bar .tabs {
  margin: 0;
  align-items: center;
}
/* 버튼 높이를 글자 종류(한글·영문·숫자)와 무관하게 같게 → 두 탭 묶음의 세로 중앙이 일치 */
.dash-bar .tabs a {
  display: inline-flex;
  align-items: center;
  line-height: 1.4;
}
.label-short {
  display: none;
}
/* 버튼 안쪽 여백만큼 바깥으로 당겨, 첫 글자·마지막 글자가 아래 카드(홈은 헤더)의 세로선에 맞게 */
.dash-bar > .tabs:first-child {
  margin-left: -0.7rem;
}
.dash-bar .period-tabs {
  margin-left: auto;
  margin-right: -0.7rem; /* 글자 끝을 카드 오른쪽 선에 맞춘다(버튼 안쪽 여백만큼) */
}

.account-desc {
  opacity: 0.5;
  font-size: 0.9rem;
  margin: 0 0 1.5rem;
}

/* 열 너비는 값 길이와 상관없이 고정 비율(table-layout: fixed는 첫 줄 너비를 따른다).
   헤더와 값을 모두 가운데 정렬해 헤더가 그 열 값의 정중앙 위에 온다. */
.records {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
.records th:nth-child(1) { width: 27%; }
.records th:nth-child(2) { width: 29%; }
.records th:nth-child(3) { width: 20%; }
.records th:nth-child(4) { width: 24%; }
.records th,
.records td {
  padding: 0.7rem 0.5rem;
  text-align: center;
}
.records th[scope='row'] {
  font-weight: 500;
  white-space: nowrap;
  opacity: 0.85;
}
.records thead th {
  font-size: 0.72rem;
  font-weight: 500;
  opacity: 0.5;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--border);
}
.records tbody tr {
  border-bottom: 1px solid var(--border);
}
.records tbody tr:hover {
  background: var(--row-hover);
}

/* 일별 카드 */
.day-cards {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.day-card {
  border-left: 3px solid transparent;
  border-radius: var(--radius);
  background: var(--card-bg);
  font-variant-numeric: tabular-nums;
}
.day-card.is-up {
  border-left-color: var(--up);
  background: color-mix(in srgb, var(--up) 6%, var(--card-bg));
}
.day-card.is-down {
  border-left-color: var(--down);
  background: color-mix(in srgb, var(--down) 6%, var(--card-bg));
}
.day-row {
  display: grid;
  grid-template-columns: 6.5rem 9rem minmax(11rem, 1fr) 9.5rem 10rem;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 2.2rem 0.6rem 0.8rem;
  cursor: pointer;
  list-style: none;
  position: relative;
}
.day-row::-webkit-details-marker { display: none; }
.day-row::after {
  content: '';
  position: absolute;
  right: 0.9rem;
  top: 50%;
  width: 0.4rem;
  height: 0.4rem;
  margin-top: -0.3rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.5;
}
.day-card[open] > .day-row::after { transform: rotate(225deg); margin-top: -0.1rem; }
.day-row:hover { background: var(--row-hover); }
.day-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.side-cols { display: contents; }
.side-cols.narrow { display: none; }
.c1, .c2, .c4, .c5 { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.c1 { order: 1; } .c2 { order: 2; } .c3 { order: 3; } .c4 { order: 4; } .c5 { order: 5; }
.c1 b { font-weight: 600; }
.c1 small, .c2 small, .c4 small { font-size: 0.72rem; opacity: 0.6; }
.result { font-size: 0.78rem; font-weight: 600; }
.c2 b { font-size: 0.85rem; font-weight: 600; }
.marks { display: flex; align-items: center; gap: 3px; margin-top: 0.15rem; }
.rule-mark { width: 8px; height: 8px; border: 1px solid currentColor; opacity: 0.7; }
.rule-mark.kept { background: currentColor; }
.c3 { display: flex; flex-direction: column; gap: 0.3rem; }
.trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; text-align: center; }
.trio span { display: flex; flex-direction: column; }
.trio b { font-size: 1.05rem; font-weight: 700; white-space: nowrap; }
.trio small { font-size: 0.68rem; opacity: 0.55; }
.rule-verdict.ok { color: var(--up); }
.rule-verdict.bad { color: var(--down); }
.tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; min-height: 1rem; }
.tag {
  font-size: 0.66rem;
  line-height: 1.4;
  padding: 0 0.35rem;
  border-radius: var(--radius);
  background: var(--card-hover);
}
.tag.best { background: var(--accent); color: #fff; font-weight: 700; }
.tag.win_streak, .tag.loss_broken, .tag.recovered { color: var(--up); }
.tag.marker { color: var(--sand); }
.c4 .big, .c3 .big { font-size: 1.05rem; font-weight: 700; }
.sess, .pos-mini { list-style: none; margin: 0; padding: 0; font-size: 0.74rem; }
.sess li, .pos-mini li { display: flex; justify-content: space-between; gap: 0.5rem; }
.sess span { opacity: 0.6; }
.pos-mini { margin-top: 0.3rem; padding-top: 0.3rem; border-top: 1px solid var(--border); }
.pos-mini li { border-left: 2px solid transparent; padding-left: 0.3rem; }
.pos-mini li.is-up { border-left-color: var(--up); }
.pos-mini li.is-down { border-left-color: var(--down); }
.pos-mini .more { opacity: 0.5; }
.day-body { padding: 0.2rem 0.8rem 0.9rem; }
.day-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.5rem 1rem;
  margin: 0.25rem 0 0.75rem;
}
.day-stats div { display: flex; flex-direction: column; gap: 0.15rem; }
.day-stats dt { font-size: 0.72rem; opacity: 0.55; }
.day-stats dd { margin: 0; font-weight: 600; }
.day-sessions { font-size: 0.85rem; display: flex; flex-wrap: wrap; gap: 0.3rem 0.9rem; opacity: 0.85; }
.hero-line-wrap.is-day { width: 100%; margin: 0.6rem 0 0; }
.hero-line-wrap.is-day.is-up { color: var(--up); }
.hero-line-wrap.is-day.is-down { color: var(--down); }
.hero-line-wrap.is-day .x-axis-labels,
.hero-line-wrap.is-day .equity-tooltip { color: var(--text); fill: var(--text); }
.hero-line-wrap:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.session-line { stroke: var(--text); stroke-width: 1; opacity: 0.15; }
/* 세션 라벨은 그래프 위 띠에. SVG 안에 두면 선의 최고점과 겹친다 */
.session-band { position: relative; height: 16px; font-size: 11px; line-height: 16px; color: var(--text); }
.session-band span { position: absolute; top: 0; opacity: 0.5; white-space: nowrap; transform: translateX(-50%); }
.session-band span.start { transform: none; }
.session-band span.end { transform: translateX(-100%); }
.curve-total { position: absolute; top: 0; left: calc(100% / 30); z-index: 1; font-size: 0.8rem; opacity: 0.85; pointer-events: none; }
.curve-total b { font-weight: 700; }
.peak-mark { stroke: var(--bg); stroke-width: 2; }
.peak-mark.high { fill: var(--up); }
.peak-mark.low { fill: var(--down); }
.day-more { display: inline-block; margin-top: 0.6rem; font-size: 0.85rem; color: var(--accent); }
@media (max-width: 900px) {
  .day-row { grid-template-columns: 6rem 1fr; }
  .trio b { font-size: 0.95rem; }
  .day-row > .side-cols { display: none; }
  .side-cols.narrow {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
    gap: 0.8rem;
    padding: 0.5rem 0 0.7rem;
  }
}

/* 최근 전적 배너 */
.recent-banner {
  border-radius: var(--radius);
  background: var(--card-bg);
  padding: 0.7rem 1rem;
  margin: 1.25rem 0 1rem;   /* 위 곡선의 날짜 라벨이 SVG 밖으로 내려와도(모바일) 걸치지 않게 */
  font-variant-numeric: tabular-nums;
}
.recent-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 0.5rem; }
.recent-head h2 { font-size: 0.9rem; font-weight: 600; margin: 0; }
.recent-pick { display: flex; gap: 0.9rem; font-size: 0.85rem; }
.recent-pick a { opacity: 0.45; border-bottom: 2px solid transparent; }
.recent-pick a:hover { opacity: 0.75; }
.recent-pick a[aria-current] { opacity: 1; font-weight: 700; border-bottom-color: currentColor; }
.recent-body { display: grid; grid-template-columns: 3fr 2fr; align-items: start; }
.banner-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem 1rem;
  margin: 0;
  padding-right: 1.2rem;
}
.banner-stats div { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.banner-stats dt { font-size: 0.72rem; opacity: 0.55; }
.banner-stats dd { margin: 0; font-weight: 600; }
.sess-table {
  width: 100%;
  border-collapse: collapse;
  border-left: 1px solid var(--border);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}
.sess-table th, .sess-table td { padding: 0.15rem 0 0.15rem 1rem; text-align: right; font-weight: 500; }
.sess-table th:first-child { padding-left: 1.2rem; text-align: left; }
.sess-table thead th { font-size: 0.7rem; opacity: 0.5; }
@media (max-width: 900px) {
  .recent-body { grid-template-columns: 1fr; }
  .banner-stats { grid-template-columns: repeat(2, 1fr); padding-right: 0; }
  .sess-table { border-left: 0; border-top: 1px solid var(--border); margin-top: 0.7rem; }
  .sess-table thead th { padding-top: 0.5rem; }
  .sess-table th:first-child { padding-left: 0; }
}
/* 주 단위 머리글 */
.week-head {
  display: flex;
  gap: 0.8rem;
  font-size: 0.8rem;
  font-weight: 500;
  opacity: 0.7;
  margin: 0.9rem 0 0.2rem;
}
.week-head:first-child { margin-top: 0; }
/* 포지션 줄 */
.pos-list { list-style: none; padding: 0; margin: 0.5rem 0 0; display: flex; flex-direction: column; gap: 2px; }
.pos-row {
  display: grid;
  grid-template-columns: 5.2rem 3rem 4rem 1fr auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.6rem;
  border-left: 3px solid transparent;
  border-radius: var(--radius);
  background: var(--card-bg);
  font-size: 0.82rem;
}
.pos-row.is-up { border-left-color: var(--up); }
.pos-row.is-down { border-left-color: var(--down); }
.pos-time { opacity: 0.6; }
.side { font-size: 0.68rem; text-align: center; padding: 0 0.3rem; border-radius: var(--radius); background: var(--card-hover); }
.side.long { color: var(--up); }
.side.short { color: var(--down); }
.pos-hold { opacity: 0.6; }
.pos-net { font-weight: 600; text-align: right; }
@media (max-width: 480px) {
  .pos-row { grid-template-columns: 4.6rem 2.6rem 3.4rem 1fr auto; gap: 0.35rem; font-size: 0.78rem; }
}
.day-private {
  margin-top: 1rem;
  padding: 0.75rem;
  border-radius: var(--radius);
  background: var(--card-hover);
  font-size: 0.85rem;
}
.day-private h3 { margin: 0 0 0.4rem; font-size: 0.8rem; opacity: 0.6; }
.day-private a { color: var(--accent); }
.checklist { list-style: none; padding: 0; margin: 0 0 0.5rem; }
.checklist li { opacity: 0.55; }
.checklist li.kept { opacity: 1; color: var(--up); }
.day-private .tags span { margin-right: 0.4rem; opacity: 0.7; }
.back a { opacity: 0.6; font-size: 0.85rem; }

.prose {
  max-width: 40em;
  margin-inline: auto;
} /* 읽기 폭으로 좁히되 가운데 메뉴와 축을 맞춘다 */
.prose h1 {
  font-size: 1.6rem;
  letter-spacing: -0.02em;
  margin: 0 0 0.25rem;
}
.prose h2 {
  font-size: 1.05rem;
  margin: 2.5rem 0 0.5rem;
}
.prose p {
  opacity: 0.85;
}
.prose .meta {
  color: var(--sand);
  opacity: 0.75;
  font-size: 0.8rem;
  margin: 0 0 0.5rem;
}
/* 마크다운 본문 요소 — .post-body 안에서만. .post-body 전체에 걸면 태그·About 링크까지 들여쓰기·밑줄이 샌다 */
.post-body h3 {
  font-size: 0.95rem;
  margin: 2rem 0 0.5rem;
}
.post-body ul,
.post-body ol {
  opacity: 0.85;
  padding-left: 1.4em;
}
.post-body li + li {
  margin-top: 0.3em;
}
.post-body a {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.post-body blockquote {
  margin: 1.5rem 0;
  padding: 0 0 0 1rem;
  border-left: 2px solid var(--border);
  opacity: 0.7;
}
.post-body code {
  font-family: var(--mono);
  font-size: 0.85em;
  padding: 0.1em 0.35em;
  border-radius: var(--radius);
  background: var(--card-hover);
}
.post-body pre {
  overflow-x: auto;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
}
.post-body pre code {
  padding: 0;
  background: none;
}
.post-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
}
.post-body hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}
.post-body table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.post-body th,
.post-body td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
/* Posts 목록: 제목 아래 고정폭 태그 한 줄 + 글 목록. 로고와 같은 글꼴로 사이트 톤을 잇는다 */
.tagline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
  list-style: none;
  margin: 0 0 2.5rem;
  padding: 0 0 1.25rem;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.82rem;
}
.tagline a {
  opacity: 0.5;
}
.tagline a:hover {
  opacity: 1;
}
/* 현재 위치 = 흰색 + 밑줄. 상단 메뉴와 같은 규칙 (강조색을 따로 두지 않는다) */
.tagline a[aria-current='page'] {
  opacity: 1;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}
.tagline sup {
  display: inline-block;
  font-size: 0.7em;
  opacity: 0.6;
  margin-left: 0.15em;
} /* inline-block: 현재 태그 밑줄이 숫자까지 이어지지 않게 */
@media (max-width: 767px) {
  .tagline {
    gap: 0 1.25rem;
  }
  .tagline a {
    display: inline-block;
    padding: 0.6rem 0;
  }
} /* 터치 영역 확보 */
.post-items {
  list-style: none;
  padding: 0;
  margin: 0;
  max-width: 44rem;
}
.post-items > li {
  padding-bottom: 2.25rem;
  margin-bottom: 2.25rem;
  border-bottom: 1px solid var(--border);
}
.post-items h2 {
  font-size: 1.3rem;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
}
.post-items h2 a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}
.post-excerpt {
  margin: 0 0 0.75rem;
  opacity: 0.65;
  font-size: 0.95rem;
}
.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  opacity: 0.45;
}
.post-meta a:hover {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.post-tags {
  margin: 2.5rem 0 1.5rem;
} /* 글 상세 하단 태그: 목록과 같은 #태그 표기 */

.links {
  list-style: none;
  padding: 0;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
}
.links a {
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  opacity: 0.7;
}
.links a:hover {
  opacity: 1;
  border-color: var(--card-border-hover);
}
.more {
  font-size: 0.85rem;
  opacity: 0.5;
}
.more:hover {
  opacity: 1;
}

.site-footer {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  opacity: 0.35;
}
.site-footer p {
  margin: 0;
}
/* 글이 짧아도 하단 선이 화면 중간에 뜨지 않게 바닥으로 민다.
   홈은 섹션들이 body 바로 아래에 있어 제외(flex 아이템이 되면 폭이 줄어든다). */
body:not(.is-home) {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
}
body:not(.is-home) > main {
  flex: 1 0 auto;
  width: 100%;
}
body:not(.is-home) > .site-footer {
  width: 100%;
}

/* ── 좁은 화면 ─────────────────────────────────────────── */
@media (max-width: 46rem) {
  /* 한 줄에 로고 + 링크 3개가 안 들어간다.
     로고는 nowrap이라 줄지 않으므로 링크를 아랫줄로 내린다. */
  .nav {
    gap: 1rem;
    flex-wrap: wrap;
    row-gap: 0.6rem;
  }
  .nav-links {
    position: static;
    transform: none;
    gap: 1.1rem;
    order: 3;
    flex: 0 0 100%;
  }
  /* 폰: 탭이 한 줄이 되면서 곡선 꼭대기가 기간 버튼에 붙지 않게 */
  .toggles {
    margin-bottom: 0.75rem;
  }
  /* 폰 폭(375px~)에서도 계정 탭과 기간 탭이 한 줄에 들어가게 버튼을 조금 줄인다 */
  .dash-bar {
    gap: 0.25rem;
  }
  .dash-bar .tabs {
    gap: 0;
  }
  .dash-bar .tabs a {
    padding: 0.3rem 0.45rem;
    font-size: 0.8rem;
  }
  .dash-bar > .tabs:first-child {
    margin-left: -0.45rem;
  }
  .dash-bar .period-tabs {
    margin-right: -0.45rem;
  }
  /* 영어 Daily/Monthly/Yearly는 폰에서 한 줄에 안 들어가 1D/1M/1Y로. 한국어는 라벨이 같아 그대로 */
  .label-long {
    display: none;
  }
  .label-short {
    display: inline;
  }
  .records th,
  .records td {
    padding: 0.55rem 0.4rem;
    font-size: 0.82rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

/* ── 등장 ─────────────────────────────────────────────
   움직임은 두 번뿐이다: 첫 화면이 열릴 때 한 번, 곡선이 보일 때 한 번. */
@keyframes hero-rise {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
/* 첫 로드: 헤더 → 본문 순서로 차례차례 떠오른다. 지연값만 어긋나게 준 스태거. */
@media (prefers-reduced-motion: no-preference) {
  .logo {
    animation: hero-rise 0.8s ease-out 0.1s both;
  }
  .nav-links {
    animation: hero-rise 0.8s ease-out 0.2s both;
  }
  .container > * {
    animation: hero-rise 0.8s ease-out 0.65s both;
  }
  .container > *:nth-child(1) {
    animation-delay: 0.35s;
  }
  .container > *:nth-child(2) {
    animation-delay: 0.45s;
  }
  .container > *:nth-child(3) {
    animation-delay: 0.55s;
  }
}

@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .home-split {
      animation: hero-rise 0.7s ease-out both;
      animation-timeline: view();
      animation-range: entry 10% cover 25%; /* 화면에 들어오는 동안만 재생 */
    }
  }
}

/* 곡선이 화면에 들어오면 왼쪽부터 그려진다(JS가 .is-drawn을 붙인다) */
.hero-line-wrap.will-draw .line-main,
.hero-line-wrap.will-draw .line-shadow {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}
.hero-line-wrap.is-drawn .line-main,
.hero-line-wrap.is-drawn .line-shadow {
  transition: stroke-dashoffset 1.6s cubic-bezier(0.33, 1, 0.68, 1);
  stroke-dashoffset: 0;
}
.hero-line-wrap.will-draw .line-area,
.hero-line-wrap.will-draw .x-axis-labels {
  opacity: 0;
}
.hero-line-wrap.is-drawn .line-area {
  transition: opacity 0.8s ease 0.8s;
  opacity: 0.05;
}
.hero-line-wrap.is-drawn .x-axis-labels {
  transition: opacity 0.8s ease 0.8s;
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .hero-line-wrap.will-draw .line-main,
  .hero-line-wrap.will-draw .line-shadow {
    stroke-dasharray: none;
    stroke-dashoffset: 0;
  }
  .hero-line-wrap.will-draw .line-area,
  .hero-line-wrap.will-draw .x-axis-labels {
    opacity: 1;
  }
}

/* ══ 모바일 헤더 + 드로어 (C안, 767px 이하) ═══════════════
   메뉴 링크는 햄버거 → 오른쪽 드로어로 옮긴다.
   768px 이상은 기존 디자인 그대로라 드로어·햄버거를 아예 숨긴다. */
.menu-toggle,
.drawer {
  display: none;
}

@media (max-width: 767px) {
  .nav {
    padding: calc(18px + env(safe-area-inset-top)) 20px 12px 24px;
    flex-wrap: nowrap;
  }
  .logo {
    font-size: 22px;
    letter-spacing: -0.5px;
    color: var(--m-text-strong);
  }
  .nav-links {
    display: none;
  }
  .nav-tools {
    margin-left: auto;
    gap: 2px;
  }
  .theme-toggle {
    width: 44px;
    height: 44px;
    padding: 0;
    opacity: 1;
    color: var(--m-text);
  }
  .nav {
    gap: 4px;
  }

  /* KO/EN 알약 토글 */
  .lang-switch {
    gap: 0;
    padding: 3px;
    border: 1px solid var(--m-line);
    border-radius: 999px;
  }
  .lang-switch button {
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1;
    opacity: 1;
    color: var(--m-text-muted);
  }
  .lang-switch button[aria-pressed='true'] {
    background: var(--m-text);
    color: var(--m-bg);
  }

  .menu-toggle {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-right: -11px; /* 아이콘 선 끝을 오른쪽 여백(20px)에 맞춘다 */
    padding: 0;
    border: none;
    background: none;
    color: var(--m-text);
    cursor: pointer;
  }

  /* 드로어: 닫혀 있으면 visibility:hidden(+inert)이라 탭 순서에 잡히지 않는다.
     닫힐 때는 패널이 다 빠져나간 뒤(260ms)에 숨긴다. */
  .drawer {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 200;
    visibility: hidden;
    transition: visibility 0s linear 260ms;
  }
  .drawer.is-open {
    visibility: visible;
    transition: none;
  }
  .drawer-overlay {
    position: absolute;
    inset: 0;
    background: rgba(5, 6, 8, 0.6);
    opacity: 0;
    transition: opacity 200ms ease;
  }
  .drawer.is-open .drawer-overlay {
    opacity: 1;
  }
  .drawer-panel {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    width: min(264px, 80vw);
    height: 100vh;
    height: 100dvh;
    padding: 18px 20px calc(32px + env(safe-area-inset-bottom)) 28px;
    background: var(--m-panel);
    border-left: 1px solid var(--m-line-soft);
    color: var(--m-text);
    transform: translateX(100%);
    transition: transform 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  .drawer.is-open .drawer-panel {
    transform: none;
  }
  .drawer-close {
    align-self: flex-end;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-right: -11px;
    padding: 0;
    border: none;
    background: none;
    color: var(--m-text);
    cursor: pointer;
  }
  .drawer-links {
    display: flex;
    flex-direction: column;
    margin-top: 40px;
  }
  /* 지금 페이지(서버가 aria-current를 단다. 홈에서는 아무것도 안 달림) */
  .drawer-links a[aria-current='page'] {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 8px;
  }
  /* 터치로 열 때 iOS 사파리가 파란 포커스 박스를 그리지 않게: 표시는 키보드 탐색(:focus-visible)일 때만 */
  .drawer-panel:focus,
  .drawer a:focus:not(:focus-visible),
  .drawer button:focus:not(:focus-visible),
  .menu-toggle:focus:not(:focus-visible) {
    outline: none;
  }
  .drawer a:focus-visible,
  .drawer button:focus-visible,
  .menu-toggle:focus-visible {
    outline: 2px solid var(--m-text-strong);
    outline-offset: 4px;
    border-radius: var(--radius);
  }
  .drawer-links a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 14px 0;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.3px;
    line-height: 1.2;
    color: var(--m-text-strong);
  }

}

@media (max-width: 767px) and (prefers-reduced-motion: reduce) {
  .drawer,
  .drawer-overlay,
  .drawer-panel {
    transition: none;
  }
}
