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

:root {
  --color-bg: #002776;
  --color-surface: #003a99;
  --color-primary: #ffdf00;
  --color-primary-text: #002776;
  --color-text: #ffffff;
  --color-text-placeholder: rgba(255, 255, 255, 0.5);
  --color-success: #009c3b;
  --color-danger: #b22234;
  --color-text-secondary: #ffffff;
  --color-label: #ffffff;
}

html,
body {
  height: 100%;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button {
  font-family: inherit;
  cursor: pointer;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ---------- Telas ---------- */
.screen {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 24px;
}

.screen--login {
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
}

.screen--onboarding {
  justify-content: center;
  gap: 16px;
}

.screen--main {
  padding: 0;
}

/* ---------- Logo ---------- */
.logo {
  font-family: 'Syne', sans-serif;
  font-size: 56px;
  font-weight: 800;
  color: var(--color-success);
  margin-bottom: 40px;
  letter-spacing: -1px;
}

/* ---------- Form ---------- */
.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 360px;
}

.input {
  width: 100%;
  background: #ffffff;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--color-bg);
  font-family: inherit;
  font-size: 16px;
}

.input::placeholder {
  color: rgba(0, 39, 118, 0.6);
}

.input:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* Input com botão dentro (ex.: toggle de senha) */
.input-wrapper {
  position: relative;
  width: 100%;
}

.input-wrapper .input {
  padding-right: 44px;
}

.input-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 6px 8px;
  font-size: 1.2rem;
  line-height: 1;
  color: rgba(0, 39, 118, 0.6);
  font-variant-emoji: text;
}

.input-toggle:hover {
  color: rgba(0, 39, 118, 0.9);
}

/* ---------- Botões ---------- */
.btn {
  width: 100%;
  padding: 14px 16px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  transition: opacity 0.15s, transform 0.05s;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--color-success);
  color: var(--color-text);
  font-size: 1.3rem;
  font-weight: 700;
}

.btn--ghost {
  background: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
  margin-top: 16px;
}

/* ---------- Links ---------- */
.link {
  background: none;
  color: var(--color-text);
  font-size: 1.1rem;
  font-weight: 500;
  text-align: center;
  padding: 4px;
}

.link--danger {
  color: var(--color-danger);
}

.error {
  color: var(--color-danger);
  font-size: 14px;
  text-align: center;
}

.success {
  color: var(--color-success);
  font-size: 14px;
  text-align: center;
}

.hint {
  color: var(--color-text-secondary);
  font-size: 14px;
  text-align: center;
  margin-top: 8px;
  opacity: 0.75;
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
  animation: fade 0.15s ease-out;
}

.modal {
  background: var(--color-bg);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 400px;
}

.modal__title {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 20px;
}

.checkbox {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 14px;
  color: var(--color-text-secondary);
  line-height: 1.4;
  cursor: pointer;
}

.checkbox input {
  margin-top: 2px;
  accent-color: var(--color-primary);
  flex-shrink: 0;
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------- Onboarding ---------- */
.onboarding__title {
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 24px;
}

.lang-btn {
  width: 100%;
  min-height: 72px;
  background: transparent;
  border: 2px solid #ffffff;
  border-radius: 16px;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  color: #ffffff;
  transition: opacity 0.15s, transform 0.05s;
}

.lang-btn:hover:not(:disabled) {
  opacity: 0.88;
}

.lang-btn:active {
  transform: scale(0.99);
}

.lang-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.tab-content .lang-btn + .lang-btn {
  margin-top: 16px;
}

.lang-btn__flag {
  width: 36px;
  height: auto;
  border-radius: 3px;
}

.lang-btn__label {
  font-size: 1.2rem;
  font-weight: 700;
}

/* ---------- Cabeçalho ---------- */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  background: #002776;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  z-index: 50;
}

.app-header__brand {
  background: none;
  border: none;
  padding: 4px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: inherit;
}

.app-header__logo {
  font-family: 'Syne', sans-serif;
  font-size: 24px;
  font-weight: 800;
  color: #009c3b;
  letter-spacing: -0.5px;
  line-height: 1;
}

