* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Nunito", "Baloo 2", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: linear-gradient(180deg, #8fe3ff 0%, #c9f1ff 45%, #fff6d6 100%);
  color: #35405a;
  user-select: none; -webkit-user-select: none;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; border: 0; cursor: pointer; }
button:disabled { opacity: .4; pointer-events: none; }

#app { max-width: 520px; margin: 0 auto; height: 100dvh; display: flex; flex-direction: column; position: relative; overflow: hidden; }
#topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 6px; padding-top: max(12px, env(safe-area-inset-top)); min-height: 60px; }
#title { font-weight: 800; font-size: 20px; flex: 1; text-align: center; }
#topbar .right { display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; background: #fff; box-shadow: 0 3px 0 #b9dff0; font-size: 18px; }
.icon-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #b9dff0; }
#back.hidden { visibility: hidden; }
#starbox { background: #fff; border-radius: 22px; padding: 8px 14px; font-weight: 800; font-size: 18px; box-shadow: 0 3px 0 #f1d27a; }
#starbox.bump { animation: pop .5s; }

#view { flex: 1; overflow-y: auto; padding: 8px 18px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: stretch; gap: 14px; -webkit-overflow-scrolling: touch; }

/* 首页 */
.hero { text-align: center; padding-top: 4px; }
.mascot { font-size: 84px; line-height: 1; animation: float 2.4s ease-in-out infinite; }
.hero h1 { margin: 4px 0 0; font-size: 40px; color: #ff7a3d; letter-spacing: 1px; text-shadow: 0 3px 0 #fff; }
.hero p { margin: 4px 0 0; font-size: 18px; font-weight: 700; }
.menu { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 6px; }
.mbtn { position: relative; border-radius: 26px; padding: 18px 8px 16px; display: flex; flex-direction: column; align-items: center; gap: 4px; color: #fff; box-shadow: 0 7px 0 rgba(0,0,0,.18); transition: transform .08s; }
.mbtn:active { transform: translateY(5px); box-shadow: 0 2px 0 rgba(0,0,0,.18); }
.mbtn span { font-size: 46px; line-height: 1.1; }
.mbtn b { font-size: 22px; }
.mbtn i { font-style: normal; font-size: 13px; opacity: .92; }
.c1 { background: #4cc9f0; } .c2 { background: #ff9f1c; } .c3 { background: #ff5d8f; } .c4 { background: #7bc043; }
.badge { position: absolute; top: -6px; right: -4px; background: #ff3b30; color: #fff; min-width: 30px; height: 30px; line-height: 30px; border-radius: 15px; font-style: normal; font-weight: 800; font-size: 16px; text-align: center; box-shadow: 0 2px 0 rgba(0,0,0,.2); animation: pop 1s infinite alternate; }
.footnote { text-align: center; font-size: 13px; opacity: .65; margin-top: auto; }

/* 选类别 */
.hint-title { text-align: center; font-size: 20px; font-weight: 800; margin: 0; }
.cats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cat { background: #fff; border-radius: 22px; padding: 14px 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; box-shadow: 0 5px 0 #cfe4ee; }
.cat:active { transform: translateY(3px); box-shadow: 0 2px 0 #cfe4ee; }
.cat .ic { font-size: 40px; line-height: 1.1; }
.cat b { font-size: 20px; }
.cat small { opacity: .65; font-weight: 700; }
.cat.all { grid-column: span 2; background: #fff3c4; box-shadow: 0 5px 0 #ecd480; }

/* 卡片 */
.progress { height: 12px; background: rgba(255,255,255,.8); border-radius: 6px; overflow: hidden; flex: none; }
.progress div { height: 100%; background: linear-gradient(90deg, #ffb703, #ff7a3d); border-radius: 6px; transition: width .3s; }
.card { background: #fff; border-radius: 30px; padding: 20px 14px; text-align: center; box-shadow: 0 7px 0 #cfe4ee; flex: none; }
.card.big { padding: 22px 14px 18px; }
.card.pop { animation: pop .4s; }
.vis { display: inline-flex; align-items: center; justify-content: center; font-size: 110px; line-height: 1.1; min-height: 120px; }
.vis.swatch { width: 110px; height: 110px; min-height: 0; border-radius: 50%; border: 5px solid #fff; box-shadow: 0 0 0 3px #d6e6ee, inset 0 -6px 0 rgba(0,0,0,.12); margin: 6px 0; }
.vis.num { font-weight: 900; color: #ff7a3d; font-size: 100px; }
.vis.sm { font-size: 58px; min-height: 0; }
.vis.sm.swatch { width: 62px; height: 62px; border-width: 3px; margin: 0; }
.vis.sm.num { font-size: 54px; }
.en { font-size: 46px; font-weight: 900; color: #3a86ff; letter-spacing: 1px; }
.zh { font-size: 24px; font-weight: 800; margin-top: 2px; opacity: .8; }

.speaker { background: #ffd23f; border-radius: 30px; padding: 14px 24px; font-size: 22px; font-weight: 800; box-shadow: 0 6px 0 #d9a900; align-self: center; }
.speaker:active { transform: translateY(4px); box-shadow: 0 2px 0 #d9a900; }
.speaker.huge { font-size: 64px; width: 150px; height: 150px; border-radius: 50%; padding: 0; margin: 10px 0; }
.nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 800; margin-top: auto; }
.nav button, .btn { background: #fff; border-radius: 22px; padding: 14px 20px; font-size: 18px; font-weight: 800; box-shadow: 0 5px 0 #cfe4ee; }
.nav button:last-child, .btn.main { background: #4cc9f0; color: #fff; box-shadow: 0 5px 0 #2a9cc4; }
.btn:active, .nav button:active { transform: translateY(3px); }
.btn.green { background: #5ccb5f; color: #fff; box-shadow: 0 5px 0 #3a9a3d; }
.btn.red { background: #ff7b72; color: #fff; box-shadow: 0 5px 0 #cc4f47; }
.btn-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* 选择题 */
.q { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.q p { margin: 0; font-size: 20px; font-weight: 800; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 4px; }
.opt { background: #fff; border-radius: 24px; min-height: 96px; font-size: 30px; font-weight: 900; color: #3a86ff; box-shadow: 0 6px 0 #cfe4ee; display: flex; align-items: center; justify-content: center; transition: transform .08s; }
.opt:active { transform: translateY(4px); box-shadow: 0 2px 0 #cfe4ee; }
.opt.right { background: #5ccb5f; color: #fff; box-shadow: 0 6px 0 #3a9a3d; animation: pop .45s; }
.opt.wrong { background: #ff8d86; color: #fff; box-shadow: 0 6px 0 #cc4f47; animation: shake .4s; }

/* 开口说 */
.mic { align-self: center; width: 120px; height: 120px; border-radius: 50%; background: #ff5d8f; font-size: 54px; box-shadow: 0 8px 0 #c93768; position: relative; flex: none; }
.mic:active { transform: translateY(5px); box-shadow: 0 3px 0 #c93768; }
.mic.on { background: #ff3b30; animation: pulse 1s infinite; }
.hint { text-align: center; font-weight: 800; font-size: 18px; min-height: 26px; }
.result { text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.result .big-stars { font-size: 44px; letter-spacing: 4px; animation: pop .5s; }
.result .msg { font-size: 22px; font-weight: 900; }
.result .heard { font-size: 16px; opacity: .75; font-weight: 700; }

/* 错题本 */
.wlist { display: flex; flex-direction: column; gap: 10px; }
.witem { display: flex; align-items: center; gap: 12px; background: #fff; border-radius: 22px; padding: 8px 14px; box-shadow: 0 4px 0 #cfe4ee; text-align: left; width: 100%; }
.witem .vis { font-size: 44px; min-height: 0; width: 56px; }
.witem .vis.swatch { width: 44px; height: 44px; border-width: 3px; margin: 0; }
.witem .vis.num { font-size: 40px; }
.witem .t { flex: 1; }
.witem .t b { font-size: 24px; color: #3a86ff; display: block; }
.witem .t small { font-size: 15px; font-weight: 700; opacity: .7; }
.witem .m { font-size: 13px; font-weight: 800; background: #ffe3e0; color: #e0463d; padding: 4px 10px; border-radius: 12px; }
.empty { text-align: center; font-size: 22px; font-weight: 800; padding: 40px 0; }
.empty div { font-size: 80px; }

/* 结果页 */
.final { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 10px; }
.final .em { font-size: 96px; animation: float 2s ease-in-out infinite; }
.final h2 { margin: 0; font-size: 32px; color: #ff7a3d; }
.final .sub { font-size: 19px; font-weight: 800; }
.final .gain { font-size: 28px; font-weight: 900; color: #e89b00; }

/* 特效 */
#fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 20; }
.conf { position: absolute; top: -40px; font-size: 28px; animation: fall linear forwards; }
#toast { position: absolute; left: 50%; bottom: 40px; transform: translate(-50%, 30px); background: #35405a; color: #fff; padding: 12px 20px; border-radius: 22px; font-weight: 800; opacity: 0; transition: .3s; z-index: 30; max-width: 86%; text-align: center; pointer-events: none; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.say { position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%); font-size: 54px; font-weight: 900; color: #fff; text-shadow: 0 4px 0 #ff7a3d, 0 0 14px rgba(255,122,61,.5); -webkit-text-stroke: 2px #ff7a3d; animation: sayup 1.1s forwards; white-space: nowrap; }

@keyframes pop { 0% { transform: scale(.7); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-9px); } 40% { transform: translateX(9px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(6px); } }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255,59,48,.6), 0 8px 0 #b3261e; } 100% { box-shadow: 0 0 0 28px rgba(255,59,48,0), 0 8px 0 #b3261e; } }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); opacity: .9; } }
@keyframes sayup { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.5); } 25% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); } 70% { opacity: 1; transform: translate(-50%, -55%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -80%) scale(1); } }

@media (max-height: 640px) {
  .vis { font-size: 80px; min-height: 90px; }
  .vis.swatch { width: 80px; height: 80px; }
  .mascot { font-size: 60px; }
  .speaker.huge { width: 110px; height: 110px; font-size: 48px; }
  .mic { width: 96px; height: 96px; font-size: 42px; }
}
