/* MDI Jogos: estilos pensados para leitores com dislexia:
   fonte Lexend, fundo creme (sem branco puro), texto escuro (sem preto puro),
   espaçamento generoso, sem itálicos, alinhamento à esquerda. */

:root {
  --bg: #FBF6EA;
  --surface: #FFFDF7;
  --ink: #26263A;
  --muted: #5A5A70;
  --primary: #4F46E5;
  --primary-ink: #FFFFFF;
  --primary-dark: #3730A3;
  --link-hover: #E4E6FF;
  --accent: #FBBF24;
  --ok: #15803D;
  --ok-bg: #DCFCE7;
  --bad: #B91C1C;
  --bad-bg: #FEE2E2;
  --line: #E7DFCB;
  --radius: 20px;
  --shadow: 0 6px 20px rgba(60, 50, 20, .08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 18px; }

body {
  font-family: 'Lexend', 'Verdana', sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  letter-spacing: .02em;
  word-spacing: .12em;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.font-grande { font-size: 1.2rem; }

/* Links sem sublinhado; no hover ficam com um fundo destacado */
a { color: var(--primary); text-decoration: none; font-weight: 600; border-radius: 6px; transition: background-color .15s, color .15s, box-shadow .15s; }
a:not(.btn):not(.logo):hover { color: var(--primary-dark); background: var(--link-hover); box-shadow: 0 0 0 4px var(--link-hover); }
a:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.logo:hover { color: var(--primary-dark); }

.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* Cabeçalho */
.topbar { background: var(--surface); border-bottom: 2px solid var(--line); }
.topbar .container { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: .8rem; padding-bottom: .8rem; flex-wrap: wrap; }
.logo { font-size: 1.5rem; font-weight: 700; color: var(--primary); text-decoration: none; display: flex; align-items: center; gap: .5rem; }
.nav { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.nav a, .nav button.linklike { text-decoration: none; color: var(--ink); font-weight: 500; padding: .4rem .8rem; border-radius: 12px; background: none; border: 0; font: inherit; cursor: pointer; }
.nav a:hover, .nav button.linklike:hover { background: var(--link-hover); color: var(--primary-dark); box-shadow: none; }
.nav a.btn:hover { background: var(--accent); color: var(--ink); }
.user-chip { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; }
.user-chip .avatar { font-size: 1.6rem; }

main { flex: 1; padding: 2rem 0 3rem; }

h1 { font-size: 2rem; line-height: 1.3; margin-bottom: .6rem; }
h2 { font-size: 1.5rem; line-height: 1.3; margin-bottom: .6rem; }
p.lead { font-size: 1.15rem; color: var(--muted); max-width: 60ch; }

/* Botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font: inherit; font-weight: 600; font-size: 1.1rem;
  padding: .8rem 1.6rem; min-height: 56px;
  border-radius: 999px; border: 3px solid transparent;
  background: var(--primary); color: var(--primary-ink);
  text-decoration: none; cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn:focus-visible, .nav a:focus-visible, input:focus-visible, .choice:focus-visible { outline: 4px solid var(--accent); outline-offset: 2px; }
.btn-secondary { background: var(--surface); color: var(--primary); border-color: var(--primary); }
.btn-accent { background: var(--accent); color: var(--ink); }
.btn-ok { background: var(--ok); }
.btn-big { font-size: 1.4rem; padding: 1rem 2.2rem; min-height: 72px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }

/* Cartões */
.card { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }

.hero { display: grid; gap: 1.5rem; align-items: center; grid-template-columns: 1.4fr 1fr; margin-bottom: 2.5rem; }
.hero .art { font-size: 6rem; text-align: center; line-height: 1.2; }

.games-grid { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin-top: 1rem; }
.game-card { display: flex; flex-direction: column; gap: .6rem; border-top: 10px solid var(--game-color, var(--primary)); }
.game-card .icon { font-size: 3.5rem; line-height: 1.1; }
.game-card p { color: var(--muted); flex: 1; }
.game-card .best { font-weight: 600; }
.badge { display: inline-block; background: var(--line); color: var(--ink); padding: .2rem .8rem; border-radius: 999px; font-size: .85rem; font-weight: 600; }

/* Formulários */
.form-card { max-width: 520px; margin: 0 auto; }
.field { margin-bottom: 1.1rem; }
.field label { display: block; font-weight: 600; margin-bottom: .3rem; }
.field input[type=text], .field input[type=email], .field input[type=password] {
  width: 100%; font: inherit; font-size: 1.1rem; padding: .8rem 1rem;
  border: 2px solid var(--line); border-radius: 14px; background: #fff; color: var(--ink);
}
.field .hint { font-size: .9rem; color: var(--muted); }
.check { display: flex; align-items: center; gap: .5rem; }
.check input { width: 24px; height: 24px; }

.avatar-picker { display: flex; flex-wrap: wrap; gap: .5rem; }
.avatar-picker label { cursor: pointer; }
.avatar-picker input { position: absolute; opacity: 0; }
.avatar-picker span { display: grid; place-items: center; width: 60px; height: 60px; font-size: 2rem; border-radius: 16px; border: 3px solid var(--line); background: #fff; }
.avatar-picker input:checked + span { border-color: var(--primary); background: #EEF0FF; }
.avatar-picker input:focus-visible + span { outline: 4px solid var(--accent); }

.alert { padding: 1rem 1.2rem; border-radius: 14px; margin-bottom: 1.2rem; font-weight: 500; }
.alert-ok { background: var(--ok-bg); color: var(--ok); }
.alert-bad { background: var(--bad-bg); color: var(--bad); }
.alert ul { padding-left: 1.2rem; }

/* Tabelas */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .7rem .6rem; border-bottom: 2px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: .95rem; }
.table-wrap { overflow-x: auto; }
.tabs { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tabs a { text-decoration: none; padding: .5rem 1rem; border-radius: 999px; border: 2px solid var(--line); color: var(--ink); font-weight: 500; }
.tabs a:hover { border-color: var(--primary); box-shadow: none; }
.tabs a.active, .tabs a.active:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.two-cols { display: grid; gap: 1.5rem; grid-template-columns: 1fr 1fr; }

footer { border-top: 2px solid var(--line); padding: 1.2rem 0; color: var(--muted); font-size: .9rem; }

/* ---------- Jogo: Diz o Nome ---------- */
.game-wrap { max-width: 900px; margin: 0 auto; }
.game-hud { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.hud-item { background: var(--surface); border: 2px solid var(--line); border-radius: 16px; padding: .5rem 1rem; font-weight: 600; }
.hud-item b { color: var(--primary); font-size: 1.3rem; }

.stage { min-height: 420px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 1.2rem; }
.stage .message { font-size: 1.4rem; font-weight: 600; }
.stage .sub { color: var(--muted); }

.timer-bar { width: 100%; max-width: 600px; height: 14px; background: var(--line); border-radius: 999px; overflow: hidden; }
.timer-bar span { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: left; }

.tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem; }
.tile {
  width: 150px; height: 150px; border-radius: 24px; background: #fff; border: 3px solid var(--line);
  display: grid; place-items: center; font-size: 5.5rem; line-height: 1;
  transition: transform .3s, opacity .3s;
}
.tile.hidden-tile { background: var(--primary); color: #fff; font-size: 4rem; border-color: var(--primary); }
.tile.pop { animation: pop .35s ease-out; }
.tile.ok { border-color: var(--ok); background: var(--ok-bg); }
.tile.bad { border-color: var(--bad); background: var(--bad-bg); }
.tile-wrap { display: flex; flex-direction: column; align-items: center; gap: .3rem; }
.tile-name { font-size: 1.3rem; font-weight: 600; min-height: 2rem; }

@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.mic-btn { width: 130px; height: 130px; border-radius: 50%; font-size: 3.5rem; border: 0; cursor: pointer; background: var(--accent); box-shadow: var(--shadow); }
.mic-btn.listening { animation: pulse 1.2s infinite; background: #F87171; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(248,113,113,.6); } 100% { box-shadow: 0 0 0 30px rgba(248,113,113,0); } }
.heard { min-height: 2.2rem; font-size: 1.2rem; color: var(--muted); }

.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .8rem; width: 100%; max-width: 640px; }
.choice {
  font: inherit; font-size: 1.5rem; font-weight: 600; padding: 1rem; min-height: 72px;
  border-radius: 18px; border: 3px solid var(--line); background: #fff; color: var(--ink); cursor: pointer;
  text-transform: lowercase;
}
.choice:hover { border-color: var(--primary); }
.choice.ok { background: var(--ok-bg); border-color: var(--ok); }
.choice.bad { background: var(--bad-bg); border-color: var(--bad); }

.mode-pick { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center; }
.feedback { font-size: 1.6rem; font-weight: 700; }
.feedback.ok { color: var(--ok); }
.feedback.bad { color: var(--bad); }
.stars { font-size: 3rem; letter-spacing: .3em; }
.row { display: flex; gap: .8rem; flex-wrap: wrap; justify-content: center; }

/* Cronómetro e palavras grandes (sílabas / letras) */
.stopwatch { font-size: 1.3rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.big-word { font-size: 4rem; font-weight: 600; line-height: 1.2; letter-spacing: .08em; }
.syl-0 { color: var(--primary); }
.syl-1 { color: #B45309; }
.syl + .syl::before { content: '-'; color: var(--muted); margin: 0 .1em; }
.gap { display: inline-block; min-width: .8em; border-bottom: 6px solid var(--accent); color: var(--primary); }
.gap.ok { color: var(--ok); border-color: var(--ok); }
.gap.bad { color: var(--bad); border-color: var(--bad); }
.choices.letters { grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); max-width: 520px; }
.letter-choice { font-size: 3rem; text-transform: none; min-height: 100px; }

/* Histórico */
.stat-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 1.5rem; }
.stat { padding: 1.1rem 1.3rem; }
.stat-label { color: var(--muted); font-size: .95rem; }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.chart-card { margin-top: .5rem; }
.chart { width: 100%; margin-top: .5rem; outline-offset: 4px; }
.chart:focus-visible { outline: 4px solid var(--accent); }
.chart svg { display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { stroke: #CFC5AC; stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 13px; font-family: inherit; }
.chart .series-line { fill: none; stroke: var(--primary); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .series-dot { fill: var(--primary); stroke: var(--surface); stroke-width: 2; }
.chart .crosshair { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-tooltip {
  position: absolute; pointer-events: none; background: var(--surface); border: 2px solid var(--line);
  border-radius: 12px; padding: .4rem .7rem; box-shadow: var(--shadow); white-space: nowrap;
}
.chart-tooltip .tt-value { font-weight: 700; font-size: 1.15rem; color: var(--ink); }
.chart-tooltip .tt-label { font-size: .85rem; color: var(--muted); }
.prompt-cell { font-size: 1.2rem; }
.time-bar { position: relative; display: flex; align-items: center; gap: .5rem; }
.time-bar span { display: block; height: 14px; border-radius: 0 4px 4px 0; background: var(--primary); opacity: .75; }
.time-bar b { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Administração */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.admin-tabs { margin: .5rem 0 1.5rem; }
.toolbar { display: flex; gap: 1rem; justify-content: space-between; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.search { display: flex; gap: .5rem; flex: 1; max-width: 520px; }
.search input, .filters select {
  flex: 1; font: inherit; padding: .6rem .9rem; border: 2px solid var(--line); border-radius: 14px; background: #fff; color: var(--ink);
}
.search .btn { min-height: 48px; padding: .4rem 1.2rem; }
.filters { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1.2rem; }
.filters label { display: flex; flex-direction: column; gap: .2rem; font-weight: 600; font-size: .95rem; }
.actions { white-space: nowrap; }
.actions a + a { margin-left: .8rem; }
.pager { display: flex; gap: 1rem; justify-content: center; align-items: center; margin-top: 1rem; color: var(--muted); flex-wrap: wrap; }
.child-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.hint { color: var(--muted); font-size: .95rem; }
.trend { font-weight: 600; white-space: nowrap; }
.trend-up { color: var(--ok); }
.trend-down { color: var(--bad); }
.danger-zone { margin-top: 2rem; padding-top: 1.2rem; border-top: 2px dashed var(--line); }
.btn-danger { background: var(--bad); }

@media (max-width: 760px) {
  .big-word { font-size: 2.8rem; }
  html { font-size: 17px; }
  .hero, .two-cols { grid-template-columns: 1fr; }
  .hero .art { font-size: 4rem; }
  .tile { width: 110px; height: 110px; font-size: 4rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
