﻿:root {
  /* Tokens globais de cores, raios e tipografia usados em todo o site */
  --bg-main: #ffffff;
  --bg-section: #008578;
  --card-surface: #f7faf9;
  --card-border: #dbe7e4;
  --accent: #00b3a4;
  --accent-strong: #006d62;
  --badge-blue: #3b82f6;
  --text-main: #122027;
  --text-muted: #5c6c74;
  --danger: #ff6b6b;
  --success: #2eb97c;
  --warning: #ffb347;
  --radius-lg: 32px;
  --radius-md: 20px;
  --shadow-soft: 0 20px 35px rgba(9, 45, 53, 0.15);
  --shadow-card: 0 12px 24px rgba(2, 64, 71, 0.12);
  font-family: "Poppins", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Reset básico para cálculo de caixa */
* {
  box-sizing: border-box;
}

/* Base do corpo da página */
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-main);
  color: var(--text-main);
  font-family: inherit;
}

/* Links neutros (herdam cor) */
a {
  color: inherit;
  text-decoration: none;
}

/* Imagens responsivas */
img {
  max-width: 100%;
  display: block;
}

/* Estilo de título curto (eyebrow) usado em seções */
.eyebrow {
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0 0 0.2rem;
}

/* Cabeçalho/hero da página inicial com nome e ações rápidas */
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1.9rem 1.5rem 1.35rem;
  background: var(--bg-main);
  border-bottom: 1px solid rgba(16, 90, 85, 0.08);
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.hero-text h1,
.hero-text h2 {
  margin: 0;
  font-size: clamp(1.85rem, 4.6vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.hero-text p {
  margin: 0.45rem 0 0;
  max-width: 760px;
}

.hero-kicker {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(13, 74, 73, 0.82);
}

.hero-subtitle {
  color: #1b3238;
  opacity: 0.9;
}

.hero-guest-hint {
  margin-top: 0.5rem;
  font-weight: 600;
  color: var(--accent-strong);
}

/* Blocos compactos com informações do usuário e streak */
.hero-meta,
.user-pill,
.streak-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.hero-meta {
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 0.5rem;
}

.hero-meta--minimal {
  min-width: 150px;
}

.hero-admin-link {
  border: 1px solid rgba(12, 108, 100, 0.22);
  background: rgba(255, 255, 255, 0.72);
  color: #0b5f58;
  border-radius: 999px;
  font-weight: 600;
  backdrop-filter: blur(4px);
  box-shadow: 0 10px 24px rgba(6, 80, 78, 0.1);
}

.user-pill {
  background: var(--card-surface);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 0.35rem 1rem;
  font-weight: 500;
}

.streak-chip {
  font-family: "Poppins", sans-serif;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.95), rgba(0, 179, 164, 0.25));
  border-radius: 22px;
  padding: 0.35rem 1.2rem;
  color: var(--accent-strong);
  font-weight: 600;
  border: 1px solid rgba(0, 111, 102, 0.2);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(10px);
  gap: 0.4rem;
}

/* Foguinho exibido no chip de streak */
.streak-chip::before {
  content: "🔥";
  font-size: 0.9rem;
}

.back-link {
  font-weight: 500;
  color: var(--accent-strong);
}

/* Topo da home com cor sólida da identidade do site */
.page-home .hero-home {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--accent);
  border-bottom: 1px solid rgba(0, 87, 78, 0.28);
}

.page-home .hero-home > * {
  position: relative;
  z-index: 1;
}

.page-home .hero-home::before {
  display: none;
}

.page-home .hero-home .hero-text h1 {
  color: #ffffff;
}

.page-home .hero-home .hero-kicker {
  color: rgba(255, 255, 255, 0.86);
}

.page-home .hero-home .hero-subtitle {
  color: rgba(255, 255, 255, 0.92);
}

.page-home .hero-home .hero-admin-link {
  border-color: rgba(255, 255, 255, 0.56);
  background: #ffffff;
  color: var(--accent-strong);
  box-shadow: 0 10px 24px rgba(0, 68, 62, 0.22);
}

/* Container principal da home */
.home-main {
  padding: 2rem 1.5rem 3rem;
  max-width: 1200px;
  margin: 0 auto;
}

/* Cartão que agrupa a lista de decks */
.deck-section {
  background: var(--card-surface);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-soft);
}

/* Topo da seção com filtros de disciplina e modo */
.section-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 2rem;
}

/* Combo de disciplina */
.discipline-select {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 500;
  color: var(--text-muted);
}

.discipline-select select {
  border-radius: 999px;
  border: 1px solid var(--card-border);
  padding: 0.5rem 1.25rem;
  font-size: 1rem;
  background: #fff;
}

