/* =========================================================
   《云学校》v0.1 — 后排靠窗的下午
   全部视觉由 CSS / SVG / Canvas 现场绘制，无任何外部资源。
   ========================================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --font-hand: "Kaiti SC", "STKaiti", "KaiTi", "Kaiti", "Songti SC", "Noto Serif CJK SC", "Microsoft YaHei", serif;
  --font-ui: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;

  --paper: #f6eddb;
  --paper-deep: #ebdfc6;
  --ink: #3b2e24;
  --ink-soft: #6b5847;
  --accent: #c0623f;
  --ring: rgba(255, 249, 233, 0.92);

  --wall-a: #e9d9b8;
  --wall-b: #d3bd97;
  --wall-c: #bfa578;
  --ceiling-a: #f4e9d4;
  --ceiling-b: #e1cfb0;
  --wainscot-a: #a3b097;
  --wainscot-b: #83957a;
  --floor-a: #a9784d;
  --floor-b: #8a5f38;
  --floor-c: #6f4a2a;

  --wood-a: #bd8551;
  --wood-b: #95633a;
  --wood-c: #6d4626;
  --wood-d: #54341c;

  --board-1: #2c4d3f;
  --board-2: #1d382d;
  --chalk: #f4efe0;

  --sky-a: #8fbfe0;
  --sky-b: #f8e9cb;
  --sky-c: #ffeccb;
  --sun: #fff3d2;
  --leaf-a: #7d9a63;
  --leaf-b: #55774a;
  --far: #b9c7bd;

  --door: #8aa292;
  --door-deep: #6d8577;
  --frost: rgba(233, 240, 232, 0.72);

  --beam: #ffe2a8;
  --beam-a: 0.32;
  --glow: rgba(255, 216, 150, 0.55);
  --tint: rgba(255, 205, 130, 0.16);
  --shade: rgba(72, 45, 24, 0.22);

  --ui-bg: rgba(38, 28, 20, 0.22);
  --ui-line: rgba(255, 246, 228, 0.26);
  --ui-ink: #fff6e6;

  color-scheme: light;
}

[data-light="morning"] {
  --wall-a: #ecefe3;
  --wall-b: #d9e0d0;
  --wall-c: #c6cfc0;
  --ceiling-a: #f5f8f1;
  --ceiling-b: #e4eade;
  --wainscot-a: #a6b8a5;
  --wainscot-b: #869c86;
  --sky-a: #b6dcec;
  --sky-b: #eef7f5;
  --sky-c: #f7fbf8;
  --sun: #f4fcff;
  --beam: #dceff2;
  --beam-a: 0.24;
  --glow: rgba(214, 240, 244, 0.5);
  --tint: rgba(198, 230, 236, 0.18);
  --board-1: #2d4a45;
  --board-2: #1f3834;
  --door: #8ba59b;
  --door-deep: #6f8a80;
  --shade: rgba(50, 62, 58, 0.2);
}

[data-light="dusk"] {
  --wall-a: #edcaa5;
  --wall-b: #d4a17a;
  --wall-c: #b98359;
  --ceiling-a: #f0d6b8;
  --ceiling-b: #dcb896;
  --wainscot-a: #a89a86;
  --wainscot-b: #87775f;
  --floor-a: #a46c42;
  --floor-b: #7f4f2e;
  --floor-c: #5f3a22;
  --wood-a: #c08a58;
  --wood-b: #95633a;
  --sky-a: #7c86bd;
  --sky-b: #ffb98d;
  --sky-c: #ffd0a5;
  --sun: #ffd9a8;
  --leaf-a: #7c7a5c;
  --leaf-b: #565c48;
  --far: #c9a898;
  --door: #8d8f7e;
  --door-deep: #6d7060;
  --beam: #ff9f66;
  --beam-a: 0.34;
  --glow: rgba(255, 160, 100, 0.55);
  --tint: rgba(255, 140, 90, 0.2);
  --shade: rgba(66, 34, 20, 0.26);
  --ui-bg: rgba(48, 26, 20, 0.26);
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: #171310;
  color: var(--ui-ink);
  font-family: var(--font-ui);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  touch-action: manipulation;
}

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  isolation: isolate;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

/* ---------------------------------------------------------
   舞台：SVG 房间 + 氛围 Canvas + 特效 Canvas
   --------------------------------------------------------- */

.stage {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(120% 90% at 50% 10%, rgba(255, 236, 205, 0.1), transparent 60%),
    linear-gradient(180deg, #2a211a, #14100d 70%);
}

.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 100% at 50% 45%, transparent 45%, rgba(10, 7, 5, 0.55) 100%),
    linear-gradient(180deg, rgba(10, 8, 6, 0.28), transparent 22%, transparent 82%, rgba(10, 8, 6, 0.35));
  z-index: 4;
}

#scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#ambience {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: 0.9;
}

#fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 70;
  pointer-events: none;
}

/* 光线过渡：所有大面积色块都慢慢换气 */
.wall-base,
.wall-panel,
.wainscot-face,
.ceiling-face,
.floor-face,
.beam-face,
.sill-face,
.door-face,
.door-deep,
.board-face,
.wood-frame {
  transition: fill 0.95s ease, stop-color 0.95s ease, opacity 0.95s ease;
}

.s-ceil-a,
.s-ceil-b,
.s-wall-a,
.s-wall-b,
.s-wall-c,
.s-wains-a,
.s-wains-b,
.s-floor-a,
.s-floor-b,
.s-floor-c,
.s-wood-a,
.s-wood-b,
.s-wood-c,
.s-board-a,
.s-board-b,
.s-sky-a,
.s-sky-b,
.s-sky-c,
.s-beam,
.s-curtain-a,
.s-curtain-b,
.s-frost-a,
.s-frost-b {
  transition: stop-color 0.95s ease;
}

.s-ceil-a { stop-color: var(--ceiling-a); }
.s-ceil-b { stop-color: var(--ceiling-b); }
.s-wall-a { stop-color: var(--wall-a); }
.s-wall-b { stop-color: var(--wall-b); }
.s-wall-c { stop-color: var(--wall-c); }
.s-wains-a { stop-color: var(--wainscot-a); }
.s-wains-b { stop-color: var(--wainscot-b); }
.s-floor-a { stop-color: var(--floor-a); }
.s-floor-b { stop-color: var(--floor-b); }
.s-floor-c { stop-color: var(--floor-c); }
.s-wood-a { stop-color: var(--wood-a); }
.s-wood-b { stop-color: var(--wood-b); }
.s-wood-c { stop-color: var(--wood-c); }
.s-board-a { stop-color: var(--board-1); }
.s-board-b { stop-color: var(--board-2); }
.s-sky-a { stop-color: var(--sky-a); }
.s-sky-b { stop-color: var(--sky-b); }
.s-sky-c { stop-color: var(--sky-c); }
.s-beam { stop-color: var(--beam); }
.s-curtain-a { stop-color: #f3e8d2; }
.s-curtain-b { stop-color: #ddc9a6; }
.s-frost-a { stop-color: rgba(244, 248, 240, 0.88); }
.s-frost-b { stop-color: rgba(228, 236, 226, 0.72); }

.light-wash {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0.75;
  mix-blend-mode: soft-light;
  background: radial-gradient(80% 70% at 78% 26%, var(--glow), transparent 62%);
  transition: background 0.95s ease, opacity 0.95s ease;
}

/* ---------------------------------------------------------
   顶部极简浮动栏
   --------------------------------------------------------- */

.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: clamp(14px, 2.2vw, 26px) clamp(16px, 2.6vw, 34px);
  pointer-events: none;
}

.topbar::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 150%;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(26, 18, 12, 0.46), rgba(26, 18, 12, 0.12) 55%, rgba(26, 18, 12, 0));
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 2px;
  pointer-events: none;
  filter: drop-shadow(0 2px 10px rgba(20, 12, 8, 0.45));
}

.brand__title {
  margin: 0;
  font-family: var(--font-hand);
  font-size: clamp(22px, 2.4vw, 30px);
  font-weight: 600;
  letter-spacing: 0.22em;
  color: #fff8ea;
}

