/* Novaproyectos: una app amable, redondeada, con menú inferior, la creación paso a paso y movimientos con rebote. */

@font-face { font-family: "Fredoka"; src: url("../fonts/fredoka/Fredoka-Variable.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("../fonts/nunito/Nunito-Variable.woff2") format("woff2"); font-weight: 400 900; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible Next"; src: url("../fonts/atkinson-hyperlegible-next/AtkinsonHyperlegibleNext-Variable.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Andika"; src: url("../fonts/andika/Andika-Regular.woff2") format("woff2"); font-display: swap; }

:root {
  --heading: #3d2b1f;
  --link: #9a4320;
  --primary: #b4532a;
  --primary-dark: #8c3d1c;
  --primary-soft: #fbeade;
  --accent: #e3a33b;
  --focus: #d4842a;
  --paper: #fbf6ee;
  --paper-strong: #f1e5d3;
  --line: #eadfcf;
  --danger: #b42318;
  --danger-soft: #fdeceb;
  --surface: #fff;
  --text: #2e2620;
  --muted: #7a6658;
  --radius: 28px;
  --radius-small: 16px;
  --shadow: 0 1px 2px rgb(61 43 31 / .05), 0 18px 40px -22px rgb(61 43 31 / .28);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --font: "Nunito", system-ui, sans-serif;
  --font-display: "Fredoka", "Nunito", system-ui, sans-serif;
  --font-reading: "Atkinson Hyperlegible Next", Verdana, system-ui, sans-serif;
  --font-early: "Andika", "Atkinson Hyperlegible Next", Verdana, sans-serif;
  --dock-space: 112px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(60vw 50vw at 100% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    radial-gradient(50vw 40vw at -10% 10%, color-mix(in srgb, var(--primary) 12%, transparent), transparent 70%),
    var(--paper);
  background-attachment: fixed;
  color: var(--text);
  font: 500 1rem/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; color: var(--heading); font-family: var(--font-display); font-weight: 600; line-height: 1.15; }
.btn, .dock, .tab-list, .eyebrow, .wizard-progress, .avatar, .chip-button, .segmented, .length-card strong, .stepper input, .tile strong, .reading-card-title, .top-brand, .login-brand { font-family: var(--font-display); }
p { margin: 0; }
a { color: var(--link); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
svg[aria-hidden="true"] { width: 1.25em; height: 1.25em; flex: none; }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .9375rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.eyebrow { color: var(--primary); font-size: .875rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }

.page { width: min(100% - 32px, 760px); margin: 0 auto; padding: 8px 0 var(--dock-space); }
.page-wide { width: min(100% - 32px, 1080px); }

.sheet { padding: clamp(20px, 4vw, 36px); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 26px;
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 10px 22px -12px color-mix(in srgb, var(--primary) 80%, transparent);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s, transform .25s var(--spring);
}
.btn:hover { background: var(--primary-dark); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-ghost { background: var(--surface); box-shadow: inset 0 0 0 2px var(--line); color: var(--heading); }
.btn-ghost:hover { background: var(--primary-soft); box-shadow: inset 0 0 0 2px transparent; }
.btn-block { width: 100%; }

.alert, .notice { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-radius: var(--radius-small); }
.alert { background: var(--danger-soft); color: var(--danger); }
.notice { background: var(--primary-soft); color: var(--primary-dark); }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px; border-radius: 999px; background: var(--surface); color: var(--primary-dark); font-size: .8125rem; font-weight: 600; }
.badge svg { width: 16px; height: 16px; }
.badge-error { color: var(--danger); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.chips > * { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; border-radius: 999px; background: var(--paper); color: var(--heading); font-size: .875rem; font-weight: 700; }
.chips svg { width: 16px; height: 16px; color: var(--primary); }
.chips-large > * { padding: 6px 14px; background: var(--surface); box-shadow: var(--shadow); }

.back { display: inline-flex; align-items: center; gap: 6px; justify-self: start; color: var(--muted); font-weight: 600; text-decoration: none; }
.back:hover { color: var(--heading); }

.page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px; }
.page-head h1 { font-size: clamp(2rem, 5vw, 2.75rem); }
.page-head p.muted { margin-top: 4px; }

/* Encabezado y menú inferior */

.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: min(100% - 32px, 1080px); margin: 0 auto; padding: 16px 0; }
.top-brand { display: flex; align-items: center; gap: 12px; min-width: 0; color: var(--heading); font-weight: 700; text-decoration: none; }
.top-brand img { flex: none; border-radius: 12px; box-shadow: var(--shadow); }
.top-brand span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--primary));
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}
.avatar-large { width: 72px; height: 72px; font-size: 1.75rem; }

