:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #eef2f8;
  --text: #1b2333;
  --muted: #5d6a80;
  --border: #dde3ee;
  --primary: #2f6fed;
  --primary-text: #ffffff;
  --bot: #ffffff;
  --user: #2f6fed;
  --user-text: #ffffff;
  --note: #fff8e6;
  --note-border: #f2d98a;
  --great: #12805c;
  --good: #2f6fed;
  --retry: #c2410c;
  --easy: #12805c;
  --mid: #b45309;
  --hard: #b91c1c;
  --ph: #fde68a;
  --ph-text: #5b4300;
  --shadow: 0 1px 2px rgba(20, 30, 60, .06), 0 4px 14px rgba(20, 30, 60, .06);
  --radius: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f141d;
    --surface: #171e2a;
    --surface-2: #1f2836;
    --text: #e6ebf4;
    --muted: #9aa7bd;
    --border: #2b3546;
    --primary: #5b8ff9;
    --primary-text: #0b1220;
    --bot: #1c2431;
    --user: #3b6fd6;
    --user-text: #ffffff;
    --note: #2a2414;
    --note-border: #5c4b1a;
    --great: #34d399;
    --good: #7aa5ff;
    --retry: #fb923c;
    --easy: #34d399;
    --mid: #fbbf24;
    --hard: #f87171;
    --ph: #5c4b1a;
    --ph-text: #fde68a;
    --shadow: none;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0f141d;
  --surface: #171e2a;
  --surface-2: #1f2836;
  --text: #e6ebf4;
  --muted: #9aa7bd;
  --border: #2b3546;
  --primary: #5b8ff9;
  --primary-text: #0b1220;
  --bot: #1c2431;
  --user: #3b6fd6;
  --user-text: #ffffff;
  --note: #2a2414;
  --note-border: #5c4b1a;
  --great: #34d399;
  --good: #7aa5ff;
  --retry: #fb923c;
  --easy: #34d399;
  --mid: #fbbf24;
  --hard: #f87171;
  --ph: #5c4b1a;
  --ph-text: #fde68a;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
}

[hidden] { display: none !important; }

button { font: inherit; color: inherit; }

/* ---------- Topo ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  flex: 1;
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-sub {
  font-weight: 400;
  font-size: .85rem;
  color: var(--muted);
  margin-left: 4px;
}

.icon-btn {
  border: 0;
  background: transparent;
  font-size: 1.25rem;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px;
}

.view { animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

h2 { margin: 0 0 4px; font-size: 1.4rem; }
h3 { margin: 24px 0 8px; font-size: 1rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

.lead { margin: 4px 0 16px; color: var(--muted); }
.muted { color: var(--muted); font-size: .9rem; }

.notice {
  background: var(--note);
  border: 1px solid var(--note-border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: .92rem;
}

/* ---------- Botões ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-weight: 600;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary); filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); font-weight: 500; }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-block { width: 100%; margin-top: 24px; }

.mini-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  min-width: 32px;
  height: 30px;
  padding: 0 6px;
  font-size: .9rem;
  cursor: pointer;
  vertical-align: middle;
}
.mini-btn:hover { background: var(--surface-2); }
.mini-text { font-size: .75rem; font-weight: 700; color: var(--muted); }

/* ---------- Cards ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  text-align: left;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .1s ease, border-color .1s ease;
}
.card:hover { border-color: var(--primary); transform: translateY(-1px); }

.card-emoji { font-size: 2rem; line-height: 1; }
.card-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.card-title { font-weight: 700; }
.card-desc { color: var(--muted); font-size: .9rem; }
.card-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.card-stars { color: #e3a008; letter-spacing: 1px; }

.tag {
  display: inline-block;
  font-size: .75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid currentColor;
}
.tag-easy { color: var(--easy); }
.tag-mid { color: var(--mid); }
.tag-hard { color: var(--hard); }

/* ---------- Apresentação ---------- */

.intro-head { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.intro-emoji { font-size: 3rem; }

.vocab { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.vocab li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.vocab-en { font-weight: 600; }
.vocab-pt { color: var(--muted); flex: 1; font-size: .92rem; }

/* ---------- Conversa ---------- */

.view-chat { display: flex; flex-direction: column; gap: 10px; }

.progress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--primary); transition: width .3s ease; }

.chat {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 6px 0 4px;
  min-height: 40vh;
}

.msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  animation: fade .2s ease;
  overflow-wrap: anywhere;
}
.msg p { margin: 0; }
.msg-text { font-size: 1.05rem; }

.msg-bot {
  align-self: flex-start;
  background: var(--bot);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow);
}
.msg-name { display: block; font-size: .75rem; font-weight: 700; color: var(--muted); margin-bottom: 2px; }
.translation { color: var(--muted); font-size: .9rem; margin-top: 4px !important; font-style: italic; }
.msg-actions { display: flex; gap: 6px; margin-top: 8px; }

.msg-user {
  align-self: flex-end;
  background: var(--user);
  color: var(--user-text);
  border-bottom-right-radius: 4px;
  text-align: right;
}

.msg-note {
  align-self: stretch;
  max-width: 100%;
  background: var(--note);
  border: 1px solid var(--note-border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.model { font-weight: 600; font-size: 1.02rem; }
.note-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 4px; }

.badge {
  display: inline-block;
  margin-top: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  background: var(--surface);
}
.badge-great { color: var(--great); }
.badge-good { color: var(--good); }
.badge-retry { color: var(--retry); }
.badge-hint { color: var(--muted); margin-left: 4px; }

.ph {
  background: var(--ph);
  color: var(--ph-text);
  border-radius: 4px;
  padding: 0 4px;
}

.hint-panel {
  background: var(--surface);
  border: 1px dashed var(--primary);
  border-radius: var(--radius);
  padding: 10px 14px;
}
.hint-panel ul { margin: 6px 0; padding-left: 18px; display: grid; gap: 8px; }
.hint-title { margin: 0; font-weight: 700; font-size: .9rem; }
.hint-en { font-weight: 600; }
.hint-pt { display: block; color: var(--muted); font-size: .88rem; }

.composer {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 0;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: var(--bg);
}
.composer input {
  flex: 1;
  min-width: 0;
  height: 48px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
}
.composer input:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: transparent; }

