/* common.css — 全站基础样式与变量 */

:root {
  /* ---- 主色 (UI V3:浅蓝马卡龙,对齐《汉字乐园》设计文档 #E8F2FE 底 / #1668D6 专注蓝) ---- */
  --color-primary: #1668D6;
  --color-primary-dark: #0F5BB5;
  --color-primary-light: #E3F1FE;

  /* ---- 辅助色(每个练习模式一个专属色,色相拉开便于儿童辨识) ---- */
  --color-green: #12B886;      /* 答对 · 写字/拼字 */
  --color-green-light: #DFF7EF;
  --color-orange: #FF922B;     /* 暖强调 */
  --color-orange-light: #FFF1DE;
  --color-red: #E8384F;        /* 答错 · 错字库 */
  --color-red-light: #FFE3E6;
  --color-blue: #3E9BF0;       /* 信息 · 自测书写 */
  --color-blue-light: #E3F1FE;
  --color-yellow: #FFC53D;     /* 提醒 */
  --color-yellow-light: #FFF6E0;
  --color-purple: #845EF7;     /* 气泡拼字 */
  --color-purple-light: #EEE9FE;
  --color-cyan: #22B8CF;       /* 拼音消消乐 */
  --color-cyan-light: #D9F3F8;

  /* 文字 */
  --color-text: #333333;
  --color-text-sub: #666666;
  --color-text-light: #999999;
  --color-text-on-primary: #FFFFFF;

  /* 背景 */
  --color-bg: #E8F2FE;
  --color-bg-card: #FFFFFF;
  --color-bg-section: #DCEBFA;

  /* 边框/分割 */
  --color-border: #D5E5F5;
  --color-divider: #E3EEF9;

  /* 语义色:对错提醒(护眼模式下会被柔和色覆盖) */
  --color-right: #12B886;       /* 答对 */
  --color-wrong: #E8384F;       /* 答错 */
  --color-warn: #FFC53D;        /* 提醒 */
  --color-info: #3E9BF0;        /* 信息 */

  /* 气泡色板(用于气泡拼字) */
  --bubble-1: #FFB3BA;
  --bubble-2: #FFDFBA;
  --bubble-3: #FFFFBA;
  --bubble-4: #BAFFC9;
  --bubble-5: #BAE1FF;
  --bubble-6: #E0BBE4;

  /* 阴影 */
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-bubble: 0 6px 20px rgba(0, 0, 0, 0.12);

  /* 按钮“厚度”阴影(按压时收掉,形成下沉手感;平板无 hover,靠按压反馈) */
  --shadow-btn-primary: 0 3px 0 var(--color-primary-dark);
  --shadow-btn-secondary: 0 3px 0 #D6E6F8;
  --shadow-btn-danger: 0 3px 0 #C0263C;
  --shadow-btn-success: 0 3px 0 #0B966B;

  /* 圆角 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  /* 字号 */
  --fs-xs: 12px;
  --fs-sm: 14px;
  --fs-base: 16px;
  --fs-md: 18px;
  --fs-lg: 22px;
  --fs-xl: 28px;
  --fs-2xl: 36px;
  --fs-3xl: 48px;
  --fs-char: 96px;

  /* 间距 */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;

  /* 动画 */
  --t-fast: 120ms ease;
  --t-base: 220ms ease;
  --t-slow: 360ms ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
               "Hiragino Sans GB", "Heiti SC", sans-serif;
  font-size: var(--fs-base);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.3s ease, color 0.3s ease;
  min-height: 100vh;
  user-select: none;
  /* 阻止书写时误触发浏览器下拉刷新 */
  overscroll-behavior-y: contain;
}

button {
  font: inherit;
  color: inherit;
  border: none;
  background: none;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

input, textarea { font: inherit; }

/* 通用布局 */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--sp-4);
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== 顶部状态栏(所有练习页统一) ===== */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  background: var(--color-bg-card);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 50;
}

