:root {
  /* 凤画色谱：朱砂、藤黄、石青、墨、绢底 */
  --bg: #f7efe2;
  --bg-2: #efe2cf;
  --ink: #241c14;
  --accent: #b23a26;
  --accent-deep: #8c2a1a;
  --accent-2: #2c6b62;
  --gold: #d9a441;
  --gold-soft: #f0cf8e;
  --card: #fffbf3;
  --line: #e0cfb4;
  --dim: #866f58;
  --shadow: 0 2px 10px rgba(90,60,30,.08);
  --r: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 17px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    radial-gradient(circle at 12% 8%, rgba(217,164,65,.14), transparent 42%),
    radial-gradient(circle at 88% 92%, rgba(178,58,38,.10), transparent 46%),
    repeating-linear-gradient(45deg, rgba(140,42,26,.018) 0 2px, transparent 2px 7px);
  background-attachment: fixed;
}

#app { display: flex; flex-direction: column; min-height: 100vh; }
.view { flex: 1; padding: 14px 16px 96px; max-width: 1080px; margin: 0 auto; width: 100%; }

/* ---------- 五端主题色 ---------- */
body[data-role="kg"]      { --accent: #e0752f; --accent-deep: #c25a17; --accent-2: #3f8f5f; }
body[data-role="pupil"]   { --accent: #b23a26; --accent-deep: #8c2a1a; --accent-2: #2c6b62; }
body[data-role="teacher"] { --accent: #2f5d8a; --accent-deep: #22436a; --accent-2: #8c5a1a; }
body[data-role="expert"]  { --accent: #4a3b6b; --accent-deep: #352a52; --accent-2: #8c6a1a; }
body[data-role="parent"]  { --accent: #5a7a4a; --accent-deep: #44603a; --accent-2: #a06a2a; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
  padding: 10px 16px 12px;
  background: linear-gradient(135deg, var(--accent-deep), var(--accent) 58%, var(--accent));
  color: #fff; box-shadow: 0 2px 12px rgba(120,40,20,.28);
}
.topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 5px;
  background:
    radial-gradient(circle at 6px -1px, var(--gold-soft) 3px, transparent 3.5px) 0 0/12px 6px repeat-x,
    linear-gradient(90deg, var(--gold), #f4dcae 50%, var(--gold));
  opacity: .95;
}
.brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; letter-spacing: 1.2px; font-size: 16.5px;
  font-family: "Songti SC", "SimSun", serif;
}
.brand::before {
  content: "凤"; display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, var(--gold-soft), var(--gold));
  color: var(--accent-deep); font-size: 15px; font-weight: 800;
}
.tb-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* 语言切换 */
.lang-switch { display: flex; background: rgba(0,0,0,.18); border-radius: 999px; padding: 3px; gap: 2px; }
.lang-switch button {
  border: 0; background: transparent; color: #fff; opacity: .78;
  font-size: 13px; padding: 6px 11px; border-radius: 999px; cursor: pointer;
  font-family: inherit; min-height: 32px;
}
.lang-switch button.on { background: #fff; color: var(--accent-deep); opacity: 1; font-weight: 700; }
.lang-switch button:hover { opacity: 1; }

.role-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid rgba(255,255,255,.5); background: rgba(255,255,255,.14);
  color: #fff; border-radius: 999px; padding: 6px 13px; font-size: 13.5px;
  cursor: pointer; font-family: inherit; min-height: 34px;
}
.role-chip:hover { background: rgba(255,255,255,.26); }

/* ---------- 身份切换：五端 ---------- */
.role-tabs {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px;
  margin: 4px 0 18px;
}
.role-tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 11px 6px; border-radius: 12px; cursor: pointer;
  border: 1.5px solid var(--line); background: var(--card); color: var(--ink);
  font-family: inherit; transition: transform .12s, box-shadow .12s;
  min-height: 62px;
}
.role-tab:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.role-tab.on {
  border-color: var(--accent); background: var(--accent); color: #fff;
  box-shadow: 0 3px 12px rgba(120,40,20,.24);
}
.rt-name { font-size: 14px; font-weight: 700; }
.rt-desc { font-size: 11px; opacity: .74; line-height: 1.3; text-align: center; }

/* ---------- 首页 ---------- */
.hero-card {
  display: flex; gap: 16px; align-items: center; width: 100%; text-align: left;
  border: 1.5px solid var(--line); border-radius: 18px; overflow: hidden;
  background: linear-gradient(120deg, var(--card), #fff7e8);
  cursor: pointer; padding: 0; font-family: inherit; color: var(--ink);
  box-shadow: 0 4px 18px rgba(120,70,30,.10);
  transition: transform .14s, box-shadow .14s;
}
.hero-card:hover { transform: translateY(-2px); box-shadow: 0 8px 26px rgba(120,70,30,.16); }
.hero-art { flex: 0 0 46%; max-width: 340px; line-height: 0; }
.hero-art svg { width: 100%; height: auto; display: block; }
.hero-copy { padding: 16px 18px 16px 0; flex: 1; }
.hero-copy h2 { margin: 0 0 6px; font-size: 22px; font-family: "Songti SC", "SimSun", serif; }
.hero-copy p { margin: 4px 0; font-size: 15px; }

.entry-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; margin-top: 16px; }
.entry-card {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 18px 10px; border-radius: var(--r); cursor: pointer;
  border: 1.5px solid var(--line); background: var(--card); color: var(--ink);
  font-family: inherit; min-height: 96px;
  transition: transform .12s, border-color .12s;
}
.entry-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.entry-icon { font-size: 26px; line-height: 1; }
.entry-label { font-size: 14px; font-weight: 600; }

.rec-card, .pack-box, .board-box, .check-box, .analysis-box, .license-box,
.prov-box, .report-box, .week-box, .task-box {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px 16px; margin-top: 16px; box-shadow: var(--shadow);
}
.rec-card h3, .pack-box h3, .board-box h3, .check-box h3, .analysis-box h3,
.license-box h3, .prov-box h3, .report-box h3, .week-box h3, .task-box h3 {
  margin: 0 0 8px; font-size: 15.5px; color: var(--accent-deep);
  border-left: 4px solid var(--accent); padding-left: 9px;
}
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 12px; font-size: 13px; color: var(--accent-deep);
}
.notice {
  margin-top: 16px; padding: 11px 14px; border-radius: 10px; font-size: 14px;
  background: rgba(217,164,65,.14); border: 1px dashed var(--gold); color: #6b4c18;
}
.sec-title { font-size: 19px; margin: 4px 0 12px; font-family: "Songti SC", "SimSun", serif; }

