/* ========== 黑板 · 诗意怀旧 ========== */
:root {
  /* 黑板 */
  --board-bg: #1f2a25;
  --board-bg-2: #1a2520;
  --board-edge: #5a3a18;
  --board-edge-dark: #3d2814;
  --board-tray: #3d2814;

  /* 粉笔色（提高清晰度，加深对比） */
  --chalk: #f4f1ea;
  --chalk-dim: rgba(244, 241, 234, 0.82);
  --chalk-soft: rgba(244, 241, 234, 0.55);

  /* 怀旧点缀 */
  --seal: #c84a3a;            /* 朱砂红 */
  --paper-bg: #f4e8d0;         /* 宣纸 */
  --ink: #2a1a08;              /* 墨色 */

  /* 便签信纸色（5 种 + 自定义） */
  --paper-1: #fdf6e3;
  --paper-2: #ffd6d6;
  --paper-3: #cfe5f0;
  --paper-4: #d6e9c6;
  --paper-5: #fbe9b6;

  /* 9 种粉笔色（用于字色 + 写效果） */
  --ch-white:   #ffffff;
  --ch-black:   #1a1a1a;
  --ch-ink:     #3a2818;
  --ch-red:     #a83232;
  --ch-orange:  #c8601f;
  --ch-yellow:  #c89e1f;
  --ch-green:   #4a7a2f;
  --ch-blue:    #2d5a8a;
  --ch-purple:  #6b4a8a;

  /* 字体 */
  --font-brush: "Ma Shan Zheng", "STXingkai", "华文行楷", "STKaiti", "KaiTi", "楷体", cursive;
  --font-kai: "ZCOOL XiaoWei", "STKaiti", "KaiTi", "楷体", "Kaiti SC", "Songti SC", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-kai);
  color: var(--chalk);
  background: #14100a;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.svg-defs { position: absolute; width: 0; height: 0; pointer-events: none; }

/* ========== 页面切换 ========== */
.page {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.45s ease, visibility 0s 0.45s;
  padding: 16px;
  overflow: hidden;
}
.page.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  z-index: 2;
  transition: opacity 0.45s ease, visibility 0s 0s;
}

/* ========== 顶部栏（返回） ========== */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(20, 16, 10, 0.92) 0%, rgba(20, 16, 10, 0) 100%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
}
.topbar[hidden] { display: none !important; }
.topbar-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(244, 241, 234, 0.08);
  color: var(--chalk);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.topbar-btn:hover { background: rgba(244, 241, 234, 0.18); }
.topbar-title {
  font-family: var(--font-kai);
  font-size: 18px;
  letter-spacing: 4px;
  color: var(--chalk);
  font-weight: 500;
}
.topbar-spacer { width: 40px; height: 40px; }

/* ========== 黑板框架 ========== */
.board-frame {
  position: relative;
  width: 100%;
  max-width: min(920px, 92vw);
  /* 高度按屏宽比例：宽屏 16:9 时更扁，窄屏 9:16 时更方 */
  height: min(82vh, 75vw, 720px);
  padding: 12px;
  background: linear-gradient(135deg, #8a5a30 0%, #6b4520 30%, #7a5230 70%, #5a3a18 100%);
  border-radius: 6px;
  box-shadow:
    inset 0 0 0 2px #3d2814,
    inset 0 0 0 3px #5a3a18,
    0 24px 70px rgba(0, 0, 0, 0.55),
    0 6px 18px rgba(0, 0, 0, 0.4);
  display: flex;
}

.board {
  position: relative;
  flex: 1;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255, 255, 255, 0.05) 0%, transparent 55%),
    radial-gradient(ellipse at 75% 80%, rgba(255, 255, 255, 0.025) 0%, transparent 50%),
    linear-gradient(180deg, #243430 0%, #1f2a25 50%, #1a2520 100%);
  border-radius: 2px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* 黑板磨砂（更细腻：高频 + 多层） */
.board::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='400' height='400'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.8' numOctaves='3' seed='4'/><feColorMatrix values='0 0 0 0 0.96 0 0 0 0 0.94 0 0 0 0 0.86 0 0 0 0.09 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  pointer-events: none;
  opacity: 0.55;
  mix-blend-mode: overlay;
}

/* 粉笔灰散落（去掉斜划痕，更接近真实"擦干净"的黑板） */
.board::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    /* 微弱粉笔灰散落 */
    radial-gradient(ellipse 80px 40px at 22% 18%, rgba(255, 255, 255, 0.05) 0%, transparent 70%),
    radial-gradient(ellipse 60px 30px at 70% 35%, rgba(255, 255, 255, 0.04) 0%, transparent 70%),
    radial-gradient(ellipse 100px 50px at 38% 75%, rgba(255, 255, 255, 0.045) 0%, transparent 70%),
    radial-gradient(ellipse 70px 35px at 86% 82%, rgba(255, 255, 255, 0.035) 0%, transparent 70%),
    radial-gradient(ellipse 50px 25px at 14% 62%, rgba(255, 255, 255, 0.03) 0%, transparent 70%);
  pointer-events: none;
}

.board-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
  max-width: 560px;
  /* 顶部 0、左右 24、底部 72（56 托盘 + 16 缓冲） */
  padding: 0 24px 72px;
  /* 标准 flex 滚动模式：填满父级、允许收缩、超出滚动 */
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;     /* 防止穿透到 body */
  /* 内容小的时候垂直居中；内容大时从顶开始（justify-content 在 overflow 时不影响 scrollTop） */
  justify-content: center;
}
/* 自定义滚动条：黑板粉笔风 */
.board-content::-webkit-scrollbar { width: 4px; }
.board-content::-webkit-scrollbar-track { background: transparent; }
.board-content::-webkit-scrollbar-thumb { background: rgba(244, 241, 234, 0.18); border-radius: 2px; }

/* ========== 诗意元素：诗句 ========== */
.verse {
  position: absolute;
  font-family: var(--font-kai);
  font-size: 14px;
  color: rgba(244, 241, 234, 0.4);
  letter-spacing: 6px;
  z-index: 1;
  white-space: nowrap;
  pointer-events: none;
}
.verse-top { top: 24px; left: 50%; transform: translateX(-50%); }
.verse-bottom { bottom: 24px; left: 50%; transform: translateX(-50%); }