/* Contêiner que agrupa filtros extras */
.header-controls {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

/* Seleção de modo (normal/revisão/etc.) */
.mode-select {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 500;
  color: var(--text-muted);
}

.mode-select select {
  border-radius: 999px;
  border: 1px solid var(--card-border);
  padding: 0.5rem 1.25rem;
  font-size: 1rem;
  background: #fff;
  width: 170px;
  max-width: 170px;
}

.mode-select select:disabled {
  background: #f2f5f4;
  color: var(--text-muted);
  cursor: not-allowed;
}

.mode-hint {
  font-size: 0.8rem;
  line-height: 1.25;
  color: var(--text-muted);
  margin-top: 0.15rem;
  max-width: 170px;
  display: block;
}

/* Lista hierárquica de decks */
.deck-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Bloco individual de deck e seus filhos */
.deck-group {
  background: #fff;
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
  border: 1px solid #e4ece9;
  overflow: visible;
}

/* Lista de decks filhos */
.deck-children {
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  background: #fff;
  border-top: 1px solid #eef2f1;
}

/* Cartão individual de deck/nó na árvore */
.deck-card {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0.9rem;
  padding: 0.9rem 1rem 0.9rem 1.4rem;
  min-height: 58px;
  background: #fff;
  color: var(--text-main);
  border: none;
  box-shadow: none;
}

/* Nó clicável que expande/colapsa filhos */
.deck-card.has-children {
  cursor: pointer;
  padding-left: 2.1rem;
}

.deck-card.has-children::after {
  content: ">";
  position: absolute;
  left: 0.8rem;
  top: 50%;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1;
  color: currentColor;
  transform: translateY(-50%) rotate(0deg);
  transition: transform 0.2s ease;
}

.deck-card.has-children[data-expanded="true"]::after {
  transform: translateY(-50%) rotate(90deg);
}

.deck-card__text {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  min-width: 0;
}

/* Destaque para nível 1 (deck principal) */
.deck-card[data-depth="1"] {
  background: var(--bg-section);
  color: #fff;
  border: none;
  box-shadow: none;
  border-radius: 18px 18px 0 0;
  padding-right: 1rem;
}

/* Quando a lista principal está fechada, arredonda também a base do header */
.deck-card[data-depth="1"][data-expanded="false"] {
  border-radius: 18px;
}

.deck-group .deck-card[data-depth="1"] {
  box-shadow: none;
  border: none;
}

.deck-group .deck-card {
  box-shadow: none;
  border: none;
}

.deck-card[data-depth="1"] .deck-stats .stat {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.deck-card[data-depth="1"] .deck-stats .stat-letter {
  background: rgba(255, 255, 255, 0.22);
}

.deck-card[data-depth="1"] .deck-title,
.deck-card[data-depth="1"] .deck-path {
  color: #fff;
}

.deck-card[data-depth="2"] {
  padding-left: 1.9rem;
}

.deck-card[data-depth="3"] {
  padding-left: 2.5rem;
}

.deck-card[data-depth="4"] {
  padding-left: 3.1rem;
}

/* Aparência das linhas de filhos dentro do grupo */
.deck-children .deck-card {
  background: #fff;
  color: var(--text-main);
  box-shadow: none;
  border: none;
  border-bottom: 1px solid #eef2f1;
  border-radius: 0;
  padding-right: 1rem;
}

.deck-children .deck-card:last-child {
  border-bottom: none;
  border-radius: 0;
}

.deck-children .deck-children {
  margin-left: 0.9rem;
  padding-left: 0.9rem;
}

.deck-group > .deck-children:last-child > .deck-card:last-child {
  border-radius: 0 0 18px 18px;
}

.deck-card .deck-title {
  margin: 0;
  font-size: 1.08rem;
  text-transform: none;
}

.deck-card .deck-path {
  opacity: 0.8;
}

.deck-card .deck-path {
  margin: 0;
  font-size: 0.9rem;
  text-transform: none;
  letter-spacing: 0.02em;
  opacity: 0.75;
}

.deck-card[data-depth="2"] .deck-path,
.deck-card[data-depth="3"] .deck-path,
.deck-card[data-depth="4"] .deck-path {
  display: none;
}

/* Badges de estatísticas de cada deck */
.deck-stats {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
  align-items: center;
}

.deck-card__text {
  width: auto;
}

.deck-stats .stat {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(0, 0, 0, 0.06);
  padding: 0.22rem 0.55rem;
  border-radius: 12px;
  font-weight: 600;
  color: inherit;
}

.deck-stats .stat-letter {
  display: inline-block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  color: #fff;
  text-align: center;
  line-height: 22px;
  font-size: 0.85rem;
}

/* Cores dos selos de Total / Acertos / Erros */
.deck-stats .stat:nth-child(1) .stat-letter { background: var(--badge-blue); }
.deck-stats .stat:nth-child(2) .stat-letter { background: var(--success); }
.deck-stats .stat:nth-child(3) .stat-letter { background: var(--danger); }

.deck-stats-single {
  align-items: center;
}

.deck-stats-single .stat-letter {
  background: var(--accent);
}

.deck-stats-single .stat-label {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Legenda exibida acima da lista */
.stats-legend {
  margin: 0 0 0.75rem 0;
  font-weight: 700;
  color: var(--text-main);
  font-size: 0.95rem;
}

/* Legenda em formato de tabela com marcadores coloridos */
.legend-table {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  overflow-x: auto;
  padding: 0.25rem 0;
}
.legend-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(0,0,0,0.03);
  padding: 0.35rem 0.6rem;
  border-radius: 10px;
  font-weight: 600;
  color: var(--text-muted);
}
.legend-dot {
  display: inline-flex;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
}
.legend-dot.n { background: var(--badge-blue); }
.legend-dot.a { background: var(--success); }
.legend-dot.r { background: var(--danger); }
.legend-label { color: var(--text-main); font-weight: 700; font-size: 0.95rem; }

.deck-stats .stat-count {
  font-weight: 700;
  font-size: 0.95rem;
}

/* Ações do deck (abrir + menu) */
.deck-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  z-index: 2;
  position: relative;
  flex-wrap: nowrap;
}

.deck-card .pill-button {
  background: #fff;
  color: var(--accent-strong);
  flex: 0 0 auto;
  min-width: 96px;
  border: 1px solid var(--card-border);
}

.deck-open-btn.is-locked,
.deck-open-btn.is-unlocked {
  position: relative;
  padding-right: 2.4rem;
  box-shadow: none;
}

.deck-open-btn.is-locked {
  background: #f3f6f5;
  color: var(--text-muted);
  border: 1px solid var(--card-border);
}

.deck-open-btn.is-unlocked {
  background: #fff;
  color: var(--accent-strong);
  border: 1px solid var(--card-border);
}

.deck-open-btn.is-locked::after,
.deck-open-btn.is-unlocked::after {
  content: "";
  position: absolute;
  right: 0.8rem;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  background-color: var(--lock-color);
  -webkit-mask: var(--lock-icon) center / contain no-repeat;
  mask: var(--lock-icon) center / contain no-repeat;
}

.deck-open-btn.is-locked {
  --lock-color: #2b2f2e;
  --lock-icon: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='currentColor' d='M7 10V7a5 5 0 0 1 10 0v3h1a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h1zm2 0h6V7a3 3 0 0 0-6 0v3z'/%3E%3C/svg%3E");
}

.deck-open-btn.is-unlocked {
  --lock-color: var(--accent-strong);
  --lock-icon: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='10' width='16' height='10' rx='2' ry='2' fill='currentColor' stroke='none'/%3E%3Cpath d='M15 10V7a3 3 0 0 0-6 0'/%3E%3Cpath d='M12 14a2 2 0 0 1 2 2v1a2 2 0 1 1-4 0v-1a2 2 0 0 1 2-2z' fill='currentColor' stroke='none'/%3E%3C/svg%3E");
}

.deck-open-btn.is-locked:hover {
  transform: none;
  box-shadow: none;
}

.deck-open-btn.is-pending {
  opacity: 0.65;
  cursor: wait;
}

.deck-card[data-depth="1"] .pill-button {
  border-color: rgba(255, 255, 255, 0.45);
}

/* Estilo base para botões em formato de pílula */
.pill-button {
  border: none;
  border-radius: 12px;
  padding: 0.6rem 1.4rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pill-button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
}

.pill-button.primary {
  background: var(--accent);
  color: #fff;
}

/* Ajuste de hover nos botões dentro dos cards */
.deck-card .pill-button:hover {
  transform: translateY(-2px);
}

.icon-button {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--card-border);
  background: #f7f9f8;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
}

