/* =========================================================================
   SPELLWISE — style.css
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;600;700&family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  /* Cores base */
  --bg: #08080f;
  --bg-soft: #0c0c17;
  --surface: #12111f;
  --surface-2: #17162a;
  --surface-3: #1d1c33;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  --text: #f3f1fa;
  --text-muted: #a9a4c4;
  --text-dim: #726d94;

  /* Acentos */
  --purple: #8b5cf6;
  --blue: #4f8dff;
  --gradient: linear-gradient(135deg, #9163f7 0%, #4f8dff 100%);
  --gold: #f2a93b;
  --gold-soft: #f5c451;
  --danger: #ef5a6f;

  /* Escolas de magia */
  --school-abjuracao: #4f8dff;
  --school-adivinhacao: #34c3c3;
  --school-conjuracao: #4caf6d;
  --school-encantamento: #ef6fa8;
  --school-evocacao: #f2593b;
  --school-ilusao: #a874f5;
  --school-necromancia: #6fae83;
  --school-transmutacao: #f2c14e;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-glow: 0 0 0 1px rgba(139, 92, 246, 0.15), 0 20px 60px -20px rgba(79, 141, 255, 0.35);

  --font-display: 'Cinzel', 'Georgia', serif;
  --font-body: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
ul { list-style: none; margin: 0; padding: 0; }

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 32px;
}

/* -------------------------------------------------------------------------
   Background ambiance (glow radial sutil, tema arcano)
------------------------------------------------------------------------- */
body.page-landing,
body.page-login {
  background:
    radial-gradient(700px 420px at 12% -5%, rgba(139, 92, 246, 0.16), transparent 60%),
    radial-gradient(800px 500px at 90% 10%, rgba(79, 141, 255, 0.12), transparent 60%),
    var(--bg);
}

/* =========================================================================
   NAVBAR (landing)
   ========================================================================= */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 0.3px;
}
.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.brand-mark svg { width: 18px; height: 18px; }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.brand-wise { color: var(--gold-soft); font-weight: 700; }

.navbar-links {
  display: flex;
  align-items: center;
  gap: 32px;
  font-size: 14px;
  color: var(--text-muted);
}
.navbar-links a:hover { color: var(--text); }

.navbar-actions { display: flex; align-items: center; gap: 20px; }
.link-btn { font-size: 14px; color: var(--text-muted); }
.link-btn:hover { color: var(--text); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  border-radius: 10px;
  border: none;
  padding: 12px 22px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 10px 30px -10px rgba(139, 92, 246, 0.55);
}
.btn-primary:hover { box-shadow: 0 14px 34px -8px rgba(139, 92, 246, 0.7); }
.btn-primary svg { width: 15px; height: 15px; }
.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
}
.btn-secondary:hover { background: var(--surface-3); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--border-strong); }
.btn-block { width: 100%; }
.btn.is-loading { opacity: 0.7; pointer-events: none; }

/* =========================================================================
   HERO
   ========================================================================= */
.hero {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 56px;
  align-items: center;
  padding: 56px 0 96px;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--purple);
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.3);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 22px;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: 46px;
  line-height: 1.18;
  letter-spacing: 0.2px;
  margin: 0 0 20px;
  text-transform: uppercase;
}
.text-gradient {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.text-gold { color: var(--gold-soft); }

.hero-desc {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-muted);
  max-width: 460px;
  margin: 0 0 32px;
}
.hero-actions { display: flex; gap: 14px; margin-bottom: 28px; }
.hero-stats {
  display: flex;
  gap: 24px;
  font-size: 13px;
  color: var(--text-dim);
}
.hero-stats span { display: flex; align-items: center; gap: 7px; }
.hero-stats .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--gold-soft); }

.hero-art {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 16 / 11;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-glow);
}
.hero-art img { width: 100%; height: 100%; object-fit: cover; }
.hero-art::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(8, 8, 15, 0.5));
}

/* =========================================================================
   SECTIONS gerais
   ========================================================================= */
.section { padding: 88px 0; border-top: 1px solid var(--border); }
.section-head { text-align: center; max-width: 620px; margin: 0 auto 56px; }
.section-eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 14px;
}
.section-head h2 {
  font-family: var(--font-display);
  font-size: 30px;
  text-transform: uppercase;
  margin: 0 0 14px;
  line-height: 1.35;
}
.section-head p { color: var(--text-muted); font-size: 15px; line-height: 1.6; }

