@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Public+Sans:wght@400;500;600;700&family=Caveat:wght@600;700&display=swap");

:root {
  /* Le cahier de la Tota — cuaderno francés, tinta azul, mariposa */
  --paper: #fcfbf6;
  --paper-2: #f4f1e6;
  --surface: #ffffff;
  --ink: #232c47; /* azul tinta oscuro */
  --ink-soft: #5a6486;
  --muted: #6b7088;
  --blue: #3551c9; /* lápiz azul (notas) */
  --blue-soft: #e7ebfb;
  --seyes: rgba(120, 110, 190, 0.13); /* línea violeta de cuaderno */
  --line: #e7e2d4;
  --coral: #e8654e; /* mariposa / acento */
  --coral-soft: #fbe4dd;
  --leaf: #6f9f4f; /* oruga */
  --leaf-soft: #e6efd9;
  --gold: #d99a2b;
  --gold-soft: #f6ead0;
  --good: #2f8a52;
  --good-soft: #def0e1;
  --almost: #b9791a;
  --almost-soft: #f7ecd4;
  --wrong: #c9483b;
  --wrong-soft: #f8e1dd;
  --shadow: 0 14px 38px rgba(35, 44, 71, 0.12);
  --shadow-sm: 0 3px 12px rgba(35, 44, 71, 0.07);
  --radius: 18px;
  --display: "Fraunces", Georgia, serif;
  --body: "Public Sans", system-ui, -apple-system, sans-serif;
  --hand: "Caveat", "Public Sans", cursive;
}

* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html,
body {
  margin: 0;
  padding: 0;
}
body {
  font-family: var(--body);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  /* papel con grilla Seyès tenue */
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--seyes) 1px, transparent 1px),
    linear-gradient(90deg, rgba(200, 90, 80, 0.06) 1px, transparent 1px);
  background-size:
    100% 30px,
    30px 100%;
}

::selection {
  background: var(--blue-soft);
}

/* ---------------- navbar ---------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px clamp(16px, 4vw, 30px);
  background: rgba(252, 251, 246, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.18rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}
.nav-brand svg {
  display: block;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav-links a {
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 8px 12px;
  border-radius: 10px;
}
.nav-links a:hover {
  background: var(--paper-2);
  color: var(--ink);
}
.nav-links a.on {
  color: var(--blue);
  background: var(--blue-soft);
}
.nav-links a.ext::after {
  content: " ↗";
  font-size: 0.75em;
  opacity: 0.6;
}
.nav-burger {
  display: none;
  background: transparent;
  color: var(--ink);
  padding: 6px 10px;
  font-size: 1.3rem;
}
@media (max-width: 560px) {
  .nav-links {
    position: absolute;
    top: 100%;
    right: 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 8px;
    box-shadow: var(--shadow);
    min-width: 170px;
    display: none;
  }
  .nav-links.open {
    display: flex;
  }
  .nav-burger {
    display: block;
  }
}

/* ---------------- layout ---------------- */
.app {
  max-width: 640px;
  margin: 0 auto;
  padding: 22px 18px calc(env(safe-area-inset-bottom) + 30px);
  display: flex;
  flex-direction: column;
  flex: 1;
}
.guia {
  max-width: 740px;
}
body {
  display: flex;
  flex-direction: column;
}

/* ---------------- footer ---------------- */
.site-foot {
  margin-top: auto;
  text-align: center;
  padding: 22px 16px calc(env(safe-area-inset-bottom) + 22px);
  color: var(--muted);
  font-size: 0.86rem;
  border-top: 1px solid var(--line);
}
.site-foot .heart {
  font-family: var(--hand);
  font-size: 1.2rem;
  color: var(--blue);
}

/* ---------------- type ---------------- */
h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.85rem;
  letter-spacing: -0.02em;
  line-height: 1.12;
  margin: 6px 0 6px;
}
.lede {
  color: var(--muted);
  margin: 0 0 22px;
  font-size: 1.02rem;
}