.dock {
  position: fixed;
  bottom: max(16px, env(safe-area-inset-bottom));
  left: 50%;
  z-index: 30;
  display: flex;
  gap: 4px;
  padding: 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(14px);
  box-shadow: 0 0 0 1px rgb(61 43 31 / .06), 0 20px 40px -16px rgb(61 43 31 / .35);
  transform: translateX(-50%);
}
.dock a, .dock button {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 92px;
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-size: .8125rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .15s, color .15s;
}
.dock button { border: 0; background: none; cursor: pointer; }
.dock form { display: flex; }
.dock a:hover, .dock button:hover { color: var(--heading); }
.dock a[aria-current="page"] { background: var(--primary); color: #fff; }

/* Ingreso: la foto de fondo y una hoja que sube desde abajo en el teléfono */

.login { position: relative; display: grid; align-items: center; min-height: 100vh; min-height: 100dvh; padding: 24px clamp(16px, 6vw, 96px); background: var(--heading); }
.login-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.login::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgb(40 26 18 / .35), transparent 60%); }
.login-sheet {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
  width: min(100%, 440px);
  padding: 36px;
  border-radius: 32px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(16px);
  box-shadow: 0 30px 60px -20px rgb(40 26 18 / .5);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; color: var(--heading); font-weight: 700; line-height: 1.2; }
.login-brand img { border-radius: 12px; }
.login-sheet h1 { font-size: 2.25rem; }
.login-form { display: grid; gap: 18px; margin-top: 18px; }

.field { display: grid; gap: 6px; }
.field > span:first-child { color: var(--heading); font-size: .9375rem; font-weight: 600; }
.field input, .wizard textarea {
  width: 100%;
  min-height: 54px;
  padding: 0 20px;
  border: 2px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface);
  font-size: 1.0625rem;
  transition: border-color .15s, box-shadow .15s;
}
.wizard textarea { padding: 14px 20px; resize: vertical; }
.field input:focus, .wizard textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); outline: 0; }
.password { position: relative; display: block; }
.password input { padding-right: 60px; }
.password-toggle {
  position: absolute;
  top: 7px;
  right: 7px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.password-toggle:hover { background: var(--primary-soft); color: var(--primary-dark); }
.password-toggle .eye-show { display: contents; }
.password-toggle .eye-hide, .password-toggle[aria-pressed="true"] .eye-show { display: none; }
.password-toggle[aria-pressed="true"] .eye-hide { display: contents; }
.login .btn { margin-top: 6px; }

/* Crear: un paso a la vez */

.wizard { display: grid; gap: 20px; }
.wizard-head { display: grid; gap: 6px; text-align: center; }
.wizard-head h1 { font-size: clamp(2rem, 6vw, 2.75rem); }
.wizard-progress { display: flex; justify-content: center; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; counter-reset: step; }
.wizard-progress li {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 600;
  counter-increment: step;
}
.wizard-progress li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--paper-strong);
  font-size: .8125rem;
}
.wizard-progress .is-done::before { content: "✓"; background: var(--primary-soft); color: var(--primary-dark); }
.wizard-progress [aria-current] { background: var(--surface); box-shadow: var(--shadow); color: var(--heading); }
.wizard-progress [aria-current]::before { background: var(--primary); color: #fff; }

.wizard-card { display: grid; gap: 28px; }
.wizard-step { display: grid; gap: 14px; }
.wizard-step + .wizard-step { padding-top: 28px; border-top: 2px dashed var(--line); }
.is-stepped .wizard-step + .wizard-step { padding-top: 0; border: 0; }
.is-stepped .wizard-step:not(.is-current) { display: none; }
.is-stepped .wizard-step.is-current { animation: step-in .45s var(--spring) both; }
.wizard-step h2 { font-size: clamp(1.5rem, 4vw, 1.875rem); }
.wizard-step h2:focus { outline: 0; }
.step-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 18px; background: var(--primary-soft); color: var(--primary-dark); font-size: 1.5rem; }