.brand__title span {
  display: inline-block;
  color: #ffe6b8;
}

.brand__sub {
  margin: 0;
  font-size: clamp(10px, 0.95vw, 12px);
  letter-spacing: 0.2em;
  color: rgba(255, 244, 226, 0.66);
}

.controls {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  background: var(--ui-bg);
  border: 1px solid var(--ui-line);
  box-shadow: 0 8px 26px rgba(14, 9, 6, 0.28);
  backdrop-filter: blur(12px) saturate(1.05);
  -webkit-backdrop-filter: blur(12px) saturate(1.05);
  pointer-events: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.seg {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 999px;
  background: rgba(255, 247, 233, 0.08);
}

.seg__btn {
  position: relative;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: rgba(255, 246, 232, 0.72);
  white-space: nowrap;
  transition: color 0.2s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.seg__btn:hover {
  color: #fffaf0;
  background: rgba(255, 247, 233, 0.1);
}

.seg__btn[aria-pressed="true"] {
  color: #3a2b20;
  background: rgba(255, 243, 222, 0.94);
  box-shadow: 0 2px 10px rgba(20, 12, 6, 0.25);
}

.seg__btn:focus-visible,
.tool-btn:focus-visible,
.ghost-btn:focus-visible,
.preset:focus-visible,
.chalk-chip:focus-visible,
.action-btn:focus-visible {
  outline: 2px solid rgba(255, 246, 226, 0.9);
  outline-offset: 2px;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: rgba(255, 247, 234, 0.86);
  border: 1px solid transparent;
  transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

.tool-btn:hover {
  background: rgba(255, 247, 233, 0.12);
  border-color: rgba(255, 247, 233, 0.2);
}

.tool-btn[aria-pressed="true"] {
  background: rgba(255, 247, 233, 0.92);
  color: #3a2b20;
}

.tool-btn--round {
  width: 34px;
  height: 34px;
  padding: 0;
  justify-content: center;
  font-family: var(--font-hand);
  font-size: 16px;
  border-radius: 50%;
}

.sound-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c9b89d;
  box-shadow: 0 0 0 2px rgba(255, 246, 226, 0.12);
  transition: background 0.25s ease, box-shadow 0.25s ease;
}

.tool-btn[aria-pressed="true"] .sound-dot {
  background: #8fb27a;
  box-shadow: 0 0 10px rgba(143, 178, 122, 0.8);
}

/* ---------------------------------------------------------
   SVG 场景细节
   --------------------------------------------------------- */

.wall-base { fill: url(#wallGrad); }
.wainscot-face { fill: url(#wainscotGrad); }
.ceiling-face { fill: url(#ceilingGrad); }
.floor-face { fill: url(#floorGrad); }
.board-face { fill: url(#boardGrad); }
.wood-frame { fill: url(#woodGrad); }
.beam-face { fill: url(#beamGrad); opacity: var(--beam-a); }
.beam-soft { opacity: calc(var(--beam-a) * 0.62); }
.beam-soft-warm { opacity: calc(var(--beam-a) * 0.7); }
.sill-face { fill: url(#woodLightGrad); }
.door-face { fill: var(--door); }
.door-deep { fill: var(--door-deep); }

.chalk-line {
  fill: none;
  stroke: var(--chalk);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chalk-text {
  fill: var(--chalk);
  font-family: var(--font-hand);
  opacity: 0.82;
}

.chalk-ghost {
  fill: var(--chalk);
  font-family: var(--font-hand);
  opacity: 0.34;
}

.poster-paper {
  fill: rgba(248, 241, 224, 0.86);
}

.poster-ink {
  fill: rgba(88, 96, 78, 0.72);
  font-family: var(--font-hand);
}

.clock-face {
  fill: #f7f1e0;
  stroke: rgba(96, 70, 44, 0.55);
  stroke-width: 2;
}

.clock-ink {
  stroke: rgba(72, 54, 38, 0.86);
  stroke-linecap: round;
}

.curtain {
  fill: url(#curtainGrad);
  opacity: 0.92;
}

.fan-blade {
  fill: url(#bladeGrad);
  stroke: rgba(72, 52, 34, 0.28);
  stroke-width: 1.2;
}

.fan-hub {
  fill: url(#woodLightGrad);
  stroke: rgba(60, 40, 24, 0.35);
}

.fan-rod {
  stroke: rgba(64, 46, 30, 0.75);
  stroke-width: 6;
  stroke-linecap: round;
}

.fan-group {
  animation: fan-spin var(--fan-duration, 34s) linear infinite;
  animation-play-state: var(--fan-play, running);
  transform-box: fill-box;
  transform-origin: 50% 50%;
}

@keyframes fan-spin {
  to { transform: rotate(360deg); }
}

/* v0.2：窗帘的呼吸 —— 两条非整数倍的正弦，永远对不齐拍子 */
.curtain-breathe {
  transform-box: view-box;
  transform-origin: 1032px 142px;
  animation: curtain-breathe var(--curtain-duration, 13.7s) ease-in-out infinite;
  animation-play-state: var(--curtain-play, running);
}

.curtain-sway {
  transform-box: view-box;
  transform-origin: 1032px 142px;
  animation: curtain-sway calc(var(--curtain-duration, 19.3s) * 1.41) ease-in-out infinite;
  animation-play-state: var(--curtain-play, running);
}

@keyframes curtain-breathe {
  0%, 100% { transform: scaleX(1) translateX(0); }
  37% { transform: scaleX(calc(1 + var(--curtain-amp, 0.032))) translateX(1.6px); }
  68% { transform: scaleX(calc(1 + var(--curtain-amp, 0.032) * 0.45)) translateX(-0.9px); }
}

@keyframes curtain-sway {
  0%, 100% { transform: skewX(0deg) translateY(0); }
  52% { transform: skewX(calc(var(--curtain-amp, 0.032) * 34deg)) translateY(-1.4px); }
}

/* 阳光跟着窗帘一起轻轻明暗呼吸 */
.beam-breathe {
  animation: beam-breathe 12.3s ease-in-out infinite;
}

@keyframes beam-breathe {
  0%, 100% { opacity: calc(var(--beam-a) * 0.5); }
  50% { opacity: calc(var(--beam-a) * 0.78); }
}

/* v0.2：挂钟秒针。平时 60 秒一圈；被盯久了会变慢，还会心虚地倒走一格 */
.clock-second {
  transform-box: view-box;
  transform-origin: 0 0;
  animation: clock-sweep 60s linear infinite;
}

.is-slow-clock .clock-second {
  animation-name: clock-sweep-slow;
  animation-duration: 240s;
}

@keyframes clock-sweep {
  to { transform: rotate(360deg); }
}

@keyframes clock-sweep-slow {
  0% { transform: rotate(0deg); }
  36% { transform: rotate(129.6deg); }
  41% { transform: rotate(123.6deg); }
  47% { transform: rotate(129.6deg); }
  78% { transform: rotate(280.8deg); }
  83% { transform: rotate(274.8deg); }
  89% { transform: rotate(280.8deg); }
  100% { transform: rotate(360deg); }
}

.fan-bob {
  animation: fan-bob 7s ease-in-out infinite;
}

@keyframes fan-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(1.4px); }
}

.dust-slow {
  animation: drift 26s ease-in-out infinite alternate;
}

@keyframes drift {
  from { transform: translate(0, 0); }
  to { transform: translate(-10px, 18px); }
}

.teacher-silhouette {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease, transform 0.9s cubic-bezier(0.22, 0.85, 0.24, 1);
}

.is-teacher .teacher-silhouette {
  opacity: 1;
  transform: translateY(0);
}

.teacher-body { fill: rgba(58, 54, 48, 0.82); }
.teacher-glass { fill: none; stroke: rgba(46, 42, 38, 0.92); stroke-width: 3; }
.teacher-lens { fill: rgba(240, 246, 240, 0.24); }
.teacher-cough {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.4s ease 0.5s, transform 0.4s ease 0.5s;
}
.is-teacher .teacher-cough { opacity: 1; transform: translateY(0); }

.frost-shine {
  animation: frost-breathe 9s ease-in-out infinite;
}

@keyframes frost-breathe {
  0%, 100% { opacity: 0.22; }
  50% { opacity: 0.4; }
}

.paper-note {
  transform-box: fill-box;
  transform-origin: 60% 60%;
  animation: paper-breathe 8s ease-in-out infinite;
}

@keyframes paper-breathe {
  0%, 100% { transform: rotate(0deg) translateY(0); }
  50% { transform: rotate(1.4deg) translateY(-1.4px); }
}

.snack-corner {
  animation: snack-peek 7.5s ease-in-out infinite;
}

@keyframes snack-peek {
  0%, 88%, 100% { transform: translateY(0); }
  93% { transform: translateY(-2.5px); }
}

/* ---------------------------------------------------------
   v0.2：课桌上那个极淡的「早」、会淡去的痕迹、涂改液三八线
   --------------------------------------------------------- */

.desk-carve {
  fill: rgba(255, 244, 220, 0.17);
  font-family: var(--font-hand);
  font-weight: 600;
  letter-spacing: 2px;
  paint-order: stroke;
  pointer-events: none;
  user-select: none;
}

.desk-traces,
.desk-glyphs {
  pointer-events: none;
}

.trace {
  transition: opacity 0.6s linear;
}

.trace--desk-line {
  fill: none;
  stroke: rgba(248, 245, 236, 0.82);
  stroke-width: 7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 刚画完的涂改液：湿的，表面有一层微反光 */
.trace--desk-line.is-wet {
  stroke: rgba(255, 255, 252, 0.94);
  filter: drop-shadow(0 0 3px rgba(255, 255, 250, 0.85)) drop-shadow(0 1px 0 rgba(70, 46, 26, 0.35));
}

/* 5 秒后干成哑光：不再反光，边缘毛一点 */
.trace--desk-line.is-dry {
  stroke: rgba(240, 237, 226, 0.72);
  filter: none;
  stroke-dasharray: 26 1.4;
}

.trace-chalk {
  fill: rgba(244, 240, 226, 0.5);
}

.trace-chalk--faint {
  fill: rgba(238, 240, 230, 0.32);
}

.trace-crumb {
  fill: rgba(214, 150, 84, 0.85);
}

.trace-ball {
  fill: rgba(246, 240, 222, 0.88);
  stroke: rgba(150, 124, 86, 0.4);
  stroke-width: 0.8;
}

.trace-ball-line {
  fill: none;
  stroke: rgba(150, 124, 86, 0.5);
  stroke-width: 0.9;
}

.desk-glyph {
  fill: none;
  stroke: rgba(255, 255, 252, 0.92);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 4px rgba(255, 255, 250, 0.9));
}

/* ---------------------------------------------------------
   v0.2：眼保健操的「闭眼看阳光」覆层
   整层不吃指针事件：吊扇、光线、声音按钮照旧能点，绝不误关眼操
   --------------------------------------------------------- */

.eye-layer {
  position: fixed;
  inset: 0;
  z-index: 39;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.9s ease, visibility 0.9s ease;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.eye-layer.is-open {
  opacity: 1;
  visibility: visible;
}

.eye-layer__sky {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 44%, rgba(255, 186, 106, 0.55), rgba(214, 96, 42, 0.72) 46%, rgba(126, 42, 20, 0.9) 100%);
  mix-blend-mode: multiply;
}

.eye-layer__halo {
  position: absolute;
  width: min(92vw, 760px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 236, 196, 0.5), rgba(255, 206, 140, 0.16) 46%, transparent 70%);
  filter: blur(6px);
  animation: eye-halo-breathe 7.6s ease-in-out infinite;
  mix-blend-mode: screen;
}

@keyframes eye-halo-breathe {
  0%, 100% { transform: scale(0.94); opacity: 0.62; }
  50% { transform: scale(1.06); opacity: 0.92; }
}

.eye-layer__hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, 96px);
  margin: 0;
  font-family: var(--font-hand);
  font-size: clamp(13px, 1.5vw, 17px);
  letter-spacing: 0.34em;
  color: rgba(255, 244, 224, 0.42);
  white-space: nowrap;
  transition: opacity 0.6s ease;
}

.eye-layer__sub {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, 130px);
  margin: 0;
  font-family: var(--font-hand);
  font-size: clamp(10px, 1.1vw, 12px);
  letter-spacing: 0.2em;
  color: rgba(255, 240, 220, 0.26);
  white-space: nowrap;
}

/* 眼皮与睫毛：只在偷看的那 0.8 秒掀开一条缝 */
.eye-layer__lashes {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(64vw, 520px);
  height: 2px;
  transform: translate(-50%, -22px) scaleY(0.06);
  opacity: 0;
  transition: transform 0.52s cubic-bezier(0.2, 0.9, 0.3, 1), opacity 0.3s ease;
  background: linear-gradient(90deg, transparent, rgba(64, 26, 10, 0.72), transparent);
  filter: blur(0.6px);
}

.eye-layer__lashes .eye-lash {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(48, 20, 8, 0.8), transparent);
}

.eye-lash--top { top: -5px; }
.eye-lash--bottom { bottom: -5px; }

.eye-layer.is-peeking .eye-layer__lashes {
  transform: translate(-50%, -22px) scaleY(1);
  opacity: 1;
}

/* 同桌也在指缝里偷看你 */
.eye-layer__mate {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(46vw, 320px);
  height: min(46vw, 320px);
  transform: translate(-50%, -30%) scale(0.9);
  opacity: 0;
  transition: opacity 0.26s ease, transform 0.55s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.eye-layer.is-peeking .eye-layer__mate {
  opacity: 1;
  transform: translate(-50%, -34%) scale(1);
}

.mate-face {
  position: absolute;
  inset: 24% 26% 26%;
  border-radius: 46% 46% 44% 44%;
  background: radial-gradient(circle at 40% 34%, rgba(58, 24, 10, 0.34), rgba(40, 16, 6, 0.16) 70%);
  filter: blur(1px);
}

.mate-eye {
  position: absolute;
  left: 50%;
  top: 47%;
  width: 38%;
  height: 3px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(38, 14, 4, 0.85), transparent);
  box-shadow: 0 0 10px rgba(255, 226, 170, 0.6);
}

.mate-hand {
  position: absolute;
  top: 30%;
  width: 30%;
  height: 42%;
  border-radius: 42% 42% 30% 30%;
  background: linear-gradient(180deg, rgba(58, 26, 12, 0.3), rgba(36, 16, 6, 0.14));
  filter: blur(1.2px);
}

.mate-hand--left { left: 4%; transform: rotate(-8deg); }
.mate-hand--right { right: 4%; transform: rotate(8deg); }

/* ---------------------------------------------------------
   v0.2：热区与按钮的微手感 —— 按下沉 2px / 缩到 0.98，松手柔和回弹
   --------------------------------------------------------- */

.hotspot {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.18s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.hotspot:active {
  transform: translateY(var(--hs-press, 2px)) scale(0.98);
}

.hotspot:active .hs-ring {
  opacity: 0.5;
}

/* 热区 */

.hotspot {
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.hs-ring {
  fill: none;
  stroke: var(--ring);
  stroke-width: 2;
  stroke-dasharray: 9 8;
  stroke-linecap: round;
  opacity: 0;
  transition: opacity 0.25s ease;
  filter: drop-shadow(0 0 7px rgba(255, 244, 216, 0.55));
  animation: ring-flow 18s linear infinite;
}

/* 窄屏：把热区悄悄放大一点，手指更好按
   （--hs-pad 由 view.js 按场景缩放比换算成"屏幕上约 6px"，不是场景单位） */
.is-narrow .hs-hit {
  stroke: rgba(255, 255, 255, 0.001);
  stroke-width: var(--hs-pad, 26);
}

@keyframes ring-flow {
  to { stroke-dashoffset: -170; }
}

.hotspot:hover .hs-ring,
.hotspot:focus-visible .hs-ring {
  opacity: 0.92;
}

.hs-tag {
  opacity: 0;
  transform: translateY(7px);
  transform-box: fill-box;
  transform-origin: center;
  transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.3, 0.9, 0.4, 1);
  pointer-events: none;
}

.hotspot:hover .hs-tag,
.hotspot:focus-visible .hs-tag,
.hints .hs-tag {
  opacity: 1;
  transform: translateY(0);
}

.hints .hs-tag {
  opacity: 0.9;
}

.hs-tag rect {
  fill: rgba(42, 32, 24, 0.82);
  stroke: rgba(255, 246, 226, 0.42);
  stroke-width: 1;
}

.hs-tag text {
  fill: #fdf5e4;
  font-family: var(--font-hand);
  font-size: 14px;
  letter-spacing: 0.09em;
}

.hotspot:active .hs-ring {
  opacity: 0.5;
}

/* 装认真：课本一立起来，背后教室就得干净——
   所有热区的虚线描边与悬浮物件名一起收掉，避免从书后面露出来 */
.is-pretending .hotspot .hs-ring,
.is-pretending .hotspot .hs-tag,
#app[data-activity="pretend"] .hotspot .hs-ring,
#app[data-activity="pretend"] .hotspot .hs-tag {
  opacity: 0 !important;
  transition: opacity 0.14s ease;
  pointer-events: none;
}

/* 眼保健操：眼皮放下来，热区描边与物件名一起藏起来；
   但吊扇仍然是可点的（覆层不吃指针事件） */
#app[data-activity="eye_exercise"] .hotspot .hs-ring,
#app[data-activity="eye_exercise"] .hotspot .hs-tag {
  opacity: 0 !important;
  transition: opacity 1.1s ease;
}

#app[data-activity="eye_exercise"] .scene-chip {
  opacity: 0 !important;
  visibility: hidden;
}

/* 手机窄屏的物件名标签：SVG 标签会随场景一起缩到看不清，
   窄屏改用固定字号的 HTML 小标签（位置由 view.js 按场景坐标换算） */

.scene-chips {
  position: fixed;
  inset: 0;
  z-index: 41;
  pointer-events: none;
}

.scene-chip {
  position: fixed;
  left: 0;
  top: 0;
  display: none;
  align-items: center;
  justify-content: center;
  height: 24px;
  padding: 0 6px;
  border-radius: 999px;
  font-family: var(--font-hand);
  font-size: 10px;
  line-height: 1;
  letter-spacing: 0.04em;
  white-space: nowrap;
  color: #fdf5e4;
  background: rgba(42, 32, 24, 0.8);
  border: 1px solid rgba(255, 246, 226, 0.32);
  box-shadow: 0 4px 12px rgba(12, 8, 5, 0.3);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.24s ease, visibility 0.24s ease;
  will-change: transform;
}

.is-phone .scene-chip {
  display: flex;
}

.is-phone.hints .scene-chip {
  opacity: 0.94;
  visibility: visible;
}

.is-pretending .scene-chip {
  opacity: 0 !important;
  visibility: hidden;
}

.sign-ui { font-family: var(--font-ui); }
.paper-ink,
.cough-ink,
.tag-ink,
.book-ink { font-family: var(--font-hand); }

.sill-paper {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  transition: opacity 0.4s ease;
}

.sill-paper__sheet {
  transform-box: fill-box;
  transform-origin: 50% 50%;
}

.sill-paper.is-folding .sill-paper__sheet {
  animation: paper-fold 0.58s cubic-bezier(0.4, 0.1, 0.2, 1) forwards;
}

@keyframes paper-fold {
  0% { transform: rotate(0deg) scale(1, 1); }
  35% { transform: rotate(-14deg) scale(0.88, 0.62); }
  70% { transform: rotate(-28deg) scale(0.52, 0.3); }
  100% { transform: rotate(-44deg) scale(0.16, 0.08); opacity: 0; }
}

/* 陌生校友的纸飞机落在窗台：一层微光 + 一架小纸飞机，轻轻提醒、不抢焦点 */

.plane-hint {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s ease, visibility 0.6s ease;
  pointer-events: none;
}

.plane-hint.is-shown {
  opacity: 1;
  visibility: visible;
}

.plane-hint__glow {
  transform-box: fill-box;
  transform-origin: center;
  animation: hint-breathe 5.8s ease-in-out infinite;
}

.plane-hint__float {
  transform-box: fill-box;
  transform-origin: center;
  animation: hint-float 6.6s ease-in-out infinite;
}

.plane-hint__label {
  fill: rgba(92, 70, 44, 0.8);
  font-family: var(--font-hand);
  font-size: 11px;
  letter-spacing: 0.16em;
}

@keyframes hint-breathe {
  0%, 100% { opacity: 0.42; }
  50% { opacity: 0.95; }
}

@keyframes hint-float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-3.4px) rotate(1.8deg); }
}

.action-btn:disabled,
.ghost-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ---------------------------------------------------------
   气泡 & 轻提示
   --------------------------------------------------------- */

.bubbles {
  position: absolute;
  top: clamp(78px, 11vh, 118px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: min(92vw, 720px);
}

.bubble {
  max-width: min(86vw, 560px);
  padding: 9px 18px;
  border-radius: 14px 14px 14px 4px;
  background: rgba(250, 242, 226, 0.95);
  color: #3b2e24;
  font-family: var(--font-hand);
  font-size: clamp(13px, 1.25vw, 16px);
  letter-spacing: 0.05em;
  line-height: 1.6;
  box-shadow: 0 10px 26px rgba(20, 12, 8, 0.28), inset 0 0 0 1px rgba(255, 255, 255, 0.6);
  animation: bubble-in 0.4s cubic-bezier(0.2, 0.9, 0.3, 1), bubble-out 0.5s ease 3.4s forwards;
}

.bubble--teacher {
  background: rgba(244, 236, 214, 0.96);
  border-left: 3px solid rgba(150, 110, 70, 0.7);
  font-style: italic;
}

.bubble--snack {
  background: rgba(255, 236, 210, 0.96);
}

.bubble--chalk {
  background: rgba(242, 244, 236, 0.95);
}

@keyframes bubble-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes bubble-out {
  to { opacity: 0; transform: translateY(-6px); }
}

.hint {
  position: absolute;
  left: 50%;
  bottom: clamp(12px, 2.4vh, 26px);
  transform: translateX(-50%);
  z-index: 45;
  margin: 0;
  padding: 7px 16px;
  border-radius: 999px;
  font-family: var(--font-hand);
  font-size: clamp(11px, 1.05vw, 13px);
  letter-spacing: 0.12em;
  color: rgba(255, 246, 230, 0.8);
  background: rgba(30, 22, 16, 0.3);
  border: 1px solid rgba(255, 246, 230, 0.14);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: none;
  transition: opacity 1s ease;
  white-space: nowrap;
}

.hint.is-faded {
  opacity: 0;
}

.orient {
  display: none;
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 45;
  margin: 0;
  padding: 5px 11px;
  border-radius: 999px;
  font-family: var(--font-hand);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: rgba(255, 246, 230, 0.62);
  background: rgba(30, 22, 16, 0.26);
  border: 1px solid rgba(255, 246, 230, 0.1);
  pointer-events: none;
}

@media (orientation: portrait) and (max-width: 760px) {
  .orient {
    display: block;
    bottom: 54px;
  }
}

/* ---------------------------------------------------------
   遮罩 / 局部近景
   --------------------------------------------------------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: clamp(14px, 3vw, 40px);
  background: radial-gradient(circle at 50% 42%, rgba(38, 27, 18, 0.42), rgba(16, 11, 8, 0.72));
  backdrop-filter: blur(4px) saturate(0.95);
  -webkit-backdrop-filter: blur(4px) saturate(0.95);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.sheet {
  position: relative;
  width: min(94vw, 1000px);
  max-height: 92vh;
  border-radius: 16px;
  background:
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0 2px, transparent 2px 5px),
    linear-gradient(160deg, #efe2c8, #e3d2b2 60%, #d9c6a3);
  color: var(--ink);
  box-shadow:
    0 40px 80px rgba(12, 8, 5, 0.55),
    0 2px 0 rgba(255, 255, 255, 0.5) inset,
    0 0 0 1px rgba(90, 62, 36, 0.28);
  transform: translateY(14px) scale(0.985);
  transition: transform 0.4s cubic-bezier(0.2, 0.9, 0.25, 1);
  overflow: hidden auto;
  overscroll-behavior: contain;
}

.overlay.is-open .sheet {
  transform: translateY(0) scale(1);
}

.sheet:focus {
  outline: none;
}

.sheet__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 10px;
}

.sheet__title {
  margin: 0;
  font-family: var(--font-hand);
  font-size: clamp(16px, 1.7vw, 21px);
  letter-spacing: 0.14em;
  color: #453426;
}

.sheet__sub {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: rgba(69, 52, 38, 0.55);
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 34px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(90, 62, 36, 0.28);
  background: rgba(255, 251, 240, 0.5);
  color: #4a3828;
  font-size: 12px;
  letter-spacing: 0.08em;
  transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.ghost-btn:hover {
  background: rgba(255, 252, 244, 0.9);
  border-color: rgba(90, 62, 36, 0.45);
}

.ghost-btn:active {
  transform: translateY(1px);
}

/* 黑板近景 */

.board-wrap {
  padding: 4px clamp(12px, 2vw, 22px) 0;
}

.board-frame {
  padding: clamp(8px, 1.1vw, 14px);
  border-radius: 12px;
  background: linear-gradient(160deg, #a97544, #7d512e 55%, #5f3b20);
  box-shadow:
    0 2px 0 rgba(255, 226, 190, 0.35) inset,
    0 12px 26px rgba(40, 24, 12, 0.35);
}

.board-glass {
  position: relative;
  border-radius: 5px;
  overflow: hidden;
  background:
    radial-gradient(120% 100% at 30% 0%, rgba(255, 255, 255, 0.06), transparent 60%),
    linear-gradient(150deg, var(--board-1), var(--board-2));
  box-shadow:
    0 0 0 2px rgba(18, 34, 28, 0.55) inset,
    0 0 40px rgba(8, 20, 16, 0.4) inset;
  aspect-ratio: 16 / 7;
}

.board-glass::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(60% 40% at 18% 26%, rgba(244, 240, 226, 0.09), transparent 70%),
    radial-gradient(50% 40% at 78% 68%, rgba(244, 240, 226, 0.05), transparent 70%);
  mix-blend-mode: screen;
}

.board-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

.board-eraser {
  position: absolute;
  left: 42%;
  top: 46%;
  width: 15%;
  aspect-ratio: 2 / 1;
  border-radius: 4px;
  background: linear-gradient(170deg, #4c5a52 0 46%, #a88a63 46% 100%);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45);
  transform: rotate(-14deg);
  transition: transform 0.36s cubic-bezier(0.3, 0.9, 0.3, 1), opacity 0.3s ease;
  opacity: 0;
  pointer-events: none;
}

.board-eraser.is-clapping {
  animation: eraser-clap 0.5s ease;
}

@keyframes eraser-clap {
  0% { opacity: 0; transform: translate(0, 0) rotate(-14deg); }
  22% { opacity: 1; }
  45% { transform: translate(-16%, 8%) rotate(9deg); }
  62% { transform: translate(6%, 12%) rotate(-20deg); }
  100% { opacity: 0; transform: translate(20%, 4%) rotate(2deg); }
}

.board-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 14px clamp(14px, 2vw, 22px) 18px;
}

.chalk-chips {
  display: flex;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(58, 44, 30, 0.1);
}

.chalk-chip {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chalk-chip[aria-pressed="true"] {
  box-shadow: 0 0 0 2px rgba(70, 50, 32, 0.65), 0 0 12px rgba(255, 255, 255, 0.4);
  transform: scale(1.06);
}

.chalk-chip--white { background: #f6f1e2; }
.chalk-chip--yellow { background: #f4e6a8; }
.chalk-chip--pink { background: #efc9c4; }

.action-btn {
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: 0.1em;
  color: #3f2f22;
  background: rgba(255, 251, 240, 0.78);
  border: 1px solid rgba(90, 62, 36, 0.24);
  box-shadow: 0 3px 0 rgba(122, 88, 56, 0.18);
  transition: transform 0.16s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.action-btn:hover {
  background: #fffdf6;
  transform: translateY(-1px);
  box-shadow: 0 5px 0 rgba(122, 88, 56, 0.16);
}

.action-btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 rgba(122, 88, 56, 0.2);
}

.action-btn--ghost {
  background: transparent;
  box-shadow: none;
  border-color: rgba(90, 62, 36, 0.22);
}

.board-note {
  margin-left: auto;
  font-family: var(--font-hand);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: rgba(70, 52, 36, 0.55);
}

/* 纸条 */

.overlay--note {
  place-items: center start;
  padding-left: clamp(16px, 7vw, 120px);
  background: linear-gradient(100deg, rgba(16, 11, 8, 0.7), rgba(16, 11, 8, 0.12) 70%, transparent);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.note-card {
  position: relative;
  width: min(88vw, 420px);
  padding: 26px 26px 20px;
  color: #3a2f26;
  border-radius: 4px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent 14%),
    repeating-linear-gradient(180deg, transparent 0 27px, rgba(120, 150, 170, 0.24) 27px 28px),
    linear-gradient(150deg, #f7f0dc, #efe4c9);
  box-shadow:
    0 30px 60px rgba(10, 7, 5, 0.45),
    inset 0 0 40px rgba(180, 150, 100, 0.16);
  transform: translateX(-26px) rotate(-1.1deg);
  transition: transform 0.45s cubic-bezier(0.2, 0.9, 0.25, 1);
  font-family: var(--font-hand);
}

.overlay.is-open .note-card {
  transform: translateX(0) rotate(-1.1deg);
}

.note-card::before {
  content: "";
  position: absolute;
  left: 26px;
  right: 26px;
  top: 50%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(140, 115, 80, 0.28), transparent);
  transform: rotate(-2deg);
}

.note-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(190, 90, 70, 0.22) 0 1px, transparent 1px) 38px 0 / 100% 100% no-repeat,
    radial-gradient(120% 60% at 50% 106%, rgba(150, 120, 80, 0.16), transparent 60%);
}

.note-from {
  margin: 0 0 14px;
  font-size: 12px;
  letter-spacing: 0.14em;
  color: rgba(70, 54, 40, 0.5);
}

.note-text {
  position: relative;
  z-index: 1;
  margin: 0 0 18px;
  min-height: 90px;
  font-size: clamp(19px, 2.1vw, 24px);
  line-height: 56px;
  letter-spacing: 0.06em;
  white-space: pre-wrap;
}

.note-replies {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(120, 95, 62, 0.32);
}

.note-replies__label {
  font-size: 12px;
  letter-spacing: 0.14em;
  color: rgba(70, 54, 40, 0.5);
}

.preset {
  text-align: left;
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid rgba(120, 95, 62, 0.28);
  background: rgba(255, 252, 242, 0.55);
  font-family: var(--font-hand);
  font-size: 15px;
  letter-spacing: 0.04em;
  color: #433428;
  transition: background 0.2s ease, transform 0.2s ease;
}

.preset:hover {
  background: rgba(255, 253, 247, 0.95);
  transform: translateX(2px);
}

.note-sent {
  position: relative;
  z-index: 2;
  margin: 0;
  font-family: var(--font-hand);
  font-size: 15px;
  color: rgba(70, 54, 40, 0.7);
  letter-spacing: 0.06em;
}

.note-close {
  position: relative;
  z-index: 3;
  margin-top: 14px;
  padding: 4px 0;
  font-family: var(--font-hand);
  font-size: 13px;
  letter-spacing: 0.1em;
  color: rgba(70, 54, 40, 0.5);
  text-decoration: underline;
  text-decoration-color: rgba(70, 54, 40, 0.25);
  text-underline-offset: 4px;
}

.note-close:hover {
  color: rgba(70, 54, 40, 0.8);
}

.note-card.is-sent .note-replies {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.note-card.is-sent .note-text {
  opacity: 0.36;
  transition: opacity 0.3s ease;
}

/* 抽屉干脆面 */

.overlay--drawer {
  place-items: end center;
  padding-bottom: clamp(12px, 3vh, 34px);
  background: radial-gradient(circle at 50% 80%, rgba(30, 20, 14, 0.42), rgba(14, 10, 7, 0.68));
}

.drawer-sheet {
  width: min(94vw, 760px);
  max-height: 88vh;
  transform: translateY(26px);
}

.overlay--drawer.is-open .drawer-sheet {
  transform: translateY(0);
}

.drawer-body {
  padding: 4px clamp(14px, 2.4vw, 26px) clamp(16px, 2.4vw, 24px);
}

.drawer-box {
  position: relative;
  border-radius: 12px;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(66, 44, 26, 0.92), rgba(44, 29, 17, 0.96)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0 2px, transparent 2px 7px);
  box-shadow:
    0 2px 0 rgba(255, 220, 180, 0.12) inset,
    0 18px 40px rgba(10, 6, 4, 0.45);
  overflow: hidden;
}

.drawer-hole {
  position: relative;
  display: grid;
  place-items: center;
  min-height: clamp(180px, 26vh, 240px);
  border-radius: 8px;
  background:
    radial-gradient(70% 90% at 50% 10%, rgba(0, 0, 0, 0.55), rgba(12, 8, 5, 0.92) 70%),
    linear-gradient(180deg, #201610, #3a281a);
  box-shadow: inset 0 10px 30px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

.pack {
  position: relative;
  width: min(58%, 300px);
  aspect-ratio: 1.5 / 1;
  transform: rotate(-7deg) translateY(8%);
  transition: transform 0.5s cubic-bezier(0.25, 0.9, 0.3, 1), filter 0.3s ease;
  filter: drop-shadow(0 16px 30px rgba(0, 0, 0, 0.5));
}

.pack__body {
  position: absolute;
  inset: 0;
  border-radius: 8px 8px 12px 12px;
  background:
    radial-gradient(80% 60% at 30% 20%, rgba(255, 255, 255, 0.35), transparent 60%),
    linear-gradient(160deg, #e8a33e, #d8672f 62%, #b74522);
  box-shadow: inset 0 0 0 2px rgba(255, 236, 200, 0.35), inset 0 -18px 30px rgba(120, 40, 12, 0.35);
  overflow: hidden;
}

.pack__body::before {
  content: "";
  position: absolute;
  inset: 8% 6% auto 6%;
  height: 32%;
  background: linear-gradient(180deg, rgba(255, 245, 220, 0.85), rgba(255, 232, 190, 0.65));
  clip-path: polygon(0 0, 100% 0, 96% 100%, 4% 100%);
}

.pack__body::after {
  content: "";
  position: absolute;
  inset: auto 10% 12% 10%;
  height: 26%;
  border-radius: 4px;
  background: rgba(120, 42, 16, 0.35);
  box-shadow: inset 0 0 0 1px rgba(255, 236, 200, 0.25);
}

.pack__title {
  position: absolute;
  top: 14%;
  left: 12%;
  right: 12%;
  z-index: 2;
  font-family: var(--font-hand);
  font-size: clamp(18px, 2.6vw, 26px);
  font-weight: 700;
  letter-spacing: 0.3em;
  color: #7a2c12;
  text-align: center;
  text-shadow: 0 1px 0 rgba(255, 240, 210, 0.6);
}

.pack__mascot {
  position: absolute;
  z-index: 2;
  right: 12%;
  bottom: 22%;
  width: 34%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 32%, #fff7e6, #e9cfa4 60%, #c9a273);
  box-shadow: inset 0 0 0 2px rgba(120, 70, 30, 0.3);
}

.pack__mascot::before,
.pack__mascot::after {
  content: "";
  position: absolute;
  top: 34%;
  width: 18%;
  height: 18%;
  border-radius: 50%;
  background: #3d2a1a;
}

.pack__mascot::before { left: 24%; }
.pack__mascot::after { right: 24%; }

.pack__crumple {
  position: absolute;
  inset: 0;
  z-index: 3;
  opacity: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(52deg, rgba(255, 255, 255, 0.25) 0 2px, transparent 2px 9px),
    repeating-linear-gradient(-38deg, rgba(60, 20, 0, 0.18) 0 2px, transparent 2px 11px);
  mix-blend-mode: overlay;
  transition: opacity 0.3s ease;
}

.pack.is-crumpled {
  transform: rotate(-3deg) translateY(2%) scale(0.94, 0.88);
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.5));
}

.pack.is-crumpled .pack__crumple { opacity: 1; }

.pack.is-shaking {
  animation: pack-shake 0.45s ease;
}

@keyframes pack-shake {
  0%, 100% { transform: rotate(-7deg) translateY(8%); }
  25% { transform: rotate(-9deg) translateY(7%) scale(1.02); }
  55% { transform: rotate(-5deg) translateY(9%) scale(0.99); }
  78% { transform: rotate(-8deg) translateY(7.5%) scale(1.01); }
}

.drawer-caption {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  z-index: 4;
  padding: 4px 12px;
  border-radius: 999px;
  font-family: var(--font-hand);
  font-size: 12px;
  letter-spacing: 0.12em;
  color: rgba(255, 240, 214, 0.78);
  background: rgba(0, 0, 0, 0.35);
  white-space: nowrap;
}

.drawer-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding-top: 16px;
}

/* 竖课本挡脸 */

.book-shield {
  position: fixed;
  inset: 0;
  z-index: 55;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  display: grid;
  place-items: end center;
  overflow: hidden;
}

.book-shield.is-up {
  opacity: 1;
}

.book-shield__cover {
  position: relative;
  width: min(74vw, 620px);
  aspect-ratio: 16 / 11;
  margin-bottom: -6vh;
  border-radius: 8px 8px 2px 2px;
  background:
    linear-gradient(170deg, #b8cbb2, #8fa88c 60%, #7b947a);
  box-shadow:
    0 -18px 50px rgba(12, 8, 5, 0.45),
    inset 0 0 0 2px rgba(255, 255, 255, 0.18),
    inset 0 -40px 60px rgba(40, 60, 40, 0.28);
  transform: translateY(72%) rotate(-1.4deg);
  transition: transform 0.55s cubic-bezier(0.2, 0.9, 0.25, 1);
  display: grid;
  place-items: center;
  color: rgba(250, 248, 236, 0.92);
  font-family: var(--font-hand);
}

.book-shield.is-up .book-shield__cover {
  transform: translateY(0) rotate(-1.4deg);
}

.book-shield__cover span {
  font-size: clamp(30px, 5vw, 56px);
  letter-spacing: 0.4em;
  text-indent: 0.4em;
  text-shadow: 0 2px 0 rgba(60, 80, 60, 0.5);
}

.book-shield__cover::after {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 4px;
}

.book-shield__bookmark {
  position: absolute;
  top: -26px;
  right: 18%;
  width: 14px;
  height: 62px;
  background: #c0623f;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%);
}

/* 回头瞟一眼的走廊 */

.corridor {
  position: fixed;
  z-index: 52;
  top: 20vh;
  right: clamp(8px, 5vw, 80px);
  width: min(78vw, 460px);
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transform: translateX(28px) rotate(1.2deg) scale(0.97);
  transition: opacity 0.35s ease, transform 0.5s cubic-bezier(0.2, 0.9, 0.25, 1);
  box-shadow:
    0 30px 70px rgba(8, 5, 4, 0.6),
    0 0 0 6px rgba(120, 86, 56, 0.85),
    0 0 0 8px rgba(60, 40, 24, 0.6);
  background: linear-gradient(180deg, #cdd7d2, #a9b7ae 60%, #8b9a90);
}

.corridor.is-open {
  opacity: 1;
  transform: translateX(0) rotate(0.6deg) scale(1);
}

.corridor__scene {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 40%),
    linear-gradient(90deg, rgba(60, 70, 66, 0.2) 0 1%, transparent 1%),
    linear-gradient(180deg, #d5ded9, #b3c0b7 62%, #97a69c);
}

.corridor__floor {
  position: absolute;
  inset: auto 0 0 0;
  height: 34%;
  background: linear-gradient(180deg, #9d8b74, #82705c);
  box-shadow: inset 0 8px 18px rgba(40, 30, 20, 0.25);
}

.corridor__floor::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, rgba(60, 46, 32, 0.18) 0 1px, transparent 1px 64px);
  transform: perspective(200px) rotateX(52deg);
  transform-origin: top;
}

.corridor__door {
  position: absolute;
  left: 8%;
  top: 16%;
  width: 26%;
  height: 50%;
  border-radius: 3px;
  background: linear-gradient(160deg, #7f9a8a, #5f7a6b);
  box-shadow: 0 10px 20px rgba(30, 30, 24, 0.25), inset 0 0 0 2px rgba(255, 255, 255, 0.14);
}

.corridor__door::after {
  content: "";
  position: absolute;
  inset: 10% 12% auto 12%;
  height: 34%;
  border-radius: 2px;
  background: rgba(226, 238, 231, 0.62);
}

.corridor__window {
  position: absolute;
  right: 6%;
  top: 18%;
  width: 30%;
  height: 38%;
  background: linear-gradient(180deg, rgba(226, 240, 240, 0.85), rgba(190, 214, 214, 0.6));
  box-shadow: inset 0 0 0 3px rgba(110, 86, 60, 0.7);
}

.corridor__window::before,
.corridor__window::after {
  content: "";
  position: absolute;
  background: rgba(110, 86, 60, 0.7);
}

.corridor__window::before {
  left: 50%;
  top: 0;
  bottom: 0;
  width: 3px;
  transform: translateX(-50%);
}

.corridor__window::after {
  top: 50%;
  left: 0;
  right: 0;
  height: 3px;
  transform: translateY(-50%);
}

.corridor__lamp {
  position: absolute;
  left: 46%;
  top: 4%;
  width: 34%;
  height: 5%;
  border-radius: 999px;
  background: #f2f4ea;
  box-shadow: 0 0 26px 12px rgba(255, 244, 210, 0.55);
}

.corridor__teacher {
  position: absolute;
  left: 62%;
  bottom: 26%;
  width: 11%;
  height: 40%;
  border-radius: 40% 40% 8% 8%;
  background: rgba(58, 56, 50, 0.82);
  opacity: 0;
  transform: translateX(24px);
  transition: opacity 0.5s ease, transform 3.2s ease;
}

.corridor--teacher .corridor__teacher {
  opacity: 1;
  transform: translateX(-16px);
}

.corridor__teacher::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -22%;
  width: 74%;
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translateX(-50%);
  background: rgba(58, 56, 50, 0.82);
}

.corridor__tag {
  position: absolute;
  left: 14px;
  bottom: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  font-family: var(--font-hand);
  font-size: 12px;
  letter-spacing: 0.12em;
  color: rgba(255, 248, 232, 0.82);
  background: rgba(22, 28, 24, 0.5);
}

/* 窗外飘回来的纸条 */

.window-note {
  position: fixed;
  z-index: 58;
  right: clamp(18px, 9vw, 140px);
  top: 24vh;
  width: min(72vw, 300px);
  padding: 20px 22px;
  border-radius: 6px;
  background:
    repeating-linear-gradient(180deg, transparent 0 25px, rgba(120, 150, 170, 0.20) 25px 26px),
    linear-gradient(150deg, #f9f2df, #efe3c8);
  color: #3a2f26;
  font-family: var(--font-hand);
  font-size: 17px;
  line-height: 1.85;
  letter-spacing: 0.04em;
  box-shadow:
    0 24px 50px rgba(10, 7, 5, 0.42),
    inset 0 0 34px rgba(180, 150, 100, 0.14);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) rotate(-1.6deg) scale(0.97);
  transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.2, 0.9, 0.25, 1), visibility 0.35s;
  pointer-events: none;
}

.window-note::after {
  content: "";
  position: absolute;
  left: 14px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(190, 90, 70, 0.2);
}

.window-note.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) rotate(-1.6deg) scale(1);
}

/* ---------------------------------------------------------
   v0.2 微手感：按下去微微沉一下，松手柔和回弹
   --------------------------------------------------------- */

.seg__btn,
.tool-btn,
.ghost-btn,
.preset,
.chalk-chip,
.action-btn,
.note-close {
  transition-property: transform, background, color, border-color, box-shadow, opacity;
  transition-duration: 0.18s;
  transition-timing-function: cubic-bezier(0.2, 0.9, 0.3, 1);
}

.seg__btn:active,
.tool-btn:active,
.ghost-btn:active,
.preset:active,
.chalk-chip:active,
.action-btn:active,
.note-close:active {
  transform: translateY(2px) scale(0.98);
}

.action-btn:disabled,
.ghost-btn:disabled {
  transform: none;
}

/* ---------------------------------------------------------
   响应式
   --------------------------------------------------------- */

@media (max-width: 900px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .controls {
    align-self: stretch;
    justify-content: flex-start;
    gap: 4px;
  }

  .seg__btn {
    padding: 6px 9px;
    font-size: 11px;
  }

  .brand__title {
    font-size: 20px;
  }

  .bubbles {
    top: 96px;
  }

  .note-card {
    padding: 20px 20px 16px;
  }

  .note-text {
    line-height: 48px;
    min-height: 72px;
  }

  .overlay--note {
    place-items: center;
    padding-left: 0;
  }
}

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

  .seg__btn {
    padding: 6px 8px;
    letter-spacing: 0.02em;
  }

  .tool-btn {
    padding: 7px 10px;
  }

  .hint {
    white-space: normal;
    max-width: 88vw;
    text-align: center;
  }

  .board-tools {
    gap: 8px;
  }

  .board-note {
    display: none;
  }
}

/* ---------------------------------------------------------
   手机窄屏（390x844 及 <=640px）：一行行排整齐，谁都不许溢出
   --------------------------------------------------------- */

@media (max-width: 640px) {
  /* ---- 顶部栏：标题一行，控件一行，触控高度 >= 34px ---- */
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px 12px 8px;
  }

  .brand {
    gap: 0;
    padding: 0;
  }

  .brand__title {
    font-size: 19px;
    letter-spacing: 0.18em;
  }

  .brand__sub {
    font-size: 9.5px;
    letter-spacing: 0.12em;
    color: rgba(255, 244, 226, 0.56);
  }

  .controls {
    width: 100%;
    max-width: 100%;
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: 4px;
    padding: 5px;
    border-radius: 20px;
  }

  .seg {
    flex: 1 1 auto;
    min-width: 0;
    gap: 1px;
    justify-content: space-between;
  }

  .seg__btn {
    flex: 1 1 0;
    min-width: 0;
    min-height: 34px;
    padding: 4px 3px;
    font-size: 11px;
    letter-spacing: 0;
    white-space: nowrap;
  }

  .tool-btn {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 4px 9px;
    font-size: 11px;
    letter-spacing: 0.02em;
  }

  .tool-btn--round {
    width: 34px;
    min-width: 34px;
    height: 34px;
    padding: 0;
    font-size: 15px;
  }

  .sound-dot {
    width: 6px;
    height: 6px;
  }

  /* ---- 气泡 / 底部轻提示 ---- */
  .bubbles {
    top: 118px;
    gap: 6px;
  }

  .bubble {
    max-width: 88vw;
    padding: 8px 14px;
    font-size: 13px;
    line-height: 1.55;
  }

  .hint {
    bottom: 10px;
    padding: 6px 12px;
    font-size: 11px;
    letter-spacing: 0.08em;
  }

  /* 竖屏已经能完整玩，不用再劝人横过来 */
  .orient {
    display: none;
  }

  /* ---- 场景里的物件名：交给固定字号的 .scene-chip ---- */
  .hs-tag {
    opacity: 0 !important;
  }

  /* ---- 浮层弹窗：宽度跟着视口走，内边距收紧 ---- */
  .overlay {
    padding: 8px;
  }

  .sheet {
    width: min(94vw, 1000px);
    max-height: 92vh;
    max-height: min(92vh, calc(100dvh - 20px));
    border-radius: 14px;
  }

  .sheet__head {
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    padding: 12px 14px 8px;
  }

  .sheet__title {
    font-size: 16px;
    letter-spacing: 0.1em;
  }

  .sheet__sub {
    font-size: 10.5px;
    letter-spacing: 0.1em;
  }

  .ghost-btn {
    min-height: 34px;
    height: 34px;
    padding: 0 11px;
    font-size: 11.5px;
    letter-spacing: 0.06em;
  }

  .action-btn {
    min-height: 36px;
    padding: 8px 14px;
    font-size: 12.5px;
    letter-spacing: 0.08em;
  }

  /* 黑板近景 */
  .board-wrap {
    padding: 2px 12px 0;
  }

  .board-frame {
    padding: 8px;
  }

  .board-tools {
    padding: 10px 12px 14px;
    gap: 8px;
  }

  .chalk-chips {
    gap: 4px;
    padding: 4px;
  }

  .chalk-chip {
    width: 34px;
    height: 34px;
  }

  /* 桌洞干脆面：底部只留「捏碎它 / 偷吃一口 / 再吃一口」 */
  .overlay--drawer {
    padding-bottom: 8px;
  }

  .drawer-sheet {
    width: min(94vw, 760px);
    max-height: 92vh;
    max-height: min(92vh, calc(100dvh - 20px));
  }

  .drawer-body {
    padding: 2px 12px 14px;
  }

  .drawer-box {
    padding: 12px;
    border-radius: 10px;
  }

  .drawer-hole {
    min-height: clamp(150px, 24vh, 200px);
  }

  .drawer-tools {
    gap: 8px;
    padding-top: 12px;
  }

  .drawer-tools .action-btn {
    flex: 1 1 auto;
  }

  .drawer-caption {
    padding: 3px 10px;
    font-size: 11px;
    letter-spacing: 0.08em;
  }

  /* 同桌纸条 */
  .overlay--note {
    place-items: center;
    padding: 8px;
  }

  .note-card {
    width: min(94vw, 420px);
    padding: 18px 16px 14px;
  }

  .note-from {
    margin-bottom: 10px;
    font-size: 11px;
  }

  .note-text {
    margin-bottom: 14px;
    font-size: 18px;
    line-height: 40px;
    letter-spacing: 0.04em;
    min-height: 56px;
  }

  .note-replies {
    gap: 7px;
  }

  .note-replies__label {
    font-size: 11px;
  }

  .preset {
    min-height: 36px;
    padding: 8px 12px;
    font-size: 14px;
  }

  .note-close {
    min-height: 34px;
    font-size: 12.5px;
  }

  /* 后门走廊窥视 */
  .corridor {
    left: 50%;
    right: auto;
    top: 24vh;
    width: min(94vw, 460px);
    transform: translateX(-50%) translateY(16px) scale(0.97);
  }

  .corridor.is-open {
    transform: translateX(-50%) translateY(0) scale(1);
  }

  .corridor__tag {
    left: 10px;
    bottom: 10px;
    font-size: 11px;
  }

  /* 陌生校友的纸飞机短信 */
  .window-note {
    left: 50%;
    right: auto;
    top: 26vh;
    width: min(86vw, 320px);
    padding: 16px 18px;
    font-size: 16px;
    line-height: 1.8;
    transform: translateX(-50%) translateY(10px) rotate(-1.2deg) scale(0.97);
  }

  .window-note.is-open {
    transform: translateX(-50%) translateY(0) rotate(-1.2deg) scale(1);
  }

  /* 竖课本挡脸 */
  .book-shield__cover {
    width: min(86vw, 620px);
    margin-bottom: -4vh;
  }

  /* 眼保健操覆层：手机上把提示收进屏幕中间，不长出横向滚动 */
  .eye-layer__hint {
    transform: translate(-50%, 74px);
    font-size: 13px;
    letter-spacing: 0.22em;
  }

  .eye-layer__sub {
    transform: translate(-50%, 104px);
    font-size: 10px;
    letter-spacing: 0.1em;
  }

  .eye-layer__lashes {
    width: min(80vw, 520px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .fan-group,
  .fan-bob,
  .dust-slow,
  .frost-shine,
  .paper-note,
  .snack-corner,
  .hs-ring,
  .plane-hint__glow,
  .plane-hint__float,
  .bubble,
  .curtain-breathe,
  .curtain-sway,
  .beam-breathe,
  .clock-second,
  .eye-layer__halo {
    animation: none !important;
  }

  .book-shield__cover,
  .sheet,
  .note-card,
  .corridor,
  .plane-hint,
  .teacher-silhouette,
  .eye-layer,
  .eye-layer__lashes,
  .eye-layer__mate {
    transition-duration: 0.001ms !important;
  }

  .beam-face {
    opacity: 0.18;
  }

  .eye-layer.is-peeking .eye-layer__lashes {
    transform: translate(-50%, -22px) scaleY(0.4);
  }
}

/* ---------------------------------------------------------
   v1.1 隐藏彩蛋 C：课桌右侧那支笔
   它不属于 ? 热区（教室里的 8 个显性热区一个都没变），
   只是课桌上一支可以随手按一下的笔。
   --------------------------------------------------------- */

.pen-easter {
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.pen-easter__hit {
  pointer-events: all;
}

.pen-easter__body {
  transform-box: fill-box;
  transform-origin: 62% 50%;
  transition: filter 0.2s ease;
}

.pen-easter:hover .pen-easter__body {
  filter: drop-shadow(0 0 4px rgba(255, 232, 176, 0.9));
}

.pen-easter.is-poked .pen-easter__body {
  animation: pen-poke 0.42s cubic-bezier(0.3, 1.15, 0.42, 1);
}

.pen-easter:focus-visible .pen-easter__body {
  filter: drop-shadow(0 0 5px rgba(255, 240, 200, 0.95));
}

@keyframes pen-poke {
  0% {
    transform: rotate(0deg) translateY(0) scale(1, 1);
  }

  26% {
    transform: rotate(-7deg) translateY(-5px) scale(1.03, 0.94);
  }

  58% {
    transform: rotate(5deg) translateY(0) scale(0.98, 1.02);
  }

  100% {
    transform: rotate(0deg) translateY(0) scale(1, 1);
  }
}

/* 笔尖上方那缕很快散掉的文学微词：没有数字，也没有累计 */
.pen-whisper {
  position: fixed;
  z-index: 46;
  max-width: min(60vw, 260px);
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(252, 246, 232, 0.94);
  border: 1px solid rgba(150, 116, 74, 0.34);
  color: #4a3728;
  font-family: var(--font-hand);
  font-size: clamp(11px, 1.05vw, 13px);
  letter-spacing: 0.06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  transform: translate(-50%, -100%);
  box-shadow: 0 6px 16px rgba(20, 12, 8, 0.22);
  animation: pen-whisper-rise 1.2s ease-out forwards;
}

@keyframes pen-whisper-rise {
  0% {
    opacity: 0;
    transform: translate(-50%, -92%) scale(0.96);
  }

  18% {
    opacity: 1;
    transform: translate(-50%, -104%) scale(1);
  }

  68% {
    opacity: 0.92;
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -138%) scale(0.99);
  }
}

@media (prefers-reduced-motion: reduce) {
  .pen-easter.is-poked .pen-easter__body {
    animation-duration: 0.001ms !important;
  }

  .pen-whisper {
    animation-duration: 1.2s !important;
  }
}