.big-cta {
  display: flex; flex-direction: column; gap: 3px; width: 100%; text-align: left;
  padding: 16px 18px; border-radius: var(--r); cursor: pointer; font-family: inherit;
  border: 0; color: #fff; background: linear-gradient(120deg, var(--accent-deep), var(--accent));
  box-shadow: 0 4px 16px rgba(60,30,10,.2); min-height: 68px;
}
.big-cta b { font-size: 17px; }
.big-cta span { font-size: 13px; opacity: .86; }

.pack-row {
  display: grid; grid-template-columns: 1fr auto; gap: 3px 10px;
  padding: 10px 0; border-bottom: 1px dashed var(--line);
}
.pack-row:last-child { border-bottom: 0; }
.pack-row b { font-size: 14.5px; }
.pack-row .obj { grid-column: 1 / -1; font-size: 13px; color: var(--dim); }

.kv { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dotted var(--line); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv i { color: var(--dim); font-style: normal; flex: 0 0 auto; }
.kv b { text-align: right; font-weight: 600; }

.ring {
  --v: 0;
  width: 92px; height: 92px; margin: 12px auto 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: conic-gradient(var(--accent) calc(var(--v) * 1%), var(--bg-2) 0);
  position: relative;
}
.ring::after { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--card); }
.ring b { position: relative; font-size: 24px; color: var(--accent-deep); }
.big-num b { font-size: 30px; color: var(--accent-deep); }
.big-num span { font-size: 14px; color: var(--dim); margin-left: 4px; }

