/* 小小识字岛 —— 共享样式 */
:root {
  --bg: #FFF6E9;
  --card: #FFFFFF;
  --ink: #3D3B37;
  --ink-soft: #8A8578;
  --orange: #FF9F43;
  --orange-deep: #F3862A;
  --green: #6BCB77;
  --green-deep: #4CAF50;
  --blue: #4D96FF;
  --pink: #FF6B9D;
  --yellow: #FFD93D;
  --red: #FF6B6B;
  --radius: 22px;
  --hanzi-font: "Kaiti SC", "STKaiti", "KaiTi", "FZKai-Z03S", serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 17px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  user-select: none;
  -webkit-user-select: none;
}
.wrap { max-width: 560px; margin: 0 auto; padding: 16px 16px 40px; }

/* 顶栏 */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 6px 2px 14px; }
.topbar .back {
  font-size: 1.15rem; text-decoration: none; color: var(--ink-soft);
  background: var(--card); border-radius: 999px; padding: 10px 20px;
  box-shadow: 0 3px 0 rgba(0,0,0,.08); font-weight: 700;
}
.topbar .back:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,.08); }
.topbar .title { font-weight: 800; font-size: 1.15rem; }
.stars-chip {
  background: var(--card); border-radius: 999px; padding: 8px 14px;
  font-weight: 800; box-shadow: 0 2px 0 rgba(0,0,0,.06); color: #E8A100;
}

/* 卡片 */
.card {
  background: var(--card); border-radius: var(--radius);
  padding: 20px; margin-bottom: 16px;
  box-shadow: 0 4px 0 rgba(0,0,0,.05);
}

/* 大按钮 */
.btn {
  display: block; width: 100%; border: none; cursor: pointer;
  border-radius: 18px; padding: 16px; font-size: 1.15rem; font-weight: 800;
  color: #fff; background: var(--orange);
  box-shadow: 0 5px 0 var(--orange-deep);
  transition: transform .06s;
  font-family: inherit;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--orange-deep); }
