/* ============================================================
   Tiếng Anh của Thuỷ — phong cách thanh lịch, sang trọng, chiều sâu 3D
   Bảng màu: hồng phấn · vàng gold champagne · tím mauve · nền ngà
   ============================================================ */
:root {
  --ink: #33232e;
  --ink-soft: #8a7682;
  --rose: #d182a2;
  --rose-deep: #b15b7f;
  --gold: #c79a55;
  --gold-lt: #ecd6a6;
  --mauve: #a98cc4;
  --blue: #a9c9ea;
  --ivory: #fbf4f0;
  --cream: #fffaf6;
  --glass: rgba(255, 251, 248, 0.62);
  --glass-strong: rgba(255, 252, 249, 0.82);
  --stroke: rgba(199, 154, 85, 0.30);
  --stroke-lt: rgba(255, 255, 255, 0.75);
  --good: #2fa579;
  --bad: #d1466a;
  --sh-amb: 0 8px 22px rgba(120, 70, 95, 0.12);
  --sh-key: 0 18px 40px rgba(120, 70, 110, 0.18);
  --sh-lift: 0 30px 66px rgba(110, 60, 100, 0.26);
  --emboss: inset 0 1px 0 rgba(255,255,255,.85), inset 0 -2px 6px rgba(150,90,120,.10);
  --radius: 24px;
  --radius-sm: 16px;
  --serif: "Playfair Display", "Cambria", "Georgia", serif;
  --font: "Be Vietnam Pro", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--ivory);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  position: relative;
  overflow-x: hidden;
}
/* Nền: quầng sáng hồng/gold/mauve trôi nhẹ tạo chiều sâu sang trọng */
body::before, body::after {
  content: ""; position: fixed; z-index: -2; border-radius: 50%;
  filter: blur(70px); opacity: 0.5; pointer-events: none;
}
body::before {
  width: 540px; height: 540px; top: -170px; right: -150px;
  background: radial-gradient(circle at 35% 35%, rgba(209,130,162,.55), transparent 70%),
              radial-gradient(circle at 70% 70%, rgba(236,214,166,.55), transparent 72%);
  animation: float1 18s ease-in-out infinite;
}
body::after {
  width: 480px; height: 480px; bottom: -170px; left: -150px;
  background: radial-gradient(circle at 40% 40%, rgba(169,140,196,.45), transparent 70%),
              radial-gradient(circle at 65% 65%, rgba(169,201,234,.45), transparent 72%);
  animation: float2 22s ease-in-out infinite;
}
@keyframes float1 { 0%,100%{transform:translate(0,0) scale(1)} 50%{transform:translate(-28px,38px) scale(1.07)} }
@keyframes float2 { 0%,100%{transform:translate(0,0) scale(1)} 50%{transform:translate(36px,-26px) scale(1.09)} }

#app { max-width: 480px; margin: 0 auto; min-height: 100vh; padding: 22px 16px 118px; position: relative; z-index: 1; }

/* ---------- Header + avatar ---------- */
.app-header { display: flex; align-items: center; gap: 13px; margin-bottom: 22px; position: relative; }
.app-header::after { content:""; position:absolute; left:2px; right:2px; bottom:-12px; height:1px; background: linear-gradient(90deg, transparent, rgba(199,154,85,.55) 20%, rgba(199,154,85,.55) 80%, transparent); }
.head-txt { flex: 1 1 auto; min-width: 0; }
.head-right { display: flex; align-items: center; gap: 9px; margin-left: auto; }
.mascot {
  width: 60px; height: 60px; border-radius: 50%; object-fit: cover; object-position: center 28%;
  flex: 0 0 auto; border: 2px solid var(--cream);
  box-shadow: 0 0 0 2px var(--gold), 0 0 0 4px rgba(255,255,255,.7),
              0 10px 24px rgba(177, 91, 127, 0.4);
  animation: bob 4.5s ease-in-out infinite;
}
@keyframes bob { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-4px)} }
.greet-title { font-family: var(--serif); font-weight: 700; font-size: 1.32rem; line-height: 1.12; letter-spacing: .2px; }
.greet-sub { color: var(--ink-soft); font-size: .82rem; margin-top: 3px; }
.icon-btn {
  border: 1px solid var(--stroke); cursor: pointer; width: 44px; height: 44px; border-radius: 50%;
  background: var(--glass-strong); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font-size: 18px; display: grid; place-items: center; color: var(--ink);
  box-shadow: var(--sh-amb), var(--emboss); transition: transform .12s;
}
.icon-btn:active { transform: scale(.9); }
.streak-badge {
  background: linear-gradient(135deg, var(--cream), #fdeede);
  border-radius: 999px; padding: 9px 13px; font-weight: 700; font-size: .9rem;
  box-shadow: var(--sh-amb), var(--emboss); display: flex; align-items: center; gap: 4px; white-space: nowrap;
  border: 1px solid var(--stroke);
}

/* ---------- Card / section ---------- */
.section-title { font-family: var(--serif); font-weight: 700; font-size: 1.2rem; letter-spacing: .1px; margin: 28px 4px 15px; display:flex; align-items:center; gap:10px; }
.section-title::after { content:""; flex:1; height:1px; background: linear-gradient(90deg, rgba(199,154,85,.5), rgba(199,154,85,0)); }
.card {
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(18px) saturate(1.3);
  border-radius: var(--radius);
  box-shadow: var(--sh-key), var(--emboss);
  border: 1px solid var(--stroke); padding: 20px; position: relative;
}
/* ánh sáng gloss góc trên tạo cảm giác 3D bóng */
.card::before, .hero::before, .stat::before, .topic-tile::before, .option::before, .gram-card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(135deg, rgba(255,255,255,.5), rgba(255,255,255,0) 42%);
}

