/* ChatMiao 主站 —— 猫猫主题 · 樱花粉 · 苹果风
 * 主色：樱花粉 · 点缀：淡紫 · 背景：奶粉白 · 大圆角大留白 */
:root {
  --primary: #f78fbf;        /* 樱花粉主色 */
  --primary-dark: #e56ea8;   /* 深粉 */
  --primary-light: #ffe4f0;  /* 粉底 */
  --primary-soft: #fff0f5;   /* 更浅粉（模板常用，避免深色下退回硬编码） */
  --accent: #a99bf0;         /* 淡紫点缀 */
  --accent-light: #efeafe;
  --bg: #fdf3f8;             /* 奶粉粉背景 */
  --card: #ffffff;
  --text: #3d3440;
  --text-light: #9a8f9c;
  --border: #f5e3ee;
  --ok: #6fbd95;
  --warn: #e6b463;
  --danger: #e8807c;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 10px 34px rgba(247, 143, 191, .14);
  --shadow-hover: 0 16px 44px rgba(247, 143, 191, .22);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* 顶部导航 —— 粉紫渐变，圆润 */
.topnav {
  background: linear-gradient(135deg, #f78fbf, #b3a3f5);
  color: #fff;
  box-shadow: 0 4px 20px rgba(247, 143, 191, .25);
  position: sticky;
  top: 0;
  z-index: 50;
}
.nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.topnav .brand {
  color: #fff;
  font-weight: 800;
  font-size: 1.15rem;
  text-decoration: none;
  letter-spacing: .5px;
  text-shadow: 0 1px 4px rgba(229, 110, 168, .35);
}
.nav-links { display: flex; gap: 6px; flex-wrap: wrap; }
.nav-links a {
  color: #fff8fb;
  text-decoration: none;
  padding: 7px 14px;
  border-radius: 22px;
  font-size: .92rem;
  transition: background .2s, transform .2s;
}
.nav-links a:hover { background: rgba(255, 255, 255, .25); transform: translateY(-1px); }

/* 导航用户区 */
.nav-user { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.nav-user a {
  color: #fff8fb;
  text-decoration: none;
  font-size: .88rem;
  padding: 6px 12px;
  border-radius: 20px;
  transition: background .2s;
}
.nav-user a:hover { background: rgba(255, 255, 255, .25); }
.nav-user .nav-register { background: rgba(255, 255, 255, .22); }
.nav-user .nav-register:hover { background: rgba(255, 255, 255, .35); }
.nav-user-name { color: #fff; font-size: .88rem; font-weight: 600; }
.nav-user-link { text-decoration: none; padding: 4px 8px; border-radius: 16px; transition: background .2s; }
.nav-user-link:hover { background: rgba(255, 255, 255, .22); }
.nav-logout {
  background: none;
  border: 1px solid rgba(255, 255, 255, .5);
  color: #fff;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: .8rem;
  cursor: pointer;
  transition: background .2s;
}
.nav-logout:hover { background: rgba(255, 255, 255, .2); }

/* 手机端导航紧凑布局：第一行 品牌+用户区，第二行 链接居中（小号） */
@media (max-width: 640px) {
  .nav-inner { flex-wrap: wrap; padding: 10px 12px 6px; row-gap: 6px; }
  .topnav .brand { font-size: 1.02rem; }
  .nav-user { margin-left: auto; }
  .nav-user a { padding: 4px 9px; font-size: .78rem; }
  .nav-user-name { font-size: .78rem; }
  .nav-logout { padding: 3px 9px; font-size: .75rem; }
  .nav-links { order: 3; width: 100%; justify-content: center; gap: 3px; }
  .nav-links a { padding: 4px 9px; font-size: .78rem; border-radius: 14px; }
}

/* 学习程度卡片：可点击 */
.learn-tile { cursor: pointer; transition: transform .15s, box-shadow .2s; }
.learn-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.learn-item { padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: .9rem; }
.learn-item:last-child { border-bottom: none; }
.muted { color: var(--text-light); font-size: .82rem; }

/* 手机端用户管理表 → 卡片式（防挤压） */
@media (max-width: 640px) {
  #user-list thead { display: none; }
  #user-list tr {
    display: block;
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 10px;
    padding: 10px 12px;
    background: var(--card);
  }
  #user-list td {
    display: block;
    border: none;
    padding: 3px 0;
    font-size: .85rem;
    white-space: normal; /* 卡片模式允许换行 */
  }
  #user-list td[data-label]::before {
    content: attr(data-label) "：";
    color: var(--text-light);
    font-size: .78rem;
  }
}

/* 用户管理表：列不换行，按钮紧凑（防挤压） */
#user-table th, #user-table td { white-space: nowrap; }
#user-table td[data-label="用户"] { white-space: normal; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
#user-table .btn { padding: 4px 9px; font-size: .78rem; margin: 2px 5px 2px 0; }
#user-table .mono { font-variant-numeric: tabular-nums; }

/* 邀请码表 + 留言表：手机端卡片化（防溢出） */
#invite-table th, #invite-table td { white-space: nowrap; }
#invite-table .btn { padding: 4px 9px; font-size: .78rem; margin: 2px 5px 2px 0; }
@media (max-width: 640px) {
  #invite-table thead, .msg-table thead { display: none; }
  #invite-table tr, .msg-table tr {
    display: block;
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 10px;
    padding: 10px 12px;
    background: var(--card);
  }
  #invite-table td, .msg-table td {
    display: block;
    border: none;
    padding: 3px 0;
    font-size: .85rem;
    white-space: normal;
  }
  #invite-table td[data-label]::before, .msg-table td[data-label]::before {
    content: attr(data-label) "：";
    color: var(--text-light);
    font-size: .78rem;
  }
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

