/* ===== 全局变量 ===== */
:root {
  --primary: #f97316;
  --primary-light: #fed7aa;
  --primary-dark: #ea580c;
  --secondary: #8b5cf6;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --bg: #fdfbf7;
  --bg-card: #ffffff;
  --border: #e5e7eb;
  --text: #1f2937;
  --text-muted: #6b7280;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-sm: 8px;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: 'PingFang SC', 'Microsoft YaHei', 'Hiragino Sans GB', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== 页面系统 ===== */
.page { display: none; }
.page.active { display: block; min-height: 100vh; padding-bottom: 2rem; }

/* ===== 登录页 ===== */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #fff7ed 0%, #fef3c7 50%, #ecfdf5 100%);
  position: relative;
  overflow: hidden;
}

.login-card {
  background: white;
  border-radius: 20px;
  padding: 3rem 2.5rem;
  box-shadow: var(--shadow-lg);
  width: 380px;
  position: relative;
  z-index: 10;
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.logo-emoji {
  font-size: 4rem;
  display: block;
  margin-bottom: 0.5rem;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.login-logo h1 {
  font-size: 1.8rem;
  color: var(--primary);
  font-weight: 700;
}

.login-subtitle {
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.login-hint {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 1rem;
}

.login-divider {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 1.5rem 0;
  position: relative;
}

.login-divider::before,
.login-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: var(--border-color);
}

.login-divider::before {
  left: 0;
}

.login-divider::after {
  right: 0;
}

.login-divider span {
  background: white;
  padding: 0 0.5rem;
  position: relative;
  z-index: 1;
}

.required {
  color: #ef4444;
  font-weight: 600;
}

.login-pets {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
}

.floating-pet {
  position: absolute;
  font-size: 2.5rem;
  animation: float 6s ease-in-out infinite;
}

.floating-pet:nth-child(1) { top: 10%; left: 5%; }
.floating-pet:nth-child(2) { top: 15%; right: 8%; }
.floating-pet:nth-child(3) { bottom: 20%; left: 3%; }
.floating-pet:nth-child(4) { bottom: 15%; right: 5%; }
.floating-pet:nth-child(5) { top: 40%; left: 2%; }
.floating-pet:nth-child(6) { top: 35%; right: 3%; }
.floating-pet:nth-child(7) { top: 65%; left: 8%; }
.floating-pet:nth-child(8) { bottom: 35%; right: 7%; }

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-20px) rotate(5deg); }
  75% { transform: translateY(10px) rotate(-5deg); }
}