/* ========== 印章 ========== */
.seal {
  position: absolute;
  bottom: 56px;
  right: 28px;
  width: 56px;
  height: 56px;
  background: var(--seal);
  color: var(--paper-bg);
  font-family: var(--font-brush);
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  transform: rotate(-4deg);
  filter: url(#seal);
  letter-spacing: 0;
  z-index: 2;
  pointer-events: none;
}
.seal-small {
  width: 42px;
  height: 42px;
  font-size: 18px;
  bottom: 40px;
  right: 24px;
}
.wall-seal {
  bottom: 24px;
  right: 24px;
}

/* ========== 粉笔字 ========== */
.chalk-title {
  font-family: var(--font-brush);
  font-size: clamp(34px, 5.5vw, 54px);
  letter-spacing: 6px;
  margin-bottom: 14px;
  color: var(--chalk);
  filter: url(#chalk);
  text-shadow:
    0 0 1px rgba(244, 241, 234, 0.5),
    0 1px 0 rgba(244, 241, 234, 0.15),
    0 0 14px rgba(244, 241, 234, 0.08);
  position: relative;
  z-index: 1;
  line-height: 1.2;
}

.chalk-title-sm {
  font-family: var(--font-brush);
  font-size: clamp(24px, 3.6vw, 34px);
  letter-spacing: 4px;
  margin-bottom: 12px;
  color: var(--chalk);
  filter: url(#chalk);
  text-shadow: 0 0 1px rgba(244, 241, 234, 0.4);
  position: relative;
  z-index: 1;
  line-height: 1.3;
}

.chalk-subtitle {
  font-family: var(--font-kai);
  font-size: clamp(14px, 1.8vw, 18px);
  color: var(--chalk-dim);
  margin-bottom: 8px;
  letter-spacing: 4px;
  position: relative;
  z-index: 1;
}

.chalk-tip {
  font-family: var(--font-kai);
  font-size: 14px;
  color: var(--chalk-soft);
  margin: 8px 0 14px;
  letter-spacing: 2px;
  line-height: 1.7;
  position: relative;
  z-index: 1;
}

/* ========== 粉笔按钮 ========== */
.chalk-btn {
  font-family: var(--font-brush);
  font-size: clamp(18px, 2.4vw, 22px);
  letter-spacing: 8px;
  padding: 12px 44px;
  background: transparent;
  color: var(--chalk);
  border: 2px dashed rgba(244, 241, 234, 0.65);
  border-radius: 4px;
  cursor: pointer;
  filter: url(#chalk);
  text-shadow: 0 0 1px rgba(244, 241, 234, 0.4);
  transition: all 0.25s ease;
  margin-top: 14px;
  position: relative;
  z-index: 1;
  overflow: hidden;
}
.chalk-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(244, 241, 234, 0.15) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
  pointer-events: none;
}
.chalk-btn:hover {
  background: rgba(244, 241, 234, 0.1);
  border-style: solid;
  transform: scale(1.04);
  color: #fff;
  text-shadow: 0 0 2px rgba(244, 241, 234, 0.6);
}
.chalk-btn:hover::before { transform: translateX(100%); }
.chalk-btn:active { transform: scale(0.97); }

.chalk-btn-outline {
  font-family: var(--font-kai);
  font-size: clamp(14px, 1.8vw, 16px);
  letter-spacing: 4px;
  padding: 9px 24px;
  background: transparent;
  color: var(--chalk-dim);
  border: 1px dashed rgba(244, 241, 234, 0.45);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 6px;
  position: relative;
  z-index: 1;
}
.chalk-btn-outline:hover {
  color: var(--chalk);
  border-color: var(--chalk);
  background: rgba(244, 241, 234, 0.05);
}

.chalk-btn-ghost {
  font-family: var(--font-kai);
  background: transparent;
  border: none;
  color: var(--chalk-dim);
  padding: 8px 16px;
  cursor: pointer;
  font-size: 14px;
  letter-spacing: 3px;
  transition: color 0.2s;
}
.chalk-btn-ghost:hover { color: var(--chalk); }

.chalk-btn-small {
  font-family: var(--font-kai);
  font-size: 14px;
  letter-spacing: 3px;
  padding: 8px 22px;
  background: transparent;
  color: var(--chalk);
  border: 1px dashed rgba(244, 241, 234, 0.5);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}
.chalk-btn-small:hover { background: rgba(244, 241, 234, 0.1); }

/* 墙页右下 + 写按钮 */
.chalk-btn-mini {
  position: absolute;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(244, 241, 234, 0.1);
  color: var(--chalk);
  border: 1px dashed rgba(244, 241, 234, 0.4);
  font-size: 22px;
  font-family: var(--font-kai);
  cursor: pointer;
  z-index: 5;
  filter: url(#chalk);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.chalk-btn-mini:hover {
  background: rgba(244, 241, 234, 0.2);
  border-style: solid;
  transform: scale(1.08);
}
.wall-fab { bottom: 24px; right: 80px; }   /* 避开右下印章 */

/* ========== 粉笔托盘 ========== */
/* 实际样式见上面"粉笔盒"区块，这里保留兼容旧选择器 */
.chalk-piece {
  display: inline-block;
  width: 26px;
  height: 7px;
  border-radius: 1px;
  position: relative;
  transform: translateY(-3px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* ========== 老师卡片 ========== */
.teacher-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  margin: 8px 0 16px;
  width: 100%;
  max-width: 460px;
  max-height: 42vh;
  overflow-y: auto;
  padding: 4px;
  position: relative;
  z-index: 1;
}
.teacher-card {
  background: rgba(244, 241, 234, 0.07);
  border: 1px dashed rgba(244, 241, 234, 0.32);
  border-radius: 4px;
  padding: 16px 10px;
  cursor: pointer;
  text-align: center;
  color: var(--chalk);
  transition: all 0.2s;
  filter: url(#chalk);
  position: relative;
}
.teacher-card:hover {
  background: rgba(244, 241, 234, 0.13);
  border-color: var(--chalk);
  transform: translateY(-2px);
}
.teacher-name {
  font-family: var(--font-brush);
  font-size: clamp(16px, 2.2vw, 20px);
  margin-bottom: 4px;
  letter-spacing: 2px;
}
.teacher-count {
  font-size: 14px;
  color: var(--chalk-soft);
  font-family: var(--font-sans);
}

/* 老师空状态 */
.teacher-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 28px 16px;
  color: var(--chalk-soft);
}
.teacher-empty-text {
  font-family: var(--font-brush);
  font-size: 20px;
  letter-spacing: 4px;
  margin-bottom: 6px;
  color: var(--chalk);
}
.teacher-empty-hint {
  font-family: var(--font-kai);
  font-size: 14px;
  letter-spacing: 2px;
  color: var(--chalk-soft);
}

/* 老师卡片：右上角删除 × */
.teacher-card {
  position: relative;
}
.teacher-delete {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(244, 241, 234, 0.3);
  background: rgba(0, 0, 0, 0.25);
  color: var(--chalk);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.18s ease, background 0.18s ease;
  z-index: 2;
  padding: 0;
  font-family: var(--font-sans);
}
.teacher-card:hover .teacher-delete { opacity: 1; }
.teacher-delete:hover {
  background: rgba(200, 70, 60, 0.85);
  border-color: rgba(255, 255, 255, 0.5);
}
/* 移动端 / 无 hover：始终显示 */
@media (hover: none) {
  .teacher-delete { opacity: 0.85; }
}

.modal-tip {
  font-family: var(--font-kai);
  font-size: 14px;
  color: rgba(244, 241, 234, 0.75);
  text-align: center;
  margin: -6px 0 18px;
  letter-spacing: 1px;
  position: relative;
  z-index: 1;
}

/* ========== 笔记本纸输入 ========== */
.notebook-paper {
  --paper-bg: #fdf6e3;
  --paper-bg2: #f5e8c8;
  background:
    linear-gradient(180deg, rgba(120, 100, 80, 0.22) 29px, transparent 30px),
    linear-gradient(180deg, rgba(120, 100, 80, 0.22) 59px, transparent 60px),
    linear-gradient(180deg, var(--paper-bg) 0%, var(--paper-bg2) 100%);
  background-size: 100% 29px, 100% 29px, 100% 100%;
  border-radius: 2px;
  padding: 20px 18px 20px 42px;
  width: 100%;
  max-width: 420px;
  margin: 4px 0 14px;
  position: relative;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.08),
    2px 4px 10px rgba(0, 0, 0, 0.35);
  z-index: 1;
  transition: --paper-bg 0.2s ease;  /* 部分浏览器支持 */
}
.notebook-paper::before {
  content: "";
  position: absolute;
  left: 32px; top: 0; bottom: 0;
  width: 1px;
  background: rgba(180, 60, 60, 0.4);
  pointer-events: none;
}

#keyword-input {
  width: 100%;
  min-height: 80px;
  max-height: 220px;       /* 200 字 + 多行 */
  overflow-y: auto;        /* 多行滚动 */
  border: none;
  background: transparent;
  font-family: var(--font-kai);
  font-size: clamp(15px, 2vw, 18px);
  line-height: 29px;
  color: var(--ink);
  outline: none;
  resize: none;
  font-weight: 500;
  position: relative;
  z-index: 1;
  white-space: pre-wrap;   /* 保留手动换行 */
  word-break: break-word;
  /* 移动端：避免 iOS 自动缩放 */
  font-size: max(16px, clamp(15px, 2vw, 18px));
}
#keyword-input::placeholder {
  color: rgba(42, 26, 8, 0.32);
}

/* 字符计数 */
.charcount {
  font-family: var(--font-kai);
  font-size: 12px;
  color: var(--chalk-soft);
  text-align: right;
  margin: 0 0 4px;
  letter-spacing: 1px;
  opacity: 0.8;
  position: relative;
  z-index: 1;
}

/* ========== 附件行：表情 + 图片 ========== */
.attach-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}
.emoji-picker {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  flex: 1 1 auto;
  min-width: 0;
}
.emoji-btn {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  border: 1px solid transparent;
  background: rgba(244, 241, 234, 0.06);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform 0.15s, background 0.15s;
}
.emoji-btn:hover {
  background: rgba(244, 241, 234, 0.15);
  transform: scale(1.15);
  border-color: rgba(244, 241, 234, 0.3);
}
.emoji-btn:active { transform: scale(0.92); }

.attach-upload {
  flex: 0 0 auto;
}
.attach-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  font-family: var(--font-kai);
  font-size: 13px;
  color: var(--chalk-soft);
  background: rgba(244, 241, 234, 0.06);
  border: 1px dashed rgba(244, 241, 234, 0.4);
  border-radius: 3px;
  cursor: pointer;
  letter-spacing: 1px;
  white-space: nowrap;
}
.attach-btn:hover {
  color: var(--chalk);
  background: rgba(244, 241, 234, 0.14);
  border-color: var(--chalk);
}