/* Recursos */
.features-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 26px 22px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.feature-card:hover { border-color: var(--border-strong); transform: translateY(-3px); }
.feature-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--gradient);
  display: grid;
  place-items: center;
  color: #fff;
  margin-bottom: 18px;
}
.feature-icon svg { width: 18px; height: 18px; }
.feature-card h3 { font-size: 15px; margin: 0 0 8px; font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.3px; }
.feature-card p { font-size: 13.5px; color: var(--text-muted); line-height: 1.6; margin: 0; }

/* Como funciona */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}
.step-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 28px 24px;
}
.step-number {
  font-family: var(--font-display);
  font-size: 30px;
  color: var(--gold-soft);
  margin-bottom: 14px;
}
.step-card h3 { font-size: 15px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: 0.3px; }
.step-card p { font-size: 13.5px; color: var(--text-muted); line-height: 1.6; margin: 0; }

.steps-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
}
.steps-cta svg { width: 20px; height: 20px; color: var(--gold-soft); flex-shrink: 0; }

/* FAQ */
.faq-list { max-width: 720px; margin: 0 auto; }
.faq-item { border-bottom: 1px solid var(--border); }
.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 4px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
}
.faq-question svg { width: 16px; height: 16px; color: var(--text-dim); transition: transform 0.2s ease; flex-shrink: 0; }
.faq-item.is-open .faq-question svg { transform: rotate(180deg); color: var(--purple); }
.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease, padding 0.25s ease;
  color: var(--text-muted);
  font-size: 13.5px;
  line-height: 1.7;
  padding: 0 4px;
}
.faq-item.is-open .faq-answer { max-height: 220px; padding: 0 4px 20px; }

/* CTA final */
.cta-panel {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.14), rgba(79, 141, 255, 0.1));
  border: 1px solid rgba(139, 92, 246, 0.28);
  border-radius: var(--radius-lg);
  text-align: center;
  padding: 56px 40px;
}
.cta-panel h2 { font-family: var(--font-display); font-size: 26px; text-transform: uppercase; margin: 0 0 14px; }
.cta-panel p { color: var(--text-muted); font-size: 14.5px; margin: 0 0 26px; }

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-dim);
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px 36px;
  text-align: center;
  padding: 32px 0;
}
.footer-links { display: flex; gap: 22px; }
.footer-links a:hover { color: var(--text-muted); }

/* =========================================================================
   LOGIN PAGE
   ========================================================================= */
.login-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}
.login-brand { margin-bottom: 28px; }
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-glow);
}
.login-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 22px;
}
.login-tab {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-weight: 700;
  font-size: 13.5px;
  padding: 9px 0;
  border-radius: 7px;
  transition: background 0.15s ease, color 0.15s ease;
}
.login-tab.is-active { background: var(--surface-3); color: var(--text); }

.field { margin-bottom: 16px; }
.field-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.field label { font-size: 13px; font-weight: 700; color: var(--text); }
.field-link { font-size: 12px; color: var(--purple); }
.field input {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  padding: 11px 13px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-body);
}
.field input:focus { outline: none; border-color: var(--purple); }

.field-error { display: block; font-size: 11.5px; color: var(--danger); margin-top: 6px; }

.password-rules { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.password-rules li {
  font-size: 11.5px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}
.password-rules li::before { content: "✕"; color: var(--danger); font-size: 10px; width: 12px; text-align: center; }
.password-rules li.is-valid { color: var(--text-muted); }
.password-rules li.is-valid::before { content: "✓"; color: var(--gold-soft); }

.login-terms {
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 20px;
}
.login-terms a { color: var(--text-muted); text-decoration: underline; }

/* =========================================================================
   APP SHELL
   ========================================================================= */
body.page-app {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  transition: width 0.2s ease;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 20;
}
.sidebar.is-collapsed { width: 76px; }
.sidebar.is-collapsed .nav-label,
.sidebar.is-collapsed .nav-link span,
.sidebar.is-collapsed .user-details,
.sidebar.is-collapsed .logout-link span,
.sidebar.is-collapsed .brand-text {
  display: none;
}
.sidebar.is-collapsed .nav-link,
.sidebar.is-collapsed .user-row,
.sidebar.is-collapsed .logout-link,
.sidebar.is-collapsed .sidebar-brand {
  justify-content: center;
  gap: 0;
  padding-left: 0;
  padding-right: 0;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  padding: 8px 10px 22px;
}

.nav-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 6px 10px 8px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 10px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.nav-link svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.is-active { background: var(--surface-3); color: var(--text); box-shadow: inset 2px 0 0 var(--purple); }

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 9px;
}
.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--gradient);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}
.user-details { display: flex; flex-direction: column; overflow: hidden; }
.user-name { font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px;
  font-size: 13px;
  color: var(--text-dim);
  border: none;
  background: none;
  width: 100%;
}
.logout-link:hover { color: var(--danger); }
.logout-link svg { width: 16px; height: 16px; }

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  margin-left: 240px;
  transition: margin-left 0.2s ease;
}
.sidebar.is-collapsed ~ .app-main { margin-left: 76px; }
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 44px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}
.sidebar-toggle-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 7px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: var(--text-muted);
}
.sidebar-toggle-btn svg { width: 15px; height: 15px; }
.sidebar-toggle-btn:hover { color: var(--text); border-color: var(--border-strong); }

