/* ===================================================================
   Fala & Repete com o NeuroBit — Design System
   Cores: azul (ciência), branco (saúde), laranja (energia/criatividade)
   =================================================================== */

/* Visibilidade por tipo de usuário (CSS-only — independe de JS).
   body[data-user-type] eh setado no auth bootstrap. Por padrao,
   tudo com data-only-type fica oculto ate o body ganhar um tipo. */
body:not([data-user-type]) [data-only-type] { display: none !important; }
body[data-user-type="pro"] [data-only-type="patient"] { display: none !important; }
body[data-user-type="patient"] [data-only-type="pro"] { display: none !important; }
body[data-user-type="patient"] [data-only-role] { display: none !important; }
body[data-user-type="pro"]:not([data-user-role="ADMIN"]) [data-only-role="ADMIN"] { display: none !important; }

/* Space Grotesk self-hospedada — alinha a tipografia com a plataforma NeuroEvolutio */
@font-face{font-family:'Space Grotesk';font-style:normal;font-weight:300 700;font-display:swap;
  src:url('/falarepete/assets/fonts/SpaceGrotesk-latin.woff2') format('woff2');
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;}
@font-face{font-family:'Space Grotesk';font-style:normal;font-weight:300 700;font-display:swap;
  src:url('/falarepete/assets/fonts/SpaceGrotesk-latin-ext.woff2') format('woff2');
  unicode-range:U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF;}
:root {
  --azul: #2563eb;
  --azul-escuro: #1e40af;
  --azul-claro: #e8f1ff;
  --cyan: #06b6d4;
  --teal: #0891b2;
  --laranja: #f97316;
  --laranja-claro: #fff0e1;
  --branco: #ffffff;
  --bg: #f4f8fe;
  --texto: #13233f;
  --texto-claro: #465775;
  --borda: #e4ecf8;
  --verde: #16a34a;
  --amarelo: #f59e0b;
  --vermelho: #ef4444;

  --radius: 16px;
  --radius-lg: 24px;
  --shadow-sm: 0 2px 6px rgba(37, 99, 235, 0.08);
  --shadow-md: 0 8px 24px rgba(37, 99, 235, 0.12);
  --shadow-lg: 0 16px 48px rgba(37, 99, 235, 0.18);

  --grad: linear-gradient(135deg, #2563eb, #06b6d4);
  --font: system-ui, -apple-system, "Segoe UI", "Inter", "Helvetica Neue", Arial, sans-serif;
  --font-head: 'Space Grotesk', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--texto);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
h1, h2, h3, .auth-title, .page-title, .auth-card-title, .hero-bit { font-family: var(--font-head); letter-spacing: -.01em; }
.brand-logo { height: 46px; width: auto; display: block; }
:focus-visible { outline: 3px solid var(--azul); outline-offset: 3px; border-radius: 8px; }
img { max-width: 100%; display: block; }

/* ===================================================================
   Telas (SPA)
   =================================================================== */
.screen { display: none; min-height: 100vh; }
.screen.active { display: block; }

/* ===================================================================
   Brand bar (topo)
   =================================================================== */
.brand-bar {
  background: var(--branco);
  border-bottom: 1px solid var(--borda);
  padding: 14px 24px;
  box-shadow: var(--shadow-sm);
  display: flex; align-items: center; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-back {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px;
  font-weight: 600; color: var(--azul); font-size: 15px; text-decoration: none;
  padding: 9px 16px; border: 1px solid var(--borda); border-radius: 999px; background: var(--branco);
  white-space: nowrap;
}
.brand-back:hover { background: var(--azul-claro); }
@media (max-width: 520px) { .brand-back span { display: none; } }
.brand-mark {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--azul), var(--laranja));
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 24px;
  box-shadow: var(--shadow-sm);
}
.brand-name { font-size: 15px; color: var(--texto-claro); line-height: 1.1; }
.brand-name strong { color: var(--azul); font-weight: 800; }
.brand-sub { font-size: 12px; color: var(--texto-claro); opacity: 0.7; }

/* ===================================================================
   Tela inicial
   =================================================================== */
.home {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}
.home-hero {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 48px;
  align-items: center;
  margin-bottom: 56px;
}
@media (max-width: 900px) { .home-hero { grid-template-columns: 1fr; } }