.image-preview {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
}
.image-preview img {
  max-width: 60px;
  max-height: 40px;
  border-radius: 3px;
  border: 1px solid rgba(244, 241, 234, 0.3);
  object-fit: cover;
  display: block;
}
.image-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: rgba(200, 70, 60, 0.9);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
}

/* 粉笔写 / 黑板擦：覆盖层 */
.chalk-input-wrap {
  position: relative;
}

/* 粉笔盒 + 黑板擦：在黑板底部托盘上并排 */
.chalk-tray {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  background:
    linear-gradient(180deg, #3a2a18 0%, #2a1c0e 60%, #1a1208 100%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 18px;
  padding: 0 20px 4px;
  z-index: 3;
  box-shadow:
    0 -2px 0 rgba(255, 255, 255, 0.04) inset,
    0 6px 12px rgba(0, 0, 0, 0.45);
}
/* 桌面反光（顶端微亮） */
.chalk-tray::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
}

/* === 粉笔盒：白色亚克力盒 + 9 支短小彩粉笔（头朝上）=== */
.chalk-box {
  position: relative;
  width: 148px;
  height: 38px;
  background:
    linear-gradient(180deg, #f8f5ee 0%, #ebe5d6 100%);
  border-radius: 3px 3px 2px 2px;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  padding: 0 4px 1px;
  border: 1px solid rgba(0, 0, 0, 0.12);
}
.chalk-box::before {
  /* 盒子内壁阴影（粉笔在凹槽里） */
  content: '';
  position: absolute;
  top: 2px;
  left: 4px;
  right: 4px;
  bottom: 1px;
  background: linear-gradient(180deg, #d8d0bc 0%, #c8c0ac 100%);
  border-radius: 1px;
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.2);
  z-index: 0;
}
/* 短小粉笔（头朝上 = 圆角顶部） */
.mini-chalk {
  --c: #3a2818;
  position: relative;
  z-index: 1;
  width: 10px;
  height: 28px;
  border: none;
  padding: 0;
  cursor: pointer;
  border-radius: 5px 5px 1.5px 1.5px;  /* 顶圆底方 */
  background:
    /* 顶端高光 + 整体颜色 + 底部一点点暗 */
    linear-gradient(180deg,
      rgba(255, 255, 255, 0.35) 0%,
      var(--c) 18%,
      var(--c) 88%,
      rgba(0, 0, 0, 0.2) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 1px 1px rgba(0, 0, 0, 0.3);
  transition: transform 0.18s ease, filter 0.18s ease, box-shadow 0.18s ease;
  /* 错落感：随机高度差 */
  height: calc(26px + var(--j, 0) * 1.5px);
}
/* 纯白粉笔：描深色边，否则跟盒子底色糊在一起 */
.mini-chalk[data-color="#ffffff"] {
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 1px 1px rgba(0, 0, 0, 0.3);
}
.mini-chalk[data-color="#ffffff"].active {
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 4px 6px rgba(0, 0, 0, 0.4),
    0 0 0 1.5px rgba(0, 0, 0, 0.3);
}
.mini-chalk:nth-child(1) { --j: 0; }
.mini-chalk:nth-child(2) { --j: 1; }
.mini-chalk:nth-child(3) { --j: -1; }
.mini-chalk:nth-child(4) { --j: 1; }
.mini-chalk:nth-child(5) { --j: 0; }
.mini-chalk:nth-child(6) { --j: -1; }
.mini-chalk:nth-child(7) { --j: 1; }
.mini-chalk:nth-child(8) { --j: 0; }
.mini-chalk:nth-child(9) { --j: -1; }
.mini-chalk:hover {
  transform: translateY(-4px);
  filter: brightness(1.1);
}
.mini-chalk.active {
  transform: translateY(-6px);
  filter: brightness(1.15);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 4px 6px rgba(0, 0, 0, 0.4),
    0 0 0 1.5px rgba(255, 255, 255, 0.2);
}

/* === 黑板擦：木把手 + 灰色绒面 === */
.chalk-eraser {
  position: relative;
  width: 70px;
  height: 26px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  border-radius: 2px;
  /* 整体阴影 */
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.4));
}
.eraser-handle {
  /* 木把手：上 */
  flex: 0 0 11px;
  background:
    linear-gradient(180deg, #c89868 0%, #a87850 60%, #8a5a38 100%);
  border-radius: 2px 2px 1px 1px;
  box-shadow:
    inset 0 1px 0 rgba(255, 220, 180, 0.5),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2);
  position: relative;
}
.eraser-handle::before {
  /* 木纹 */
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(90deg,
      transparent 0px,
      rgba(0, 0, 0, 0.08) 8px,
      transparent 9px,
      rgba(0, 0, 0, 0.06) 18px,
      transparent 19px);
  border-radius: inherit;
}
.eraser-handle::after {
  /* 中央手握凹槽（横向阴影） */
  content: '';
  position: absolute;
  left: 8px;
  right: 8px;
  top: 4px;
  height: 2px;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.2) 50%, transparent 100%);
  border-radius: 2px;
}
.eraser-pad {
  /* 灰色绒面：下 */
  flex: 1;
  background:
    linear-gradient(180deg,
      #6a6a6a 0%,
      #7a7a7a 8%,
      #888 15%,
      #6e6e6e 30%,
      #5a5a5a 60%,
      #4a4a4a 100%);
  border-radius: 0 0 2px 2px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    inset 0 -2px 3px rgba(0, 0, 0, 0.4);
  position: relative;
  overflow: hidden;
}
.eraser-pad::before {
  /* 绒面纤维（细密的横线） */
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(90deg,
      transparent 0px,
      rgba(255, 255, 255, 0.06) 1px,
      transparent 2px,
      rgba(0, 0, 0, 0.08) 3px);
  opacity: 0.7;
}
.eraser-pad::after {
  /* 底部磨损 */
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.3) 100%);
}
.chalk-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  overflow: visible;
}
.chalk-overlay circle {
  transform-origin: center;
}