.picks { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.pick { display: grid; gap: 6px; }
.pick > span, .lengths legend, .option legend { display: flex; align-items: center; gap: 8px; color: var(--heading); font-size: .9375rem; font-weight: 600; }
.pick select {
  width: 100%;
  min-height: 60px;
  padding: 0 48px 0 20px;
  border: 2px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237a6658' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 18px center / 20px;
  color: var(--heading);
  font-size: 1.125rem;
  font-weight: 600;
  appearance: none;
  cursor: pointer;
}
.pick select:hover { border-color: color-mix(in srgb, var(--primary) 50%, var(--line)); }
.pick select:focus-visible { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); outline: 0; }

@supports (appearance: base-select) {
  .pick select, .pick select::picker(select) { appearance: base-select; }
  .pick select { display: flex; align-items: center; }
  .pick select::picker-icon { display: none; }
  .pick select > button { display: flex; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: inherit; }
  .pick selectedcontent { display: block; }
  .pick selectedcontent::first-letter { text-transform: uppercase; }
  .pick select::picker(select) {
    box-sizing: border-box;
    min-width: anchor-size(width);
    max-height: min(26rem, calc(100% - 12px));
    position-try-order: most-block-size;
    margin-block: 8px;
    padding: 8px;
    border: 0;
    border-radius: 20px;
    background: var(--surface);
    box-shadow: 0 24px 48px -16px rgb(61 43 31 / .4);
    color: var(--text);
    font: 500 1rem/1.4 var(--font);
  }
  .pick optgroup { display: grid; gap: 2px; padding-top: 4px; color: var(--muted); font: 800 .75rem/1.4 var(--font); letter-spacing: .06em; text-transform: uppercase; }
  .pick optgroup + optgroup { margin-top: 6px; padding-top: 10px; border-top: 2px dashed var(--line); }
  .pick optgroup legend { padding: 4px 12px; }
  .pick option {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 8px 12px;
    border-radius: 12px;
    color: var(--text);
    font: 700 1rem/1.4 var(--font);
    letter-spacing: 0;
    text-transform: none;
    cursor: pointer;
  }
  .pick option::checkmark { order: 1; margin-inline-start: auto; color: var(--primary); }
  .pick option:hover, .pick option:focus-visible { outline: 0; background: var(--paper); }
  .pick option:checked { background: var(--primary-soft); color: var(--primary-dark); }
}

.lengths { display: grid; gap: 10px; margin: 6px 0 0; padding: 0; border: 0; }
.lengths legend { margin-bottom: 10px; padding: 0; }
.length-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.length-card {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 18px 8px 14px;
  border: 2px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: border-color .15s, background-color .15s, transform .3s var(--spring);
}
.length-card:hover { border-color: color-mix(in srgb, var(--primary) 50%, var(--line)); }
.length-card input { position: absolute; opacity: 0; }
.length-card:has(:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); transform: translateY(-2px); }
.length-card:has(:focus-visible) { outline: 3px solid var(--focus); outline-offset: 3px; }
.length-lines { display: grid; gap: 4px; width: 44px; }
.length-lines i { height: 5px; border-radius: 4px; background: currentColor; opacity: .55; }
.length-lines i:last-child { width: 70%; }