.deck-menu-toggle {
  font-size: 1.4rem;
  line-height: 1;
  letter-spacing: 0;
  background: rgba(0, 0, 0, 0.06);
  color: #fff;
  border-color: rgba(0, 0, 0, 0.08);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease,
    border-color 0.18s ease;
  --menu-glow: rgba(0, 0, 0, 0.18);
}

.deck-menu-toggle,
#studyOptionsBtn {
  font-size: 1.4rem;
  line-height: 1;
}

#studyOptionsBtn {
  background: rgba(0, 0, 0, 0.06);
  color: #fff;
  border-color: rgba(0, 0, 0, 0.08);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease,
    border-color 0.18s ease;
  --menu-glow: rgba(0, 0, 0, 0.18);
}

.deck-menu-toggle:hover {
  background: rgba(0, 0, 0, 0.12);
  transform: translateY(-1px) scale(1.03);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}

#studyOptionsBtn:hover {
  background: rgba(0, 0, 0, 0.12);
  transform: translateY(-1px) scale(1.03);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}

.deck-menu-toggle.is-open,
#studyOptionsBtn.is-open {
  transform: translateY(-1px) scale(1.04);
  box-shadow: 0 0 0 3px var(--menu-glow), 0 10px 20px rgba(0, 0, 0, 0.2);
  animation: menuPulse 1.6s ease-in-out infinite;
}

@keyframes menuPulse {
  0%,
  100% {
    box-shadow: 0 0 0 2px var(--menu-glow), 0 8px 16px rgba(0, 0, 0, 0.16);
  }
  50% {
    box-shadow: 0 0 0 5px var(--menu-glow), 0 12px 22px rgba(0, 0, 0, 0.22);
  }
}

.deck-card[data-depth="1"] .deck-menu-toggle {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.28);
  --menu-glow: rgba(255, 255, 255, 0.35);
}

.deck-card[data-depth="1"] .deck-menu-toggle:hover {
  background: rgba(255, 255, 255, 0.26);
}

.deck-card[data-depth="2"] .deck-menu-toggle,
.deck-card[data-depth="3"] .deck-menu-toggle,
.deck-card[data-depth="4"] .deck-menu-toggle {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.08);
  color: #1b1f1e;
  text-shadow: none;
  --menu-glow: rgba(0, 0, 0, 0.18);
}

.menu-wrapper {
  position: relative;
}

.menu,
.deck-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
  min-width: 180px;
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  z-index: 5;
}

.menu[hidden],
.deck-menu[hidden] {
  display: none !important;
}

.menu-item,
.deck-menu-item {
  background: transparent;
  border: none;
  text-align: left;
  padding: 0.55rem 0.75rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  border-radius: 10px;
}

.menu-item:hover,
.deck-menu-item:hover {
  background: #f1f4f3;
}

.menu-item[disabled],
.deck-menu-item[disabled] {
  color: var(--text-muted);
  cursor: not-allowed;
}

.pill-button.small {
  padding: 0.35rem 0.9rem;
  font-size: 0.85rem;
}

/* Mensagem de vazio quando não há decks/cartas */
.empty-state {
  text-align: center;
  margin-top: 1.5rem;
  color: var(--text-muted);
}

/* Página de estudo (flashcards e questões) */
.page-study {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #f4f8f7;
}

/* Variante de hero na tela de estudo */
.hero-study {
  align-items: center;
  background: linear-gradient(120deg, rgba(0, 133, 120, 0.2), rgba(255, 255, 255, 0));
}

/* Coluna central da sessão de estudo */
.study-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  padding: 2rem 1.5rem 3rem;
  max-width: 1040px;
  margin: 0 auto;
  width: 100%;
}

/* Coluna que empilha os cartões de estudo */
.card-column {
  --card-max: 900px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  align-items: center;
  width: 100%;
}

/* Wrapper que centraliza o card e rótulos de swipe */
.card-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

/* Cartão principal (flashcard) usado nos swipes */
.study-card {
  width: min(100%, var(--card-max));
  min-height: 360px;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 2.5rem 2.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  align-items: flex-start;
  justify-content: center;
  text-align: left;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  touch-action: pan-y;
}

.study-card.locked {
  opacity: 0.95;
  cursor: default;
}

.study-card.hidden {
  display: none;
}

.study-card.dragging {
  box-shadow: 0 30px 50px rgba(0, 0, 0, 0.2);
}

/* Texto das faces (pergunta/resposta) */
.card-face {
  font-size: 1.05rem;
  line-height: 1.65;
  text-align: left;
  width: 100%;
}

/* Destaque para a resposta exibida */
.card-answer {
  margin-top: 0.8rem;
  font-weight: 600;
  color: var(--accent-strong);
}

/* Sublinhado pontilhado para esconder trechos (cloze) */
.cloze-hidden {
  display: inline-block;
  padding: 0 0.2rem;
  border-bottom: 2px dotted var(--text-muted);
}

.card-face.back {
  border-top: 1px solid var(--card-border);
  padding-top: 1.2rem;
}

.card-answer {
  margin-top: 0.75rem;
  font-weight: 600;
  color: var(--accent-strong);
}

.cloze-hidden {
  border-bottom: 2px dotted rgba(18, 32, 39, 0.4);
  padding: 0 0.3rem;
}

/* Container de imagem dentro do card */
.card-image {
  max-height: 180px;
  display: flex;
  justify-content: center;
}

.card-image img {
  max-width: 100%;
  max-height: 240px;
  object-fit: contain;
  border-radius: 12px;
}

/* Labels que aparecem ao arrastar para lados */
.swipe-label {
  position: absolute;
  top: 20px;
  font-weight: 700;
  font-size: 1.2rem;
  padding: 0.4rem 0.8rem;
  border-radius: 12px;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.swipe-left {
  left: 20px;
  background: rgba(255, 107, 107, 0.85);
}

.swipe-right {
  right: 20px;
  background: rgba(46, 185, 124, 0.85);
}

.swipe-label.visible {
  opacity: 1;
}

/* Área de botões abaixo do card */
.card-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}

/* Botão primário para mostrar resposta/avançar */
.primary-action {
  width: 100%;
  max-width: 360px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 0.9rem;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
}

/* Botões exibidos após responder */
.answer-actions {
  display: none;
  gap: 1rem;
  justify-content: center;
  width: 100%;
}

#editCurrentCardLink {
  width: 100%;
  max-width: 360px;
  text-align: center;
}

/* Botão secundário com ícone para marcar acerto/erro */
.action-btn {
  flex: 1;
  max-width: 200px;
  border-radius: 20px;
  border: none;
  background: #fff;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.9rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.action-btn span {
  font-size: 1.2rem;
}

.action-btn small {
  font-size: 0.95rem;
  color: inherit;
}