/* 写：粉笔落下 - 短促、明显、白色 */
.chalk-write-dot {
  animation: chalkWriteDot 1.2s ease-out forwards;
}
.chalk-write-line {
  animation: chalkWriteLine 1.1s ease-out forwards;
}

/* dev demo 模式：URL 带 #demo 时延长动画到 4s 便于截图 */
body.demo-mode .chalk-write-dot {
  animation-duration: 4s;
}
body.demo-mode .chalk-write-line {
  animation-duration: 4s;
}
body.demo-mode .chalk-erase-dust {
  animation-duration: 4s;
}
@keyframes chalkWriteDot {
  0%   { opacity: 0; transform: scale(0.4); }
  25%  { opacity: 1; transform: scale(1.1); }
  100% { opacity: 0; transform: scale(2.4); }
}
@keyframes chalkWriteLine {
  0%   { opacity: 0; stroke-width: 4; }
  20%  { opacity: 1; }
  60%  { opacity: 0.85; stroke-width: 3; }
  100% { opacity: 0; stroke-width: 2; }
}

/* 擦：黑板擦 - 飘散、慢、灰白 */
.chalk-erase-dust {
  animation: chalkEraseDust 1.8s ease-out forwards;
  transform-origin: center;
}
@keyframes chalkEraseDust {
  0%   { opacity: 1; transform: translate(0, 0) scale(1.3); filter: blur(0); }
  40%  { opacity: 0.85; filter: blur(0.3px); }
  100% { opacity: 0; transform: translate(var(--dx, 0), var(--dy, -50px)) scale(0.5); filter: blur(1px); }
}

/* 输入新字符时 textarea 内文字的"刚写好"瞬态 */
#keyword-input.just-wrote {
  animation: justWrote 0.4s ease;
}
@keyframes justWrote {
  0%   { filter: blur(2.5px); opacity: 0.55; }
  100% { filter: blur(0); opacity: 1; }
}
/* 删除字符时 textarea 内文字的"被擦掉"瞬态（视觉提示） */
#keyword-input.just-erased {
  animation: justErased 0.4s ease;
}
@keyframes justErased {
  0%   { filter: contrast(0.6) blur(1px); }
  50%  { filter: contrast(0.85) blur(0.5px); }
  100% { filter: none; }
}

/* ========== 信纸色选择 ========== */
.paper-picker {
  display: flex;
  gap: 10px;
  margin: 4px 0 16px;
  position: relative;
  z-index: 1;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}
.paper-dot {
  width: 34px;
  height: 34px;
  border-radius: 2px;
  cursor: pointer;
  border: 2px solid transparent;
  box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.3);
  transition: all 0.2s;
  position: relative;
  filter: url(#paper);
}
.paper-dot:hover { transform: scale(1.12) rotate(-2deg); }
.paper-dot.selected {
  border-color: var(--chalk);
  box-shadow: 0 0 0 2px rgba(244, 241, 234, 0.3), 1px 2px 4px rgba(0, 0, 0, 0.4);
}

/* 彩色轮盘：自定义颜色 + 圆形 dial（视觉提示） */
.picker-divider {
  width: 1px;
  height: 26px;
  background: rgba(244, 241, 234, 0.25);
  margin: 0 4px;
}
.paper-wheel {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid rgba(244, 241, 234, 0.55);
  box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.4);
  background:
    conic-gradient(
      #ff5252 0deg, #ff9d3a 45deg, #ffe66b 90deg,
      #6ed47b 135deg, #4cb3e8 180deg, #5b6cff 225deg,
      #a96ce0 270deg, #e36cae 315deg, #ff5252 360deg
    );
  transition: all 0.2s;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.paper-wheel::after {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: var(--chalk);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
  z-index: 1;
}
.paper-wheel:hover { transform: scale(1.1) rotate(8deg); }
.paper-wheel.selected {
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(244, 241, 234, 0.6), 1px 2px 4px rgba(0, 0, 0, 0.4);
}
.paper-wheel input[type="color"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  border: none;
  padding: 0;
  cursor: pointer;
  z-index: 2;
}
.paper-wheel .wheel-label {
  position: relative;
  z-index: 3;
  font-size: 12px;
  font-family: var(--font-kai);
  color: #2a1a08;
  pointer-events: none;
  letter-spacing: 0;
  font-weight: 700;
  margin-top: 1px;
}

/* ========== 欢迎页：双按钮 ========== */
.welcome-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 8px;
  position: relative;
  z-index: 1;
}
.welcome-actions .chalk-btn { margin-top: 0; }
.welcome-actions .chalk-btn-outline { margin-top: 0; }