/* ---------------- buttons ---------------- */
button,
.btn {
  font-family: var(--body);
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 13px;
  padding: 13px 18px;
  cursor: pointer;
  transition:
    transform 0.06s ease,
    filter 0.15s ease,
    background 0.15s ease;
  color: #fff;
  background: var(--blue);
}
button:active,
.btn:active {
  transform: translateY(1px) scale(0.99);
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
.btn-primary {
  width: 100%;
  padding: 16px;
  font-size: 1.05rem;
  background: var(--blue);
  box-shadow: 0 8px 18px rgba(53, 81, 201, 0.22);
}
.btn-coral {
  background: var(--coral);
  box-shadow: 0 8px 18px rgba(232, 101, 78, 0.22);
}
.btn-ghost {
  background: transparent;
  color: var(--blue);
  border: 1.5px solid var(--line);
}
.btn-ghost:hover {
  border-color: var(--blue);
}
.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.card-surface {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

/* ---------------- home / study ---------------- */
.screen {
  display: none;
  flex: 1;
  flex-direction: column;
}
.screen.active {
  display: flex;
}
.field {
  margin: 0 0 16px;
}
.field > label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.segmented {
  display: flex;
  gap: 5px;
  background: var(--paper-2);
  padding: 5px;
  border-radius: 13px;
}
.segmented button {
  flex: 1;
  background: transparent;
  color: var(--muted);
  padding: 10px 6px;
  font-size: 0.9rem;
  border-radius: 9px;
}
.segmented button.on {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
select {
  font-family: inherit;
  font-size: 1rem;
  width: 100%;
  padding: 13px 14px;
  border-radius: 13px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}
.method {
  margin-top: 18px;
  font-size: 0.92rem;
  color: var(--ink-soft);
  background: var(--blue-soft);
  border-radius: 14px;
  padding: 14px 16px;
}
.method b {
  color: var(--blue);
}

.progress-wrap {
  margin-bottom: 16px;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 7px;
  font-weight: 600;
}
.progress-meta b {
  color: var(--blue);
}
.bar {
  height: 9px;
  background: var(--paper-2);
  border-radius: 99px;
  overflow: hidden;
}
.bar > span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--leaf), var(--coral));
  border-radius: 99px;
  transition: width 0.4s ease;
}

.flashcard {
  flex: 1;
  min-height: 280px;
  perspective: 1500px;
  margin-bottom: 14px;
  cursor: pointer;
  user-select: none;
}
.flashcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: inherit;
  transition: transform 0.5s cubic-bezier(0.4, 0.1, 0.2, 1);
  transform-style: preserve-3d;
}
.flashcard.flipped .flashcard-inner {
  transform: rotateY(180deg);
}
.face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: safe center;
  text-align: center;
  overflow-y: auto;
}
.face::before {
  /* lomo de cuaderno */
  content: "";
  position: absolute;
  left: 22px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--coral-soft);
}
.face .role {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 800;
  color: var(--coral);
  margin-bottom: 14px;
}
.face .text {
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.face.back {
  transform: rotateY(180deg);
  background: var(--blue-soft);
  border-color: var(--blue-soft);
}
.face.back .text {
  font-family: var(--body);
  font-size: 1.12rem;
  font-weight: 500;
  line-height: 1.5;
}
.face .hint {
  position: absolute;
  bottom: 14px;
  font-size: 0.78rem;
  color: var(--muted);
}
.flashcard.no-hint .hint {
  display: none;
}
/* la mini-oruga solo aparece cuando reacciona (no tapa los botones) */
.mascota-mini .mascota-art {
  opacity: 0;
  transition: opacity 0.25s ease;
}
.mascota-mini.say .mascota-art {
  opacity: 1;
}

/* texto largo: achicar */
.face .text.long {
  font-size: 1.18rem;
}
.face.back .text.long {
  font-size: 0.98rem;
}

.controls {
  min-height: 56px;
}
.reveal-btn {
  width: 100%;
  background: var(--ink);
  padding: 16px;
  font-size: 1.04rem;
}
.grades {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 9px;
}
.grades button {
  flex-direction: column;
  padding: 12px 6px;
  font-size: 0.92rem;
  line-height: 1.15;
}
.grades .g-emoji {
  display: block;
  font-size: 1.2rem;
  margin-bottom: 3px;
}
.g-wrong {
  background: var(--wrong-soft);
  color: var(--wrong);
}
.g-almost {
  background: var(--almost-soft);
  color: var(--almost);
}
.g-good {
  background: var(--good-soft);
  color: var(--good);
}

/* opción múltiple */
.choices {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.choice {
  background: var(--surface);
  border: 1.5px solid var(--line);
  color: var(--ink);
  text-align: left;
  padding: 14px 16px;
  font-size: 0.98rem;
  font-weight: 500;
  line-height: 1.4;
}
.choice:hover {
  border-color: var(--blue);
}
.choice.correct {
  background: var(--good-soft);
  border-color: var(--good);
  color: var(--good);
}
.choice.wrong {
  background: var(--wrong-soft);
  border-color: var(--wrong);
  color: var(--wrong);
}

/* cloze (completar) */
.cloze {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cloze input {
  font-family: inherit;
  font-size: 1.05rem;
  width: 100%;
  padding: 14px 16px;
  border-radius: 13px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  text-align: center;
}
.cloze input:focus {
  outline: none;
  border-color: var(--blue);
}
.cloze input.ok {
  border-color: var(--good);
  background: var(--good-soft);
  color: var(--good);
  font-weight: 700;
}
.cloze input.bad {
  border-color: var(--wrong);
  background: var(--wrong-soft);
  color: var(--wrong);
  font-weight: 700;
}
/* selector de formato con 4 botones: que envuelva */
.segmented {
  flex-wrap: wrap;
}
.segmented button {
  flex: 1 1 28%;
}

/* cloze */
.cloze-q {
  font-family: var(--display);
  font-size: 1.25rem;
  line-height: 1.5;
  text-align: center;
}
.cloze-blank {
  display: inline-block;
  min-width: 70px;
  border-bottom: 2.5px dashed var(--coral);
  color: var(--coral);
  font-weight: 700;
}

.study-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 14px;
}
.study-foot button {
  background: transparent;
  color: var(--muted);
  padding: 8px 4px;
  font-size: 0.85rem;
  font-weight: 600;
}
.study-foot button:hover {
  color: var(--ink);
}
#undo-btn {
  color: var(--blue);
}

/* done / empty */
.center-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
}
.center-screen h1 {
  margin: 0;
}
.center-screen p {
  color: var(--muted);
  margin: 4px 0 22px;
  max-width: 340px;
}
.center-screen .btn-row {
  width: 100%;
  max-width: 340px;
  flex-direction: column;
}

