/* ========================================
   设计系统 - 汉字书写教学应用（合并版）
   ======================================== */

:root {
  /* 主色调 - 柔和翠绿 */
  --primary: #3D9B6E;
  --primary-light: #2ECC71;
  --primary-lighter: #a8e6cf;
  --primary-dark: #2d8a5e;
  --primary-gradient: linear-gradient(135deg, #3D9B6E, #2ECC71);
  --primary-gradient-r: linear-gradient(135deg, #2ECC71, #3D9B6E);

  /* 强调色 - 琥珀金 */
  --accent: #f5a623;
  --accent-light: #ffd166;
  --accent-gradient: linear-gradient(135deg, #f5a623, #ffd166);

  /* 错误色 */
  --error: #e74c3c;
  --error-light: #f5b7b1;
  --error-gradient: linear-gradient(135deg, #e74c3c, #f5a623);

  /* 成功色 */
  --success: #27ae60;
  --success-gradient: linear-gradient(135deg, #27ae60, #2ECC71);

  /* 中性色 - 暖纸张色系 */
  --bg: #F7F4EF;
  --bg-pattern: #f0ece4;
  --bg-card: #ffffff;
  --bg-card-hover: #fefefe;
  --bg-muted: #f0ece4;
  --text-primary: #2C3E50;
  --text-secondary: #5D6D7E;
  --text-muted: #AAB7B8;
  --border: #e0dcd5;
  --border-light: #f0ece6;

  /* 书写区域颜色 */
  --stroke-color: #2c3e50;
  --outline-color: #dcd8d0;
  --highlight-color: var(--primary);
  --drawing-color: var(--primary);
  --grid-color: #c9544a;

  /* 阴影系统 - 多层次 */
  --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.06);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.15), 0 8px 16px rgba(0, 0, 0, 0.08);
  --shadow-glow-primary: 0 0 20px rgba(61, 155, 110, 0.25);
  --shadow-glow-accent: 0 0 20px rgba(245, 166, 35, 0.25);
  --shadow-inset: inset 0 1px 2px rgba(0, 0, 0, 0.06);

  /* 圆角 */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  /* 过渡 - 弹性曲线 */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* 装饰字体 */
  --font-display: 'ZCOOL KuaiLe', 'PingFang SC', system-ui, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans CJK SC', system-ui, sans-serif;
}

/* ========================================
   基础样式
   ======================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  background-image:
    radial-gradient(circle at 20% 50%, rgba(61, 155, 110, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(245, 166, 35, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 50% 80%, rgba(46, 204, 113, 0.02) 0%, transparent 50%);
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.container {
  max-width: 500px;
  margin: 0 auto;
  padding: 8px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(8px);
  animation: page-enter 0.5s ease-out 0.1s forwards;
}

@keyframes page-enter {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========================================
   头部
   ======================================== */

.header {
  text-align: center;
  margin-bottom: 16px;
  position: relative;
  padding-bottom: 14px;
}

.header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 10%;
  right: 10%;
  height: 2px;
  background: var(--primary-gradient);
  border-radius: 1px;
  opacity: 0.4;
}

.title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 1px;
}

.subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

/* ========================================
   控制面板
   ======================================== */

.control-panel {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 12px 12px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  position: relative;
  overflow: hidden;
}

.control-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary-gradient);
  opacity: 0.6;
}

.char-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: nowrap;
}

.char-input-group label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.char-input-group input {
  flex: 1 1 50px;
  min-width: 40px;
  height: 40px;
  padding: 0 8px;
  font-size: 16px;
  text-align: center;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-primary);
  transition: all var(--transition-normal);
}

.char-input-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(61, 155, 110, 0.15);
}

.char-input-group .btn-primary {
  flex-shrink: 0;
  padding: 0 16px;
  font-size: 13px;
  border-radius: var(--radius-full);
  height: 38px;
}

.quick-select {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.char-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.char-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: 15px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-normal);
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
}

.char-btn:hover {
  border-color: var(--primary);
  background: rgba(61, 155, 110, 0.08);
  transform: translateY(-1px);
  box-shadow: var(--shadow-xs);
}

.char-btn:active {
  transform: translateY(0) scale(0.95);
  background: rgba(61, 155, 110, 0.15);
}

.char-btn.active {
  border-color: transparent;
  background: var(--primary-gradient);
  color: white;
  box-shadow: var(--shadow-glow-primary);
  transform: translateY(-1px);
}

.refresh-btn {
  flex-shrink: 0;
  align-self: flex-start;
}

.refresh-btn svg {
  transition: transform 0.3s ease;
}

.refresh-btn:hover svg {
  transform: rotate(180deg);
}

/* ========================================
   按钮样式
   ======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 16px;
  height: 40px;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary-gradient);
  color: white;
  border: none;
  box-shadow: var(--shadow-xs);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: var(--shadow-glow-primary);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0) scale(0.97);
}

.btn-secondary {
  background: var(--bg-muted);
  color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--border);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
}

.btn-outline:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-large {
  padding: 0 32px;
  height: 48px;
  font-size: 16px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  border: none;
  background: var(--bg-muted);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition-normal);
  -webkit-tap-highlight-color: transparent;
}

.icon-btn:hover:not(:disabled) {
  background: var(--primary-gradient);
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow-primary);
}

.icon-btn:active:not(:disabled) {
  transform: scale(0.92) !important;
}

.icon-btn:focus {
  outline: none;
  box-shadow: none;
}

.icon-btn:focus:not(:focus-visible) {
  background: var(--bg-muted);
  color: var(--text-secondary);
}

.icon-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ========================================
   进度条
   ======================================== */

.progress-section {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.progress-info {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.stroke-name {
  padding: 3px 10px;
  background: var(--error-gradient);
  color: white;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  min-width: 44px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(231, 76, 60, 0.25);
  transition: all var(--transition-normal);
}

.stroke-name:empty {
  background: var(--bg-muted);
  color: var(--text-muted);
  box-shadow: none;
}

.progress-bar {
  height: 8px;
  background: var(--bg-muted);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: var(--primary-gradient);
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 100%
  );
  animation: progress-shimmer 2s ease-in-out infinite;
}

@keyframes progress-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ========================================
   书写区域（合并版）
   ======================================== */

.writing-panel {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 2px solid var(--border);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 280px;
  max-height: 550px;
  position: relative;
}

.writing-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary-gradient);
  z-index: 5;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  background: linear-gradient(180deg, var(--bg-muted) 0%, var(--bg-card) 100%);
  border-bottom: 1px solid var(--border-light);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-center {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 40px;
  min-height: 40px;
  margin-left: 14px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-icon {
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  transition: all var(--transition-normal);
}

.status-icon.demo {
  background: linear-gradient(135deg, rgba(61, 155, 110, 0.15), rgba(46, 204, 113, 0.1));
  color: var(--primary-dark);
}

.status-icon.write {
  background: linear-gradient(135deg, rgba(245, 166, 35, 0.2), rgba(255, 209, 102, 0.12));
  color: #d48806;
}

.status-icon.success {
  background: linear-gradient(135deg, rgba(39, 174, 96, 0.18), rgba(46, 204, 113, 0.12));
  color: var(--success);
  box-shadow: 0 0 12px rgba(39, 174, 96, 0.2);
}

.status-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

/* 拼音显示样式 */
.char-pinyin {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-dark);
  padding: 3px 10px;
  background: linear-gradient(135deg, rgba(61, 155, 110, 0.12), rgba(46, 204, 113, 0.06));
  border-radius: var(--radius-full);
  min-width: 20px;
  text-align: center;
  border: 1px solid rgba(61, 155, 110, 0.15);
}