.hero-text .eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--azul);
  background: var(--azul-claro);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 16px;
}
.hero-text h1 {
  font-size: clamp(36px, 5vw, 56px);
  line-height: 1.05;
  margin: 0 0 18px;
  letter-spacing: -0.02em;
  color: var(--azul);
}
.hero-with { display: block; font-size: 0.5em; font-weight: 500; color: var(--texto-claro); margin: 4px 0; }
.hero-bit {
  background: linear-gradient(135deg, var(--azul), var(--laranja));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lead { font-size: 18px; color: var(--texto-claro); margin: 0 0 8px; }
.quote {
  font-style: italic; color: var(--laranja);
  font-weight: 600; margin: 0 0 28px;
}
.home-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.hero-mascot {
  display: grid;
  gap: 18px;
  justify-items: center;
}
.hero-mascot img {
  width: 100%;
  max-width: 380px;
  max-height: 70vh;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 30px 60px rgba(30, 111, 217, 0.3));
  animation: floaty 4s ease-in-out infinite;
}
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
.hero-bubble {
  position: relative;
  background: var(--branco);
  border: 2px solid var(--azul-claro);
  border-radius: var(--radius);
  padding: 14px 18px;
  max-width: 340px;
  box-shadow: var(--shadow-md);
  font-size: 14.5px;
  color: var(--texto);
}
.hero-bubble::after {
  content: '';
  position: absolute;
  top: -12px; left: 50%; transform: translateX(-50%);
  width: 0; height: 0;
  border-style: solid;
  border-width: 0 10px 12px 10px;
  border-color: transparent transparent var(--branco) transparent;
}