.action-btn.danger {
  background: linear-gradient(135deg, #ffe0e0, #ffd1d1);
  color: #b42323;
}

.action-btn.success {
  background: linear-gradient(135deg, #e0f9f0, #d3f3e7);
  color: #137a4b;
}

.action-btn:active {
  transform: translateY(1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Botão para marcar carta como favorita */
.favorite-btn {
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 0.4rem 1.2rem;
  background: #fff;
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
  font-weight: 500;
}

.favorite-btn .icon {
  font-size: 1rem;
}

.favorite-btn[aria-pressed="true"] {
  background: rgba(254, 226, 226, 0.7);
  color: var(--danger);
}

/* Questão de ordenação: slots e chips arrastáveis */
.ordering-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ordering-slots {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.5rem;
}

.ordering-slot {
  min-height: 48px;
  border: 2px dashed rgba(18, 32, 39, 0.2);
  border-radius: 14px;
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  user-select: none;
  touch-action: manipulation;
}

.ordering-slot:empty::after {
  content: attr(data-label);
  opacity: 0.6;
}

.ordering-slot > .ordering-chip {
  width: 100%;
}

.ordering-pool {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.ordering-chip-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ordering-chip {
  border: none;
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  background: #e8f8f4;
  color: var(--accent-strong);
  font-weight: 600;
  cursor: grab;
  user-select: none;
  touch-action: manipulation;
}

.ordering-chip:active {
  cursor: grabbing;
}

.ordering-container,
.ordering-container p,
.ordering-chip-wrapper,
.ordering-pool,
.image-completion-container,
.image-completion-container p,
.image-completion-board,
.image-slot,
.image-completion-container .ordering-slot,
.image-completion-container .ordering-chip {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

/* Mensagens de feedback na ordenação */
.ordering-feedback {
  font-weight: 600;
}

.ordering-feedback.correct {
  color: var(--success);
}

.ordering-feedback.incomplete {
  color: var(--warning);
}

.ordering-feedback.incorrect {
  color: var(--danger);
}

/* Caixa com resultado e botões da questão de ordenação */
.ordering-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: 360px;
}

.ordering-result-box {
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 0.75rem 1rem;
  background: #f6f8f7;
}

.ordering-result-box[data-state="success"] {
  border-color: var(--success);
  background: #e6f7ef;
}

.ordering-result-box[data-state="error"] {
  border-color: var(--danger);
  background: #fff1f1;
}

.ordering-result-box[data-state="incomplete"] {
  border-color: var(--warning);
  background: #fff7e0;
}

/* Questão de associação: duas colunas para montar pares */
.linking-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  width: 100%;
}

.linking-column {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Questão de múltipla escolha / opções */
.options-board {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: var(--card-max);
  margin: 0 auto;
}

.option-row {
  display: grid;
  grid-template-columns: 24px minmax(280px, 1fr) 140px;
  gap: 0.6rem;
  align-items: center;
  width: 100%;
}

.option-badge {
  display: inline-flex;
  min-width: 28px;
  justify-content: center;
  font-weight: 700;
  color: var(--text-muted);
  font-size: 1rem;
  align-self: center;
}

.options-area {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 1rem;
  width: 100%;
  max-width: var(--card-max);
  align-items: center;
}

.access-notice {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: #fff7dc;
  border: 1px solid rgba(255, 179, 71, 0.55);
  color: var(--accent-strong);
  font-weight: 600;
  text-align: center;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.04);
}

.deck-lock-notice {
  margin: 0 0 1rem;
}

.access-notice.error {
  background: #fff4f4;
  border-color: rgba(255, 107, 107, 0.6);
  color: var(--danger);
}

/* Alternativa clicável */
.option-item {
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  background: #fff;
  font-weight: 700;
  text-align: left;
  white-space: normal;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
  width: 100%;
  justify-content: flex-start;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

.option-item.is-selected {
  border-color: var(--accent);
  box-shadow: 0 10px 20px rgba(0, 179, 164, 0.15);
  transform: translateY(-1px);
}

/* Navegação por questão (pontos numerados) */
.question-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.page-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  justify-content: center;
  padding: 0.35rem 0.6rem;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 999px;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.08);
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.page-btn {
  width: 36px;
  height: 36px;
  font-size: 1.2rem;
  font-weight: 700;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--card-border);
  color: var(--accent-strong);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.page-btn:hover:not([disabled]):not([data-locked="true"]) {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.12);
}

.page-btn[disabled],
.page-btn[data-locked="true"] {
  opacity: 0.6;
  cursor: not-allowed;
  background: #f1f4f3;
  color: #b4c0bb;
  box-shadow: none;
}

.page-info {
  font-weight: 600;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 0, 0, 0.06);
  padding: 0.45rem 0.9rem;
  border-radius: 18px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.06);
  line-height: 1.25;
  font-size: 0.95rem;
  text-align: center;
  white-space: pre-line;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
}

.page-premium-hint {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-strong);
  background: rgba(0, 179, 164, 0.12);
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.page-premium-hint.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.page-premium-hint.is-attention {
  box-shadow: 0 8px 18px rgba(0, 179, 164, 0.2);
}

.nav-dot {
  width: 38px;
  height: 38px;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  background: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.nav-dot.is-active {
  border-color: var(--accent);
  box-shadow: 0 8px 14px rgba(0, 179, 164, 0.15);
  transform: translateY(-1px);
}

.nav-dot.is-correct {
  border-color: var(--success);
  background: #e6f7ef;
}

.nav-dot.is-wrong {
  border-color: var(--danger);
  background: #fff1f1;
}

.option-item.is-correct {
  border-color: var(--success);
  background: #e6f7ef;
}

.option-item.is-wrong {
  border-color: var(--danger);
  background: #fff1f1;
}

.option-item-content {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  width: 100%;
}

.option-letter {
  display: inline-flex;
  min-width: 44px;
  justify-content: center;
  font-weight: 700;
  color: var(--text-muted);
  flex: 0 0 auto;
}

.option-text {
  display: block;
  flex: 1;
  min-width: 0;
  text-align: left;
  line-height: 1.4;
  color: var(--text-main);
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.option-text p,
.option-text div {
  margin: 0;
}

/* Item clicável da associação */
.linking-item {
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  background: #fff;
  color: var(--text-main);
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  transition: transform 0.1s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.05);
}

.linking-item.is-selected {
  border-color: var(--accent);
  box-shadow: 0 10px 20px rgba(0, 179, 164, 0.18);
  transform: translateY(-1px);
}

.linking-item.is-linked {
  color: var(--text-main);
}

/* Texto de instrução na associação */
.linking-legend {
  margin: 0.35rem 0;
  text-align: center;
  color: var(--text-muted);
  font-weight: 600;
}

/* Resumo de ligações corretas/incorretas */
.linking-review {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.linking-review-title {
  margin: 0.25rem 0;
  font-weight: 700;
  color: var(--text-muted);
}

.link-pill {
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 0.55rem 0.75rem;
  font-weight: 700;
  color: var(--text-main);
  background: #fff;
}

.link-pill.user-wrong {
  border-color: var(--danger);
  color: var(--danger);
  background: #fff4f4;
}

.link-pill.correct {
  border-color: var(--accent);
  color: var(--accent-strong);
  background: #e8f8f4;
}

/* Bloco de resolução/explicação */
.resolution-block {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.04);
}

.resolution-block h3 {
  margin: 0 0 0.5rem 0;
}

.resolution-video iframe {
  width: 100%;
  min-height: 240px;
  border: none;
  border-radius: 12px;
}

/* Resumo de acertos/erros na questão de ordenação */
.ordering-review {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.ordering-review-title {
  margin: 0 0 0.25rem;
  font-weight: 700;
  color: var(--text-muted);
}

.ordering-review-list {
  margin: 0;
  padding-left: 1rem;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--card-border);
}

.ordering-review-list li {
  padding: 0.35rem 0.5rem;
}

.ordering-review-list li.is-wrong {
  color: var(--danger);
  font-weight: 700;
}

.ordering-review-list.correct li {
  color: var(--success);
  font-weight: 700;
}

/* Linha de comparação entre resposta do usuário e gabarito */
.ordering-compare-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
}

.ordering-compare {
  padding: 0.45rem 0.6rem;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: #fff;
  font-weight: 600;
}

.ordering-compare.user.is-wrong {
  border-color: var(--danger);
  color: var(--danger);
  background: #fff4f4;
}

.ordering-compare.correct {
  border-color: var(--success);
  color: var(--success);
  background: #e9f8f0;
}
/* Questão de completar imagem com rótulos arrastáveis */
.image-completion-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
  margin-top: 1rem;
  margin-bottom: 1rem;
  padding: 0.25rem 0.5rem;
}

