/* ==========================================================================
   educze — Vocabulário de Inglês
   Estilo responsivo e elegante (tema escuro). Foco no conteúdo.
   ========================================================================== */

:root {
    --bg:          #0f1318;
    --bg-grad:     radial-gradient(1200px 600px at 50% -10%, #18202b 0%, #0f1318 55%);
    --surface:     #161b22;
    --surface-2:   #1c232d;
    --border:      #29323d;
    --border-soft: #222a34;
    --text:        #eef2f7;
    --muted:       #8b97a7;
    --accent:      #3b9dff;
    --accent-strong:#2b80e0;
    --accent-soft: rgba(59, 157, 255, 0.12);
    --ipa:         #8aa0b4;
    --shadow:      0 20px 50px rgba(0, 0, 0, 0.45);
    --radius:      18px;
    --radius-sm:   12px;
    --topbar-h:    58px;
    --sidebar-w:   344px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { height: 100%; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }

body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    background-image: var(--bg-grad);
    background-attachment: fixed;
    color: var(--text);
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* ----- Barra superior --------------------------------------------------- */
.topbar {
    flex-shrink: 0;
    z-index: 40;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 18px;
    background: rgba(15, 19, 24, 0.85);
    backdrop-filter: saturate(160%) blur(12px);
    -webkit-backdrop-filter: saturate(160%) blur(12px);
    border-bottom: 1px solid var(--border-soft);
}

.brand { text-decoration: none; display: inline-flex; align-items: center; }

.brand-mark {
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: -0.02em;
    color: var(--text);
}
.brand-accent { color: var(--accent); }

.topbar-tag {
    margin-left: auto;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--muted);
    letter-spacing: 0.02em;
    white-space: nowrap;
}

/* Rodapé com a indicação da lista (aparece no mobile) */
.rodape-tag {
    display: none;
    flex-shrink: 0;
    text-align: center;
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--muted);
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border-soft);
}

/* Botão do menu (hambúrguer) — só aparece no mobile */
.menu-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 40px;
    height: 40px;
    padding: 9px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    cursor: pointer;
}
.menu-btn span {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.2s ease;
}
body.drawer-aberto .menu-btn span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
body.drawer-aberto .menu-btn span:nth-child(2) { opacity: 0; }
body.drawer-aberto .menu-btn span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ----- Layout ----------------------------------------------------------- */
.layout {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    align-items: stretch;
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    flex: 1;
    min-height: 0;
}

/* ----- Barra lateral (grupos) ------------------------------------------ */
.sidebar {
    height: 100%;
    align-self: stretch;
    overflow-y: auto;
    padding: 22px 16px 40px;
    border-right: 1px solid var(--border-soft);
}
.sidebar-head {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 4px 6px 16px;
}
.grupos {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 9px;
}
.grupo-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    aspect-ratio: 1 / 1;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease, transform 0.12s ease;
}
.grupo-btn:hover { border-color: #3a4756; background: var(--surface-2); }
.grupo-btn:active { transform: scale(0.96); }
.grupo-label {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}
.grupo-num { font-size: 1.35rem; font-weight: 700; line-height: 1; }
.grupo-btn.ativo {
    background: var(--accent-soft);
    border-color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--accent);
}
.grupo-btn.ativo .grupo-num { color: var(--accent); }
.grupo-btn.ativo .grupo-label { color: var(--accent-strong); }

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 12, 0.6);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease;
    z-index: 25;
}

/* ----- Conteúdo --------------------------------------------------------- */
.conteudo {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(10px, 2vh, 18px);
    padding: 18px 24px;
    overflow: hidden;
}

.card {
    width: 100%;
    max-width: 600px;
    margin: 0;
    background: linear-gradient(180deg, var(--surface) 0%, #12171e 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: clamp(20px, 3.2vw, 34px);
    display: flex;
    flex-direction: column;
}

.card-top { margin-bottom: clamp(14px, 2.4vh, 24px); }
.info {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--muted);
    text-align: center;
    margin-bottom: 12px;
}
.progresso {
    height: 6px;
    border-radius: 100px;
    background: var(--surface-2);
    overflow: hidden;
}
.progresso-bar {
    height: 100%;
    width: 0;
    border-radius: 100px;
    background: linear-gradient(90deg, var(--accent-strong), var(--accent));
    transition: width 0.35s ease;
}

/* Bloco da palavra */
.palavra-bloco {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: clamp(150px, 28vh, 240px);
    padding: clamp(6px, 1.6vh, 18px) 0;
}
.palavra {
    font-size: clamp(2.3rem, 7.5vw, 3.4rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.1;
    word-break: break-word;
}
.som-linha {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
}
.som {
    font-size: clamp(1.05rem, 3.8vw, 1.45rem);
    font-weight: 500;
    color: var(--ipa);
    font-feature-settings: "case" 1;
}
.som-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--ipa);
    cursor: pointer;
    transition: color 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
}
.som-btn:hover { color: var(--accent); border-color: var(--accent); }
.som-btn:active { transform: scale(0.92); }