.char-pinyin:empty {
  display: none;
}

/* 发音按钮样式 - 绝对定位在书写区域左上角 */
.voice-btn {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 10;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(4px);
}

.voice-btn:hover:not(:disabled) {
  background: var(--primary-gradient);
  color: white;
  box-shadow: var(--shadow-glow-primary);
}

.voice-btn.playing {
  background: var(--primary-gradient);
  color: white;
  animation: voice-pulse 1s ease-in-out infinite;
}

@keyframes voice-pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(61, 155, 110, 0.4);
  }
  50% {
    transform: scale(1.08);
    box-shadow: 0 0 0 8px rgba(61, 155, 110, 0);
  }
}

.writer-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 12px;
  height: min(320px, 55vh);
  min-height: 200px;
  max-height: 450px;
}

#main-writer {
  position: relative;
  border: 2.5px solid var(--grid-color);
  border-radius: 2px;
  background: linear-gradient(
    135deg,
    #fdfcf9 0%,
    #faf8f3 25%,
    #fcfbf8 50%,
    #f9f7f1 75%,
    #fdfcf9 100%
  );
  width: 100%;
  height: 100%;
  box-shadow: var(--shadow-inset), 0 1px 3px rgba(201, 84, 74, 0.08);
}

/* 米字格背景 - 使用SVG实现红色虚线 */
#main-writer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='100%25' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cline x1='50' y1='0' x2='50' y2='100' stroke='%23c9544a' stroke-width='0.5' stroke-dasharray='3,2'/%3E%3Cline x1='0' y1='50' x2='100' y2='50' stroke='%23c9544a' stroke-width='0.5' stroke-dasharray='3,2'/%3E%3Cline x1='0' y1='0' x2='100' y2='100' stroke='%23c9544a' stroke-width='0.5' stroke-dasharray='3,2'/%3E%3Cline x1='100' y1='0' x2='0' y2='100' stroke='%23c9544a' stroke-width='0.5' stroke-dasharray='3,2'/%3E%3C/svg%3E");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  z-index: 0;
  opacity: 0.6;
}

/* 确保 hanzi-writer 内容在米字格上方 */
#main-writer > *:not(.voice-btn) {
  position: relative;
  z-index: 1;
}

.hint-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(253, 252, 249, 0.96);
  opacity: 1;
  transition: opacity var(--transition-normal);
  pointer-events: none;
  backdrop-filter: blur(2px);
}

.hint-overlay.hidden {
  opacity: 0;
}

.completed-emoji {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  line-height: 40px;
  height: 40px;
  opacity: 0;
  transform: scale(0.5);
  transition: all var(--transition-bounce);
}

.completed-emoji.show {
  opacity: 1;
  transform: scale(1);
}

/* emoji 飞行动画 */
.flying-emoji {
  position: fixed;
  font-size: 300px;
  line-height: 1;
  z-index: 1000;
  pointer-events: none;
  animation: emoji-fly 2s linear forwards;
  filter: drop-shadow(0 0 30px rgba(255, 200, 50, 0.3));
}

@keyframes emoji-fly {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.3);
  }
  15% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 1;
    transform: translate(calc(-50% + var(--target-x)), calc(-50% + var(--target-y))) scale(0.1);
  }
}

.hint-content {
  text-align: center;
}

.hint-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.hint-text {
  font-size: 14px;
  color: var(--text-muted);
}

.panel-footer {
  padding: 10px 16px;
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-muted) 100%);
  text-align: center;
}

.panel-footer p {
  font-size: 13px;
  color: var(--text-secondary);
  transition: all var(--transition-normal);
}

/* ========================================
   已完成汉字区域
   ======================================== */

.completed-section {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-top: 12px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.completed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.completed-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.completed-count {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-muted);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 500;
}

.completed-chars {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 36px;
}

.completed-chars .char-btn {
  border-color: transparent;
  background: var(--primary-gradient);
  color: white;
  box-shadow: var(--shadow-xs);
  transition: all var(--transition-normal);
}

.completed-chars .char-btn:hover {
  background: var(--primary-gradient-r);
  border-color: transparent;
  transform: translateY(-2px) scale(1.05);
  box-shadow: var(--shadow-sm);
}

/* ========================================
   选课按钮 & 星星计数器
   ======================================== */

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.level-tag {
  font-size: 13px;
  color: var(--primary-dark);
  background: linear-gradient(135deg, rgba(61, 155, 110, 0.12), rgba(46, 204, 113, 0.08));
  padding: 3px 12px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
  border: 1px solid rgba(61, 155, 110, 0.15);
}

.level-tag .level-icon {
  font-size: 14px;
}

.course-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-full);
  border: none;
  background: var(--primary-gradient);
  color: white;
  cursor: pointer;
  transition: all var(--transition-normal);
  -webkit-tap-highlight-color: transparent;
  box-shadow: var(--shadow-xs);
}

.course-btn:hover {
  box-shadow: var(--shadow-glow-primary);
  transform: translateY(-1px);
}

.course-btn:active {
  transform: scale(0.97);
}

.course-btn svg {
  width: 16px;
  height: 16px;
}

/* 星星计数器 */
.header-stars {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px 10px;
  background: linear-gradient(135deg, rgba(245, 166, 35, 0.12), rgba(255, 209, 102, 0.08));
  border-radius: var(--radius-full);
  border: 1px solid rgba(245, 166, 35, 0.2);
  flex-shrink: 0;
}

.header-stars .star-icon {
  color: var(--accent);
  filter: drop-shadow(0 0 2px rgba(245, 166, 35, 0.3));
}

.header-stars .star-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  min-width: 12px;
  text-align: center;
}

