/**
 * 手写视觉笔记样式 — 草稿纸长卷 + 多色墨水 + 手绘元素
 */

@import url('https://fonts.googleapis.com/css2?family=Ma+Shan+Zheng&family=Long+Cang&family=Zhi+Mang+Xing&family=Caveat:wght@400;700&family=Patrick+Hand&display=swap');

:root {
  --hn-paper: #fdf6e3;
  --hn-paper-dark: #f5edd6;
  --hn-line: #d4c8a0;
  --hn-line-light: rgba(212, 200, 160, 0.4);
  --hn-ink-black: #1a1a2e;
  --hn-ink-red: #c0392b;
  --hn-ink-blue: #2563a8;
  --hn-ink-green: #1a7a4c;
  --hn-highlight: rgba(255, 235, 59, 0.45);
  --hn-shadow: rgba(0, 0, 0, 0.08);
}

/* 颜色映射 */
.hn-black { color: var(--hn-ink-black); }
.hn-red { color: var(--hn-ink-red); }
.hn-blue { color: var(--hn-ink-blue); }
.hn-green { color: var(--hn-ink-green); }

.hn-stroke-black { stroke: var(--hn-ink-black); }
.hn-stroke-red { stroke: var(--hn-ink-red); }
.hn-stroke-blue { stroke: var(--hn-ink-blue); }
.hn-stroke-green { stroke: var(--hn-ink-green); }

/* 手写稿播放器容器 — 覆盖 .deck-player 的双栏 grid 布局 */
#handnote-player.deck-player {
  display: flex;
  flex-direction: column;
  gap: 0;
  grid-template-columns: none;
}

#handnote-player .player-header {
  grid-column: auto;
  padding: 14px 0;
  margin-bottom: 8px;
}

#handnote-player-container {
  width: 100%;
  flex: 1;
  padding: 0 16px 16px;
  overflow-y: auto;
  max-height: calc(100vh - 160px);
}

/* 手写稿容器 — 横线纸长卷 */
.handnote-scroll {
  width: 100%;
  max-width: none;
  margin: 0;
  background-color: var(--hn-paper);
  background-image:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 27px,
      var(--hn-line-light) 27px,
      var(--hn-line-light) 28px
    );
  padding: 36px 48px 60px;
  border-radius: 4px;
  box-shadow: 0 2px 12px var(--hn-shadow), 0 0 0 1px rgba(0,0,0,0.03);
  font-family: 'Long Cang', 'Patrick Hand', 'Noto Sans CJK SC', sans-serif;
  line-height: 1.6;
  position: relative;
  overflow: visible;
}

/* 纸张左侧装订线 */
.handnote-scroll::before {
  content: '';
  position: absolute;
  left: 32px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(192, 57, 43, 0.3);
}

/* 笔记区块通用 */
.hn-block {
  margin-bottom: 20px;
  position: relative;
  break-inside: avoid;
}

/* 标题区块 */
.hn-title-block {
  text-align: center;
  margin-bottom: 28px;
}

.hn-title-text {
  font-family: 'Ma Shan Zheng', 'Zhi Mang Xing', serif;
  font-size: 42px;
  font-weight: bold;
  line-height: 1.4;
  display: inline-block;
  position: relative;
}

.hn-title-sub {
  font-family: 'Long Cang', 'Caveat', cursive;
  font-size: 22px;
  opacity: 0.75;
  margin-top: 8px;
}

/* 手绘波浪下划线 */
.hn-wavy-underline {
  display: block;
  width: 100%;
  height: 12px;
  margin-top: 4px;
}

/* 大括号区块 */
.hn-brace-block {
  display: flex;
  align-items: stretch;
  gap: 12px;
  padding-left: 20px;
}

.hn-brace-svg {
  flex-shrink: 0;
  align-self: stretch;
  height: 100%;
}

.hn-brace-content {
  flex: 1;
}

.hn-brace-label {
  font-family: 'Ma Shan Zheng', serif;
  font-size: 24px;
  margin-bottom: 8px;
  display: inline-block;
}

.hn-brace-items {
  list-style: none;
  padding: 0;
  margin: 0;
}

.hn-brace-items li {
  font-family: 'Long Cang', 'Caveat', cursive;
  font-size: 19px;
  line-height: 1.9;
  padding-left: 16px;
  position: relative;
}