/* ===== 表单 ===== */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; margin-bottom: 0.4rem; font-weight: 500; color: var(--text); }
.form-input, .form-textarea {
  width: 100%;
  padding: 0.6rem 0.9rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: white;
  transition: border-color 0.2s;
  outline: none;
}
.form-input:focus, .form-textarea:focus { border-color: var(--primary); }
.form-textarea { resize: vertical; }
.form-group select, .form-group input[type="text"], .form-group input[type="email"], .form-group input[type="password"] {
  width: 100%;
  padding: 0.6rem 0.9rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: white;
  transition: border-color 0.2s;
  outline: none;
}
.form-group select:focus, .form-group input[type="text"]:focus, .form-group input[type="email"]:focus, .form-group input[type="password"]:focus {
  border-color: var(--primary);
}

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.6rem 1.2rem;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(0.96); }
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-outline { background: white; color: var(--text); border-color: var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn-outline.active { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-purple { background: #7c3aed; color: white; border-color: #7c3aed; }
.btn-purple:hover { background: #6d28d9; border-color: #6d28d9; }
.btn-batch {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.1rem;
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
  color: #fff;
  border: none;
  border-radius: 20px;
  font-size: 14px !important;
  line-height: 1.4;
  font-weight: 700 !important;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(124,58,237,0.4);
  transition: all 0.2s;
}
.btn-batch:hover {
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  transform: translateY(-2px);
  box-shadow: 0 5px 16px rgba(124,58,237,0.5);
}
.btn-batch.active {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
}
.btn-batch.active:hover {
  background: linear-gradient(135deg, #dc2626, #991b1b);
  box-shadow: 0 5px 16px rgba(220,38,38,0.5);
}
.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.9rem; }
.btn-full { width: 100%; }

/* ===== 顶部导航 ===== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: white;
  border-bottom: 2px solid var(--border);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.app-logo { font-size: 1.8rem; }
.app-title { font-size: 1.2rem; font-weight: 700; color: var(--primary); }

.header-center { display: flex; align-items: center; gap: 0.75rem; }

.class-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.class-selector select {
  padding: 0.4rem 0.8rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  background: white;
  cursor: pointer;
  outline: none;
  min-width: 150px;
}

.class-selector select:focus { border-color: var(--primary); }

.header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.current-user-badge {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  background: var(--bg);
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  white-space: nowrap;
}

/* ===== 导航标签 ===== */
.app-nav {
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem 1.5rem;
  background: white;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}

.app-nav::-webkit-scrollbar { display: none; }

.nav-tab {
  padding: 0.5rem 1rem;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  transition: all 0.2s;
}

.nav-tab:hover { background: var(--primary-light); color: var(--primary); }
.nav-tab.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }

/* ===== 主内容区 ===== */
.app-main { padding: 1.5rem; max-width: 1400px; margin: 0 auto; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== 空状态 ===== */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}
.empty-icon { font-size: 4rem; margin-bottom: 1rem; }
.empty-state h3 { font-size: 1.3rem; margin-bottom: 0.5rem; color: var(--text); }
.empty-state p { margin-bottom: 1.5rem; }

/* ===== 统计卡片 ===== */
.overview-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  border-radius: 16px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 4px 14px rgba(0,0,0,0.1);
  border: none;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-card:nth-child(1) { background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%); }
.stat-card:nth-child(2) { background: linear-gradient(135deg, #d4fc79 0%, #96e6a1 100%); }
.stat-card:nth-child(3) { background: linear-gradient(135deg, #a1c4fd 0%, #c2e9fb 100%); }
.stat-card:nth-child(4) { background: linear-gradient(135deg, #ffeaa7 0%, #dda0dd 100%); }
.stat-card::after {
  content: '';
  position: absolute;
  right: -15px; bottom: -15px;
  width: 70px; height: 70px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
}

.stat-icon { font-size: 2.5rem; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1)); }
.stat-num { font-size: 1.8rem; font-weight: 800; color: #2d3748; }
.stat-label { font-size: 0.8rem; color: rgba(0,0,0,0.5); margin-top: 0.1rem; font-weight: 500; }





/* ===== 宠物网格 ===== */
.section-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 1rem;
  padding: 0.4rem 0.8rem 0.4rem 1rem;
  border-left: 4px solid var(--primary);
  background: linear-gradient(90deg, rgba(249,115,22,0.08) 0%, transparent 100%);
  border-radius: 0 8px 8px 0;
}

/* 随机抽查按钮 */
.random-icon { font-size: 1.1rem; }
.random-icon.spinning {
  display: inline-block;
  animation: spinDice 0.3s linear infinite;
}
@keyframes spinDice {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 宠物卡片高亮态 */
.pet-card.random-highlight {
  outline: 4px solid #f97316;
  outline-offset: 3px;
  transform: translateY(-8px) scale(1.06) !important;
  box-shadow: 0 12px 32px rgba(249,115,22,0.5), 0 0 0 8px rgba(249,115,22,0.15) !important;
  z-index: 10;
  position: relative;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.pet-card.random-flash {
  animation: randomFlash 0.4s ease-in-out 3;
}
@keyframes randomFlash {
  0%,100% { outline-color: #f97316; box-shadow: 0 12px 32px rgba(249,115,22,0.5), 0 0 0 8px rgba(249,115,22,0.15); }
  50% { outline-color: #facc15; box-shadow: 0 12px 40px rgba(250,204,21,0.7), 0 0 0 12px rgba(250,204,21,0.2); }
}

/* 随机结果弹窗 */
.random-result-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  animation: fadeIn 0.25s ease;
}
.random-result-box {
  background: #fff;
  border-radius: 24px;
  padding: 2.5rem 2.8rem 2rem;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  animation: popIn 0.35s cubic-bezier(0.34,1.56,0.64,1);
  min-width: 260px;
}
@keyframes popIn {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.random-result-emoji {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  animation: bounce 0.6s ease infinite alternate;
}
@keyframes bounce {
  from { transform: translateY(0); }
  to { transform: translateY(-8px); }
}
.random-result-name {
  font-size: 2rem;
  font-weight: 900;
  color: #f97316;
  margin-bottom: 0.6rem;
  letter-spacing: 0.05em;
}
.random-result-pet {
  margin: 0.6rem 0;
  color: #666;
}
.random-result-score {
  font-size: 1.2rem;
  font-weight: 700;
  color: #f59e0b;
  margin-top: 0.4rem;
}

/* ===== 幸运抽奖按钮 ===== */
.btn-random {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.1rem;
  background: linear-gradient(135deg, #f87171, #dc2626);
  color: #fff;
  border: none;
  border-radius: 20px;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(220,38,38,0.4);
  transition: all 0.2s;
}
.btn-random:hover {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  transform: translateY(-2px);
  box-shadow: 0 5px 16px rgba(220,38,38,0.5);
}

.btn-lucky {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.1rem;
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
  color: #fff;
  border: none;
  border-radius: 20px;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(124,58,237,0.4);
  transition: all 0.2s;
}
.btn-lucky:hover {
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  transform: translateY(-2px);
  box-shadow: 0 5px 16px rgba(124,58,237,0.5);
}

/* ===== 幸运抽奖弹窗 ===== */
.lucky-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2500;
  animation: fadeIn 0.25s ease;
}
.lucky-modal {
  background: #fff;
  border-radius: 24px;
  width: min(90vw, 820px);
  max-height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(0,0,0,0.25);
  animation: popIn 0.35s cubic-bezier(0.34,1.56,0.64,1);
}
.lucky-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1.6rem;
  border-bottom: 1px solid #f0f0f0;
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
  border-radius: 24px 24px 0 0;
}
.lucky-title {
  font-size: 1.3rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: 0.04em;
}
.lucky-close-btn {
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.lucky-close-btn:hover { background: rgba(255,255,255,0.35); }

.lucky-body {
  display: flex;
  gap: 0;
  flex: 1;
  overflow: hidden;
}

/* 左侧转盘区 */
.lucky-wheel-panel {
  flex: 1 1 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.8rem 1.6rem 1.4rem;
  background: linear-gradient(160deg, #f5f3ff 0%, #ede9fe 100%);
  border-right: 1px solid #e9e1ff;
}
.lucky-wheel-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 380px;
  height: 380px;
}
#lucky-wheel-canvas {
  border-radius: 50%;
  display: block;
  box-shadow: 0 8px 30px rgba(124,58,237,0.25);
}
/* 顶部指针 */
.lucky-pointer {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2.4rem;
  color: #7c3aed;
  filter: drop-shadow(0 3px 6px rgba(124,58,237,0.5));
  z-index: 10;
  animation: pointerBob 1.5s ease-in-out infinite;
  line-height: 1;
}
@keyframes pointerBob {
  0%,100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(4px); }
}
/* 中心按钮（覆盖canvas中心） */
.lucky-spin-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
  border: 4px solid #fff;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(124,58,237,0.5);
  transition: all 0.2s;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lucky-spin-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #6d28d9, #7c3aed);
  transform: translate(-50%, -50%) scale(1.08);
  box-shadow: 0 6px 24px rgba(124,58,237,0.7);
}
.lucky-spin-btn.spinning {
  animation: spinPulse 0.6s ease-in-out infinite alternate;
  cursor: not-allowed;
}
@keyframes spinPulse {
  from { box-shadow: 0 4px 18px rgba(124,58,237,0.5); }
  to   { box-shadow: 0 8px 32px rgba(124,58,237,0.9), 0 0 0 8px rgba(124,58,237,0.2); }
}
.lucky-spin-hint {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: #7c3aed;
  font-weight: 600;
  opacity: 0.8;
}

/* 右侧奖品管理 */
.lucky-prizes-panel {
  flex: 0 0 260px;
  display: flex;
  flex-direction: column;
  padding: 1.6rem 1.4rem;
  overflow: hidden;
}
.lucky-prizes-title {
  font-size: 1rem;
  font-weight: 800;
  color: #4c1d95;
  margin-bottom: 0.8rem;
  padding-bottom: 0.6rem;
  border-bottom: 2px solid #ede9fe;
}
.lucky-prizes-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
  padding-right: 2px;
}
.lucky-prizes-list::-webkit-scrollbar { width: 4px; }
.lucky-prizes-list::-webkit-scrollbar-thumb { background: #c4b5fd; border-radius: 4px; }

.lucky-prize-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.6rem;
  background: #f5f3ff;
  border-radius: 10px;
  border: 1px solid #ede9fe;
  transition: background 0.15s, opacity 0.3s;
}
.lucky-prize-item:hover { background: #ede9fe; }
.lucky-prize-item.prize-depleted { opacity: 0.45; }
.prize-color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.prize-name {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 600;
  color: #4c1d95;
  outline: none;
  cursor: text;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 4px;
  padding: 0 2px;
}
.prize-name:focus {
  background: #fff;
  outline: 2px solid #a78bfa;
  white-space: normal;
  overflow: visible;
}
.prize-count-badge {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
  min-width: 22px;
  text-align: center;
  flex-shrink: 0;
  line-height: 1.5;
}
.prize-depleted .prize-count-badge {
  background: #d1d5db;
  color: #6b7280;
}
.prize-count-btn {
  width: 22px;
  height: 22px;
  border: 1.5px solid #c4b5fd;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  color: #7c3aed;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
  transition: all 0.15s;
  padding: 0;
}
.prize-count-btn:hover { background: #ede9fe; border-color: #7c3aed; }
.prize-count-minus:hover { background: #fee2e2; border-color: #ef4444; color: #ef4444; }
.prize-del-btn {
  background: none;
  border: none;
  color: #c4b5fd;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px 4px;
  border-radius: 4px;
  flex-shrink: 0;
  line-height: 1;
  transition: color 0.2s, background 0.2s;
}
.prize-del-btn:hover { color: #ef4444; background: #fee2e2; }

.lucky-add-prize {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.4rem;
}
.lucky-input {
  flex: 1;
  border: 1.5px solid #c4b5fd;
  border-radius: 10px;
  padding: 0.4rem 0.7rem;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s;
  min-width: 0;
}
.lucky-input:focus { border-color: #7c3aed; }
.lucky-count-input {
  width: 56px;
  border: 1.5px solid #c4b5fd;
  border-radius: 10px;
  padding: 0.4rem 0.3rem;
  font-size: 0.88rem;
  outline: none;
  text-align: center;
  transition: border-color 0.2s;
  flex-shrink: 0;
  -moz-appearance: textfield;
}
.lucky-count-input::-webkit-outer-spin-button,
.lucky-count-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.lucky-count-input:focus { border-color: #7c3aed; }
.lucky-prize-tip {
  font-size: 0.78rem;
  color: #a78bfa;
  text-align: center;
}

/* ===== 幸运结果弹窗 ===== */
.lucky-result-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4000;
  animation: fadeIn 0.2s ease;
}
.lucky-result-box {
  background: #fff;
  border-radius: 28px;
  padding: 3rem 3.5rem 2.5rem;
  text-align: center;
  box-shadow: 0 24px 70px rgba(124,58,237,0.3);
  animation: popIn 0.4s cubic-bezier(0.34,1.56,0.64,1);
  min-width: 280px;
}
.lucky-result-firework {
  font-size: 3rem;
  margin-bottom: 0.5rem;
  animation: bounce 0.7s ease infinite alternate;
}
.lucky-result-label {
  font-size: 1rem;
  color: #888;
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.lucky-result-prize {
  font-size: 2.2rem;
  font-weight: 900;
  color: #7c3aed;
  letter-spacing: 0.05em;
  text-shadow: 0 2px 10px rgba(124,58,237,0.25);
  padding: 0.4rem 1rem;
  background: linear-gradient(135deg, #f5f3ff, #ede9fe);
  border-radius: 16px;
  border: 2px solid #c4b5fd;
  display: inline-block;
  min-width: 180px;
}


/* 卡片网格 */
/* ===== 总览多选批量操作 ===== */
.overview-toolbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.overview-multi-toggle {
  font-size: 0.88rem;
}
/* 卡片选中态 */
.pet-card.overview-selected {
  outline: 3px solid #7c3aed;
  box-shadow: 0 0 0 6px rgba(124,58,237,0.18), 0 4px 16px rgba(124,58,237,0.25) !important;
  transform: translateY(-3px) scale(1.02);
  position: relative;
}
.pet-card.overview-selected::after {
  content: '✓';
  position: absolute;
  top: 8px;
  right: 10px;
  width: 22px;
  height: 22px;
  background: #7c3aed;
  color: #fff;
  border-radius: 50%;
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  line-height: 22px;
  text-align: center;
}
/* 底部批量操作栏 */
.overview-batch-bar {
  position: sticky;
  bottom: 1rem;
  margin-top: 1.5rem;
  background: linear-gradient(135deg, #4c1d95, #7c3aed);
  border-radius: 16px;
  padding: 0.9rem 1.2rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  box-shadow: 0 8px 30px rgba(124,58,237,0.45);
  flex-wrap: wrap;
  z-index: 100;
}
.overview-batch-count {
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  white-space: nowrap;
  align-self: center;
  min-width: 80px;
}
.overview-batch-rules {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex: 1;
}
.overview-rule-btn {
  font-size: 0.82rem !important;
  padding: 0.3rem 0.75rem !important;
}
.overview-custom-btn {
  background: rgba(255,255,255,0.18) !important;
  color: #fff !important;
  border-color: rgba(255,255,255,0.3) !important;
}
.overview-custom-btn:hover {
  background: rgba(255,255,255,0.28) !important;
}

#pets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.25rem;
}

/* 宠物卡片 - 简洁风格 + 彩色渐变 */
.pet-card {
  border-radius: 18px;
  padding: 1.4rem 1rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: visible;
  border: 3px solid rgba(255,255,255,0.6);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

/* 卡片颜色变体 */
.pet-card.color-0 { background: linear-gradient(145deg, #fff0f9 0%, #ffe0f5 50%, #ffd6ef 100%); }
.pet-card.color-1 { background: linear-gradient(145deg, #fff8e1 0%, #fff0b0 50%, #ffe57a 100%); }
.pet-card.color-2 { background: linear-gradient(145deg, #e8f5e9 0%, #c8e6c9 50%, #a5d6a7 100%); }
.pet-card.color-3 { background: linear-gradient(145deg, #e3f2fd 0%, #bbdefb 50%, #90caf9 100%); }
.pet-card.color-4 { background: linear-gradient(145deg, #f3e5f5 0%, #e1bee7 50%, #ce93d8 100%); }
.pet-card.color-5 { background: linear-gradient(145deg, #fce4ec 0%, #f8bbd9 50%, #f48fb1 100%); }
.pet-card.color-6 { background: linear-gradient(145deg, #e0f7fa 0%, #b2ebf2 50%, #80deea 100%); }
.pet-card.color-7 { background: linear-gradient(145deg, #fff3e0 0%, #ffe0b2 50%, #ffcc80 100%); }

/* 气泡装饰 */
.pet-card::before,
.pet-card::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  opacity: 0.35;
  pointer-events: none;
}
.pet-card::before {
  width: 60px; height: 60px;
  top: -16px; right: -16px;
  background: rgba(255,255,255,0.9);
  z-index: -1;
}
.pet-card::after {
  width: 36px; height: 36px;
  bottom: 10px; left: -10px;
  background: rgba(255,255,255,0.7);
  z-index: -1;
}

/* 小星星装饰 */
.pet-card .card-sparkle {
  position: absolute;
  top: 8px;
  left: 10px;
  font-size: 0.75rem;
  opacity: 0.55;
  animation: twinkle 2.5s ease-in-out infinite;
  pointer-events: none;
}
.pet-card .card-sparkle2 {
  position: absolute;
  bottom: 12px;
  right: 10px;
  font-size: 0.6rem;
  opacity: 0.45;
  animation: twinkle 2s ease-in-out infinite 0.8s;
  pointer-events: none;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.45; transform: scale(1) rotate(0deg); }
  50% { opacity: 0.9; transform: scale(1.3) rotate(20deg); }
}

.pet-card:hover {
  transform: translateY(-6px) scale(1.03);
  box-shadow: 0 12px 32px rgba(0,0,0,0.18);
  border-color: rgba(255,255,255,0.9);
}

.pet-card:active {
  transform: translateY(-2px) scale(0.99);
}

/* 宠物Emoji */
.pet-emoji {
  font-size: 3.2rem;
  display: block;
  margin-bottom: 0.5rem;
  animation: petIdle 3s ease-in-out infinite;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.15));
  transition: all 0.3s ease;
}

/* 动态宠物大小 */
.pet-emoji.scale-1 { font-size: 2.2rem; }
.pet-emoji.scale-2 { font-size: 2.5rem; }
.pet-emoji.scale-3 { font-size: 2.9rem; }
.pet-emoji.scale-4 { font-size: 3.2rem; }
.pet-emoji.scale-5 { font-size: 3.5rem; }
.pet-emoji.scale-6 { font-size: 3.9rem; }
.pet-emoji.scale-7 { font-size: 4.3rem; }
.pet-emoji.scale-8 { font-size: 4.5rem; }

/* 宠物卡片容器 */
.pet-emoji-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 0.5rem;
}

/* 未知宠物容器 */
.pet-emoji-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 0.5rem;
}

/* 宠物饥饿提示 - 闪烁动画 */
.pet-hungry-tip {
  font-size: 0.88rem;
  font-weight: 700;
  color: #e74c3c;
  margin: 0.2rem 0 0.15rem;
  animation: hungry-blink 0.8s ease-in-out infinite alternate;
}

@keyframes hungry-blink {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.95); }
  100% { opacity: 1; transform: scale(1.05); }
}

/* 宠物卡片勋章 - 左侧竖排 */
.pet-card-medals {
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 5;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.25));
}

.pet-card-medals .medal {
  font-size: 0.7rem;
  width: 1.2rem;
  height: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 未知宠物的问号 */
.unknown-question {
  position: absolute;
  top: -6px;
  right: -6px;
  font-size: 1.1rem;
  background: var(--warning);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  animation: bounce 1s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* 未知宠物卡片点击效果 */
.pet-card.unknown-pet:hover {
  cursor: pointer;
  transform: translateY(-5px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  border-color: var(--primary);
}

@keyframes petIdle {
  0%, 100% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.08) rotate(4deg); }
  75% { transform: scale(0.96) rotate(-3deg); }
}

/* 高等级宠物闪光 */
.pet-card.vip-card .pet-emoji {
  animation: petDance 2s ease-in-out infinite;
  filter: drop-shadow(0 0 8px rgba(255,200,50,0.7));
}

@keyframes petDance {
  0%, 100% { transform: scale(1) rotate(0deg) translateY(0); }
  30% { transform: scale(1.12) rotate(6deg) translateY(-4px); }
  60% { transform: scale(1.06) rotate(-4deg) translateY(-2px); }
}

.pet-name {
  font-weight: 400;
  font-size: 1rem;
  margin-bottom: 0.25rem;
  color: var(--text);
  letter-spacing: -0.01em;
}
.pet-owner {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.25rem;
  color: var(--text);
  letter-spacing: -0.01em;
}

.pet-level-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  color: white;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  border: 2px solid var(--bg-card);
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.pet-score {
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: 0.5rem;
  color: #f59e0b;
}

/* 进度条 */
.progress-bar {
  height: 6px;
  background: rgba(0,0,0,0.08);
  border-radius: 3px;
  margin-top: 0.5rem;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #f9c74f, #f3722c, #f94144, #90be6d, #43aa8b, #577590, #277da1);
  background-size: 200% 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
  animation: rainbowSlide 3s linear infinite;
}

@keyframes rainbowSlide {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* ===== 卡片积分快捷按钮 ===== */
.card-score-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #f97316, #f59e0b);
  color: white;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(249,115,22,0.45);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 2;
  line-height: 1;
  padding: 0;
}
.card-score-btn:hover {
  transform: scale(1.2) rotate(15deg);
  box-shadow: 0 4px 14px rgba(249,115,22,0.6);
}

/* ===== 积分弹窗头部（单卡片积分） ===== */
.mcs-student-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
}

/* ===== 积分操作 ===== */
.score-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .score-layout { grid-template-columns: 1fr; }
}

/* 快速积分面板 - 左右横排 */
.score-quick-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 640px) {
  .score-quick-panel { grid-template-columns: 1fr; }
}

.score-quick-column {
  background: white;
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  border: 2px solid var(--border);
}

.quick-column-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 2px solid var(--border);
}

.score-rules-panel {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.rule-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: white;
  transition: all 0.2s;
  font-size: 0.9rem;
  font-weight: 500;
}

.rule-btn:hover { transform: translateX(4px); }
.rule-btn.add-rule { border-color: #86efac; }
.rule-btn.add-rule:hover { background: #f0fdf4; border-color: var(--success); }
.rule-btn.minus-rule { border-color: #fca5a5; }
.rule-btn.minus-rule:hover { background: #fef2f2; border-color: var(--danger); }

.rule-score-badge {
  font-weight: 700;
  font-size: 1rem;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
}

.add-score { color: var(--success); background: #f0fdf4; }
.minus-score { color: var(--danger); background: #fef2f2; }

.student-select-mode {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

/* 选择学生区域（顶部横排） */
.score-student-section {
  background: white;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow);
  border: 2px solid var(--border);
  margin-bottom: 1.25rem;
}

.score-student-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.score-student-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 0.4rem;
  max-height: 180px;
  overflow-y: auto;
  padding: 0.25rem;
  background: #f9fafb;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.student-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 0.4rem 0.4rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: white;
  transition: all 0.15s;
  text-align: center;
  position: relative;
  contain: paint;
}

.student-chip:hover { border-color: var(--primary); background: var(--primary-light); }
.student-chip.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.15);
}

/* 勾选标记 */
.chip-check {
  position: absolute;
  top: 3px;
  right: 5px;
  font-size: 0.7rem;
  font-weight: 900;
  color: white;
  background: var(--primary);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  z-index: 1;
}

/* 积分徽章 */
.chip-score {
  font-size: 0.72rem;
  font-weight: 700;
  margin-top: 0.1rem;
  line-height: 1;
}

/* 已选提示条 */
.score-select-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #ede9fe, #f5f3ff);
  border: 1.5px solid #c4b5fd;
  border-radius: 10px;
  padding: 0.5rem 0.9rem;
  margin-bottom: 0.6rem;
  font-size: 0.88rem;
  color: #4c1d95;
  gap: 0.8rem;
}
.score-select-bar b { color: var(--primary); font-size: 1.05em; }

.chip-emoji-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 52px;
  overflow: hidden;
  margin-bottom: 0.1rem;
}

.student-chip .chip-emoji {
  font-size: 1.6rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.student-chip .chip-emoji svg {
  width: 42px;
  height: 42px;
  display: block;
}
/* 学生卡片中的 .kfp-wrap 需要缩小，防止溢出 */
.student-chip .kfp-wrap {
  width: 42px !important;
  height: 46px !important;
  overflow: hidden;
}
.student-chip .kfp-wrap svg {
  width: 100% !important;
  height: 100% !important;
}

.chip-medals {
  display: flex;
  gap: 0.1rem;
  margin-bottom: 0.2rem;
}

.medal {
  font-size: 0.7rem;
  width: 1.2rem;
  height: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.medal.earned {
  background: linear-gradient(135deg, #ffd700, #ffb300);
  color: #8b6b00;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.medal.empty {
  background: #f0f0f0;
  color: #ccc;
  border: 1px solid #e0e0e0;
}

.student-chip .chip-name { font-size: 1.05rem; margin-top: 0.1rem; font-weight: 700; }

.custom-score-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.input-sm {
  flex: 1;
  padding: 0.4rem 0.7rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  outline: none;
}
.input-sm:focus { border-color: var(--primary); }

.history-list {
  max-height: 300px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.7rem 0.8rem;
  border-left: 3px solid var(--border);
  background: white;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.85rem;
  margin-bottom: 0.6rem;
  transition: all 0.2s;
}

.history-item:hover {
  border-left-color: var(--primary);
  background: #fef9f3;
}

.history-item .hi-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.history-item .hi-name { font-weight: 600; flex: 1; }
.history-item .hi-score { font-weight: 700; font-size: 0.95rem; }
.history-item .hi-reason { color: var(--text-muted); font-size: 0.8rem; }
.history-item .hi-time { color: var(--text-muted); font-size: 0.72rem; }
.history-item.hi-add { border-left-color: var(--success); }
.history-item.hi-minus { border-left-color: var(--danger); }

/* ===== 宠物详情 ===== */
.pet-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.75rem;
}

.pet-detail-card {
  position: relative;
  background: white;
  border-radius: var(--radius);
  padding: 0.85rem;
  box-shadow: var(--shadow);
  border: 2px solid var(--border);
}

.pet-detail-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.pet-detail-emoji-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  overflow: hidden;
  flex-shrink: 0;
}

.pet-detail-emoji { font-size: 2.2rem; line-height: 1; }

/* 宠物详情卡片中的 .kfp-wrap 与积分操作一致：限死尺寸 + overflow:hidden */
.pet-detail-card .kfp-wrap {
  width: 42px !important;
  height: 46px !important;
  overflow: hidden;
}
.pet-detail-card .kfp-wrap svg {
  width: 100% !important;
  height: 100% !important;
}

.pet-medals {
  display: flex;
  gap: 0.15rem;
}

.pet-medals .medal {
  font-size: 0.7rem;
  width: 1.2rem;
  height: 1.2rem;
}
.pet-detail-info h4 { font-size: 0.9rem; font-weight: 700; }
.pet-detail-info .owner-name { font-size: 0.75rem; color: var(--text-muted); }
.pet-level-text { font-size: 0.75rem; color: var(--primary); font-weight: 600; }

.pet-stats-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.pet-stat {
  flex: 1;
  text-align: center;
  background: #f9fafb;
  border-radius: 8px;
  padding: 0.35rem;
}
.pet-stat .ps-val { font-size: 1rem; font-weight: 700; color: var(--primary); }
.pet-stat .ps-label { font-size: 0.68rem; color: var(--text-muted); }

/* ===== 排行榜 ===== */
.ranking-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.ranking-column {
  min-width: 0;
}

.ranking-column-right {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1rem;
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
}

.ranking-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.ranking-month-info {
  font-size: 0.82rem;
  color: var(--text-muted);
  background: #f3f4f6;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-weight: 600;
}

.ranking-filters { display: flex; gap: 0.4rem; }

.ranking-list { display: flex; flex-direction: column; gap: 0.5rem; }

.ranking-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.2rem;
  background: white;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  border: 2px solid var(--border);
  transition: all 0.2s;
}

.ranking-item:hover { transform: translateX(4px); border-color: var(--primary); }
.ranking-item.rank-1 { border-color: #f59e0b; background: linear-gradient(135deg, #fffbeb, white); }
.ranking-item.rank-2 { border-color: #9ca3af; background: linear-gradient(135deg, #f9fafb, white); }
.ranking-item.rank-3 { border-color: #d97706; background: linear-gradient(135deg, #fef3c7, white); }

.rank-num {
  font-size: 1.4rem;
  font-weight: 700;
  width: 36px;
  text-align: center;
}

.rank-pet { font-size: 2rem; }
.rank-name { flex: 1; font-weight: 600; font-size: 0.95rem; }
.rank-score { font-size: 1.1rem; font-weight: 700; color: var(--primary); }
.rank-level { font-size: 0.8rem; background: var(--primary-light); color: var(--primary); padding: 0.2rem 0.6rem; border-radius: 20px; }

/* ===== 规则管理 ===== */
.rules-actions { display: flex; gap: 0.75rem; margin-bottom: 1.5rem; }
.rules-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 2rem; }

@media (max-width: 640px) {
  .rules-grid { grid-template-columns: 1fr; }
}

.rules-col-title { font-size: 1rem; font-weight: 700; margin-bottom: 0.75rem; }
.add-color { color: var(--success); }
.minus-color { color: var(--danger); }

.rules-list { display: flex; flex-direction: column; gap: 0.4rem; }

.rule-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  background: white;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.rule-item-icon { font-size: 1.3rem; }
.rule-item-name { flex: 1; font-weight: 500; }
.rule-item-score { font-weight: 700; font-size: 1rem; }
.rule-item .btn { padding: 0.2rem 0.5rem; font-size: 0.75rem; }

.level-settings { background: white; border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.level-desc { color: var(--text-muted); margin-bottom: 1rem; font-size: 0.88rem; }
.level-settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.75rem; margin-bottom: 1.25rem; }

.level-input-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem;
  background: #f9fafb;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.level-input-readonly {
  background: #f3f4f6;
  opacity: 0.85;
}
.level-label { font-size: 0.82rem; font-weight: 600; white-space: nowrap; color: var(--primary); }
.level-label-0 { color: #9ca3af; }
.level-readonly-val {
  flex: 1;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
}
.level-stage-tag {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  border: 1px solid;
  white-space: nowrap;
  flex-shrink: 0;
}
.level-input {
  flex: 1;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  width: 80px;
  outline: none;
}

/* ===== 学生管理 ===== */
.students-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.toolbar-actions { display: flex; gap: 0.5rem; }

.students-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.students-table thead tr {
  background: var(--primary-light);
}

.students-table th {
  padding: 0.9rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text);
}

.students-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

/* 学生管理表格中的宠物SVG头像 */
.students-table td .kfp-wrap {
  width: 48px !important;
  height: 54px !important;
  overflow: hidden;
  display: inline-block;
}

.students-table td .kfp-wrap svg {
  width: 100% !important;
  height: 100% !important;
}

.students-table tbody tr:last-child td { border-bottom: none; }
.students-table tbody tr:hover { background: #f9fafb; }

.pet-selector-mini {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  cursor: pointer;
}

/* ===== 数据管理 ===== */
.data-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.data-card {
  background: white;
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow);
  border: 2px solid var(--border);
  transition: all 0.2s;
}

.data-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.data-card-icon { font-size: 3rem; margin-bottom: 0.75rem; }
.data-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 0.5rem; }
.data-card p { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 1rem; }
.danger-card { border-color: #fca5a5; }

.operation-log {
  background: #1f2937;
  border-radius: var(--radius-sm);
  padding: 1rem;
  max-height: 300px;
  overflow-y: auto;
}

/* 用户管理样式 */
.user-list {
  max-height: 400px;
  overflow-y: auto;
}

.user-item {
  display: flex;
  align-items: center;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  background: white;
}

.user-item:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.user-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 700;
  color: white;
  margin-right: 0.75rem;
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.user-email {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.user-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.user-actions .btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
}

.user-empty {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

.user-empty .empty-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

/* 用户等级标签 */
.role-badge {
  display: inline-block;
  font-size: 0.68rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  margin-left: 0.5rem;
  vertical-align: middle;
  font-weight: 600;
  white-space: nowrap;
}

.role-badge.role-admin {
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: white;
  box-shadow: 0 1px 3px rgba(249, 115, 22, 0.3);
}

.role-badge.role-user {
  background: #e5e7eb;
  color: #6b7280;
}

/* 用户详情按钮 */
.btn-info {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  border: none;
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
}
.btn-info:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 3px 8px rgba(59, 130, 246, 0.4);
}

/* 用户详情弹窗 */
.user-detail-section {
  margin-bottom: 1.25rem;
}
.user-detail-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--primary);
}
.user-detail-row {
  display: flex;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border, #e5e7eb);
}
.user-detail-row:last-child {
  border-bottom: none;
}
.user-detail-label {
  width: 80px;
  flex-shrink: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}
.user-detail-value {
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 500;
}
.user-detail-empty {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  background: var(--light, #f9fafb);
  border-radius: 8px;
}
.user-detail-class-card {
  background: var(--light, #f9fafb);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.75rem;
  border: 1px solid var(--border, #e5e7eb);
  transition: box-shadow 0.2s;
}
.user-detail-class-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.user-detail-class-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.user-detail-class-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
}
.user-detail-class-teacher {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: #e5e7eb;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}
.user-detail-class-meta {
  display: flex;
  gap: 1.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.user-detail-class-meta strong {
  color: var(--text);
  font-size: 0.95rem;
}
.user-detail-toggle-icon {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: 0.5rem;
  transition: transform 0.2s;
}
.user-detail-students {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border, #e5e7eb);
}
.user-detail-students-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.user-detail-students-table th {
  text-align: left;
  padding: 0.4rem 0.6rem;
  background: var(--light, #f3f4f6);
  font-weight: 600;
  color: var(--text-secondary, #6b7280);
  font-size: 0.8rem;
}
.user-detail-students-table td {
  padding: 0.35rem 0.6rem;
  border-bottom: 1px solid var(--border, #f3f4f6);
}
.user-detail-updated {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: right;
  margin-top: 0.5rem;
}

  font-family: monospace;
  font-size: 0.82rem;
}

.log-item {
  padding: 0.2rem 0;
  color: #9ca3af;
  border-bottom: 1px solid #374151;
}
.log-item .log-time { color: #6b7280; margin-right: 0.5rem; }
.log-item .log-action { color: #34d399; }
.log-item .log-detail { color: #d1d5db; }

/* ===== 弹窗 ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.active { display: flex; }

.modal {
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  width: 460px;
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.9) translateY(-20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-lg { width: 600px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 1.1rem; font-weight: 700; }

.modal-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.2rem;
  line-height: 1;
  transition: color 0.2s;
}
.modal-close:hover { color: var(--danger); }

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}

/* ===== 宠物选择器 ===== */
.pet-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pet-pick-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  width: 68px;
}

.pet-pick-item:hover { border-color: var(--primary); background: var(--primary-light); }
.pet-pick-item.selected { border-color: var(--primary); background: var(--primary-light); }
.pet-pick-item .pp-emoji { font-size: 1.8rem; display: flex; align-items: center; justify-content: center; }

/* 宠物选择器中的SVG头像尺寸限制 */
.pet-pick-item .pp-emoji .kfp-wrap {
  width: 52px;
  height: 58px;
}

.pet-pick-item .pp-emoji .kfp-wrap svg {
  width: 100%;
  height: 100%;
}

.pet-pick-item .pp-name { font-size: 0.7rem; margin-top: 0.2rem; text-align: center; }

/* ===== 图标选择器 ===== */
.icon-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.icon-pick-item {
  font-size: 1.5rem;
  padding: 0.4rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.icon-pick-item:hover { border-color: var(--primary); transform: scale(1.1); }
.icon-pick-item.selected { border-color: var(--primary); background: var(--primary-light); }

/* ===== 宠物选择弹窗 ===== */
.pet-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 1rem;
  max-height: 50vh;
  overflow-y: auto;
  padding: 0.5rem;
}

.pet-select-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 0.5rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg-card);
}

.pet-select-item:hover {
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.pet-select-item.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.pet-select-item .pet-select-emoji {
  font-size: 2.5rem;
  margin-bottom: 0.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 80px;
}

/* 宠物选择器中的SVG头像尺寸限制 */
.pet-select-item .pet-select-emoji .kfp-wrap {
  width: 72px;
  height: 80px;
}

.pet-select-item .pet-select-emoji .kfp-wrap svg {
  width: 100%;
  height: 100%;
}

.pet-select-item .pet-select-name {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

.pet-select-item .pet-select-question {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ===== Toast 通知 ===== */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 0.75rem 1.2rem;
  border-radius: var(--radius-sm);
  background: #1f2937;
  color: white;
  font-size: 0.88rem;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 200px;
}

/* 重置确认对话框样式 */
.reset-warning {
  text-align: center;
  padding: 1rem;
}

.reset-warning-icon {
  font-size: 3rem;
  color: var(--danger);
  margin-bottom: 1rem;
}

.reset-warning h4 {
  color: var(--danger);
  margin-bottom: 1rem;
}

.reset-consequences {
  text-align: left;
  margin: 1.5rem 0;
  padding: 1rem;
  background: #fef9f9;
  border-radius: var(--radius);
  border-left: 3px solid var(--danger);
}

.reset-consequences li {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.reset-input-group {
  margin-top: 1.5rem;
  text-align: left;
}

.reset-input-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

#reset-confirm-input {
  width: 100%;
  font-size: 1rem;
  padding: 0.75rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
}

#reset-confirm-input:focus {
  border-color: var(--danger);
  outline: none;
}

#reset-confirm-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.toast.success { background: #065f46; border-left: 4px solid var(--success); }
.toast.error { background: #7f1d1d; border-left: 4px solid var(--danger); }
.toast.warning { background: #78350f; border-left: 4px solid var(--warning); }

/* ===== 大屏展示 ===== */
.display-page {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4c1d95 100%);
  min-height: 100vh;
  color: white;
}

.display-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 2rem;
}

.display-header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: #fbbf24;
  text-shadow: 0 0 20px rgba(251, 191, 36, 0.5);
}

.display-content {
  padding: 0 2rem 2rem;
}

.display-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.25rem;
}

.display-card {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius);
  padding: 1.2rem 1rem 1.5rem;
  text-align: center;
  backdrop-filter: blur(10px);
  transition: all 0.3s;
  overflow: hidden;
}

.display-card:hover {
  transform: translateY(-5px);
  background: rgba(255,255,255,0.15);
}

.display-pet-emoji { font-size: 3.5rem; display: block; margin-bottom: 0.5rem; }

/* 大屏展示 - SVG宠物头像容器 */
.display-pet-svg {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 0.75rem;
  height: 112px; /* 对齐 projection-mode 尺寸 100×112px */
}
/* 让大屏展示的宠物头像使用 projection-mode 尺寸 */
.display-pet-svg .kfp-wrap {
  width: 100px !important;
  height: 112px !important;
}

/* 禁用动画模式：停止所有宠物SVG动画 */
.no-pet-animate .kfp-wrap,
.no-pet-animate .kfp-wrap.kfp-junior,
.no-pet-animate .kfp-wrap.kfp-middle,
.no-pet-animate .kfp-wrap.kfp-senior,
.no-pet-animate .kfp-wrap.kfp-unknown {
  animation: none !important;
  filter: none !important;
}
.display-name { font-size: 0.82rem; color: rgba(255,255,255,0.7); margin-bottom: 0.25rem; }
.display-owner { font-weight: 700; font-size: 1rem; color: #fff; }
.display-score { font-size: 1.1rem; font-weight: 700; color: #fbbf24; margin-top: 0.5rem; }
.display-level { font-size: 0.78rem; background: rgba(251,191,36,0.2); color: #fbbf24; padding: 0.2rem 0.6rem; border-radius: 20px; display: inline-block; margin-top: 0.25rem; }

/* ===== 其它 ===== */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.5rem 0;
}

.theme-picker { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.theme-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
}
.theme-btn.active { border-color: var(--text); transform: scale(1.15); }

.hint-text { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 0.75rem; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* 分割线 */
.score-left, .score-right {
  background: white;
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.custom-score-area { margin-top: 1rem; }
.score-history { margin-top: 1rem; }

/* 底部最近记录区域 */
.score-history-section {
  background: white;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow);
  border: 2px solid var(--border);
  margin-top: 1.25rem;
}

.history-list-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.6rem;
  max-height: 220px;
  overflow-y: auto;
}

.history-list-row .history-item {
  flex: 0 0 calc(50% - 0.3rem);
  margin-bottom: 0;
}

@media (max-width: 640px) {
  .history-list-row .history-item { flex: 0 0 100%; }
}

/* 报告弹窗 */
.report-section { margin-bottom: 1.5rem; }
.report-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.report-table th, .report-table td { border: 1px solid var(--border); padding: 0.5rem 0.7rem; }
.report-table th { background: var(--primary-light); }

/* ===== 卡通宠物系统 ===== */

/* 卡通宠物基础容器 */
.cartoon-pet {
  width: 80px;
  height: 80px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
  animation: petFloat 3s ease-in-out infinite;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
}

/* 宠物浮动动画 */
@keyframes petFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-8px) rotate(3deg); }
  75% { transform: translateY(4px) rotate(-2deg); }
}

/* 宠物脉动动画（心跳效果） */
@keyframes petPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* 宠物眨眼动画 */
@keyframes petBlink {
  0%, 90%, 100% { transform: scaleY(1); }
  95% { transform: scaleY(0.1); }
}

/* 宠物耳朵摆动动画 */
@keyframes earWiggle {
  0%, 100% { transform: rotate(0deg); }
  33% { transform: rotate(10deg); }
  66% { transform: rotate(-5deg); }
}

/* 宠物跳跃动画 */
@keyframes petJump {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-15px); }
}

/* 宠物旋转动画 */
@keyframes petSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 宠物发光动画 */
@keyframes petGlow {
  0%, 100% { box-shadow: 0 0 10px rgba(255, 215, 0, 0.3); }
  50% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.6); }
}

.pet-head {
  width: 60px;
  height: 60px;
  background: var(--pet-color, #f59e0b);
  border-radius: 50%;
  position: relative;
  animation: petPulse 2s ease-in-out infinite;
}

/* 宠物通用部件 */
.pet-ear {
  position: absolute;
  top: -8px;
  width: 20px;
  height: 25px;
  background: var(--pet-ear-color, var(--pet-color, #f59e0b));
  border-radius: 50% 50% 0 0;
  z-index: 1;
}

.pet-ear.left-ear { left: 8px; transform: rotate(-15deg); }
.pet-ear.right-ear { right: 8px; transform: rotate(15deg); }

.pet-face {
  position: absolute;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pet-eye {
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: 8px;
}

.pet-eye.left-eye { left: 8px; }
.pet-eye.right-eye { right: 8px; }

.pet-eye::after {
  content: '';
  position: absolute;
  width: 4px;
  height: 4px;
  background: #333;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.pet-nose {
  width: 12px;
  height: 8px;
  background: #333;
  border-radius: 50%;
  position: absolute;
  top: 22px;
}

/* 小狗特殊样式 */
.dog-pet .pet-ear { 
  background: #d97706;
  border-radius: 40% 40% 40% 40%;
}

/* 小猫特殊样式 */
.cat-pet .pet-ear { 
  background: #8b5cf6;
  border-radius: 50% 50% 0 0;
  height: 20px;
}

.cat-pet .pet-eye {
  width: 6px;
  height: 10px;
  background: white;
  border-radius: 50% 50% 0 0;
}

.cat-pet .pet-eye::after {
  width: 3px;
  height: 6px;
  background: #333;
  border-radius: 50% 50% 0 0;
}

.cat-whisker {
  position: absolute;
  width: 12px;
  height: 1px;
  background: #333;
  top: 18px;
}

.cat-whisker.left-whisker { 
  left: 2px; 
  transform: rotate(-15deg);
}
.cat-whisker.right-whisker { 
  right: 2px; 
  transform: rotate(15deg);
}

/* 小兔特殊样式 */
.rabbit-pet .pet-ear {
  background: #ec4899;
  width: 15px;
  height: 35px;
  border-radius: 50%;
  top: -15px;
}

.rabbit-pet .pet-eye {
  background: #ff6b9d;
}

.rabbit-pet .pet-nose {
  background: #ff6b9d;
  width: 8px;
  height: 8px;
  top: 20px;
}

/* 仓鼠特殊样式 */
.hamster-pet .pet-head {
  background: #f97316;
  border-radius: 60% 60% 50% 50%;
}

.hamster-pet .pet-eye {
  width: 6px;
  height: 6px;
  background: #333;
  top: 15px;
}

.hamster-pet .pet-nose {
  background: #8b4513;
  width: 6px;
  height: 4px;
  top: 25px;
}

.hamster-cheek {
  position: absolute;
  width: 12px;
  height: 8px;
  background: #ff8c69;
  border-radius: 50%;
  top: 20px;
}

.hamster-cheek.left-cheek { left: 2px; }
.hamster-cheek.right-cheek { right: 2px; }

/* 小狐特殊样式 */
.fox-pet .pet-ear {
  background: #ef4444;
  width: 20px;
  height: 25px;
  border-radius: 50% 50% 0 0;
}

.fox-pet .pet-eye {
  background: #ffcccb;
}

.fox-pet .pet-nose {
  background: #ff6b6b;
}

.fox-tail {
  position: absolute;
  width: 20px;
  height: 30px;
  background: #ef4444;
  border-radius: 50%;
  top: 40px;
  right: -15px;
  transform: rotate(30deg);
}

/* 小熊特殊样式 */
.bear-pet .pet-ear {
  background: #92400e;
  width: 18px;
  height: 18px;
  top: -6px;
}

.bear-pet .pet-eye {
  width: 10px;
  height: 10px;
  background: white;
  top: 12px;
}

.bear-pet .pet-nose {
  background: #5d4037;
  width: 10px;
  height: 8px;
  top: 24px;
}

/* 熊猫特殊样式 */
.panda-pet .pet-head {
  background: white;
}

.panda-pet .pet-ear {
  background: #374151;
  width: 16px;
  height: 16px;
  top: -6px;
}

.panda-eye-patch {
  position: absolute;
  width: 20px;
  height: 20px;
  background: #374151;
  border-radius: 50%;
  top: 10px;
}

.panda-eye-patch.left-patch { left: 5px; }
.panda-eye-patch.right-patch { right: 5px; }

.panda-pet .pet-eye {
  width: 6px;
  height: 6px;
  background: white;
  top: 5px;
}

.panda-pet .pet-nose {
  background: #374151;
  width: 10px;
  height: 8px;
  top: 22px;
}

/* 小虎特殊样式 */
.tiger-pet .pet-head {
  background: #d97706;
}

.tiger-pet .pet-ear {
  background: #b45309;
}

.tiger-stripe {
  position: absolute;
  width: 8px;
  height: 2px;
  background: #b45309;
  border-radius: 2px;
}

.tiger-stripe.stripe1 {
  top: 20px;
  left: 15px;
  transform: rotate(-30deg);
}

.tiger-stripe.stripe2 {
  top: 25px;
  right: 15px;
  transform: rotate(30deg);
}

/* 宠物等级相关样式 - 为Lv.2到Lv.8添加不同头像效果 */
.cartoon-pet.level-2 { transform: scale(0.8); opacity: 0.9; }
.cartoon-pet.level-3 { transform: scale(0.9); opacity: 0.95; }
.cartoon-pet.level-4 { transform: scale(1.0); opacity: 1; }
.cartoon-pet.level-5 { transform: scale(1.1); opacity: 1; }
.cartoon-pet.level-6 { transform: scale(1.2); opacity: 1; }
.cartoon-pet.level-7 { transform: scale(1.3); opacity: 1; }
.cartoon-pet.level-8 { transform: scale(1.4); opacity: 1; }

/* 高等级宠物特效 */
.cartoon-pet.level-2 .pet-head {
  animation: petPulse 2.5s ease-in-out infinite, petBlink 4s ease-in-out infinite;
}

.cartoon-pet.level-3 .pet-head {
  animation: petPulse 2.2s ease-in-out infinite, petBlink 3.5s ease-in-out infinite;
}

.cartoon-pet.level-4 .pet-head {
  animation: petPulse 2s ease-in-out infinite, petBlink 3s ease-in-out infinite;
  box-shadow: 0 0 5px rgba(255, 215, 0, 0.2);
}

.cartoon-pet.level-5 .pet-head {
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
  animation: petPulse 1.5s ease-in-out infinite, petBlink 2.5s ease-in-out infinite, petGlow 3s ease-in-out infinite;
}

.cartoon-pet.level-6 .pet-head {
  box-shadow: 0 0 15px rgba(255, 165, 0, 0.4);
  animation: petPulse 1.2s ease-in-out infinite, petBlink 2s ease-in-out infinite, petGlow 2.5s ease-in-out infinite;
}

.cartoon-pet.level-7 .pet-head {
  box-shadow: 0 0 20px rgba(255, 69, 0, 0.5);
  animation: petPulse 1s ease-in-out infinite, petBlink 1.5s ease-in-out infinite, petGlow 2s ease-in-out infinite;
}

.cartoon-pet.level-8 .pet-head {
  box-shadow: 0 0 25px rgba(255, 20, 147, 0.6);
  animation: petPulse 0.8s ease-in-out infinite, petBlink 1s ease-in-out infinite, petGlow 1.5s ease-in-out infinite, petJump 3s ease-in-out infinite;
}

/* 为耳朵添加动画 */
.cartoon-pet.level-4 .pet-ear {
  animation: earWiggle 4s ease-in-out infinite;
}

.cartoon-pet.level-5 .pet-ear {
  animation: earWiggle 3.5s ease-in-out infinite;
}

.cartoon-pet.level-6 .pet-ear {
  animation: earWiggle 3s ease-in-out infinite;
}

.cartoon-pet.level-7 .pet-ear {
  animation: earWiggle 2.5s ease-in-out infinite;
}

.cartoon-pet.level-8 .pet-ear {
  animation: earWiggle 2s ease-in-out infinite, earWiggle 1.5s ease-in-out infinite reverse;
}

/* 宠物边框和光环 */
.cartoon-pet::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 3px solid transparent;
  animation: borderGlow 3s linear infinite;
}

@keyframes borderGlow {
  0%, 100% { border-color: rgba(255, 255, 255, 0.3); }
  50% { border-color: rgba(255, 255, 255, 0.7); }
}

/* 宠物卡片中的卡通宠物 */
.pet-card .cartoon-pet {
  width: 70px;
  height: 70px;
  margin-bottom: 5px;
}

.pet-card:hover .cartoon-pet {
  animation: petFloat 2s ease-in-out infinite;
}

/* 未知宠物蛋 */
.egg-svg {
  width: 60px;
  height: 80px;
  position: relative;
  margin: 0 auto 10px;
  animation: eggFloat 3s ease-in-out infinite;
}

.egg-shell {
  width: 50px;
  height: 70px;
  background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.egg-crack {
  position: absolute;
  width: 2px;
  height: 15px;
  background: rgba(0,0,0,0.2);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(45deg);
}

.egg-sparkle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 0 6px white;
  top: 20px;
  right: 15px;
  animation: sparkleTwinkle 2s ease-in-out infinite;
}

@keyframes eggFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-5px) rotate(2deg); }
  75% { transform: translateY(3px) rotate(-1deg); }
}

@keyframes sparkleTwinkle {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* 宠物头像选择器 */
.pet-selector .cartoon-pet {
  width: 50px;
  height: 50px;
  margin: 0 auto;
  transform: scale(0.8);
}

.pet-select-item:hover .cartoon-pet {
  animation: petFloat 2s ease-in-out infinite;
  transform: scale(0.9);
}

/* 宠物动态效果增强 */
.cartoon-pet .pet-eye::after {
  animation: eyeSparkle 3s ease-in-out infinite;
}

@keyframes eyeSparkle {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* 排行榜卡通宠物 */
.rank-pet-svg {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rank-pet-svg .cartoon-pet {
  width: 40px;
  height: 40px;
  margin: 0;
  transform: scale(0.8);
}

.ranking-item:hover .rank-pet-svg .cartoon-pet {
  animation: petFloat 1.5s ease-in-out infinite;
}

/* 宠物状态指示器 */
.pet-status-indicator {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  z-index: 10;
}

.pet-status-indicator.sleeping { background: #3b82f6; animation: statusPulse 2s ease-in-out infinite; }
.pet-status-indicator.happy { background: #10b981; animation: statusPulse 1.5s ease-in-out infinite; }
.pet-status-indicator.energetic { background: #f59e0b; animation: statusPulse 1s ease-in-out infinite; }

@keyframes statusPulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
}

/* 宠物成长徽章 */
.pet-growth-badge {
  position: absolute;
  bottom: -5px;
  right: -5px;
  width: 20px;
  height: 20px;
  background: linear-gradient(135deg, #f97316, #f59e0b);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.6rem;
  font-weight: bold;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* 响应式调整 */
@media (max-width: 640px) {
  .cartoon-pet {
    width: 60px;
    height: 60px;
  }
  
  .pet-card .cartoon-pet {
    width: 50px;
    height: 50px;
  }
  
  .pet-head {
    width: 45px;
    height: 45px;
  }
  
  .pet-ear {
    width: 15px;
    height: 20px;
  }
}

/* ===== 不同时期宠物头像样式 ===== */

/* 幼年期宠物（Lv.1-3） */
.cartoon-pet.young {
  transform: scale(0.7);
  opacity: 0.9;
}

.cartoon-pet.young .pet-head {
  animation: petPulse 3s ease-in-out infinite, petBlink 5s ease-in-out infinite;
}

.cartoon-pet.young .pet-ear {
  animation: earWiggle 5s ease-in-out infinite;
}

/* 成长期宠物（Lv.4-6） */
.cartoon-pet.middle {
  transform: scale(1.0);
  opacity: 1;
}

.cartoon-pet.middle .pet-head {
  animation: petPulse 2s ease-in-out infinite, petBlink 4s ease-in-out infinite;
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.2);
}

.cartoon-pet.middle .pet-ear {
  animation: earWiggle 3s ease-in-out infinite;
}

/* 成熟期宠物（Lv.7-8） */
.cartoon-pet.mature {
  transform: scale(1.2);
  opacity: 1;
}

.cartoon-pet.mature .pet-head {
  animation: petPulse 1.5s ease-in-out infinite, petBlink 3s ease-in-out infinite, petGlow 2s ease-in-out infinite;
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
}

.cartoon-pet.mature .pet-ear {
  animation: earWiggle 2s ease-in-out infinite;
}

/* 时期装饰元素 */
.period-decoration {
  position: absolute;
  width: 10px;
  height: 10px;
  background: white;
  border-radius: 50%;
  opacity: 0.8;
  z-index: 5;
}

.period-decoration.middle {
  bottom: 5px;
  right: 5px;
  background: radial-gradient(circle, #ffd700 30%, transparent 70%);
  animation: petSpin 4s linear infinite;
}

.period-decoration.mature {
  top: 5px;
  left: 5px;
  background: radial-gradient(circle, #ff0000 30%, transparent 70%);
  animation: petSpin 2s linear infinite;
}

.period-glow {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.3) 0%, transparent 70%);
  animation: petGlow 2s ease-in-out infinite;
  z-index: -1;
}

/* 宠物舌头（狗狗） */
.pet-tongue {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 8px;
  background: #ff6b8b;
  border-radius: 50%;
  z-index: 2;
}

/* 宠物项圈（狗狗） */
.collar {
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 8px;
  background: #ff0000;
  border-radius: 4px;
  z-index: 3;
}

/* 猫蝴蝶结 */
.cat-bow {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 15px;
  height: 15px;
  background: #ff69b4;
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  z-index: 4;
}

/* 猫项圈 */
.cat-collar {
  position: absolute;
  bottom: -3px;
  left: 50%;
  transform: translateX(-50%);
  width: 35px;
  height: 6px;
  background: #4169e1;
  border-radius: 3px;
  z-index: 3;
}

/* 兔子牙齿 */
.rabbit-tooth {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 8px;
  background: white;
  border-radius: 0 0 3px 3px;
  z-index: 2;
}

/* 胡萝卜 */
.carrot {
  position: absolute;
  top: -10px;
  right: -5px;
  width: 15px;
  height: 20px;
  background: #ff8c00;
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  transform: rotate(-30deg);
  z-index: 4;
}

/* 响应式调整 */
@media (max-width: 640px) {
  .cartoon-pet.young {
    transform: scale(0.6);
  }
  
  .cartoon-pet.middle {
    transform: scale(0.8);
  }
  
  .cartoon-pet.mature {
    transform: scale(1.0);
  }
  
  .period-decoration {
    width: 8px;
    height: 8px;
  }
}
}

/* ===== ICP备案号 ===== */
.icp-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  padding: 0.4rem 1rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.5;
  background: var(--bg);
  z-index: 100;
  border-top: 1px solid var(--border);
}
.icp-footer a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}
.icp-footer a:hover {
  color: var(--primary);
  text-decoration: underline;
}
