:root {
  --ink: #22204A;
  --ink-soft: #5D5B82;
  --paper: #E6F3EC;
  --grid: #C9E2D4;
  --white: #FFFFFF;
  --seal: #E23D4B;
  --sun: #FFC83D;
  --t1: #E23D4B;
  --t2: #EE8A00;
  --t3: #179870;
  --t4: #5A54D8;
  --t0: #8A8EA8;
  --r-phone: 44px;
  --r-card: 22px;
  --r-pill: 999px;
  --f-head: "Grandstander", "Lexend", system-ui, sans-serif;
  --f-body: "Lexend", system-ui, sans-serif;
  --f-zh: "Noto Serif SC", "Songti SC", serif;
  --f-py: "Noto Sans SC", "Lexend", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--f-body);
  color: var(--ink);
  background-color: var(--paper);
  /* 田字格: a grade de treino de caligrafia chinesa */
  background-image:
    linear-gradient(var(--grid) 2px, transparent 2px),
    linear-gradient(90deg, var(--grid) 2px, transparent 2px);
  background-size: 120px 120px;
  background-position: -1px -1px;
  min-height: 100vh;
}

button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--t4); outline-offset: 2px; }
svg use { pointer-events: none; }

.zh { font-family: var(--f-zh); font-weight: 600; }
.py { font-family: var(--f-py); font-weight: 500; }
.py i, i.t0, i.t1, i.t2, i.t3, i.t4 { font-style: normal; }
.t0 { color: var(--t0); } .t1 { color: var(--t1); } .t2 { color: var(--t2); } .t3 { color: var(--t3); } .t4 { color: var(--t4); }
.t1c { color: var(--t1); } .t2c { color: var(--t2); } .t3c { color: var(--t3); } .t4c { color: var(--t4); }
.t2bg { background: var(--t2) !important; } .t3bg { background: var(--t3) !important; } .t4bg { background: var(--t4) !important; }

/* ---------- página de apresentação ---------- */
.intro {
  display: flex; gap: 20px; align-items: center;
  max-width: 1200px; margin: 0 auto; padding: 40px 28px 8px;
}
.intro-mo { width: 76px; height: 78px; flex: none; }
.intro h1 { font-family: var(--f-head); font-weight: 800; font-size: 2.4rem; line-height: 1.05; margin: 0 0 6px; }
.intro p { margin: 0; max-width: 62ch; color: var(--ink-soft); line-height: 1.5; }

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 44px 28px;
  max-width: 1600px; margin: 0 auto; padding: 32px 28px 80px;
  justify-items: center;
}
.screen { margin: 0; width: 360px; }
.screen figcaption { margin-top: 14px; font-size: .9rem; line-height: 1.45; color: var(--ink-soft); padding: 0 6px; }
.screen figcaption b { display: block; font-family: var(--f-head); font-size: 1.15rem; color: var(--ink); margin-bottom: 2px; }

/* ---------- celular ---------- */
.phone {
  width: 360px; height: 760px;
  background: #FBFDFC;
  border: 10px solid var(--ink);
  border-radius: var(--r-phone);
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 50px -24px rgba(34, 32, 74, .45);
  position: relative;
}
.status {
  display: flex; justify-content: space-between;
  padding: 10px 22px 4px; font-size: .72rem; font-weight: 600;
}
.body { flex: 1; overflow-y: auto; padding: 8px 18px 18px; scrollbar-width: none; }
.body::-webkit-scrollbar { display: none; }
h2 { font-family: var(--f-head); font-weight: 800; font-size: 1.7rem; margin: 6px 0 12px; }
h3 { font-family: var(--f-head); font-weight: 600; font-size: 1.05rem; margin: 0; }
.cat { margin: 18px 0 8px; }

.tabbar {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 2px solid #EEF2F0; padding: 8px 6px 14px; background: var(--white);
}
.tabbar a { display: grid; justify-items: center; gap: 3px; font-size: .68rem; color: var(--t0); font-weight: 500; }
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a.on { color: var(--ink); font-weight: 600; }