.status-bar__left,
.status-bar__right {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.status-bar__btn {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
  color: var(--color-text);
  background: var(--color-bg);
  transition: all var(--t-fast);
}

.status-bar__btn:hover { background: var(--color-primary-light); }
.status-bar__btn--active { background: var(--color-primary); color: white; }

.status-bar__progress {
  font-weight: 600;
  color: var(--color-text);
  font-size: var(--fs-sm);
}

.status-bar__timer {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-3);
  background: var(--color-orange-light);
  border-radius: var(--radius-pill);
  color: var(--color-orange);
  font-weight: 600;
  font-size: var(--fs-sm);
}

.status-bar__score {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-3);
  background: var(--color-green-light);
  border-radius: var(--radius-pill);
  color: var(--color-green);
  font-weight: 600;
  font-size: var(--fs-sm);
}

/* ===== 通用卡片 ===== */
.card {
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
  transition: all var(--t-base);
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card--clickable { cursor: pointer; }

/* ===== 按钮 (UI V2) =====
 * 尺寸:L 52px(主行动/页尾 CTA) · M 44px(默认,≥44 触控标准) · S 36px(次要/密集区)
 * 变体:primary(每屏仅一个) · secondary(浅主色底) · outline(白底描边) · danger(破坏性)
 * 按压:缩 0.96 + 厚度阴影收掉 = “按下去”的手感(平板无 hover,必须靠按压反馈)
 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 44px;
  padding: 0 var(--sp-5);
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: var(--fs-base);
  transition: transform var(--t-fast), box-shadow var(--t-fast),
              background-color var(--t-fast), color var(--t-fast), opacity var(--t-fast);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.btn .hz-icon { flex: none; }

.btn--l, .btn--lg { min-height: 52px; padding: 0 var(--sp-6); font-size: var(--fs-md); }
.btn--m         { min-height: 44px; padding: 0 var(--sp-5); font-size: var(--fs-base); }
.btn--s, .btn--sm { min-height: 36px; padding: 0 var(--sp-4); font-size: var(--fs-sm); }

.btn--primary   { background: var(--color-primary); color: #fff; box-shadow: var(--shadow-btn-primary); }
.btn--secondary { background: var(--color-primary-light); color: var(--color-primary-dark); box-shadow: var(--shadow-btn-secondary); }
.btn--outline   { background: var(--color-bg-card); color: var(--color-primary); border: 2px solid var(--color-primary); }
.btn--danger    { background: var(--color-red); color: #fff; box-shadow: var(--shadow-btn-danger); }
.btn--success   { background: var(--color-green); color: #fff; box-shadow: var(--shadow-btn-success); }
.btn--ghost     { background: var(--color-bg); color: var(--color-text); }

.btn:active { transform: scale(0.96); box-shadow: none; }
.btn--primary:hover { background: var(--color-primary-dark); }
.btn--outline:active { background: var(--color-primary-light); }

.btn[disabled], .btn--disabled { opacity: 0.45; box-shadow: none; pointer-events: none; }
.btn--block { width: 100%; }

/* 纯图标按钮(返回 / 朗读 / 护眼 / 家长设置):44px 圆形触控区 */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 44px; height: 44px;
  border-radius: var(--radius-pill);
  background: var(--color-bg);
  color: var(--color-text-sub);
  transition: transform var(--t-fast), background-color var(--t-fast), color var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}