.image-completion-prompt {
  text-align: center;
  font-weight: 600;
  margin-bottom: 0.6rem;
}

/* Quadro que mostra a imagem central e slots */
.image-completion-board {
  position: relative;
  width: min(90%, 360px);
  max-width: 360px;
  aspect-ratio: 1;
  background: #fff;
  border: 2px solid var(--card-border);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  margin-top: 0.6rem;
  margin-bottom: 0.6rem;
}

.image-completion-center {
  width: 70%;
  height: 70%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-completion-center img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Slot de texto posicionável ao redor da imagem */
.image-slot {
  position: absolute;
  min-width: 96px;
  max-width: 120px;
  min-height: 44px;
  padding: 0.25rem 0.5rem;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  word-break: break-word;
  text-align: center;
  line-height: 1.2;
}

.image-slot.pos-top {
  top: -6%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.image-slot.pos-right {
  right: -2%;
  top: 50%;
  transform: translate(25%, -50%);
}

.image-slot.pos-bottom {
  bottom: -2%;
  left: 50%;
  transform: translate(-50%, 25%);
}

.image-slot.pos-left {
  left: -2%;
  top: 50%;
  transform: translate(-25%, -50%);
}

/* Texto de status da carta (intervalo, estado) */
.interval-preview,
.card-state {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Painel de pré-visualização/resumo */
.preview-panel {
  background: var(--card-surface);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  min-height: 200px;
}

.preview-panel h2 {
  margin-top: 0;
}

/* Chips de tags associadas ao card */
.card-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.card-tags-row[hidden] {
  display: none;
}

.tag-pill {
  padding: 0.3rem 0.9rem;
  background: rgba(18, 32, 39, 0.1);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-strong);
}

.empty-state {
  font-weight: 500;
}

/* Página de criação/edição de cartas */
.page-editor {
  background: #f4f8f7;
  min-height: 100vh;
}

/* Container com colunas de formulários do editor */
.editor-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Avisos em destaque (ex.: carregamento, riscos) */
.warning-panel {
  background: #fff7dc;
  border-radius: var(--radius-md);
  padding: 1.5rem;
  border: 1px solid rgba(255, 179, 71, 0.4);
}

/* Grid responsivo que divide os painéis do editor */
.editor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

/* Cartão base usado para cada painel da tela */
.panel {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
}

/* Cabeçalho do painel com título e ações */
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

/* Botões rápidos de formatação */
.toolbar {
  display: flex;
  gap: 0.5rem;
}

.toolbar-btn {
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 0.4rem 0.8rem;
  background: var(--card-surface);
  cursor: pointer;
}

/* Formulário de conteúdo da carta */
.card-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

.card-form textarea,
.card-form input,
.card-form select,
.card-form .rich-input {
  width: 100%;
  border-radius: 18px;
  border: 1px solid var(--card-border);
  padding: 0.75rem 1rem;
  font-family: inherit;
}

.card-form .rich-input {
  background: #fff;
  min-height: 120px;
  white-space: pre-wrap;
  word-break: break-word;
  outline: none;
}

.card-form .rich-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 179, 164, 0.12);
}

.card-form .rich-input[data-placeholder]:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
}

.rich-input--lg {
  min-height: 170px;
}

.rich-input--md {
  min-height: 140px;
}

.rich-input--sm {
  min-height: 90px;
}

.option-input {
  width: 100%;
}

.option-row .option-input {
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
}

/* Campo de tags/níveis da carta */
.tags-fieldset {
  border-radius: var(--radius-md);
  border: 1px dashed var(--card-border);
  padding: 1rem;
}

.tag-levels {
  display: grid;
  gap: 0.75rem;
}

.tag-level input {
  border-radius: 12px;
}

/* Ações para anexar ou remover imagens */
.image-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.image-actions-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.format-toolbar {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  align-items: center;
  margin: 0.25rem 0 0.15rem;
}

.format-toolbar--secondary {
  margin-top: 0.35rem;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  font-weight: 600;
}

.code-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.9rem;
  min-height: 160px;
  resize: vertical;
}

.code-input--sm {
  min-height: 90px;
}

.option-text-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.format-btn {
  border: 1px solid var(--card-border);
  background: #fff;
  color: var(--text-main);
  border-radius: 8px;
  padding: 0.35rem 0.55rem;
  font-weight: 700;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1;
  min-width: 34px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.format-btn:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 14px rgba(0, 179, 164, 0.15);
  transform: translateY(-1px);
}

/* Listas dinâmicas para itens de ordenação */
.ordering-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Lista de pares para questões de associação */
.linking-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.linking-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.5rem;
}

.linking-row input {
  border-radius: 12px;
}