.home-history { background: var(--branco); padding: 24px; border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.home-history h2 { margin: 0 0 16px; color: var(--azul); font-size: 18px; }
.history-list { display: grid; gap: 8px; }
.history-empty { color: var(--texto-claro); font-style: italic; margin: 0; }
.history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--bg);
  border-radius: 12px;
  border: 1px solid var(--borda);
}
.history-item-info { font-size: 14px; color: var(--texto-claro); }
.history-item-info strong { color: var(--texto); display: block; font-size: 15px; margin-bottom: 2px; }
/* Tarefas do paciente: estado concluída */
.history-item.task-is-done { opacity: .7; }
.task-done { font-weight: 700; color: var(--verde, #16a34a); white-space: nowrap; }

.footer-mini {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px;
  text-align: center;
  color: var(--texto-claro);
  font-size: 13px;
}
.footer-mini .small { font-size: 11px; opacity: 0.7; margin-top: 4px; }

/* ===================================================================
   Buttons
   =================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 15px;
  border: none;
  transition: transform .15s, box-shadow .2s, background .15s;
  text-decoration: none;
}
.btn-primary { background: var(--grad); color: var(--branco); box-shadow: 0 10px 24px rgba(37, 99, 235, 0.38); }
.btn-primary:hover { filter: brightness(1.04); transform: translateY(-1px); box-shadow: 0 14px 28px rgba(37, 99, 235, 0.45); }
.btn-secondary { background: var(--laranja); color: var(--branco); box-shadow: 0 6px 18px rgba(249, 115, 22, 0.32); }
.btn-secondary:hover { background: #ea580c; transform: translateY(-1px); }
.btn-ghost { background: var(--branco); color: var(--azul); border: 2px solid var(--azul-claro); }
.btn-ghost:hover { border-color: var(--azul); background: var(--azul-claro); }
.btn-large { padding: 16px 32px; font-size: 17px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-icon {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--branco);
  border: 1px solid var(--borda);
  font-size: 16px;
  display: grid; place-items: center;
}
.btn-icon:hover { background: var(--azul-claro); border-color: var(--azul); }
.btn-back {
  background: transparent; border: none;
  color: var(--azul); font-weight: 600; font-size: 15px;
  padding: 8px 12px; border-radius: 8px;
}
.btn-back:hover { background: var(--azul-claro); }

/* ===================================================================
   Page bar
   =================================================================== */
.page-bar {
  background: var(--branco);
  border-bottom: 1px solid var(--borda);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  position: sticky; top: 0; z-index: 10;
}
.page-bar h2 { margin: 0; font-size: 20px; color: var(--azul); }
.page-body { max-width: 1100px; margin: 0 auto; padding: 28px 24px 64px; display: grid; gap: 24px; }

/* ===================================================================
   Cards / Forms
   =================================================================== */
.card-form, .card-list {
  background: var(--branco);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.card-form h3, .card-list h3 {
  margin: 0 0 18px;
  color: var(--azul);
  font-size: 18px;
}
.grid-form {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.grid-form .span-2 { grid-column: 1 / -1; }
.grid-form label {
  display: flex; flex-direction: column; gap: 4px;
}
.grid-form label > span {
  font-size: 13px;
  font-weight: 600;
  color: var(--texto-claro);
}
.grid-form input, .grid-form select, .grid-form textarea {
  padding: 12px 14px;
  border: 1.5px solid var(--borda);
  border-radius: 12px;
  font-family: inherit;
  font-size: 15px;
  background: var(--bg);
  color: var(--texto);
  outline: none;
  transition: border-color .15s, background .15s;
}
.grid-form input:focus, .grid-form select:focus, .grid-form textarea:focus {
  border-color: var(--azul);
  background: var(--branco);
}
.form-actions {
  display: flex; gap: 12px; justify-content: flex-end;
  margin-top: 8px;
}
fieldset {
  border: none; padding: 0; margin: 0;
}
fieldset legend {
  font-size: 13px;
  font-weight: 700;
  color: var(--texto-claro);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.radios { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 700px) { .radios { grid-template-columns: 1fr; } }
.radio-card {
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 16px;
  border: 2px solid var(--borda);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
  transition: all .15s;
}
.radio-card input { position: absolute; opacity: 0; pointer-events: none; }
.radio-card strong { color: var(--texto); font-size: 15px; }
.radio-card small { color: var(--texto-claro); font-size: 12px; }
.radio-card:has(input:checked) {
  border-color: var(--azul);
  background: var(--azul-claro);
  box-shadow: var(--shadow-sm);
}

.toggles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (max-width: 700px) { .toggles { grid-template-columns: 1fr; } }
.toggle {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: 10px;
  border: 1px solid var(--borda);
  cursor: pointer;
}
.toggle input { width: 18px; height: 18px; accent-color: var(--azul); }

.session-form { background: var(--branco); padding: 24px; border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }

/* ===================================================================
   Patients list
   =================================================================== */
.patient-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 18px;
  background: var(--bg);
  border-radius: var(--radius);
  margin-bottom: 10px;
  border: 1px solid var(--borda);
}
.patient-info strong { font-size: 16px; color: var(--texto); display: block; }
.patient-info small { color: var(--texto-claro); font-size: 13px; }
.patient-actions { display: flex; gap: 6px; }
.patient-actions button {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--borda);
  background: var(--branco);
  color: var(--azul);
}
.patient-actions button.danger { color: var(--vermelho); border-color: #fecaca; }
.patient-actions button:hover { background: var(--azul-claro); }
.patient-actions button.danger:hover { background: #fee2e2; }

/* ===================================================================
   Game screen
   =================================================================== */
.game-top {
  background: var(--branco);
  padding: 14px 24px 0;
  border-bottom: 1px solid var(--borda);
  position: sticky; top: 0; z-index: 10;
}
.game-top-left {
  display: inline-flex; gap: 8px;
  margin-right: 16px;
}
.game-top-info {
  display: inline-flex; gap: 24px; align-items: center;
  font-size: 14px;
}
.game-patient { font-weight: 700; color: var(--texto); }
.game-mode { color: var(--azul); font-weight: 600; }
.game-progress { color: var(--texto-claro); }
.game-progress-bar {
  height: 6px; background: var(--azul-claro);
  margin-top: 12px;
}
.game-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--azul), var(--laranja));
  width: 0%;
  transition: width .4s;
}

.game-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px;
  display: grid;
  grid-template-columns: 1.4fr 0.6fr;
  grid-template-areas:
    "card mascote"
    "evaluation evaluation";
  gap: 24px;
}
@media (max-width: 900px) {
  .game-main {
    grid-template-columns: 1fr;
    grid-template-areas: "card" "mascote" "evaluation";
  }
}

.word-card {
  grid-area: card;
  background: var(--branco);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  display: grid; gap: 16px;
  position: relative;
  align-self: start;       /* nao stretchar pra altura do mascote */
}
.word-card.simple-card { padding: 16px; }
/* Wrapper da imagem da palavra — base pra posicionar o overlay
   exatamente sobre o rodape da img (que tem o rotulo impresso). */
.word-image-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  min-height: 0;
}
.word-image-wrap img {
  display: block;
  max-width: 100%;
  max-height: 55vh;        /* cabe em laptops normais */
  width: auto;             /* width ajusta pra manter aspect ratio */
  height: auto;
  border-radius: var(--radius);
}
/* Overlay cobre apenas a faixa do rotulo impresso na imagem (~16% inferior)
   quando o terapeuta desliga "Mostrar palavra escrita". */