/* ========== 写信页：署名 + 日期 ========== */
.signature-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 4px 0 14px;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
  flex-wrap: wrap;
}
.signature-input {
  flex: 1 1 140px;
  min-width: 0;
  padding: 8px 12px;
  background: rgba(244, 241, 234, 0.08);
  border: 1px dashed rgba(244, 241, 234, 0.4);
  border-radius: 3px;
  color: var(--chalk);
  font-family: var(--font-kai);
  font-size: 14px;
  letter-spacing: 2px;
  outline: none;
  transition: all 0.2s;
}
.signature-input::placeholder { color: rgba(244, 241, 234, 0.45); }
.signature-input:focus {
  border-color: var(--chalk);
  background: rgba(244, 241, 234, 0.13);
}
.signature-date {
  font-family: var(--font-kai);
  font-size: 14px;
  color: var(--chalk-soft);
  letter-spacing: 2px;
  white-space: nowrap;
}

/* ========== 墙页：分享按钮 ========== */
.wall-share {
  bottom: 24px;
  right: 144px;     /* 在 fab 左侧（fab 在 right: 80px，48px 宽，间距 16px） */
  font-size: 22px;
}

/* ========== 快照（寄来的墙）模式 ========== */
.wall-save {
  bottom: 24px;
  right: 208px;     /* 在 share 左侧，间距同 16px */
  font-size: 18px;
  border-style: solid;
  background: rgba(200, 138, 58, 0.22);
  color: #ffd9a0;
}
.wall-readonly-badge {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  margin: 0;
  padding: 5px 14px;
  font-family: var(--font-kai);
  font-size: 13px;
  letter-spacing: 2px;
  color: rgba(255, 217, 160, 0.92);
  background: rgba(20, 16, 10, 0.55);
  border: 1px dashed rgba(255, 217, 160, 0.45);
  border-radius: 2px;
  pointer-events: none;
  white-space: nowrap;
}
.wall-toast {
  position: absolute;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  margin: 0;
  max-width: 82%;
  padding: 8px 16px;
  font-family: var(--font-kai);
  font-size: 14px;
  letter-spacing: 1px;
  text-align: center;
  color: var(--chalk);
  background: rgba(20, 16, 10, 0.82);
  border: 1px solid rgba(244, 241, 234, 0.25);
  border-radius: 3px;
  pointer-events: none;
}
.share-note {
  margin: -8px 0 14px;
  white-space: pre-line;
}

/* ========== 分享模态框 ========== */
.share-qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
}
.share-qr-img {
  background: #fff;
  border-radius: 4px;
  padding: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  display: block;
  width: 180px;
  height: 180px;
  object-fit: contain;
}
.qr-hint {
  font-family: var(--font-kai);
  font-size: 14px;
  color: var(--chalk-soft);
  letter-spacing: 2px;
  margin: 0;
}
.share-actions {
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.share-actions .chalk-btn-small { font-size: 14px; padding: 8px 16px; }

/* ========== 便签查看模态 ========== */
.note-view-modal {
  /* 继承便签纸感：颜色、字、阴影 */
  max-width: 360px;
  width: calc(100% - 40px);
  padding: 28px 24px 20px;
  border-radius: 1px;
  position: relative;
  /* 背景色由 JS 设置（沿用原便签颜色） */
  background: var(--paper-1);
  color: var(--ink);
  font-family: var(--font-kai);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.06),
    inset 0 -2px 4px rgba(0, 0, 0, 0.08),
    0 1px 1px rgba(0, 0, 0, 0.3),
    2px 4px 12px rgba(0, 0, 0, 0.5),
    8px 14px 32px rgba(0, 0, 0, 0.45);
  transform: rotate(-1deg);
  animation: noteViewIn 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.1);
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}
@keyframes noteViewIn {
  0%   { transform: rotate(-1deg) scale(0.85); opacity: 0; }
  60%  { transform: rotate(-1deg) scale(1.04); opacity: 1; }
  100% { transform: rotate(-1deg) scale(1); opacity: 1; }
}
.note-view-modal::before {
  content: "";
  position: absolute;
  top: -10px; left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  width: 70px; height: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7) 0%, rgba(255, 255, 255, 0.4) 50%, rgba(255, 255, 255, 0.15) 100%);
  border-left: 1px solid rgba(0, 0, 0, 0.06);
  border-right: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  opacity: 0.85;
}
.note-view-text {
  font-size: 17px;
  line-height: 1.7;
  letter-spacing: 0.5px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink);
  font-weight: 500;
  margin-bottom: 14px;
  text-align: left;
}
.note-view-image {
  margin: 0 -8px 14px;
  text-align: center;
}
.note-view-image img {
  display: inline-block;
  max-width: 100%;
  max-height: 240px;
  border-radius: 1px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}
.note-view-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px dashed rgba(42, 26, 8, 0.18);
  font-family: var(--font-kai);
  font-size: 13px;
  color: rgba(42, 26, 8, 0.6);
  margin-bottom: 14px;
}
.note-view-signature {
  flex: 1 1 auto;
  text-align: left;
  font-weight: 600;
  color: rgba(42, 26, 8, 0.75);
  letter-spacing: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.note-view-date {
  flex: 0 0 auto;
  font-size: 12px;
  color: rgba(42, 26, 8, 0.45);
  letter-spacing: 0.5px;
}
.note-view-modal .modal-actions {
  margin-top: 4px;
  justify-content: center;
}

/* ========== 黑板墙：便条 ========== */
.notes-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.note {
  position: absolute;
  width: clamp(140px, 18vw, 170px);
  min-height: clamp(95px, 12vw, 115px);
  padding: 30px 14px 18px;
  border-radius: 1px;
  /* 多层阴影：纸张厚度 + 黑色阴影 + 卷边 */
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.06),
    inset 0 -2px 4px rgba(0, 0, 0, 0.08),
    0 1px 1px rgba(0, 0, 0, 0.3),
    2px 4px 12px rgba(0, 0, 0, 0.5),
    4px 8px 22px rgba(0, 0, 0, 0.25);
  cursor: grab;
  font-family: var(--font-brush);
  font-size: clamp(15px, 1.9vw, 18px);
  line-height: 1.5;
  color: var(--ink);
  user-select: none;
  transform: rotate(-2deg);
  transition: transform 0.25s cubic-bezier(0.4, 1.4, 0.6, 1), box-shadow 0.25s ease;
  filter: url(#paper);
  animation: noteIn 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  display: flex;
  flex-direction: column;      /* 图与文字纵向堆叠：附图不再挤扁正文 */
  align-items: center;
  justify-content: center;
  text-align: center;
}
@keyframes noteIn {
  0% { opacity: 0; transform: rotate(-2deg) scale(0.4) translateY(-30px); }
  60% { opacity: 1; transform: rotate(-2deg) scale(1.06) translateY(4px); }
  100% { opacity: 1; transform: rotate(-2deg) scale(1) translateY(0); }
}
.note:active { cursor: grabbing; }
.note:hover {
  /* hover：抬起、归正、加深阴影 */
  transform: rotate(0deg) scale(1.05) translateY(-3px);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.06),
    inset 0 -2px 4px rgba(0, 0, 0, 0.08),
    0 2px 3px rgba(0, 0, 0, 0.35),
    4px 8px 20px rgba(0, 0, 0, 0.55),
    8px 14px 32px rgba(0, 0, 0, 0.3);
  z-index: 10;
}
.note.dragging {
  transform: rotate(0deg) scale(1.08) translateY(-2px);
  transition: none;
  z-index: 50;
}