/* Hero */
.hero {
  position: relative; overflow: hidden; border-radius: var(--radius); padding: 24px;
  background: linear-gradient(140deg, rgba(255,255,255,.92), rgba(247,214,226,.8) 55%, rgba(233,214,232,.78));
  box-shadow: var(--sh-lift), var(--emboss); border: 1px solid var(--stroke);
}
.hero h2 { font-family: var(--serif); margin: 0 0 7px; font-size: 1.42rem; font-weight: 700; }
.hero p { margin: 0 0 17px; color: var(--ink-soft); font-size: .92rem; }
.hero .sparkle { position:absolute; right:-4px; top:-16px; font-size:80px; opacity:.22; transform: rotate(10deg); }

/* Stat */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; perspective: 800px; }
.stat {
  position: relative; background: var(--glass-strong);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius-sm); padding: 15px 8px; text-align: center;
  box-shadow: var(--sh-amb), var(--emboss); border: 1px solid var(--stroke);
  transition: transform .25s ease, box-shadow .25s;
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--sh-key); }
.stat .num { font-family: var(--serif); font-weight: 700; font-size: 1.5rem; background: linear-gradient(120deg, var(--rose-deep), var(--gold)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stat .lbl { font-size: .67rem; color: var(--ink-soft); margin-top: 4px; letter-spacing: .2px; }

/* ---------- Nút 3D ---------- */
.btn {
  border: none; cursor: pointer; font-family: inherit; font-weight: 700; letter-spacing: .2px;
  border-radius: 999px; padding: 15px 22px; font-size: 1.02rem; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(180deg, var(--rose) 0%, var(--rose-deep) 100%);
  box-shadow: 0 12px 24px rgba(177, 91, 127, 0.4),
              inset 0 1px 0 rgba(255,255,255,.5),
              inset 0 -3px 9px rgba(120, 40, 75, 0.35);
  transition: transform .12s ease, box-shadow .2s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-shadow: 0 1px 2px rgba(110,30,60,.28);
}
.btn::after { content:""; position:absolute; top:0; bottom:0; left:-70%; width:55%; background: linear-gradient(100deg, transparent, rgba(255,255,255,.55), transparent); transform: skewX(-18deg); pointer-events:none; animation: shimmer 5s ease-in-out infinite; }
@keyframes shimmer { 0%, 55% { left:-70%; } 100% { left:140%; } }
.btn:active { transform: translateY(3px) scale(.99); box-shadow: 0 4px 12px rgba(177,91,127,.4), inset 0 1px 0 rgba(255,255,255,.35); }
.btn.block { width: 100%; }
.btn.lav { background: linear-gradient(180deg, var(--mauve), #8a6bb5); box-shadow: 0 12px 24px rgba(138,107,181,.42), inset 0 1px 0 rgba(255,255,255,.45), inset 0 -3px 9px rgba(70,40,120,.35); text-shadow:0 1px 2px rgba(60,30,110,.28); }
.btn.mint { background: linear-gradient(180deg, var(--gold-lt), var(--gold)); box-shadow: 0 12px 24px rgba(199,154,85,.42), inset 0 1px 0 rgba(255,255,255,.6), inset 0 -3px 9px rgba(130,95,30,.32); color:#5a4415; text-shadow:none; }
.btn.ghost { background: var(--glass-strong); color: var(--ink); box-shadow: var(--sh-amb), var(--emboss); border: 1px solid var(--stroke); text-shadow:none; }
.btn.ghost::after { display:none; }
.btn.sm { padding: 10px 15px; font-size: .85rem; }

/* ---------- Topic tiles (3D) ---------- */
.topic-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; perspective: 900px; }
.topic-tile {
  position: relative; background: var(--glass);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-radius: var(--radius-sm); padding: 17px 15px;
  box-shadow: var(--sh-amb), var(--emboss);
  cursor: pointer; text-align: left; border: 1px solid var(--stroke);
  transition: transform .2s ease, box-shadow .25s; transform-style: preserve-3d;
  display: flex; flex-direction: column; gap: 6px;
}
.topic-tile:hover { box-shadow: var(--sh-key); }
.topic-tile:active { transform: translateY(2px) scale(.985); }
.topic-tile .emo { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; font-size: 25px; margin-bottom: 2px;
  background: linear-gradient(150deg, rgba(255,255,255,.95), rgba(247,224,232,.82));
  border: 1px solid var(--stroke); box-shadow: var(--emboss), 0 6px 14px rgba(120,70,110,.14); }
.topic-tile .t-vi { font-family: var(--serif); font-weight: 700; font-size: 1.06rem; letter-spacing: .1px; }
.topic-tile .t-en { font-size: .68rem; color: var(--gold); font-weight: 600; letter-spacing: 1px; text-transform: uppercase; }
.topic-tile .bar { height: 7px; border-radius: 999px; background: rgba(120,70,95,.10); overflow: hidden; margin-top: 5px; box-shadow: inset 0 1px 2px rgba(120,70,95,.18); }
.topic-tile .bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--rose)); border-radius: 999px; transition: width .5s; }
.topic-tile .cnt { font-size: .67rem; color: var(--ink-soft); }

/* ---------- Flashcard 3D ---------- */
.flash-wrap { display: flex; flex-direction: column; align-items: center; gap: 19px; }
.progress-line { width: 100%; height: 9px; background: rgba(120,70,95,.10); border-radius: 999px; overflow: hidden; box-shadow: inset 0 1px 3px rgba(120,70,95,.2); }
.progress-line > i { display:block; height:100%; background: linear-gradient(90deg,var(--mauve),var(--rose),var(--gold)); transition: width .35s; }
.flash-count { font-size: .82rem; color: var(--ink-soft); align-self: flex-end; font-weight: 600; }

.flip { perspective: 1100px; -webkit-perspective: 1100px; width: 100%; }
.flip-inner { position: relative; width: 100%; min-height: 356px; transform-style: preserve-3d; -webkit-transform-style: preserve-3d; transition: transform .58s cubic-bezier(.2,.7,.2,1); -webkit-transition: -webkit-transform .58s cubic-bezier(.2,.7,.2,1); }
.flip.flipped .flip-inner { transform: rotateY(180deg); -webkit-transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: var(--radius); overflow: hidden;
  background: linear-gradient(165deg, var(--cream), #fdeef0);
  box-shadow: var(--sh-lift), var(--emboss); border: 1px solid var(--stroke);
  padding: 30px 22px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
}
.face::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(125deg, rgba(255,255,255,.6) 0%, rgba(255,255,255,0) 40%); }
.face.back { transform: rotateY(180deg); -webkit-transform: rotateY(180deg); background: linear-gradient(165deg,var(--cream), #f0e8f6); }
.face .word-en { font-family: var(--serif); font-size: 2.35rem; font-weight: 700; letter-spacing: .4px; position: relative; z-index: 1; color: var(--ink); }
.face .ipa { color: var(--gold); font-size: 1.1rem; margin-top: 7px; font-weight: 600; position: relative; z-index:1; letter-spacing:.3px; }
.face .word-mean { font-family: var(--serif); font-weight: 700; font-size: 1.55rem; color: var(--rose-deep); margin-top: 12px; position: relative; z-index: 1; }
.face .tap-hint { position:absolute; bottom: 15px; font-size:.72rem; color: var(--ink-soft); z-index:1; }
.face .word-vi { font-family: var(--serif); font-size: 1.9rem; font-weight: 700; color: var(--rose-deep); position: relative; z-index:1; }
.face .ex { margin-top: 17px; font-size: .96rem; position: relative; z-index:1; }
.face .ex .en { font-weight: 600; }
.face .ex .vi { color: var(--ink-soft); font-size: .87rem; margin-top: 3px; }

.speak-btn {
  border: none; cursor: pointer; margin-top: 17px; position: relative; z-index: 2;
  width: 64px; height: 64px; border-radius: 50%; color: #fff; font-size: 26px;
  background: linear-gradient(180deg, var(--gold-lt), var(--gold));
  box-shadow: 0 12px 24px rgba(199,154,85,.5), inset 0 2px 0 rgba(255,255,255,.6), inset 0 -3px 9px rgba(130,95,30,.35);
  display: grid; place-items: center; transition: transform .12s; color:#5a4415;
}
.speak-btn:active { transform: scale(.9); }
.speak-btn.speaking { animation: spk .75s ease; }
.mini-speak.speaking { animation: spk .75s ease; }
@keyframes spk { 0% { box-shadow: 0 0 0 0 rgba(199,154,85,.6); } 70% { box-shadow: 0 0 0 15px rgba(199,154,85,0); } 100% { box-shadow: 0 0 0 0 rgba(199,154,85,0); } }

.flash-actions { display: flex; gap: 12px; width: 100%; }
.flash-actions .btn { flex: 1; }

/* ---------- Quiz (3D) ---------- */
.quiz-q { text-align: center; }
.quiz-prompt-lbl { color: var(--ink-soft); font-size: .84rem; font-weight: 600; }
.quiz-word { font-family: var(--serif); font-size: 2.1rem; font-weight: 700; margin: 8px 0 4px; }
.quiz-word.vi { color: var(--rose-deep); }
.options { display: grid; gap: 12px; margin-top: 18px; perspective: 900px; }
.option {
  position: relative; background: var(--glass-strong); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--stroke); border-radius: var(--radius-sm);
  padding: 15px 16px; font-size: 1.06rem; font-weight: 600; cursor: pointer; text-align: center;
  font-family: inherit; color: var(--ink);
  box-shadow: var(--sh-amb), var(--emboss); transform-style: preserve-3d;
  transition: transform .18s, border-color .2s, background .2s, box-shadow .2s;
}
.option:hover { box-shadow: var(--sh-key); }
.option:active { transform: scale(.98); }
.option.correct { background: #e6f7ef; border-color: var(--good); color: var(--good); }
.option.wrong { background: #fbe7ec; border-color: var(--bad); color: var(--bad); }
.option[disabled] { cursor: default; }

.result-card { text-align: center; }
.result-emoji { font-size: 72px; filter: drop-shadow(0 8px 14px rgba(120,70,110,.32)); }
.result-score { font-family: var(--serif); font-size: 2.7rem; font-weight: 700; background: linear-gradient(120deg,var(--rose-deep),var(--gold)); -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent; margin: 6px 0; }
.result-msg { color: var(--ink-soft); margin-bottom: 18px; }

/* ---------- Phrases ---------- */
.phrase-row { display: flex; align-items: center; gap: 12px; padding: 14px 4px; border-bottom: 1px solid var(--stroke); }
.phrase-row:last-child { border-bottom: none; }
.phrase-text { flex: 1; }
.phrase-text .en { font-weight: 700; font-size: 1.04rem; }
.phrase-text .vi { color: var(--ink-soft); font-size: .86rem; margin-top: 2px; }
.mini-speak {
  border: 1px solid var(--stroke); cursor: pointer; flex: 0 0 auto;
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(180deg,#fbf1dd,#f3e3c3); color: var(--gold); font-size: 19px;
  display: grid; place-items: center; transition: transform .12s;
  box-shadow: var(--sh-amb), var(--emboss);
}
.mini-speak:active { transform: scale(.9); }

/* ---------- Grammar ---------- */
.gram-card { margin-bottom: 15px; position: relative; }
.gram-head { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-weight: 700; font-size: 1.12rem; }
.gram-head .emo { font-size: 25px; filter: drop-shadow(0 4px 6px rgba(120,70,110,.28)); }
.gram-head .en { color: var(--ink-soft); font-weight: 400; font-size: .76rem; font-family: var(--font); letter-spacing:.3px; text-transform: uppercase; }
.gram-points { margin: 13px 0 0; padding-left: 4px; list-style: none; display: grid; gap: 9px; }
.gram-points li { position: relative; padding-left: 24px; font-size: .93rem; line-height: 1.5; }
.gram-points li::before { content: "◆"; color: var(--gold); position: absolute; left: 2px; font-size: .72rem; top: 3px; }
.gram-ex { margin-top: 15px; background: rgba(247,236,242,.7); border-radius: var(--radius-sm); padding: 13px 14px; display: grid; gap: 11px; border:1px solid var(--stroke); }
.gram-ex .row { display:flex; align-items:center; gap:10px; }
.gram-ex .txt { flex:1; }
.gram-ex .en { font-weight: 700; }
.gram-ex .vi { color: var(--ink-soft); font-size: .85rem; }

/* ---------- Đầu màn con ---------- */
.view-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.back-btn {
  border: 1px solid var(--stroke); background: var(--glass-strong); backdrop-filter: blur(8px);
  box-shadow: var(--sh-amb), var(--emboss); cursor: pointer; width: 44px; height: 44px; border-radius: 50%;
  font-size: 20px; display: grid; place-items: center; color: var(--ink); flex: 0 0 auto;
}
.view-head h2 { font-family: var(--serif); margin: 0; font-size: 1.28rem; font-weight: 700; }
.view-head .sub { font-size: .78rem; color: var(--ink-soft); }

/* ---------- Nav dưới (glass pill 3D) ---------- */
.nav {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 12px;
  width: min(468px, calc(100% - 20px));
  background: rgba(255,251,248,.72); backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-radius: 28px; box-shadow: var(--sh-lift), var(--emboss);
  display: flex; justify-content: space-around; padding: 9px 6px; z-index: 50; border: 1px solid var(--stroke);
}
.nav button {
  border: none; background: transparent; cursor: pointer; font-family: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--ink-soft); font-size: .65rem; font-weight: 600; padding: 6px 8px; border-radius: 16px;
  flex: 1; transition: color .2s, background .2s;
}
.nav button .ic { font-size: 22px; transition: transform .2s; }
.nav button.active { color: var(--rose-deep); background: linear-gradient(180deg, rgba(209,130,162,.16), rgba(199,154,85,.08)); box-shadow: inset 0 0 0 1px var(--stroke); }
.nav button.active .ic { transform: translateY(-2px) scale(1.14); }

/* ---------- Hiệu ứng ---------- */
.pop { animation: pop .5s cubic-bezier(.2,.8,.2,1.2); }
@keyframes pop { 0%{transform:scale(.6);opacity:0} 60%{transform:scale(1.08)} 100%{transform:scale(1);opacity:1} }
.toast {
  position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: rgba(51,35,46,.96); color: #fff; padding: 11px 20px; border-radius: 999px; font-size: .86rem; font-weight: 600;
  opacity: 0; transition: all .3s; z-index: 100; pointer-events: none; box-shadow: var(--sh-key); max-width: 88%; text-align:center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.empty { text-align:center; color: var(--ink-soft); padding: 30px 10px; }
.empty .big { font-size: 52px; }
.hidden { display: none !important; }
.view { animation: fade .4s ease; }
@keyframes fade { from{opacity:0; transform: translateY(10px)} to{opacity:1; transform:none} }

.install-hint {
  margin-top: 18px; background: rgba(236,214,166,.28); backdrop-filter: blur(8px);
  border-radius: var(--radius-sm); padding: 13px 15px; font-size: .83rem; color: var(--ink);
  display:flex; gap:8px; align-items:center; border:1px solid var(--stroke); box-shadow: var(--emboss);
}

/* ---------- Đánh bóng cao cấp ---------- */
/* Thẻ chủ đề hiện lên so le, mềm mại */
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.topic-grid .topic-tile { animation: rise .55s both; }
.topic-grid .topic-tile:nth-child(1){animation-delay:.03s}
.topic-grid .topic-tile:nth-child(2){animation-delay:.08s}
.topic-grid .topic-tile:nth-child(3){animation-delay:.13s}
.topic-grid .topic-tile:nth-child(4){animation-delay:.18s}
.topic-grid .topic-tile:nth-child(5){animation-delay:.23s}
.topic-grid .topic-tile:nth-child(6){animation-delay:.28s}
.topic-grid .topic-tile:nth-child(7){animation-delay:.33s}
.topic-grid .topic-tile:nth-child(n+8){animation-delay:.38s}

/* Ánh sáng quét chậm qua hero */
.hero::after { content:""; position:absolute; top:-40%; left:-30%; width:60%; height:180%; transform: rotate(18deg);
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.35), transparent); animation: heroSheen 9s ease-in-out infinite; pointer-events:none; }
@keyframes heroSheen { 0%,60%{ left:-40%; opacity:.0 } 75%{opacity:.9} 100%{ left:130%; opacity:0 } }

/* Số liệu ánh kim lấp lánh nhẹ */
.stat .num, .result-score { background-size: 200% auto; animation: goldshift 6s linear infinite; }
@keyframes goldshift { to { background-position: 200% center; } }

/* Avatar vầng sáng nhẹ */
.mascot { position: relative; }

/* ---------- Tinh chỉnh chữ & nhịp bố cục ---------- */
body { letter-spacing: .1px; line-height: 1.45; text-rendering: optimizeLegibility; }
.greet-title, .hero h2, .view-head h2, .section-title, .result-score, .quiz-word,
.face .word-en, .face .word-vi, .stat .num { letter-spacing: -0.012em; }
.greet-title { font-size: 1.44rem; font-weight: 800; }
.hero h2 { font-size: 1.58rem; font-weight: 800; }
.view-head h2 { font-size: 1.34rem; }
.face .word-en { font-size: 2.55rem; font-weight: 800; }
.face .word-vi { font-size: 2.05rem; }
.face .ipa { letter-spacing: .4px; }
.quiz-word { font-size: 2.25rem; }
.greet-sub, .view-head .sub { letter-spacing: .2px; }
.stat .lbl, .quiz-prompt-lbl, .flash-count, .btn, .nav button { letter-spacing: .3px; }
.phrase-text .en, .gram-ex .en, .face .ex .en { letter-spacing: .1px; }
.stat .num, .flash-count, .streak-badge, .result-score, .quiz-word { font-variant-numeric: tabular-nums; }
.hero p, .phrase-text .vi, .face .ex .vi, .gram-points li { line-height: 1.5; }

/* ---------- Màn mở đầu (splash) ---------- */
#splash { position: fixed; inset: 0; z-index: 999; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  background: radial-gradient(circle at 50% 34%, var(--cream), var(--ivory) 72%); text-align: center; padding: 24px; }
#splash.hide { opacity: 0; visibility: hidden; transition: opacity .6s ease, visibility .6s; }
#splash .s-ava { width: 124px; height: 124px; border-radius: 50%; object-fit: cover; object-position: center 28%;
  border: 3px solid #fff; box-shadow: 0 0 0 3px var(--gold), 0 0 44px rgba(199,154,85,.5), 0 16px 44px rgba(177,91,127,.4);
  animation: splashAva 1.1s cubic-bezier(.2,.8,.2,1.1) both; }
#splash .s-title { font-family: var(--serif); font-weight: 800; font-size: 2.05rem; color: var(--ink); letter-spacing: -0.012em; animation: splashUp .8s .25s both; }
#splash .s-sub { color: var(--ink-soft); font-size: .92rem; margin-top: -6px; letter-spacing: .3px; animation: splashUp .8s .42s both; }
#splash .s-dots { display: flex; gap: 7px; margin-top: 6px; animation: splashUp .8s .58s both; }
#splash .s-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); animation: sdot 1s infinite; }
#splash .s-dots i:nth-child(2) { animation-delay: .16s; }
#splash .s-dots i:nth-child(3) { animation-delay: .32s; }
@keyframes splashAva { from { opacity: 0; transform: scale(.7) translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes splashUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes sdot { 0%,100% { opacity: .3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-5px); } }

/* ---------- Chuyển màn mượt ---------- */
.view { animation: none; }
@keyframes screenIn { from { opacity: 0; transform: translateY(12px) scale(.992); } to { opacity: 1; transform: none; } }
#app.screen-in { animation: screenIn .45s cubic-bezier(.2,.75,.2,1); }

/* ---------- Tông xanh áo dài (data-theme="blue") ---------- */
:root[data-theme="blue"] {
  --ink: #22303b;
  --ink-soft: #6f8697;
  --rose: #6fb0dd;
  --rose-deep: #3f8fc6;
  --mauve: #8ab6dd;
  --ivory: #f1f7fc;
  --cream: #fbfdff;
  --glass: rgba(250, 253, 255, 0.62);
  --glass-strong: rgba(250, 253, 255, 0.82);
  --bad: #e0637f;
}
:root[data-theme="blue"] body::before {
  background: radial-gradient(circle at 30% 30%, rgba(111,176,221,.5), transparent 70%),
              radial-gradient(circle at 70% 70%, rgba(236,214,166,.5), transparent 72%);
}
:root[data-theme="blue"] body::after {
  background: radial-gradient(circle at 40% 40%, rgba(138,184,221,.45), transparent 70%),
              radial-gradient(circle at 65% 65%, rgba(191,219,240,.45), transparent 72%);
}
:root[data-theme="blue"] .hero {
  background: linear-gradient(140deg, rgba(255,255,255,.92), rgba(210,233,249,.82) 55%, rgba(223,238,248,.8));
}
:root[data-theme="blue"] .face.back { background: linear-gradient(165deg, var(--cream), #e6f1fb); }
:root[data-theme="blue"] .gram-ex { background: rgba(232,242,250,.7); }

/* ---------- Hội thoại (danh sách + chat) ---------- */
.dlg-list { display: grid; gap: 11px; }
.dlg-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; cursor: pointer;
  background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--stroke);
  border-radius: var(--radius-sm); padding: 13px 15px; box-shadow: var(--sh-amb), var(--emboss); font-family: inherit; color: var(--ink);
  transition: transform .12s, box-shadow .2s; }
.dlg-item:hover { box-shadow: var(--sh-key); }
.dlg-item:active { transform: scale(.985); }
.dlg-emo { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-size: 24px; flex: 0 0 auto;
  background: linear-gradient(150deg, rgba(255,255,255,.95), rgba(247,224,232,.82)); border: 1px solid var(--stroke); box-shadow: var(--emboss); }
.dlg-txt { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.dlg-vi { font-family: var(--serif); font-weight: 700; font-size: 1.06rem; }
.dlg-en { font-size: .68rem; color: var(--gold); font-weight: 600; letter-spacing: 1px; text-transform: uppercase; }
.dlg-go { color: var(--ink-soft); font-size: 1.5rem; }

.chat { display: flex; flex-direction: column; gap: 12px; }
.bubble-row { display: flex; align-items: flex-end; gap: 8px; max-width: 100%; }
.bubble-row.them { justify-content: flex-start; }
.bubble-row.me { justify-content: flex-end; flex-direction: row-reverse; }
.bubble { max-width: 78%; border-radius: 18px; padding: 11px 14px; box-shadow: var(--sh-amb), var(--emboss); border: 1px solid var(--stroke); }
.bubble-row.them .bubble { background: var(--glass-strong); border-bottom-left-radius: 6px; }
.bubble-row.me .bubble { background: linear-gradient(160deg, #ffffff, rgba(209,130,162,.16)); border-bottom-right-radius: 6px; }
.bubble .who { font-size: .64rem; font-weight: 700; color: var(--gold); letter-spacing: .4px; margin-bottom: 3px; text-transform: uppercase; }
.bubble .b-en { font-weight: 700; font-size: 1.02rem; }
.bubble .b-vi { color: var(--ink-soft); font-size: .84rem; margin-top: 3px; }
.bubble-row .mini-speak { width: 44px; height: 44px; font-size: 17px; }
.bubble-row.active .bubble { box-shadow: 0 0 0 3px rgba(209,130,162,.28), var(--sh-key); border-color: var(--rose); }
:root[data-theme="blue"] .bubble-row.me .bubble { background: linear-gradient(160deg, #ffffff, rgba(111,176,221,.18)); }
:root[data-theme="blue"] .bubble-row.active .bubble { box-shadow: 0 0 0 3px rgba(111,176,221,.3), var(--sh-key); }
:root[data-theme="blue"] .dlg-emo { background: linear-gradient(150deg, rgba(255,255,255,.95), rgba(210,233,249,.82)); }

/* Nav 6 mục — thu nhỏ chút cho vừa */
.nav button { font-size: .62rem; padding: 6px 4px; }
.nav button .ic { font-size: 21px; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; }
  .flip, .flip-inner { transition: none !important; }
}