.word-overlay-hide {
  position: absolute;
  bottom: 0;
  left: 50%; transform: translateX(-50%);
  width: var(--word-img-w, 100%);
  max-width: 100%;
  height: 16%;
  background: var(--branco);
  border-radius: 0 0 var(--radius) var(--radius);
  z-index: 2;
}
.word-extras { text-align: center; }
.word-text { font-size: 32px; font-weight: 800; color: var(--azul); text-transform: uppercase; }
.word-syllables { font-size: 22px; color: var(--laranja); font-weight: 700; letter-spacing: 0.08em; }
.word-actions {
  display: flex; gap: 10px; flex-wrap: wrap; justify-content: center;
}

.auditory-grid {
  grid-area: card;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 700px) { .auditory-grid { grid-template-columns: 1fr; } }
.auditory-card {
  background: var(--branco);
  border-radius: var(--radius);
  padding: 12px;
  border: 3px solid transparent;
  cursor: pointer;
  transition: all .2s;
  box-shadow: var(--shadow-sm);
}
.auditory-card img {
  width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 10px;
}
.auditory-card:hover { transform: translateY(-2px); border-color: var(--azul-claro); box-shadow: var(--shadow-md); }
.auditory-card.correct { border-color: var(--verde); background: #f0fdf4; }
.auditory-card.wrong { border-color: var(--vermelho); background: #fef2f2; }

.game-mascot {
  grid-area: mascote;
  background: linear-gradient(180deg, var(--azul-claro), var(--branco));
  border-radius: var(--radius-lg);
  padding: 20px;
  display: grid; gap: 16px;
  text-align: center;
  align-content: start;
}
.game-mascot img { width: 100%; max-width: 220px; height: auto; object-fit: contain; display: block; margin: 0 auto; animation: floaty 4s ease-in-out infinite; }
.game-bubble {
  background: var(--branco);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  font-size: 15px;
  color: var(--texto);
  line-height: 1.45;
  min-height: 70px;
  border: 2px solid var(--azul-claro);
}

.evaluation {
  grid-area: evaluation;
  background: var(--branco);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.evaluation h3 { margin: 0 0 16px; color: var(--azul); font-size: 17px; }
.eval-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.eval-btn {
  padding: 14px 12px;
  border-radius: 12px;
  border: 2px solid var(--borda);
  background: var(--bg);
  font-weight: 700;
  font-size: 14px;
  color: var(--texto);
  transition: all .15s;
}
.eval-btn:hover { background: var(--azul-claro); border-color: var(--azul); }
.eval-btn.selected { background: var(--azul); color: var(--branco); border-color: var(--azul); }
.eval-btn.selected[data-result="correto"] { background: var(--verde); border-color: var(--verde); }
.eval-btn.selected[data-result="aproximado"] { background: var(--amarelo); border-color: var(--amarelo); }
.eval-btn.selected[data-result="com_ajuda"] { background: var(--azul); border-color: var(--azul); }
.eval-btn.selected[data-result="nao_realizou"] { background: var(--vermelho); border-color: var(--vermelho); }
.eval-btn.selected[data-result="recusou"] { background: #64748b; border-color: #64748b; }
.eval-btn.selected[data-result="repetir_depois"] { background: var(--laranja); border-color: var(--laranja); }

.eval-note { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.eval-note span { font-size: 13px; font-weight: 600; color: var(--texto-claro); }
.eval-note input {
  padding: 12px 14px;
  border: 1.5px solid var(--borda);
  border-radius: 10px;
  font-size: 15px;
  background: var(--bg);
}
.eval-note input:focus { border-color: var(--azul); background: var(--branco); outline: none; }

.eval-actions {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}

/* ===================================================================
   Relatório
   =================================================================== */
.report {
  background: var(--branco);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-md);
}
.report-header { margin-bottom: 20px; padding-bottom: 16px; border-bottom: 2px solid var(--azul-claro); }
.report-header h3 { margin: 0; color: var(--azul); font-size: 22px; }
.report-header p { margin: 4px 0; color: var(--texto-claro); font-size: 14px; }
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin: 16px 0; }
.report-grid > div {
  padding: 12px 16px;
  background: var(--bg);
  border-radius: 12px;
  border: 1px solid var(--borda);
}
.report-grid strong { display: block; font-size: 22px; color: var(--azul); }
.report-grid span { color: var(--texto-claro); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.report-words { margin-top: 20px; }
.report-word-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: 10px;
  margin-bottom: 6px;
  border: 1px solid var(--borda);
}
.report-word-item .word-label { font-weight: 600; }
.report-word-item .result-chip {
  font-size: 12px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px;
}
.result-chip.correto { background: #dcfce7; color: #166534; }
.result-chip.aproximado { background: #fef3c7; color: #92400e; }
.result-chip.com_ajuda { background: #dbeafe; color: #1e40af; }
.result-chip.nao_realizou { background: #fee2e2; color: #991b1b; }
.result-chip.recusou { background: #e2e8f0; color: #475569; }
.result-chip.repetir_depois { background: #ffedd5; color: #9a3412; }
.report-word-item .obs { font-size: 13px; color: var(--texto-claro); font-style: italic; }
.report-summary {
  margin-top: 20px;
  padding: 16px;
  background: var(--azul-claro);
  border-radius: 12px;
  font-size: 14px;
  color: var(--azul-escuro);
  line-height: 1.55;
}
.report-actions {
  display: flex; gap: 12px; flex-wrap: wrap; justify-content: center;
  margin-top: 24px;
}

/* ===================================================================
   Tarefa de casa
   =================================================================== */
.words-pick {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  max-height: 360px;
  overflow-y: auto;
  padding: 10px;
  background: var(--bg);
  border-radius: 12px;
  border: 1px solid var(--borda);
}
.word-pick-card {
  border-radius: 10px;
  border: 2px solid var(--borda);
  padding: 8px;
  background: var(--branco);
  cursor: pointer;
  transition: all .15s;
  text-align: center;
}
.word-pick-card img { aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; margin-bottom: 6px; }
.word-pick-card span { font-size: 13px; font-weight: 600; color: var(--texto); }
.word-pick-card.selected { border-color: var(--azul); background: var(--azul-claro); }

.hw-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--bg);
  border-radius: 12px;
  border: 1px solid var(--borda);
  margin-bottom: 8px;
}
.hw-item .copy-link {
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--azul);
  color: var(--branco);
  border: none;
  font-size: 13px;
  font-weight: 600;
}

.family-task {
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
}
.family-task h3 { color: var(--azul); font-size: 22px; }

/* ===================================================================
   Gerenciador de palavras
   =================================================================== */
.words-toolbar {
  display: grid;
  grid-template-columns: 2fr 1fr auto;
  gap: 12px;
}
@media (max-width: 700px) { .words-toolbar { grid-template-columns: 1fr; } }
.words-toolbar input, .words-toolbar select {
  padding: 12px 14px;
  border: 1.5px solid var(--borda);
  border-radius: 12px;
  font-size: 15px;
  background: var(--branco);
}

.words-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 8px;
}
.word-grid-card {
  background: var(--branco);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow-sm);
  display: grid; gap: 8px;
}
.word-grid-card img { aspect-ratio: 4/3; object-fit: cover; border-radius: 10px; }
.word-grid-card .word-grid-title { font-weight: 700; color: var(--texto); display: flex; justify-content: space-between; align-items: center; }
.word-grid-card .word-grid-meta { font-size: 12px; color: var(--texto-claro); }
.word-grid-card .word-grid-actions { display: flex; gap: 6px; }
.word-grid-card .word-grid-actions button {
  flex: 1;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--borda);
  background: var(--bg);
  color: var(--azul);
}
.word-grid-card.inactive { opacity: 0.5; }
.status-badge {
  font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px;
}
.status-badge.active { background: #dcfce7; color: #166534; }
.status-badge.inactive { background: #fee2e2; color: #991b1b; }

/* ===================================================================
   Modal
   =================================================================== */
.modal {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: grid; place-items: center;
  padding: 16px;
  z-index: 100;
  backdrop-filter: blur(4px);
}
/* O atributo [hidden] sozinho perde para .modal{display:grid} (mesma
   especificidade, regra do autor vence). Esta regra (classe+atributo) tem
   especificidade maior e garante que hidden=true realmente esconda o modal. */
.modal[hidden] { display: none; }
.modal-content {
  background: var(--branco);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-content h3 { margin: 0 0 18px; color: var(--azul); }

/* ===================================================================
   Toast
   =================================================================== */
.toast {
  position: fixed;
  bottom: 24px; left: 50%; transform: translateX(-50%);
  padding: 14px 22px;
  background: var(--azul);
  color: var(--branco);
  border-radius: 999px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  z-index: 200;
  animation: toastIn .25s ease;
}
.toast.success { background: var(--verde); }
.toast.warn { background: var(--amarelo); color: #1b2738; }
.toast.error { background: var(--vermelho); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ===================================================================
   Footer global
   =================================================================== */
.footer-global {
  text-align: center;
  padding: 16px 24px;
  background: var(--branco);
  border-top: 1px solid var(--borda);
  color: var(--texto-claro);
}
.footer-global small { font-size: 12px; }
#screen-game ~ .footer-global,
#screen-homework-family ~ .footer-global { display: none; }

/* ===================================================================
   Reduzir animações (acessibilidade)
   =================================================================== */
.no-animations *, .no-animations *::before, .no-animations *::after {
  animation: none !important;
  transition: none !important;
}

/* ===================================================================
   Print do relatório
   =================================================================== */
@media print {
  body { background: var(--branco); }
  .page-bar, .report-actions { display: none !important; }
  .report { box-shadow: none; padding: 0; }
}

/* ===================================================================
   RESPONSIVO — celular + tablet
   Garante que tudo cabe na viewport e funciona bem em touch.
   =================================================================== */

/* Tablet pequeno e abaixo (até 900px) */
@media (max-width: 900px) {
  .hero-mascot img { max-width: 240px; }
  .hero-bubble { max-width: 90%; font-size: 14px; }
  .home { padding: 20px 16px 60px; }
  .home-actions { gap: 8px; }
  .game-main { padding: 16px 12px; gap: 16px; }
  .game-mascot { padding: 12px; }
  .game-mascot img { max-width: 160px; }
  .word-card { padding: 16px; }
  .word-image-wrap img { max-height: 45vh; }
  .word-actions { gap: 8px; }
  .word-actions .btn { font-size: 13px; padding: 10px 14px; }
}

/* Celular (até 640px) */
@media (max-width: 640px) {
  html, body { font-size: 15px; }

  /* Topbar do game super compacta */
  .page-bar { padding: 8px 12px; gap: 8px; flex-wrap: wrap; }
  .brand-bar { padding: 10px 14px; }
  .brand-mark { width: 36px; height: 36px; font-size: 20px; }
  .brand-name { font-size: 13px; }
  .brand-sub { font-size: 11px; }

  /* Home: hero em 1 coluna, tudo encolhe */
  .home-hero { gap: 24px; margin-bottom: 32px; }
  .hero-text h1 { font-size: clamp(28px, 9vw, 40px); }
  .lead { font-size: 16px; }
  .quote { font-size: 14px; margin-bottom: 18px; }
  .hero-mascot img { max-width: 200px; }
  .hero-bubble { font-size: 13px; padding: 10px 14px; }
  .btn { padding: 10px 16px; font-size: 14px; }
  .btn-large { padding: 12px 22px; font-size: 15px; }

  /* Tela de sessão: imagem da palavra cabe na viewport */
  .word-image-wrap img { max-height: 38vh; }
  .word-actions { flex-direction: column; }
  .word-actions .btn { width: 100%; }
  .game-mascot { padding: 10px; }
  .game-mascot img { max-width: 110px; }
  .game-bubble { font-size: 13px; padding: 10px 12px; min-height: 50px; }
  .evaluation { padding: 14px; }
  .eval-buttons { grid-template-columns: 1fr 1fr; }

  /* Modais ocupam quase tela toda */
  .modal-content { max-width: 96vw; max-height: 95vh; padding: 16px; }

  /* Botões da page-bar do game compactos */
  .page-bar .btn-icon { width: 38px; height: 38px; }
}

/* Celular pequeno (até 380px) */
@media (max-width: 380px) {
  .hero-text h1 { font-size: 26px; }
  .home-actions .btn { flex: 1 1 100%; }
  .word-image-wrap img { max-height: 34vh; }
  .game-mascot img { max-width: 90px; }
}

/* ===================================================================
   AUTH — login pro/paciente
   =================================================================== */
.auth-wrap {
  max-width: 720px; margin: 0 auto; padding: 40px 24px;
  text-align: center;
}
.auth-title { font-size: clamp(28px, 4vw, 40px); color: var(--azul); margin: 0 0 12px; font-weight: 800; }
.auth-sub { color: var(--texto-claro); font-size: 16px; margin: 0 0 36px; }
.auth-cards {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px;
}
@media (max-width: 640px) { .auth-cards { grid-template-columns: 1fr; } }
.auth-card {
  background: var(--branco); border: 2px solid var(--borda); border-radius: var(--radius-lg);
  padding: 28px 22px; cursor: pointer; transition: all .2s;
  display: flex; flex-direction: column; gap: 6px; align-items: center;
  font-family: inherit; text-align: center;
}
.auth-card:hover { border-color: var(--azul); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.auth-card-icon { font-size: 48px; }
.auth-card-title { font-size: 18px; font-weight: 700; color: var(--azul); }
.auth-card-desc { font-size: 13px; color: var(--texto-claro); }

.auth-form {
  max-width: 420px; margin: 0 auto; padding: 32px 24px;
  display: grid; gap: 16px;
}
.auth-form form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field span { font-size: 13px; color: var(--texto-claro); font-weight: 600; }
.field input {
  padding: 12px 14px; border-radius: 12px; border: 2px solid var(--borda);
  font-size: 16px; font-family: inherit; background: var(--branco);
}
.field input:focus { outline: none; border-color: var(--azul); }
.form-error {
  background: #fef2f2; color: var(--vermelho); padding: 10px 12px;
  border-radius: 10px; font-size: 13px;
}
.page-title { flex: 1; font-weight: 700; color: var(--texto); }

/* User badge na brand-bar */
.brand-user {
  margin-left: auto; display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--texto-claro);
}
.brand-user-name { font-weight: 600; color: var(--texto); }
.btn-small { padding: 6px 12px; font-size: 12px; }

/* ===================================================================
   ADMIN — gerenciar profissionais
   =================================================================== */
.admin-main { max-width: 900px; margin: 0 auto; padding: 24px; }
.admin-list { display: grid; gap: 12px; }
.admin-list-item {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px;
  padding: 14px 18px; background: var(--branco); border-radius: var(--radius);
  border: 1px solid var(--borda);
}
.admin-list-item .name { font-weight: 700; color: var(--texto); }
.admin-list-item .meta { font-size: 13px; color: var(--texto-claro); }
.admin-list-item .role-badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.05em;
  background: var(--azul-claro); color: var(--azul); margin-right: 8px;
}
.admin-list-item .role-badge.admin { background: #fef3c7; color: #b45309; }
.admin-list-item .role-badge.fono  { background: var(--azul-claro); color: var(--azul); }
.admin-list-item .role-badge.educador { background: #dcfce7; color: #15803d; }
.admin-list-item.inactive { opacity: 0.55; }

/* ===================================================================
   EVOLUTION — dashboard de evolução
   =================================================================== */
.evo-main { max-width: 1100px; margin: 0 auto; padding: 24px; }
.evo-summary {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px; margin-bottom: 24px;
}
.evo-stat {
  background: var(--branco); border-radius: var(--radius-lg);
  padding: 18px; box-shadow: var(--shadow-sm); text-align: center;
}
.evo-stat-value { font-size: 32px; font-weight: 800; color: var(--azul); line-height: 1; }
.evo-stat-label { font-size: 13px; color: var(--texto-claro); margin-top: 6px; }
.evo-stat-delta {
  display: inline-block; margin-top: 6px; padding: 2px 8px;
  border-radius: 999px; font-size: 12px; font-weight: 700;
}
.evo-stat-delta.up { background: #dcfce7; color: #15803d; }
.evo-stat-delta.down { background: #fef2f2; color: var(--vermelho); }
.evo-stat-delta.flat { background: var(--bg); color: var(--texto-claro); }

.evo-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px;
}
@media (max-width: 800px) { .evo-grid { grid-template-columns: 1fr; } }
.evo-card {
  background: var(--branco); border-radius: var(--radius-lg);
  padding: 20px; box-shadow: var(--shadow-sm); min-height: 280px;
}
.evo-card h3 { margin: 0 0 14px; color: var(--azul); font-size: 16px; }
.evo-card canvas { max-height: 250px; }
.evo-words { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.evo-words li {
  display: grid; grid-template-columns: 1fr auto; gap: 10px;
  padding: 8px 12px; background: var(--bg); border-radius: 10px;
  font-size: 14px;
}
.evo-words li .acc { font-weight: 700; color: var(--azul); }
.evo-words .empty { color: var(--texto-claro); font-style: italic; text-align: center; padding: 24px; }

/* ═══════════════════════════════════════════════════════════════════════════
   FALAS DA PALAVRA (aipim / mandioca / macaxeira)
   ═══════════════════════════════════════════════════════════════════════════ */

.btn-mini {
  border: 1px solid var(--borda);
  background: var(--branco);
  color: var(--texto-claro);
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.btn-mini:hover { background: var(--azul-claro); border-color: var(--azul); color: var(--azul); }
.btn-mini.btn-perigo:hover { background: #fee2e2; border-color: var(--vermelho); color: var(--vermelho); }
/* O botão de gravar pulsa: sem sinal visível, a fono não sabe se o microfone
   pegou, fala no vazio e só descobre ao ouvir o silêncio depois de salvar. */
.btn-mini.gravando {
  background: var(--vermelho); border-color: var(--vermelho); color: var(--branco);
  animation: pulso-gravando 1.1s ease-in-out infinite;
}
@keyframes pulso-gravando { 50% { opacity: .55; } }

.campo-com-botao { display: flex; gap: 8px; align-items: stretch; }
.campo-com-botao input { flex: 1 1 auto; min-width: 0; }
.campo-com-botao .btn-mini { flex: 0 0 auto; white-space: nowrap; }

#wf-img-previa img {
  max-height: 120px; border-radius: 12px; border: 1px solid var(--borda);
  object-fit: contain; background: var(--bg);
}

.falas-bloco {
  border: 1px solid var(--borda);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--bg);
}
.falas-cabecalho { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.falas-cabecalho strong { color: var(--azul); }
.falas-dica, .falas-vazio { font-size: 13px; color: var(--texto-claro); }
.falas-lista { display: flex; flex-direction: column; gap: 8px; }

.fala-item {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  background: var(--branco); border: 1px solid var(--borda);
  border-radius: 12px; padding: 8px 10px;
}
.fala-item.fala-padrao { border-color: var(--azul); box-shadow: var(--shadow-sm); }
.fala-nome { font-weight: 700; color: var(--texto); }
.fala-regiao { font-size: 12px; color: var(--texto-claro); }
.fala-marca {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--azul); background: var(--azul-claro); border-radius: 999px; padding: 3px 9px;
}
.fala-item .btn-perigo { margin-left: auto; }

.falas-nova { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.falas-nova input {
  flex: 1 1 160px; min-width: 0;
  border: 1px solid var(--borda); border-radius: 10px; padding: 8px 10px;
  font-family: inherit; font-size: 14px;
}
.falas-status { margin: 8px 0 0; font-size: 13px; color: var(--texto-claro); }
.falas-status.erro { color: var(--vermelho); font-weight: 600; }

/* Barra de variantes na sessão */
.word-variantes {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 8px; margin-top: 12px;
}
.word-variantes-rotulo { font-size: 13px; color: var(--texto-claro); }
.variante-btn {
  border: 1px solid var(--borda); background: var(--branco); color: var(--texto-claro);
  border-radius: 999px; padding: 7px 16px; font-size: 14px; font-weight: 600;
  font-family: inherit; cursor: pointer;
}
.variante-btn.ativa { background: var(--azul); border-color: var(--azul); color: var(--branco); }