.header-stars .star-count.star-bounce {
  animation: star-count-bounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes star-count-bounce {
  0% { transform: scale(1); }
  40% { transform: scale(1.5); }
  100% { transform: scale(1); }
}

/* ========================================
   打卡火焰组件
   ======================================== */

.header-streak {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px 10px;
  background: linear-gradient(135deg, rgba(231, 76, 60, 0.08), rgba(245, 166, 35, 0.08));
  border-radius: var(--radius-full);
  border: 1px solid rgba(231, 76, 60, 0.12);
  flex-shrink: 0;
  opacity: 0.5;
  transition: opacity var(--transition-normal);
}

.header-streak.active {
  opacity: 1;
}

.header-streak .streak-fire {
  font-size: 14px;
  line-height: 1;
}

.header-streak.active .streak-fire {
  animation: fire-breathe 2s ease-in-out infinite;
}

.header-streak .streak-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 12px;
  text-align: center;
}

.header-streak.active .streak-count {
  color: var(--text-primary);
}

@keyframes fire-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ========================================
   每日挑战任务
   ======================================== */

.daily-tasks-section {
  margin-top: 16px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.daily-tasks-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition-fast);
}

.daily-tasks-header:hover {
  background: var(--bg-muted);
}

.daily-tasks-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.daily-tasks-icon {
  font-size: 15px;
}

.daily-tasks-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.daily-tasks-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--error);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-full);
  animation: badge-pulse 2s ease-in-out infinite;
}

@keyframes badge-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.daily-tasks-toggle {
  color: var(--text-muted);
  transition: transform var(--transition-normal);
}

.daily-tasks-section.collapsed .daily-tasks-toggle {
  transform: rotate(-90deg);
}

.daily-tasks-body {
  max-height: 400px;
  overflow: hidden;
  transition: max-height var(--transition-slow), opacity var(--transition-normal);
  opacity: 1;
}

.daily-tasks-section.collapsed .daily-tasks-body {
  max-height: 0;
  opacity: 0;
}

.daily-tasks-list {
  padding: 0 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.daily-task-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  transition: all var(--transition-normal);
}

.daily-task-card.completed {
  opacity: 0.5;
}

.daily-task-card.completed .daily-task-text {
  text-decoration: line-through;
}

.daily-task-icon {
  font-size: 18px;
  flex-shrink: 0;
  width: 28px;
  text-align: center;
}

.daily-task-info {
  flex: 1;
  min-width: 0;
}

.daily-task-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.daily-task-progress-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.daily-task-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-muted);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.daily-task-progress-fill {
  height: 100%;
  background: var(--primary-gradient);
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
  min-width: 0;
}

.daily-task-card.completed .daily-task-progress-fill {
  background: var(--text-muted);
}

.daily-task-count {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  font-weight: 500;
}

.daily-task-check {
  font-size: 16px;
  flex-shrink: 0;
  opacity: 0;
  transform: scale(0.5);
  transition: all var(--transition-bounce);
}

.daily-task-card.completed .daily-task-check {
  opacity: 1;
  transform: scale(1);
}

.daily-tasks-reward {
  padding: 8px 16px 14px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

.reward-stars {
  color: var(--accent);
  font-weight: 600;
}

/* ========================================
   签到日历
   ======================================== */

.calendar-section {
  margin-top: 16px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  padding: 16px;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.calendar-header-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.calendar-icon {
  font-size: 15px;
}

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.calendar-month {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  min-width: 100px;
  text-align: center;
}

.calendar-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: var(--bg-muted);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.calendar-nav-btn:hover {
  background: var(--border);
  color: var(--text-primary);
}

.calendar-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 4px;
}

.calendar-weekdays span {
  text-align: center;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 4px 0;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.calendar-day {
  position: relative;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.calendar-day.empty {
  color: transparent;
}

.calendar-day.today {
  font-weight: 700;
  color: var(--primary);
  background: rgba(61, 155, 110, 0.08);
  box-shadow: inset 0 0 0 1.5px var(--primary);
}

.calendar-day .dot {
  position: absolute;
  bottom: 3px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
}

.calendar-day .dot.streak {
  background: var(--primary-dark);
  box-shadow: 0 0 4px rgba(61, 155, 110, 0.4);
}

.calendar-day .dot.gap {
  background: var(--text-muted);
}

.calendar-day .dot.perfect {
  background: var(--accent);
  box-shadow: 0 0 4px rgba(245, 166, 35, 0.4);
}

.calendar-day.future {
  color: var(--border);
}

.calendar-day.has-data {
  cursor: pointer;
}

.calendar-day.has-data:hover {
  background: rgba(61, 155, 110, 0.12);
}

.calendar-stats {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-light);
}

.calendar-stat {
  font-size: 12px;
  color: var(--text-muted);
}

.calendar-stat strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* 日详情弹窗 */
.day-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.day-detail-modal.active {
  pointer-events: auto;
  opacity: 1;
}

.day-detail-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.day-detail-content {
  position: relative;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  max-height: 80vh;
  background: var(--bg-card);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  transform: translateY(100%);
  transition: transform var(--transition-medium);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.day-detail-modal.active .day-detail-content {
  transform: translateY(0);
}

.day-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}

.day-detail-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.day-detail-close {
  padding: 4px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.day-detail-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.day-detail-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}

.day-stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 8px;
  background: var(--bg-hover);
  border-radius: var(--radius-md);
}

.day-stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
}

.day-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.day-detail-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px 20px;
}

.day-detail-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

.day-detail-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  margin-bottom: 8px;
  background: var(--bg-hover);
  border-radius: var(--radius-md);
}

.day-detail-char {
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border-radius: var(--radius-md);
}

.day-detail-info {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 12px;
}

.day-detail-grade {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

.day-detail-grade.grade-perfect {
  background: rgba(245, 166, 35, 0.15);
  color: #C68400;
}

.day-detail-grade.grade-good {
  background: rgba(61, 155, 110, 0.15);
  color: var(--primary-dark);
}

.day-detail-grade.grade-try {
  background: rgba(107, 114, 128, 0.15);
  color: var(--text-muted);
}

.day-detail-grade.grade-giveup {
  background: rgba(239, 68, 68, 0.15);
  color: #DC2626;
}

.day-detail-stars {
  font-size: 14px;
}

.day-detail-mistakes {
  font-size: 12px;
  color: var(--text-muted);
}

@media (min-width: 768px) {
  .day-detail-modal {
    align-items: center;
  }

  .day-detail-content {
    border-radius: var(--radius-lg);
    max-height: 70vh;
  }
}

/* ========================================
   断签提醒弹窗
   ======================================== */

.streak-break-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.streak-break-modal.active {
  opacity: 1;
  visibility: visible;
}

.streak-break-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
}