/* ---------- 1. início ---------- */
.home-top { display: flex; justify-content: space-between; align-items: flex-start; margin-top: 4px; }
.hello { font-family: var(--f-head); font-weight: 800; font-size: 1.9rem; margin: 0; line-height: 1; }
.hello-zh { margin: 4px 0 0; font-size: .95rem; }
.streak {
  background: #FFF1D6; color: #9A5B00; font-weight: 600; font-size: .85rem;
  padding: 7px 12px; border-radius: var(--r-pill);
}
.home-mo { position: relative; display: grid; justify-items: center; margin: 14px 0 6px; }
.bubble {
  background: var(--white); border: 2.5px solid var(--ink); border-radius: 20px;
  padding: 10px 14px; font-weight: 500; font-size: .95rem; max-width: 230px; text-align: center;
  position: relative; margin-bottom: 10px;
}
.bubble::after {
  content: ""; position: absolute; left: 50%; bottom: -11px; width: 16px; height: 16px;
  background: var(--white); border-right: 2.5px solid var(--ink); border-bottom: 2.5px solid var(--ink);
  transform: translateX(-50%) rotate(45deg);
}
.mo-big { width: 128px; height: 132px; animation: float 3.2s ease-in-out infinite; }
.mo-eyes { animation: blink 4.5s infinite; transform-origin: 60px 66px; }
@keyframes float { 50% { transform: translateY(-7px) rotate(-2deg); } }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }

.cta-talk {
  width: 100%; border: 0; border-radius: var(--r-card);
  background: var(--ink); color: var(--white);
  font-family: var(--f-head); font-weight: 800; font-size: 1.25rem;
  padding: 18px; display: flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow: 0 6px 0 #0F0E2B;
  margin-top: 8px;
}
.cta-talk:active { transform: translateY(4px); box-shadow: 0 2px 0 #0F0E2B; }
.cta-talk svg { width: 26px; height: 26px; }

.challenge, .album-peek {
  margin-top: 16px; padding: 14px 16px; border-radius: var(--r-card);
  background: var(--paper); border: 2px solid var(--grid);
}
.challenge-head, .peek-head { display: flex; justify-content: space-between; align-items: center; }
.challenge p { margin: 6px 0 10px; font-size: .92rem; }
.stars { color: var(--sun); font-size: 1.1rem; letter-spacing: 2px; }
.bar { height: 10px; border-radius: var(--r-pill); background: var(--white); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--t3); border-radius: inherit; }
.peek-head span { font-size: .82rem; color: var(--ink-soft); }
.peek-row { display: flex; gap: 8px; margin-top: 10px; }
.sticker-mini {
  width: 52px; height: 52px; display: grid; place-items: center; font-size: 1.6rem;
  background: var(--white); border-radius: 14px; border: 2px solid var(--grid); cursor: pointer;
}
.sticker-mini.new { border-color: var(--seal); color: var(--seal); }

/* ---------- 2. conversa ---------- */
.chat-head {
  display: flex; align-items: center; gap: 10px; padding: 6px 16px 10px;
  border-bottom: 2px solid #EEF2F0;
}
.chat-head .ic { width: 24px; height: 24px; flex: none; }
.chat-head b { font-family: var(--f-head); font-size: 1.15rem; display: block; line-height: 1.1; }
.chat-head.plain b { display: inline; }
.online { font-size: .75rem; color: var(--t3); font-weight: 500; }
.chat-head.plain .online { color: var(--ink-soft); margin-left: 6px; }
.mo-avatar { width: 40px; height: 42px; flex: none; }