/* 便签左上角小折痕 */
.note::after {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 14px; height: 14px;
  background: linear-gradient(135deg, transparent 50%, rgba(0, 0, 0, 0.12) 50%);
  pointer-events: none;
}

/* 胶带：双层（更立体） */
.note::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%) rotate(-1.5deg);
  width: 68px;
  height: 22px;
  background: linear-gradient(180deg, rgba(255, 235, 120, 0.65) 0%, rgba(255, 220, 80, 0.5) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    0 2px 4px rgba(0, 0, 0, 0.2);
  border-radius: 1px;
}

.note-text {
  width: 100%;                 /* column flex 中保持整行换行，不被 shrink-to-fit */
  word-break: break-word;
  white-space: pre-wrap;
  font-weight: 500;
  text-shadow: 0 0 0.5px rgba(42, 26, 8, 0.15);
}

/* 便签底部：署名 + 日期 */
.note-meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 6px;
  padding: 0 10px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  font-family: var(--font-kai);
  font-size: 12px;
  color: rgba(42, 26, 8, 0.55);
  letter-spacing: 1px;
  pointer-events: none;
  line-height: 1.2;
}
.note-meta .note-signature {
  flex: 1 1 auto;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}
.note-meta .note-date {
  flex: 0 0 auto;
  font-size: 11px;
  color: rgba(42, 26, 8, 0.45);
  white-space: nowrap;
  font-family: var(--font-sans);
}

/* 便签内附图 */
.note-image {
  display: block;
  max-width: 90%;
  max-height: 110px;
  margin: 0 auto 4px;
  border-radius: 2px;
  object-fit: contain;
  pointer-events: none;       /* 不拦截双击删除 / 拖动 */
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* 墙页内容（m3 重理：不再用 margin-top 偏移，改用绝对定位） */
.wall-content {
  position: absolute;
  top: 60px;        /* 离板顶的距离 */
  left: 0;
  right: 0;         /* 占满父级宽度，让 text-align: center 真正居中 */
  z-index: 2;
  pointer-events: none;
  text-align: center;
  white-space: nowrap;
}
.wall-title {
  font-size: clamp(22px, 3.2vw, 30px);
  letter-spacing: 6px;
  margin: 0;
}
.chalk-stats {
  font-size: 14px;
  color: var(--chalk-soft);
  letter-spacing: 3px;
  margin-top: 6px;
  font-family: var(--font-sans);
}
.wall-hint {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 14px;
  color: rgba(244, 241, 234, 0.45);
  letter-spacing: 2px;
  z-index: 2;
  margin: 0;
  text-align: center;
  pointer-events: none;
}

/* ========== 模态框 ========== */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: maskIn 0.2s ease;
  padding: 16px;
}
@keyframes maskIn { from { opacity: 0; } to { opacity: 1; } }

.chalk-modal {
  background: linear-gradient(180deg, #243430 0%, #1f2a25 100%);
  border: 2px solid var(--board-edge);
  border-radius: 6px;
  padding: 28px;
  width: 100%;
  max-width: 380px;
  color: var(--chalk);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  position: relative;
}
.chalk-modal::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.4' numOctaves='2' seed='4'/><feColorMatrix values='0 0 0 0 0.96 0 0 0 0 0.94 0 0 0 0 0.86 0 0 0 0.06 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  pointer-events: none;
  opacity: 0.45;
  mix-blend-mode: overlay;
  border-radius: 4px;
}
.chalk-modal h3 {
  font-family: var(--font-brush);
  font-size: 22px;
  letter-spacing: 4px;
  margin-bottom: 18px;
  text-align: center;
  position: relative;
  z-index: 1;
}
.chalk-modal input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(244, 241, 234, 0.08);
  border: 1px dashed rgba(244, 241, 234, 0.4);
  border-radius: 3px;
  color: var(--chalk);
  font-family: var(--font-kai);
  font-size: 17px;
  letter-spacing: 2px;
  outline: none;
  margin-bottom: 18px;
  position: relative;
  z-index: 1;
}
.chalk-modal input:focus {
  border-color: var(--chalk);
  background: rgba(244, 241, 234, 0.12);
}
.chalk-modal input::placeholder { color: var(--chalk-soft); }