/* ---------------- mascota ---------------- */
.mascota {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin: 4px 0 18px;
}
.mascota-art {
  flex-shrink: 0;
  width: 88px;
  height: 88px;
}
.mascota-art svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}
.mascota-bubble {
  position: relative;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 11px 15px;
  font-family: var(--hand);
  font-size: 1.28rem;
  line-height: 1.15;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.mascota-bubble::before {
  content: "";
  position: absolute;
  left: -8px;
  bottom: 16px;
  width: 14px;
  height: 14px;
  background: var(--surface);
  border-left: 1.5px solid var(--line);
  border-bottom: 1.5px solid var(--line);
  transform: rotate(45deg);
}
.mascota-mini {
  position: fixed;
  right: 14px;
  bottom: 14px;
  width: 64px;
  height: 64px;
  z-index: 30;
  pointer-events: none;
}
.mascota-mini .mascota-art {
  width: 64px;
  height: 64px;
}
body.studying .site-foot {
  display: none;
}
.mascota-mini .mascota-bubble {
  position: absolute;
  right: 70px;
  bottom: 6px;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}
.mascota-mini.say .mascota-bubble {
  opacity: 1;
  transform: translateY(0);
}
@keyframes wiggle {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-7deg); }
  75% { transform: rotate(7deg); }
}
.mascota-react {
  animation: wiggle 0.5s ease;
}
@keyframes floaty {
  0%, 100% { transform: translateY(0) rotate(-2.5deg); }
  50% { transform: translateY(-6px) rotate(2.5deg); }
}
.mascota-float {
  animation: floaty 2.6s ease-in-out infinite;
}

/* ---------------- toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(12px);
  background: var(--ink);
  color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
  z-index: 60;
  max-width: 90vw;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  visibility: visible;
}

/* índice / paginación de la guía */
.g-index-h {
  font-family: var(--display);
  font-size: 1.3rem;
  margin: 4px 0 14px;
}
.g-index {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.g-index-item {
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 15px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 500;
  line-height: 1.3;
  box-shadow: var(--shadow-sm);
}
.g-index-item:hover {
  border-color: var(--blue);
}
.g-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin: 4px 0 14px;
}
.g-nav + .g-sec {
  margin-top: 0;
}
.g-nav-idx {
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
  font-size: 0.95rem;
}
.g-nav-pn {
  display: flex;
  gap: 8px;
}
.g-nav-pn a {
  background: var(--paper-2);
  color: var(--ink);
  border-radius: 10px;
  padding: 7px 12px;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
}