/* ---------- 苹果风 Hero（滚动分屏版：内容居中，背景由 .hero-screen 提供） ---------- */
.hero {
  position: static;
  overflow: visible;
  text-align: center;
  padding: 0;
  margin: 0;
  border-radius: 0;
  background: none;
  border: none;
}
.hero .eyebrow {
  margin: 0 0 16px;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--primary-dark);
  text-transform: uppercase;
}
.hero-title {
  margin: 0 0 18px;
  font-size: clamp(2.2rem, 5.5vw, 3.4rem);
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: -.5px;
  color: var(--text);
}
.hero-title em { font-style: normal; color: var(--primary-dark); }
.hero-sub {
  margin: 0 auto 26px;
  max-width: 560px;
  font-size: 1.05rem;
  color: var(--text-light);
}
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---------- 建站小故事 ---------- */
.story-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 30px;
  margin-bottom: 34px;
}
.story-card h2 { margin: 0 0 10px; font-size: 1.25rem; color: var(--primary-dark); }
.story-card p { margin: 7px 0; color: var(--text); }
.story-card .story-sign {
  margin-top: 12px;
  color: var(--text-light);
  font-size: .9rem;
  font-weight: 600;
}

/* 通用卡片（笔记 / 联系 / 文件 / 后台等页面） */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  margin-bottom: 18px;
}
.card h2 { margin-top: 0; color: var(--primary-dark); }

/* 区块标题（苹果风：小字、字距） */
.section-title {
  font-size: .88rem;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--text-light);
  margin: 0 0 16px 4px;
}

/* 功能入口卡片 */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 34px;
}
.tile {
  display: block;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 22px;
  text-decoration: none;
  color: var(--text);
  transition: transform .25s, box-shadow .25s;
}
.tile:hover { transform: translateY(-5px); box-shadow: var(--shadow-hover); }
.tile .icon { font-size: 1.8rem; }
.tile h3 { margin: 10px 0 6px; font-size: 1.08rem; color: var(--text); }
.tile p { margin: 0; font-size: .88rem; color: var(--text-light); }

/* ---------- 宣传画廊 ---------- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  margin-bottom: 34px;
}
.gallery-item {
  margin: 0;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform .25s, box-shadow .25s;
}
.gallery-item:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.gallery-item img {
  display: block;
  width: 100%;
  aspect-ratio: 19 / 10; /* 匹配截图比例：同比例下 cover 不裁剪，整齐和谐 */
  object-fit: cover;
  background: var(--primary-light);
}
.gallery-item figcaption {
  padding: 10px 14px;
  font-size: .85rem;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 10px 26px;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .2s, transform .2s, box-shadow .2s;
  box-shadow: 0 6px 18px rgba(247, 143, 191, .30);
}
.btn:hover { background: var(--primary-dark); transform: translateY(-2px); box-shadow: 0 10px 26px rgba(229, 110, 168, .35); }
.btn.ghost {
  background: rgba(255, 255, 255, .65);
  color: var(--primary-dark);
  border: 1px solid var(--border);
  box-shadow: none;
  backdrop-filter: blur(8px);
}
.btn.ghost:hover { background: #fff; }
.btn.danger { background: var(--danger); box-shadow: 0 6px 18px rgba(232, 128, 124, .30); }
.btn.danger:hover { background: #d9625d; }
.btn.small { padding: 5px 14px; font-size: .82rem; border-radius: 999px; }

/* ---------- 表单 ---------- */
input[type="text"], input[type="password"], input[type="email"], textarea, select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-family: inherit;
  background: var(--card);
  color: var(--text);
  transition: border-color .2s, box-shadow .2s;
}
textarea { resize: vertical; min-height: 120px; }
input:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
}
label { font-weight: 600; font-size: .9rem; display: block; margin: 14px 0 6px; }
.form-row { margin-bottom: 6px; }