.hn-brace-items li::before {
  content: '•';
  position: absolute;
  left: 0;
  font-size: 18px;
}

/* 脑图区块 */
.hn-mindmap-block {
  display: flex;
  justify-content: center;
  padding: 8px 0;
}

.hn-mindmap-svg {
  max-width: 100%;
  overflow: hidden;
}

/* 流程图区块 */
.hn-flow-block {
  display: flex;
  justify-content: center;
  padding: 8px 0;
}

.hn-flow-svg {
  max-width: 100%;
  overflow: hidden;
}

/* 对比区块 */
.hn-compare-block {
  display: flex;
  justify-content: center;
  gap: 0;
  padding: 8px 0;
  position: relative;
}

.hn-compare-svg {
  max-width: 100%;
  overflow: hidden;
}

/* 笔记列表区块 */
.hn-notes-block {
  padding-left: 20px;
}

.hn-notes-heading {
  font-family: 'Ma Shan Zheng', serif;
  font-size: 26px;
  display: inline-block;
  position: relative;
  padding: 2px 8px;
  margin-bottom: 12px;
}

/* 荧光笔涂抹 */
.hn-highlight {
  background: linear-gradient(
    180deg,
    transparent 0%,
    transparent 15%,
    var(--hn-highlight) 15%,
    var(--hn-highlight) 85%,
    transparent 85%
  );
  padding: 0 4px;
  transform: rotate(-0.5deg);
}

.hn-notes-lines {
  list-style: none;
  padding: 0;
  margin: 0;
}

.hn-notes-lines li {
  font-family: 'Long Cang', 'Caveat', cursive;
  font-size: 19px;
  line-height: 1.9;
  padding-left: 24px;
  position: relative;
}

.hn-notes-lines li::before {
  content: '→';
  position: absolute;
  left: 0;
  font-size: 18px;
}

/* 总结区块 */
.hn-summary-block {
  margin-top: 28px;
  padding: 18px 20px;
  border: 2px dashed rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  transform: rotate(-0.3deg);
}

.hn-summary-heading {
  font-family: 'Ma Shan Zheng', serif;
  font-size: 28px;
  margin-bottom: 12px;
  text-align: center;
}

.hn-summary-points {
  list-style: none;
  padding: 0;
  margin: 0;
}

.hn-summary-points li {
  font-family: 'Long Cang', 'Caveat', cursive;
  font-size: 19px;
  line-height: 1.9;
  padding-left: 28px;
  position: relative;
}

.hn-summary-points li::before {
  content: '✓';
  position: absolute;
  left: 0;
  font-size: 18px;
}

/* 手写稿播放器容器 */
.handnote-player {
  width: 100%;
  min-height: calc(100vh - 120px);
  overflow-y: auto;
  padding: 24px 0;
}

/* 加载状态 */
.handnote-loading {
  text-align: center;
  padding: 80px 20px;
  font-family: 'Long Cang', cursive;
  font-size: 24px;
  color: var(--hn-ink-black);
}

/* SVG 手绘节点文字 */
.hn-node-text {
  font-family: 'Ma Shan Zheng', serif;
  font-size: 16px;
  text-anchor: middle;
  dominant-baseline: central;
}

.hn-edge-text {
  font-family: 'Long Cang', 'Caveat', cursive;
  font-size: 13px;
  text-anchor: middle;
  fill: var(--hn-ink-black);
  opacity: 0.8;
}

.hn-branch-label {
  font-family: 'Ma Shan Zheng', serif;
  font-size: 15px;
  text-anchor: start;
  dominant-baseline: central;
}

.hn-child-text {
  font-family: 'Long Cang', cursive;
  font-size: 14px;
  text-anchor: start;
  dominant-baseline: central;
  opacity: 0.85;
}

/* 滚动条美化 */
.handnote-scroll-container::-webkit-scrollbar {
  width: 8px;
}

.handnote-scroll-container::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
}

.handnote-scroll-container::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

/* 移动端适配 */
@media (max-width: 640px) {
  .handnote-scroll {
    padding: 24px 20px 60px;
  }

  .handnote-scroll::before {
    left: 12px;
  }

  .hn-title-text {
    font-size: 32px;
  }

  .hn-title-sub {
    font-size: 18px;
  }

  .hn-brace-items li,
  .hn-notes-lines li,
  .hn-summary-points li {
    font-size: 17px;
  }
}