/* Alternativas na criação de questões de múltipla escolha */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

.option-row {
  display: grid;
  grid-template-columns: 28px minmax(240px, 1fr) auto;
  gap: 0.7rem;
  align-items: center;
}

.option-row input[type="text"],
.option-row textarea {
  border-radius: 12px;
  width: 100%;
  flex: 1 1 auto;
}

.option-row textarea {
  min-height: 90px;
  resize: vertical;
  padding: 0.65rem 0.75rem;
  font-family: inherit;
}

.option-row .code-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.option-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.option-row label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0;
  white-space: nowrap;
}

.option-row .pill-button.ghost {
  padding: 0.25rem 0.55rem;
  min-width: 0;
  font-size: 0.8rem;
  background: #f1f4f3;
  border: 1px solid var(--card-border);
  color: var(--text-muted);
}

.option-actions .icon-button {
  width: 30px;
  height: 30px;
  font-size: 0.9rem;
}

.ordering-item-row {
  display: flex;
  gap: 0.5rem;
}

.ordering-item-row input {
  flex: 1;
  border-radius: 12px;
}

/* Lista de cartas existentes no editor */
.cards-list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.cards-list li {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* Mensagens de status/sucesso do formulário */
.form-status {
  margin-top: 0.5rem;
  font-weight: 600;
  color: var(--text-muted);
}
.form-status.success { color: var(--success); }
.form-status.error { color: var(--danger); }
.form-status.info { color: var(--text-main); }

.backup-panel {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.backup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.backup-url {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.backup-url input {
  flex: 1 1 260px;
  min-width: 220px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  padding: 0.45rem 0.6rem;
}

/* Painel de arrastar cartas por tag (organização manual) */
.arrange-container {
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.25rem;
  border: 1px dashed rgba(0,0,0,0.06);
  border-radius: 12px;
  background: #fff;
}
.arrange-preview {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem;
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(0,0,0,0.02), rgba(0,0,0,0.01));
  cursor: grab;
  user-select: none;
  transition: box-shadow 0.2s ease, background 0.2s ease, transform 0.2s ease, margin 0.15s ease, padding 0.15s ease, height 0.15s ease;
}
.arrange-preview .preview-index {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--accent-strong);
  font-size: 0.85rem;
  flex: 0 0 auto;
}
.arrange-preview .preview-body {
  flex: 1;
  min-width: 0;
}
.arrange-preview .preview-date {
  color: var(--text-muted);
  font-size: 0.82rem;
  flex: 0 0 auto;
}
.arrange-preview:focus-visible {
  outline: 2px solid rgba(0, 179, 164, 0.5);
}
.arrange-preview.is-selected {
  background: rgba(0, 179, 164, 0.08);
  box-shadow: 0 12px 28px rgba(0, 179, 164, 0.2);
}
.arrange-preview.is-locked {
  background: rgba(255, 199, 92, 0.12);
}
.arrange-preview.dragging {
  opacity: 0;
  margin: 0 !important;
  padding: 0 !important;
  border: 0;
  height: 0 !important;
  box-shadow: none;
  cursor: grabbing;
}
.arrange-preview .preview-title {
  font-weight: 700;
  font-size: 0.95rem;
}
.arrange-preview .preview-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
}
.arrange-detail {
  margin-top: 0.75rem;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  background: #fff;
  padding: 0.75rem;
}
.arrange-detail__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}
.arrange-detail__meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 0.6rem;
}
.arrange-detail__body {
  max-height: 260px;
  overflow: auto;
  padding-right: 0.25rem;
}
.arrange-detail__statement {
  font-weight: 600;
  margin-bottom: 0.6rem;
}
.arrange-detail__options {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.arrange-detail__option {
  display: flex;
  gap: 0.45rem;
  align-items: flex-start;
  font-size: 0.9rem;
}
.arrange-detail__option-letter {
  font-weight: 700;
  color: var(--accent-strong);
}
.arrange-detail__option.is-correct .arrange-detail__option-letter {
  color: var(--success);
}
.tag-lock-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(255, 255, 255, 0.7);
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.tag-lock-toggle input {
  accent-color: var(--accent);
}
.arrange-placeholder {
  border: 2px dashed var(--accent);
  border-radius: 10px;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-strong);
  font-weight: 600;
  letter-spacing: 0.02em;
  background: rgba(0, 179, 164, 0.08);
  animation: arrangePulse 1.2s ease-in-out infinite;
}

/* Animação que pisca o espaço reservado enquanto arrasta */
@keyframes arrangePulse {
  0% { opacity: 0.4; }
  50% { opacity: 1; }
  100% { opacity: 0.4; }
}

.cards-list button {
  align-self: flex-start;
}

/* Configuração da questão de completar imagem (edição no editor) */
.image-completion-config {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  border: 1px dashed var(--card-border);
  border-radius: var(--radius-md);
  background: #f9fbfa;
}

.image-completion-config[hidden] {
  display: none !important;
}

/* Lista de rótulos por lado da imagem */
.image-sides-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.image-side-row {
  display: grid;
  grid-template-columns: auto 90px 1fr auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  background: #fff;
}

.image-side-row input[type="text"] {
  flex: 1;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  padding: 0.35rem 0.6rem;
}

.side-label {
  min-width: 70px;
  font-weight: 600;
  color: var(--text-muted);
}

/* Campos extras para slots adicionais */
.image-extras {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.image-extra-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.image-extra-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
}

.image-extra-row input {
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 0.4rem 0.6rem;
}