.traducao {
    margin-top: clamp(14px, 2.5vh, 24px);
    min-height: 1.6em;
    font-size: clamp(1.25rem, 4.6vw, 1.85rem);
    font-weight: 600;
    color: var(--accent);
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.28s ease, transform 0.28s ease;
}
.traducao.visivel { opacity: 1; transform: translateY(0); }

/* Estado final: eficiência */
.eficiencia-bloco {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.eficiencia-num {
    font-size: clamp(3.4rem, 15vw, 5.4rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--accent);
    line-height: 1;
}
.eficiencia-label {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--muted);
}

/* Alternância entre estudo e final */
.controles, .controles-final {
    display: flex;
    gap: 12px;
    margin-top: clamp(20px, 3.4vh, 32px);
}
.controles-final { display: none; }

.card.estado-final .palavra-bloco { min-height: clamp(150px, 24vh, 210px); }
.card.estado-final .palavra,
.card.estado-final .som-linha,
.card.estado-final .traducao { display: none; }
.card.estado-final .eficiencia-bloco { display: flex; }
.card.estado-final .controles { display: none; }
.card.estado-final .controles-final { display: flex; }

/* ----- Botões ----------------------------------------------------------- */
.btn {
    flex: 1;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 14px 18px;
    font-family: inherit;
    font-size: 0.98rem;
    font-weight: 600;
    border-radius: 12px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.12s ease, opacity 0.18s ease;
    white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primario {
    background: var(--accent);
    color: #052440;
}
.btn-primario:hover { background: var(--accent-strong); }
.btn-secundario {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--border);
}
.btn-secundario:hover { border-color: #3a4756; background: #232b36; }
.btn-secundario:disabled {
    opacity: 0.4;
    cursor: default;
    transform: none;
}
.btn svg { flex-shrink: 0; }

/* ----- Rodapé e dica ---------------------------------------------------- */
.dica {
    margin-top: 0;
    font-size: 0.82rem;
    color: var(--muted);
    text-align: center;
}
.dica kbd {
    display: inline-block;
    padding: 1px 7px;
    margin: 0 1px;
    font-family: inherit;
    font-size: 0.78rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
}
.rodape {
    margin-top: 0;
    font-size: 0.8rem;
    color: var(--muted);
    text-align: center;
}
.rodape strong { color: var(--text); font-weight: 700; }

/* ==========================================================================
   Responsivo
   ========================================================================== */

/* Telas médias: barra lateral um pouco menor */
@media (max-width: 1024px) {
    :root { --sidebar-w: 292px; }
    .grupos { gap: 8px; }
}

/* Mobile / tablet estreito: barra lateral vira gaveta (drawer) */
@media (max-width: 780px) {
    .menu-btn { display: flex; }
    .topbar-tag { display: none; }

    .layout { display: block; }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100dvh;
        width: min(310px, 84vw);
        padding-top: calc(var(--topbar-h) + 18px);
        background: #10151b;
        border-right: 1px solid var(--border);
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 30;
    }
    .grupos { grid-template-columns: repeat(5, 1fr); }

    body.drawer-aberto .sidebar { transform: translateX(0); }
    body.drawer-aberto .overlay { opacity: 1; visibility: visible; }

    .conteudo { padding: 14px 16px; gap: 10px; }
    .dica { display: none; }
    .rodape-tag { display: block; }
}

/* Celulares pequenos */
@media (max-width: 380px) {
    .brand-mark { font-size: 1.3rem; }
    .card { padding: 20px 18px; }
    .btn { padding: 13px 10px; font-size: 0.9rem; gap: 6px; }
    .palavra-bloco { min-height: clamp(130px, 24vh, 200px); }
}

/* Telas baixas (paisagem): reduz ainda mais o respiro vertical */
@media (max-height: 620px) {
    .palavra-bloco { min-height: 120px; }
    .card-top { margin-bottom: 12px; }
    .dica, .rodape { display: none; }
}

/* Botões empilhados em telas estreitas (evita estouro do container) */
@media (max-width: 560px) {
    .controles, .controles-final { flex-direction: column; }
    .btn { padding: 14px 16px; }
}

/* Preferência por menos movimento */
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}


/* ---------- Rodapé institucional (identificação do responsável,
   políticas e atribuição da fonte do vocabulário) ---------- */
.rodape-tag{
  padding:22px 18px 34px;
  text-align:center;
  line-height:1.6;
}
.rodape-linha{
  margin:0 auto 8px;
  max-width:720px;
  font-size:.74rem;
  opacity:.75;
}
.rodape-linha a{ color:inherit; text-decoration:underline; }
.rodape-linha a:hover{ opacity:1; }
.rodape-fonte{ font-size:.7rem; opacity:.6; }
.rodape-legal{ font-size:.68rem; opacity:.55; margin-bottom:0; }
