/* Magin design system · componentes
   Depende de tokens.css. Classes sem prefixo de framework; estados com .is-* ou aria-*. */

/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-body-size);
  line-height: var(--text-body-line);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg,
video {
  display: block;
  max-width: 100%;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

::selection {
  background: var(--primary-soft);
  color: var(--primary-text);
}

/* Em telas de toque, nenhum campo fica abaixo de 16px (evita o zoom automático do iOS) */
@media (pointer: coarse) {
  input,
  textarea,
  select {
    font-size: max(16px, 1em);
  }
}

/* Barras de rolagem finas, no cinza da paleta (claro e escuro) */
html {
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

*:hover {
  scrollbar-color: var(--text-faint) transparent;
}

/* Navegadores sem scrollbar-color (Safari antigo) */
@supports not (scrollbar-color: auto) {
  ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
  }

  ::-webkit-scrollbar-track {
    background: transparent;
  }

  ::-webkit-scrollbar-thumb {
    border: 3px solid transparent;
    border-radius: 999px;
    background: var(--line-strong) padding-box;
  }

  ::-webkit-scrollbar-thumb:hover {
    background: var(--text-faint) padding-box;
  }

  ::-webkit-scrollbar-corner {
    background: transparent;
  }
}

.container {
  width: min(100% - 32px, var(--container));
  margin-inline: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Tipografia ---------- */

.display,
.h1,
.h2,
.h3 {
  margin: 0;
  color: var(--text);
  text-wrap: balance;
}

.display {
  font: var(--text-display-weight) var(--text-display-size) / var(--text-display-line)
    var(--text-display-family);
  letter-spacing: var(--text-display-tracking);
}

.h1 {
  font: var(--text-h1-weight) var(--text-h1-size) / var(--text-h1-line) var(--text-h1-family);
  letter-spacing: var(--text-h1-tracking);
}

.h2 {
  font: var(--text-h2-weight) var(--text-h2-size) / var(--text-h2-line) var(--text-h2-family);
  letter-spacing: var(--text-h2-tracking);
}

.h3 {
  font: var(--text-h3-weight) var(--text-h3-size) / var(--text-h3-line) var(--text-h3-family);
  letter-spacing: var(--text-h3-tracking);
}

.lead {
  margin: 0;
  font-size: var(--text-lead-size);
  line-height: var(--text-lead-line);
  color: var(--text-muted);
  text-wrap: pretty;
}

.body {
  margin: 0;
  color: var(--text-muted);
  text-wrap: pretty;
}

.sm {
  font-size: var(--text-sm-size);
  line-height: var(--text-sm-line);
  font-weight: var(--text-sm-weight);
}

.xs {
  font-size: var(--text-xs-size);
  line-height: var(--text-xs-line);
  font-weight: var(--text-xs-weight);
  letter-spacing: var(--text-xs-tracking);
}

.muted {
  color: var(--text-muted);
}

.faint {
  color: var(--text-faint);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: var(--text-eyebrow-size);
  font-weight: var(--text-eyebrow-weight);
  letter-spacing: var(--text-eyebrow-tracking);
  text-transform: uppercase;
  color: var(--primary-text);
}

.eyebrow::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

/* Texto em gradiente da marca (uma palavra por título, no máximo) */
.grad {
  background: linear-gradient(
    95deg,
    var(--violet-500) 10%,
    var(--violet-300) 55%,
    var(--emerald-500) 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Marca-texto: destaque curto dentro de um título */
.hl {
  display: inline-block;
  padding: 0 0.16em;
  border-radius: 0.16em;
  background: var(--accent);
  color: #fff;
  line-height: 1.02;
}

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

.btn {
  --btn-bg: var(--primary);
  --btn-fg: var(--on-primary);
  --btn-bd: transparent;
  --btn-h: 44px;
  /* Acabamento com reflexo: brilho no topo, profundidade embaixo e sombra na cor do botão */
  --btn-sheen: linear-gradient(180deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0) 55%);
  --btn-depth: rgba(36, 16, 77, 0.28);
  --btn-glow: rgba(123, 47, 242, 0.28);
  --btn-shine: inset 0 1px 0 rgba(255, 255, 255, 0.35), inset 0 -2px 0 var(--btn-depth);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--btn-h);
  padding: 0 20px;
  border: 1.5px solid var(--btn-bd);
  border-radius: var(--radius-pill);
  background: var(--btn-sheen), var(--btn-bg);
  color: var(--btn-fg);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  box-shadow:
    var(--btn-shine),
    0 2px 6px -2px var(--btn-glow);
  transition:
    background-color var(--motion-fast) var(--motion-ease-out),
    transform var(--motion-fast) var(--motion-ease-out),
    box-shadow var(--motion-base) var(--motion-ease-out),
    border-color var(--motion-fast);
}

.btn:hover {
  --btn-bg: var(--primary-hover);
  box-shadow:
    var(--btn-shine),
    0 4px 12px -4px var(--btn-glow);
  transform: translateY(-1px);
}

.btn:active {
  box-shadow:
    inset 0 2px 4px var(--btn-depth),
    0 1px 2px var(--btn-glow);
  transform: translateY(1px) scale(0.98);
}

.btn:disabled,
.btn[aria-disabled='true'] {
  opacity: 0.5;
  pointer-events: none;
}

/* Variantes sem preenchimento: lisas, sem reflexo */
.btn--secondary,
.btn--ghost {
  --btn-sheen: none;
}

.btn--secondary,
.btn--secondary:hover,
.btn--secondary:active,
.btn--ghost,
.btn--ghost:hover,
.btn--ghost:active {
  box-shadow: none;
}

.btn--secondary {
  --btn-bg: transparent;
  --btn-fg: var(--text);
  --btn-bd: var(--line-strong);
}

.btn--secondary:hover {
  --btn-bg: var(--surface-soft);
  --btn-bd: var(--text-faint);
}

.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--text-muted);
}