.streak-break-content {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 32px 24px 24px;
  text-align: center;
  max-width: 300px;
  width: 90%;
  box-shadow: var(--shadow-xl);
  transform: scale(0.8);
  transition: transform var(--transition-bounce);
}

.streak-break-modal.active .streak-break-content {
  transform: scale(1);
}

.streak-break-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.streak-break-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.streak-break-message {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 20px;
}

.streak-break-btn {
  min-width: 120px;
}

/* ========================================
   每日挑战庆祝弹窗
   ======================================== */

.celebrate-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.celebrate-modal.active {
  opacity: 1;
  visibility: visible;
}

.celebrate-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
}

.celebrate-content {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 32px 24px 24px;
  text-align: center;
  max-width: 300px;
  width: 90%;
  box-shadow: var(--shadow-xl);
  transform: scale(0.8);
  transition: transform var(--transition-bounce);
}

.celebrate-modal.active .celebrate-content {
  transform: scale(1);
}

.celebrate-confetti {
  font-size: 52px;
  margin-bottom: 12px;
  animation: celebrate-bounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes celebrate-bounce {
  0% { transform: scale(0) rotate(-15deg); }
  60% { transform: scale(1.2) rotate(5deg); }
  100% { transform: scale(1) rotate(0); }
}

.celebrate-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.celebrate-reward {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 20px;
}

.celebrate-btn {
  min-width: 120px;
}

/* ========================================
   底部入口栏
   ======================================== */

.bottom-entries {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  padding: 0;
}

.bottom-entry-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  -webkit-tap-highlight-color: transparent;
  box-shadow: var(--shadow-sm);
}

.bottom-entry-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.bottom-entry-btn:active {
  transform: scale(0.97) translateY(0);
}

.bottom-entry-icon {
  font-size: 18px;
}

.bottom-entry-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.achievement-header-badge {
  position: absolute;
  top: 6px;
  right: 8px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ========================================
   成就解锁通知弹窗
   ======================================== */

.achievement-modal {
  position: fixed;
  inset: 0;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
  pointer-events: none;
}

.achievement-modal.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.achievement-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.achievement-content {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 32px 28px 24px;
  text-align: center;
  max-width: 280px;
  width: 88%;
  box-shadow: var(--shadow-xl);
  transform: scale(0.6);
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

.achievement-modal.active .achievement-content {
  transform: scale(1);
}

.achievement-shine {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(from 0deg, transparent 0%, rgba(245, 166, 35, 0.08) 25%, transparent 50%);
  animation: achievement-rotate 3s linear infinite;
  pointer-events: none;
}

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

.achievement-content > * {
  position: relative;
  z-index: 1;
}

.achievement-content .achievement-icon {
  font-size: 56px;
  margin-bottom: 8px;
  filter: drop-shadow(0 4px 12px rgba(245, 166, 35, 0.3));
  animation: achievement-icon-bounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s both;
}

@keyframes achievement-icon-bounce {
  0% { transform: scale(0) rotate(-20deg); }
  60% { transform: scale(1.3) rotate(5deg); }
  100% { transform: scale(1) rotate(0); }
}

.achievement-content .achievement-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 4px;
}

.achievement-content .achievement-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.achievement-content .achievement-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.achievement-content .achievement-reward {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}

/* ========================================
   成就墙弹窗
   ======================================== */

.achievement-wall-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.achievement-wall-modal.active {
  opacity: 1;
  visibility: visible;
}

.achievement-wall-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.achievement-wall-content {
  position: relative;
  width: 100%;
  max-width: 500px;
  max-height: 80vh;
  background: var(--bg);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}

.achievement-wall-modal.active .achievement-wall-content {
  transform: translateY(0);
}

.achievement-wall-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
}

.achievement-wall-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
}

.achievement-wall-count {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
}

.achievement-wall-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg-muted);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 16px;
  transition: all var(--transition-normal);
  flex-shrink: 0;
}

.achievement-wall-close:hover {
  background: var(--border);
  transform: rotate(90deg);
}

.achievement-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 16px 20px;
  overflow-y: auto;
  max-height: calc(80vh - 60px);
}

.achievement-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  transition: all var(--transition-normal);
  text-align: center;
}

.achievement-card.unlocked {
  border-color: rgba(245, 166, 35, 0.3);
  background: linear-gradient(135deg, #fffcf5, #fff8e8);
}

.achievement-card.locked {
  opacity: 0.4;
}

.achievement-card-icon {
  font-size: 36px;
  margin-bottom: 8px;
  line-height: 1;
}

.achievement-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.achievement-card-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

.achievement-card-date {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border-light);
  width: 100%;
}

/* ========================================
   排行榜弹窗
   ======================================== */

.leaderboard-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.leaderboard-modal.active {
  opacity: 1;
  visibility: visible;
}

.leaderboard-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.leaderboard-content {
  position: relative;
  width: 100%;
  max-width: 500px;
  max-height: 85vh;
  background: var(--bg);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}

.leaderboard-modal.active .leaderboard-content {
  transform: translateY(0);
}

.leaderboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
}

.leaderboard-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
}

.leaderboard-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg-muted);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 16px;
  transition: all var(--transition-normal);
  flex-shrink: 0;
}

.leaderboard-close:hover {
  background: var(--border);
  transform: rotate(90deg);
}

.leaderboard-tabs {
  display: flex;
  gap: 0;
  padding: 12px 20px 0;
  background: var(--bg-card);
}

.lb-tab {
  flex: 1;
  padding: 8px 0;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.lb-tab.active {
  color: var(--primary);
  font-weight: 600;
}

.lb-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20%;
  right: 20%;
  height: 3px;
  background: var(--primary-gradient);
  border-radius: 3px 3px 0 0;
}

.lb-tab:hover:not(.active) {
  color: var(--text-secondary);
  background: var(--bg-muted);
}

.leaderboard-summary {
  padding: 10px 20px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
}

.leaderboard-list {
  overflow-y: auto;
  max-height: calc(85vh - 150px);
  padding: 4px 0;
}

.lb-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  transition: background var(--transition-fast);
}

.lb-item:hover {
  background: var(--bg-muted);
}

.lb-item.is-user {
  background: linear-gradient(135deg, rgba(61, 155, 110, 0.08), rgba(46, 204, 113, 0.04));
  border-left: 3px solid var(--primary);
}

.lb-rank {
  width: 32px;
  text-align: center;
  flex-shrink: 0;
}

.lb-medal {
  font-size: 20px;
  line-height: 1;
}

.lb-rank-num {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

.lb-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  border: 2px solid var(--border-light);
}

.lb-info {
  flex: 1;
  min-width: 0;
}

.lb-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-item.is-user .lb-name {
  color: var(--primary-dark);
  font-weight: 600;
}