.modal-quote {
  font-family: var(--font-brush);
  font-size: 17px;
  line-height: 1.5;
  color: var(--chalk);
  margin-bottom: 18px;
  text-align: center;
  padding: 14px 12px;
  background: rgba(244, 241, 234, 0.05);
  border-radius: 3px;
  position: relative;
  z-index: 1;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.chalk-modal.small { max-width: 340px; }

/* 换一组按钮（顶部小字） */
.shuffle-btn {
  position: absolute;
  top: 86px;
  right: 30px;
  padding: 4px 10px;
  font-family: var(--font-kai);
  font-size: 12px;
  color: rgba(244, 241, 234, 0.5);
  background: rgba(244, 241, 234, 0.06);
  border: 1px dashed rgba(244, 241, 234, 0.35);
  border-radius: 2px;
  cursor: pointer;
  letter-spacing: 3px;
  z-index: 2;
  filter: url(#chalk);
  transition: all 0.2s;
  font-weight: 500;
}
.shuffle-btn:hover {
  color: var(--chalk);
  background: rgba(244, 241, 234, 0.12);
  border-color: var(--chalk);
}
.shuffle-btn:active { transform: scale(0.96); }

/* ========== 落款（欢迎页底部） ========== */
.footer-mark {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-kai);
  font-size: 14px;
  color: rgba(244, 241, 234, 0.42);
  letter-spacing: 4px;
  z-index: 1;
  pointer-events: none;
  white-space: nowrap;
}

/* ========== 角落小印章 ========== */
.seal-corner {
  position: absolute;
  bottom: 56px;
  left: 28px;
  width: 38px;
  height: 38px;
  background: var(--seal);
  color: var(--paper-bg);
  font-family: var(--font-brush);
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
  transform: rotate(3deg);
  filter: url(#seal);
  z-index: 2;
  pointer-events: none;
  letter-spacing: 0;
}

/* ========== 黑板氛围：角落涂鸦 + 短句 ========== */
/* SVG 小涂鸦（苹果 / 粉笔 / 花 / 桃心），白粉笔 + 滤镜模拟粉笔粗糙感 */
.chalk-doodle {
  position: absolute;
  color: rgba(244, 241, 234, 0.42);
  filter: url(#chalk);
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.3s;
}
.chalk-doodle svg { display: block; }

/* 角落短句（粉笔字 + 字间距） */
.chalk-text {
  position: absolute;
  font-family: var(--font-kai);
  font-size: 14px;
  color: rgba(244, 241, 234, 0.32);
  letter-spacing: 4px;
  z-index: 1;
  pointer-events: none;
  white-space: nowrap;
  font-weight: 400;
  filter: url(#chalk);
}
.chalk-text strong {
  color: rgba(244, 241, 234, 0.55);
  font-weight: 600;
}

/* 位置预设（让 HTML 简洁） */
.doodle-tl { top: 60px; left: 28px; }
.doodle-tr { top: 60px; right: 28px; }
.doodle-bl { bottom: 70px; left: 28px; }
.doodle-br { bottom: 70px; right: 28px; }
.doodle-mid-l { top: 50%; left: 24px; transform: translateY(-50%); }
.doodle-mid-r { top: 50%; right: 24px; transform: translateY(-50%); }

.chalk-tl { top: 70px; left: 50%; transform: translateX(-50%); }
.chalk-tl-l { top: 60px; left: 32px; }
.chalk-tl-r { top: 60px; right: 32px; }
.chalk-bl-l { bottom: 70px; left: 32px; }
.chalk-bl-r { bottom: 70px; right: 32px; }

/* 欢迎页右上：9.10 教师节 + 小苹果 */
.date-stamp {
  font-family: var(--font-kai);
  font-size: 14px;
  color: rgba(244, 241, 234, 0.45);
  letter-spacing: 3px;
  filter: url(#chalk);
}

/* ========== 黑板真·氛围：课题/课程/值日/作业/倒计时/公式 ========== */
/* 课题（最顶部，红粉笔，醒目） */
.chalk-topic {
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-kai);
  font-size: 14px;
  color: rgba(220, 110, 90, 0.62);  /* 偏红的粉笔 */
  letter-spacing: 2px;
  z-index: 1;
  pointer-events: none;
  white-space: nowrap;
  filter: url(#chalk);
  font-weight: 500;
}
.chalk-topic strong {
  color: rgba(244, 241, 234, 0.72);
  font-weight: 600;
  letter-spacing: 3px;
}

/* 小卡（虚线边框，半透明背景，模拟黑板上的"分块"） */
.chalk-card {
  position: absolute;
  background: rgba(244, 241, 234, 0.04);
  border: 1px dashed rgba(244, 241, 234, 0.28);
  border-radius: 2px;
  padding: 6px 9px 7px;
  font-family: var(--font-kai);
  z-index: 1;
  pointer-events: none;
  filter: url(#chalk);
  line-height: 1.5;
  min-width: 0;
}
.chalk-card-title {
  font-size: 13px;
  color: rgba(244, 241, 234, 0.72);
  letter-spacing: 3px;
  margin-bottom: 4px;
  font-weight: 600;
  border-bottom: 1px dashed rgba(244, 241, 234, 0.2);
  padding-bottom: 2px;
}
.chalk-card-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: rgba(244, 241, 234, 0.5);
  letter-spacing: 1px;
  line-height: 1.55;
}
.chalk-card-item .num {
  color: rgba(220, 110, 90, 0.6);
  font-weight: 600;
  flex: 0 0 14px;
}
.chalk-card-item .subj {
  flex: 0 0 28px;
  letter-spacing: 0;
}
.chalk-card-item .topic {
  color: rgba(244, 241, 234, 0.42);
  text-align: right;
  flex: 1 1 auto;
}

/* 值日生小卡（更小，2-3 行） */
.chalk-card-duty {
  font-size: 13px;
  color: rgba(244, 241, 234, 0.6);
  letter-spacing: 2px;
  line-height: 1.7;
}

/* 学科涂鸦：公式/单词/古诗（半透明小字） */
.chalk-subject {
  position: absolute;
  font-family: var(--font-kai);
  font-size: 13px;
  color: rgba(244, 241, 234, 0.32);
  letter-spacing: 1px;
  pointer-events: none;
  z-index: 1;
  white-space: nowrap;
  filter: url(#chalk);
  line-height: 1.3;
}
.chalk-subject.italic { font-style: italic; }
.chalk-subject.mono { font-family: "Courier New", "Consolas", monospace; letter-spacing: 0; }

/* 倒计时（红粉笔，醒目） */
.chalk-countdown {
  position: absolute;
  font-family: var(--font-kai);
  font-size: 14px;
  color: rgba(220, 110, 90, 0.62);
  letter-spacing: 2px;
  pointer-events: none;
  z-index: 1;
  white-space: nowrap;
  filter: url(#chalk);
  font-weight: 500;
}
.chalk-countdown .num { color: rgba(255, 200, 160, 0.85); font-weight: 700; font-size: 16px; }

/* 作业 / 通知 / 提示（小字） */
.chalk-notice {
  position: absolute;
  font-family: var(--font-kai);
  font-size: 13px;
  color: rgba(244, 241, 234, 0.5);
  letter-spacing: 1.5px;
  pointer-events: none;
  z-index: 1;
  white-space: nowrap;
  filter: url(#chalk);
}
.chalk-notice strong { color: rgba(244, 241, 234, 0.7); font-weight: 600; }
.chalk-notice .tag {
  color: rgba(220, 110, 90, 0.6);
  font-weight: 600;
  margin-right: 4px;
}

/* 位置预设 */
.card-tl { top: 110px; left: 30px; }
.card-tr { top: 110px; right: 30px; }
.card-bl { bottom: 130px; left: 30px; }
.card-br { bottom: 130px; right: 30px; }

.countdown-bl { bottom: 130px; left: 30px; }
.countdown-br { bottom: 130px; right: 30px; }
.countdown-tl { top: 110px; left: 30px; }
.countdown-tr { top: 110px; right: 30px; }

/* ========== 页面进入动画（stagger） ========== */
@keyframes pageRise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pageFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* 欢迎页元素顺序入场 */
.page.active .chalk-title { animation: pageRise 0.7s 0.05s both; }
.page.active .chalk-subtitle { animation: pageRise 0.7s 0.18s both; }
.page.active .chalk-tip { animation: pageRise 0.7s 0.28s both; }
.page.active .chalk-btn { animation: pageRise 0.7s 0.38s both; }
.page.active .seal { animation: pageFade 0.9s 0.55s both; }
.page.active .seal-corner { animation: pageFade 0.9s 0.6s both; }
.page.active .verse { animation: pageFade 1.1s 0.05s both; }
.page.active .footer-mark { animation: pageFade 1.2s 0.7s both; }

/* 选老师页 */
.page.active .chalk-title-sm { animation: pageRise 0.6s 0.05s both; }
.page.active .teacher-grid { animation: pageRise 0.6s 0.18s both; }
.page.active .chalk-btn-outline { animation: pageRise 0.6s 0.3s both; }

/* 写印象页 */
.page.active .notebook-paper { animation: pageRise 0.6s 0.15s both; }
.page.active .paper-picker { animation: pageRise 0.6s 0.25s both; }

/* 墙页 */
.page.active .wall-content { animation: pageRise 0.6s 0.05s both; }
.page.active .note { animation: noteIn 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both; }

/* ========== 滚动条 ========== */
.teacher-grid::-webkit-scrollbar { width: 4px; }
.teacher-grid::-webkit-scrollbar-track { background: transparent; }
.teacher-grid::-webkit-scrollbar-thumb { background: rgba(244, 241, 234, 0.2); border-radius: 2px; }

/* ========== 适配 ========== */

/* 平板 */
@media (max-width: 1024px) and (orientation: landscape) {
  .board-frame {
    max-width: 92vw;
    height: min(85vh, 70vw, 640px);
  }
}

/* 手机：横屏 */
@media (max-width: 900px) and (orientation: landscape) {
  .board-frame {
    max-width: 96vw;
    height: 88vh;
    padding: 8px;
  }
  .chalk-title { font-size: 32px; letter-spacing: 4px; }
  .chalk-title-sm { font-size: 22px; }
  .chalk-tip { margin: 6px 0 10px; }
  .teacher-grid { max-height: 36vh; }
  .seal { width: 40px; height: 40px; font-size: 16px; bottom: 32px; right: 18px; }
  .seal-small { width: 32px; height: 32px; font-size: 14px; bottom: 24px; right: 14px; }
  .verse { font-size: 12px; letter-spacing: 4px; }
  .verse-top { top: 16px; }
  .verse-bottom { bottom: 16px; }
  .chalk-tray:not(#chalk-tray) { height: 12px; }
  .chalk-piece { width: 22px; height: 6px; }
  .chalk-piece.eraser { width: 40px; height: 10px; }
  .footer-mark { font-size: 13px; }
  .chalk-stats { font-size: 13px; }
  /* 横屏也缩角落涂鸦 */
  .chalk-doodle { transform: scale(0.7); }
  .chalk-doodle.doodle-tr, .chalk-doodle.chalk-tl-r, .chalk-doodle.chalk-bl-r { transform-origin: top right; }
  .chalk-doodle.doodle-bl, .chalk-doodle.chalk-bl-l { transform-origin: bottom left; }
  .chalk-text { font-size: 12px; letter-spacing: 2px; }
}

/* 手机：竖屏 */
@media (max-width: 640px), (max-width: 900px) and (orientation: portrait) {
  .page { padding: 12px; padding-top: 60px; }
  .board-frame {
    max-width: 96vw;
    height: min(78vh, 130vw, 600px);
    padding: 8px;
  }
  .chalk-title {
    font-size: clamp(28px, 8vw, 36px);
    letter-spacing: 4px;
    margin-bottom: 10px;
  }
  .chalk-title-sm {
    font-size: clamp(20px, 5.5vw, 26px);
    letter-spacing: 3px;
  }
  .chalk-subtitle { font-size: 14px; letter-spacing: 3px; }
  .chalk-tip { font-size: 14px; margin: 6px 0 10px; }
  .chalk-btn {
    font-size: 17px;
    letter-spacing: 6px;
    padding: 10px 32px;
  }
  .chalk-btn-outline { font-size: 14px; padding: 8px 18px; }
  .teacher-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    max-height: 38vh;
    min-height: 0;          /* m8 修复：grid 子项允许收缩到 0 才能被 max-height 约束 */
  }
  .teacher-card { padding: 14px 8px; }
  .teacher-name { font-size: 16px; }
  .notebook-paper {
    padding: 16px 14px 16px 36px;
    max-width: 100%;
  }
  #keyword-input { font-size: 16px; min-height: 50px; }
  .paper-picker { gap: 10px; }
  .paper-dot { width: 32px; height: 32px; }
  .paper-wheel { width: 36px; height: 36px; }
  .signature-input { font-size: 14px; padding: 7px 10px; }
  .signature-date { font-size: 13px; letter-spacing: 1px; }
  .note {
    width: clamp(120px, 28vw, 150px);
    min-height: clamp(80px, 18vw, 100px);
    font-size: 15px;
    padding: 24px 10px 22px;
  }
  .note-meta { font-size: 12px; padding: 0 8px; bottom: 4px; }
  .note-meta .note-date { font-size: 10px; }
  .seal { width: 42px; height: 42px; font-size: 17px; bottom: 24px; right: 16px; }
  .seal-small { width: 32px; height: 32px; font-size: 14px; bottom: 20px; right: 12px; }
  .verse { font-size: 12px; letter-spacing: 3px; }
  .verse-top { top: 14px; }
  .verse-bottom { bottom: 14px; }
  /* 装饰托盘（welcome/wall 4 个粉笔条）压扁；写信页 #chalk-tray 保持 56px */
  .chalk-tray:not(#chalk-tray) { height: 12px; }
  .chalk-piece { width: 20px; height: 5px; }
  .chalk-piece.eraser { width: 38px; height: 9px; }
  .topbar-title { font-size: 16px; letter-spacing: 3px; }
  .wall-fab { bottom: 18px; right: 64px; }
  .wall-share { bottom: 18px; right: 124px; }
  .wall-hint { font-size: 12px; bottom: 76px; letter-spacing: 1px; }
  /* 角落氛围：移动端缩小、不挤主内容 */
  .chalk-doodle { transform: scale(0.8); transform-origin: top left; }
  .chalk-doodle.doodle-tr, .chalk-doodle.chalk-tl-r, .chalk-doodle.chalk-bl-r { transform-origin: top right; }
  .chalk-doodle.doodle-bl, .chalk-doodle.chalk-bl-l { transform-origin: bottom left; }
  .chalk-text { font-size: 13px; letter-spacing: 2px; }
  .doodle-tl, .doodle-tr, .chalk-tl-l, .chalk-tl-r { top: 50px; }
  .doodle-bl, .doodle-br, .chalk-bl-l, .chalk-bl-r { bottom: 60px; }
  /* 黑板小卡：移动端隐藏个别元素以免挤主内容（仍保留 1-2 个） */
  .chalk-card { font-size: 11px; padding: 4px 7px 5px; }
  .chalk-card-title { font-size: 12px; letter-spacing: 2px; }
  .chalk-card-item { font-size: 11px; line-height: 1.45; }
  .card-tl, .countdown-tl { top: 90px; left: 14px; }
  .card-tr, .countdown-tr { top: 90px; right: 14px; }
  .card-bl, .countdown-bl { bottom: 90px; left: 14px; }
  .card-br, .countdown-br { bottom: 90px; right: 14px; }
  .chalk-topic { top: 50px; font-size: 13px; }
  .chalk-subject { font-size: 12px; }
  .chalk-countdown { font-size: 12px; }
  .shuffle-btn { top: 80px; right: 14px; font-size: 11px; padding: 3px 8px; }
  .footer-mark { font-size: 13px; letter-spacing: 3px; }
  .topbar { height: 50px; }
  .page { padding-top: 54px; }
  .chalk-stats { font-size: 13px; }
}

/* 超宽屏：黑板固定 920，居中显示 */
@media (min-width: 1400px) {
  .board-frame {
    max-width: 920px;
    height: 720px;
  }
}