.view-content { flex: 1; padding: 44px 44px 70px; max-width: 1120px; width: 100%; }
.view { display: none; }
.view.is-active { display: block; }

.view-eyebrow {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--purple);
  margin-bottom: 14px;
}
.view-eyebrow-icon { margin-right: 7px; }
.view h1 {
  font-family: var(--font-display);
  font-size: 28px;
  text-transform: uppercase;
  margin: 0 0 10px;
}
.view-subtitle { color: var(--text-muted); font-size: 14px; margin: 0 0 28px; }

/* Recommend form panel */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-glow);
  margin-bottom: 36px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr) auto;
  gap: 16px;
  align-items: end;
}
.form-field label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.form-field select {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 11px 12px;
  border-radius: 9px;
  font-size: 13.5px;
  font-family: var(--font-body);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a9a4c4' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 15px;
}
.form-field select:focus { outline: none; border-color: var(--purple); }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
  font-size: 13.5px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
}

.results-grid { display: grid; gap: 16px; }

/* Search/filter bar for grimório */
.filter-bar {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 26px;
}
.search-field {
  position: relative;
  display: flex;
  align-items: center;
}
.search-field svg {
  position: absolute;
  left: 13px;
  width: 15px;
  height: 15px;
  color: var(--text-dim);
}
.search-field input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 10px 12px 10px 36px;
  border-radius: 9px;
  font-size: 13.5px;
  font-family: var(--font-body);
}
.search-field input:focus { outline: none; border-color: var(--purple); }
.filter-bar select {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 9px;
  font-size: 13.5px;
  font-family: var(--font-body);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a9a4c4' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
}
.filter-bar select:focus { outline: none; border-color: var(--purple); }

.grimorio-grid, .results-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }

/* =========================================================================
   SPELL CARD — inspirado em cards de magia de mesa (index cards / stat blocks)
   ========================================================================= */
.spell-card {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  align-self: start;
}
.spell-card:hover { border-color: var(--border-strong); }
.spell-card.is-expanded { box-shadow: var(--shadow-glow); }

.spell-card-strip {
  width: 5px;
  flex-shrink: 0;
  background: var(--school-abjuracao);
}
.spell-card[data-school="abjuracao"] .spell-card-strip { background: var(--school-abjuracao); }
.spell-card[data-school="adivinhacao"] .spell-card-strip { background: var(--school-adivinhacao); }
.spell-card[data-school="conjuracao"] .spell-card-strip { background: var(--school-conjuracao); }
.spell-card[data-school="encantamento"] .spell-card-strip { background: var(--school-encantamento); }
.spell-card[data-school="evocacao"] .spell-card-strip { background: var(--school-evocacao); }
.spell-card[data-school="ilusao"] .spell-card-strip { background: var(--school-ilusao); }
.spell-card[data-school="necromancia"] .spell-card-strip { background: var(--school-necromancia); }
.spell-card[data-school="transmutacao"] .spell-card-strip { background: var(--school-transmutacao); }

.spell-card-body { flex: 1; min-width: 0; padding: 16px 16px 16px 14px; }

.spell-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
}
.spell-card-titles { min-width: 0; }
.spell-name {
  font-family: var(--font-display);
  font-size: 16px;
  margin: 0 0 5px;
  letter-spacing: 0.2px;
}
.spell-school-tag { font-size: 11.5px; color: var(--text-dim); }

.spell-card-header-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.spell-level-badge {
  font-size: 11px;
  font-weight: 800;
  color: var(--gold-soft);
  background: rgba(242, 169, 59, 0.12);
  border: 1px solid rgba(242, 169, 59, 0.3);
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text-dim);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}
.icon-btn svg { width: 14px; height: 14px; }
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }

.star-btn.is-active { color: var(--gold-soft); border-color: rgba(242, 169, 59, 0.4); background: rgba(242, 169, 59, 0.1); }
.star-btn.pop { transform: scale(1.22); }

