/* nocau Fun 代码开发：通用样式（与 style.css 搭配使用） */
.fun-header .nav-links a { font-size: 0.9rem; }
.fun-main {
  min-height: calc(100vh - 140px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 96px 20px 56px;
  position: relative;
  overflow: hidden;
}
.fun-intro { text-align: center; margin-bottom: 34px; max-width: 640px; z-index: 2; }
.fun-intro h1 { font-size: clamp(1.9rem, 4.4vw, 3rem); letter-spacing: -0.03em; font-weight: 800; }
.fun-intro p { margin-top: 12px; color: var(--text-soft); font-size: 0.95rem; }
.fun-box {
  position: relative;
  width: min(680px, 92vw);
  min-height: 420px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--bg-soft);
  overflow: hidden;
}
.fun-box canvas { display: block; width: 100%; height: 100%; }
.fun-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 22px;
  z-index: 2;
}
.fun-controls .btn { min-width: 96px; }
.fun-status {
  margin-top: 16px;
  font-size: 0.9rem;
  color: var(--text-soft);
  min-height: 1.4em;
  text-align: center;
  z-index: 2;
}
.fun-footer {
  padding: 26px 20px 40px;
  text-align: center;
  border-top: 1px solid var(--line);
}
.fun-footer a { margin: 0 8px; }

/* 合集入口页 */
.fun-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  width: 100%;
}
.fun-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-soft);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--transition), transform var(--transition), background var(--transition);
}
.fun-card:hover { border-color: var(--line-strong); transform: translateY(-3px); background: var(--bg); }
.fun-card .fun-card-index { font-size: 0.72rem; letter-spacing: 0.16em; color: var(--brand); text-transform: uppercase; }
.fun-card h3 { font-size: 1.04rem; font-weight: 700; }
.fun-card p { font-size: 0.86rem; color: var(--text-soft); line-height: 1.6; }
.fun-card .fun-card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 6px; }
.fun-card .tag { font-size: 0.7rem; }

/* 各页面细节组件 */
.fun-canvas-wrap { width: 100%; height: 420px; position: relative; }
.fun-canvas-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.click-hint { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); font-size: 0.8rem; color: var(--text-soft); background: var(--bg-soft); padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); z-index: 3; pointer-events: none; }

/* 生日蛋糕 / 爱心 / 卡片类 DOM 舞台 */
.stage-center { text-align: center; padding: 30px 20px; width: 100%; }
.candle-flame { cursor: pointer; }

/* 照片墙 */
.photo-wall { position: relative; width: 100%; height: 420px; overflow: hidden; }
.photo-slide { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; opacity: 0; transform: translateX(24px); transition: opacity 0.6s ease, transform 0.6s ease; }
.photo-slide.is-active { opacity: 1; transform: none; }
.photo-frame { width: min(300px, 60vw); height: 260px; border: 1px solid var(--line-strong); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 2.6rem; color: var(--text-soft); background: var(--bg); overflow: hidden; }
.photo-caption { font-size: 0.95rem; color: var(--text); }
.photo-nav { display: flex; gap: 10px; margin-top: 14px; }

/* 回忆录时间线 */
.memory-scroll { width: 100%; height: 100%; overflow-y: auto; padding: 30px 24px; }
.memory-item { opacity: 0; transform: translateY(26px); transition: opacity 0.6s ease, transform 0.6s ease; border-left: 1px solid var(--line-strong); padding: 0 0 26px 22px; position: relative; max-width: 560px; margin: 0 auto; }
.memory-item::before { content: ""; position: absolute; left: -4.5px; top: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.memory-item.is-visible { opacity: 1; transform: none; }
.memory-item .m-time { font-size: 0.72rem; letter-spacing: 0.14em; color: var(--brand); text-transform: uppercase; }
.memory-item h3 { margin: 6px 0; font-size: 1.05rem; }
.memory-item p { font-size: 0.9rem; color: var(--text-soft); line-height: 1.7; }

/* 星空许愿 / 孔明灯文字 */
.wish-input { display: flex; gap: 10px; margin-top: 16px; }
.wish-input .form-control { max-width: 260px; }
.wish-note { margin-top: 12px; font-size: 0.9rem; color: var(--brand); min-height: 1.4em; }

/* 像素画板 */
.pixel-board { display: grid; gap: 2px; background: var(--line); padding: 4px; border-radius: 10px; }
.pixel-cell { width: 18px; height: 18px; background: var(--bg); border: 0; padding: 0; cursor: pointer; border-radius: 3px; }
.pixel-cell.is-painted { background: currentColor; }
.pixel-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: center; margin-top: 14px; }
.pixel-color { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; }
.pixel-color.is-active { border-color: var(--brand); transform: scale(1.15); }