/* ---------- 通用元件 ---------- */
.dim { color: var(--dim); }
.small { font-size: 13px; }
.warn { color: #9a3412; }
.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 16px; box-shadow: var(--shadow);
}
.btn {
  border: 1.5px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 10px; padding: 10px 15px; font-size: 14.5px; cursor: pointer;
  font-family: inherit; min-height: 44px; transition: border-color .12s, background .12s;
}
.btn:hover { border-color: var(--accent); }
.btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.btn.small { min-height: 38px; padding: 8px 12px; font-size: 13.5px; }

.big-play {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 18px; border-radius: 16px; border: 0; cursor: pointer;
  background: linear-gradient(120deg, var(--accent-deep), var(--accent));
  color: #fff; font-size: 17px; font-weight: 700; font-family: inherit;
  box-shadow: 0 4px 16px rgba(60,30,10,.2); min-height: 64px;
}
.big-play.playing { animation: pulse .5s ease 2; }
.big-play.rec { background: linear-gradient(120deg, #7a2010, #a8321c); }
.big-play.rec.live { animation: recPulse 1s infinite; }
.bp-icon { font-size: 20px; }
@keyframes pulse { 50% { transform: scale(.98); filter: brightness(1.12); } }
@keyframes recPulse { 50% { box-shadow: 0 0 0 8px rgba(168,50,28,.18); } }

.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tab {
  border: 1.5px solid var(--line); background: var(--card); color: var(--dim);
  border-radius: 999px; padding: 9px 16px; font-size: 14px; cursor: pointer;
  font-family: inherit; min-height: 40px;
}
.tab.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }

/* ---------- 绘本 ---------- */
.book { position: relative; }
.book-stage {
  position: relative; border-radius: 20px; overflow: hidden;
  background: #fdf6e8; border: 2px solid var(--gold);
  box-shadow: 0 10px 34px rgba(110,70,30,.18);
}
.book-stage svg { display: block; width: 100%; height: auto; }
.book-stage .hotspot {
  position: absolute; border-radius: 50%; cursor: pointer;
  background: rgba(255,255,255,0); border: 2px dashed transparent;
  transition: background .15s;
}
.book-stage .hotspot:hover, .book-stage .hotspot:active {
  background: rgba(255,255,255,.32); border-color: rgba(255,255,255,.8);
}
.book-text {
  margin-top: 14px; font-size: 21px; line-height: 1.95;
  font-family: "Songti SC", "SimSun", serif; text-align: center;
}
.book-text .ch { transition: background .12s, color .12s; border-radius: 4px; padding: 0 1px; }
.book-text .ch.on { background: var(--gold-soft); color: var(--accent-deep); }
.book-title { text-align: center; font-size: 24px; margin: 6px 0 10px; font-family: "Songti SC", "SimSun", serif; }
.book-title small { display: block; font-size: 14px; color: var(--dim); font-weight: 400; letter-spacing: 1px; }

.book-dots { display: flex; justify-content: center; gap: 9px; margin: 14px 0; }
.book-dots button {
  width: 12px; height: 12px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--line); padding: 0;
}
.book-dots button.on { background: var(--accent); transform: scale(1.25); }
.book-nav { display: flex; gap: 10px; justify-content: center; margin-top: 6px; }