/* layout guía: sidebar + breadcrumb + paginación */
.guia-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.guia-sidebar {
  width: 240px;
  flex-shrink: 0;
  position: sticky;
  top: 74px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px;
  box-shadow: var(--shadow-sm);
}
.guia-content {
  flex: 1;
  min-width: 0;
}
.sidebar-toggle {
  display: none;
  background: var(--paper-2);
  color: var(--ink);
  width: 100%;
  margin-bottom: 14px;
}
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 14px;
}
.breadcrumb a {
  color: var(--blue);
  text-decoration: none;
  font-weight: 600;
}
.bc-cur {
  color: var(--ink);
  font-weight: 600;
}
.g-pn {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 20px;
}
.pn-prev,
.pn-next {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 12px;
  padding: 11px 14px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  line-height: 1.3;
  max-width: 47%;
}
.pn-next {
  text-align: right;
  margin-left: auto;
}
.pn-prev:hover,
.pn-next:hover {
  border-color: var(--blue);
}
/* "Para entender": la lógica detrás, visible */
.g-why-block {
  margin-top: 18px;
  background: var(--blue-soft);
  border-radius: 14px;
  padding: 15px 17px;
}
.g-why-h {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}
.g-why-item {
  margin: 0 0 12px;
}
.g-why-item:last-child {
  margin-bottom: 0;
}
.g-why-q {
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 3px;
  line-height: 1.4;
}
.g-why-a {
  color: var(--ink-soft);
  line-height: 1.6;
}
@media (max-width: 760px) {
  .guia-layout {
    flex-direction: column;
  }
  .guia-sidebar {
    display: none;
    position: static;
    width: 100%;
    max-height: none;
    margin-bottom: 14px;
  }
  .guia-sidebar.open {
    display: block;
  }
  .sidebar-toggle {
    display: block;
  }
}

/* ===== home: avance + opciones + camino de unidades ===== */
.home-overall {
  padding: 14px 16px;
  margin: 8px 0 20px;
}
.home-opts {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}
.home-opts .opt > label {
  display: block;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.path-head {
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 600;
  margin: 26px 0 14px;
}
.path {
  display: flex;
  flex-direction: column;
}
.unit {
  display: flex;
  align-items: center;
  gap: 15px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 9px 6px;
  position: relative;
}
.unit::before {
  content: "";
  position: absolute;
  left: 28px;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--line);
  z-index: 0;
}
.unit:first-child::before {
  top: 50%;
}
.unit:last-child::before {
  bottom: 50%;
}
.unit-ring {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 5px var(--paper);
}
.unit-ring-in {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-family: var(--display);
  color: var(--ink);
}
.unit.done .unit-ring-in {
  background: var(--leaf);
  color: #fff;
}
.unit-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.unit-title {
  font-weight: 600;
  line-height: 1.25;
}
.unit-prog {
  font-size: 0.82rem;
  color: var(--muted);
}
.unit:hover .unit-title {
  color: var(--blue);
}
.reset-all {
  display: block;
  margin: 24px auto 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}
.reset-all:hover {
  color: var(--wrong);
}

/* ===== landing / portada ===== */
.landing {
  padding-top: 8px;
}
.land-art {
  width: 96px;
  height: 96px;
  margin: 4px 0 6px;
}
.land-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 22px;
}
.land-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 18px;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition:
    transform 0.08s ease,
    border-color 0.15s ease;
}
.land-card:hover {
  border-color: var(--blue);
  transform: translateY(-1px);
}
.land-ico {
  font-size: 1.9rem;
  flex-shrink: 0;
}
.land-tx {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.land-t {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.2rem;
}
.land-d {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.35;
}
.land-go {
  color: var(--blue);
  font-size: 1.4rem;
  font-weight: 700;
}
.study-unit {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--blue);
  margin-bottom: 8px;
}