.btn--ghost:hover {
  --btn-bg: var(--surface-sunken);
  --btn-fg: var(--text);
  transform: none;
}

/* Sobre foto ou fundo roxo */
.btn--light {
  --btn-bg: #fff;
  --btn-fg: var(--violet-700);
  --btn-sheen: linear-gradient(180deg, rgba(255, 255, 255, 0) 45%, rgba(76, 26, 158, 0.06) 100%);
  --btn-depth: rgba(76, 26, 158, 0.14);
  --btn-glow: rgba(15, 10, 30, 0.25);
  --btn-shine: inset 0 1px 0 #fff, inset 0 -2px 0 var(--btn-depth);
}

.btn--light:hover {
  --btn-bg: var(--violet-50);
}

.btn--glass {
  --btn-bg: rgba(255, 255, 255, 0.14);
  --btn-fg: #fff;
  --btn-bd: rgba(255, 255, 255, 0.35);
  --btn-sheen: none;
  backdrop-filter: blur(12px);
}

.btn--glass,
.btn--glass:hover,
.btn--glass:active {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn--glass:hover {
  --btn-bg: rgba(255, 255, 255, 0.24);
}

.btn--accent {
  --btn-bg: var(--accent);
  --btn-fg: #fff;
  --btn-depth: rgba(4, 120, 87, 0.35);
  --btn-glow: rgba(16, 185, 129, 0.28);
}

.btn--accent:hover {
  --btn-bg: var(--emerald-600);
}

.btn--sm {
  --btn-h: 36px;
  padding: 0 14px;
  font-size: 14px;
}

.btn--lg {
  --btn-h: 52px;
  padding: 0 26px;
  font-size: 16px;
}

.btn--icon {
  width: var(--btn-h);
  padding: 0;
}

.btn.is-loading {
  color: transparent;
  pointer-events: none;
  position: relative;
}

.btn.is-loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid var(--btn-fg);
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--primary-text);
  font-weight: 600;
}

.link .icon {
  transition: transform var(--motion-base) var(--motion-ease-out);
}

.link:hover .icon {
  transform: translateX(3px);
}