.app-header__flag {
  width: 28px;
  height: auto;
  border-radius: 3px;
}

.app-header__avatar {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #ffffff;
  padding: 0;
  flex-shrink: 0;
}

/* ---------- Conteúdo principal ---------- */
.content {
  flex: 1;
  padding: 24px;
  padding-top: calc(80px + env(safe-area-inset-top));
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
}

.tab-content__title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 16px;
}

.welcome-message {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 8px;
  opacity: 0.85;
}

/* ---------- Sub-tabs ---------- */
.subtabs {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 20px;
}

.subtab {
  flex: 1;
  background: none;
  border: none;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--color-text);
  font-size: 14px;
  font-weight: 600;
  opacity: 0.7;
  transition: background 0.15s, opacity 0.15s;
}

.subtab--active {
  background: rgba(255, 255, 255, 0.15);
  opacity: 1;
}

.subtab-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---------- Card de frase ---------- */
.frase-card {
  background: var(--color-surface);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.frase-card__main {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
}

.frase-card__translation {
  font-size: 16px;
  opacity: 0.9;
}

.frase-card__phonetic {
  font-size: 13px;
  font-style: italic;
  color: rgba(255,255,255,0.6);
  margin: 0.25rem 0;
}

.lang-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.lang-toggle__lado {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.5);
  transition: color 0.2s;
}

.lang-toggle__lado.ativo {
  color: #ffffff;
  font-weight: 700;
}

.lang-toggle__seta {
  background: #009c3b;
  color: #ffffff;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.lang-toggle__seta:hover {
  background: #007a2f;
}

.frase-card__context {
  font-size: 14px;
  opacity: 0.85;
  margin-top: 4px;
  line-height: 1.4;
}

.frase-card .btn {
  margin-top: 8px;
}

/* ---------- Textarea ---------- */
.input--textarea {
  resize: vertical;
  min-height: 96px;
  font-family: inherit;
  line-height: 1.4;
}

/* ---------- Bottom Bar ---------- */
.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  background: var(--color-surface);
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  z-index: 50;
}

.tab {
  flex: 1;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  color: var(--color-label);
  opacity: 0.6;
  transition: opacity 0.15s, color 0.15s;
}

.tab--active {
  color: var(--color-primary);
  opacity: 1;
}

.tab__icon {
  font-size: 22px;
  line-height: 1;
}

.tab__label {
  font-size: 11px;
  font-weight: 500;
}

/* ─── PERFIL ─────────────────────────────────── */
.perfil {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
}
.perfil__avatar-wrap {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  overflow: hidden;
  background: #003a99;
  border: 3px solid #009c3b;
}
.perfil__avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.perfil__info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}
.perfil__nome {
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
}
.perfil__email {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.6);
}
.perfil__badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  margin-top: 0.25rem;
}
.perfil__badge--free {
  background: rgba(255,255,255,0.15);
  color: #ffffff;
}
.perfil__badge--pro {
  background: #ffdf00;
  color: #002776;
}
.perfil__metricas {
  display: flex;
  gap: 1rem;
  width: 100%;
  justify-content: center;
}
.perfil__metrica-card {
  background: #003a99;
  border-radius: 12px;
  padding: 0.75rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  min-width: 100px;
}
.perfil__metrica-valor {
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffffff;
}
.perfil__metrica-label {
  font-size: 11px;
  color: rgba(255,255,255,0.6);
}
.btn--pro {
  background: #ffdf00;
  color: #002776;
  font-weight: 700;
  width: 100%;
}
.btn--pro:hover {
  background: #ffe833;
}
.btn--admin {
  background: #003a99;
  color: #ffffff;
  font-weight: 700;
  width: 100%;
  border: 1.5px solid #ffdf00;
}
.btn--admin:hover {
  background: #002776;
}
.btn--danger {
  background: #b22234;
  color: #ffffff;
  font-weight: 700;
  width: 100%;
}
.btn--danger:hover {
  background: #8e1a28;
}
.btn--ghost-small {
  background: none;
  border: none;
  color: #888888;
  font-size: 12px;
  cursor: pointer;
  padding: 0.5rem;
  margin-top: 0.5rem;
}
.btn--ghost-small:hover {
  color: #b22234;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal__titulo {
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 0.5rem;
  text-align: center;
}
.modal__texto {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.7);
  text-align: center;
  margin-bottom: 1rem;
}

