/* ========== 基础 ========== */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  font-family: "Comic Sans MS", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: linear-gradient(160deg, #fff6d5 0%, #ffe3ec 50%, #d9f3ff 100%);
  color: #3a3a3a;
  user-select: none;
  overflow-x: hidden;
}

button { font-family: inherit; border: none; cursor: pointer; }
/* 全局：hidden 属性必须能盖过 .report-btn/.modal 等带 display 的作者样式，否则设了 hidden 仍会显示 */
[hidden] { display: none !important; }
button:active { transform: scale(0.94); }

/* ========== 顶部栏 ========== */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}
.title { position: absolute; left: 50%; transform: translateX(-50%); font-size: 1.5rem; color: #ff6f61; letter-spacing: 1px; }
.icon-btn {
  font-size: 1.8rem; background: #fff; border-radius: 50%;
  width: 48px; height: 48px; box-shadow: 0 3px 0 #e0e0e0;
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none; color: inherit;
}
.icon-btn.small { width: 40px; height: 40px; font-size: 1.3rem; opacity: 0.6; }
.icon-btn.small:hover { opacity: 1; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; padding: 4px 12px 4px 6px; border-radius: 999px;
  box-shadow: 0 3px 0 #e0e0e0; font-size: 1rem; font-weight: bold; color: #555;
}
.user-chip[hidden] { display: none; }
.user-avatar { font-size: 1.5rem; line-height: 1; }
.user-name { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stars-inline { color: #f5a623; margin-left: 4px; }
.stars {
  font-size: 1.2rem; font-weight: bold; color: #f5a623;
  background: #fff; padding: 6px 14px; border-radius: 999px;
  box-shadow: 0 3px 0 #e0e0e0;
}

/* ========== 页面切换 ========== */
.screen { display: none; padding: 20px 16px 40px; max-width: 900px; margin: 0 auto; }
.screen.active { display: block; animation: fadeIn 0.35s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.hint { text-align: center; font-size: 1.2rem; margin-bottom: 18px; color: #666; }
.hint.big { font-size: 1.6rem; color: #ff6f61; font-weight: bold; margin: 20px 0 28px; }

/* ========== 选择小朋友 ========== */
.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 18px; max-width: 760px; margin: 0 auto;
}
.profile-card {
  background: #fff; border-radius: 28px; padding: 22px 10px 16px; text-align: center;
  box-shadow: 0 6px 0 #e6e6e6; transition: transform 0.15s;
}
.profile-card:hover { transform: translateY(-4px); }
.profile-card .p-avatar { font-size: 4rem; line-height: 1.1; }
.profile-card .p-name { font-size: 1.3rem; font-weight: bold; margin-top: 8px; color: #444; }
.profile-card .p-stars { font-size: 1rem; color: #f5a623; margin-top: 4px; }
.profile-card.add { background: rgba(255,255,255,0.6); border: 3px dashed #ffb3a7; box-shadow: none; color: #ff6f61; }
.profile-card.add .p-avatar { color: #ff6f61; }

/* ========== 弹窗 ========== */
.modal {
  position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,0.35);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal[hidden] { display: none; }
.modal-card {
  background: #fff; border-radius: 28px; padding: 26px 22px; width: 100%; max-width: 460px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.2); animation: pop 0.3s ease;
}
.modal-card h2 { text-align: center; color: #ff6f61; margin-bottom: 14px; }
.modal-label { display: block; font-size: 1rem; color: #777; margin: 12px 0 8px; }
.modal-card input {
  width: 100%; font-size: 1.3rem; padding: 10px 14px; border-radius: 14px;
  border: 2px solid #eee; font-family: inherit; margin-bottom: 18px;
}
.modal-card input:focus { outline: none; border-color: #4a90e2; }

/* 朗读语速滑块 */
.rate-row { display: flex; align-items: center; gap: 12px; margin: 6px 0 4px; }
.rate-row .rate-cap { font-size: 1.4rem; flex-shrink: 0; }
.modal-card input[type="range"] {
  flex: 1; width: auto; margin: 0; padding: 0; height: 28px; border: none; background: transparent;
  -webkit-appearance: none; appearance: none; cursor: pointer;
}
.modal-card input[type="range"]:focus { outline: none; }
.modal-card input[type="range"]::-webkit-slider-runnable-track { height: 8px; border-radius: 999px; background: #e8edf5; }
.modal-card input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 26px; height: 26px; margin-top: -9px;
  border-radius: 50%; background: #ff6f61; border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.modal-card input[type="range"]::-moz-range-track { height: 8px; border-radius: 999px; background: #e8edf5; }
.modal-card input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: #ff6f61; border: 3px solid #fff; }
.rate-value { text-align: center; font-size: 1.1rem; color: #666; margin: 12px 0 18px; }
.rate-value b { color: #ff6f61; font-size: 1.3rem; }
.avatar-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.avatar-opt {
  font-size: 1.8rem; background: #f7f7f7; border-radius: 12px; padding: 6px 0; line-height: 1.2;
}
.avatar-opt.selected { background: #ffe3ec; box-shadow: 0 0 0 3px #ff6f61 inset; }

/* ========== 分类卡 ========== */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}
.category-card {
  background: var(--c, #fff);
  border-radius: 24px;
  padding: 22px 10px;
  text-align: center;
  color: #fff;
  box-shadow: 0 6px 0 rgba(0,0,0,0.15);
  transition: transform 0.15s;
}
.category-card:hover { transform: translateY(-4px); }
.category-card .cat-emoji { font-size: 3.5rem; line-height: 1; }
.category-card .cat-name { font-size: 1.3rem; font-weight: bold; margin-top: 10px; }
.category-card .cat-zh { font-size: 1rem; opacity: 0.9; }
.category-card .cat-progress {
  margin-top: 10px; height: 8px; background: rgba(255,255,255,0.35); border-radius: 999px; overflow: hidden;
}
.category-card .cat-progress > span { display: block; height: 100%; background: #fff; border-radius: 999px; transition: width 0.4s; }
.category-card .cat-meta { font-size: 0.85rem; opacity: 0.95; margin-top: 4px; }

/* ========== 单词卡 ========== */
.flashcard {
  position: relative;
  background: #fff;
  border-radius: 32px;
  padding: 30px 20px 90px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  min-height: 360px;
  animation: pop 0.35s ease;
}
@keyframes pop { 0% { transform: scale(0.85); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.card-emoji { font-size: 9rem; line-height: 1.2; }
/* 单词配图常带透明留白，同样 1em 下视觉比 Emoji 显小：单独把图片放大到 1.4em（!important 覆盖 renderPic 内联的 max-height:1em），Emoji 文字尺寸不变 */
.card-emoji img, .quiz-option img { max-height: 1.4em !important; }
.card-word { font-size: 3.2rem; font-weight: bold; color: #ff6f61; margin-top: 8px; text-transform: lowercase; }
.card-zh { font-size: 1.6rem; color: #777; margin-top: 4px; }
.card-sentence { font-size: 1.2rem; color: #4a90e2; margin-top: 10px; cursor: pointer; }
.card-sentence:hover { text-decoration: underline; }
.card-sentence-zh { font-size: 1rem; color: #999; margin-top: 4px; }

.speak-btn {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  width: 64px; height: 64px; border-radius: 50%;
  background: #4a90e2; color: #fff; font-size: 2rem;
  box-shadow: 0 5px 0 #2f6cb3;
}
.speak-btn:active { transform: translateX(-50%) scale(0.94); }
.speak-btn.speaking { animation: pulse 0.6s infinite alternate; }
@keyframes pulse { to { box-shadow: 0 5px 0 #2f6cb3, 0 0 0 14px rgba(74,144,226,0.25); } }

.speak-btn.large { position: static; transform: none; width: 90px; height: 90px; font-size: 2.8rem; }
.speak-btn.large:active { transform: scale(0.94); }

/* 图文不符上报：卡片右上角带文字的胶囊按钮，白底描边保证压在图上也能看清 */
.report-btn {
  position: absolute; right: 12px; top: 12px;
  height: 32px; padding: 0 12px; border-radius: 999px;
  background: rgba(255,255,255,0.92); color: #d1495b; font-size: 0.92rem; font-weight: 600; line-height: 1;
  display: inline-flex; align-items: center; gap: 5px;
  box-shadow: 0 1px 5px rgba(0,0,0,0.18);
}
.report-btn:hover { background: #fff; }
.report-btn:active { transform: scale(0.94); }
.report-btn[disabled] { opacity: 0.55; cursor: default; }

/* 轻提示 toast */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  max-width: 88vw; padding: 12px 20px; border-radius: 999px;
  background: rgba(0,0,0,0.82); color: #fff; font-size: 1.05rem; text-align: center;
  z-index: 999; box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  animation: toast-in 0.2s ease;
}
.toast.error { background: rgba(231,76,60,0.95); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* 进度点 */
.dots { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin: 16px 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #ddd; }
.dot.active { background: #ff6f61; transform: scale(1.3); }
.dot.done { background: #f5a623; }

/* 按钮 */
.nav-row { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.big-btn {
  font-size: 1.2rem; font-weight: bold; color: #fff;
  padding: 14px 22px; border-radius: 999px;
  box-shadow: 0 5px 0 rgba(0,0,0,0.2);
  min-width: 120px;
}
.big-btn.purple { background: #9b59b6; }
.big-btn.green  { background: #2ecc71; }
.big-btn.orange { background: #ff9f43; }

/* ========== 游戏 ========== */
.quiz-question { text-align: center; margin-bottom: 24px; }
.quiz-prompt { font-size: 1.4rem; margin-top: 12px; color: #555; }
.quiz-word { font-weight: bold; color: #ff6f61; font-size: 1.8rem; }

.quiz-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  max-width: 560px; margin: 0 auto;
}
.quiz-option {
  background: #fff; border-radius: 28px;
  font-size: 5.5rem; line-height: 1.4;
  padding: 20px 10px;
  box-shadow: 0 6px 0 #ddd;
  transition: transform 0.15s, background 0.2s;
}
.quiz-option:hover { transform: translateY(-4px); }
.quiz-option.correct { background: #c8f7c5; box-shadow: 0 6px 0 #2ecc71; animation: bounce 0.5s; }
.quiz-option.wrong   { background: #ffd6d6; box-shadow: 0 6px 0 #e74c3c; animation: shake 0.4s; }
.quiz-option:disabled { cursor: default; }
@keyframes bounce { 0%,100% { transform: scale(1); } 50% { transform: scale(1.15); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-10px); } 75% { transform: translateX(10px); } }

.quiz-progress { text-align: center; margin-top: 24px; font-size: 1.4rem; font-weight: bold; color: #f5a623; }

/* ========== 结果 ========== */
.result-card {
  background: #fff; border-radius: 32px; padding: 40px 20px; text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}
.result-emoji { font-size: 7rem; animation: bounce 1s infinite; }
.result-card h2 { font-size: 2.2rem; color: #ff6f61; margin: 10px 0; }
.result-card p { font-size: 1.4rem; color: #666; margin-bottom: 24px; }
.result-record { color: #ff6f61 !important; font-weight: bold; animation: bounce 0.8s infinite; }
.result-record[hidden] { display: none; }

/* ========== 彩带 ========== */
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 99; }

/* ========== 小屏适配 ========== */
@media (max-width: 480px) {
  .card-emoji { font-size: 6.5rem; }
  .card-word { font-size: 2.6rem; }
  .quiz-option { font-size: 4rem; }
  .big-btn { min-width: 100px; padding: 12px 16px; font-size: 1.05rem; }
  .title { font-size: 1.2rem; }
  .user-name { display: none; }
  .avatar-grid { grid-template-columns: repeat(6, 1fr); }
}

/* ========== ICP 备案页脚 ========== */
.icp { text-align: center; font-size: 0.78rem; color: #9aa4b0; padding: 10px 0 16px; }
.icp a { color: inherit; text-decoration: none; }
.icp a:hover { text-decoration: underline; }