.btn-icon:active { transform: scale(0.94); background: var(--color-primary-light); color: var(--color-primary-dark); }
.btn-icon--l { width: 52px; height: 52px; }
.btn-icon--s { width: 36px; height: 36px; }
.btn-icon--on { background: var(--color-primary); color: #fff; }
.btn-icon--on:active { background: var(--color-primary-dark); color: #fff; }

/* ===== SVG 图标容器 (js/icons.js) ===== */
.hz-ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  line-height: 0;
  color: inherit;
}
.hz-ic > svg, svg.hz-icon { display: block; }
/* 放在彩色圆底上的图标(模式入口 / 主卡片 / 安装横幅)统一转白 */
.hz-ic--on-color { color: #fff; }
/* 图标与文字混排时的默认间距 */
.btn .hz-ic + span:not(:empty), .btn span + .hz-ic { margin-left: 0; }

/* ===== 标签 chip ===== */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 2px var(--sp-2);
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: 500;
  background: var(--color-bg);
  color: var(--color-text-sub);
}
.chip--success { background: var(--color-green-light); color: var(--color-green); }
.chip--danger  { background: var(--color-red-light);  color: var(--color-red);  }
.chip--warning { background: var(--color-orange-light); color: var(--color-orange); }
.chip--info    { background: var(--color-blue-light);  color: var(--color-blue);  }
.chip--purple  { background: var(--color-primary-light); color: var(--color-primary); }

/* ===== 模态弹窗 ===== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  opacity: 0; pointer-events: none;
  transition: opacity var(--t-base);
}
.modal-backdrop--show { opacity: 1; pointer-events: auto; }
.modal {
  background: white;
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  max-width: 90%;
  width: 420px;
  box-shadow: var(--shadow-lg);
  transform: scale(0.9);
  transition: transform var(--t-base);
}
.modal-backdrop--show .modal { transform: scale(1); }
.modal__title { font-size: var(--fs-lg); font-weight: 700; margin-bottom: var(--sp-3); }
.modal__content { color: var(--color-text-sub); margin-bottom: var(--sp-5); line-height: 1.6; }
.modal__actions { display: flex; gap: var(--sp-3); justify-content: flex-end; }

/* ===== Toast 提示 ===== */
.toast {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--radius-md);
  font-size: var(--fs-md);
  font-weight: 600;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: all var(--t-base);
}
.toast--show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* ===== 拼音样式 ===== */
.pinyin {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.4em;
  color: var(--color-text-sub);
  font-weight: 400;
  margin-right: 0.1em;
  letter-spacing: 0.05em;
}

.hanzi-with-pinyin {
  display: inline-flex;
  align-items: flex-end;
  gap: 0.1em;
}
.hanzi-with-pinyin .pinyin {
  align-self: flex-start;
  margin-bottom: 0.5em;
}

/* ===== 网格布局 ===== */
.grid {
  display: grid;
  gap: var(--sp-4);
}
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.grid--6 { grid-template-columns: repeat(6, 1fr); }

@media (max-width: 768px) {
  .grid--4 { grid-template-columns: repeat(3, 1fr); }
  .grid--6 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 480px) {
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .grid--6 { grid-template-columns: repeat(3, 1fr); }
}

/* ===== 通用工具类 ===== */
.text-center { text-align: center; }
.text-sub { color: var(--color-text-sub); }
.text-light { color: var(--color-text-light); }
.font-bold { font-weight: 700; }
.mt-1 { margin-top: var(--sp-1); } .mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); } .mt-4 { margin-top: var(--sp-4); }
.mt-5 { margin-top: var(--sp-5); } .mt-6 { margin-top: var(--sp-6); }
.mb-1 { margin-bottom: var(--sp-1); } .mb-2 { margin-bottom: var(--sp-2); }
.mb-3 { margin-bottom: var(--sp-3); } .mb-4 { margin-bottom: var(--sp-4); }
.mb-5 { margin-bottom: var(--sp-5); } .mb-6 { margin-bottom: var(--sp-6); }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: var(--sp-2); } .gap-3 { gap: var(--sp-3); } .gap-4 { gap: var(--sp-4); }

/* ===== 动效 ===== */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}
@keyframes pop {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.animate-shake { animation: shake 0.4s ease; }
.animate-pop { animation: pop 0.4s ease; }
.animate-fade-in { animation: fadeIn 0.4s ease; }
.animate-float { animation: float 2.5s ease-in-out infinite; }

/* ===== 拼音标注模式 ===== */
.with-pinyin {
  position: relative;
  display: inline-block;
  text-align: center;
}
.with-pinyin .pinyin {
  position: absolute;
  top: -1em;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}

/* ===== PWA 更新提示 Toast ===== */
.pwa-update-toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%) translateY(20px);
  background: var(--color-primary);
  color: white;
  padding: 10px 16px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
}
.pwa-update-toast--show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.pwa-update-toast__btn:disabled {
  opacity: 0.65;
  cursor: default;
}
.pwa-update-toast__btn {
  background: white;
  color: var(--color-primary);
  border: none;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}



/* ============================================================
 * 护眼模式 — 设计规范实现
 * 见 SPEC: 暖浅护眼 + 柔和暗护眼 两套主题
 * 设计目标:降低蓝光、控制对比度、减少频闪、保留语义色
 * ============================================================ */