/* ---------- 状态徽章 ---------- */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
}
.badge.ok { background: #e2f4ea; color: var(--ok); }
.badge.off { background: #fde9e7; color: var(--danger); }
.badge.wait { background: #fdf3dd; color: var(--warn); }

/* ---------- 服务器卡片 ---------- */
.server-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-bottom: 34px; }
.server-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; transition: transform .25s, box-shadow .25s; }
.server-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.server-card .name { font-weight: 800; font-size: 1.05rem; color: var(--primary-dark); }
.server-card .addr { color: var(--text-light); font-size: .82rem; }
.server-card .big-num { font-size: 2rem; font-weight: 800; color: var(--primary); }
.server-card .meta { font-size: .85rem; color: var(--text-light); margin-top: 6px; }
.server-card .motd { font-size: .9rem; margin: 8px 0 0; }

/* 服务器卡片：3D 翻转（正面人数 / 背面折线图） */
.flip-card {
  perspective: 1000px;
  cursor: pointer;
  min-height: 210px;
}
.flip-card .flip-inner {
  position: relative;
  width: 100%;
  height: 210px;
  transition: transform .6s ease;
  transform-style: preserve-3d;
}
.flip-card.flipped .flip-inner { transform: rotateY(180deg); }
.flip-front, .flip-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 16px 20px;
  overflow: hidden;
}
.flip-back {
  transform: rotateY(180deg);
  text-align: center;
}
.flip-back-title { font-size: .85rem; color: var(--primary-dark); font-weight: 700; margin-bottom: 6px; }
.mini-chart {
  min-height: 84px;
  max-width: 240px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}
.flip-hint {
  font-size: .75rem;
  color: var(--text-light);
  margin: 8px 0 0;
  opacity: .75;
}

/* 极简折线图居中 */
.chart-center { max-width: 680px; margin: 0 auto; }

/* ---------- 照片墙 Lightbox（点击放大 + 轮播） ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(42, 30, 40, .9);
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .3s ease;
}
.lightbox.open { display: flex; opacity: 1; }
.lightbox img {
  max-width: 88vw;
  max-height: 84vh;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
  transform: scale(.92);
  opacity: 0;
  transition: transform .3s ease, opacity .3s ease;
}
.lightbox.open img { transform: scale(1); opacity: 1; }
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .15);
  color: #fff;
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}
.lightbox-nav:hover { background: rgba(255, 255, 255, .32); }
.lightbox-prev { left: 18px; }
.lightbox-next { right: 18px; }
.lightbox-close {
  position: absolute;
  top: 14px;
  right: 20px;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
}
.lightbox-count {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, .85);
  font-size: .9rem;
}
@media (max-width: 520px) {
  .lightbox-nav { width: 38px; height: 38px; font-size: 1.2rem; }
  .lightbox-prev { left: 8px; }
  .lightbox-next { right: 8px; }
}

/* ---------- 折线图 ---------- */
.chart-wrap { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px; }
.chart-wrap h3 { margin: 0 0 4px; color: var(--primary-dark); }
.chart-wrap .sub { color: var(--text-light); font-size: .85rem; margin-bottom: 10px; }
.chart-toolbar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.chart-toolbar button {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 6px 16px;
  cursor: pointer;
  font-size: .85rem;
  color: var(--text);
  transition: all .2s;
}
.chart-toolbar button:hover { border-color: var(--primary); color: var(--primary-dark); }
.chart-toolbar button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.chart-svg { width: 100%; height: auto; display: block; }