/* ===== pulido de espaciado + responsive + TOC ===== */
@media (min-width: 900px) {
  .guia {
    max-width: 1080px;
  }
}
.g-body {
  line-height: 1.68;
}
.g-body p {
  margin: 0 0 16px;
}
.g-h {
  margin: 28px 0 10px;
}
.g-h:first-child {
  margin-top: 6px;
}
.g-sec {
  padding: 26px 22px;
}
.g-def,
.g-callout,
.g-ex {
  margin-bottom: 16px;
}
.toc-item.on {
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 700;
}
/* sidebar ocultable en todas las pantallas + breadcrumb sticky arriba */
.guia-sidebar {
  display: none;
}
.guia-sidebar.open {
  display: block;
}
.sidebar-toggle {
  display: block;
}
.breadcrumb {
  position: sticky;
  top: 54px;
  background: rgba(252, 251, 246, 0.93);
  backdrop-filter: blur(6px);
  z-index: 20;
  padding: 11px 0;
  margin: 0 0 16px;
}

/* ===== guía v2: traducir + notas al margen + toggles ===== */
.g-main {
  min-width: 0;
}
.g-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}
.g-tool {
  background: var(--paper-2);
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 7px 13px;
  border-radius: 999px;
}
.g-tool.on {
  background: var(--blue-soft);
  color: var(--blue);
}
.g-translate {
  background: var(--blue);
  color: #fff;
}
.g-margin {
  margin-top: 16px;
  background-color: var(--paper);
  background-image: linear-gradient(var(--seyes) 1px, transparent 1px);
  background-size: 100% 26px;
  border: 1px solid var(--blue-soft);
  border-radius: 14px;
  padding: 12px 16px;
}
.g-margin .g-notes-h {
  font-family: var(--body);
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--blue);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
@media (min-width: 900px) {
  .g-sec {
    display: grid;
    grid-template-columns: 1fr 250px;
    gap: 26px;
    align-items: start;
  }
  .g-margin {
    margin-top: 0;
    position: sticky;
    top: 84px;
  }
}

/* ---------------- login ---------------- */
.login-box {
  margin: auto;
  width: 100%;
  max-width: 410px;
  padding: 34px 28px;
  text-align: center;
}
.login-art {
  width: 84px;
  height: 84px;
  margin: 0 auto 6px;
}
.login-box h1 {
  margin: 4px 0 4px;
}
.login-box .lede {
  margin-bottom: 22px;
}
#login-form,
#buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#login-form {
  gap: 12px;
}
#login-form input {
  font-family: inherit;
  font-size: 1rem;
  width: 100%;
  padding: 14px 16px;
  border-radius: 13px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  text-align: center;
}
#login-form input:focus {
  outline: none;
  border-color: var(--blue);
}
.login-sep {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--muted);
  font-size: 0.82rem;
}
.login-sep::before,
.login-sep::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.login-foot {
  margin: 16px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}
.msg {
  margin-top: 14px;
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 0.92rem;
  font-weight: 600;
  display: none;
}
.msg.show {
  display: block;
}
.msg.ok {
  background: var(--good-soft);
  color: var(--good);
}
.msg.err {
  background: var(--wrong-soft);
  color: var(--wrong);
}