@media (max-width: 640px) {
  .page-home .hero {
    display: none;
  }
  .home-main {
    padding: 1.1rem 0.9rem 2rem;
  }
  .deck-section {
    padding: 1rem;
  }
  .section-header {
    margin-bottom: 1rem;
  }
  .section-header .eyebrow {
    display: none;
  }
  .stats-legend {
    margin: 0 0 0.6rem 0;
  }
  /* Ajustes dos cards de deck para telas até 640px */
  .deck-card {
    padding: 0.5rem 0.65rem;
    gap: 0.2rem;
    font-size: 0.88rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 75px;
    align-items: center;
    column-gap: 0.6rem;
  }
  .deck-card .deck-title {
    font-size: 0.84rem;
  }
  .deck-card .deck-path {
    font-size: 0.6rem;
  }
  .deck-stats {
    gap: 0.12rem;
    flex-wrap: nowrap;
  }
  .deck-stats .stat {
    padding: 0.1rem 0.22rem;
    font-size: 0.66rem;
  }
  .deck-stats .stat-letter {
    width: 14px;
    height: 14px;
    line-height: 14px;
    font-size: 0.6rem;
  }
  .deck-card .pill-button {
    padding: 0.32rem 0.52rem;
    font-size: 0.72rem;
    white-space: nowrap;
  }
  .deck-card {
    padding-right: 0.65rem;
  }
  .deck-card .pill-button {
    margin-left: 0.1rem;
  }
  .deck-card__text {
    width: auto;
    max-width: 100%;
    padding-right: 0.95rem;
    border-right: 1px dashed rgba(0, 0, 0, 0.12);
    overflow: hidden;
  }
  .deck-card__text .deck-title,
  .deck-card__text .deck-path {
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .deck-card[data-depth="1"] .deck-card__text {
    border-right-color: rgba(255, 255, 255, 0.35);
  }
  .deck-card {
    flex-wrap: wrap;
    row-gap: 0.25rem;
  }
  .deck-card__text {
    flex: 1 1 0%;
    min-width: 0;
  }
  .deck-actions {
    flex: 0 0 auto;
    margin-left: auto;
    align-self: center;
    justify-content: flex-end;
    padding-top: 0;
    padding-left: 0.4rem;
    width: 75px;
    min-width: 75px;
  }
  .deck-actions .pill-button {
    width: 100%;
    justify-content: center;
  }
  .deck-open-btn.is-unlocked::after {
    display: none;
  }
  .deck-open-btn.is-unlocked {
    padding-right: 0.52rem;
  }
  .deck-open-btn.is-locked::after {
    display: none;
  }
  .deck-open-btn.is-locked {
    display: inline-flex;
    align-items: center;
    padding-right: 0.52rem;
    color: var(--text-muted);
  }
  .deck-actions .deck-menu-toggle {
    display: none;
  }
  .deck-menu {
    display: none !important;
  }
  .legend-table {
    gap: 0.22rem;
  }
  .legend-cell {
    font-size: 0.7rem;
    padding: 0.18rem 0.32rem;
  }
  .legend-dot {
    width: 16px;
    height: 16px;
    font-size: 0.64rem;
  }

  /* Compactação extra para telas menores que 480px */
  @media (max-width: 480px) {
    .deck-section {
      padding: 1.1rem 0.9rem;
      font-size: 0.92rem;
    }
    .deck-list {
      gap: 0.7rem;
    }
    .deck-group {
      border-radius: 12px;
    }
    .deck-card {
      padding: 0.55rem 0.65rem;
      gap: 0.25rem;
    }
    .deck-card .deck-title {
      font-size: 0.9rem;
    }
    .deck-card .deck-path {
      font-size: 0.68rem;
    }
    .deck-card .pill-button {
      padding: 0.4rem 0.65rem;
      font-size: 0.8rem;
    }
    .deck-card__text {
      width: auto;
    }
    .deck-stats {
      gap: 0.18rem;
    }
    .deck-stats .stat {
      padding: 0.14rem 0.32rem;
      font-size: 0.74rem;
    }
    .deck-stats .stat-letter {
      width: 16px;
      height: 16px;
      line-height: 16px;
      font-size: 0.7rem;
    }
    .legend-cell {
      font-size: 0.8rem;
      padding: 0.26rem 0.45rem;
    }
  }

  .deck-card-mb {
    margin-bottom: 0.85rem;
  }

  .deck-card-mb__header {
    padding: 0.8rem 0.85rem;
  }

  .deck-row-mb {
    padding: 0.55rem 0.75rem;
    grid-template-columns: 1fr auto auto;
  }

  .deck-row-mb__stats {
    gap: 0.2rem;
  }

  .deck-row-mb__action {
    font-size: 0.9rem;
  }
  .hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .deck-card {
    padding: 0.55rem 0.65rem;
    gap: 0.4rem;
    border-radius: 12px;
    min-height: auto;
    position: relative;
    flex-direction: row;
    align-items: center;
  }

  .deck-card__text {
    flex-direction: column;
    gap: 0.15rem;
    align-items: flex-start;
    text-align: left;
  }

  .deck-card .pill-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 0.75rem;
    width: auto;
    height: auto;
    min-width: 0;
    border-radius: 10px;
    position: static;
    margin-left: auto;
    font-size: 0.9rem;
  }

  .deck-card.has-children::after {
    left: 0.55rem;
    right: auto;
    top: 50%;
    transform: translateY(-50%) rotate(0deg);
  }

  .deck-card.has-children[data-expanded="true"]::after {
    transform: translateY(-50%) rotate(90deg);
  }

  .study-card {
    width: 100%;
  }

  .answer-actions {
    flex-direction: column;
    align-items: center;
  }

  .image-completion-board {
    max-width: 280px;
    width: 90%;
  }

  .image-slot {
    min-width: 80px;
    max-width: 100px;
    padding: 0.2rem 0.45rem;
    font-size: 0.9rem;
    line-height: 1.2;
  }

  .image-slot.pos-right {
    right: -6%;
    transform: translate(30%, -50%);
  }

  .image-slot.pos-left {
    left: -6%;
    transform: translate(-30%, -50%);
  }

  .image-slot.pos-top {
    top: -8%;
    transform: translate(-50%, -30%);
  }

  .image-slot.pos-bottom {
    bottom: -8%;
    transform: translate(-50%, 30%);
  }

  .deck-section {
    padding: 0.9rem;
    gap: 0.75rem;
  }

  .legend-table {
    gap: 0.6rem;
    font-size: 0.92rem;
    padding: 0.1rem 0;
  }

  .deck-card {
    padding: 0.6rem 0.75rem;
    gap: 0.4rem;
    border-radius: 13px;
    min-height: auto;
    position: relative;
    flex-direction: row;
    align-items: center;
  }

  .deck-card .deck-title {
    font-size: 0.98rem;
    letter-spacing: 0.01em;
    margin-bottom: 0;
  }

  .deck-card .deck-path {
    font-size: 0.75rem;
    letter-spacing: 0.02em;
    opacity: 0.7;
  }

  .deck-children {
    margin-left: 1rem;
    padding-left: 0.75rem;
    gap: 0.75rem;
  }

  .deck-list {
    gap: 0.8rem;
  }

  .deck-stats {
    gap: 0.25rem;
    font-size: 0.78rem;
    margin-top: 0;
  }

  .deck-stats .stat {
    padding: 0.2rem 0.45rem;
    border-radius: 10px;
  }

  .deck-stats .stat-letter {
    width: 20px;
    height: 20px;
    line-height: 20px;
    font-size: 0.8rem;
  }

  .deck-card .pill-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 0.75rem;
    width: auto;
    height: auto;
    min-width: 0;
    border-radius: 12px;
    position: static;
    margin-left: auto;
    font-size: 0.9rem;
  }

  .deck-card__text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
  }

  .deck-card.has-children::after {
    left: 0.45rem;
    right: auto;
    top: 50%;
    transform: translateY(-50%) rotate(0deg);
  }

  .deck-card.has-children[data-expanded="true"]::after {
    transform: translateY(-50%) rotate(90deg);
  }

  .page-study .menu {
    left: 0;
    right: auto;
    min-width: 160px;
    max-width: calc(100vw - 2.5rem);
  }
}
/* Versão compacta dos decks para visualização mobile */
.deck-card-mb {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  margin-bottom: 1rem;
}

