* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { font-family: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, sans-serif; background: #fff7e6; color: #2b2b2b; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
#app { max-width: 900px; margin: 0 auto; padding: max(12px, env(safe-area-inset-top)) 14px 24px; min-height: 100%; }
button { font-family: inherit; cursor: pointer; border: 0; }

/* Trang chủ */
.home { text-align: center; padding-top: 4vh; }
.home h1 { font-size: clamp(30px, 6vw, 46px); margin: 0 0 10px; }
.stats { display: flex; gap: 10px; justify-content: center; margin-bottom: 22px; flex-wrap: wrap; }
.stats span { background: #fff; padding: 8px 16px; border-radius: 99px; font-size: 20px; font-weight: 700; box-shadow: 0 2px 8px #0001; }
.bigbtn { display: block; width: min(100%, 460px); margin: 14px auto; padding: 22px; font-size: clamp(24px, 4.5vw, 32px); font-weight: 800; color: #fff; border-radius: 26px; box-shadow: 0 7px 0 #0002; }
.bigbtn:active { transform: translateY(4px); box-shadow: 0 3px 0 #0002; }
.c1 { background: linear-gradient(135deg, #ff922b, #ff6b6b); }
.c2 { background: linear-gradient(135deg, #4dabf7, #7950f2); }
.c3 { background: linear-gradient(135deg, #51cf66, #20c997); }
.topics { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 18px auto 6px; max-width: 560px; }
.topics button { background: #fff; padding: 10px 14px; border-radius: 16px; font-size: 17px; font-weight: 700; box-shadow: 0 2px 8px #0001; }
.sub { color: #888; font-size: 15px; margin-top: 20px; }
.link { background: none; color: #999; font-size: 16px; margin-top: 26px; text-decoration: underline; }

/* Câu hỏi */
.top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.x { background: #fff; width: 44px; height: 44px; border-radius: 50%; font-size: 20px; flex: none; box-shadow: 0 2px 6px #0001; }
.prog { flex: 1; display: flex; gap: 4px; }
.prog i { flex: 1; height: 12px; border-radius: 99px; background: #ffe3b3; }
.prog i.done { background: #51cf66; } .prog i.miss { background: #ffa94d; } .prog i.cur { background: #ff922b; }
.timer { background: #fff; padding: 8px 14px; border-radius: 99px; font-weight: 800; font-size: 18px; font-variant-numeric: tabular-nums; }
.timer.low { background: #ffe3e3; color: #e03131; }
.qtext { background: #fff; border-radius: 22px; padding: 14px 16px; box-shadow: 0 2px 10px #0001; }
.qtext .vi { font-size: clamp(20px, 3.6vw, 28px); font-weight: 800; line-height: 1.35; }
.qtext .en { font-size: clamp(15px, 2.6vw, 19px); color: #666; margin-top: 6px; line-height: 1.35; }
.qno { color: #ff922b; margin-right: 4px; }
.spk { background: #fff3d6; border-radius: 99px; padding: 4px 12px; font-size: 18px; vertical-align: middle; margin-left: 4px; }
.en .spk { font-size: 14px; }
.visual { margin: 12px 0; text-align: center; }
.visual:empty { margin: 6px 0; }
.emo { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; font-size: clamp(34px, 7vw, 52px); line-height: 1.15; background: #fff; border-radius: 20px; padding: 12px; }
.emo.seq { gap: 2px; font-size: clamp(30px, 6vw, 48px); }
.boxes { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.emo.box { border: 3px solid #74c0fc; background: #e7f5ff; font-size: clamp(28px, 5.5vw, 40px); max-width: 46%; }
.tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.tiles span { background: #fff; border: 3px solid #ffd08a; border-radius: 16px; min-width: 62px; padding: 8px 12px; font-size: clamp(26px, 5vw, 38px); font-weight: 800; }
.tiles.letters span { color: #7950f2; border-color: #d0bfff; }
.tiles.shirts span { background: #ff8787; color: #fff; border: 0; border-radius: 10px 10px 18px 18px; position: relative; margin: 0 8px; }
.tiles.shirts span::before, .tiles.shirts span::after { content: ""; position: absolute; top: 0; width: 14px; height: 22px; background: #ff8787; }
.tiles.shirts span::before { left: -10px; border-radius: 8px 0 0 8px; transform: skewY(-25deg); }
.tiles.shirts span::after { right: -10px; border-radius: 0 8px 8px 0; transform: skewY(25deg); }
.tiles.cards span { border-color: #74c0fc; background: #e7f5ff; min-width: 70px; padding: 14px 12px; }
.bigmath { font-size: clamp(38px, 9vw, 68px); font-weight: 900; background: #fff; border-radius: 20px; padding: 14px; letter-spacing: 2px; }
.bal { display: inline-flex; align-items: flex-end; gap: 8px; background: #fff; border-radius: 20px; padding: 10px 16px; margin: 4px 6px; font-size: clamp(32px, 6.5vw, 50px); }
.bal span { border-bottom: 5px solid #555; padding: 0 6px; min-width: 60px; }
.bal b { font-size: .8em; }
.fig { width: 100%; max-height: 38vh; background: #fff; border-radius: 20px; padding: 8px; }

.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ch { position: relative; background: #fff; border: 4px solid #ffd08a; border-radius: 22px; padding: 14px 10px 14px 44px; font-size: clamp(22px, 4.4vw, 32px); font-weight: 800; min-height: 74px; box-shadow: 0 5px 0 #ffd08a; color: #2b2b2b; }
.ch:active { transform: translateY(3px); box-shadow: 0 2px 0 #ffd08a; }
.ch b { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); background: #fff3d6; color: #e8590c; width: 30px; height: 30px; line-height: 30px; border-radius: 50%; font-size: 16px; }
.ch i { font-size: .7em; font-weight: 600; color: #777; }
.choices.big .ch { font-size: clamp(36px, 7vw, 52px); }
.ch.ok { background: #d3f9d8; border-color: #40c057; box-shadow: 0 5px 0 #40c057; animation: pop .4s; }
.ch.bad { background: #ffe3e3; border-color: #ff8787; box-shadow: none; opacity: .55; animation: shake .35s; }
.ch.sel { background: #d0ebff; border-color: #339af0; box-shadow: 0 5px 0 #339af0; }
@keyframes pop { 50% { transform: scale(1.07); } }
@keyframes shake { 25% { transform: translateX(-7px); } 75% { transform: translateX(7px); } }

#fb { margin-top: 14px; text-align: center; }
.good { font-size: 30px; font-weight: 900; color: #2f9e44; animation: pop .4s; }
.hint { background: #fff3bf; border-radius: 18px; padding: 14px; font-size: clamp(17px, 3vw, 21px); text-align: left; line-height: 1.45; }
.next { margin-top: 12px; background: #40c057; color: #fff; font-size: 26px; font-weight: 800; padding: 14px 44px; border-radius: 22px; box-shadow: 0 5px 0 #2f9e44; }
.nav { display: flex; gap: 10px; margin-top: 16px; }
.nav button { flex: 1; padding: 14px; font-size: 20px; font-weight: 800; border-radius: 18px; background: #fff; box-shadow: 0 3px 0 #0002; }
.nav .submit { background: #7950f2; color: #fff; }
.grid { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; justify-content: center; }
.grid button { width: 40px; height: 40px; border-radius: 12px; background: #fff; font-weight: 700; font-size: 15px; }
.grid button.ans { background: #a5d8ff; } .grid button.cur { outline: 3px solid #ff922b; }

/* Kết quả, sticker, ba mẹ */
.card { background: #fff; border-radius: 24px; padding: 20px; margin: 14px 0; box-shadow: 0 2px 10px #0001; text-align: center; }
.card h2 { margin: 0 0 8px; font-size: 28px; }
.score { font-size: 60px; font-weight: 900; color: #ff922b; }
.newst { font-size: 90px; animation: pop .6s 3; }
.stk { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; font-size: 44px; }
.stk span.off { filter: grayscale(1); opacity: .18; }
.rev { text-align: left; border-top: 2px dashed #eee; padding: 12px 0; }
.rev .fig { max-height: 200px; } .rev .emo, .rev .bigmath { font-size: 28px; }
.rev .wrong { color: #e03131; } .rev .right { color: #2f9e44; font-weight: 800; }
table { width: 100%; border-collapse: collapse; font-size: 15px; text-align: left; -webkit-user-select: text; user-select: text; }
th, td { padding: 7px 8px; border-bottom: 1px solid #f0e6d2; }
tr.tp td { background: #fff3d6; font-weight: 800; }
td.lo { color: #e03131; font-weight: 700; } td.hi { color: #2f9e44; font-weight: 700; }
.pbtn { background: #eee; padding: 10px 16px; border-radius: 12px; font-size: 15px; margin: 4px; }

@media (max-width: 480px) {
  .ch { padding-left: 38px; min-height: 64px; }
  .ch b { left: 7px; width: 26px; height: 26px; line-height: 26px; font-size: 14px; }
  .tiles span { min-width: 50px; padding: 6px 9px; }
}

/* Đề mẫu */
.qtext.enfirst { display: flex; flex-direction: column-reverse; }
.qtext.enfirst .en { font-size: clamp(18px, 3.2vw, 24px); color: #2b2b2b; font-weight: 700; margin: 0 0 6px; }
.qtext.enfirst .vi { font-size: clamp(17px, 3vw, 22px); font-weight: 600; font-style: italic; color: #555; }
.grp { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grp div { background: #fff; border: 3px solid #ffd08a; border-radius: 18px; padding: 8px; }
.grp b { display: block; font-size: 20px; color: #e8590c; }
.grp span { font-size: clamp(22px, 4.5vw, 30px); font-weight: 800; letter-spacing: 3px; }
.row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; align-items: flex-end; }
.g2, .gx { display: inline-grid; background: #fff; border: 2px solid #333; }
.g2 { grid-template-columns: 1fr 1fr; font-size: clamp(26px, 5.5vw, 40px); }
.g2 span, .gx span { border: 1px solid #333; display: grid; place-items: center; }
.g2 span { width: 1.6em; height: 1.6em; }
.gx span { width: 26px; height: 26px; font-size: 16px; font-weight: 700; }
.cap { font-size: 14px; color: #666; text-align: center; }
.bx { display: inline-grid; grid-template-columns: 1fr 1fr; border: 2px solid #333; background: #fff; font-size: clamp(18px, 3.6vw, 24px); font-weight: 800; }
.bx span { padding: 6px 12px; border: 1px solid #333; }
.bx span.w { grid-column: 1 / 3; }
.delist { display: grid; gap: 10px; max-width: 520px; margin: 0 auto; }
.delist div { display: flex; gap: 8px; align-items: center; background: #fff; border-radius: 18px; padding: 10px 12px; box-shadow: 0 2px 8px #0001; }
.delist b { flex: 1; text-align: left; font-size: 22px; }
.delist button { padding: 12px 14px; border-radius: 14px; font-size: 17px; font-weight: 800; color: #fff; }
.c4 { background: linear-gradient(135deg, #f783ac, #e64980); }

/* Hồ sơ bé */
.av { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: #fff; font-size: 34px; object-fit: cover; box-shadow: 0 2px 10px #0002; border: 3px solid #fff; vertical-align: middle; }
.av.lg { width: 96px; height: 96px; font-size: 60px; border-color: #ffd08a; }
.av.xl { width: 120px; height: 120px; font-size: 74px; border-color: #ffd08a; }
.avbtn { background: none; display: block; margin: 0 auto 6px; }
.avbtn small { display: block; color: #999; font-size: 14px; margin-top: 4px; }
.who { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; margin-top: 24px; }
.whobtn { background: #fff; border-radius: 28px; padding: 18px 20px 12px; box-shadow: 0 6px 0 #0001, 0 2px 10px #0001; min-width: 170px; display: block; }
.whobtn:active { transform: translateY(3px); }
.whobtn b { display: block; font-size: 24px; margin-top: 8px; }
.whobtn small { color: #888; font-size: 15px; }
.whobtn.add .av { background: #f1f3f5; border-color: #dee2e6; color: #868e96; }
.who .link { margin-top: 8px; font-size: 14px; }
.pf { text-align: left; border: 5px solid #ffe066; }
.pf .hello { display: inline-block; background: linear-gradient(135deg, #4dabf7, #1c7ed6); color: #fff; font-weight: 800; padding: 8px 18px; border-radius: 99px; border: 2px solid #ffe066; }
.pf h2 { margin: 14px 0 6px; }
.pf label { display: block; font-weight: 800; font-size: 19px; margin: 16px 0 8px; }
.pf input#pname { width: 100%; font: inherit; font-size: 22px; padding: 14px 18px; border: 3px solid #dbe4ee; border-radius: 18px; background: #f4f7fb; -webkit-user-select: text; user-select: text; }
.pf .two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opts button, .avs button { background: #fff; border: 3px solid #e3e8ef; border-radius: 16px; padding: 12px 6px; font-size: 17px; font-weight: 700; color: #555; }
.opts button.on, .avs button.on { border-color: #4dabf7; background: #e7f5ff; color: #1c7ed6; box-shadow: 0 3px 0 #4dabf7; }
.avbox { display: flex; gap: 18px; align-items: center; border: 3px dashed #ced4da; border-radius: 22px; padding: 14px; font-size: 20px; }
.upbtn { margin-top: 8px; background: linear-gradient(135deg, #4dabf7, #1c7ed6); color: #fff; font-weight: 800; font-size: 17px; padding: 10px 16px; border-radius: 14px; }
.avs { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 8px; margin-bottom: 14px; }
.avs button { font-size: 34px; padding: 6px; }
@media (max-width: 480px) { .pf .two { grid-template-columns: 1fr; } }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 9; }
.confetti i { position: absolute; top: -40px; font-size: 30px; font-style: normal; animation: fall 1.5s ease-in forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(360deg); opacity: .6; } }
.spk.wait { animation: blink .6s infinite alternate; background: #ffd43b; }
@keyframes blink { to { opacity: .35; } }
.submitbig { display: block; margin: 36px auto 10px; padding: 14px 40px; font-size: 20px; font-weight: 800; border-radius: 18px; background: #7950f2; color: #fff; box-shadow: 0 4px 0 #5f3dc4; }