/* ---------------- guía ---------------- */
.guia-header {
  margin-bottom: 14px;
}
.guia-header h1 {
  font-size: 2rem;
}
.guia-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 14px 0 10px;
}
.toc-btn {
  background: var(--paper-2);
  color: var(--ink);
}
.guia-tip {
  font-size: 0.88rem;
  color: var(--ink-soft);
  background: var(--blue-soft);
  border-radius: 14px;
  padding: 11px 14px;
  margin: 6px 0 0;
}
.gloss-demo,
.gloss {
  border-bottom: 2px dotted var(--blue);
  cursor: pointer;
  color: var(--blue);
  font-weight: 600;
}
.gloss:hover {
  background: var(--blue-soft);
  border-radius: 4px;
}
.toc {
  display: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.toc.open {
  display: block;
}
.toc-head {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 800;
  color: var(--muted);
  padding: 4px 8px 8px;
}
.toc-item {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 9px 8px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--ink);
  font-size: 0.94rem;
  line-height: 1.3;
}
.toc-item:hover {
  background: var(--paper-2);
}
.toc-n {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: var(--blue);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.g-sec {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  scroll-margin-top: 72px;
}
.g-sechead {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}
.g-num {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--blue-soft);
  color: var(--blue);
  font-family: var(--display);
  font-weight: 700;
  display: grid;
  place-items: center;
}
.g-q {
  font-family: var(--display);
  font-size: 1.22rem;
  font-weight: 600;
  margin: 2px 0 0;
  line-height: 1.25;
}
.g-body {
  font-size: 1rem;
  line-height: 1.6;
}
.g-body p {
  margin: 0 0 12px;
}
.g-body ul,
.g-body ol {
  margin: 0 0 12px;
  padding-left: 22px;
}
.g-body li {
  margin: 4px 0;
}
.g-h {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 600;
  margin: 16px 0 8px;
  color: var(--blue);
}
.g-def {
  background: var(--paper-2);
  border-left: 3px solid var(--blue);
  border-radius: 0 10px 10px 0;
  padding: 10px 14px;
  margin: 0 0 12px;
}
.g-defterm {
  font-weight: 700;
}
.g-ex {
  margin: 0 0 12px;
}
.g-exlabel {
  display: inline-block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 800;
  color: var(--coral);
  margin-bottom: 2px;
}
.g-ex ul {
  margin-top: 4px;
}
.g-callout {
  background: var(--gold-soft);
  border: 1px solid #ecd6a6;
  border-radius: 12px;
  padding: 11px 14px;
  margin: 0 0 12px;
  font-size: 0.95rem;
}
/* notas manuscritas: la firma — letra a mano azul sobre la grilla */
.g-notes {
  margin-top: 16px;
  background-color: var(--paper);
  background-image: linear-gradient(var(--seyes) 1px, transparent 1px);
  background-size: 100% 26px;
  border: 1px solid var(--blue-soft);
  border-radius: 14px;
  padding: 12px 16px;
}
.g-notes-h {
  font-family: var(--body);
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--blue);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.g-note {
  font-family: var(--hand);
  font-size: 1.3rem;
  line-height: 1.25;
  color: #2c3aa0;
  padding: 4px 0;
}
.g-noteref {
  display: block;
  font-family: var(--body);
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 1px;
}
.g-whyrow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.g-why {
  background: var(--coral-soft);
  color: var(--coral);
  font-size: 0.86rem;
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 700;
}

/* ---------------- modal ---------------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(35, 44, 71, 0.45);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
}
.modal.show {
  display: flex;
}
.modal-card {
  background: var(--surface);
  width: 100%;
  max-width: 560px;
  border-radius: 20px 20px 0 0;
  padding: 24px 22px calc(env(safe-area-inset-bottom) + 24px);
  box-shadow: var(--shadow);
  position: relative;
  max-height: 80vh;
  overflow-y: auto;
}
.modal-card h3 {
  font-family: var(--display);
  margin: 0 36px 10px 0;
  font-size: 1.2rem;
}
#modal-body {
  font-size: 0.98rem;
  line-height: 1.6;
}
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--paper-2);
  color: var(--ink);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  padding: 0;
  font-size: 1.2rem;
  line-height: 1;
}
@media (min-width: 620px) {
  .modal {
    align-items: center;
  }
  .modal-card {
    border-radius: 20px;
  }
}

/* ---------------- admin ---------------- */
.admin .block {
  padding: 18px;
  margin-bottom: 16px;
}
.admin label.lbl {
  display: block;
  font-weight: 700;
  font-size: 0.85rem;
  margin: 0 0 7px;
}
.admin input[type="text"],
.admin input[type="password"],
.admin textarea {
  font-family: inherit;
  font-size: 1rem;
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}
.admin textarea {
  min-height: 200px;
  resize: vertical;
  line-height: 1.5;
}
.admin .hint {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 7px 0 0;
}
.admin .row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 12px;
}
.admin .radio {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 0.92rem;
  color: var(--muted);
  font-weight: 600;
}
.preview-list,
.cards-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mini-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  background: var(--paper-2);
  border-radius: 12px;
  padding: 11px 13px;
  font-size: 0.92rem;
}
.mini-card .c {
  font-weight: 700;
  flex-shrink: 0;
  max-width: 42%;
}
.mini-card .d {
  color: var(--muted);
  text-align: right;
}
.mini-card.bad {
  background: var(--wrong-soft);
  color: var(--wrong);
}
.mini-card button {
  background: transparent;
  color: var(--wrong);
  padding: 0 4px;
  font-size: 1.1rem;
}

/* ---------------- a11y ---------------- */
:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  .flashcard-inner,
  .bar > span,
  .toast,
  .mascota-float,
  .mascota-react,
  .mascota-mini .mascota-bubble {
    transition: none;
    animation: none;
  }
}