/* === 暖浅护眼(主推:日常学习/刷题/阅读) === */
:root.theme-eye-protect {
  --page-bg: #F7F3E7;
  --card-bg: #FBF8F0;
  --text-title: #3A3730;
  --text-body: #4B4840;
  --text-tip: #747066;
  --border-color: #DCD6C6;
  --hover-bg: #ECE7D7;
  --selected-bg: #E3DDCC;

  /* 覆盖默认变量,让所有组件自动跟随主题 */
  --color-bg: #F7F3E7;
  --color-bg-card: #FBF8F0;
  --color-bg-section: #ECE7D7;
  --color-text: #4B4840;            /* 正文色 4.5:1+ 对比度 */
  --color-text-sub: #747066;
  --color-text-light: #9C968A;
  --color-border: #DCD6C6;
  --color-divider: #E5E0D0;

  /* 语义色降饱和 */
  --color-green: #488C64;             /* 答对:低饱墨绿 */
  --color-green-light: #DCE9E0;
  --color-red: #B85448;               /* 答错:砖红,非亮红 */
  --color-red-light: #F2D9D6;
  --color-orange: #C99446;            /* 提醒:暖棕黄 */
  --color-orange-light: #EFE5D2;
  --color-yellow: #C99446;
  --color-yellow-light: #EFE5D2;
  --color-blue: #4A7294;              /* 信息:低饱灰蓝 */
  --color-blue-light: #DEE5EC;
  --color-purple: #6E5B8E;            /* 紫色降饱和 */
  --color-purple-light: #E4DFEC;
  --color-cyan: #3E8C9E;
  --color-cyan-light: #DDE8EB;
  --color-primary: #C0654A;           /* 主色:暖橙降饱和,仍保持品牌辨识 */
  --color-primary-dark: #A6543C;
  --color-primary-light: #F5E4DD;

  /* 按钮厚度阴影同步柔和化 */
  --shadow-btn-primary: 0 3px 0 #A6543C;
  --shadow-btn-secondary: 0 3px 0 #E3CDC4;
  --shadow-btn-danger: 0 3px 0 #96433A;
  --shadow-btn-success: 0 3px 0 #3C7657;

  /* 阴影更柔和 */
  --shadow-sm: 0 1px 3px rgba(80, 60, 30, 0.06);
  --shadow-md: 0 4px 12px rgba(80, 60, 30, 0.08);
  --shadow-lg: 0 8px 24px rgba(80, 60, 30, 0.10);

  /* 语义色别名(供组件级 --color-right/--color-wrong 使用) */
  --color-right: #488C64;
  --color-wrong: #B85448;
  --color-warn: #C99446;
  --color-info: #4A7294;
}

/* === 柔和暗护眼(夜间模式:仅睡前短时阅读,不建议做题) === */
:root.theme-eye-dark {
  --page-bg: #33302D;
  --card-bg: #3D3A36;
  --text-title: #E4E0D8;
  --text-body: #D0CCC2;
  --text-tip: #969084;
  --border-color: #54504A;
  --hover-bg: #48443F;
  --selected-bg: #504A44;

  --color-bg: #33302D;
  --color-bg-card: #3D3A36;
  --color-bg-section: #2D2A28;
  --color-text: #D0CCC2;
  --color-text-sub: #A8A298;
  --color-text-light: #7E7A72;
  --color-text-on-primary: #33302D;
  --color-border: #54504A;
  --color-divider: #48443F;

  --color-green: #68B084;
  --color-green-light: #3D4D44;
  --color-red: #D66B60;
  --color-red-light: #4D3D3A;
  --color-orange: #D8A862;
  --color-orange-light: #4D4438;
  --color-yellow: #D8A862;
  --color-yellow-light: #4D4438;
  --color-blue: #6892BC;
  --color-blue-light: #3A434F;
  --color-purple: #9682B8;
  --color-purple-light: #423B57;
  --color-cyan: #57A7BC;
  --color-cyan-light: #37474D;
  --color-primary: #FF9070;
  --color-primary-dark: #E8704F;
  --color-primary-light: #4A332E;

  --shadow-btn-primary: 0 3px 0 #C25E44;
  --shadow-btn-secondary: 0 3px 0 #5C3F39;
  --shadow-btn-danger: 0 3px 0 #A54B4B;
  --shadow-btn-success: 0 3px 0 #4E8B69;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.6);

  --color-right: #68B084;
  --color-wrong: #D66B60;
  --color-warn: #D8A862;
  --color-info: #6892BC;
}