/* ---------- Chips, badges e tags ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition:
    border-color var(--motion-fast),
    background var(--motion-fast),
    transform var(--motion-fast) var(--motion-ease-out);
}

.chip:hover {
  border-color: var(--violet-300);
  transform: translateY(-1px);
}

.chip.is-active,
.chip[aria-pressed='true'] {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-text);
}

.chip--sm {
  height: 28px;
  padding: 0 10px;
  font-size: 13px;
}

.chip--glass {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(15, 10, 30, 0.38);
  color: #fff;
  backdrop-filter: blur(14px);
}

.chip--glass:hover {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(15, 10, 30, 0.5);
}

.badge {
  --badge-bg: var(--primary-soft);
  --badge-fg: var(--primary-text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  background: var(--badge-bg);
  color: var(--badge-fg);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge--accent {
  --badge-bg: var(--accent-soft);
  --badge-fg: var(--accent-text);
}

.badge--warning {
  --badge-bg: var(--warning-soft);
  --badge-fg: var(--warning);
}

.badge--danger {
  --badge-bg: var(--danger-soft);
  --badge-fg: var(--danger);
}

.badge--neutral {
  --badge-bg: var(--surface-sunken);
  --badge-fg: var(--text-muted);
}

.badge--dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Código BNCC, turma, duração */
.tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--text-muted);
  font: 600 11.5px / 1 var(--font-mono);
  letter-spacing: 0.02em;
}

/* ---------- Formulários ---------- */

.field {
  display: grid;
  gap: 6px;
}

.field__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.field__help {
  font-size: 12px;
  color: var(--text-faint);
}

.input,
.textarea,
.select {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  /* 16px: abaixo disso o Safari do iPhone dá zoom ao focar e não volta */
  font-size: 16px;
  transition:
    border-color var(--motion-fast),
    box-shadow var(--motion-fast);
}

.textarea {
  min-height: 96px;
  resize: vertical;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-faint);
}

.input:hover,
.textarea:hover,
.select:hover {
  border-color: var(--text-faint);
}

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.field.is-invalid .input {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px var(--danger-soft);
}

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch__track {
  width: 40px;
  height: 24px;
  padding: 3px;
  border-radius: var(--radius-pill);
  background: var(--line-strong);
  transition: background var(--motion-base);
}

.switch__track::after {
  content: '';
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform var(--motion-base) var(--motion-ease-spring);
}

.switch input:checked + .switch__track {
  background: var(--accent);
}

.switch input:checked + .switch__track::after {
  transform: translateX(16px);
}

.switch input:focus-visible + .switch__track {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* ---------- Compositor (onde o professor pede) ---------- */

.composer {
  display: grid;
  gap: 10px;
  width: 100%;
  padding: 14px 14px 12px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  transition:
    border-color var(--motion-base),
    box-shadow var(--motion-base);
}

.composer:focus-within {
  border-color: var(--violet-300);
  box-shadow:
    var(--shadow-md),
    0 0 0 5px var(--primary-soft);
}

.composer__input {
  width: 100%;
  min-height: 28px;
  max-height: 160px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  resize: none;
}

.composer__input:focus {
  outline: none;
}

.composer__input::placeholder {
  color: var(--text-faint);
}

.composer__bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.composer__bar .composer__send {
  margin-left: auto;
}

.composer--pill {
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 8px 8px 8px 22px;
  border-radius: var(--radius-pill);
}

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

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.card--soft {
  border-color: transparent;
  background: var(--surface-soft);
}

.card--raised {
  border-color: transparent;
  box-shadow: var(--shadow-md);
}

.card--interactive {
  cursor: pointer;
  transition:
    transform var(--motion-base) var(--motion-ease-out),
    box-shadow var(--motion-base) var(--motion-ease-out),
    border-color var(--motion-base);
}

.card--interactive:hover {
  border-color: var(--violet-200);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

/* Ícone de habilidade: linha dentro de quadrado colorido pela área */
.skill-icon {
  --area: var(--area-planejamento);
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 12px;
  background: color-mix(in srgb, var(--area) 14%, var(--surface));
  color: var(--area);
}

.skill-icon .icon {
  width: 20px;
  height: 20px;
}

.skill-icon--sm {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.skill-icon--sm .icon {
  width: 15px;
  height: 15px;
}

.area-planejamento {
  --area: var(--area-planejamento);
}

.area-avaliacao {
  --area: var(--area-avaliacao);
}

.area-inclusao {
  --area: var(--area-inclusao);
}

.area-alfabetizacao {
  --area: var(--area-alfabetizacao);
}

.area-carreira {
  --area: var(--area-carreira);
}

.skill {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
}

.skill__title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.skill__desc {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

.stat__value {
  font: 700 48px / 1 var(--font-display);
  letter-spacing: -0.03em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.stat__label {
  margin-top: 8px;
  font-size: 14px;
  color: var(--text-muted);
}

/* ---------- Navegação do app ---------- */

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition:
    background var(--motion-fast),
    color var(--motion-fast);
}

.nav-item:hover {
  background: color-mix(in srgb, var(--primary) 7%, transparent);
  color: var(--text);
}

.nav-item.is-active,
.nav-item[aria-current='page'] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.nav-section {
  margin: 18px 12px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--area, var(--primary));
}

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

.tabs {
  position: relative;
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: var(--surface-sunken);
}

.tabs__indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 0;
  border-radius: var(--radius-pill);
  background: var(--surface-raised);
  box-shadow: var(--shadow-sm);
  transition:
    transform var(--motion-base) var(--motion-ease-out),
    width var(--motion-base) var(--motion-ease-out);
}

.tab {
  position: relative;
  z-index: 1;
  height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--motion-fast);
}

.tab[aria-selected='true'] {
  color: var(--text);
}

/* Sem o indicador animado (telas sem o JS do design system, como o web app em React),
   a própria aba selecionada ganha o fundo e a sombra */
.tabs:not(:has(.tabs__indicator)) .tab[aria-selected='true'] {
  background: var(--surface-raised);
  box-shadow:
    var(--shadow-sm),
    inset 0 0 0 1px var(--line);
}

.tabs--line:not(:has(.tabs__indicator)) .tab[aria-selected='true'] {
  background: none;
  box-shadow: inset 0 -2px 0 var(--primary);
}

/* Abas sublinhadas (dentro de painéis) */
.tabs--line {
  gap: 18px;
  padding: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: none;
}

.tabs--line .tab {
  height: 40px;
  padding: 0;
  border-radius: 0;
}

.tabs--line .tabs__indicator {
  top: auto;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--primary);
  box-shadow: none;
}