.lb-stars {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
}

.lb-star-icon {
  font-size: 12px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* 全屏底部滑入弹窗 */
.course-modal {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  top: 0;
  z-index: 101;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  will-change: transform;
}

.course-modal.active {
  transform: translateY(0);
}

.course-modal-header {
  display: flex;
  align-items: center;
  padding: 14px 16px 10px;
  flex-shrink: 0;
  position: relative;
}

.course-modal-drag {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
}

.course-modal-title {
  flex: 1;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
}

.course-modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg-muted);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 18px;
  transition: all var(--transition-normal);
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.course-modal-close:hover {
  background: var(--border);
  transform: rotate(90deg);
}

.course-modal-close:active {
  transform: scale(0.9) rotate(90deg);
}

/* 级别卡片横向滚动 */
.level-cards-scroll {
  display: flex;
  gap: 10px;
  padding: 8px 16px 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-shrink: 0;
}

.level-cards-scroll::-webkit-scrollbar {
  display: none;
}

.level-card {
  min-width: 110px;
  max-width: 110px;
  padding: 12px 10px;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  scroll-snap-align: start;
  transition: all var(--transition-normal);
  position: relative;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.level-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.level-card:active {
  transform: scale(0.97) translateY(0);
}

.level-card.free {
  border-left: 3px solid var(--primary);
}

.level-card.vip {
  border-left: 3px solid var(--accent);
  background: linear-gradient(135deg, #fffcf5, #fff8e8);
}

.level-card.vip:hover {
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(245, 166, 35, 0.1);
}

.level-card.selected {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow-primary);
  transform: translateY(-2px);
}

.level-card.selected.free {
  border-left-color: var(--primary);
}

.level-card-icon {
  font-size: 24px;
  margin-bottom: 4px;
}

.level-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.level-card-count {
  font-size: 12px;
  color: var(--text-muted);
}

.level-card-stars {
  font-size: 11px;
  color: var(--accent);
  margin-top: 2px;
}

.level-card-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  font-weight: 500;
}

.level-card-badge.free-badge {
  background: linear-gradient(135deg, rgba(61, 155, 110, 0.15), rgba(46, 204, 113, 0.1));
  color: var(--primary-dark);
}

.level-card-badge.vip-badge {
  background: linear-gradient(135deg, rgba(245, 166, 35, 0.2), rgba(255, 209, 102, 0.15));
  color: #d48806;
}

.level-card-lock {
  position: absolute;
  bottom: 6px;
  right: 6px;
  font-size: 12px;
  opacity: 0.5;
}

/* 汉字网格区域 */
.chars-grid-container {
  flex: 1;
  overflow-y: auto;
  padding: 4px 16px 80px;
  -webkit-overflow-scrolling: touch;
}

.chars-grid-category {
  margin-bottom: 16px;
}

.chars-grid-category-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
  padding-left: 4px;
}

.chars-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.char-grid-item {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  -webkit-tap-highlight-color: transparent;
  gap: 2px;
  overflow: hidden;
}

.char-grid-item:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.char-grid-item:active {
  transform: scale(0.95) translateY(0);
  background: rgba(61, 155, 110, 0.08);
}

.char-grid-item.completed {
  background: linear-gradient(135deg, rgba(61, 155, 110, 0.08), rgba(46, 204, 113, 0.05));
  border-color: var(--primary-light);
}

.char-grid-item.completed::after {
  content: '✓';
  position: absolute;
  bottom: 3px;
  right: 5px;
  font-size: 10px;
  color: var(--primary);
  font-weight: 700;
  background: rgba(61, 155, 110, 0.1);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.char-grid-item.locked {
  background: var(--bg-muted);
  opacity: 0.5;
  cursor: default;
}

.char-grid-item.locked:hover {
  border-color: var(--border-light);
  transform: none;
  box-shadow: none;
}

.char-grid-item .char-text {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.char-grid-item .char-pinyin-small {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1;
}

.char-grid-item.locked .char-text {
  color: var(--text-muted);
}

.char-grid-item .lock-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 16px;
}

/* VIP 底部横幅 */
.vip-banner {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 16px;
  background: linear-gradient(135deg, #f5a623, #f7c948);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 2;
}

.vip-banner-text {
  font-size: 14px;
  font-weight: 500;
  color: #5a3e00;
}

.vip-banner-btn {
  padding: 6px 16px;
  border-radius: 20px;
  border: 2px solid #5a3e00;
  background: transparent;
  color: #5a3e00;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.vip-banner-btn:hover {
  background: #5a3e00;
  color: white;
}

.vip-banner-btn:active {
  transform: scale(0.95);
}

/* ========================================
   VIP 会员弹窗
   ======================================== */

.vip-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.vip-modal.active {
  opacity: 1;
  visibility: visible;
}

.vip-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.vip-modal-content {
  position: relative;
  width: 90%;
  max-width: 380px;
  max-height: 85vh;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.vip-modal.active .vip-modal-content {
  transform: scale(1);
}

.vip-modal-header {
  background: linear-gradient(135deg, #f5a623 0%, #ffd166 50%, #f5a623 100%);
  background-size: 200% 200%;
  animation: vip-shimmer 3s ease-in-out infinite;
  padding: 24px 20px 18px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.vip-modal-header::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 60%);
  pointer-events: none;
}

@keyframes vip-shimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.vip-modal-header .crown-icon {
  font-size: 36px;
  margin-bottom: 4px;
  filter: drop-shadow(0 2px 4px rgba(90, 62, 0, 0.3));
}

.vip-modal-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: #5a3e00;
  position: relative;
}

.vip-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5a3e00;
  font-size: 16px;
  transition: all var(--transition-normal);
  -webkit-tap-highlight-color: transparent;
  z-index: 1;
}

.vip-modal-close:hover {
  background: rgba(255, 255, 255, 0.9);
  transform: rotate(90deg);
}

.vip-modal-body {
  padding: 20px 16px;
  overflow-y: auto;
  max-height: calc(85vh - 180px);
}

/* 权益列表 */
.vip-perks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.vip-perk-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: linear-gradient(135deg, var(--bg-muted), rgba(240, 236, 228, 0.5));
  border-radius: var(--radius-sm);
  transition: all var(--transition-normal);
}

.vip-perk-item:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-xs);
}

.vip-perk-icon {
  font-size: 20px;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(245, 166, 35, 0.1);
  border-radius: 8px;
}

.vip-perk-text {
  font-size: 12px;
  color: var(--text-primary);
  line-height: 1.4;
}

.vip-perk-text strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
}