.mic-btn {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 0;
  background: var(--primary);
  color: var(--primary-text);
  font-size: 1.4rem;
  cursor: pointer;
}
.mic-btn:disabled { opacity: .45; cursor: default; }
.mic-btn.listening {
  background: #dc2626;
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, .55); }
  70% { box-shadow: 0 0 0 14px rgba(220, 38, 38, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

.composer-tools { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin-top: -4px; }

/* ---------- Resultado ---------- */

.summary-head { text-align: center; padding: 12px 0; }
.stars { font-size: 2.6rem; color: #e3a008; letter-spacing: 4px; }
.summary-score { color: var(--muted); margin: 4px 0 0; }

.summary-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.summary-list li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.summary-list p { margin: 2px 0; }
.sum-q { font-weight: 600; }
.sum-said { color: var(--muted); }
.sum-model { font-size: .92rem; }

.summary-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.summary-actions .btn { flex: 1 1 200px; }

/* ---------- Configurações ---------- */

.settings {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  width: min(440px, calc(100vw - 32px));
  padding: 20px;
}
.settings::backdrop { background: rgba(0, 0, 0, .4); }
.settings form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: .92rem; }
.field select, .field input[type="range"] { width: 100%; }
.field select {
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  padding: 0 8px;
}
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .92rem; }
.check input { margin-top: 4px; }
.dialog-actions { display: flex; justify-content: flex-end; }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  max-width: calc(100vw - 32px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 12px;
  font-size: .92rem;
  opacity: 0;
  transition: opacity .25s ease, transform .25s ease;
  z-index: 100;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 480px) {
  .brand-sub { display: none; }
  .tabs [role="tab"] { font-size: .86rem; padding: 0 4px; white-space: nowrap; }
  .msg { max-width: 92%; }
  .composer .btn-primary { padding: 8px 12px; }
}

.composer-tools .btn { padding: 6px 10px; font-size: .9rem; }

/* ---------- Avatar (Teacher Sam) ---------- */

.avatar { flex: none; width: 96px; height: 96px; }
.avatar-sm { width: 52px; height: 52px; }
.avatar-md { width: 96px; height: 96px; }
.avatar svg { width: 100%; height: 100%; display: block; overflow: visible; }

.av-bg { fill: var(--surface-2); }
.av-skin { fill: #e8b48f; }
.av-hair { fill: #3b2a20; }
.av-shirt { fill: var(--primary); }
.av-collar { fill: #ffffff; }
.av-eye { fill: #1f2430; }
.av-brow { fill: none; stroke: #3b2a20; stroke-width: 2.6; stroke-linecap: round; }
.av-glasses rect, .av-glasses path { fill: none; stroke: #1f2430; stroke-width: 1.8; }
.av-glasses rect { fill: rgba(255, 255, 255, .12); }
.av-nose { fill: none; stroke: #b97f5c; stroke-width: 1.6; stroke-linecap: round; }
.av-cheek { fill: #f08a8a; opacity: .25; transition: opacity .3s ease; }
.av-mouth path, .av-mouth ellipse { display: none; }
.m-neutral, .m-thinking { fill: none; stroke: #7a2e2e; stroke-width: 2.4; stroke-linecap: round; }
.m-happy, .m-surprised, .m-talk { fill: #7a2e2e; }

.av-eyes, .av-brows, .av-head, .m-talk { transform-box: fill-box; transform-origin: center; }
.av-eyes { animation: av-blink 5s infinite; }
@keyframes av-blink {
  0%, 92%, 100% { transform: scaleY(1); }
  95% { transform: scaleY(.1); }
}

.mood-neutral .m-neutral,
.mood-happy .m-happy,
.mood-thinking .m-thinking,
.mood-surprised .m-surprised { display: inline; }

.mood-happy .av-cheek { opacity: .55; }
.mood-happy .av-brows { transform: translateY(-1.5px); }
.mood-happy .av-head { animation: av-hop .5s ease; }
.mood-thinking .av-brow-l { transform: translateY(2px) rotate(6deg); transform-box: fill-box; transform-origin: center; }
.mood-thinking .av-brow-r { transform: translateY(-2px) rotate(-8deg); transform-box: fill-box; transform-origin: center; }
.mood-thinking .av-head { transform: rotate(-4deg); transition: transform .3s ease; }
.mood-surprised .av-brows { transform: translateY(-3px); }

.avatar.talking .av-mouth path, .avatar.talking .av-mouth ellipse { display: none; }
.avatar.talking .av-mouth .m-talk { display: inline; animation: av-talk .26s ease-in-out infinite alternate; }
.avatar.talking .av-head { animation: av-bob 1.2s ease-in-out infinite; }

@keyframes av-talk { from { transform: scaleY(.25); } to { transform: scaleY(1); } }
@keyframes av-bob { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(1.5deg) translateY(-.5px); } }
@keyframes av-hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-3px); } }

@media (prefers-reduced-motion: reduce) {
  .av-eyes, .avatar.talking .av-head, .mood-happy .av-head { animation: none; }
  .avatar.talking .av-mouth .m-talk { animation-duration: .5s; }
}

/* ---------- Palco do professor + balão ---------- */

.stage { display: flex; align-items: flex-start; gap: 12px; margin: 4px 0 16px; }
.bubble {
  position: relative;
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  border-top-left-radius: 4px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.bubble > div { flex: 1; }
.bubble p { margin: 0 0 6px; }
.bubble p:last-child { margin-bottom: 0; }
em.en { font-style: normal; font-weight: 600; color: var(--primary); }

.chat-stage { display: flex; align-items: center; gap: 10px; }
.chat-stage strong { display: block; line-height: 1.2; }

/* ---------- Abas ---------- */

.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 16px;
  background: var(--surface-2);
  border-radius: 12px;
}
.tabs [role="tab"] {
  flex: 1;
  min-height: 42px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.tabs [role="tab"][aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ---------- Trilha ---------- */

.track { display: grid; gap: 10px; }
.level {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.level summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
}
.level summary::-webkit-details-marker { display: none; }
.level-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.level-name { font-weight: 700; }
.level-desc { color: var(--muted); font-size: .88rem; }
.level-count { color: var(--muted); font-weight: 700; font-size: .9rem; }
.level-bar { height: 4px; background: var(--surface-2); }
.level-bar > div { height: 100%; background: var(--great); }

.level-badge {
  flex: none;
  display: inline-grid;
  place-items: center;
  min-width: 42px;
  height: 32px;
  padding: 0 6px;
  border-radius: 8px;
  font-weight: 800;
  color: #fff;
  background: #64748b;
}
.level-a1 { background: #16a34a; }
.level-a2 { background: #0d9488; }
.level-b1 { background: #2563eb; }
.level-b2 { background: #7c3aed; }
.level-c1 { background: #db2777; }
.level-c2 { background: #dc2626; }

.lesson-list { list-style: none; margin: 0; padding: 6px; display: grid; gap: 2px; }
.lesson-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
button.lesson-item:hover { background: var(--surface-2); }
.lesson-item.disabled { color: var(--muted); cursor: default; }
.lesson-num {
  flex: none;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  font-size: .85rem;
  font-weight: 700;
}
.lesson-item.done .lesson-num { background: var(--great); color: #fff; }
.lesson-title { flex: 1; }
.lesson-score { color: var(--muted); font-size: .85rem; }

/* ---------- Lição ---------- */

.lesson-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.lesson-heading { flex: 1; min-width: 0; font-size: 1.15rem; margin: 0; }

.lang-switch { display: flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; flex: none; }
.lang-switch button {
  border: 0;
  background: var(--surface);
  padding: 6px 10px;
  font-weight: 700;
  font-size: .85rem;
  color: var(--muted);
  cursor: pointer;
}
.lang-switch button[aria-pressed="true"] { background: var(--primary); color: var(--primary-text); }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.panel h3 { margin-top: 0; }
.panel h4 { margin: 16px 0 6px; font-size: .9rem; color: var(--muted); }
.topics { margin: 0 0 8px; padding-left: 20px; }

.table-wrap { overflow-x: auto; margin: 4px 0 8px; }
.grammar-table { border-collapse: collapse; width: 100%; font-size: .92rem; }
.grammar-table th, .grammar-table td { border-bottom: 1px solid var(--border); padding: 6px 8px; text-align: left; vertical-align: top; }
.grammar-table th { color: var(--muted); font-weight: 700; font-size: .8rem; }

.examples { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.examples li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-2);
}
.ex-en { font-weight: 600; }
.ex-actions { display: flex; gap: 4px; }
.ex-pt { grid-column: 1 / -1; color: var(--muted); font-size: .88rem; }

.mistakes { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.mistakes li { padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.mistakes li:last-child { border-bottom: 0; padding-bottom: 0; }
.mistakes p { margin: 2px 0; }
.wrong { color: var(--retry); text-decoration: line-through; text-decoration-thickness: 1px; }
.right { color: var(--great); font-weight: 600; }
.why { color: var(--muted); font-size: .92rem; }

.exercise { display: flex; flex-direction: column; gap: 10px; }
.ex-count { margin: 0; color: var(--muted); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.ex-prompt { margin: 0; font-size: 1.2rem; font-weight: 600; line-height: 1.7; }
.ex-hint { margin: 0; color: var(--muted); font-size: .92rem; font-style: italic; }
.blank { display: inline-block; min-width: 3em; border-bottom: 2px solid var(--primary); color: transparent; }

.options { display: grid; gap: 8px; }
.option {
  text-align: left;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 1rem;
  cursor: pointer;
}
.option:hover:not(:disabled) { border-color: var(--primary); }
.option:disabled { cursor: default; opacity: .75; }
.option.correct { border-color: var(--great); background: color-mix(in srgb, var(--great) 12%, var(--surface)); opacity: 1; font-weight: 700; }
.option.wrong { border-color: var(--retry); background: color-mix(in srgb, var(--retry) 12%, var(--surface)); opacity: 1; }

.fill-form { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.blank-input {
  width: 9em;
  max-width: 100%;
  font: inherit;
  padding: 2px 8px;
  margin: 0 4px;
  border: 0;
  border-bottom: 2px solid var(--primary);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 6px 6px 0 0;
}
.blank-input:focus { outline: 2px solid var(--primary); }
.blank-input.correct { border-color: var(--great); color: var(--great); }
.blank-input.wrong { border-color: var(--retry); color: var(--retry); text-decoration: line-through; }

.order-line {
  min-height: 52px;
  padding: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border: 2px dashed var(--border);
  border-radius: 12px;
  font-size: 1.05rem;
  font-weight: 600;
  align-items: center;
}
.order-line.correct { border-color: var(--great); color: var(--great); }
.order-line.wrong { border-color: var(--retry); color: var(--retry); }
.order-bank { display: flex; flex-wrap: wrap; gap: 6px; }
.word {
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 1rem;
  cursor: pointer;
}
.order-line .word { background: var(--surface); border-color: var(--primary); }
.ex-actions-row { display: flex; gap: 8px; flex-wrap: wrap; }

.composer-inline { position: static; padding: 0; background: transparent; }
.composer-inline input {
  flex: 1;
  min-width: 0;
  height: 48px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
}
.said { margin: 0; font-weight: 600; }
.said.correct { color: var(--great); }

.lesson-nav {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  padding: 12px 0;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  margin-top: 12px;
  background: var(--bg);
}
.lesson-nav .btn-primary { min-width: 120px; }
.result-panel { text-align: center; }
.result-panel .summary-actions { flex-direction: column; }

/* ---------- Gramática dentro da conversa ---------- */

.msg-grammar {
  align-self: stretch;
  max-width: 100%;
  background: var(--surface);
  border: 1px dashed var(--primary);
  border-radius: var(--radius);
  padding: 8px 14px;
}
.msg-grammar summary { cursor: pointer; font-weight: 600; color: var(--primary); }
.grammar-body { margin-top: 8px; }
.grammar-body p { margin: 0 0 6px; }
.grammar-body .msg-actions { align-items: center; flex-wrap: wrap; }

.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: .92rem;
}
.chip:hover { border-color: var(--primary); }

fieldset.field { border: 0; padding: 0; margin: 0; }
fieldset.field legend { padding: 0; margin-bottom: 6px; }

@media (max-width: 480px) {
  .stage .avatar-md { width: 72px; height: 72px; }
  .lesson-heading { font-size: 1rem; }
  .lesson-nav .btn { padding: 8px 10px; }
  .lesson-nav .btn-primary { min-width: 0; flex: 1; }
}

#lesson-bubble { display: block; }

/* ---------- Planos, dados e sobre ---------- */

.card.locked { opacity: .75; }
.tag-premium { color: var(--mid); }
.lesson-item.locked .lesson-title { color: var(--muted); }
.settings .prow { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.settings label.btn { cursor: pointer; }
.about summary { cursor: pointer; font-weight: 600; }
.about ul { padding-left: 18px; margin: 6px 0; font-size: .9rem; color: var(--muted); }
.about p { font-size: .9rem; margin: 6px 0; }
.settings { max-height: calc(100dvh - 32px); overflow-y: auto; }

/* ---------- Conta ---------- */

.acc-btn {
  font-size: 1rem;
  font-weight: 800;
}
.acc-btn.acc-on {
  background: var(--primary);
  color: var(--primary-text);
  border-radius: 50%;
}
.account-box { max-width: 460px; margin: 8px auto; }
.acc-card { display: flex; flex-direction: column; gap: 12px; }
.acc-card h2 { margin: 0; }
.acc-card > p { margin: 0; }
.acc-form { display: flex; flex-direction: column; gap: 12px; }
.acc-input {
  height: 46px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
}
.acc-input:focus { outline: 2px solid var(--primary); border-color: transparent; }
.acc-links { display: flex; flex-wrap: wrap; gap: 6px; }
.acc-link { padding: 4px 8px; min-height: 36px; color: var(--primary); }
.acc-msg { margin: 0; font-size: .92rem; }
.acc-msg:empty { display: none; }
.acc-msg.error { color: var(--retry); }
.acc-msg.ok { color: var(--great); }
.acc-who { display: flex; align-items: center; gap: 12px; }
.acc-who div { display: flex; flex-direction: column; }
.acc-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: var(--primary-text);
  font-weight: 800;
  font-size: 1.3rem;
}
.acc-more summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.acc-more .acc-form { margin-top: 8px; }
.btn-danger { background: var(--retry); border-color: var(--retry); color: #fff; }
.btn-danger:hover { background: var(--retry); filter: brightness(1.08); }

/* ---------- Conversa livre com IA ---------- */
.ai-box { margin-top: 12px; text-align: center; }
.ai-box .muted { font-size: .85rem; margin-top: 6px; }
.btn-ai {
  background: linear-gradient(135deg, #6d4aff, var(--primary));
  color: #fff;
  border-color: transparent;
}
.btn-ai:hover { filter: brightness(1.08); }
.msg-tip {
  align-self: stretch;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid #6d4aff;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.msg-tip .tip-title { font-size: .75rem; font-weight: 700; color: #6d4aff; text-transform: uppercase; letter-spacing: .04em; }
.msg-typing { align-self: flex-start; color: var(--muted); font-style: italic; background: transparent; box-shadow: none; }
.badge-wait { color: var(--muted); }