/* === 通用:护眼主题下,所有硬编码 white 卡片自动跟随主题 === */
/* 使用高特异性 + !important 覆盖组件 CSS 中的 background: white */
.theme-eye-protect .home,
.theme-eye-protect .quick-grid,
.theme-eye-protect .main-card,
.theme-eye-protect .lesson-card,
.theme-eye-protect .grade-card,
.theme-eye-protect .modal,
.theme-eye-protect .practice__main,
.theme-eye-protect .wronglib,
.theme-eye-protect .toast,
.theme-eye-protect .status-bar,
.theme-eye-protect .eye-toggle,
.theme-eye-protect .card,
.theme-eye-protect .ss-component,
.theme-eye-protect .bubble,
.theme-eye-protect .quick-card,
.theme-eye-protect .pm-tile,
.theme-eye-protect .pm-tile--char,
.theme-eye-protect .pm-tile--pinyin,
.theme-eye-protect .wrong-item,
.theme-eye-protect canvas {
  background-color: var(--card-bg) !important;
  border-color: var(--border-color) !important;
}
.theme-eye-dark .home,
.theme-eye-dark .quick-grid,
.theme-eye-dark .main-card,
.theme-eye-dark .lesson-card,
.theme-eye-dark .grade-card,
.theme-eye-dark .modal,
.theme-eye-dark .practice__main,
.theme-eye-dark .wronglib,
.theme-eye-dark .toast,
.theme-eye-dark .status-bar,
.theme-eye-dark .eye-toggle,
.theme-eye-dark .card,
.theme-eye-dark .ss-component,
.theme-eye-dark .bubble,
.theme-eye-dark .quick-card,
.theme-eye-dark .pm-tile,
.theme-eye-dark .pm-tile--char,
.theme-eye-dark .pm-tile--pinyin,
.theme-eye-dark .wrong-item,
.theme-eye-dark canvas {
  background-color: var(--card-bg) !important;
  border-color: var(--border-color) !important;
  color: var(--text-body) !important;
}

/* === 暗色模式下文字色调调整 === */
.theme-eye-dark .home__title,
.theme-eye-dark .home__slogan,
.theme-eye-dark .home__author,
.theme-eye-dark .quick-item__label,
.theme-eye-dark .main-card__title,
.theme-eye-dark .lesson-card__title,
.theme-eye-dark .grade-card__label,
.theme-eye-dark .modal__title,
.theme-eye-dark .practice__title,
.theme-eye-dark .wronglib__title {
  color: var(--text-title) !important;
}
.theme-eye-dark .footer {
  color: var(--text-tip) !important;
}

/* === 护眼主题下:动画降速 / 关闭闪烁 === */
.theme-eye-protect *,
.theme-eye-dark * {
  animation-duration: 0.4s !important;
  transition-duration: 0.3s !important;
}
/* 关闭高对比度闪烁动画(shake / pulse / matchPop) */
.theme-eye-protect .animate-shake,
.theme-eye-protect .animate-pop,
.theme-eye-dark .animate-shake,
.theme-eye-dark .animate-pop {
  animation: none !important;
}
.theme-eye-protect .bubble {
  animation: none !important;
}
.theme-eye-dark .bubble {
  animation: none !important;
}

/* ============================================================
 * 家长设置 · 顶部按钮(与护眼模式同一行)
 * ============================================================ */
.parental-toggle {
  position: relative;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: rgba(255, 255, 255, 0.7);
  color: var(--color-text-sub);
  border: 1px solid var(--color-border);
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all var(--t-base);
}
.parental-toggle:hover {
  background: white;
  transform: scale(1.08);
  border-color: var(--color-text-light);
}
.parental-toggle--active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
  box-shadow: 0 2px 8px rgba(88, 86, 229, 0.3);
}
.parental-toggle__icon {
  font-size: 18px;
  line-height: 1;
}
.parental-toggle__badge {
  position: absolute;
  top: -6px;
  right: -10px;
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  background: var(--color-green);
  color: white;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  white-space: nowrap;
}
.parental-toggle__badge--hidden { display: none; }