/* 价格方案 */
.vip-plans {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.vip-plan {
  flex: 1;
  padding: 12px 8px;
  background: var(--bg-muted);
  border-radius: var(--radius-md);
  text-align: center;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.vip-plan:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.vip-plan.recommended {
  border-color: var(--accent);
  background: linear-gradient(135deg, #fffcf5, #fff8e8);
  box-shadow: var(--shadow-glow-accent);
}

.vip-plan.recommended .plan-badge {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  padding: 2px 10px;
  background: var(--accent-gradient);
  color: white;
  border-radius: var(--radius-full);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}

.vip-plan-name {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.vip-plan-price {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.vip-plan-price .unit {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-secondary);
}

.vip-plan-original {
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: line-through;
  margin-top: 2px;
}

.vip-plan-avg {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* 购买按钮 */
.vip-buy-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #f5a623 0%, #ffd166 50%, #f5a623 100%);
  background-size: 200% 200%;
  color: #5a3e00;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-normal);
  box-shadow: 0 4px 16px rgba(245, 166, 35, 0.35);
  -webkit-tap-highlight-color: transparent;
  animation: vip-btn-shimmer 3s ease-in-out infinite;
  position: relative;
  overflow: hidden;
}

@keyframes vip-btn-shimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.vip-buy-btn:hover {
  box-shadow: 0 6px 20px rgba(245, 166, 35, 0.45);
  transform: translateY(-1px);
}

.vip-buy-btn:active {
  transform: scale(0.98);
}

/* ========================================
   评价弹窗
   ======================================== */

.result-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.result-modal.active {
  opacity: 1;
  visibility: visible;
}

.result-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.result-modal-content {
  position: relative;
  width: 85%;
  max-width: 320px;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  transform: scale(0.85);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  padding: 28px 24px 24px;
  text-align: center;
}

.result-modal.active .result-modal-content {
  transform: scale(1);
}

/* 星星显示区 */
.result-stars {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
  min-height: 44px;
}

.result-star {
  font-size: 38px;
  line-height: 1;
  color: var(--border);
  opacity: 0;
  transform: scale(0) rotate(-30deg);
  transition: all 0.01s;
}

.result-star.earned {
  color: var(--accent);
  filter: drop-shadow(0 2px 6px rgba(245, 166, 35, 0.4));
  animation: star-pop-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.result-star.empty {
  opacity: 0.25;
  transform: scale(0.85);
  animation: none;
}

@keyframes star-pop-in {
  0% {
    opacity: 0;
    transform: scale(0) rotate(-30deg);
  }
  60% {
    opacity: 1;
    transform: scale(1.2) rotate(5deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

/* 评价标签 */
.result-grade {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  padding: 4px 24px;
  border-radius: var(--radius-full);
  margin-bottom: 12px;
}

.result-grade.grade-perfect {
  background: linear-gradient(135deg, #f5a623, #ffd166);
  color: #5a3e00;
  box-shadow: 0 4px 16px rgba(245, 166, 35, 0.35);
}

.result-grade.grade-good {
  background: linear-gradient(135deg, #27ae60, #2ECC71);
  color: white;
  box-shadow: 0 4px 16px rgba(39, 174, 96, 0.3);
}

.result-grade.grade-tryAgain {
  background: linear-gradient(135deg, #f39c12, #e67e22);
  color: white;
  box-shadow: 0 4px 16px rgba(243, 156, 18, 0.3);
}

/* 汉字信息 */
.result-char-info {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* 鼓励文案 */
.result-message {
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--text-primary);
  margin-bottom: 20px;
}

/* 操作按钮 */
.result-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.result-actions .btn {
  flex: 1;
  max-width: 140px;
  height: 40px;
  font-size: 14px;
  border-radius: var(--radius-full);
}

/* ========================================
   动画
   ======================================== */

/* Emoji 飞行动画 */
@keyframes emoji-float-up {
  0% {
    opacity: 0;
    transform: scale(3) translateY(0);
  }
  20% {
    opacity: 1;
    transform: scale(3) translateY(0);
  }
  80% {
    opacity: 1;
    transform: scale(0.3) translateY(-100px);
  }
  100% {
    opacity: 1;
    transform: scale(0.3) translateY(-100px);
  }
}

@keyframes emoji-fly-to-target {
  0% {
    opacity: 1;
    transform: scale(0.3) translateY(-100px);
  }
  70% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  85% {
    opacity: 1;
    transform: scale(1.15) translateY(0);
  }
  100% {
    opacity: 0;
    transform: scale(1) translateY(0);
  }
}

.emoji-animate-element {
  position: fixed;
  font-size: 300px;
  line-height: 1;
  z-index: 9999;
  pointer-events: none;
  animation: emoji-float-up 0.5s ease-out forwards, emoji-fly-to-target 0.7s ease-in forwards;
  animation-delay: 0s, 0.5s;
  filter: drop-shadow(0 0 40px rgba(255, 200, 50, 0.4));
}

/* 星光粒子效果 */
.sparkle {
  position: fixed;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9998;
  animation: sparkle-fade 0.8s ease-out forwards;
}

@keyframes sparkle-fade {
  0% {
    opacity: 1;
    transform: scale(1) translate(0, 0);
  }
  100% {
    opacity: 0;
    transform: scale(0) translate(var(--tx), var(--ty));
  }
}

/* ========================================
   响应式设计
   ======================================== */

@media (min-width: 500px) {
  .container {
    padding: 24px;
  }

  .writer-container {
    min-height: 350px;
  }

  .writing-panel {
    min-height: 400px;
  }
}

@media (max-height: 700px) {
  .header {
    margin-bottom: 12px;
  }

  .control-panel {
    padding: 10px 12px;
    margin-bottom: 10px;
  }

  .progress-section {
    padding: 10px 12px;
    margin-bottom: 10px;
  }

  .writer-container {
    min-height: 250px;
    padding: 12px;
  }
}

/* ========================================
   学习报告弹窗
   ======================================== */

.report-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.report-modal.active {
  opacity: 1;
  visibility: visible;
}

.report-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.report-content {
  position: relative;
  width: 100%;
  max-width: 500px;
  max-height: 85vh;
  background: var(--bg);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}

.report-modal.active .report-content {
  transform: translateY(0);
}

.report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
}

.report-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
}

.report-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg-muted);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 16px;
  transition: all var(--transition-normal);
  flex-shrink: 0;
}

.report-close:hover {
  background: var(--border);
  transform: rotate(90deg);
}

.report-tabs {
  display: flex;
  gap: 0;
  padding: 12px 20px 0;
  background: var(--bg-card);
}

.report-tab {
  flex: 1;
  padding: 8px 0;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.report-tab.active {
  color: var(--primary);
  font-weight: 600;
}

.report-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20%;
  right: 20%;
  height: 3px;
  background: var(--primary-gradient);
  border-radius: 3px 3px 0 0;
}

.report-tab:hover:not(.active) {
  color: var(--text-secondary);
  background: var(--bg-muted);
}

.report-body {
  overflow-y: auto;
  max-height: calc(85vh - 120px);
  padding: 16px 20px 24px;
}

/* 报告统计卡片网格 */
.report-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.report-stat-card {
  padding: 14px 12px;
  border-radius: var(--radius-md);
  text-align: center;
  border: 1px solid var(--border-light);
  background: var(--bg-card);
}

.report-stat-card.report-card-blue { border-left: 3px solid #4a90d9; }
.report-stat-card.report-card-green { border-left: 3px solid var(--primary); }
.report-stat-card.report-card-purple { border-left: 3px solid #9b59b6; }
.report-stat-card.report-card-orange { border-left: 3px solid #e67e22; }

.report-stat-icon {
  font-size: 22px;
  margin-bottom: 4px;
}

.report-stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.report-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* 报告区块 */
.report-section {
  margin-bottom: 16px;
}

.report-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-light);
}

.report-empty {
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border);
}

/* 数据对比列表 */
.report-comparison {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.report-compare-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.report-compare-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.report-compare-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

/* 弱字/掌握/复习列表 */
.report-char-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.report-char-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.report-char-item.weak {
  border-left: 3px solid #e74c3c;
}

.report-char-item.mastered {
  border-left: 3px solid var(--primary);
}

.report-char-item.review {
  border-left: 3px solid #f39c12;
}

.report-char-text {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 600;
  background: var(--bg-muted);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.report-char-info {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* 级别进度 */
.report-level-item {
  margin-bottom: 12px;
}

.report-level-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.report-level-icon {
  font-size: 18px;
}

.report-level-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
}

.report-level-count {
  font-size: 12px;
  color: var(--text-muted);
}

.report-level-bar {
  height: 8px;
  background: var(--bg-muted);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.report-level-fill {
  height: 100%;
  background: var(--primary-gradient);
  border-radius: var(--radius-full);
  transition: width 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
  min-width: 0;
}

/* ========================================
   移动端优化
   ======================================== */

/* 超窄屏幕 (≤320px) */
@media (max-width: 320px) {
  .title {
    font-size: 20px;
  }

  .char-input-group {
    gap: 6px;
  }

  .char-input-group label {
    font-size: 13px;
  }

  .char-input-group input {
    font-size: 14px;
    padding: 0 4px;
  }

  .char-input-group .btn-primary {
    padding: 0 8px;
    font-size: 12px;
  }
}

/* 横屏适配 */
@media (orientation: landscape) and (max-height: 450px) {
  .header {
    margin-bottom: 8px;
  }

  .title {
    font-size: 18px;
  }

  .subtitle {
    display: none;
  }

  .control-panel {
    padding: 8px 12px;
    margin-bottom: 8px;
  }

  .char-input-group {
    margin-bottom: 8px;
  }

  .progress-section {
    padding: 8px 12px;
    margin-bottom: 8px;
  }

  .writing-panel {
    min-height: 180px;
    max-height: 250px;
  }

  .writer-container {
    height: min(200px, 35vh);
    min-height: 150px;
    padding: 8px;
  }
}

/* 大屏平板横屏 */
@media (min-width: 768px) and (orientation: landscape) {
  .container {
    max-width: 700px;
  }

  .writing-panel {
    max-height: 500px;
  }

  .writer-container {
    height: min(350px, 50vh);
  }
}

/* ========================================
   全局微交互系统
   ======================================== */

/* Ripple 按钮效果 */
.ripple {
  position: relative;
  overflow: hidden;
}

.ripple::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: width 0.4s ease, height 0.4s ease, opacity 0.4s ease;
}

.ripple:active::after {
  width: 200%;
  height: 200%;
  opacity: 1;
  transition: 0s;
}

/* 控制面板入场 */
.control-panel {
  animation: slide-up 0.4s ease-out 0.15s both;
}

.progress-section {
  animation: slide-up 0.4s ease-out 0.25s both;
}

.writing-panel {
  animation: slide-up 0.4s ease-out 0.35s both;
}

.completed-section {
  animation: slide-up 0.4s ease-out 0.45s both;
}

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 刷新按钮旋转增强 */
.refresh-btn:active svg {
  transition: none;
  transform: rotate(360deg);
}

/* 状态切换平滑过渡 */
.status-icon,
.status-text,
.stroke-name,
.char-pinyin,
.currentStroke {
  transition: all var(--transition-normal);
}

/* 面板提示文字淡入淡出 */
.panel-footer p {
  transition: opacity var(--transition-normal), transform var(--transition-normal);
}

/* 按钮聚焦增强 */
.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.char-btn:focus-visible,
.char-grid-item:focus-visible,
.level-card:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* 滚动条美化 */
.chars-grid-container::-webkit-scrollbar,
.vip-modal-body::-webkit-scrollbar {
  width: 4px;
}

.chars-grid-container::-webkit-scrollbar-track,
.vip-modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.chars-grid-container::-webkit-scrollbar-thumb,
.vip-modal-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.chars-grid-container::-webkit-scrollbar-thumb:hover,
.vip-modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ========================================
   无障碍 - 减少动画模式
   ======================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .container {
    opacity: 1;
    transform: none;
  }

  .control-panel,
  .progress-section,
  .writing-panel,
  .completed-section {
    animation: none;
  }

  .flying-emoji,
  .emoji-animate-element,
  .sparkle {
    display: none;
  }

  .progress-fill::after {
    animation: none;
  }

  .voice-btn.playing {
    animation: none;
  }

  .vip-modal-header {
    animation: none;
    background-size: 100% 100%;
  }

  .vip-buy-btn {
    animation: none;
    background-size: 100% 100%;
  }

  .result-star.earned {
    animation: none;
    opacity: 1;
    transform: scale(1);
  }

  .header-stars .star-count.star-bounce {
    animation: none;
  }
}

/* ========================================
   页面路由与底部导航
   ======================================== */

/* 应用容器 */
.app-container {
  max-width: 500px;
  margin: 0 auto;
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* 页面容器 */
.pages-container {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* 单个页面 */
.page {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 80px; /* 为底部导航留空间 */
  -webkit-overflow-scrolling: touch;
}

.page.active {
  display: flex;
}

/* 练习页 */
#page-practice {
  height: 100%;
  overflow-y: hidden; /* 练习页不滚动 */
}

#page-practice > *:not(.writing-panel) {
  flex-shrink: 0;
}

.writing-panel {
  flex: 1;
  min-height: 0; /* 允许flex子元素滚动 */
}

/* 底部导航栏 */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 500px;
  height: 56px;
  background: var(--bg-card);
  display: flex;
  justify-content: space-around;
  align-items: center;
  box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.06);
  border-top: 1px solid var(--border);
  z-index: 50;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-item {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  transition: color var(--transition-fast);
  padding: 8px 0;
}

.nav-item:active {
  opacity: 0.7;
}

.nav-item.active .nav-icon {
  color: var(--primary);
}

.nav-item.active .nav-label {
  color: var(--primary);
  font-weight: 600;
}

.nav-icon {
  width: 24px;
  height: 24px;
  transition: color var(--transition-fast);
}

.nav-label {
  font-size: 11px;
  font-weight: 400;
  transition: color var(--transition-fast);
}

/* ========================================
   发现页样式
   ======================================== */

/* 打卡统计卡片 */
.streak-stats-section {
  display: flex;
  gap: 12px;
  padding: 16px;
}

.stat-card {
  flex: 1;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.stat-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.stat-info {
  flex: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-value span {
  font-size: 28px;
}

/* 功能入口网格 */
.feature-entries-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 16px;
}

.feature-entry-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-sm);
  position: relative;
}

.feature-entry-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-lighter);
}

.feature-entry-card:active {
  transform: translateY(0);
}

.feature-entry-icon {
  font-size: 32px;
  flex-shrink: 0;
}

.feature-entry-label {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
}

/* ========================================
   用户中心页样式
   ======================================== */

/* 用户信息卡片 */
.user-info-card {
  background: var(--primary-gradient);
  padding: 40px 24px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  position: relative;
}

.user-avatar-large {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 4px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: all var(--transition-normal);
}

.user-avatar-large:active {
  transform: scale(0.95);
}

.user-avatar-emoji-large {
  font-size: 40px;
}

.user-nickname {
  font-size: 20px;
  font-weight: 600;
  color: var(--bg-card);
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.user-nickname:active {
  background: rgba(255, 255, 255, 0.1);
}

.edit-icon {
  opacity: 0.6;
}

.user-days-label {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
}

/* 用户统计 */
.user-stats-section {
  display: flex;
  gap: 4px;
  padding: 16px;
  background: var(--bg-card);
  margin: -16px 16px 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  position: relative;
  z-index: 1;
}

.user-stat-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
}

.user-stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
}

.user-stat-label {
  font-size: 11px;
  color: var(--text-muted);
}

/* VIP状态卡片 */
.vip-status-card {
  margin: 0 16px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.vip-status-active,
.vip-status-locked {
  display: flex;
  align-items: center;
  gap: 12px;
}

.vip-status-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.vip-status-text {
  flex: 1;
}

.vip-status-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.vip-status-expire {
  font-size: 12px;
  color: var(--text-muted);
}

.vip-status-features {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.vip-status-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(245, 166, 35, 0.1);
  padding: 4px 8px;
  border-radius: var(--radius-xs);
}

.vip-status-btn {
  padding: 8px 16px;
  font-size: 13px;
  white-space: nowrap;
}

/* 设置菜单 */
.settings-menu {
  padding: 0 16px;
  margin-bottom: 24px;
}

.settings-group {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background var(--transition-fast);
  width: 100%;
  text-align: left;
}

.settings-item:last-child {
  border-bottom: none;
}

.settings-item:active {
  background: var(--bg-muted);
}

.settings-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.settings-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.settings-label {
  font-size: 14px;
  color: var(--text-primary);
}

.settings-arrow {
  flex-shrink: 0;
  color: var(--text-muted);
}

.settings-item.danger .settings-label {
  color: var(--error);
}

.settings-item.danger .settings-icon {
  filter: hue-rotate(0deg) saturate(1.5);
}

/* ========================================
   头像选择弹窗
   ======================================== */

.avatar-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.avatar-modal.active {
  display: flex;
}

.avatar-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
}

.avatar-content {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 90%;
  max-width: 320px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
}

.avatar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.avatar-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.avatar-close {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
  border: none;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}

.avatar-close:active {
  background: var(--border);
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}

.avatar-option {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
  border: 2px solid transparent;
  font-size: 24px;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-option:hover {
  background: var(--border);
}

.avatar-option.selected {
  border-color: var(--primary);
  background: var(--primary-lighter);
}

.avatar-option:active {
  transform: scale(0.95);
}

/* ========================================
   昵称编辑弹窗
   ======================================== */

.nickname-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.nickname-modal.active {
  display: flex;
}

.nickname-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
}

.nickname-content {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 320px;
  box-shadow: var(--shadow-xl);
}

.nickname-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}

.nickname-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.nickname-close {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
  border: none;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}

.nickname-close:active {
  background: var(--border);
}

.nickname-body {
  padding: 20px;
}

.nickname-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 15px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text-primary);
  margin-bottom: 16px;
  transition: border-color var(--transition-fast);
}

