/* Estante LFC — base compartilhada (tokens, botões, campos, mapa mental, bottom sheet, áudio) */
:root {
  --bg: #F7F8FC;
  --surface: #FFFFFF;
  --ink: #1E293B;
  --ink-2: #475569;
  --ink-3: #94A3B8;
  --line: #E2E8F0;
  --primary: #4F46E5;
  --primary-2: #4338CA;
  --primary-soft: #EEF2FF;
  --ok: #10B981;
  --ok-soft: #ECFDF5;
  --no: #E11D48;
  --no-soft: #FFF1F2;
  --gold: #F59E0B;
  --gold-soft: #FFFBEB;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, .14);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg);
  line-height: 1.5; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--primary); text-decoration: none; }
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
button { font: inherit; color: inherit; }
.muted { color: var(--ink-2); }
.small { font-size: .85rem; }
.center { text-align: center; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.label { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }

/* ---------- botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 999px; border: 1.5px solid transparent;
  font-weight: 700; font-size: .95rem; cursor: pointer; text-align: center;
  background: var(--surface); color: var(--ink); transition: transform .12s var(--ease), box-shadow .2s, background .2s, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: linear-gradient(180deg, #5B54EE, var(--primary)); color: #fff; box-shadow: 0 6px 18px rgba(79, 70, 229, .32); }
.btn-primary:hover { background: var(--primary-2); }
.btn-primary.soft { box-shadow: none; opacity: .92; }
.btn-success { background: linear-gradient(180deg, #19C38C, var(--ok)); color: #fff; box-shadow: 0 6px 18px rgba(16, 185, 129, .3); }
.btn-outline { border-color: var(--primary); color: var(--primary); background: transparent; }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: rgba(79, 70, 229, .06); color: var(--primary); }
.btn-lg { min-height: 54px; font-size: 1.05rem; padding: 14px 22px; }
.btn-sm { min-height: 36px; padding: 6px 14px; font-size: .85rem; }
.btn-block { width: 100%; }

/* ---------- campos ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.field input, .field textarea, .field select {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: #fff;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(79, 70, 229, .12); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-row.three { grid-template-columns: 1fr 1fr 1fr; }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }

.progress { height: 8px; background: #E9ECF5; border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), #7C73F6); transition: width .6s var(--ease); }

.feedback { display: none; margin-top: 12px; padding: 12px 14px; border-radius: var(--radius-sm); font-size: .95rem; }
.feedback.show { display: block; animation: rise .25s var(--ease); }
.feedback.ok { background: var(--ok-soft); color: #065F46; }
.feedback.no { background: var(--no-soft); color: #9F1239; }

.alert { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--no-soft); color: #9F1239; font-size: .92rem; }
.alert.info { background: var(--primary-soft); color: var(--primary-2); }

@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- mapa mental ---------- */
.mindmap { position: relative; width: 100%; aspect-ratio: 360 / 460; margin: 0 auto; max-width: 420px; }
.mm-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.mm-line {
  fill: none; stroke-width: 3; stroke-linecap: round; opacity: .55;
  stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw .8s var(--ease) forwards; animation-delay: var(--d, 0ms);
}
@keyframes draw { to { stroke-dashoffset: 0; } }
.mm-center {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 31%; aspect-ratio: 1; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 8px; color: #fff;
  background: radial-gradient(circle at 30% 25%, rgba(255,255,255,.28), transparent 45%), var(--map-color, var(--primary));
  box-shadow: 0 10px 30px color-mix(in srgb, var(--map-color, #4F46E5) 40%, transparent), 0 0 0 8px color-mix(in srgb, var(--map-color, #4F46E5) 12%, transparent);
  animation: pop .5s var(--ease) both;
}
.mm-center strong { font-size: clamp(.8rem, 3.6vw, 1rem); font-weight: 800; letter-spacing: .02em; line-height: 1.1; }
.mm-center small { font-size: clamp(.6rem, 2.6vw, .72rem); opacity: .9; margin-top: 3px; line-height: 1.15; }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -50%) scale(.6); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }

.mm-node {
  --c: var(--primary); --soft: var(--primary-soft);
  position: absolute; transform: translate(-50%, -50%); width: 35%; min-height: 54px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  padding: 8px 8px; border-radius: 16px; cursor: pointer; text-align: center;
  background: #fff; border: 2px solid color-mix(in srgb, var(--c) 30%, #fff);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--c) 18%, transparent);
  animation: nodeIn .45s var(--ease) both; animation-delay: var(--d, 0ms);
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.mm-node:hover { border-color: var(--c); }
.mm-node:focus-visible { outline: 3px solid color-mix(in srgb, var(--c) 45%, transparent); outline-offset: 2px; }
.mm-en { font-weight: 800; font-size: clamp(.78rem, 3.4vw, .92rem); color: var(--c); line-height: 1.15; }
.mm-pt { font-size: clamp(.62rem, 2.7vw, .72rem); color: var(--ink-2); line-height: 1.2; }
.mm-node.active { background: var(--soft); border-color: var(--c); box-shadow: 0 0 0 5px color-mix(in srgb, var(--c) 16%, transparent), 0 8px 22px color-mix(in srgb, var(--c) 28%, transparent); }
.mm-node.pulse { animation: pulse .55s var(--ease); }
.mm-check { position: absolute; top: -7px; right: -7px; width: 20px; height: 20px; border-radius: 50%; display: none; align-items: center; justify-content: center; background: var(--ok); color: #fff; font-size: .7rem; font-weight: 800; box-shadow: 0 2px 6px rgba(16,185,129,.4); }
.mm-node.seen .mm-check { display: flex; }
.mm-node.locked { filter: saturate(.3); opacity: .75; }
.mm-lock { position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; padding: 4px; border-radius: 50%; background: var(--ink); color: #fff; }
@keyframes nodeIn { from { opacity: 0; transform: translate(-50%, -50%) scale(.7); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@keyframes pulse { 0% { transform: translate(-50%, -50%) scale(1); } 40% { transform: translate(-50%, -50%) scale(1.09); } 100% { transform: translate(-50%, -50%) scale(1); } }

.c-indigo { --c: #4F46E5; --soft: #EEF2FF; }
.c-emerald { --c: #059669; --soft: #ECFDF5; }
.c-amber { --c: #D97706; --soft: #FFFBEB; }
.c-rose { --c: #E11D48; --soft: #FFF1F2; }
.c-sky { --c: #0284C7; --soft: #F0F9FF; }
.c-violet { --c: #7C3AED; --soft: #F5F3FF; }

/* ---------- bottom sheet ---------- */
#sheet-root, .sheet-root { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
#sheet-root:empty, .sheet-root:empty { display: none; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .35); opacity: 0; transition: opacity .25s; pointer-events: auto; }
.sheet {
  position: absolute; left: 50%; bottom: 0; width: 100%; max-width: 480px; transform: translate(-50%, 105%);
  background: #fff; border-radius: 26px 26px 0 0; padding: 8px 22px calc(22px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-lg); transition: transform .32s var(--ease); pointer-events: auto; max-height: 88vh; overflow: auto;
  border-top: 5px solid var(--node, var(--primary));
}
.open > .sheet-backdrop { opacity: 1; }
.open > .sheet { transform: translate(-50%, 0); }
.sheet-handle { display: block; width: 100%; padding: 8px 0 14px; background: none; border: 0; cursor: pointer; }
.sheet-handle span { display: block; width: 44px; height: 5px; border-radius: 9px; background: var(--line); margin: 0 auto; }
.fs-en { font-size: 1.7rem; font-weight: 800; color: var(--node, var(--ink)); margin-bottom: 4px; }
.fs-pt { font-size: 1.08rem; color: var(--ink-2); margin-bottom: 14px; }
.fs-example { background: var(--bg); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 14px; border-left: 4px solid var(--node, var(--primary)); }
.fs-ex-en { font-weight: 700; font-size: 1.05rem; }
.fs-ex-pt { color: var(--ink-2); font-size: .92rem; margin-top: 2px; }
.fs-tip { display: flex; gap: 10px; align-items: flex-start; background: var(--gold-soft); color: #92400E; border-radius: var(--radius-sm); padding: 12px 14px; margin-top: 14px; font-size: .93rem; }
.tip-ico { flex: none; }
.steps { padding-left: 20px; margin: 6px 0 18px; display: grid; gap: 10px; }
.kbd { display: inline-block; padding: 0 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); font-weight: 700; }

/* ---------- botões de áudio ---------- */
.audio-row { display: grid; grid-template-columns: 1.5fr 1fr; gap: 10px; }
.btn-audio {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 56px; padding: 10px 14px;
  border-radius: 16px; border: 0; cursor: pointer; font-weight: 800; font-size: 1rem;
  background: var(--node, var(--primary)); color: #fff; box-shadow: 0 6px 16px rgba(15, 23, 42, .14);
  transition: transform .12s var(--ease), filter .2s;
}
.btn-audio:active { transform: scale(.97); }
.btn-audio em { font-style: normal; font-size: .72rem; font-weight: 700; opacity: .8; }
.btn-audio .spk { width: 22px; height: 22px; }
.btn-audio.slow { background: #fff; color: var(--ink); border: 2px solid var(--line); box-shadow: none; }
.btn-audio.slow svg { width: 26px; height: 26px; color: var(--ok); }
.btn-audio.slow.playing { border-color: var(--ok); background: var(--ok-soft); }
.wave { display: none; align-items: flex-end; gap: 3px; height: 20px; }
.wave i { width: 3px; height: 30%; border-radius: 2px; background: currentColor; animation: wave .9s ease-in-out infinite; }
.wave i:nth-child(2) { animation-delay: -.7s; } .wave i:nth-child(3) { animation-delay: -.5s; }
.wave i:nth-child(4) { animation-delay: -.3s; } .wave i:nth-child(5) { animation-delay: -.1s; }
.btn-audio.playing .wave { display: flex; }
.btn-audio.playing .spk { display: none; }
@keyframes wave { 0%, 100% { height: 25%; } 50% { height: 100%; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .mm-line { stroke-dashoffset: 0; }
}