/* ---------- 列表 ---------- */
.list-item {
  border-bottom: 1px solid var(--border);
  padding: 13px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.list-item:last-child { border-bottom: none; }
.list-item .title { font-weight: 600; text-decoration: none; color: var(--text); transition: color .15s; }
.list-item .title:hover { color: var(--primary); }
.list-item .meta { font-size: .82rem; color: var(--text-light); }

/* ---------- 笔记正文 ---------- */
.note-body { overflow-wrap: break-word; }
.note-body h1, .note-body h2, .note-body h3 { color: var(--primary-dark); }
.note-body pre {
  background: #33303d;
  color: #f5eef6;
  padding: 14px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
}
.note-body code { background: var(--primary-light); padding: 2px 6px; border-radius: 6px; font-size: .9em; }
.note-body pre code { background: none; padding: 0; }
.note-body img { max-width: 100%; border-radius: var(--radius-sm); }
.note-body blockquote { border-left: 4px solid var(--primary); margin: 10px 0; padding: 4px 14px; color: var(--text-light); background: var(--primary-light); border-radius: 0 12px 12px 0; }
.note-body table { border-collapse: collapse; width: 100%; }
.note-body th, .note-body td { border: 1px solid var(--border); padding: 6px 10px; }

/* ---------- 提示条 ---------- */
.alert { border-radius: var(--radius-sm); padding: 11px 16px; margin-bottom: 14px; font-size: .92rem; }
.alert.ok { background: #e2f4ea; color: #2e6b46; }
.alert.warn { background: #fdf3dd; color: #7a5c16; }
.alert.err { background: #fde9e7; color: #7a2e2a; }

/* ---------- 管理表格 ---------- */
table.admin-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.admin-table th, .admin-table td { border-bottom: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top; }
.admin-table th { color: var(--primary-dark); background: var(--primary-light); }
.msg-content { white-space: pre-wrap; }

.footer {
  border-top: 1px solid var(--border);
  background: #fff;
  color: var(--text-light);
  font-size: .85rem;
}
.footer a { color: var(--text-light); text-decoration: none; }
.footer a:hover { color: var(--primary); }

.empty { color: var(--text-light); text-align: center; padding: 30px 0; }
.mono { font-family: Consolas, Monaco, monospace; font-size: .88rem; }

/* ---------- 社区广场（xyebbs 式板块内容流） ---------- */
.board-wrap { margin-top: 6px; }
.board {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 22px;
}
.board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.board-head h2 { margin: 0; font-size: 1.12rem; color: var(--primary-dark); }
.board-more {
  color: var(--text-light);
  font-size: .85rem;
  text-decoration: none;
  transition: color .2s;
}
.board-more:hover { color: var(--primary); }

.item-list { display: flex; flex-direction: column; }
.item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 8px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: background .15s, padding-left .2s;
}
.item-row:last-child { border-bottom: none; }
.item-row:hover { background: var(--bg); padding-left: 14px; }
.item-main { min-width: 0; flex: 1; }
.item-title { font-weight: 600; font-size: .98rem; }
.item-desc {
  color: var(--text-light);
  font-size: .85rem;
  margin-top: 2px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.item-meta {
  color: var(--text-light);
  font-size: .8rem;
  white-space: nowrap;
  flex-shrink: 0;
}
.board-empty { color: var(--text-light); text-align: center; padding: 24px 0; }
.board-contact { text-align: center; padding: 12px 0; }
.board-contact p { color: var(--text-light); margin: 0 0 14px; }

/* 分屏里的紧凑列表 */
.mini-list .item-row { padding: 10px 4px; }
.mini-list .item-title { font-size: .95rem; }
.mini-list .item-desc { font-size: .82rem; }

/* ---------- 苹果官网式设计（Apple.com 风格） ---------- */
.apple-hero {
  background:
    radial-gradient(130% 100% at 50% 0%, #ffe9f3 0%, rgba(255, 233, 243, 0) 55%),
    linear-gradient(180deg, #fff6fb 0%, #fdf3f8 100%);
}
.apple-center { text-align: center; }
.apple-eyebrow {
  font-size: .9rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--primary-dark);
  margin: 0 0 18px;
}
.apple-eyebrow.light { color: #ffd9e8; }
.apple-title {
  font-size: clamp(2.6rem, 6vw, 4.2rem);
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -.5px;
  margin: 0 0 16px;
  color: var(--text);
}
.apple-title-sm { font-size: clamp(2rem, 4.5vw, 3rem); margin-bottom: 12px; }
.apple-title.light, .apple-title-sm.light { color: #fff; }
.apple-sub {
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  color: var(--text-light);
  margin: 0 auto 22px;
  max-width: 640px;
  line-height: 1.6;
}
.apple-sub.light { color: #e8d9e0; }
.apple-links { margin: 8px 0 0; font-size: 1.05rem; }
.apple-links a {
  color: var(--primary-dark);
  text-decoration: none;
  margin: 0 14px;
  transition: opacity .2s;
}
.apple-links a:hover { text-decoration: underline; opacity: .8; }
.apple-links.light a { color: #ffc7dd; }
.apple-links-sep { display: none; }

/* 浅色屏（服务器也改浅色，不再用深色） */
.apple-section { background: linear-gradient(180deg, #fff 0%, #fdf3f8 100%); }
.apple-section.alt { background: linear-gradient(180deg, #fdf3f8 0%, #fff 100%); }

/* 苹果式：侧边 logo 徽章（每部分的大 emoji 渐变圆角块，比例协调） */
.apple-section .split-media {
  height: 180px;
  width: 180px;
  border-radius: 36px;
  font-size: 4.2rem;
  flex-shrink: 0;
  box-shadow: var(--shadow);
}
.apple-section .split { gap: 44px; }
.media-monitor { background: linear-gradient(135deg, #ffe4f0, #d8efff); }

/* 苹果式列表（无框、留白） */
.apple-list {
  max-width: 460px;
  margin: 6px 0 0;
  text-align: left;
}
.apple-list .item-row { padding: 11px 2px; }
.apple-list .item-title { font-size: .95rem; }
.apple-list .item-desc { font-size: .82rem; }

/* 服务器卡片（分屏内）微调 */
.apple-section .server-grid { margin-top: 4px; }

/* ---------- 猫猫 AI 聊天悬浮窗 ---------- */
#cat-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #f78fbf, #b3a3f5);
  color: #fff;
  font-size: 26px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(247, 143, 191, .45);
  z-index: 1000;
  transition: transform .2s, box-shadow .2s;
}
#cat-fab:hover { transform: scale(1.08); box-shadow: 0 10px 30px rgba(247, 143, 191, .55); }
.cat-chat {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 340px;
  max-width: calc(100vw - 32px);
  height: 480px;
  max-height: calc(100vh - 100px);
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1000;
  font-size: .9rem;
}
.cat-header {
  background: linear-gradient(135deg, #f78fbf, #b3a3f5);
  color: #fff;
  padding: 12px 16px;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cat-close { background: none; border: none; color: #fff; font-size: 20px; cursor: pointer; line-height: 1; }
.cat-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fdf3f8;
}
.cat-msg {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: 16px;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
}
.cat-msg-bot { background: #fff; align-self: flex-start; border-bottom-left-radius: 4px; box-shadow: 0 1px 4px rgba(0, 0, 0, .06); }
.cat-msg-me { background: linear-gradient(135deg, #f78fbf, #d9a8f0); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
/* 系统气泡：报错/系统提示独立展示（不参与 AI 上下文，不伪装成猫猫回复） */
.cat-msg-sys {
  align-self: center;
  background: #f3f0f7;
  color: #8a7f9b;
  font-size: .78rem;
  padding: 5px 12px;
  border-radius: 12px;
  max-width: 88%;
  text-align: center;
  border: 1px dashed #ddd4e6;
}
.cat-msg-sys a { color: var(--primary-dark); }
.cat-header { display: flex; align-items: center; gap: 8px; }
.cat-header > span { flex: 1; }
.cat-new {
  background: rgba(255,255,255,.22);
  border: 1px solid rgba(255,255,255,.4);
  color: #fff;
  border-radius: 14px;
  padding: 3px 10px;
  font-size: .75rem;
  cursor: pointer;
}
.cat-new:hover { background: rgba(255,255,255,.32); }
.cat-quick { display: flex; gap: 6px; padding: 8px 12px; background: #fff; flex-wrap: wrap; }
.cat-quick button {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: .78rem;
  cursor: pointer;
  color: var(--primary-dark);
  transition: background .2s;
}
.cat-quick button:hover { background: var(--primary-light); }
.cat-input { display: flex; gap: 8px; padding: 10px 12px; background: #fff; border-top: 1px solid var(--border); }
.cat-input input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: .88rem;
  outline: none;
}
.cat-input input:focus { border-color: var(--primary); }
.cat-input button {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: .85rem;
  cursor: pointer;
}
.cat-input button:disabled { opacity: .5; cursor: not-allowed; }

/* 显隐控制：hidden 属性必须生效（防 display:flex 覆盖） */
.cat-chat[hidden] { display: none !important; }

/* ---------- 聊天窗响应式：桌面悬浮 / 平板适中 / 手机全屏 ---------- */
@media (min-width: 521px) and (max-width: 820px) {
  .cat-chat { width: 360px; height: 480px; right: 18px; bottom: 18px; }
}
@media (max-width: 520px) {
  .cat-chat {
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    height: 100vh;   /* 兜底：不支持 dvh 的老浏览器 */
    height: 100dvh;  /* 动态视口：键盘弹出时自动缩小 */
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
    font-size: .95rem;
    /* 键盘弹出时的精确贴合由 chat.js 的 visualViewport 适配接管（inline 覆盖） */
  }
  #cat-fab {
    right: 14px;
    bottom: 14px;
    width: 52px;
    height: 52px;
    font-size: 24px;
  }
  .cat-body { padding: 12px; }
  .cat-msg { max-width: 88%; padding: 10px 14px; }
  .cat-input { padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); }
  .cat-input input { font-size: 1rem; }
  .cat-input button { padding: 10px 18px; }
}

/* ========== 主页滚动分屏（苹果式叙事） ========== */
html.snap-scroll { scroll-snap-type: y proximity; }

.snap-screen {
  min-height: 100vh;
  min-height: 100svh;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  padding: 40px 0;
}
.screen-inner {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity .7s ease, transform .7s ease;
}
.screen-inner.visible { opacity: 1; transform: none; }

/* Hero 屏：背景从中心粉色向外渐变到页面底色，边缘无边框线、缩放自适应 */
.hero-screen {
  background: radial-gradient(115% 115% at 50% 28%, #ffe2ee 0%, #fdf3f8 74%, #fdf3f8 100%);
}
.hero {
  text-align: center;
  background: none;
  border: none;
  border-radius: 0;
  padding: 0;
  margin: 0;
}
.scroll-hint {
  margin-top: 36px;
  color: var(--text-light);
  font-size: .9rem;
  animation: bob 2s ease-in-out infinite;
}
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(8px); } }

/* 故事屏 */
.story-card {
  max-width: 720px;
  margin: 0 auto;
  padding: 36px 40px;
}
.story-card .eyebrow { margin: 0 0 10px; }

/* 左右分栏屏 */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
  align-items: center;
}
.split-reverse .split-media { order: 2; }
.split-reverse .split-text { order: 1; }
.split-media {
  height: 320px;
  border-radius: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5.5rem;
  box-shadow: var(--shadow);
}
.media-note { background: linear-gradient(135deg, #ffe4f0, #efeafe); }
.media-files { background: linear-gradient(135deg, #efeafe, #d8efff); }
.media-contact { background: linear-gradient(135deg, #fff1e0, #ffe4f0); }
.split-text .eyebrow { margin: 0 0 10px; }
.split-text h2 { font-size: 2rem; margin: 0 0 12px; color: var(--text); }
.split-text p { color: var(--text-light); font-size: 1.02rem; margin: 0 0 22px; }

/* 服务器屏 */
.screen-inner .server-grid { margin-bottom: 20px; }

/* 图片轮播（宣传图自动切换）：contain 完整展示，容器比例匹配截图（约 1.9:1） */
.carousel {
  position: relative;
  width: 100%;
  max-width: 760px;
  aspect-ratio: 19 / 10; /* 匹配 1920x1009 截图，contain 后撑满无留白 */
  margin: 10px auto 6px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--primary-light);
}
.carousel img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain; /* 完整显示整张图，不裁剪 */
  opacity: 0;
  transition: opacity .9s ease;
}
.carousel img.active { opacity: 1; }

/* 移动端适配 */
@media (max-width: 720px) {
  .split { grid-template-columns: 1fr; gap: 24px; }
  .split-reverse .split-media { order: 0; }
  .split-reverse .split-text { order: 1; }
  .split-media { height: 220px; }
  .snap-screen { padding: 28px 0; }
}

/* ---------- 背景碎碎念（猫猫的絮叨 & 颜文字） ---------- */
.snap-screen { position: relative; overflow: hidden; }
.bg-quote {
  position: absolute;
  pointer-events: none;
  user-select: none;
  color: var(--primary-dark);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 1px;
  opacity: .13;
  animation: breathe 4.5s ease-in-out infinite;
  white-space: nowrap;
}
.bg-quote .kao {
  color: var(--accent);
  font-weight: 700;
}
@keyframes breathe {
  0%, 100% { opacity: .10; transform: translateY(0) rotate(var(--tilt, 0deg)); }
  50%      { opacity: .20; transform: translateY(-6px) rotate(var(--tilt, 0deg)); }
}

/* ═══════════ 夜间模式（跟随系统） ═══════════ */
/* ═══════════ 