.ideas { display: grid; gap: 12px; }
.chip-button {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 24%, var(--surface));
  color: var(--heading);
  font-weight: 600;
  cursor: pointer;
}
.chip-button:hover { background: color-mix(in srgb, var(--accent) 40%, var(--surface)); }
.idea-list { display: grid; gap: 8px; }
.idea {
  display: grid;
  gap: 2px;
  padding: 14px 18px;
  border: 2px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  animation: step-in .3s var(--ease) both;
}
.idea:nth-child(2) { animation-delay: .05s; }
.idea:nth-child(3) { animation-delay: .1s; }
.idea:hover { border-color: var(--primary); background: var(--primary-soft); }
.idea strong { color: var(--heading); font-weight: 600; }
.idea span { color: var(--muted); font-size: .9375rem; }

.stepper { display: inline-flex; align-items: center; justify-self: start; gap: 8px; }
.stepper button {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-dark);
  cursor: pointer;
  transition: background-color .15s, color .15s, transform .25s var(--spring);
}
.stepper button:hover:not(:disabled) { background: var(--primary); color: #fff; }
.stepper button:active:not(:disabled) { transform: scale(.92); }
.stepper button:disabled { opacity: .35; cursor: default; }
.stepper input { width: 80px; border: 0; background: none; color: var(--heading); font-size: 2.75rem; font-weight: 700; text-align: center; appearance: textfield; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button { appearance: none; }
.stepper-small { gap: 4px; }
.stepper-small button { width: 36px; height: 36px; }
.stepper-small svg { width: 18px; height: 18px; }
.stepper-small input { width: 36px; font-size: 1.125rem; }

.customize summary { display: inline-flex; align-items: center; gap: 8px; color: var(--link); font-weight: 600; cursor: pointer; list-style: none; }
.customize summary::-webkit-details-marker { display: none; }
.customize summary::after { content: ""; width: 8px; height: 8px; border: solid currentColor; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) translateY(-2px); transition: transform .2s; }
.customize[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.customize-body { display: grid; gap: 22px; margin-top: 14px; padding: 20px; border-radius: 20px; background: var(--paper); }
.option { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; }
.option legend { margin-bottom: 8px; padding: 0; }
.option legend svg { color: var(--primary); }
.segmented { display: flex; flex-wrap: wrap; gap: 6px; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { display: block; padding: 8px 16px; border-radius: 999px; background: var(--surface); color: var(--muted); font-weight: 600; cursor: pointer; }
.segmented input:checked + span { background: var(--primary); color: #fff; }
.segmented input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.levels { display: flex; flex-wrap: wrap; gap: 12px 28px; }
.level { display: grid; gap: 4px; justify-items: start; color: var(--heading); font-size: .9375rem; font-weight: 600; }

.wizard-nav { display: flex; justify-content: flex-end; gap: 10px; padding-top: 20px; border-top: 2px solid var(--paper); }
.wizard-nav [data-wizard-back] { margin-right: auto; }

@keyframes step-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }

/* Mis lecturas: tarjetas grandes */

.library { display: grid; gap: 24px; }
.reading-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin: 0; padding: 0; list-style: none; }
.reading-grid > li { display: grid; }
.reading-card {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 10px;
  padding: 10px 10px 18px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  transition: transform .35s var(--spring), box-shadow .2s;
}
.reading-card:hover { transform: translateY(-4px); box-shadow: 0 26px 50px -24px rgb(61 43 31 / .4); }
.reading-card > :not(.reading-card-top) { margin-inline: 10px; }
.reading-card-top { display: flex; align-items: start; justify-content: space-between; gap: 8px; height: 96px; padding: 14px; border-radius: 20px; background: var(--primary-soft); }
.reading-grid > li:nth-child(3n + 2) .reading-card-top { background: color-mix(in srgb, var(--accent) 26%, var(--surface)); }
.reading-grid > li:nth-child(3n) .reading-card-top { background: var(--paper-strong); }
.reading-card-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--surface); color: var(--primary-dark); }
.reading-card-title { display: -webkit-box; overflow: hidden; color: var(--heading); font-size: 1.125rem; font-weight: 600; line-height: 1.3; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.reading-card-meta { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .875rem; }
.more { justify-self: center; min-width: 240px; }
.empty { display: grid; justify-items: center; gap: 12px; padding-block: 48px; text-align: center; }
.empty .btn { margin-top: 8px; }

/* Ver la lectura: su pedido arriba y las partes en pestañas */

.reading { display: grid; gap: 16px; }
.topic { display: flex; align-items: start; gap: 8px; color: var(--muted); }
.topic svg { margin-top: .15em; color: var(--primary); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions .btn { min-height: 46px; padding: 0 20px; }
.actions .btn:last-child { margin-left: auto; }

.status { display: grid; justify-items: center; gap: 14px; padding-block: 56px; text-align: center; }
.status h1 { font-size: 1.75rem; }
.loader { display: flex; align-items: end; gap: 10px; height: 72px; margin-bottom: 8px; }
.loader span { width: 20px; height: 20px; border-radius: 50%; background: var(--primary); animation: hop 1.1s var(--spring) infinite; }
.loader span:nth-child(2) { background: var(--accent); animation-delay: .15s; }
.loader span:nth-child(3) { background: var(--primary-dark); animation-delay: .3s; }
@keyframes hop { 0%, 60%, 100% { transform: translateY(0) scale(1, 1); } 15% { transform: translateY(0) scale(1.2, .8); } 35% { transform: translateY(-40px) scale(.9, 1.1); } }
.empty-icon { display: grid; place-items: center; width: 96px; height: 96px; border-radius: 32px; background: var(--primary-soft); color: var(--primary-dark); font-size: 2.5rem; }
.status-icon { color: var(--danger); font-size: 2.5rem; line-height: 0; }
.progress { width: min(100%, 380px); height: 14px; overflow: hidden; border-radius: 999px; background: var(--paper-strong); }
.progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width .5s var(--ease); }
.progress-step { min-height: 1.5em; color: var(--heading); font-weight: 600; transition: opacity .3s; }
.progress-step.is-changing { opacity: 0; }

.tabs { display: grid; gap: 16px; }
.tab-list {
  position: sticky;
  top: 8px;
  z-index: 10;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  scrollbar-width: none;
}
.tab-list [role="tab"] {
  display: inline-flex;
  flex: 1 0 auto;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.tab-list [role="tab"]:hover { color: var(--heading); }
.tab-list [aria-selected="true"] { background: var(--primary); color: #fff; }
.count { min-width: 22px; padding: 0 6px; border-radius: 999px; background: var(--paper-strong); color: var(--heading); font-size: .75rem; line-height: 22px; text-align: center; }
[aria-selected="true"] .count { background: rgb(255 255 255 / .25); color: #fff; }
.tab-panel { display: grid; gap: 14px; animation: step-in .3s var(--ease) both; }
.tabs:has([role="tablist"]:not([hidden])) .panel-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.panel-title, .editing .sheet > h2, .editing .panel-bar h2 { display: flex; align-items: center; gap: 10px; font-size: 1.375rem; }
.panel-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }

.switch { display: inline-flex; align-items: center; gap: 10px; margin-left: auto; color: var(--heading); font-weight: 600; cursor: pointer; }
.switch input { position: relative; width: 48px; height: 28px; margin: 0; border-radius: 999px; background: var(--paper-strong); appearance: none; cursor: pointer; transition: background-color .2s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgb(61 43 31 / .3); transition: translate .2s var(--ease); }
.switch input:checked { background: var(--primary); }
.switch input:checked::after { translate: 20px 0; }

.reading-text { display: grid; gap: 1em; font: 1.1875rem/1.75 var(--font-reading); }
.reading-text h2 { margin-top: .5em; font: 800 1.25rem/1.3 var(--font); }
.reading-text ul, .reading-text ol { display: grid; gap: .4em; margin: 0; padding-left: 1.4em; }
.reading-text .steps { padding: 0; list-style: none; counter-reset: step; }
.reading-text .steps li { position: relative; padding-left: 2.4em; counter-increment: step; }
.reading-text .steps li::before { content: counter(step); position: absolute; top: .15em; left: 0; display: grid; place-items: center; width: 1.6em; height: 1.6em; border-radius: 50%; background: var(--primary); color: #fff; font: 800 .875rem/1 var(--font); }
.reading-text .stanza span { display: block; }
.reading-text .lead { color: var(--heading); font-weight: 700; }
.reading-text .stage { color: var(--muted); font-style: italic; }
.reading-text .dialogue strong { color: var(--heading); font-family: var(--font); font-weight: 600; }
.reading-text .place, .reading-text .signature { text-align: right; }
.reading-title { margin-bottom: .2em; font: 600 clamp(1.75rem, 4vw, 2.375rem)/1.15 var(--font-display); color: var(--heading); text-wrap: balance; }
.is-preschool .reading-text { font-family: var(--font-early); font-size: 1.375rem; }

.words { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 0; }
.words > div { padding: 18px 20px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.words > div:nth-child(3n + 1) { border-top: 6px solid var(--primary); }
.words > div:nth-child(3n + 2) { border-top: 6px solid var(--accent); }
.words > div:nth-child(3n) { border-top: 6px solid var(--paper-strong); }
.words dt { color: var(--heading); font-size: 1.125rem; font-weight: 700; }
.words dd { margin: 4px 0 0; color: var(--muted); }

.questions, .moments, .home { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; counter-reset: item; }
.question, .moment, .home > li { display: grid; gap: 8px; padding: 22px 24px; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.question { counter-increment: item; }
.question-level { justify-self: start; padding: 2px 10px; border-radius: 999px; background: var(--paper); color: var(--muted); font-size: .75rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.question-prompt { color: var(--heading); font-size: 1.0625rem; font-weight: 600; }
.question-prompt::before { content: counter(item) ". "; color: var(--primary); }
.options-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.options-list li { display: flex; align-items: center; gap: 12px; padding: 8px 12px 8px 8px; border-radius: 14px; background: var(--paper); }
.options-list li > span { display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--surface); color: var(--muted); font-weight: 700; }
.open-answer { color: var(--muted); font-style: italic; }
.expected { display: none; padding: 12px 16px; border-radius: 14px; background: var(--primary-soft); color: var(--primary-dark); }
.show-answers .expected { display: block; }
.show-answers .is-answer { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.show-answers .is-answer > span { background: var(--primary); color: #fff; }
.moment { counter-increment: item; }
.moment h3::before { content: counter(item) ". "; color: var(--primary); }
.moment h3, .home h3 { font-size: 1.125rem; }
.moment-question { padding: 12px 16px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 18%, var(--surface)); color: var(--heading); font-weight: 700; }

/* Editar */

.editing form { display: grid; gap: 16px; }
.editing .sheet { display: grid; gap: 14px; }
.editing .sheet > h2 svg, .editing .panel-bar h2 svg { color: var(--primary); }
.editing .question, .editing .moment, .editing .home > li { background: var(--paper); box-shadow: none; }
.edit-bar {
  position: sticky;
  top: 8px;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  padding: 10px 10px 10px 20px;
  border-radius: 24px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}
.edit-bar p { display: flex; flex: 1 1 280px; align-items: center; gap: 10px; color: var(--muted); font-size: .9375rem; }
.edit-bar p svg { color: var(--primary); }
.edit-buttons { display: flex; gap: 8px; }
.edit-buttons .btn { min-height: 46px; }
:where(.editable) { color: inherit; font: inherit; }
.editable {
  display: block;
  width: calc(100% + .8em);
  min-width: 0;
  min-height: 0;
  margin-inline: -.4em;
  padding: .15em .4em;
  border: 2px dashed var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--paper) 60%, transparent);
  field-sizing: content;
  resize: none;
}
.editable:hover { border-color: color-mix(in srgb, var(--primary) 35%, var(--line)); }
.editable:focus { border-style: solid; border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 4px var(--primary-soft); outline: 0; }
@supports not (field-sizing: content) {
  textarea.editable { resize: vertical; }
}
.reading-text .heading { margin-top: .5em; font: 800 1.25rem/1.3 var(--font); }
.edit-list { display: grid; gap: 2px; }
.edit-list span { color: var(--muted); font: 700 .8125rem var(--font); }
.dialogue-edit { display: flex; align-items: start; gap: .6em; }
.dialogue-edit input { flex: none; width: auto; min-width: 5ch; max-width: 40%; margin-inline: -.4em 0; color: var(--heading); font-family: var(--font); font-weight: 600; }
.dialogue-edit textarea { flex: 1; width: auto; margin-inline: 0 -.4em; }
.editing .words > div { box-shadow: none; background: var(--paper); }
.word-term { color: var(--heading); font-weight: 700; }
.word-meaning { margin-top: 4px; color: var(--muted); }
.option-edit { display: grid !important; grid-template-columns: 22px auto minmax(0, 1fr); align-items: center; gap: 10px; background: var(--surface) !important; }
.option-edit:has(:checked) { background: var(--primary-soft) !important; }
.option-edit input[type="radio"] { width: 22px; height: 22px; margin: 0; accent-color: var(--primary); }
.option-edit .editable { width: calc(100% + .4em); margin-inline: -.4em 0; }
.editable.moment-question { width: 100%; margin-inline: 0; padding: 12px 16px; }
.home-name { color: var(--heading); font: 800 1.125rem var(--font); }

/* Mi cuenta */

.profile { display: grid; gap: 16px; max-width: 560px; margin: 0 auto; }
.profile-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px; }
.profile-card h1 { font-size: 1.75rem; }
.form { display: grid; gap: 16px; }
.form h2 { font-size: 1.375rem; }
.form .btn { justify-self: start; }

/* Mi institución */

.dashboard { display: grid; gap: 20px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.tile { display: flex; align-items: center; gap: 16px; padding: 22px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.tile > div { display: grid; }
.tile strong { color: var(--heading); font-size: 2.25rem; font-weight: 700; line-height: 1.1; }
.tile small { color: var(--muted); font-size: 1rem; font-weight: 700; }
.tile span:not(.ring, .tile-icon) { color: var(--muted); font-size: .9375rem; }
.tile-quota { background: var(--primary); }
.tile-quota strong, .tile-quota small, .tile-quota span:not(.ring) { color: #fff !important; }
.tile-icon { display: grid; place-items: center; flex: none; width: 64px; height: 64px; border-radius: 20px; background: var(--primary-soft); color: var(--primary-dark); font-size: 1.5rem; }
.ring {
  display: grid;
  place-items: center;
  flex: none;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--value) * 1%), rgb(255 255 255 / .22) 0);
}
.ring span { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; background: var(--primary); color: #fff; font-size: .875rem; font-weight: 700; }
.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.columns .sheet { display: grid; align-content: start; gap: 16px; }
.columns h2, .people h2 { font-size: 1.375rem; }
.bars { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.bars li { display: grid; grid-template-columns: minmax(100px, 1fr) 2fr 2.5ch; align-items: center; gap: 12px; font-weight: 700; }
.bars strong { color: var(--heading); text-align: right; }
.bar { height: 16px; overflow: hidden; border-radius: 999px; background: var(--paper); }
.bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), var(--accent)); }
.people { display: grid; gap: 14px; }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.person { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 14px; padding: 18px; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.person > div { display: grid; min-width: 0; }
.person strong { color: var(--heading); font-weight: 600; }
.person .muted { font-size: .875rem; }
.person-counts { display: flex; grid-column: 1 / -1; gap: 8px; margin: 0; }
.person-counts div { display: flex; flex: 1; justify-content: space-between; padding: 8px 14px; border-radius: 14px; background: var(--paper); }
.person-counts dt { color: var(--muted); font-size: .875rem; }
.person-counts dd { margin: 0; color: var(--heading); font-weight: 700; }

/* Teléfono: el menú ocupa todo el borde inferior y el ingreso es una hoja sobre la foto */

@media (max-width: 640px) {
  :root { --dock-space: 104px; }
  .top { padding: 12px 0; }
  .top-brand span { display: -webkit-box; font-size: .9375rem; line-height: 1.2; white-space: normal; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .dock { right: 0; bottom: 0; left: 0; justify-content: space-around; padding: 8px 8px max(8px, env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0; transform: none; }
  .dock a, .dock form { flex: 1; }
  .dock button { width: 100%; }
  .dock a, .dock button { min-width: 0; padding: 8px 4px; border-radius: 16px; font-size: .75rem; }
  .dock a[aria-current="page"] { background: var(--primary-soft); color: var(--primary-dark); }

  .login { align-items: end; padding: 0; }
  .login-photo { height: 42vh; }
  .login::after { display: none; }
  .login-sheet { width: 100%; margin-top: 36vh; padding: 28px 22px 32px; border-radius: 32px 32px 0 0; background: var(--surface); }

  .wizard-progress li:not([aria-current]) { padding-right: 4px; font-size: 0; }
  .wizard-card { gap: 22px; }
  .wizard-nav { position: sticky; bottom: calc(var(--dock-space) - 16px); margin: 0 -20px -20px; padding: 14px 20px 20px; border-radius: 0 0 var(--radius) var(--radius); background: var(--surface); }
  .wizard-nav .btn { flex: 1; padding: 0 16px; }
  .wizard-nav [data-wizard-back] { flex: 0 0 auto; margin-right: 0; }
  .length-card { padding-inline: 4px; font-size: .9375rem; }
  .customize-body { padding: 16px; }
  .levels { display: grid; gap: 10px; }
  .level { grid-template-columns: 1fr auto; align-items: center; justify-items: stretch; }

  .actions .btn { flex: 1; min-width: calc(50% - 4px); }
  .actions .btn:last-child { margin-left: 0; }
  .tab-list { border-radius: 22px; }
  .tab-list [role="tab"] { padding: 0 12px; }
  .tab-list [role="tab"] svg { display: none; }
  .question, .moment, .home > li { padding: 18px; }
  .edit-bar { padding: 12px; }
  .edit-buttons { flex: 1; }
  .edit-buttons .btn { flex: 1; }
  .tile strong { font-size: 1.75rem; }
  .bars li { grid-template-columns: 1fr auto; gap: 6px 12px; }
  .bars .bar { grid-column: 1 / -1; grid-row: 2; }
  .reading-card-top { height: 72px; }
  .profile-card { grid-template-columns: auto 1fr; }
  .profile-card form { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  body { background: #fff; }
  .top, .dock, .no-print, .edit-bar { display: none !important; }
  .page { width: auto; padding: 0; }
  .sheet, .question, .moment, .home > li, .words > div { box-shadow: none; padding-inline: 0; }
  .tab-panel[hidden] { display: grid !important; }
  .panel-title { position: static !important; width: auto !important; height: auto !important; clip-path: none !important; margin-top: 1em; }
  .question, .moment, .home > li { break-inside: avoid; }
}