.culture-card, .ai-card {
  margin-top: 14px; border-radius: var(--r); padding: 13px 15px;
  background: linear-gradient(120deg, #fff8e9, #fffdf7);
  border: 1px solid var(--gold-soft);
}
.ai-card { background: linear-gradient(120deg, #eef6f4, #f8fdfb); border-color: #bfe0d8; }
.culture-card h4, .ai-card h4 {
  margin: 0 0 6px; font-size: 14px; color: var(--accent-deep); display: flex; gap: 6px; align-items: center;
}
.culture-card p, .ai-card p { margin: 4px 0; font-size: 14.5px; line-height: 1.7; }
.ai-tag {
  font-size: 11px; background: var(--accent-2); color: #fff; border-radius: 4px;
  padding: 1px 6px; letter-spacing: .5px;
}

/* 注音 ruby */
ruby { ruby-position: over; }
rt { font-size: .52em; color: var(--dim); letter-spacing: .5px; font-weight: 400; }

/* ---------- 音乐层 ---------- */
.music-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 9px; margin-bottom: 14px; }
.meta-cell {
  background: var(--card); border: 1px solid var(--line); border-radius: 11px;
  padding: 9px 11px; text-align: center;
}
.meta-cell i { display: block; font-style: normal; font-size: 12px; color: var(--dim); }
.meta-cell b { font-size: 16px; color: var(--accent-deep); }

.score-sheet { overflow-x: auto; padding: 8px 0; }
.score-sheet svg { display: block; }
.jianpu-line { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 22px; font-family: "Songti SC", serif; }
.jianpu-note { display: inline-flex; flex-direction: column; align-items: center; cursor: pointer; padding: 3px 4px; border-radius: 6px; }
.jianpu-note:hover { background: var(--bg-2); }
.jianpu-note .under { font-size: 11px; color: var(--dim); line-height: 1; }

.wave-wrap { position: relative; border-radius: 10px; overflow: hidden; background: #f4ecdc; }
.wave-wrap svg { display: block; width: 100%; height: 110px; }
.playhead { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); box-shadow: 0 0 6px var(--accent); }

.lyric-line { display: flex; flex-wrap: wrap; gap: 8px; font-size: 20px; margin: 10px 0; }
.lyric-ch { display: flex; flex-direction: column; align-items: center; min-width: 34px; }
.lyric-ch .py { font-size: 11px; color: var(--dim); }
.lyric-ch.on .zh { color: var(--accent); font-weight: 700; }

.mv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.mv-cell { border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #fff; }
.mv-cell svg { display: block; width: 100%; height: auto; }
.mv-cell.on { outline: 3px solid var(--accent); }
.mv-cap { font-size: 12px; padding: 4px 7px; color: var(--dim); }

.transport { display: flex; gap: 8px; align-items: center; margin-top: 14px; flex-wrap: wrap; }

/* ---------- 练习 / 评分 ---------- */
.pattern-list { display: grid; gap: 8px; margin-top: 14px; }
.pattern-row {
  display: flex; flex-direction: column; gap: 2px; text-align: left;
  padding: 11px 13px; border-radius: 11px; border: 1.5px solid var(--line);
  background: var(--card); cursor: pointer; font-family: inherit; color: var(--ink); min-height: 54px;
}
.pattern-row:hover { border-color: var(--accent); }
.pattern-row b { font-size: 14.5px; }

.mic-meter { display: flex; gap: 3px; align-items: flex-end; height: 34px; margin: 12px 0; }
.mic-meter i { flex: 1; background: var(--line); border-radius: 2px; height: 8px; transition: height .08s; }

.score-card { margin-top: 16px; border-top: 1px dashed var(--line); padding-top: 14px; }
.score-head { display: flex; justify-content: center; margin-bottom: 12px; }
.score-num b { font-size: 46px; color: var(--accent); line-height: 1; font-family: "Songti SC", serif; }
.score-num span { font-size: 14px; color: var(--dim); margin-left: 6px; }
.dims { display: grid; gap: 9px; }
.dim-row { display: grid; grid-template-columns: 68px 1fr 34px; gap: 9px; align-items: center; font-size: 13.5px; }
.dim-row > span { color: var(--dim); }
.dim-bar { height: 9px; background: var(--bg-2); border-radius: 999px; overflow: hidden; }
.dim-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); border-radius: 999px; transition: width .5s; }
.dim-row b { text-align: right; color: var(--accent-deep); }

.fix-box { margin-top: 14px; }
.fix-box h4, .curve-box h4 { margin: 0 0 6px; font-size: 14px; color: var(--accent-deep); }
.fix-box ul { margin: 0; padding-left: 18px; }
.fix-box li { font-size: 14px; margin: 4px 0; }
.fix.good { color: var(--accent-2); }
.fix.warn { color: #9a3412; }
.curve-box { margin-top: 14px; }
.ab-box { display: flex; gap: 9px; margin-top: 14px; flex-wrap: wrap; }
.ab-box .btn { flex: 1; min-width: 130px; }
.act-bar { display: flex; gap: 9px; margin-top: 16px; }
.act-bar .btn { flex: 1; }

/* ---------- 游戏 ---------- */
.ask { text-align: center; font-size: 16.5px; margin: 16px 0 12px; font-weight: 600; }
.opt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.opt-btn {
  padding: 16px 10px; border-radius: 13px; border: 1.5px solid var(--line);
  background: var(--card); font-size: 15.5px; font-family: inherit; color: var(--ink);
  cursor: pointer; min-height: 56px;
}
.opt-btn:hover { border-color: var(--accent); background: #fff8ea; }
.tap-pad {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 150px; border-radius: 20px; cursor: pointer; font-family: inherit;
  border: 2px dashed var(--accent); background: rgba(178,58,38,.06);
  font-size: 26px; font-weight: 700; color: var(--accent-deep); margin: 12px 0;
}
.tap-pad.hit { background: var(--accent); color: #fff; }
.tap-pad.live { border-style: solid; }
.result { margin-top: 14px; padding: 13px; border-radius: 11px; text-align: center; }
.result.good { background: rgba(44,107,98,.1); border: 1px solid var(--accent-2); }
.result.bad { background: rgba(178,58,38,.08); border: 1px solid var(--accent); }
.result p { margin: 5px 0; font-size: 15px; }

/* ---------- toast / 底栏 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%) translateY(12px);
  background: rgba(36,28,20,.94); color: #fff; padding: 11px 18px; border-radius: 999px;
  font-size: 14px; z-index: 90; opacity: 0; transition: opacity .2s, transform .2s;
  pointer-events: none; max-width: 86vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.bad { background: rgba(140,42,26,.96); }

.statusbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; gap: 7px; align-items: center; flex-wrap: wrap;
  padding: 7px 14px; font-size: 11.5px; color: var(--dim);
  background: rgba(247,239,226,.96); border-top: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.statusbar .sep { opacity: .5; }
.dot-lic { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }
.dot-lic::before { content: "●"; font-size: 9px; }
.dot-lic.ok { color: var(--accent-2); }
.dot-lic.bad { color: #9a3412; }

/* ---------- 幼儿园端：大触控、低文字 ---------- */
body[data-role="kg"] { font-size: 19px; }
body[data-role="kg"] .view { padding: 12px 14px 100px; }
body[data-role="kg"] .btn,
body[data-role="kg"] .tab,
body[data-role="kg"] .role-tab,
body[data-role="kg"] .entry-card,
body[data-role="kg"] .opt-btn,
body[data-role="kg"] .lang-switch button,
body[data-role="kg"] .role-chip { min-height: 88px; }
body[data-role="kg"] .entry-card { padding: 22px 12px; }
body[data-role="kg"] .entry-icon { font-size: 40px; }
body[data-role="kg"] .entry-label { font-size: 17px; }
body[data-role="kg"] .hero-card { flex-direction: column; }
body[data-role="kg"] .hero-art { flex: none; max-width: 100%; width: 100%; }
body[data-role="kg"] .hero-copy { padding: 12px 16px 18px; text-align: center; }
body[data-role="kg"] .book-text { font-size: 26px; line-height: 2.1; }
body[data-role="kg"] .rt-desc { display: none; }
body[data-role="kg"] .score-card,
body[data-role="kg"] .dims,
body[data-role="kg"] .score-head { display: none; }

/* ---------- 窄屏 ---------- */
@media (max-width: 620px) {
  .view { padding: 12px 12px 92px; }
  .role-tabs { grid-template-columns: repeat(3, 1fr); }
  .hero-card { flex-direction: column; }
  .hero-art { flex: none; max-width: 100%; width: 100%; }
  .hero-copy { padding: 12px 16px 16px; }
  .hero-copy h2 { font-size: 19px; }
  .book-text { font-size: 18px; line-height: 1.9; }
  .dim-row { grid-template-columns: 58px 1fr 30px; font-size: 13px; }
  .score-num b { font-size: 38px; }
}

@media print {
  .topbar, .statusbar, .act-bar, .tabs { display: none; }
  .view { padding: 0; }
}