.glow-btn { color: var(--purple); }
.glow-btn:hover { color: #fff; background: var(--gradient); border-color: transparent; }
.glow-btn.is-loading { color: #fff; background: var(--gradient); border-color: transparent; animation: pulse-glow 1s ease-in-out infinite; }
@keyframes pulse-glow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.chevron-btn svg { transition: transform 0.2s ease; }
.spell-card.is-expanded .chevron-btn svg { transform: rotate(180deg); }

.spell-card-details {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.28s ease;
}
.spell-card.is-expanded .spell-card-details {
  max-height: 600px;
  overflow-y: auto;
  padding-right: 4px; /* evita o texto colar na barra de scroll */
}
.spell-card-details::-webkit-scrollbar { width: 6px; }
.spell-card-details::-webkit-scrollbar-track { background: transparent; }
.spell-card-details::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; }

.spell-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 16px 0 14px;
  padding: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 9px;
}
.spell-stats dt { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); margin: 0 0 3px; }
.spell-stats dd { font-size: 12px; font-weight: 700; margin: 0; color: var(--text); }

.spell-desc { font-size: 13px; line-height: 1.7; color: var(--text-muted); margin: 0 0 10px; }
.spell-material,
.spell-higher-level {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-muted);
  margin: 0 0 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.03);
  border-left: 2px solid var(--gold-soft);
  border-radius: 4px;
}
.spell-material strong,
.spell-higher-level strong { color: var(--text); }
.spell-classes { font-size: 12px; color: var(--text-dim); margin: 0 0 4px; }
.spell-classes strong { color: var(--text-muted); }

.spell-ai-panel {
  margin-top: 14px;
  padding: 14px;
  border-radius: 9px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(79, 141, 255, 0.06));
  border: 1px solid rgba(139, 92, 246, 0.25);
}
.spell-ai-loading { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-muted); }
.spell-ai-loading-label { margin-left: 2px; }
.spell-ai-loading .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--purple);
  animation: blink 1.1s infinite ease-in-out;
}
.spell-ai-loading .dot:nth-child(2) { animation-delay: 0.15s; }
.spell-ai-loading .dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

.spell-ai-text { font-size: 13px; line-height: 1.7; color: var(--text); margin: 0; }

/* Favorites list */
.favorites-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.favorite-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.favorite-row.is-removing { opacity: 0; transform: translateX(8px); }
.favorite-strip {
  width: 4px;
  align-self: stretch;
  border-radius: 4px;
  flex-shrink: 0;
}
.favorite-row[data-school="abjuracao"] .favorite-strip { background: var(--school-abjuracao); }
.favorite-row[data-school="adivinhacao"] .favorite-strip { background: var(--school-adivinhacao); }
.favorite-row[data-school="conjuracao"] .favorite-strip { background: var(--school-conjuracao); }
.favorite-row[data-school="encantamento"] .favorite-strip { background: var(--school-encantamento); }
.favorite-row[data-school="evocacao"] .favorite-strip { background: var(--school-evocacao); }
.favorite-row[data-school="ilusao"] .favorite-strip { background: var(--school-ilusao); }
.favorite-row[data-school="necromancia"] .favorite-strip { background: var(--school-necromancia); }
.favorite-row[data-school="transmutacao"] .favorite-strip { background: var(--school-transmutacao); }
.favorite-name { font-family: var(--font-display); font-size: 14.5px; flex: 1; }
.favorite-school-tag { font-size: 12px; color: var(--text-dim); background: var(--bg-soft); border: 1px solid var(--border); padding: 4px 10px; border-radius: 999px; }
.trash-btn:hover { color: var(--danger); border-color: rgba(239, 90, 111, 0.4); background: rgba(239, 90, 111, 0.1); }

/* =========================================================================
   MODAL — usado nos Termos de Uso
   ========================================================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop[hidden] { display: none; }
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  max-width: 560px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.6);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
}
.modal-header h2 { font-size: 16px; margin: 0; }
.modal-body { padding: 18px 22px 26px; font-size: 13px; line-height: 1.7; color: var(--text-muted); }
.modal-body h3 { font-size: 13.5px; color: var(--text); margin: 18px 0 6px; }
.modal-box-small { max-width: 380px; }
.modal-body h3:first-child { margin-top: 0; }
.modal-body p { margin: 0 0 10px; }
.esqueci-senha-feedback { font-size: 12.5px; margin: 12px 0 0; padding: 10px 12px; border-radius: 8px; }
.esqueci-senha-feedback.is-success { background: rgba(242, 169, 59, 0.12); color: var(--gold-soft); border: 1px solid rgba(242, 169, 59, 0.3); }
.esqueci-senha-feedback.is-error { background: rgba(239, 68, 68, 0.1); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.3); }

/* =========================================================================
   TOAST — notificações rápidas no canto da tela
   ========================================================================= */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: 0 14px 34px -8px rgba(0, 0, 0, 0.5);
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  max-width: 300px;
}
.toast.is-visible { transform: translateX(0); opacity: 1; }
.toast-success { border-color: rgba(242, 169, 59, 0.4); }
.toast-success::before { content: "★ "; color: var(--gold-soft); }
.toast-error { border-color: rgba(239, 68, 68, 0.4); }
.toast-error::before { content: "⚠ "; color: var(--danger); }

