/* ============================================================================
 * 萌宠教学系统 · 样式（精品童趣）
 * 设计基调：
 *   · 暖白纸感底色，不用径向渐变 / 波点 / 发光
 *   · 卡片 = 白底 + 1px 发丝描边 + 极淡投影（几乎不可见）
 *   · 圆角收敛：14 / 10 / 18，按钮 10，徽标 6-7
 *   · 主题色一律实色填充，hover 走 deep 深色，不用渐变
 *   · 图标统一 1.8px 线性描边（js/icons.js），不用 emoji
 * ==========================================================================*/

:root {
  /* 主题色（由 js/app.js applyTheme 覆盖） */
  --theme-main: #5B9A6E;
  --theme-deep: #3F7653;
  --theme-light: #EFF6F1;
  --theme-soft: #CFE5D6;
  --theme-text: #2F6B45;
  --theme-rgb: 91, 154, 110;

  /* 中性色：暖灰纸感 */
  --bg: #F6F5F1;
  --bg-2: #EFEDE7;
  --card: #FFFFFF;
  --card-2: #FBFAF7;
  --line: #E8E5DD;
  --line-2: #DCD8CE;
  --ink: #2A2A28;
  --ink-2: #5C5B56;
  --ink-3: #918F88;

  /* 语义色（去饱和，与插画色同族） */
  --ok: #4E9A6B;
  --ok-bg: #EEF6F1;
  --warn: #C2892E;
  --warn-bg: #FAF4E8;
  --danger: #C4614F;
  --danger-bg: #FBF0EE;
  --gold: #C2903F;
  --gold-2: #9C6F26;
  --gold-bg: #FAF4E8;

  /* 圆角 */
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 18px;

  /* 投影：只用于浮层，卡片几乎不用 */
  --shadow-card: 0 1px 2px rgba(42, 40, 36, .04);
  --shadow-pop: 0 10px 28px rgba(42, 40, 36, .12), 0 2px 6px rgba(42, 40, 36, .06);
  --shadow-modal: 0 24px 60px rgba(42, 40, 36, .2), 0 2px 8px rgba(42, 40, 36, .06);

  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", sans-serif;
}

* { box-sizing: border-box; }

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

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.55;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: #D5D2C9; border-radius: 8px;
  border: 3px solid transparent; background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: #C4C0B5; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------------------------------------------ 图标 */
.ic { display: inline-block; vertical-align: middle; flex: none; }

/* ------------------------------------------------------------------ 布局 */
#app { min-height: 100vh; display: flex; flex-direction: column; }

.wrap {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(246, 245, 241, .88);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-in { display: flex; align-items: center; gap: 14px; height: 60px; }

.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  background: var(--theme-main); color: #fff;
  display: grid; place-items: center; flex: none;
}
.brand > div > div:first-child { font-weight: 700; font-size: 16px; letter-spacing: -.2px; }
.brand-sub { font-size: 11.5px; color: var(--ink-3); font-weight: 500; }

.topbar-spacer { flex: 1; }

.teacher-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 12px 4px 4px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line);
}
.teacher-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--theme-light); color: var(--theme-text);
  display: grid; place-items: center; flex: none;
}
.teacher-name { font-size: 13px; font-weight: 600; color: var(--ink-2); }

.icon-btn {
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--line); color: var(--ink-2);
  transition: background .15s, border-color .15s, color .15s;
}
.icon-btn:hover { background: var(--theme-light); border-color: var(--theme-soft); color: var(--theme-text); }

main { flex: 1; padding: 26px 0 72px; }

/* ------------------------------------------------------------------ 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 15px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 600; white-space: nowrap; letter-spacing: -.1px;
  border: 1px solid transparent; transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--theme-main); color: #fff; }
.btn-primary:hover { background: var(--theme-deep); }
.btn-ghost { background: var(--card); border-color: var(--line-2); color: var(--ink-2); }
.btn-ghost:hover { border-color: var(--theme-main); color: var(--theme-text); background: var(--theme-light); }
.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: #EFD3CD; }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; gap: 5px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }

/* ------------------------------------------------------------- 页头区块 */
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-title { font-size: 24px; font-weight: 700; letter-spacing: -.5px; margin: 0; }
.page-desc { font-size: 13px; color: var(--ink-3); margin: 5px 0 0; }
.page-head-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* --------------------------------------------------------------- 班级卡片 */
.class-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 16px;
}

