/* ===========================
   Odin — tema dark compacto
   =========================== */

:root {
  --bg: #1f2229;
  --surface: #2b2e37;
  --surface-2: #353945;
  --border: #393d48;
  --border-hover: #4b505e;
  --text: #f1f3f6;
  --muted: #a6abb6;
  --faint: #7a808c;
  --accent: #7c9cff;
  --accent-soft: rgba(124, 156, 255, 0.12);

  --c-cards: #7c9cff;
  --c-pron: #5fd3a6;
  --c-listen: #f0b45b;
  --c-vocab: #e47fb3;

  --radius: 12px;
  --radius-sm: 8px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

html, body { height: 100%; }
html { background: #1f2229; } /* evita fundo branco durante a troca de tela */

/* ---------- Transição entre telas (View Transitions entre páginas) ----------
   Chrome/Edge 126+ e Safari 18.2+; nos demais a troca acontece normal, sem animação. */
@view-transition { navigation: auto; }
::view-transition-old(root),
::view-transition-new(root) { animation-duration: .18s; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}

[hidden] { display: none !important; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }

svg.icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* ---------- Logo ---------- */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.02em;
}
.logo-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-size: 17px;
  font-weight: 700;
}

/* Logotipo em texto (Odin) */
.wordmark {
  position: relative;
  display: inline-block;
  font-family: "Cinzel", Georgia, serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.14em;
  line-height: 1;
  padding-bottom: 6px;
  background: linear-gradient(135deg, #9db4ff 0%, #7c9cff 45%, #a78bfa 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
/* traço fino embaixo, como assinatura de logo */
.wordmark::after {
  content: "";
  position: absolute;
  left: 0.1em;
  right: 0.24em;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, #7c9cff, rgba(167, 139, 250, 0));
}

/* ---------- Botões / inputs ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  font-weight: 500;
  transition: border-color .15s, background .15s;
}
.btn:hover { border-color: var(--border-hover); }
.btn-primary {
  background: #2f6fed;
  border-color: #2f6fed;
  color: #fff;
}
.btn-primary:hover { background: #4580f5; border-color: #4580f5; }
.btn-block { width: 100%; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--muted); }
.input {
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  outline: none;
  transition: border-color .15s;
}
.input::placeholder { color: var(--faint); }
.input:focus { border-color: var(--accent); }

/* ===========================
   Login
   =========================== */
.login-page {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.login-card {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 44px 56px 36px;
  position: relative;
  /* efeito "saltado": brilho em cima + sombras em camadas */
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 2px 4px rgba(0, 0, 0, 0.2),
    0 12px 24px rgba(0, 0, 0, 0.25),
    0 32px 64px -16px rgba(0, 0, 0, 0.55),
    0 0 80px -20px rgba(124, 156, 255, 0.25);
  animation: login-rise .6s cubic-bezier(.2, .8, .2, 1) both;
}
/* faixa de destaque no topo do quadro */
.login-card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  height: 3px;
  background: linear-gradient(90deg, #7c9cff, #a78bfa);
}
@keyframes login-rise {
  from { opacity: 0; transform: translateY(24px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .login-card { animation: none; }
}
.login-page {
  background:
    radial-gradient(600px 400px at 50% 40%, rgba(124, 156, 255, 0.08), transparent 70%),
    var(--bg);
}

/* Troca Entrar <-> Cadastro */
.auth-view:not([hidden]) { animation: auth-fade .35s ease both; }
@keyframes auth-fade {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-view:not([hidden]) { animation: none; }
}
.field-hint { font-size: 13px; color: var(--faint); margin-top: -10px; }
.field-hint.error { color: #ff6b70; }
.login-form .btn:disabled { opacity: .7; cursor: default; transform: none; box-shadow: none; }
.login-form .input.invalid { border-color: #e5484d; }
.float-field .input.invalid + label { color: #ff6b70; }

/* Campos com label que flutua até a borda */
.float-field { position: relative; }
.float-field .input { width: 100%; }
.float-field label {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  padding: 0 6px;
  font-size: 17px;
  color: var(--faint);
  pointer-events: none;
  transition: top .18s ease, font-size .18s ease, color .18s ease;
}
.float-field .input:focus + label,
.float-field .input:not(:placeholder-shown) + label {
  top: 0;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--muted);
  /* metade de cima na cor do quadro, metade de baixo na cor do campo: "corta" a borda */
  background: linear-gradient(var(--surface) 50%, var(--bg) 50%);
}
.float-field .input:focus + label { color: var(--accent); }
.float-field .input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.login-head { text-align: center; margin-bottom: 32px; }
.login-head .wordmark { font-size: 34px; margin-bottom: 22px; }
.login-head h1 { font-size: 22px; font-weight: 600; }
.login-head p { color: var(--muted); font-size: 15px; margin-top: 4px; }

.login-form { display: flex; flex-direction: column; gap: 22px; }
.login-form .field { gap: 8px; }
.login-form .field label { font-size: 14px; color: var(--text); font-weight: 500; }
.login-form .input {
  height: 58px;
  padding: 0 18px;
  font-size: 17px; /* 16px+ evita o zoom automático no iPhone */
  border-radius: 2px;
  transition: border-color .18s, box-shadow .18s;
}
.login-form .btn {
  height: 54px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 2px;
  margin-top: 6px;
  transition: background .15s, transform .15s, box-shadow .15s;
}
.login-form .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px -6px rgba(47, 111, 237, 0.6);
}
.login-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: var(--muted);
}
.login-row label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.login-row input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }
.login-row a { color: var(--accent); }
.login-row a:hover, .login-foot a:hover { color: var(--text); }

.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--faint);
  font-size: 12px;
  margin: 4px 0;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.login-foot {
  text-align: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 15px;
  color: var(--muted);
}
.login-foot a { color: var(--accent); font-weight: 500; }

/* ===========================
   Home
   =========================== */
.app {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover { color: var(--text); background: var(--surface); border-color: var(--border); }
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.greeting { margin: 8px 0 20px; }
.greeting h1 { font-size: 20px; font-weight: 600; }
.greeting p { color: var(--muted); font-size: 13px; }

/* ---------- Mini cards de estatística ---------- */
.stats {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 0;
  margin-bottom: 28px;
}
.stat {
  --c: var(--muted);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  min-width: 0;
}
.stat + .stat { border-left: 1px solid var(--border); }
.stat[data-color="blue"]   { --c: #4ea1ff; }
.stat[data-color="gray"]   { --c: #9aa1ad; }
.stat[data-color="green"]  { --c: #3ecf8e; }
.stat[data-color="purple"] { --c: #a78bfa; }

.stat-icon { color: var(--c); display: grid; place-items: center; }
.stat-icon svg.icon { width: 28px; height: 28px; stroke-width: 1.7; }
.stat-body { min-width: 0; }
.stat-value {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.stat-label {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Seção ---------- */
.section-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

/* ---------- Cards de módulo ---------- */
.modules {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.module {
  --c: var(--accent);
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
  min-height: 200px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 14px;
  /* leve brilho na cor do módulo vindo do canto */
  background:
    radial-gradient(120% 90% at 0% 0%, color-mix(in srgb, var(--c) 13%, transparent), transparent 60%),
    var(--surface);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
.module:hover {
  border-color: color-mix(in srgb, var(--c) 50%, var(--border));
  transform: translateY(-3px);
  box-shadow: 0 16px 32px -14px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
/* ícone grande e apagado no canto, como marca d'água */
.module-watermark {
  position: absolute;
  right: -18px;
  bottom: -22px;
  z-index: -1;
  color: var(--c);
  opacity: 0.07;
  pointer-events: none;
  transition: opacity .2s, transform .3s;
}
.module-watermark svg.icon { width: 130px; height: 130px; stroke-width: 1.4; }
.module:hover .module-watermark { opacity: 0.12; transform: rotate(-6deg) scale(1.05); }

.module-bottom { display: flex; flex-direction: column; gap: 10px; }
.module[data-color="cards"]  { --c: var(--c-cards); }
.module[data-color="pron"]   { --c: var(--c-pron); }
.module[data-color="listen"] { --c: var(--c-listen); }
.module[data-color="vocab"]  { --c: var(--c-vocab); }

.module-head { display: flex; align-items: center; gap: 14px; }
.module-head h3 {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.module-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  color: var(--c);
  background: color-mix(in srgb, var(--c) 16%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 22%, transparent);
}
.module-icon svg.icon { width: 24px; height: 24px; }
.module-badge {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--c);
  background: color-mix(in srgb, var(--c) 12%, transparent);
  padding: 3px 10px;
  border-radius: 999px;
}
.module h3 {
  font-family: "Outfit", var(--font);
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.progress {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.progress span {
  display: block;
  height: 100%;
  background: var(--c);
  border-radius: inherit;
}
.module-foot {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  color: var(--muted);
}
.module-foot strong {
  font-family: "Outfit", var(--font);
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ===========================
   Cards
   =========================== */
.app-narrow { max-width: 560px; }

.topbar-title { display: flex; align-items: center; gap: 8px; }
.topbar-title .icon-btn { margin-left: -8px; }
.topbar-title h1 { font-size: 17px; font-weight: 600; }
.page-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--c-cards);
  background: color-mix(in srgb, var(--c-cards) 12%, transparent);
}
.page-icon svg.icon { width: 16px; height: 16px; }

/* Palavras | Frases */
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 8px 0 16px;
}
.segmented-item {
  height: 34px;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.segmented-item:hover { color: var(--text); }
.segmented-item.active { background: var(--surface-2); color: var(--text); box-shadow: 0 0 0 1px var(--border); }

/* Resumo */
.deck-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 0;
  margin-bottom: 16px;
}
.deck-stat {
  --c: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.deck-stat + .deck-stat { border-left: 1px solid var(--border); }
.deck-stat[data-color="review"]  { --c: #f0b45b; }
.deck-stat[data-color="new"]     { --c: #4ea1ff; }
.deck-stat[data-color="learned"] { --c: #3ecf8e; }
.deck-stat-value {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--c);
  font-variant-numeric: tabular-nums;
}
.deck-stat-label { font-size: 13px; color: var(--muted); }

/* Ações */
.deck-actions { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }

.action-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--c);
  background: color-mix(in srgb, var(--c) 14%, transparent);
}
.action-chevron { color: var(--faint); margin-left: auto; }

.action-primary {
  --c: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius);
  background: #2f6fed;
  color: #fff;
  transition: background .15s, transform .15s;
}
.action-primary:hover { background: #4580f5; transform: translateY(-1px); }
.action-primary .action-icon { background: rgba(255, 255, 255, 0.16); }
.action-primary .action-icon svg.icon { fill: currentColor; }
.action-primary .action-chevron { color: rgba(255, 255, 255, 0.7); }
.action-text { display: flex; flex-direction: column; }
.action-text strong { font-size: 17px; font-weight: 600; }
.action-text small { font-size: 13px; color: rgba(255, 255, 255, 0.75); }

.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
/* Jogar / Adicionar: conteúdo centralizado, ícone grande e fundo na cor do tile */
.action-tile {
  --c: var(--accent);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 2px;
  padding: 20px 12px 18px;
  background:
    radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--c) 16%, transparent), transparent 70%),
    var(--surface);
  border: 1px solid color-mix(in srgb, var(--c) 28%, var(--border));
  border-radius: var(--radius);
  transition: border-color .2s, transform .2s, background-color .2s;
}
.action-tile:hover { border-color: color-mix(in srgb, var(--c) 55%, var(--border)); transform: translateY(-2px); }
.action-tile:active { transform: scale(0.98); }
.action-tile[data-color="play"] { --c: #a78bfa; }
.action-tile[data-color="add"]  { --c: #3ecf8e; }
.action-tile .action-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  margin-bottom: 10px;
  background: color-mix(in srgb, var(--c) 18%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 30%, transparent);
}
.action-tile .action-icon svg.icon { width: 24px; height: 24px; stroke-width: 2; }
.action-tile strong { font-size: 16px; font-weight: 600; }
.action-tile small { font-size: 13px; color: var(--muted); }

.list-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  transition: border-color .15s, color .15s;
}
.list-link:hover { border-color: var(--border-hover); color: var(--text); }
.list-link span { color: var(--text); font-size: 15px; }
.list-link small {
  margin-left: auto;
  font-size: 12px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.list-link small + .action-chevron { margin-left: 0; }

/* ===========================
   Adicionar card
   =========================== */
.page-icon-add {
  color: #3ecf8e;
  background: color-mix(in srgb, #3ecf8e 12%, transparent);
}
.add-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
}
.field label .hint { color: var(--faint); margin-left: 4px; }
.add-form .input { background: var(--bg); }
.textarea {
  height: auto;
  padding: 10px 12px;
  resize: vertical;
  min-height: 72px;
  line-height: 1.5;
}
.field-warn { font-size: 12px; color: #f0b45b; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.form-tip { font-size: 11px; color: var(--faint); text-align: right; margin-top: -8px; }

/* Tela de adicionar: mesmo visual do quadro e dos campos do login */
.page-form .add-form {
  position: relative;
  gap: 22px;
  padding: 28px 20px 22px;
  border-radius: 0;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 2px 4px rgba(0, 0, 0, 0.2),
    0 12px 28px -8px rgba(0, 0, 0, 0.4);
}
/* faixa de destaque no topo, igual ao login */
.page-form .add-form::before {
  content: "";
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  height: 3px;
  background: linear-gradient(90deg, #7c9cff, #a78bfa);
}
.page-form .float-field label { font-size: 17px; left: 10px; }
.page-form .float-field label .hint { font-size: 0.85em; color: var(--faint); margin-left: 2px; }
/* exemplo só aparece com o campo em foco (senão ficaria por cima do label) */
.page-form .float-field .input:not(:focus)::placeholder { color: transparent; }
/* Nota (textarea): label começa no topo, não no meio */
.float-area label { top: 26px; }
.float-area .input:focus + label,
.float-area .input:not(:placeholder-shown) + label { top: 0; }
.page-form .field-warn { margin-top: -14px; }
.page-form .add-form .input {
  height: 52px;
  padding: 0 16px;
  font-size: 18px; /* 16px+ evita o zoom automático no iPhone */
  font-weight: 500;
  letter-spacing: 0.06em;
  border-radius: 0;
  transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}
.page-form .add-form .input::placeholder { font-weight: 400; letter-spacing: 0.01em; }
/* Ao focar: borda azul igual nos 4 lados e um leve brilho em volta */
.page-form .add-form .input:focus {
  border-color: var(--accent);
  background-color: color-mix(in srgb, var(--accent) 5%, var(--bg));
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.page-form .add-form .textarea {
  height: auto;
  min-height: 96px;
  padding: 14px 16px;
  font-size: 17px;
}
.page-form .field-warn { font-size: 13px; }
.page-form .add-form .input:focus + label { background: linear-gradient(var(--surface) 50%, color-mix(in srgb, var(--accent) 5%, var(--bg)) 50%); }
.page-form .form-tip { margin-top: -4px; }

/* Botão dentro do campo (ex.: traduzir automaticamente) */
.float-field.has-action .input { padding-right: 52px; }
.field-action {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  /* sempre com cara de botão: fundo e borda na cor de destaque */
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  cursor: pointer;
  transition: color .15s, background-color .15s, border-color .15s, opacity .15s, transform .1s;
}
.field-action svg.icon { width: 20px; height: 20px; }
.field-action:hover {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
}
.field-action:active { transform: translateY(-50%) scale(.92); }
.field-action:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.field-action.idle { opacity: .55; }          /* Frente vazia: mais apagado, mas ainda visível */
.field-action.loading { color: var(--accent); cursor: default; }
.field-action.loading svg.icon { animation: pulse 0.9s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.page-form .segmented-item { height: 40px; font-size: 16px; }
.page-form .recent-item { font-size: 15px; padding: 12px 16px; }

/* Barra fixa de botões no rodapé */
.page-form { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.form-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
}
.form-bar-inner {
  max-width: 560px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 10px;
}
.form-bar .btn {
  height: 54px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 0;
}
.page-form .toast { bottom: calc(96px + env(safe-area-inset-bottom)); }
kbd {
  font: inherit;
  font-size: 10px;
  padding: 0 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
}

.recent-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
/* Adicionados recentemente: caixa com rolagem própria (~5 itens visíveis) */
.page-form .recent-list {
  max-height: min(300px, 42vh);
  overflow-y: auto;
  overscroll-behavior: contain;       /* rolar a lista não arrasta a página junto */
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--border-hover) transparent;
}
.page-form .recent-list.more-below {
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 40px), transparent);
          mask-image: linear-gradient(to bottom, #000 calc(100% - 40px), transparent);
}
.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color .15s, background-color .15s;
}
/* clicável: abre o card para edição */
a.recent-item:hover { border-color: var(--border-hover); }
a.recent-item:active { background-color: var(--surface-2); }
.recent-edit { width: 16px; height: 16px; color: var(--faint); transition: color .15s; }
a.recent-item:hover .recent-edit { color: var(--accent); }
.recent-back { margin-left: auto; }
.page-form .recent-item { border-radius: 0; }
.recent-front { font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-back { color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }

/* ===========================
   Todos os cards
   =========================== */
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; gap: 6px; }
.btn-sm svg.icon { width: 15px; height: 15px; }
.btn-danger { background: #e5484d; border-color: #e5484d; color: #fff; }
.btn-danger:hover { background: #ec5d62; border-color: #ec5d62; }
.icon-btn-danger:hover { color: #ff6b70; }

.seg-count {
  font-size: 11px;
  color: var(--faint);
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
}
.segmented-item.active .seg-count { color: var(--muted); }

.search { position: relative; margin-bottom: 12px; }
.search svg.icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--faint);
  pointer-events: none;
}
.search .input { width: 100%; padding-left: 36px; background: var(--surface); }

/* Todos os cards: busca maior, mesmo estilo dos campos do card-form */
.page-list .search { margin-bottom: 16px; }
.page-list .search svg.icon { left: 16px; width: 20px; height: 20px; transition: color .2s; }
.page-list .search .input {
  height: 52px;
  padding: 0 16px 0 48px;
  font-size: 17px; /* 16px+ evita o zoom automático no iPhone */
  font-weight: 500;
  letter-spacing: 0.06em;
  border-radius: 0;
  transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}
.page-list .search .input::placeholder { font-weight: 400; letter-spacing: 0.02em; }
.page-list .search .input:focus {
  border-color: var(--accent);
  background-color: color-mix(in srgb, var(--accent) 5%, var(--surface));
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.page-list .search:focus-within svg.icon { color: var(--accent); }
.page-list #addLink { border-radius: 0; }

.card-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.card-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 8px 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color .15s;
}
.card-row:hover { border-color: var(--border-hover); }
.card-row.confirming { border-color: rgba(229, 72, 77, 0.5); background: rgba(229, 72, 77, 0.06); padding-right: 12px; }
.card-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.card-front { font-weight: 500; overflow-wrap: anywhere; }
.card-back { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.card-note {
  font-size: 12px;
  color: var(--faint);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.card-row.confirming .card-actions { gap: 6px; }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 12px);
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border-hover);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Botão sincronizar ---------- */
.sync-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.sync-btn:hover { color: var(--text); border-color: var(--border-hover); }
.sync-btn svg.icon { width: 15px; height: 15px; }
.sync-btn.syncing { cursor: default; color: var(--text); }
.sync-btn.syncing svg.icon { animation: spin .9s linear infinite; }
.sync-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #f0b45b;
  border: 2px solid var(--bg);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Atalho para a home ----------
   Telas com barra de ações (Adicionar card): ícone da casa dentro da própria barra.
   Demais telas: botão redondo flutuante no canto inferior direito. */
.form-bar-inner.with-home { grid-template-columns: 54px 1fr 2fr; }
.form-bar .form-bar-home {
  padding: 0;
  color: var(--muted);
}
.form-bar .form-bar-home:hover { color: var(--accent); }
.form-bar-home svg.icon { width: 24px; height: 24px; }

.home-fab {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 20;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border-hover);
  color: var(--accent);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35), 0 2px 4px rgba(0, 0, 0, .25);
  transition: background-color .15s, transform .1s;
  view-transition-name: home-fab; /* fica parado na troca entre telas */
}
.home-fab:hover { background: color-mix(in srgb, var(--accent) 14%, var(--surface-2)); }
.home-fab:active { transform: scale(.92); }
.home-fab svg.icon { width: 24px; height: 24px; }
/* Mesmo visual do botão Início, mas dentro do cabeçalho (ex.: Adicionar em "Todos os cards") */
.round-btn {
  flex: none;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border-hover);
  color: var(--accent);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35), 0 2px 4px rgba(0, 0, 0, .25);
  transition: background-color .15s, transform .1s;
}
.round-btn:hover { background: color-mix(in srgb, var(--accent) 14%, var(--surface-2)); }
.round-btn:active { transform: scale(.92); }
.round-btn svg.icon { width: 24px; height: 24px; }
/* espaço no fim da página para o botão não cobrir o último item */
body.has-home-fab { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
@media (min-width: 900px) { .home-fab { right: 28px; bottom: 28px; } }

/* ===========================
   Estudar (study.html)
   =========================== */
.page-study { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
.page-study .icon-btn.disabled { opacity: .35; pointer-events: none; }
.page-study .icon-btn:disabled { opacity: .35; cursor: default; background: none; border-color: transparent; }

/* Restantes: novas · aprendendo · revisar + progresso do dia */
.study-head { display: flex; align-items: center; gap: 14px; margin: 4px 0 14px; }
.study-counts { display: flex; gap: 12px; font-variant-numeric: tabular-nums; }
.sc { --c: var(--muted); display: inline-flex; align-items: center; gap: 5px; font-size: 15px; font-weight: 600; color: var(--c); }
.sc i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.sc b { font-weight: 600; border-bottom: 2px solid transparent; line-height: 1.3; }
.sc.current b { border-bottom-color: var(--c); }
.sc-new    { --c: #4ea1ff; }
.sc-learn  { --c: #ff6b70; }
.sc-review { --c: #f0b45b; }
.study-progress { flex: 1; --c: #3ecf8e; }
.study-progress span { transition: width .3s; }

/* Modos: Só ouvir / Digitar resposta */
.study-modes { display: flex; gap: 8px; margin: -4px 0 12px; }
.mode-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: color .15s, border-color .15s, background-color .15s;
}
.mode-chip svg.icon { width: 15px; height: 15px; }
.mode-chip:hover { color: var(--text); border-color: var(--border-hover); }
.mode-chip[aria-pressed="true"] {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  background: var(--accent-soft);
}

/* Botão grande do "Só ouvir" (no lugar da palavra) */
.listen-btn {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  background: var(--accent-soft);
  color: var(--accent);
  cursor: pointer;
  transition: transform .1s, background-color .15s;
  animation: listen-pulse 2s ease-out infinite;
}
.listen-btn svg.icon { width: 40px; height: 40px; }
.listen-btn:hover { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.listen-btn:active { transform: scale(.94); }
@keyframes listen-pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 35%, transparent); }
  70%, 100% { box-shadow: 0 0 0 16px transparent; }
}
@media (prefers-reduced-motion: reduce) { .listen-btn { animation: none; } }

/* Digitar resposta */
.type-box { width: 100%; max-width: 380px; cursor: auto; }
.type-input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  font-size: 18px; /* 16px+ evita o zoom automático no iPhone */
  text-align: center;
  background: var(--bg);
}
.type-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
.type-result {
  --c: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  color: var(--c);
  background: color-mix(in srgb, var(--c) 12%, transparent);
}
.type-result span { font-size: 13px; font-weight: 400; color: var(--muted); }
.type-result s { color: var(--text); text-decoration-color: var(--c); }
.type-result[data-result="ok"]     { --c: #3ecf8e; }
.type-result[data-result="almost"] { --c: #f0b45b; }
.type-result[data-result="wrong"],
.type-result[data-result="empty"]  { --c: #ff6b70; }
/* botão de resposta sugerido pela digitação */
.ans.suggest { box-shadow: 0 0 0 2px var(--c); background: color-mix(in srgb, var(--c) 24%, var(--surface)); }

/* Card */
.study-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  min-height: min(58vh, 460px);
  padding: 48px 24px 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.study-card.enter { animation: card-in .22s ease-out; }
@keyframes card-in { from { opacity: 0; transform: translateY(8px) scale(.985); } }
@media (prefers-reduced-motion: reduce) { .study-card.enter { animation: none; } }

.study-tag {
  --c: var(--muted);
  position: absolute;
  top: 14px;
  left: 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--c);
  background: color-mix(in srgb, var(--c) 12%, transparent);
  padding: 2px 10px;
  border-radius: 999px;
}
.study-tag[data-kind="new"]    { --c: #4ea1ff; }
.study-tag[data-kind="learn"]  { --c: #ff6b70; }
.study-tag[data-kind="review"] { --c: #f0b45b; }

.study-q { display: flex; align-items: center; justify-content: center; gap: 6px; max-width: 100%; }
.study-front {
  font-size: 32px;
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.speak-btn { flex: none; color: var(--accent); }
.speak-btn svg.icon { width: 20px; height: 20px; }

.study-a {
  width: 100%;
  padding-top: 22px;
  border-top: 1px dashed var(--border-hover);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: card-in .18s ease-out;
}
.study-back { font-size: 24px; font-weight: 500; color: var(--text); overflow-wrap: anywhere; }
.study-note { font-size: 15px; color: var(--muted); white-space: pre-line; }
.study-hint { position: absolute; bottom: 14px; font-size: 12px; color: var(--faint); }

/* Rodapé: Mostrar resposta / botões de resposta */
.study-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
}
.study-bar-inner { max-width: 560px; margin: 0 auto; }
.show-btn { width: 100%; height: 62px; font-size: 17px; font-weight: 600; }
.answer-btns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ans {
  --c: var(--muted);
  height: 62px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--c) 40%, var(--border));
  background: color-mix(in srgb, var(--c) 12%, var(--surface));
  color: var(--text);
  cursor: pointer;
  transition: background-color .15s, transform .1s;
}
.ans:hover { background: color-mix(in srgb, var(--c) 22%, var(--surface)); }
.ans:active { transform: scale(.95); }
.ans span { font-size: 15px; font-weight: 600; }
.ans small { font-size: 12px; color: var(--c); font-weight: 500; font-variant-numeric: tabular-nums; }
.ans[data-c="again"] { --c: #ff6b70; }
.ans[data-c="hard"]  { --c: #f0b45b; }
.ans[data-c="good"]  { --c: #3ecf8e; }
.ans[data-c="easy"]  { --c: #4ea1ff; }

/* Fim do estudo */
.study-done {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 40px 20px 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}
.done-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin-bottom: 6px;
  color: #3ecf8e;
  background: color-mix(in srgb, #3ecf8e 14%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #3ecf8e 30%, transparent);
}
.done-icon svg.icon { width: 30px; height: 30px; stroke-width: 2.4; }
.study-done h2 { font-size: 20px; font-weight: 600; }
.study-done p { color: var(--muted); font-size: 15px; max-width: 340px; }
.done-summary { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; margin: 16px 0 6px; }
.done-summary:empty { display: none; }
.done-summary div { display: flex; flex-direction: column; gap: 2px; }
.done-summary div + div { border-left: 1px solid var(--border); }
.done-summary strong { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.done-summary span { font-size: 12px; color: var(--muted); }
.done-actions { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 320px; margin-top: 14px; }
.done-actions .btn { height: 48px; font-size: 15px; font-weight: 600; }

/* ===========================
   Jogo: ligar pares (game.html)
   =========================== */
.page-icon-play { color: #a78bfa; background: color-mix(in srgb, #a78bfa 12%, transparent); }
#soundBtn .icon-off { display: none; }
#soundBtn.off .icon-on { display: none; }
#soundBtn.off .icon-off { display: block; }
#soundBtn:not(.off) { color: var(--accent); }

.game-head { display: flex; align-items: center; gap: 10px; margin: 4px 0 16px; }
.game-progress { flex: 1; --c: #a78bfa; }
.game-progress span { transition: width .2s; }
.game-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.game-chip svg.icon { width: 15px; height: 15px; }
.game-chip-bad b { color: #ff6b70; }

.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.match-col { display: flex; flex-direction: column; gap: 14px; }
.tile {
  min-height: 70px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.25;
  overflow-wrap: anywhere;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  box-shadow: 0 2px 0 rgba(0, 0, 0, .18);
  border-radius: var(--radius);
  cursor: pointer;
  touch-action: manipulation;          /* toque instantâneo, sem esperar zoom */
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  transition: background-color .08s, border-color .08s, transform .08s;
}
.tile:active { transform: scale(.97); }
.tile.sel {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
  color: #fff;
}
.tile.ok {
  border-color: #3ecf8e;
  background: color-mix(in srgb, #3ecf8e 28%, var(--surface));
  color: #fff;
  animation: tile-out .19s cubic-bezier(.5, 0, .75, 0) forwards;
}
.tile.bad {
  border-color: #ff6b70;
  background: color-mix(in srgb, #ff6b70 16%, var(--surface));
  animation: tile-shake .3s;
}
.tile.pop { animation: tile-in .16s ease-out; }
.tile.empty { visibility: hidden; }
/* acerto: dá um "pulo" com brilho verde e encolhe sumindo */
@keyframes tile-out {
  0%   { transform: scale(1); box-shadow: 0 0 0 0 rgba(62, 207, 142, .55); }
  35%  { transform: scale(1.07); box-shadow: 0 0 0 6px rgba(62, 207, 142, .35); opacity: 1; }
  100% { transform: scale(.4) rotate(-4deg); box-shadow: 0 0 0 14px rgba(62, 207, 142, 0); opacity: 0; filter: blur(2px); }
}
@keyframes tile-in {
  from { opacity: 0; transform: scale(.85) translateY(6px); }
  70%  { transform: scale(1.03); }
}

/* faíscas do acerto (desenhadas por cima, no centro do tile) */
.burst { position: fixed; z-index: 50; width: 0; height: 0; pointer-events: none; }
.burst-ring {
  position: absolute;
  left: calc(var(--w) / -2);
  top: calc(var(--h) / -2);
  width: var(--w);
  height: var(--h);
  border-radius: var(--radius);
  border: 2px solid #3ecf8e;
  animation: burst-ring .35s ease-out forwards;
}
.burst i {
  position: absolute;
  left: -4px;
  top: -4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3ecf8e;
  box-shadow: 0 0 8px #3ecf8e;
  animation: burst-dot .4s cubic-bezier(.2, .7, .3, 1) forwards;
}
.burst i:nth-child(odd) { background: #a6f4cf; width: 6px; height: 6px; }
@keyframes burst-ring { to { transform: scale(1.25); opacity: 0; } }
@keyframes burst-dot {
  0%   { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--x), var(--y)) scale(.2); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .burst { display: none; } }

/* Ranking (10 melhores) */
.ranking { width: 100%; margin-top: 18px; text-align: left; }
.ranking .section-title { margin-bottom: 8px; }
.rank-list { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.rank-list li {
  display: grid;
  grid-template-columns: 28px auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid transparent;
  font-variant-numeric: tabular-nums;
}
.rank-list li.me {
  border-color: #a78bfa;
  background: color-mix(in srgb, #a78bfa 14%, var(--bg));
  animation: tile-in .3s ease-out;
}
.rank-pos {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
}
.rank-pos[data-pos="1"] { color: #1f2229; background: #f5c542; }
.rank-pos[data-pos="2"] { color: #1f2229; background: #c9ced6; }
.rank-pos[data-pos="3"] { color: #1f2229; background: #d89a62; }
.rank-time { font-size: 16px; font-weight: 600; }
.rank-detail { font-size: 12px; color: var(--muted); }
.rank-date { font-size: 12px; color: var(--faint); }
.rank-empty { color: var(--muted); font-size: 14px; display: block !important; text-align: center; }
.rank-rule { margin-top: 8px; font-size: 12px !important; color: var(--faint) !important; text-align: center; max-width: none !important; }
@keyframes tile-shake {
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}
/* Frases: texto maior não cabe, fonte menor */
.game-frases .tile { font-size: 15px; min-height: 84px; }
@media (prefers-reduced-motion: reduce) {
  .tile.ok, .tile.bad, .tile.pop { animation: none; }
}

/* ---------- Responsivo ---------- */
@media (max-width: 520px) {
  /* Login */
  .login-card { padding: 36px 28px 28px; }
  .login-head { margin-bottom: 26px; }
  .login-head .wordmark { font-size: 30px; }
  .login-head h1 { font-size: 20px; }

  /* Estatísticas: sempre uma linha, conteúdo empilhado e menor */
  .stats { padding: 12px 0; margin-bottom: 22px; }
  .stat { gap: 8px; padding: 0 10px; }
  .stat-icon svg.icon { width: 20px; height: 20px; }
  .stat-value { font-size: 18px; }
  .stat-label { font-size: 11px; white-space: normal; line-height: 1.3; }

  /* Sincronizar: só o ícone */
  .sync-label { display: none; }
  .sync-btn { padding: 0 9px; }

  /* Adicionar */
  .add-form { padding: 16px; }
  .form-actions .btn-primary { flex: 1; }
  .form-tip { display: none; }

  /* Módulos: 2 por linha, mais compactos */
  .modules { gap: 10px; }
  .module { padding: 14px; gap: 14px; min-height: 165px; border-radius: 12px; }
  .module-head { gap: 8px; }
  .module-icon { width: 30px; height: 30px; border-radius: 9px; }
  .module-icon svg.icon { width: 16px; height: 16px; }
  .module-badge { display: none; }
  .module h3 { font-size: clamp(14px, 3.9vw, 18px); letter-spacing: 0; }
  .module-watermark { right: -14px; bottom: -16px; }
  .module-watermark svg.icon { width: 90px; height: 90px; }
  .progress { height: 5px; }
  .module-bottom { gap: 8px; }
  .module-foot { font-size: 12px; flex-wrap: wrap; gap: 2px 8px; }
  .module-foot strong { font-size: 15px; }
}