[role='tabpanel'][hidden] {
  display: none;
}

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

.bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
}

.bubble--user {
  justify-self: end;
  border-bottom-right-radius: 6px;
  background: var(--primary);
  color: var(--on-primary);
}

.bubble--assistant {
  justify-self: start;
  border-bottom-left-radius: 6px;
  background: var(--surface-sunken);
  color: var(--text);
}

/* Resposta com o Lapisinho: o avatar ao lado do balão. Enquanto gera, o próprio avatar vira os pontinhos. */
.ai-msg {
  justify-self: start;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  max-width: 100%;
}

.ai-msg > magin-lapisinho {
  width: 32px;
  margin-top: 2px;
}

.ai-msg__body {
  display: grid;
  gap: 8px;
  justify-items: start;
  min-width: 0;
}

/* ---------- Lapisinho (o mascote, js/lapisinho.js) ---------- */

magin-lapisinho {
  display: inline-block;
  flex: none;
  width: 32px;
  aspect-ratio: 1;
  line-height: 0;
  vertical-align: middle;
}

magin-lapisinho > svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.mlz-corpo,
.mlz-pontos rect {
  fill: var(--lapisinho-corpo, var(--violet-500));
  transition: fill 0.45s ease;
}

.mlz-ponta-p {
  fill: var(--lapisinho-ponta, var(--emerald-500));
  transition: fill 0.45s ease;
}

.mlz-salto,
.mlz-tremor,
.mlz-ponta {
  transform-box: fill-box;
  transform-origin: 50% 100%;
}

