:root {
  /* Bộ màu riêng của app Tú Anh (xanh ngọc + cam đào), không dùng màu thương hiệu nào khác */
  --navy: #123c3a; --navy2: #1f6f68; --gold: #f4b183; --gold2: #fbd3b5;
  --bg: #f2f6f4; --card: #fff; --text: #1f3331; --muted: #627370;
  --ok: #1f9d55; --ok-bg: #e5f6ec; --bad: #d64545; --bad-bg: #fde8e8; --line: #dbe4e0;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: "Be Vietnam Pro", system-ui, sans-serif; font-size: 17px; line-height: 1.45;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
#app { max-width: 520px; margin: 0 auto; padding: 0 16px; }

.top {
  margin: 0 -16px; padding: calc(18px + env(safe-area-inset-top)) 20px 22px;
  background: linear-gradient(135deg, var(--navy), var(--navy2)); color: #fff;
  border-radius: 0 0 22px 22px;
}
.top small { color: var(--gold); letter-spacing: .15em; text-transform: uppercase; font-size: 11px; font-weight: 700; }
.top h1 { margin: 2px 0 0; font-size: 24px; }
.top .row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.streak { background: rgba(255,255,255,.12); border-radius: 14px; padding: 6px 12px; text-align: center; font-weight: 700; }
.streak b { display: block; font-size: 22px; color: var(--gold2); }
.streak span { font-size: 11px; font-weight: 500; opacity: .8; }

.card { background: var(--card); border-radius: 18px; padding: 18px; margin-top: 14px; box-shadow: 0 1px 3px rgba(11,26,51,.08); }
.card h2 { margin: 0 0 6px; font-size: 18px; color: var(--navy); }
.muted { color: var(--muted); font-size: 14px; }
.big-btn {
  display: block; width: 100%; margin-top: 14px; padding: 15px; border-radius: 14px;
  background: var(--gold); color: var(--navy); font-weight: 800; font-size: 18px;
}
.big-btn.navy { background: var(--navy); color: var(--gold2); }
.big-btn.ghost { background: transparent; color: var(--navy); border: 2px solid var(--line); }
.big-btn:active { transform: scale(.98); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.stat { background: var(--bg); border-radius: 12px; padding: 10px 6px; text-align: center; }
.stat b { display: block; font-size: 20px; color: var(--navy); }
.stat span { font-size: 12px; color: var(--muted); }
.bar { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.bar i { display: block; height: 100%; background: var(--gold); border-radius: 99px; }
.week { display: flex; justify-content: space-between; margin-top: 12px; }
.week div { text-align: center; font-size: 12px; color: var(--muted); }
.week i { display: block; width: 30px; height: 30px; border-radius: 50%; margin: 4px auto 0; background: var(--line); font-style: normal; line-height: 30px; }
.week i.on { background: var(--gold); color: var(--navy); }

/* Màn học */
.lesson-top { display: flex; align-items: center; gap: 12px; padding: calc(14px + env(safe-area-inset-top)) 0 4px; }
.lesson-top .bar { flex: 1; margin: 0; }
.x { font-size: 22px; color: var(--muted); padding: 4px 8px; }
.step { font-size: 13px; color: var(--muted); margin-top: 6px; }
.flash {
  background: var(--card); border-radius: 22px; min-height: 300px; margin-top: 14px; padding: 26px 20px;
  display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center;
  box-shadow: 0 2px 8px rgba(11,26,51,.1); position: relative;
}
.flash .en { font-size: 32px; font-weight: 800; color: var(--navy); line-height: 1.2; }
.flash.phrase .en { font-size: 24px; }
.flash .vn { font-size: 21px; font-weight: 600; margin-top: 14px; color: var(--text); }
.flash .ex { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); font-size: 16px; width: 100%; }
.flash .ex i { display: block; color: var(--muted); font-size: 14px; margin-top: 2px; }
.flash .topic { position: absolute; top: 12px; left: 16px; font-size: 12px; color: var(--muted); }
.flash .hint { margin-top: 18px; color: var(--muted); font-size: 14px; }
.speak {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; padding: 10px 18px;
  background: var(--bg); border-radius: 99px; font-weight: 700; color: var(--navy);
}
.speak.small { margin: 0; padding: 6px 10px; font-size: 14px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.two .big-btn { margin-top: 14px; }
.bad-btn { background: var(--bad-bg); color: var(--bad); }
.ok-btn { background: var(--ok-bg); color: var(--ok); }

.q { background: var(--card); border-radius: 22px; padding: 22px 18px; margin-top: 14px; text-align: center; box-shadow: 0 2px 8px rgba(11,26,51,.1); }
.q .label { font-size: 13px; color: var(--muted); }
.q .prompt { font-size: 26px; font-weight: 800; color: var(--navy); margin-top: 6px; line-height: 1.25; }
.q .prompt.vn { font-size: 22px; }
.choices { display: grid; gap: 10px; margin-top: 14px; }
.choice {
  text-align: left; padding: 14px 16px; border-radius: 14px; background: var(--card);
  border: 2px solid var(--line); font-size: 17px; font-weight: 600;
}
.choice.ok { border-color: var(--ok); background: var(--ok-bg); color: var(--ok); }
.choice.bad { border-color: var(--bad); background: var(--bad-bg); color: var(--bad); }
.choice:disabled { cursor: default; }
.feedback { margin-top: 12px; padding: 12px 14px; border-radius: 14px; font-weight: 600; }
.feedback.ok { background: var(--ok-bg); color: var(--ok); }
.feedback.bad { background: var(--bad-bg); color: var(--bad); }

.done { text-align: center; padding-top: 40px; }
.done .emoji { font-size: 64px; }
.done h1 { color: var(--navy); margin: 8px 0 4px; }

/* Danh sách */
.page-title { padding: calc(18px + env(safe-area-inset-top)) 0 4px; }
.page-title h1 { margin: 0; color: var(--navy); font-size: 24px; }
.search { width: 100%; margin-top: 12px; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--line); font: inherit; background: #fff; }
.group h3 { margin: 18px 0 6px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.item { display: flex; align-items: center; gap: 10px; background: var(--card); padding: 12px 14px; border-radius: 14px; margin-top: 6px; width: 100%; text-align: left; }
.item .t { flex: 1; min-width: 0; }
.item .t b { display: block; color: var(--navy); }
.item .t span { font-size: 14px; color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); flex: none; }
.dot.l1 { background: #f2b84b; } .dot.l2 { background: #8bc34a; } .dot.l3 { background: var(--ok); }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }

.set-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.set-row:first-of-type { border-top: 0; }
.seg { display: flex; background: var(--bg); border-radius: 12px; padding: 3px; }
.seg button { padding: 8px 12px; border-radius: 10px; font-weight: 600; font-size: 15px; color: var(--muted); }
.seg button.on { background: var(--navy); color: var(--gold2); }
.code { font-family: ui-monospace, Consolas, monospace; font-size: 20px; letter-spacing: .08em; font-weight: 700; color: var(--navy); background: var(--bg); padding: 10px; border-radius: 12px; text-align: center; margin-top: 8px; user-select: all; }
select, .input { font: inherit; padding: 8px 10px; border-radius: 10px; border: 2px solid var(--line); background: #fff; max-width: 60%; }
.input { width: 100%; max-width: none; margin-top: 8px; text-transform: uppercase; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center;
  background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 10;
}
.tabs button { flex: 1; max-width: 130px; padding: 8px 0 10px; font-size: 20px; color: var(--muted); display: flex; flex-direction: column; align-items: center; }
.tabs button span { font-size: 12px; font-weight: 600; margin-top: 2px; }
.tabs button.on { color: var(--navy); }
.tabs button.on span { color: var(--navy); }
body.in-lesson .tabs { display: none; }
body.in-lesson { padding-bottom: 20px; }
[hidden] { display: none !important; }
.mic-box { margin-top: 14px; padding: 12px 14px; border-radius: 14px; text-align: left; font-size: 15px; width: 100%; }
.mic-box.ok { background: var(--ok-bg); color: var(--ok); }
.mic-box.mid { background: #fff4dc; color: #9a6b00; }
.mic-box.bad { background: var(--bad-bg); color: var(--bad); }
.mic-box.listening { background: var(--bg); color: var(--navy); animation: pulse 1.2s infinite; }
.mic-box .muted { margin-top: 6px; }
.mic-words { margin-top: 8px; font-size: 19px; font-weight: 700; line-height: 1.6; }
.w-ok { color: var(--ok); }
.w-bad { color: var(--bad); text-decoration: underline wavy; }
.speak + .speak { margin-left: 8px; }
@keyframes pulse { 50% { opacity: .6; } }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 20; max-width: 90%; text-align: center; }