/* =========================================================================
   RESPONSIVE
   Tablet:  <= 1024px  (iPads e Android tablets em geral)
   Celular: <= 600px   (praticamente todos os smartphones, portrait)
   ========================================================================= */

/* ---------- TABLET ---------- */
@media (max-width: 1024px) {
  .container { padding: 0 24px; }

  /* Landing */
  .hero { grid-template-columns: 1fr; text-align: center; }
  .hero-art { order: -1; margin-bottom: 12px; }
  .hero-desc { max-width: none; margin-left: auto; margin-right: auto; }
  .hero-actions { justify-content: center; }
  .hero-stats { justify-content: center; flex-wrap: wrap; }
  .features-grid { grid-template-columns: repeat(2, 1fr); }
  .steps-grid { grid-template-columns: 1fr; }
  .navbar-links { gap: 18px; }

  /* App shell */
  .sidebar:not(.is-collapsed) { width: 200px; }
  .app-main { margin-left: 200px; }
  .sidebar.is-collapsed ~ .app-main { margin-left: 76px; }
  .view-content { padding: 36px 28px 60px; }

  /* Formulários e filtros */
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-grid > .btn { grid-column: 1 / -1; }
  .filter-bar { grid-template-columns: 1fr 1fr; }

  /* Grades de cards */
  .grimorio-grid, .results-grid { grid-template-columns: 1fr; }
  .favorites-list { grid-template-columns: 1fr; }
}

/* ---------- CELULAR ---------- */
@media (max-width: 600px) {
  .container { padding: 0 18px; }

  /* Navbar / topbar */
  .navbar { padding: 14px 0; }
  .navbar-links { display: none; }
  .navbar-actions { gap: 12px; }
  .topbar { padding: 14px 16px; flex-wrap: wrap; gap: 10px; }

  /* Hero */
  .hero h1 { font-size: 28px; }
  .hero-desc { font-size: 14px; }
  .hero-actions { flex-direction: column; width: 100%; }
  .hero-actions .btn { width: 100%; justify-content: center; }
  .hero-stats { gap: 10px 16px; font-size: 12.5px; }

  /* Seções gerais */
  .section { padding: 56px 0; }
  .section-head h2 { font-size: 24px; }
  .features-grid { grid-template-columns: 1fr; }
  .cta-panel { padding: 32px 20px; }
  .cta-panel h2 { font-size: 21px; }
  .footer-inner { flex-direction: column; gap: 14px; text-align: center; }
  .footer-links { flex-wrap: wrap; justify-content: center; }

  /* Login / Cadastro */
  .login-wrap { padding: 24px 16px; }
  .login-card { max-width: 100%; padding: 24px 20px; }

  /* Notificações */
  .toast-container { left: 16px; right: 16px; top: 16px; }
  .toast { max-width: none; }

  /* App shell */
  body.mobile-nav-open { overflow: hidden; }
  .sidebar {
    position: fixed;
    z-index: 30;
    height: 100vh;
    left: 0;
    top: 0;
    width: 260px;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .sidebar.is-collapsed { width: 260px; } /* no celular, o menu é sempre "cheio" quando aberto */
  body.mobile-nav-open .sidebar { transform: translateX(0); }
  .app-main, .sidebar.is-collapsed ~ .app-main { margin-left: 0; }

  .mobile-nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 25;
  }
  body.mobile-nav-open .mobile-nav-backdrop { display: block; }

  .view-content { padding: 26px 16px 50px; }
  .view h1 { font-size: 22px; }
  .panel { padding: 18px; }

  /* Formulários e filtros */
  .form-grid { grid-template-columns: 1fr; }
  .filter-bar { grid-template-columns: 1fr; }

  /* Cards de magia */
  .grimorio-grid, .results-grid, .favorites-list { grid-template-columns: 1fr; }
  .spell-card-header { flex-wrap: wrap; }
  .spell-card-header-right { flex-wrap: wrap; justify-content: flex-end; }
  .spell-stats { grid-template-columns: repeat(2, 1fr); }
  .spell-name { font-size: 15px; }
}