.lang-btn--suggested {
  border-color: #009c3b;
  background: rgba(0, 156, 59, 0.1);
}
.lang-btn__hint {
  font-size: 10px;
  color: #009c3b;
  font-weight: 600;
  margin-left: auto;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ─── FRASES ─────────────────────────────────── */
.frases-categorias,
.frases-subcategorias,
.frases-lista {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.5rem 0;
}
.frases-cat-btn {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: #003a99;
  border: none;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  text-align: left;
}
.frases-cat-btn:hover {
  background: #002776;
}
.frases-cat-btn__icon {
  font-size: 1.5rem;
}
.frases-cat-btn__label {
  flex: 1;
}
.frases-sub-btn {
  background: #003a99;
  border: none;
  border-radius: 10px;
  padding: 0.85rem 1.25rem;
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  text-align: left;
}
.frases-sub-btn:hover {
  background: #002776;
}
.frase-card__translation {
  font-size: 0.95rem;
  color: rgba(255,255,255,0.8);
  margin: 0.25rem 0;
}
.frases-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
  gap: 0.5rem;
}
.frases-nav__counter {
  font-size: 13px;
  color: rgba(255,255,255,0.6);
  white-space: nowrap;
}

/* ─── DICIONÁRIO ─────────────────────────────── */
.dic-busca,
.dic-detalhe {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.5rem 0;
}
.dic-input-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.dic-input-row .input {
  flex: 1;
}
.dic-btn-buscar {
  width: 48px;
  height: 48px;
  padding: 0;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.dic-resultados {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.dic-resultado-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #003a99;
  border: none;
  border-radius: 10px;
  padding: 0.85rem 1.25rem;
  color: #ffffff;
  cursor: pointer;
  transition: background 0.2s;
  text-align: left;
  gap: 1rem;
}
.dic-resultado-btn:hover {
  background: #002776;
}
.dic-resultado-btn__palavra {
  font-size: 1rem;
  font-weight: 600;
}
.dic-resultado-btn__traducao {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.6);
  text-align: right;
}
.dic-resultado-btn__direita {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.dic-resultado-btn__estrela {
  font-size: 0.75rem;
}
.dic-resultado-btn__seta {
  font-size: 0.9rem;
  color: #ffdf00;
  font-weight: 700;
}
.dic-hint {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  text-align: center;
  margin-top: 0.25rem;
}

/* ─── ADMIN ──────────────────────────────────── */
.admin {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0.5rem 0;
}
.admin-metricas {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.admin-enriquecimento {
  background: #003a99;
  border-radius: 12px;
  padding: 1rem;
}
.admin-enr-texto {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.7);
  margin-bottom: 0.5rem;
}
.admin-enr-barra-bg {
  background: rgba(255,255,255,0.15);
  border-radius: 20px;
  height: 8px;
  overflow: hidden;
}
.admin-enr-barra-fill {
  background: #009c3b;
  height: 8px;
  border-radius: 20px;
  transition: width 0.5s;
}
.admin-usuarios {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.admin-usuarios__titulo {
  font-size: 0.95rem;
  font-weight: 700;
  color: rgba(255,255,255,0.7);
  margin-bottom: 0.25rem;
}
.admin-usuario-item {
  background: #003a99;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.admin-usuario-item__nome {
  font-size: 0.95rem;
  font-weight: 600;
  color: #ffffff;
}
.admin-usuario-item__email {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.6);
}
.admin-usuario-item__badges {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.25rem;
}
.admin-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
}
.admin-badge--pro {
  background: #ffdf00;
  color: #002776;
}
.admin-badge--free {
  background: rgba(255,255,255,0.15);
  color: #ffffff;
}
.admin-badge--admin {
  background: #b22234;
  color: #ffffff;
}
.admin-badge--user {
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.6);
}