.nickname-input:focus {
  outline: none;
  border-color: var(--primary);
}

.nickname-actions {
  display: flex;
  gap: 12px;
}

.nickname-actions .btn {
  flex: 1;
}

/* ========================================
   关于弹窗
   ======================================== */

.about-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.about-modal.active {
  display: flex;
}

.about-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
}

.about-content {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 320px;
  box-shadow: var(--shadow-xl);
}

.about-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}

.about-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.about-close {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
  border: none;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}

.about-close:active {
  background: var(--border);
}

.about-body {
  padding: 32px 24px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.about-logo {
  font-size: 56px;
  margin-bottom: 16px;
}

.about-app-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.about-version {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.about-description {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 24px;
}

.about-ok-btn {
  width: 100%;
}

/* ========================================
   确认弹窗
   ======================================== */

.confirm-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.confirm-modal.active {
  display: flex;
}

.confirm-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
}

.confirm-content {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 300px;
  box-shadow: var(--shadow-xl);
}

.confirm-body {
  padding: 32px 24px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.confirm-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.confirm-message {
  font-size: 15px;
  color: var(--text-primary);
  line-height: 1.6;
  margin-bottom: 24px;
}

.confirm-actions {
  display: flex;
  gap: 12px;
  width: 100%;
}

.confirm-actions .btn {
  flex: 1;
}

/* ========================================
   Header用户头像按钮
   ======================================== */

.user-avatar-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--bg-muted);
  border: 2px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.user-avatar-btn:active {
  transform: scale(0.95);
}

.user-avatar-emoji {
  font-size: 24px;
}

/* ========================================
   响应式调整
   ======================================== */

@media (max-height: 700px) {
  .user-info-card {
    padding: 32px 20px 24px;
  }

  .user-avatar-large {
    width: 60px;
    height: 60px;
  }

  .user-avatar-emoji-large {
    font-size: 34px;
  }

  .user-nickname {
    font-size: 18px;
  }
}