.deck-card-mb__header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  background: var(--bg-section);
  color: #fff;
}

.deck-card-mb__icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.deck-card-mb__title-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.deck-card-mb__title {
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.01em;
}

.deck-card-mb__subtitle {
  font-size: 0.82rem;
  opacity: 0.9;
}

.deck-row-mb__stats-header .deck-row-mb__stat {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.deck-row-mb__stats-header .deck-row-mb__stat-letter {
  color: #fff;
  background: rgba(255, 255, 255, 0.25);
}

.deck-row-mb__stats-header .deck-row-mb__stat-num {
  color: #fff;
}

.deck-card-mb__study {
  margin-left: auto;
  background: #fff;
  color: var(--accent-strong);
  border: none;
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.deck-card-mb__chevron {
  margin-left: 0.35rem;
  font-size: 1.1rem;
  transform: rotate(0deg);
  transition: transform 0.2s ease;
  font-weight: 700;
}

.deck-card-mb__chevron.expanded {
  transform: rotate(90deg);
}

.deck-card-mb__body {
  background: #fff;
  display: flex;
  flex-direction: column;
}

.deck-card-mb__body.collapsed {
  display: none;
}

.deck-row-mb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid #e9efed;
}

.deck-row-mb:last-child {
  border-bottom: none;
}

.deck-row-mb__left {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1;
  min-width: 0;
}

.deck-row-mb__title {
  font-weight: 700;
  color: var(--text-main);
  font-size: 0.96rem;
}

.deck-row-mb__content {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.deck-row-mb__stats {
  display: inline-flex;
  gap: 0.25rem;
  font-weight: 700;
  align-items: center;
}

.deck-row-mb__stats-row {
  display: inline-flex;
}

.deck-row-mb__stat {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 10px;
  padding: 0.15rem 0.4rem;
  background: rgba(0, 0, 0, 0.04);
}

.deck-row-mb__stat-letter {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  text-align: center;
  line-height: 18px;
  color: #fff;
  font-size: 0.78rem;
}

.deck-row-mb__stat-num {
  font-size: 0.9rem;
  color: var(--text-main);
}

.deck-row-mb__stat-n .deck-row-mb__stat-letter {
  background: var(--badge-blue);
}

.deck-row-mb__stat-a .deck-row-mb__stat-letter {
  background: var(--success);
}

.deck-row-mb__stat-r .deck-row-mb__stat-letter {
  background: var(--danger);
}

.deck-row-mb__action {
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 0.35rem 0.7rem;
  font-weight: 700;
  color: var(--accent-strong);
  cursor: pointer;
}

.deck-row-mb__chevron {
  width: 12px;
  display: inline-flex;
  justify-content: center;
  color: var(--text-muted);
  transform: rotate(0deg);
  transition: transform 0.2s ease;
  font-weight: 700;
}

.deck-row-mb__chevron.expanded {
  transform: rotate(90deg);
}

.deck-row-mb__children {
  padding-left: 1rem;
}

/* Mobile/tela reduzida - bloco consolidado */
@media (max-width: 900px) {
  .deck-children { margin-left: 0; padding-left: 0; }
  .deck-card[data-depth="2"],
  .deck-card[data-depth="3"] { padding-left: 1rem; }
  .deck-card[data-depth="4"] { padding-left: 0.3rem; }
  .deck-card.has-children::after { left: 0.1rem; right: auto; }
}

@media (max-width: 640px) {
  .deck-children { margin-left: 0; padding-left: 0; border-left: none; }
  .deck-card {
    padding: 0.45rem 0.5rem 0.45rem 0.8rem;
    gap: 0.18rem;
    font-size: 0.82rem;
    position: relative;
  }
  .deck-card .deck-title { font-size: 0.8rem; }
  .deck-card .deck-path { font-size: 0.58rem; }
  .deck-card[data-depth="2"],
  .deck-card[data-depth="3"] { padding-left: 2rem; }
  .deck-card[data-depth="4"] { padding-left: 0.3rem; }
  .deck-card.has-children::after { left: 0.15rem; right: auto; }
  .deck-card .pill-button {
    position: absolute;
    right: 0.2rem;
    top: 50%;
    transform: translateY(-50%);
    padding: 0.3rem 0.5rem;
    font-size: 0.7rem;
  }
  .deck-card__text { width: auto; }
  .deck-stats { gap: 0.14rem; flex-wrap: nowrap; }
  .deck-stats .stat { padding: 0.1rem 0.24rem; font-size: 0.66rem; }
  .deck-stats .stat-letter { width: 13px; height: 13px; line-height: 13px; font-size: 0.6rem; }
  .deck-stats .stat-count { font-size: 0.68rem; }
  .legend-table { gap: 0.3rem; flex-wrap: nowrap; }
  .legend-cell { font-size: 0.7rem; padding: 0.18rem 0.3rem; white-space: nowrap; }
  .legend-dot { width: 15px; height: 15px; font-size: 0.6rem; }
}

@media (max-width: 480px) {
  .deck-children { margin-left: 0; padding-left: 0; }
  .deck-card {
    padding: 0.38rem 0.45rem 0.38rem 0.65rem;
    gap: 0.14rem;
    font-size: 0.78rem;
  }
  .deck-card .deck-title { font-size: 0.72rem; }
  .deck-card .deck-path { font-size: 0.52rem; }
  .deck-card[data-depth="2"],
  .deck-card[data-depth="3"] { padding-left: 1.9rem; }
  .deck-card[data-depth="4"] { padding-left: 0.3rem; }
  .deck-card.has-children::after { left: 0.15rem; right: auto; }
  .deck-card .pill-button {
    right: 0.15rem;
    padding: 0.26rem 0.42rem;
    font-size: 0.64rem;
  }
  .deck-card__text { width: auto; }
  .deck-stats .stat { padding: 0.08rem 0.18rem; font-size: 0.6rem; }
  .deck-stats .stat-letter { width: 12px; height: 12px; line-height: 12px; font-size: 0.54rem; }
  .deck-stats .stat-count { font-size: 0.6rem; }
  .legend-table { gap: 0.24rem; }
  .legend-cell { font-size: 0.64rem; padding: 0.14rem 0.24rem; }
  .legend-dot { width: 14px; height: 14px; font-size: 0.56rem; }
}