/* ============================================================
 * 家长设置 · 设置弹窗(数字输入)
 * ============================================================ */
.modal--parental {
  width: 460px;
  max-width: 92vw;
}
.parental-field {
  display: block;
  margin-bottom: 14px;
  padding: 12px 14px;
  background: var(--color-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-divider);
}
.parental-field__label {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 2px;
}
.parental-field__hint {
  display: block;
  font-size: 12px;
  color: var(--color-text-light);
  margin-bottom: 8px;
}
.parental-field__input {
  display: flex;
  align-items: center;
  gap: 8px;
}
.parental-field__input input {
  flex: 1;
  padding: 8px 12px;
  font-size: 16px;
  font-weight: 600;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  outline: none;
  transition: border-color var(--t-fast);
  -moz-appearance: textfield;
}
.parental-field__input input::-webkit-outer-spin-button,
.parental-field__input input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.parental-field__input input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}
.parental-field__unit {
  font-size: 13px;
  color: var(--color-text-sub);
  font-weight: 500;
}
.parental-warning {
  padding: 10px 12px;
  background: var(--color-orange-light);
  color: var(--color-orange);
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 12px;
  line-height: 1.5;
}
.parental-warning--hidden { display: none; }

.parental-presets {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  padding: 10px 12px;
  background: var(--color-bg-section);
  border-radius: var(--radius-sm);
}
.parental-presets__label {
  font-size: 12px;
  color: var(--color-text-light);
  margin-right: 4px;
}
.parental-preset {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-text-sub);
  cursor: pointer;
  transition: all var(--t-fast);
}
.parental-preset:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-color: var(--color-primary-light);
}

/* ============================================================
 * 家长设置 · 全屏锁屏倒计时
 * ============================================================ */
.parental-lock {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(20, 18, 14, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: parentalLockFadeIn 0.3s ease;
  /* 禁止文字选中 */
  user-select: none;
  -webkit-user-select: none;
}
@keyframes parentalLockFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.parental-lock__content {
  text-align: center;
  color: #F5EFE2;
  max-width: 420px;
}
.parental-lock__icon {
  font-size: 72px;
  margin-bottom: 16px;
  animation: parentalLockPulse 1.6s ease-in-out infinite;
}
@keyframes parentalLockPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.08); }
}
.parental-lock__title {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 14px;
  letter-spacing: 0.05em;
}
.parental-lock__text {
  font-size: 16px;
  line-height: 1.7;
  opacity: 0.85;
  margin-bottom: 24px;
}
.parental-lock__countdown {
  font-size: 80px;
  font-weight: 900;
  font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
  letter-spacing: 0.1em;
  color: #FFC93C;
  text-shadow: 0 0 24px rgba(255, 201, 60, 0.4);
  margin: 20px 0;
  line-height: 1;
}
.parental-lock__hint {
  font-size: 13px;
  opacity: 0.6;
  margin-top: 8px;
}

/* ============================================================
 * 横屏通用适配(平板/手机横屏)
 * ============================================================ */
/* 手机横屏: 状态栏压缩, 释放纵向空间 */
@media (orientation: landscape) and (max-height: 500px) {
  .status-bar { padding: 6px 12px; }
  .status-bar__btn { padding: 4px 10px; font-size: 12px; gap: 2px; }
  .status-bar__progress,
  .status-bar__timer,
  .status-bar__score { padding: 2px 8px; font-size: 12px; }
}

/* ============================================================
 * "请横屏"轻提示(浏览器不允许锁方向时的兜底)
 * ============================================================ */
.rotate-hint {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 12px);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: 14px;
  border-radius: var(--radius-pill, 999px);
  box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,.2));
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease, transform .3s ease;
  z-index: 9999;
}
.rotate-hint--show { opacity: 1; transform: translate(-50%, 0); }
.rotate-hint__icon { font-size: 18px; animation: rotate-hint-turn 1.6s ease-in-out infinite; }
@keyframes rotate-hint-turn {
  0%, 40%   { transform: rotate(0deg); }
  60%, 100% { transform: rotate(90deg); }
}