.mlz-olhar {
  transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Criando: os olhos deslizam devagar, sem a mola de quando ele reage */
magin-lapisinho[estado='criando'] .mlz-olhar {
  transition: transform 0.9s ease-in-out;
}

.mlz-olhos {
  transform-box: fill-box;
  transform-origin: center;
}

.mlz-pilula {
  fill: #fff;
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mlz-arco {
  display: none;
  fill: none;
  stroke: #fff;
  stroke-width: 5;
  stroke-linecap: round;
}

[data-expr='feliz'] .mlz-pilula,
[data-expr='contente'] .mlz-pilula,
[data-expr='fechado'] .mlz-pilula {
  display: none;
}

[data-expr='feliz'] .mlz-feliz,
[data-expr='contente'] .mlz-contente,
[data-expr='fechado'] .mlz-fechado {
  display: block;
}

/* Erro (falhou de verdade): o rosto do aflito com corpo e ponta em vermelho. O aflito em roxo fica
   para "não encontrado" e vazios. A cor troca com a mesma transição de fill do corpo. */
magin-lapisinho > svg[data-cor='erro'] {
  --lapisinho-corpo: var(--danger);
  --lapisinho-ponta: var(--danger-strong);
}

/* Aflito e erro: olhos inclinados em / \ e o corpo tremendo */
[data-expr='aflito'] .mlz-olho-e .mlz-pilula {
  transform: translate(-1px, -2px) rotate(28deg) scale(0.82);
}

[data-expr='aflito'] .mlz-olho-d .mlz-pilula {
  transform: translate(-1px, -1px) rotate(-20deg) scale(0.74);
}

[data-expr='aflito'] .mlz-tremor {
  animation: lapisinho-tremer 0.55s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  [data-expr='aflito'] .mlz-tremor {
    animation: none;
  }
}

.caret::after {
  content: '';
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 2px;
  vertical-align: -0.15em;
  background: var(--primary);
  animation: blink 1s steps(1) infinite;
}

/* ---------- Avatar ---------- */

.avatar {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  overflow: hidden;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-text);
  font-size: 12px;
  font-weight: 700;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-stack {
  display: flex;
}

.avatar-stack .avatar {
  border: 2px solid var(--surface);
}

.avatar-stack .avatar + .avatar {
  margin-left: -10px;
}

/* ---------- Acordeão (details/summary) ---------- */

.accordion {
  display: grid;
  gap: 10px;
}

.accordion details {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  transition:
    border-color var(--motion-base),
    box-shadow var(--motion-base);
}

.accordion details[open] {
  border-color: var(--violet-200);
  box-shadow: var(--shadow-md);
}

.accordion summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.accordion summary::-webkit-details-marker {
  display: none;
}

.accordion summary .icon {
  color: var(--text-faint);
  transition: transform var(--motion-base) var(--motion-ease-out);
}

.accordion details[open] summary .icon {
  transform: rotate(45deg);
  color: var(--primary);
}

.accordion__body {
  padding: 0 20px 18px;
  color: var(--text-muted);
}

/* ---------- Feedback ---------- */

.toast {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
}

.toast .icon {
  color: var(--emerald-300);
}

.toast-region {
  position: fixed;
  z-index: 100;
  bottom: 24px;
  left: 50%;
  display: grid;
  gap: 8px;
  transform: translateX(-50%);
}

.toast-region .toast {
  animation: toast-in var(--motion-slow) var(--motion-ease-spring);
}

/* Aviso de cookies: pequeno no canto, sem tela escura e sem travar nada (não é modal). Some no "Ok" ou
   no "Recusar" e não volta. Montado por assets/tag-manager.js (site) e lib/tagManager.ts (app). */
.cookie-notice {
  position: fixed;
  z-index: 90;
  bottom: 16px;
  left: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  max-width: min(400px, calc(100vw - 32px));
  padding: 10px 10px 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.4;
  box-shadow: var(--shadow-md);
  animation: toast-in var(--motion-slow) var(--motion-ease-out);
}

.cookie-notice p {
  flex: 1 1 180px;
  margin: 0;
}

.cookie-notice a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cookie-notice__actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

/* No app: o canto esquerdo é o menu da conta, na barra lateral */
.cookie-notice--right {
  right: 16px;
  left: auto;
}

@media (max-width: 640px) {
  /* Celular: à esquerda do botão "Experimente" da landing, que fica no canto direito */
  .cookie-notice {
    right: 84px;
    bottom: 12px;
    left: 12px;
    max-width: none;
  }
}

@media (max-width: 900px) {
  /* App no celular: embaixo fica o campo de pedido; o aviso vai para baixo da barra do topo */
  .cookie-notice--right {
    top: 64px;
    right: 12px;
    bottom: auto;
    left: 12px;
    max-width: none;
  }
}

.progress {
  height: 6px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: var(--surface-sunken);
}

.progress__bar {
  height: 100%;
  width: var(--value, 0%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width var(--motion-slow) var(--motion-ease-out);
}

.skeleton {
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    var(--skeleton) 0%,
    var(--surface-soft) 50%,
    var(--skeleton) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

.kbd {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface);
  font: 600 11px / 1 var(--font-mono);
  color: var(--text-muted);
}

/* ---------- Janela de app (para demos e screenshots vivos) ---------- */

.window {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.window__bar {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.window__bar i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--line-strong);
}

.window__url {
  margin: 0 auto;
  padding: 3px 14px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-faint);
  font-size: 12px;
}

/* ---------- Rotação de palavras (data-rotate) ---------- */

.rotator {
  /* Sem overflow: hidden, para o bloco alinhar pela linha de base do texto */
  display: inline-grid;
  vertical-align: baseline;
}

.rotator > * {
  grid-area: 1 / 1;
  opacity: 0;
  filter: blur(8px);
  transform: translateY(0.18em);
  transition:
    opacity 0.45s ease-out,
    filter 0.45s ease-out,
    transform 0.6s var(--motion-ease-out);
  white-space: nowrap;
}

.rotator.grad {
  background: none;
  color: inherit;
}

/* O gradiente vai em cada palavra: no container ele pintaria todas ao mesmo tempo */
.rotator.grad > * {
  background: linear-gradient(
    95deg,
    var(--violet-500) 10%,
    var(--violet-300) 55%,
    var(--emerald-500) 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.rotator > .is-active {
  opacity: 1;
  filter: blur(0);
  transform: none;
}

.rotator > .is-leaving {
  opacity: 0;
  filter: blur(6px);
  transform: translateY(-0.12em);
  transition-duration: 0.25s;
  transition-timing-function: ease-in;
}

/* ---------- Movimento ---------- */

[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 0.7s var(--motion-ease-out),
    transform 0.7s var(--motion-ease-out);
  transition-delay: calc(var(--i, 0) * 80ms);
}

[data-reveal='scale'] {
  transform: scale(0.96);
}

[data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

.marquee {
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}

.marquee__track {
  display: flex;
  width: max-content;
  gap: var(--marquee-gap, 56px);
  animation: marquee var(--marquee-duration, 32s) linear infinite;
}

.marquee:hover .marquee__track {
  animation-play-state: paused;
}

@keyframes marquee {
  to {
    transform: translateX(calc(-50% - var(--marquee-gap, 56px) / 2));
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes lapisinho-tremer {
  0%,
  100% {
    transform: rotate(0) translateX(0);
  }
  20% {
    transform: rotate(-1.6deg) translateX(-0.6px);
  }
  45% {
    transform: rotate(0.9deg) translateX(0.4px);
  }
  70% {
    transform: rotate(-0.9deg) translateX(0.6px) scale(1.01, 0.99);
  }
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
}

@keyframes float {
  50% {
    transform: translateY(-8px);
  }
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.97);
  }
}

.pop-in {
  animation: pop-in var(--motion-slow) var(--motion-ease-spring) both;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  [data-reveal] {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Anúncio na espera (docs/anuncios.md) ----------
   Card que entra no lugar do esqueleto enquanto o Magin cria. O web roda os anúncios; o painel
   admin usa o mesmo card na prévia. As barrinhas do topo mostram quantos são e o tempo de cada um. */
.anuncio {
  display: grid;
  gap: var(--space-3);
  max-width: 560px;
  padding: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  animation: pop-in var(--motion-slow) var(--motion-ease-spring) both;
}

.anuncio__barras {
  display: flex;
  gap: 4px;
}

.anuncio__barra {
  position: relative;
  flex: 1;
  height: 3px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--line);
  cursor: pointer;
}

/* Área de toque maior que a barrinha */
.anuncio__barra::after {
  content: '';
  position: absolute;
  inset: -8px 0;
}

.anuncio__barra-cheia {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--text-muted);
  transform-origin: left center;
  transform: scaleX(0);
}

.anuncio__barra.is-vista .anuncio__barra-cheia {
  transform: scaleX(1);
}

.anuncio__barra.is-atual .anuncio__barra-cheia {
  animation: anuncio-encher var(--anuncio-tempo, 8s) linear both;
}

.anuncio.is-pausado .anuncio__barra.is-atual .anuncio__barra-cheia {
  animation-play-state: paused;
}

@keyframes anuncio-encher {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

.anuncio__topo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  font-size: 12px;
  color: var(--text-faint);
}

.anuncio__selo {
  flex: none;
  padding: 2px 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.anuncio__quem {
  overflow: hidden;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--text);
}

.anuncio__midia {
  display: block;
  width: 100%;
  max-height: 300px;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
}

.anuncio__midia img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 300px;
  object-fit: contain;
}

.anuncio__corpo {
  display: grid;
  gap: var(--space-1);
}

.anuncio__titulo {
  margin: 0;
  font-family: var(--font-display);
  font-size: 17px;
  line-height: 1.3;
  font-weight: 650;
  color: var(--text);
}

.anuncio__texto {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-muted);
}

.anuncio__cta {
  justify-self: start;
  margin-top: var(--space-2);
}

.anuncio__cta .icon {
  width: 14px;
  height: 14px;
}

/* "Por que estou vendo isso?": discreto, abre a explicação no próprio card */
.anuncio__porque {
  font-size: 12px;
  color: var(--text-faint);
}

.anuncio__porque summary {
  display: inline-block;
  cursor: pointer;
  list-style: none;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}

.anuncio__porque summary::-webkit-details-marker {
  display: none;
}

.anuncio__porque summary:hover,
.anuncio__porque[open] summary {
  color: var(--text-muted);
}

.anuncio__porque summary:focus-visible {
  border-radius: var(--radius-xs);
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.anuncio__porque p {
  margin: var(--space-2) 0 0;
  line-height: 1.5;
  color: var(--text-muted);
}

@media (prefers-reduced-motion: reduce) {
  /* Sem a barrinha enchendo: a troca continua pelo tempo, mas a barra só marca qual é */
  .anuncio__barra.is-atual .anuncio__barra-cheia {
    animation: none;
    transform: scaleX(1);
    opacity: 0.6;
  }
}

/* ---------- Recomendação na conversa (.claude/tdd/recomendacoes-soeducador.tdd.md) ----------
   Card discreto embaixo da resposta do Magin, depois do material e dos próximos passos. Separado por
   uma linha fina, menor que o anúncio da espera e com o botão secundário: nunca parece a ação
   principal da tela. Reaproveita o selo e o "Por que estou vendo isso?" do anúncio. */
.recomendacao {
  display: grid;
  gap: var(--space-2);
  max-width: 560px;
  margin-top: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px solid var(--line);
}

.recomendacao__topo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  font-size: 12px;
  color: var(--text-faint);
}

.recomendacao__quem {
  flex: 1;
  overflow: hidden;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--text-muted);
}

.recomendacao__fechar {
  margin: -4px -4px -4px 0;
  color: var(--text-faint);
}

.recomendacao__cartao {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.recomendacao__midia {
  display: block;
  flex: none;
  width: 112px;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--radius-xs);
  background: var(--surface-sunken);
}

.recomendacao__midia img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recomendacao__corpo {
  display: grid;
  align-content: start;
  gap: var(--space-1);
  min-width: 0;
}

.recomendacao__titulo {
  margin: 0;
  font-family: var(--font-display);
  font-size: 15px;
  line-height: 1.3;
  font-weight: 600;
  color: var(--text);
}

.recomendacao__texto {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-muted);
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.recomendacao__cta {
  justify-self: start;
  margin-top: var(--space-1);
}

.recomendacao__cta .icon {
  width: 14px;
  height: 14px;
}

.recomendacao--dispensada {
  margin: var(--space-2) 0 0;
  padding-top: var(--space-3);
  border-top: 1px solid var(--line);
}

/* Celular: a miniatura vai para cima, o texto embaixo */
@media (max-width: 480px) {
  .recomendacao__cartao {
    flex-direction: column;
  }

  .recomendacao__midia {
    width: 100%;
    aspect-ratio: 16 / 9;
  }
}

/* Cursos que o professor pediu (`data-cursos`): os mesmos cards, sem selo e sem "x" */
.recomendacao--pedido > .recomendacao__quem {
  margin: 0;
  font-size: 12px;
}

.recomendacao__item {
  display: grid;
  gap: var(--space-2);
}