/* 贪吃蛇 / 翻牌 */
.snake-wrap { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.snake-wrap canvas { background: var(--bg); }
.snake-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: rgba(10, 12, 14, 0.35); color: var(--text); z-index: 2; }
.snake-overlay .btn { min-width: 120px; }
.memory-game-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; width: min(420px, 92%); padding: 20px; }
.memory-tile { aspect-ratio: 1; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 1.8rem; cursor: pointer; transition: transform 0.25s ease, background var(--transition); user-select: none; }
.memory-tile.flipped, .memory-tile.matched { background: var(--bg-soft); }
.memory-tile.matched { border-color: var(--brand); opacity: 0.55; cursor: default; }

/* 倒计时 */
.countdown-grid { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.countdown-cell { text-align: center; padding: 18px 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); min-width: 84px; }
.countdown-cell .num { display: block; font-size: 2.2rem; font-weight: 800; color: var(--brand); letter-spacing: -0.02em; }
.countdown-cell .unit { font-size: 0.8rem; color: var(--text-soft); }

@media (max-width: 900px) {
  .fun-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .fun-grid { grid-template-columns: 1fr; }
  .fun-main { padding-top: 80px; }
  .fun-box { min-height: 340px; }
}

/* ---------- 通用动画关键帧 ---------- */
@keyframes flame-flicker {
  0%   { transform: translateX(-50%) scale(1) rotate(-3deg); }
  100% { transform: translateX(-50%) scale(1.12, 1.28) rotate(4deg); }
}
@keyframes confetti-fall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 0.95; }
  100% { transform: translateY(260px) rotate(340deg); opacity: 0; }
}
@keyframes heart-rise {
  0%   { transform: translateY(0) scale(0.6); opacity: 0.85; }
  70%  { opacity: 0.8; }
  100% { transform: translateY(-46vh) scale(1.25) rotate(8deg); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .candle-flame, .confetti-piece { animation: none !important; }
}

/* fun 页面移动端导航：横向可滚动 */
@media (max-width: 820px) {
  .fun-header .nav-links {
    position: static;
    display: flex;
    flex-direction: row;
    gap: 14px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    max-width: 100%;
  }
  .fun-header .nav-actions { flex-direction: column; align-items: flex-end; gap: 0; }
}

/* ============ 第二批：代码开发页 / 样式挑选 / 免责声明 / 知识条目 ============ */

/* 代码开发页模板 */
.code-page { padding: 96px 20px 56px; }
.code-page .container-inner { max-width: 900px; margin: 0 auto; }
.code-hero { text-align: center; margin-bottom: 30px; }
.code-hero h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); letter-spacing: -0.03em; font-weight: 800; }
.code-hero .sub { margin-top: 10px; color: var(--text-soft); font-size: 0.95rem; line-height: 1.7; }
.code-hero .meta-line { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.code-hero .meta-line .tag { font-size: 0.72rem; }

.code-section { margin-top: 26px; }
.code-section > h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.code-section > h2::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); display: inline-block; }
.code-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-soft);
  padding: 20px 22px;
  line-height: 1.8;
  color: var(--text-soft);
  font-size: 0.92rem;
}
.code-card ul, .code-card ol { padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.code-card code { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; font-size: 0.85em; color: var(--text); }
.code-card strong { color: var(--text); font-weight: 700; }

.code-block { position: relative; margin-top: 26px; }
.code-block pre {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #0d0f12;
  color: #d8dee9;
  padding: 18px 20px;
  overflow-x: auto;
  font-size: 0.83rem;
  line-height: 1.75;
  max-height: 640px;
  tab-size: 2;
}
[data-theme="light"] .code-block pre { background: #f4f5f7; color: #2c3138; border-color: var(--line); }
.code-block pre code { font-family: "Cascadia Code", Consolas, "JetBrains Mono", monospace; }
.code-copy-btn {
  position: absolute; top: 10px; right: 12px;
  border: 1px solid var(--line); background: var(--bg-soft);
  color: var(--text-soft); border-radius: 8px; padding: 5px 12px;
  font-size: 0.76rem; cursor: pointer; transition: border-color var(--transition), color var(--transition);
}
.code-copy-btn:hover { border-color: var(--brand); color: var(--brand); }
.code-lang-badge {
  position: absolute; top: 10px; left: 12px;
  font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-soft); border: 1px solid var(--line); border-radius: 999px;
  padding: 3px 10px; background: var(--bg);
}
.code-block .code-copy-btn { right: 12px; }

/* 样式挑选（多主题/多形态） */
.style-picker { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 18px; z-index: 2; }
.style-picker .btn.is-active { border-color: var(--brand); color: var(--brand); background: var(--bg-soft); }
.theme-demo { width: 16px; height: 16px; border-radius: 50%; display: inline-block; margin-right: 6px; vertical-align: -3px; border: 1px solid var(--line); }

/* 免责声明 */
.disclaimer {
  margin-top: 22px;
  border: 1px solid var(--brand);
  border-left-width: 4px;
  border-radius: 12px;
  background: var(--bg-soft);
  padding: 16px 18px;
  font-size: 0.88rem;
  line-height: 1.8;
  color: var(--text-soft);
}
.disclaimer strong { color: var(--brand); display: block; margin-bottom: 6px; }

/* 系统知识条目 */
.kb-item { border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; background: var(--bg-soft); margin-top: 14px; }
.kb-item h3 { font-size: 1rem; font-weight: 700; }
.kb-item h3 .kb-no { color: var(--brand); font-size: 0.78rem; letter-spacing: 0.14em; margin-right: 8px; }
.kb-item p { font-size: 0.9rem; color: var(--text-soft); line-height: 1.75; margin-top: 8px; }
.kb-item .kb-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.kb-item .kb-tags .tag { font-size: 0.68rem; }

/* 合集页分类筛选 */
.fun-filters { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 26px; }
.fun-filters .btn { font-size: 0.8rem; padding: 7px 16px; }
.fun-filters .btn.is-active { border-color: var(--brand); color: var(--brand); }
.fun-count { text-align: center; color: var(--text-soft); font-size: 0.82rem; margin-bottom: 22px; }

/* 聊天 demo（虚拟对象 Virtual Companion） */
.chat-demo { width: min(560px, 100%); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--bg); display: flex; flex-direction: column; margin: 0 auto; }
.chat-demo .chat-head { padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 0.9rem; font-weight: 700; color: var(--text); background: var(--bg-soft); }
.chat-demo .chat-body { height: 300px; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { max-width: 78%; padding: 9px 14px; border-radius: 14px; font-size: 0.86rem; line-height: 1.6; white-space: pre-wrap; }
.chat-msg.bot { align-self: flex-start; background: var(--bg-soft); border: 1px solid var(--line); color: var(--text); }
.chat-msg.user { align-self: flex-end; background: var(--brand); color: #fff; }
.chat-demo .chat-input { display: flex; gap: 10px; padding: 12px; border-top: 1px solid var(--line); }
.chat-demo .chat-input input { flex: 1; }
.chat-hint { text-align: center; font-size: 0.8rem; color: var(--text-soft); margin-top: 10px; }

/* 激光打蚊器 demo */
.laser-wrap { position: relative; width: 100%; height: 420px; overflow: hidden; border-radius: 14px; }
.laser-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.laser-stat { position: absolute; top: 12px; left: 14px; font-size: 0.8rem; color: var(--text-soft); background: var(--bg-soft); border: 1px solid var(--line); padding: 5px 12px; border-radius: 999px; z-index: 3; }
.laser-crosshair { position: absolute; width: 34px; height: 34px; border: 1px solid rgba(231, 76, 60, 0.9); border-radius: 50%; pointer-events: none; z-index: 3; transform: translate(-50%, -50%); box-shadow: 0 0 10px rgba(231, 76, 60, 0.5); }
.laser-crosshair::before, .laser-crosshair::after { content: ""; position: absolute; background: rgba(231, 76, 60, 0.9); }
.laser-crosshair::before { left: 50%; top: -6px; width: 1px; height: 46px; }
.laser-crosshair::after { top: 50%; left: -6px; height: 1px; width: 46px; }

/* 圣诞树 demo */
.tree-stage { width: min(520px, 92vw); height: 460px; position: relative; overflow: hidden; border-radius: 14px; display: flex; align-items: flex-end; justify-content: center; }
.tree-stage .tree-wrap { position: relative; display: flex; flex-direction: column; align-items: center; }
.tree-star { font-size: 2rem; animation: twinkle 1.6s ease-in-out infinite; }
.tree-layer { width: 0; height: 0; border-left: 74px solid transparent; border-right: 74px solid transparent; border-bottom: 108px solid var(--tree-green, #2e7d4f); margin-top: -34px; position: relative; }
.tree-layer::after { content: ""; position: absolute; left: 50%; top: 60px; transform: translateX(-50%); width: 6px; height: 24px; background: var(--tree-trunk, #7a5230); }
.tree-layer .orn { position: absolute; border-radius: 50%; animation: twinkle 2.4s ease-in-out infinite; }
.tree-trunk { width: 34px; height: 46px; background: var(--tree-trunk, #7a5230); border-radius: 0 0 8px 8px; margin-top: -6px; }
.tree-snow { position: absolute; bottom: 0; left: 0; right: 0; height: 26px; background: rgba(255,255,255,0.18); border-radius: 12px 12px 0 0; }
@keyframes twinkle { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* 贺卡多主题 */
.birthday-theme { transition: background 0.5s ease, color 0.5s ease; }
.birthday-theme.theme-star { --bc-bg: linear-gradient(135deg, #101c3a, #1b2f63); --bc-accent: #ffd166; --bc-text: #eef2ff; }
.birthday-theme.theme-sakura { --bc-bg: linear-gradient(135deg, #fdeef0, #f8d8de); --bc-accent: #e0708a; --bc-text: #5a3a44; }
.birthday-theme.theme-classic { --bc-bg: linear-gradient(135deg, #f7f3e9, #efe6d2); --bc-accent: #c89b3c; --bc-text: #4a4238; }
.birthday-card-cover { background: var(--bc-bg, var(--bg-soft)); color: var(--bc-text, var(--text)); }
.birthday-card-cover .bc-accent { color: var(--bc-accent, var(--brand)); }

/* 页面底部说明（浏览器直开提示） */
.opensrc-note {
  max-width: 760px;
  margin: 30px auto 0;
  padding: 16px 20px;
  border-left: 2px solid var(--brand);
  background: var(--bg-soft);
  border-radius: 0 12px 12px 0;
  color: var(--text-soft);
  font-size: 0.88rem;
  line-height: 1.7;
}

/* 移动端适配 */
@media (max-width: 720px) {
  .code-page { padding-top: 84px; }
  .code-card { padding: 16px; }
  .tree-layer { border-left-width: 56px; border-right-width: 56px; border-bottom-width: 82px; }
}
