/* 口语小伙伴 - 儿童友好界面 */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

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

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: linear-gradient(160deg, #FFF7E0 0%, #E3F4FF 55%, #EAFEED 100%);
  color: #333;
  font-size: 17px;
}

#app { max-width: 760px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; padding: 0 16px 24px; }
.hidden { display: none !important; }

/* ---------- header ---------- */
header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 4px;
  position: sticky; top: 0; z-index: 10;
  background: linear-gradient(160deg, #FFF7E0 0%, #E3F4FF 90%);
}
.header-title { flex: 1; font-size: 22px; font-weight: 700; color: #2B6CB0; }
.header-stars {
  background: #fff; border-radius: 999px; padding: 6px 14px;
  font-weight: 700; color: #E8A200; font-size: 18px;
  box-shadow: 0 2px 8px rgba(232, 162, 0, .18);
}
.icon-btn {
  border: none; background: #fff; border-radius: 16px;
  font-size: 24px; padding: 8px 12px; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.08); transition: transform .15s;
}
.icon-btn:active { transform: scale(.9); }

/* ---------- views ---------- */
.view { flex: 1; }
.view-title { text-align: center; color: #2B6CB0; font-size: 26px; margin: 8px 0 18px; }

/* ---------- home ---------- */
.hero { text-align: center; margin: 18px 0 10px; }
.mascot { font-size: 84px; line-height: 1.1; }
.hero h1 { font-size: 28px; color: #2B6CB0; margin: 6px 0 0; }

.big-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
.big-card {
  border: none; border-radius: 28px; padding: 30px 14px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  transition: transform .15s; box-shadow: 0 8px 24px rgba(0,0,0,.10);
  color: #fff; font-family: inherit;
}
.big-card:active { transform: scale(.95); }
.card-read { background: linear-gradient(150deg, #FF9F43, #FF6B6B); }
.card-chat { background: linear-gradient(150deg, #38B6FF, #5D5FEF); }
.big-emoji { font-size: 56px; }
.big-name { font-size: 24px; font-weight: 800; }
.big-sub { font-size: 15px; opacity: .92; }

.home-tip { text-align: center; margin-top: 22px; color: #999; font-size: 14px; }
.home-tip.warn { color: #E8A200; font-weight: 600; }

/* ---------- grid cards (topics / scenes) ---------- */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.grid-card {
  border: none; border-radius: 22px; padding: 20px 10px; cursor: pointer;
  background: #fff; box-shadow: 0 4px 14px rgba(43,108,176,.10);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: transform .15s; font-family: inherit;
}
.grid-card:active { transform: scale(.94); }
.grid-card .g-emoji { font-size: 44px; }
.grid-card .g-name { font-size: 18px; font-weight: 700; color: #444; }
.grid-card .g-sub { font-size: 13px; color: #999; }

/* ---------- read ---------- */
.read-progress { text-align: center; color: #2B6CB0; font-weight: 700; font-size: 18px; margin: 10px 0; }
.read-card {
  background: #fff; border-radius: 30px; padding: 30px 20px;
  text-align: center; box-shadow: 0 8px 24px rgba(43,108,176,.12);
}
.read-emoji { font-size: 90px; line-height: 1.15; }
.read-en { font-size: 44px; font-weight: 800; color: #333; margin-top: 8px; letter-spacing: 1px; }
.read-zh { font-size: 20px; color: #888; margin-top: 6px; }

.read-actions { display: flex; justify-content: center; gap: 40px; margin: 26px 0 10px; }
.round-btn {
  border: none; cursor: pointer; border-radius: 50%;
  width: 110px; height: 110px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px;
  font-size: 36px; color: #fff; font-family: inherit;
  box-shadow: 0 8px 20px rgba(0,0,0,.16); transition: transform .15s;
}
.round-btn span { font-size: 14px; font-weight: 700; }
.round-btn:active { transform: scale(.92); }
.round-btn.listen { background: linear-gradient(150deg, #38B6FF, #5D5FEF); }
.round-btn.speak { background: linear-gradient(150deg, #FF9F43, #FF6B6B); }
.round-btn.listening {
  animation: pulse 1s infinite;
  background: linear-gradient(150deg, #FF5252, #D50000);
}
@keyframes pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 82, 82, .5); }
  50% { transform: scale(1.07); box-shadow: 0 0 0 18px rgba(255, 82, 82, 0); }
}

.read-feedback {
  background: #fff; border-radius: 20px; padding: 14px 18px;
  text-align: center; margin: 10px 0; box-shadow: 0 4px 14px rgba(43,108,176,.10);
}
.read-feedback .stars-line { font-size: 30px; }
.read-feedback .praise { font-size: 19px; font-weight: 700; color: #2E8B57; margin: 6px 0; }
.read-feedback .word-line { font-size: 22px; letter-spacing: 1px; word-break: break-word; }
.read-feedback .word-line b { color: #E85D5D; border-bottom: 3px dotted #E85D5D; }
.read-feedback .spoken-line { font-size: 14px; color: #aaa; margin-top: 6px; }

.read-nav { display: flex; justify-content: center; gap: 16px; margin-top: 14px; }
.nav-btn {
  border: none; border-radius: 999px; padding: 13px 30px;
  font-size: 18px; font-weight: 700; cursor: pointer; font-family: inherit;
  background: #fff; color: #2B6CB0; box-shadow: 0 4px 14px rgba(43,108,176,.14);
  transition: transform .15s;
}
.nav-btn:active { transform: scale(.93); }
.nav-btn.primary { background: #2B6CB0; color: #fff; }

/* ---------- chat ---------- */
#view-chat { display: flex; flex-direction: column; }
.chat-box {
  flex: 1; overflow-y: auto; background: #fff;
  border-radius: 24px; padding: 16px; min-height: 300px; max-height: 52vh;
  box-shadow: 0 8px 24px rgba(43,108,176,.10);
  display: flex; flex-direction: column; gap: 12px;
}
.bubble {
  max-width: 78%; padding: 10px 16px; border-radius: 20px;
  font-size: 19px; line-height: 1.5; white-space: pre-wrap; word-break: break-word;
}
.bubble.ai { align-self: flex-start; background: #EAF4FF; color: #1d4e86; border-bottom-left-radius: 6px; }
.bubble.kid { align-self: flex-end; background: #FFE9C7; color: #8a5b00; border-bottom-right-radius: 6px; }
.bubble.thinking { color: #b8b8b8; font-size: 15px; }
.bubble .zh-hint { display: block; font-size: 14px; color: #7aa6c9; margin-top: 4px; }

.hint-card {
  margin-top: 12px; background: #FFF3D6; border-radius: 16px;
  padding: 10px 16px; font-size: 16px; color: #8a5b00; text-align: center;
}
.hint-card b { font-size: 17px; }
.chat-actions { display: flex; align-items: center; justify-content: center; gap: 24px; margin-top: 16px; }
.chat-actions .round-btn { width: 96px; height: 96px; font-size: 30px; }

/* ---------- parent ---------- */
.parent-card {
  background: #fff; border-radius: 20px; padding: 16px 20px; margin-bottom: 14px;
  box-shadow: 0 4px 14px rgba(43,108,176,.08);
}
.parent-card h3 { margin: 0 0 10px; color: #2B6CB0; font-size: 18px; }
.parent-card details summary { cursor: pointer; color: #2B6CB0; font-weight: 600; padding: 6px 0; }
.parent-card ol, .parent-card ul { padding-left: 22px; line-height: 1.8; margin: 8px 0; }
.parent-card code {
  background: #F0F6FF; padding: 2px 8px; border-radius: 8px;
  font-size: 14px; color: #1d4e86; word-break: break-all;
}
.parent-card p { line-height: 1.7; }
.config-ok { color: #2E8B57; font-weight: 700; font-size: 16px; }
.config-bad { color: #E85D5D; font-weight: 700; font-size: 16px; line-height: 1.7; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat-item {
  background: #fff; border-radius: 18px; text-align: center; padding: 16px 8px;
  box-shadow: 0 4px 14px rgba(43,108,176,.08);
}
.stat-item .s-num { font-size: 28px; font-weight: 800; color: #2B6CB0; }
.stat-item .s-label { font-size: 13px; color: #999; margin-top: 4px; }

.table-wrap { overflow-x: auto; max-height: 320px; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 7px 10px; text-align: left; border-bottom: 1px solid #F0F0F0; white-space: nowrap; }
th { color: #888; font-weight: 600; background: #FAFCFF; }
td.stars { color: #E8A200; }

/* ---------- modal ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.35);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal-box {
  background: #fff; border-radius: 28px; padding: 34px 40px;
  text-align: center; max-width: 86vw;
  box-shadow: 0 16px 48px rgba(0,0,0,.2);
  animation: pop .25s ease;
}
@keyframes pop { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-emoji { font-size: 64px; }
.modal-title { font-size: 24px; font-weight: 800; color: #2B6CB0; margin: 10px 0 6px; }
.modal-sub { color: #666; font-size: 16px; margin-bottom: 18px; line-height: 1.6; }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%) translateY(20px);
  background: rgba(40,40,40,.9); color: #fff; padding: 12px 22px;
  border-radius: 999px; font-size: 15px; opacity: 0; pointer-events: none;
  transition: all .3s; z-index: 60; max-width: 84vw; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 平板适配 ---------- */
@media (max-width: 520px) {
  .big-cards { gap: 12px; }
  .big-card { padding: 22px 10px; }
  .big-emoji { font-size: 42px; }
  .big-name { font-size: 19px; }
  .hero h1 { font-size: 22px; }
  .mascot { font-size: 64px; }
  .read-en { font-size: 36px; }
  .read-emoji { font-size: 72px; }
  .round-btn { width: 94px; height: 94px; }
  .read-actions { gap: 22px; }
}

/* ---------- Wonderskills 专区 ---------- */
.big-cards.three { grid-template-columns: 1fr 1fr 1fr; }
.card-ws { background: linear-gradient(150deg, #34C759, #00A88E); }
.ws-book-sub { font-size: 15px; color: #999; font-weight: 600; margin-left: 6px; }

.ws-unit-card { padding: 16px 10px; }
.ws-unit-card .g-sub.zh { color: #b8b8b8; }
.ws-progress {
  width: 100%; height: 10px; background: #EDF2F7;
  border-radius: 999px; margin-top: 8px; overflow: hidden;
}
.ws-progress-bar {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #34C759, #00A88E);
  transition: width .3s;
}
.ws-progress-text { font-size: 12px; color: #00A88E; font-weight: 700; margin-top: 4px; }

.ws-unit-info {
  background: #fff; border-radius: 20px; padding: 14px 20px; margin-bottom: 16px;
  box-shadow: 0 4px 14px rgba(43,108,176,.08); text-align: center;
}
.ws-unit-info .ws-zh-title { font-size: 16px; color: #666; }
.ws-unit-info .ws-pattern { font-size: 15px; color: #E8A200; font-weight: 700; margin-top: 4px; }
.ws-unit-info .ws-story { font-size: 15px; color: #00A88E; font-weight: 700; margin-top: 4px; }

@media (max-width: 520px) {
  .big-cards.three { grid-template-columns: 1fr; gap: 12px; }
  .big-card.card-ws { padding: 22px 10px; }
}