.class-card {
  position: relative; overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  transition: border-color .18s, box-shadow .18s, transform .18s;
}
.class-card:hover { transform: translateY(-2px); border-color: var(--line-2); box-shadow: var(--shadow-pop); }

.class-card-top {
  position: relative; padding: 18px 20px 16px;
  background: var(--c-main, #5B9A6E); color: #fff;
}
.class-emoji {
  position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  color: rgba(255, 255, 255, .18); line-height: 0;
}
.class-name { font-size: 18px; font-weight: 700; letter-spacing: -.3px; position: relative; z-index: 1; }
.class-grade { font-size: 12px; opacity: .82; position: relative; z-index: 1; margin-top: 1px; }
.class-card-body { padding: 16px 20px 18px; }

.class-stats { display: flex; align-items: flex-end; gap: 20px; margin-bottom: 16px; }
.class-stat { display: flex; flex-direction: column; }
.class-stat b { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15; letter-spacing: -.4px; }
.class-stat span { font-size: 11px; color: var(--ink-3); }

.class-card-actions { display: flex; gap: 8px; }
.class-card-actions .btn { flex: 1; }

.empty-state {
  grid-column: 1 / -1; padding: 52px 20px; text-align: center;
  background: var(--card); border: 1px dashed var(--line-2);
  border-radius: var(--radius-lg); color: var(--ink-3);
}
.empty-state .big { display: flex; justify-content: center; color: var(--ink-3); opacity: .55; margin-bottom: 12px; }

/* ------------------------------------------------------------------ 工具条 */
.toolbar {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 9px 11px; margin-bottom: 18px;
  box-shadow: var(--shadow-card);
}
.search-box {
  display: flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 11px; border-radius: var(--radius-sm);
  background: var(--card-2); border: 1px solid var(--line); flex: 0 1 200px;
  transition: border-color .15s, background .15s;
}
.search-box:focus-within { background: #fff; border-color: var(--theme-main); }
.search-box input { border: none; background: none; outline: none; width: 100%; font-size: 13px; }
.search-box span { color: var(--ink-3); line-height: 0; }

.select-pill {
  height: 34px; padding: 0 30px 0 11px; border-radius: var(--radius-sm);
  background: var(--card-2); border: 1px solid var(--line); font-size: 13px; font-weight: 500;
  appearance: none; -webkit-appearance: none; outline: none; color: var(--ink-2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23918F88' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
.select-pill:hover { border-color: var(--line-2); }
.select-pill:focus { border-color: var(--theme-main); background-color: #fff; }

.toolbar-sep { width: 1px; height: 20px; background: var(--line); }
.toolbar-spacer { flex: 1; }

/* ------------------------------------------------------------- 班级头图 */
.class-hero {
  position: relative; overflow: hidden;
  border-radius: var(--radius-lg); padding: 22px 24px; margin-bottom: 18px;
  background: var(--c-main, #5B9A6E); color: #fff;
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
}
.hero-main { position: relative; z-index: 1; }
.hero-back {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px;
  color: rgba(255, 255, 255, .92); margin-bottom: 8px; cursor: pointer;
  background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .2);
  padding: 3px 10px; border-radius: 999px; transition: background .15s;
}
.hero-back:hover { background: rgba(255, 255, 255, .26); }
.hero-title { font-size: 25px; font-weight: 700; letter-spacing: -.6px; margin: 0; }
.hero-meta { font-size: 12.5px; opacity: .85; margin-top: 1px; }
.hero-stats { margin-left: auto; display: flex; gap: 26px; position: relative; z-index: 1; flex-wrap: wrap; }
.hero-stat { text-align: center; }
.hero-stat b { display: block; font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15; letter-spacing: -.5px; }
.hero-stat span { font-size: 11.5px; opacity: .82; }
.hero-actions { display: flex; gap: 8px; position: relative; z-index: 1; width: 100%; flex-wrap: wrap; }
.hero-actions .btn {
  background: rgba(255, 255, 255, .16); color: #fff;
  border-color: rgba(255, 255, 255, .26);
}
.hero-actions .btn:hover { background: rgba(255, 255, 255, .3); }

/* ------------------------------------------------------------- 宠物卡片墙 */
.pet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 13px;
}

.pet-card {
  position: relative; display: flex; flex-direction: column;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card);
  padding: 11px 11px 10px;
  transition: border-color .18s, box-shadow .18s, transform .18s;
  cursor: pointer;
}
.pet-card:hover {
  transform: translateY(-2px);
  border-color: var(--c-main, #5B9A6E);
  box-shadow: var(--shadow-pop);
}
.pet-card.is-broken { background: var(--card-2); border-color: var(--line-2); }
.pet-card.is-max { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(194, 144, 63, .12); }
.pet-card.is-hungry { border-color: #E2C08A; }

.pet-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 3px; }

.lv-badge {
  display: inline-flex; align-items: center; gap: 3px;
  height: 21px; padding: 0 8px; border-radius: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .2px;
  background: var(--c-main, #5B9A6E); color: #fff;
}
.lv-badge.broken { background: #7C7A74; }
.lv-badge.max { background: var(--gold); color: #fff; }

.pet-card-menu {
  width: 24px; height: 24px; border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-3); background: transparent; border: 1px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.pet-card-menu:hover { background: var(--card-2); color: var(--ink); border-color: var(--line); }

.pet-figure { height: 114px; display: grid; place-items: center; position: relative; }
.pet-figure svg { display: block; }

.pet-ribbon {
  position: absolute; top: 2px; left: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px;
  background: var(--warn-bg); color: #8F6216; border: 1px solid #EBD6AE; white-space: nowrap;
}
.pet-ribbon.r-danger { background: var(--danger-bg); color: #9C4335; border-color: #EFD3CD; }
.pet-ribbon.r-rare { background: #EDF4FA; color: #2A6389; border-color: #CBE0F0; }
.pet-ribbon.r-epic { background: #F3F1FB; color: #5B4A96; border-color: #DCD6F0; }
.pet-ribbon.r-legend { background: var(--gold-bg); color: var(--gold-2); border-color: #EBD6AE; }

.pet-name {
  font-size: 14px; font-weight: 700; text-align: center; letter-spacing: -.1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pet-species { font-size: 10.5px; color: var(--ink-3); text-align: center; margin-top: 1px; }

.pet-progress-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 10px; color: var(--ink-3); margin-top: 9px; margin-bottom: 5px;
}
.pet-progress-row b { color: var(--theme-text); font-weight: 700; }

.progress { height: 5px; border-radius: 999px; background: #EDEBE4; overflow: hidden; }
.progress i {
  display: block; height: 100%; border-radius: 999px;
  background: var(--c-main, #5B9A6E);
  transition: width .45s cubic-bezier(.34, 1.2, .64, 1);
}
.progress.gold i { background: var(--gold); }

.pet-foot {
  display: flex; align-items: center; gap: 6px; margin-top: 10px;
  padding-top: 9px; border-top: 1px solid var(--line);
}
.pet-score {
  font-size: 15.5px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--theme-text); line-height: 1; letter-spacing: -.3px;
}
.pet-score small { font-size: 10px; font-weight: 600; color: var(--ink-3); }
.pet-score.neg { color: var(--danger); }
.pet-group-pill {
  margin-left: auto; font-size: 10px; color: var(--ink-3);
  padding: 2px 7px; border-radius: 6px; background: var(--card-2); border: 1px solid var(--line);
}
.pet-score-btns { display: flex; gap: 5px; margin-top: 7px; }
.score-btn {
  flex: 1; height: 29px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.score-btn.minus { background: var(--card-2); color: var(--ink-3); border: 1px solid var(--line); }
.score-btn.minus:hover { background: var(--danger-bg); color: var(--danger); border-color: #EFD3CD; }
.score-btn.plus { background: var(--c-light, #EFF6F1); color: var(--c-text, #2F6B45); border: 1px solid var(--c-soft, #CFE5D6); }
.score-btn.plus:hover { background: var(--c-main, #5B9A6E); color: #fff; border-color: var(--c-main, #5B9A6E); }

/* ------------------------------------------------------------------ 弹窗 */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(42, 40, 36, .38);
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  display: grid; place-items: center; padding: 24px;
  animation: fadeIn .16s ease;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(.985) } to { opacity: 1; transform: none } }

.modal {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  width: 100%; max-width: 520px; max-height: 88vh;
  display: flex; flex-direction: column; overflow: hidden;
  animation: popIn .2s cubic-bezier(.34, 1.2, .64, 1);
}
.modal.wide { max-width: 760px; }
.modal.narrow { max-width: 400px; }

.modal-head {
  display: flex; align-items: center; gap: 11px;
  padding: 17px 20px 15px; border-bottom: 1px solid var(--line);
}
.modal-title { font-size: 16px; font-weight: 700; letter-spacing: -.2px; }
.modal-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.modal-head .icon-btn { margin-left: auto; width: 30px; height: 30px; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot {
  display: flex; gap: 9px; padding: 14px 20px 17px;
  border-top: 1px solid var(--line); background: var(--card-2);
}
.modal-foot .btn { flex: 1; }

.field { margin-bottom: 15px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--ink-2); margin-bottom: 7px; }
.input {
  width: 100%; height: 42px; padding: 0 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: var(--card-2); outline: none;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.input:focus { border-color: var(--theme-main); background: #fff; box-shadow: 0 0 0 3px rgba(var(--theme-rgb), .14); }
textarea.input { height: auto; padding: 11px 13px; resize: vertical; line-height: 1.6; }
select.input { appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23918F88' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; padding-right: 32px;
}
.hint { font-size: 11.5px; color: var(--ink-3); margin-top: 7px; line-height: 1.55; }

/* ------------------------------------------------------------- 主题色选择 */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(94px, 1fr)); gap: 8px; }
.theme-item {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 9px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--card);
  font-size: 12px; font-weight: 600; color: var(--ink-2);
  transition: border-color .15s, background .15s;
}
.theme-item:hover { border-color: var(--line-2); background: var(--card-2); }
.theme-item.active {
  border-color: var(--t-main); background: var(--t-light); color: var(--t-text);
  box-shadow: 0 0 0 2px var(--t-light);
}
.theme-dot { width: 15px; height: 15px; border-radius: 5px; flex: none; background: var(--t-main); }

/* -------------------------------------------------------------- 加减分面板 */
.score-tabs {
  display: flex; gap: 4px; padding: 3px;
  background: var(--bg-2); border-radius: var(--radius-sm); margin-bottom: 16px;
}
.score-tab {
  flex: 1; height: 34px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--ink-3);
  transition: background .15s, color .15s;
}
.score-tab.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow-card); }
.score-tab.active.plus { color: var(--theme-text); }
.score-tab.active.minus { color: var(--danger); }

.reason-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 8px; }
.reason-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 13px 6px 11px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--card);
  transition: border-color .15s, background .15s, transform .12s;
}
.reason-item:hover { transform: translateY(-2px); }
.reason-item .ic { line-height: 0; }
.reason-item.plus .ic { color: var(--theme-text); }
.reason-item.minus .ic { color: var(--danger); }
.reason-item .lb { font-size: 12px; font-weight: 600; }
.reason-item .pt { font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.reason-item.plus .pt { color: var(--ok); }
.reason-item.minus .pt { color: var(--danger); }
.reason-item.plus:hover { border-color: var(--theme-main); background: var(--theme-light); }
.reason-item.minus:hover { border-color: #E0AFA4; background: var(--danger-bg); }

/* ---------------------------------------------------------------- 学生详情 */
.detail-hero {
  display: flex; gap: 20px; align-items: center;
  padding: 20px; border-radius: var(--radius);
  background: var(--c-light, #EFF6F1);
  border: 1px solid var(--c-soft, #CFE5D6); margin-bottom: 16px;
}
.detail-figure { flex: none; width: 132px; height: 140px; display: grid; place-items: center; }
.detail-info { flex: 1; min-width: 0; }
.detail-name { font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; letter-spacing: -.3px; }
.detail-species {
  font-size: 12px; color: var(--ink-2); margin: 3px 0 9px;
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
}
.detail-score { font-size: 33px; font-weight: 700; line-height: 1; color: var(--theme-text); font-variant-numeric: tabular-nums; letter-spacing: -1px; }
.detail-score small { font-size: 13px; font-weight: 600; color: var(--ink-3); margin-left: 4px; letter-spacing: 0; }

.stage-track { display: flex; gap: 3px; margin: 12px 0 7px; }
.stage-seg { flex: 1; height: 6px; border-radius: 999px; background: #E4E1D9; }
.stage-seg.on { background: var(--c-main, #5B9A6E); }
.stage-seg.gold { background: var(--gold); }
.stage-labels { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--ink-3); margin: 0 1px; }
.stage-labels .passed { color: var(--ink-2); }
.stage-labels .on { color: var(--theme-text, var(--ink)); font-weight: 700; }
.stage-progress { text-align: center; font-size: 11px; color: var(--ink-2); margin: 4px 0 2px; }
.stage-progress b { color: var(--theme-text, var(--ink)); font-weight: 700; }

/* ========================================================== 宠物阶段动画 ===
   每个阶段的 SVG 在浏览器里以 CSS keyframes 持续动起来 = 网页版"动图"。
   节奏有意错开，避免全班整齐抖动。 */
@keyframes pet-egg-wobble {
  0%, 100% { transform: rotate(-2deg) scale(1); }
  50%      { transform: rotate(2deg)  scale(1.025); }
}
@keyframes pet-sprout-hop {
  0%, 100% { transform: translateY(0)    rotate(-1deg); }
  50%      { transform: translateY(-5px) rotate(1deg); }
}
@keyframes pet-juvenile-wag {
  0%, 100% { transform: translateY(0)    rotate(0); }
  20%      { transform: translateY(-3px) rotate(-3deg); }
  60%      { transform: translateY(-1px) rotate(3deg); }
  80%      { transform: translateY(0)    rotate(-1deg); }
}
@keyframes pet-adult-breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.022); }
}
@keyframes pet-mythic-pulse {
  0%, 100% { transform: scale(1)     rotate(0); }
  50%      { transform: scale(1.04)  rotate(0.5deg); }
}
@keyframes pet-aura-spin {
  to { transform: rotate(360deg); }
}

svg.pet-stage-1 { animation: pet-egg-wobble     2.6s ease-in-out infinite; transform-origin: 100px 130px; transform-box: view-box; }
svg.pet-stage-2 { animation: pet-sprout-hop     1.7s ease-in-out infinite; transform-origin: 100px 110px; transform-box: view-box; }
svg.pet-stage-3 { animation: pet-juvenile-wag   2.1s ease-in-out infinite; transform-origin: 100px 130px; transform-box: view-box; }
svg.pet-stage-4 { animation: pet-adult-breathe  3.6s ease-in-out infinite; transform-origin: 100px 130px; transform-box: view-box; }
svg.pet-stage-5 { animation: pet-mythic-pulse   2.4s ease-in-out infinite; transform-origin: 100px 128px; transform-box: view-box; }
svg.pet-stage-5 .mythic-ring      { animation: pet-aura-spin 8s  linear infinite;        transform-origin: center; transform-box: fill-box; }
svg.pet-stage-5 .mythic-rays      { animation: pet-aura-spin 14s linear infinite reverse; transform-origin: center; transform-box: fill-box; }
svg.pet-stage-5 .mythic-halo      { animation: pet-aura-spin 6s  linear infinite;        transform-origin: center; transform-box: fill-box; }

@media (prefers-reduced-motion: reduce) {
  svg.pet-stage-1, svg.pet-stage-2, svg.pet-stage-3, svg.pet-stage-4, svg.pet-stage-5,
  svg.pet-stage-5 .mythic-ring, svg.pet-stage-5 .mythic-rays, svg.pet-stage-5 .mythic-halo {
    animation: none !important;
  }
}

/* ============================================================ 领养中心 === */
.adopt-cta {
  display: flex; align-items: center; gap: 10px;
  margin: 8px 2px 0; padding: 8px 0 0;
  border-top: 1px dashed var(--line);
}
.adopt-cta .btn-primary { background: var(--gold); border-color: var(--gold-2); }
.adopt-cta .btn-primary:hover { background: var(--gold-2); }
.adopt-count { font-size: 11.5px; color: var(--ink-3); }

.adopt-body { padding: 4px 6px 8px; }
.adopt-filter { display: flex; gap: 6px; padding: 0 4px 10px; flex-wrap: wrap; }
.adopt-chip {
  padding: 5px 12px; border-radius: 999px;
  background: var(--card-2); border: 1px solid var(--line);
  color: var(--ink-2); font-size: 12px; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.adopt-chip:hover { border-color: var(--c-main, #5B9A6E); }
.adopt-chip.on { background: var(--theme-main, #5B9A6E); color: #fff; border-color: var(--theme-deep, #4a7d59); }

.adopt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  padding: 4px;
  max-height: 62vh; overflow-y: auto;
}
.adopt-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 6px 6px;
  cursor: pointer;
  transition: transform .15s, border-color .15s, box-shadow .15s;
  text-align: center;
}
.adopt-card:hover { transform: translateY(-2px); border-color: var(--theme-main, #5B9A6E); box-shadow: 0 4px 12px rgba(0,0,0,.06); }
.adopt-card.is-current { opacity: .5; cursor: not-allowed; }
.adopt-card.is-current:hover { transform: none; border-color: var(--line); box-shadow: none; }
.adopt-fig { display: grid; place-items: center; height: 92px; }
.adopt-fig svg { display: block; }
.adopt-name { font-size: 12.5px; color: var(--ink); font-weight: 600; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.adopt-meta { display: flex; justify-content: center; gap: 4px; align-items: center; margin-top: 2px; min-height: 16px; }
.rarity-tag { font-size: 10.5px; font-weight: 600; }
.adopt-mark {
  font-size: 10px; padding: 1px 6px; border-radius: 999px;
  background: var(--card-2); color: var(--ink-3);
  border: 1px solid var(--line);
}
.adopt-mark.taken { background: #FBF4E1; color: var(--gold-2); border-color: #EBD6AE; }

/* 筛选：通过 grid 上的 data-rarity 隐藏不匹配的卡片，不重开 modal */
.adopt-grid[data-rarity="common"] .adopt-card:not([data-rarity="common"]),
.adopt-grid[data-rarity="rare"]   .adopt-card:not([data-rarity="rare"]),
.adopt-grid[data-rarity="epic"]   .adopt-card:not([data-rarity="epic"]),
.adopt-grid[data-rarity="legend"] .adopt-card:not([data-rarity="legend"]) {
  display: none;
}

.section-title {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 700; color: var(--ink-2);
  margin: 20px 0 10px;
}
.section-title::before { content: ''; width: 3px; height: 13px; border-radius: 2px; background: var(--theme-main); }

.log-list { display: flex; flex-direction: column; gap: 6px; }
.log-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 13px; border-radius: var(--radius-sm);
  background: var(--card-2); border: 1px solid var(--line);
}
.log-ic {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ok-bg); color: var(--ok);
}
.log-ic.minus { background: var(--danger-bg); color: var(--danger); }
.log-main { flex: 1; min-width: 0; }
.log-reason { font-size: 13px; font-weight: 600; }
.log-time { font-size: 10.5px; color: var(--ink-3); }
.log-delta { font-size: 14.5px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ok); }
.log-delta.minus { color: var(--danger); }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.stat-box { padding: 12px; border-radius: var(--radius-sm); background: var(--card-2); border: 1px solid var(--line); text-align: center; }
.stat-box b { display: block; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
.stat-box span { font-size: 11px; color: var(--ink-3); }

/* ------------------------------------------------------------------ 图鉴 */
.rarity-group { margin-bottom: 26px; }
.rarity-head { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.rarity-tag { font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.rarity-count { font-size: 11.5px; color: var(--ink-3); }

.dex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 9px; }
.dex-item {
  position: relative; overflow: hidden;
  border-radius: var(--radius); border: 1px solid var(--line); background: var(--card);
  padding: 8px 6px 9px; text-align: center;
  transition: border-color .18s, transform .18s, box-shadow .18s;
}
.dex-item:hover { transform: translateY(-2px); border-color: var(--line-2); box-shadow: var(--shadow-card); }
.dex-item.locked { background: var(--card-2); border-color: #EFECE4; }
.dex-item.locked .dex-fig svg { filter: grayscale(1); opacity: .3; }
.dex-item.locked .dex-name { color: #B5B2AA; }
.dex-item.locked .dex-owner { color: #C6C3BB; }
.dex-item.locked .dex-rar { opacity: .22; }
.dex-item .dex-fig { height: 72px; display: grid; place-items: center; }
.dex-name { font-size: 11.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dex-owner { font-size: 10px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dex-rar { position: absolute; top: 7px; right: 7px; width: 6px; height: 6px; border-radius: 50%; }

/* ------------------------------------------------------------- 批量记分 */
.batch-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.batch-bar .chip { cursor: pointer; }
.batch-bar .chip:hover { background: var(--theme-soft); }
.batch-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 7px;
  max-height: 330px; overflow-y: auto; padding: 2px;
}
.batch-item {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  padding: 7px 4px 6px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--card);
  transition: border-color .15s, background .15s;
}
.batch-item:hover { border-color: var(--line-2); background: var(--card-2); }
.batch-item.on { border-color: var(--theme-main); background: var(--theme-light); }
.batch-item .bi-fig { height: 50px; display: grid; place-items: center; }
.batch-item .bi-name {
  font-size: 11.5px; font-weight: 700; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.batch-item .bi-score { font-size: 10px; color: var(--ink-3); }
.batch-item.on::after {
  content: ''; position: absolute; top: 4px; right: 4px;
  width: 15px; height: 15px; border-radius: 50%; background: var(--theme-main);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.6 4.4 4.4L19 7.2'/%3E%3C/svg%3E");
  background-size: 10px 10px; background-position: center; background-repeat: no-repeat;
}
.batch-summary {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  margin-top: 14px; padding: 11px 14px; border-radius: var(--radius-sm);
  background: var(--theme-light); color: var(--theme-text);
  border: 1px solid var(--theme-soft); font-size: 12.5px; font-weight: 600;
}
.batch-summary b { font-size: 15.5px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------- 大屏模式 */
.screen-mode {
  position: fixed; inset: 0; z-index: 200;
  background: #1D1C1A; color: #fff;
  display: flex; flex-direction: column; overflow: hidden;
}
.screen-head { display: flex; align-items: center; gap: 16px; padding: 18px 30px 14px; position: relative; z-index: 2; }
.screen-title { font-size: 26px; font-weight: 700; letter-spacing: -.7px; }
.screen-title .acc { color: color-mix(in srgb, var(--c-main, #5B9A6E) 62%, #fff); }
.screen-meta { font-size: 12.5px; color: rgba(255, 255, 255, .45); }
.screen-head .icon-btn {
  margin-left: auto; width: auto; height: 36px; padding: 0 15px;
  font-size: 13px; font-weight: 600; color: #fff;
  background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .16);
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.screen-head .icon-btn:hover { background: rgba(255, 255, 255, .18); color: #fff; }
.screen-body { flex: 1; overflow-y: auto; padding: 10px 30px 30px; position: relative; z-index: 2; }
.screen-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 11px; }
.screen-cell {
  border-radius: var(--radius); padding: 10px 8px 11px; text-align: center;
  background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .09);
  transition: background .18s, border-color .18s;
}
.screen-cell.max { background: rgba(194, 144, 63, .16); border-color: rgba(194, 144, 63, .42); }
.screen-cell.broken { background: rgba(255, 255, 255, .025); }
.screen-cell .sc-fig { height: 80px; display: grid; place-items: center; }
.screen-cell .sc-name { font-size: 13px; font-weight: 700; margin-top: 2px; }
.screen-cell .sc-lv { font-size: 10.5px; color: rgba(255, 255, 255, .5); }
.screen-cell .sc-lv b { color: color-mix(in srgb, var(--c-main, #5B9A6E) 55%, #fff); }

.shout-banner {
  position: relative; z-index: 3; margin: 0 30px 14px;
  display: flex; align-items: center; gap: 11px;
  padding: 13px 20px; border-radius: var(--radius);
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .14);
  animation: shoutIn .4s cubic-bezier(.34, 1.2, .64, 1);
}
@keyframes shoutIn { from { opacity: 0; transform: translateY(-10px) } to { opacity: 1; transform: none } }
.shout-ic {
  flex: none; line-height: 0;
  color: color-mix(in srgb, var(--c-main, #5B9A6E) 55%, #fff);
}
.shout-banner .who { font-size: 12px; color: rgba(255, 255, 255, .55); flex: none; }
.shout-banner .msg { font-size: 18px; font-weight: 600; letter-spacing: -.2px; }

/* ------------------------------------------------------------------ Toast */
.toast-wrap {
  position: fixed; top: 76px; left: 50%; transform: translateX(-50%);
  z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 17px; border-radius: var(--radius-sm);
  background: #2A2A28; color: #fff;
  font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-pop);
  animation: toastIn .26s cubic-bezier(.34, 1.2, .64, 1);
}
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px) } to { opacity: 1; transform: none } }
.toast.out { animation: toastOut .28s ease forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px) } }
.toast.ok { background: #3F7A57; }
.toast.warn { background: #9E6E20; }
.toast.err { background: #A34F40; }
.toast.gold { background: var(--gold-2); }

/* ---------------------------------------------------------------- 下拉菜单 */
.menu-pop {
  position: absolute; z-index: 60; min-width: 158px;
  background: var(--card); border: 1px solid var(--line-2);
  border-radius: var(--radius); box-shadow: var(--shadow-pop);
  padding: 5px; animation: popIn .15s ease;
}
.menu-pop button {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px 10px; border-radius: 8px;
  font-size: 13px; font-weight: 500; text-align: left; color: var(--ink-2);
}
.menu-pop button .ic { color: var(--ink-3); }
.menu-pop button:hover { background: var(--theme-light); color: var(--theme-text); }
.menu-pop button:hover .ic { color: var(--theme-text); }
.menu-pop button.danger:hover { background: var(--danger-bg); color: var(--danger); }
.menu-pop button.danger:hover .ic { color: var(--danger); }
.menu-sep { height: 1px; background: var(--line); margin: 4px 6px; }

/* ------------------------------------------------------------------- 其它 */
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font-size: 11.5px; padding: 4px 10px; border-radius: 999px;
  background: var(--theme-light); color: var(--theme-text);
  border: 1px solid var(--theme-soft); font-weight: 600;
  transition: background .15s;
}
.chip.gray { background: var(--card-2); color: var(--ink-3); border-color: var(--line); }

.mv-up { animation: mvUp .45s cubic-bezier(.34, 1.2, .64, 1); }
@keyframes mvUp { 0% { transform: translateY(0) } 40% { transform: translateY(-8px) } 100% { transform: none } }
.pulse { animation: pulse 1.6s ease infinite; }
@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: .55 } }

.float-score {
  position: fixed; z-index: 400; font-size: 20px; font-weight: 700;
  font-variant-numeric: tabular-nums; pointer-events: none;
  animation: floatUp 1s ease forwards;
}
@keyframes floatUp {
  0% { opacity: 0; transform: translateY(6px) scale(.85) }
  25% { opacity: 1; transform: translateY(-4px) scale(1.08) }
  100% { opacity: 0; transform: translateY(-36px) scale(1) }
}

.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2.5px solid var(--line-2); border-top-color: var(--theme-main);
  animation: spin .8s linear infinite; margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg) } }

/* ---------------------------------------------------------------- 响应式 */
@media (max-width: 720px) {
  .wrap { padding: 0 14px; }
  .page-title { font-size: 20px; }
  .class-grid { grid-template-columns: 1fr; }
  .pet-grid { grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); gap: 10px; }
  .hero-title { font-size: 20px; }
  .hero-stats { gap: 16px; width: 100%; justify-content: space-between; }
  .hero-stat b { font-size: 19px; }
  .detail-hero { flex-direction: column; text-align: center; }
  .detail-info { display: flex; flex-direction: column; align-items: center; }
  .detail-species { justify-content: center; }
  .detail-figure { width: 110px; height: 118px; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .screen-head { padding: 14px 16px 10px; }
  .screen-title { font-size: 19px; }
  .screen-body { padding: 8px 16px 20px; }
  .screen-grid { grid-template-columns: repeat(auto-fill, minmax(94px, 1fr)); gap: 8px; }
  .shout-banner { margin: 0 16px 12px; }
  .shout-banner .msg { font-size: 15px; }
  .modal-mask { padding: 12px; align-items: flex-end; }
  .modal { max-height: 92vh; }
  .toolbar { gap: 8px; }
  .search-box { flex: 1 1 100%; }
  .reason-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
}