.chat { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; background: #F6FAF8; }
.msg { max-width: 82%; padding: 10px 14px; border-radius: 20px; font-size: .93rem; line-height: 1.4; }
.msg.me { align-self: flex-end; background: var(--ink); color: var(--white); border-bottom-right-radius: 6px; }
.msg.mo { align-self: flex-start; background: var(--white); border: 2px solid #E3ECE7; border-bottom-left-radius: 6px; }
.score {
  display: inline-block; margin-left: 6px; font-size: .7rem; font-weight: 600;
  background: var(--sun); color: var(--ink); padding: 2px 7px; border-radius: var(--r-pill);
}

.word-card {
  position: relative; align-self: stretch; margin: 2px 6px;
  background: var(--white); border: 2.5px solid var(--ink); border-radius: var(--r-card);
  padding: 16px 16px 14px; text-align: center;
  box-shadow: 5px 5px 0 var(--grid);
  animation: card-in .5s cubic-bezier(.2, 1.4, .4, 1) both .3s;
}
@keyframes card-in { from { transform: scale(.85) rotate(-3deg); opacity: 0; } }
.seal {
  position: absolute; top: -12px; right: 14px;
  background: var(--seal); color: var(--white); font-family: var(--f-zh); font-weight: 900;
  width: 38px; height: 38px; display: grid; place-items: center; border-radius: 8px;
  transform: rotate(8deg); font-size: 1.15rem;
}
.wc-zh { font-size: 3.4rem; margin: 0; line-height: 1.15; font-weight: 900; }
.wc-py { font-size: 1.25rem; margin: 2px 0 0; }
.wc-pt { margin: 2px 0 12px; color: var(--ink-soft); font-size: .92rem; }
.wc-actions { display: flex; gap: 8px; justify-content: center; }
.wc-actions button {
  display: flex; align-items: center; gap: 6px; border: 2px solid var(--ink); background: var(--white);
  border-radius: var(--r-pill); padding: 8px 14px; font-weight: 600; font-size: .85rem;
}
.wc-actions button svg { width: 18px; height: 18px; }
.wc-actions button.playing { background: var(--sun); }
.chip-action {
  align-self: flex-start; border: 0; background: var(--t3); color: var(--white);
  font-weight: 600; padding: 9px 16px; border-radius: var(--r-pill); font-size: .88rem;
}

.mic-dock {
  display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; justify-items: center;
  padding: 10px 18px 18px; background: var(--white); border-top: 2px solid #EEF2F0; position: relative;
}
.mic-dock .ic { width: 26px; height: 26px; color: var(--t0); }
.dock-hint { font-size: .7rem; color: var(--ink-soft); grid-column: 2; grid-row: 2; margin-top: 4px; }
.mic-btn {
  grid-column: 2; grid-row: 1; position: relative; width: 72px; height: 72px; border-radius: 50%;
  border: 0; background: var(--seal); color: var(--white); display: grid; place-items: center;
  margin-bottom: 2px;
}
.mic-btn svg { width: 32px; height: 32px; position: relative; }
.ring { position: absolute; inset: 0; border-radius: 50%; border: 3px solid var(--seal); animation: ring 2s ease-out infinite; }
.ring.r2 { animation-delay: 1s; }
@keyframes ring { to { transform: scale(1.7); opacity: 0; } }

/* ---------- 3. caractere ---------- */
.char-tabs { display: flex; gap: 8px; justify-content: center; margin: 10px 0 14px; }
.char-tabs button {
  width: 54px; height: 54px; font-size: 1.7rem; border-radius: 16px;
  border: 2px solid var(--grid); background: var(--white);
}
.char-tabs button.on { border-color: var(--ink); background: var(--ink); color: var(--white); }
.grid-box {
  width: 220px; height: 220px; margin: 0 auto; position: relative; border: 3px solid var(--seal);
  background:
    linear-gradient(45deg, transparent calc(50% - .5px), #F3C3C7 calc(50% - .5px), #F3C3C7 calc(50% + .5px), transparent calc(50% + .5px)),
    linear-gradient(-45deg, transparent calc(50% - .5px), #F3C3C7 calc(50% - .5px), #F3C3C7 calc(50% + .5px), transparent calc(50% + .5px)),
    linear-gradient(transparent calc(50% - 1px), #EFA3AA calc(50% - 1px), #EFA3AA calc(50% + 1px), transparent calc(50% + 1px)),
    linear-gradient(90deg, transparent calc(50% - 1px), #EFA3AA calc(50% - 1px), #EFA3AA calc(50% + 1px), transparent calc(50% + 1px)),
    #FFFDFB;
}
#writer { width: 100%; height: 100%; }
.writer-fallback { width: 100%; height: 100%; display: grid; place-items: center; font-size: 150px; font-family: var(--f-zh); font-weight: 600; }
.char-py { text-align: center; font-size: 1.4rem; margin: 12px 0 4px; }
.char-py span { font-family: var(--f-body); font-size: .95rem; color: var(--ink-soft); font-weight: 400; margin-left: 6px; }
.story { background: var(--paper); border-radius: var(--r-card); padding: 14px 16px; margin-top: 12px; }
.story p { margin: 6px 0 10px; font-size: .92rem; line-height: 1.5; }
.parts { display: flex; gap: 8px; flex-wrap: wrap; }
.parts span { background: var(--white); border-radius: 12px; padding: 6px 10px; font-size: .85rem; }
.parts b { font-size: 1.2rem; margin-right: 4px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.btn-soft, .btn-ink {
  border-radius: 16px; padding: 13px 10px; font-weight: 600; font-size: .9rem;
}
.btn-soft { border: 2px solid var(--ink); background: var(--white); }
.btn-ink { border: 0; background: var(--ink); color: var(--white); box-shadow: 0 4px 0 #0F0E2B; }
.btn-ink.wide { width: 100%; margin-top: 16px; }

/* ---------- 4. tom ---------- */
.tone-tip { margin: 10px 0 12px; font-size: .92rem; line-height: 1.45; }
.tone-chart { background: var(--white); border: 2px solid #E3ECE7; border-radius: var(--r-card); padding: 10px 8px 4px; }
.tone-chart svg { width: 100%; display: block; }
.levels line { stroke: #EDF1EF; stroke-width: 1.5; }
.ref { fill: none; stroke-width: 10; stroke-linecap: round; opacity: .35; }
.t3s { stroke: var(--t3); } .t0s { stroke: var(--t0); }
.mine { fill: none; stroke: var(--ink); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.mine.live { animation: draw 1s ease-out; stroke-dasharray: 1200; }
@keyframes draw { from { stroke-dashoffset: 1200; } to { stroke-dashoffset: 0; } }
.tone-chart text { font-family: var(--f-py); font-size: 13px; fill: var(--ink-soft); text-anchor: middle; }
.tone-legend { display: flex; gap: 16px; font-size: .78rem; color: var(--ink-soft); margin: 8px 4px 0; }
.sw { display: inline-block; width: 22px; height: 7px; border-radius: 4px; margin-right: 6px; vertical-align: middle; }
.ref-sw { background: var(--t3); opacity: .35; }
.mine-sw { background: var(--ink); height: 4px; }
.verdict { margin-top: 12px; background: #FFF6E0; border-radius: 16px; padding: 10px 14px; font-size: .9rem; }
.verdict p { margin: 4px 0; }
.tone-kinds { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.tone-kinds div { display: flex; align-items: center; gap: 8px; background: var(--paper); border-radius: 14px; padding: 8px 10px; font-size: .74rem; line-height: 1.25; }
.tone-kinds b { font-family: var(--f-py); font-size: 1.5rem; }
.mic-wide {
  width: 100%; margin-top: 14px; border: 0; border-radius: var(--r-card);
  background: var(--seal); color: var(--white); padding: 15px; font-weight: 600; font-size: 1rem;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.mic-wide svg { width: 24px; height: 24px; }
.mic-wide.rec { background: var(--ink); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.97); } }

/* ---------- 5. álbum ---------- */
.search {
  width: 100%; border: 2px solid var(--grid); border-radius: var(--r-pill);
  padding: 11px 16px; font: inherit; font-size: .9rem; background: var(--white);
}
.filters { display: flex; gap: 6px; margin-top: 10px; }
.filters button { border: 2px solid var(--grid); background: var(--white); border-radius: var(--r-pill); padding: 6px 12px; font-size: .8rem; font-weight: 500; }
.filters button.on { background: var(--ink); color: var(--white); border-color: var(--ink); }
.stickers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.sticker {
  border: 2px solid var(--grid); background: var(--white); border-radius: 18px;
  padding: 10px 4px 8px; display: grid; justify-items: center; gap: 1px;
}
.sticker .zh { font-size: 1.9rem; line-height: 1.2; white-space: nowrap; }
.sticker .zh.long { font-size: 1.35rem; line-height: 1.75; }
.sticker i { font-family: var(--f-py); font-style: normal; font-size: .85rem; font-weight: 500; }
.sticker i b { font-weight: 500; }
.sticker em { font-style: normal; font-size: .74rem; color: var(--ink-soft); }
.sticker small { color: var(--sun); font-size: .8rem; letter-spacing: 1px; }
.sticker.training { border-style: dashed; border-color: var(--t2); }
.sticker.training small { color: var(--t2); letter-spacing: 0; font-weight: 600; font-size: .68rem; }
.sticker.locked { background: var(--paper); border-style: dashed; color: var(--t0); font-size: 1.8rem; font-family: var(--f-head); align-content: center; }
.sticker:active, .sticker-mini:active, .pieces button:active { transform: scale(.94); }

/* ---------- 6. tradutor ---------- */
.trans-in, .trans-out { border-radius: var(--r-card); padding: 12px 16px 14px; position: relative; }
.trans-in { background: var(--paper); }
.trans-in p { font-size: 1.15rem; margin: 4px 50px 0 0; font-weight: 500; }
.trans-out { background: var(--white); border: 2.5px solid var(--ink); margin-top: 10px; text-align: center; box-shadow: 5px 5px 0 var(--grid); }
.lang { font-size: .74rem; color: var(--ink-soft); font-weight: 500; display: block; text-align: left; }
.trans-out .big { font-size: 2.6rem; margin: 4px 0 0; font-weight: 900; }
.trans-out .py { font-size: 1.1rem; margin: 2px 0 12px; }
.mic-small {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--seal); color: var(--white);
  display: grid; place-items: center;
}
.mic-small svg { width: 22px; height: 22px; }
.pieces { display: flex; gap: 8px; }
.pieces button {
  flex: 1; border: 2px solid var(--grid); background: var(--white); border-radius: 16px;
  padding: 8px 4px; display: grid; justify-items: center; font-size: .78rem; color: var(--ink-soft);
}
.pieces .zh { font-size: 1.4rem; color: var(--ink); }
.recent { list-style: none; padding: 0; margin: 0; }
.recent li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 2px; border-bottom: 2px solid #EEF2F0; font-size: .88rem; }
.recent .zh { font-size: 1.05rem; }

/* ---------- 7. pais ---------- */
.phone.parents { background: #F7F7FB; }
.gate { display: inline-flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 600; color: var(--ink-soft); background: #ECEBF5; padding: 5px 10px; border-radius: var(--r-pill); margin: 6px 0 0; }
.gate svg { width: 15px; height: 15px; }
.pais h2 { font-family: var(--f-body); font-weight: 600; font-size: 1.45rem; margin-top: 10px; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kpis div { background: var(--white); border-radius: 16px; padding: 10px; border: 1.5px solid #E6E5F0; }
.kpis b { font-size: 1.35rem; display: block; }
.kpis span { font-size: .7rem; color: var(--ink-soft); line-height: 1.3; display: block; }
.kpis em { font-style: normal; color: var(--t3); font-weight: 600; }
.pais .cat { font-family: var(--f-body); font-weight: 600; font-size: .95rem; }
.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; height: 110px; align-items: end; background: var(--white); border-radius: 16px; padding: 10px 12px 6px; border: 1.5px solid #E6E5F0; }
.bars div { display: grid; grid-template-rows: 1fr auto; height: 100%; align-items: end; justify-items: center; }
.bars span { width: 100%; background: #C9C7E6; border-radius: 6px 6px 2px 2px; }
.bars .today span { background: var(--ink); }
.bars i { font-style: normal; font-size: .66rem; color: var(--ink-soft); margin-top: 4px; }
.weak { display: grid; gap: 10px; background: var(--white); border-radius: 16px; padding: 12px; border: 1.5px solid #E6E5F0; }
.weak > div { display: grid; grid-template-columns: 1fr 70px 34px; gap: 8px; align-items: center; font-size: .8rem; }
.weak .bar { background: #EFEFF5; height: 8px; }
.weak em { font-style: normal; font-weight: 600; text-align: right; }
.next { margin-top: 14px; background: var(--ink); color: var(--white); border-radius: 16px; padding: 12px 14px; font-size: .85rem; line-height: 1.45; }
.next p { margin: 4px 0 0; opacity: .9; }
.settings { list-style: none; padding: 0; margin: 12px 0 0; }
.settings li { display: flex; justify-content: space-between; gap: 8px; padding: 10px 2px; border-bottom: 1.5px solid #E6E5F0; font-size: .82rem; }

@media (max-width: 420px) {
  .intro { padding: 24px 16px 0; }
  .intro h1 { font-size: 1.8rem; }
  .gallery { padding: 24px 0 60px; grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