.btn.green { background: var(--green); box-shadow: 0 5px 0 var(--green-deep); }
.btn.green:active { box-shadow: 0 1px 0 var(--green-deep); }
.btn.blue { background: var(--blue); box-shadow: 0 5px 0 #2F73DD; }
.btn.blue:active { box-shadow: 0 1px 0 #2F73DD; }
.btn.ghost { background: #F1EADB; color: var(--ink-soft); box-shadow: 0 5px 0 #DDD3BE; }
.btn.ghost:active { box-shadow: 0 1px 0 #DDD3BE; }
.btn:disabled { opacity: .45; }
.btn + .btn { margin-top: 12px; }


/* 一键开始主按钮 */
.btn-hero {
  display: flex; align-items: center; gap: 18px;
  background: linear-gradient(135deg, var(--orange), #FFBE63);
  border-radius: var(--radius); padding: 24px 22px; margin-bottom: 14px;
  color: #fff; text-decoration: none;
  box-shadow: 0 6px 0 #DC8228;
  transition: transform .08s;
}
.btn-hero:active { transform: translateY(4px); box-shadow: 0 2px 0 #DC8228; }
.btn-hero .icon { font-size: 3.2rem; line-height: 1; }
.btn-hero .t { font-size: 1.4rem; font-weight: 900; }
.btn-hero .d { opacity: .96; font-size: .98rem; margin-top: 5px; font-weight: 600; }
.btn-hero.done { background: linear-gradient(135deg, var(--green), #9BE0A3); box-shadow: 0 6px 0 #3E9A4A; }
.btn-hero.done:active { box-shadow: 0 2px 0 #3E9A4A; }

/* 首页任务卡 */
.task-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--card); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 14px;
  box-shadow: 0 4px 0 rgba(0,0,0,.05);
  cursor: pointer; text-decoration: none; color: var(--ink);
  position: relative;
}
.task-card .icon { font-size: 2.4rem; }
.task-card .t { font-weight: 800; font-size: 1.15rem; }
.task-card .d { color: var(--ink-soft); font-size: .92rem; margin-top: 3px; }
.task-card .check { position: absolute; right: 18px; font-size: 1.5rem; }
.task-card.done { opacity: .75; }

/* 汉字大显示 */
.hanzi-big {
  font-family: var(--hanzi-font);
  font-size: 7.2rem; line-height: 1.15; text-align: center;
  color: var(--ink);
}
.pinyin-big { text-align: center; font-size: 1.6rem; color: var(--blue); font-weight: 700; letter-spacing: .05em; }
.emoji-big { text-align: center; font-size: 5.4rem; line-height: 1.15; margin: 6px 0; }

/* 词语胶囊 */
.word-pills { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 14px; }
.word-pill {
  background: #FFF1DC; border: 2px solid #FFD9A8; color: var(--ink);
  border-radius: 999px; padding: 10px 18px; font-size: 1.25rem; font-weight: 700;
  font-family: var(--hanzi-font); cursor: pointer;
}
.word-pill:active { background: #FFE3BC; }
.sentence {
  margin-top: 14px; text-align: center; font-size: 1.3rem; line-height: 1.7;
  font-family: var(--hanzi-font); background: #F0F7FF; border-radius: 14px; padding: 12px; cursor: pointer;
}

/* 选项格子（听音选字） */
.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.opt {
  background: var(--card); border: 3px solid #EFE7D6; border-radius: 20px;
  font-family: var(--hanzi-font); font-size: 3.4rem; padding: 18px 0; text-align: center;
  cursor: pointer; box-shadow: 0 4px 0 rgba(0,0,0,.05); color: var(--ink);
}
.opt:active { transform: scale(.97); }
.opt.right { background: #E8F8EC; border-color: var(--green); animation: pop .35s; }
.opt.wrong { background: #FDECEC; border-color: var(--red); animation: shake .4s; }
@keyframes pop { 50% { transform: scale(1.12); } }
@keyframes shake { 20%{transform:translateX(-7px)} 40%{transform:translateX(7px)} 60%{transform:translateX(-5px)} 80%{transform:translateX(5px)} }

/* 播放按钮 */
.speaker {
  display: block; margin: 8px auto; border: none; cursor: pointer;
  width: 84px; height: 84px; border-radius: 50%;
  background: var(--blue); color: #fff; font-size: 2.2rem;
  box-shadow: 0 5px 0 #2F73DD;
}
.speaker:active { transform: translateY(3px); box-shadow: 0 2px 0 #2F73DD; }

/* 进度点/进度条 */
.dots { display: flex; gap: 8px; justify-content: center; margin: 10px 0 4px; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: #E8DFC9; }
.dot.on { background: var(--orange); }
.dot.now { background: var(--blue); transform: scale(1.25); }
.pbar { height: 14px; background: #F0E8D5; border-radius: 999px; overflow: hidden; }
.pbar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--green), #9BE0A3); border-radius: 999px; transition: width .5s; }

/* 田字格（认字展示用，与书写格同款） */
.tian-grid {
  width: 230px; height: 230px; margin: 10px auto;
  display: flex; align-items: center; justify-content: center;
  background:
    linear-gradient(to right, transparent 49.6%, #F2C9C9 49.6%, #F2C9C9 50.4%, transparent 50.4%),
    linear-gradient(to bottom, transparent 49.6%, #F2C9C9 49.6%, #F2C9C9 50.4%, transparent 50.4%),
    #FFFDF6;
  border: 3px solid #E7B9B9; border-radius: 16px;
}
.tian-grid .hanzi-big { font-size: 10.5rem; line-height: 1; }

/* 笔顺格 */
.writer-box { display: flex; justify-content: center; margin: 10px 0; }
#writer-target {
  background:
    linear-gradient(to right, transparent 49.6%, #F2C9C9 49.6%, #F2C9C9 50.4%, transparent 50.4%),
    linear-gradient(to bottom, transparent 49.6%, #F2C9C9 49.6%, #F2C9C9 50.4%, transparent 50.4%),
    #FFFDF6;
  border: 3px solid #E7B9B9; border-radius: 16px;
}

/* 庆祝页 */
.celebrate { text-align: center; padding: 40px 10px; }
.celebrate .big { font-size: 4.5rem; animation: bounce 1s infinite alternate; }
@keyframes bounce { to { transform: translateY(-12px); } }
.celebrate h2 { margin: 12px 0 6px; }
.celebrate p { color: var(--ink-soft); margin-bottom: 22px; }

/* 小岛动物 */
.animal-row { display: flex; flex-wrap: wrap; gap: 8px; font-size: 1.9rem; margin-top: 10px; }
.animal-row .locked { filter: grayscale(1); opacity: .35; }

/* 家长页 */
.char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 8px; margin-top: 10px; }
.char-cell {
  font-family: var(--hanzi-font); font-size: 1.5rem; text-align: center;
  padding: 8px 0; border-radius: 12px; background: #F6F1E4; cursor: pointer; border: 2px solid transparent;
}
.char-cell.known { background: #E4F7E7; border-color: var(--green); }
.char-cell.learning { background: #FFF1DC; border-color: var(--orange); }
.char-cell.grad { background: #EAF1FF; border-color: var(--blue); }
.unit-head { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; font-weight: 800; }
.unit-head button { border: none; background: #F1EADB; border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: .85rem; color: var(--ink-soft); font-weight: 700; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat { background: #FAF5EA; border-radius: 14px; padding: 12px; text-align: center; }
.stat .n { font-size: 1.6rem; font-weight: 800; }
.stat .l { color: var(--ink-soft); font-size: .85rem; margin-top: 2px; }
input[type=number], input[type=text], select {
  font-size: 1.1rem; padding: 10px 14px; border-radius: 12px; border: 2px solid #E8DFC9;
  width: 100%; font-family: inherit; background: #fff; color: var(--ink);
}
label.field { display: block; margin: 12px 0 4px; font-weight: 700; font-size: .95rem; }
h3.section { margin: 6px 0 10px; font-size: 1.05rem; }
.muted { color: var(--ink-soft); font-size: .88rem; line-height: 1.6; }
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 22px; border-radius: 999px;
  font-weight: 700; opacity: 0; pointer-events: none; transition: opacity .3s; z-index: 99;
}
.toast.show { opacity: .92; }

/* 金币飞行特效 */
.coin-fly {
  position: fixed; width: 48px; height: 48px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #FFE566, #F5A623 55%, #B45309);
  box-shadow: 0 0 0 3px #F5A623, 0 6px 18px rgba(245,166,35,.6), inset 0 2px 4px rgba(255,255,255,.5);
  display: flex; align-items: center; justify-content: center;
  pointer-events: none; z-index: 250;
  animation: coinfly .85s cubic-bezier(.4,0,.2,1) forwards;
}
.coin-fly::after { content: '★'; font-size: 22px; color: #92400E; font-weight: 900; }
@keyframes coinfly {
  0%   { transform: translate(0,0) scale(1.3) rotate(-15deg); opacity: 1; }
  40%  { transform: translate(calc(var(--tx)*.4), calc(var(--ty)*.3)) scale(1.6) rotate(25deg); opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) scale(.3) rotate(360deg); opacity: 0; }
}
.stars-chip.pop { animation: chippop .4s cubic-bezier(.34,1.56,.64,1); }
@keyframes chippop { 50% { transform: scale(1.35); } }
