/* Catálogo de estudio: alcance, filtros y fichas por formato. */
.study-explorer {
  display:grid;grid-template-columns:minmax(12rem,26%) minmax(0,1fr);
  border:1px solid var(--line);border-radius:0 0 12px 12px;background:white;
}
.explorer-side {min-width:0;padding:.8rem;background:var(--ruta-panel,#f4f7f9);border-right:1px solid var(--line);}
.workspace .explorer-side-label {margin:0 0 .45rem;color:var(--ruta-tinta,var(--ink));font-weight:700;font-size:.96rem;text-align:start;}
.explorer-intents {display:flex;flex-wrap:wrap;gap:.3rem;margin-bottom:.55rem;}
.explorer-intent {
  flex:auto;min-height:2.75rem;padding:.3rem .65rem;border:1px solid var(--ruta-control,var(--line));
  border-radius:.55rem;background:white;color:var(--ruta-oscuro,var(--ink));font:inherit;font-size:.88rem;font-weight:650;
}
.explorer-intent:hover {background:var(--ruta-activo,#e0edf4);}
.explorer-intent[aria-pressed=true] {background:var(--ruta-azul,#26547c);border-color:var(--ruta-azul,#26547c);color:white;}
.explorer-intent:focus-visible {outline:2px solid var(--ruta-oscuro,#143452);outline-offset:2px;}
.explorer-rail {display:grid;gap:.125rem;padding-top:.35rem;border-top:1px solid var(--line);}
.explorer-choice {
  display:flex;align-items:center;gap:.55rem;min-height:2.45rem;width:100%;padding:.35rem .55rem;
  border:0;border-radius:.45rem;text-align:left;background:transparent;color:var(--ink);
  font:inherit;font-size:.91rem;line-height:1.25;
}
.explorer-choice .symbol {width:1rem;height:1rem;flex:none;color:var(--ruta-azul);}
.explorer-choice[aria-pressed=true],.explorer-choice:hover {background:var(--ruta-activo,#e0edf4);}
.explorer-choice[aria-pressed=true] {font-weight:700;}
.explorer-choice[aria-pressed=true]::after {content:'›';margin-left:auto;color:var(--ruta-azul);}
.explorer-panel {min-width:0;padding:.9rem 1.1rem .65rem;}
.explorer-select {display:none;}
.explorer-heading {display:flex;align-items:baseline;justify-content:space-between;gap:.3rem .8rem;flex-wrap:wrap;}
.explorer-heading h3 {margin:0;font-size:1.35rem;color:var(--ink);}
.workspace .explorer-panel .collection-scope {
  align-items:stretch;margin:.4rem 0 .55rem;padding:0;width:fit-content;
  border:1px solid var(--ruta-control,var(--line));border-radius:.5rem;background:white;overflow:hidden;gap:0;
}
.explorer-panel .collection-scope .chip {
  min-height:2.15rem;flex:auto;border-radius:0;border:none;padding:.28rem .7rem;
}
.explorer-panel .collection-scope .chip:focus-visible {outline-offset:-3px;}
.explorer-controls {
  display:flex;align-items:center;flex-wrap:wrap;gap:.35rem .65rem;
  margin-bottom:.3rem;color:var(--muted);
}
.explorer-controls>.field {flex:1 1 9rem;min-width:0;margin:0;}
.explorer-controls>.field label {
  position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;
}
.workspace .explorer-controls>.field input {width:100%;min-height:2.1rem;height:2.1rem;padding:.3rem .55rem;font-size:.85rem;}
.explorer-controls .collection-count {margin-left:auto;font-size:.77rem;}
.practice-mode-choices {
  display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem;
  max-width:54rem;margin:1.5rem auto 2rem;
}
.practice-mode-choice {
  display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:.85rem;
  min-height:8rem;padding:1.25rem;border:1px solid #becfdf;border-radius:1rem;
  background:#edf4fa;color:#234c70;font:inherit;text-align:start;cursor:pointer;
}
.practice-mode-choice.random {background:#edf6f1;color:#25594a;border-color:#bcd6c9;}
.practice-mode-choice .symbol:first-child {width:1.65rem;height:1.65rem;}
.practice-mode-choice .symbol:last-child {width:1rem;height:1rem;}
.practice-mode-choice:hover {border-color:currentColor;}
.practice-mode-choice:focus-visible {outline:3px solid #26547c;outline-offset:3px;}
.practice-mode-copy {display:grid;gap:.3rem;min-width:0;}
.practice-mode-copy strong {font-size:1.3rem;}
.practice-mode-hint {font-size:.96rem;line-height:1.4;}
.practice-random-panel {max-width:37rem;margin:1rem auto;}
.workspace .practice-random-panel .random-box {padding:clamp(1rem,4vw,2rem);text-align:center;}
.practice-random-panel .random-box [hidden]{display:none!important}
.practice-random-panel .random-box>fieldset{margin-block:0 1rem}
.practice-random-panel .practice-choice:has(input:disabled){opacity:.55;cursor:default}
.practice-random-panel .button-row {justify-content:center;gap:.7rem;margin-top:1rem;}
.practice-random-panel .meter {margin:.6rem auto 1rem;}
.workspace .random-count {text-align:center;font-weight:700;}
.workspace .random-help {line-height:1.5;}
.topic-search {padding-block:.5rem;}
.library-results .collection-hint,.library-results .collection-mark-status {margin:.45rem 0;}
.library-results .collection-mark-status:empty {margin:0;}
.section-list > .collection-mark-status {grid-column:1/-1; padding:.55rem .8rem; background:#edf5fa; border-radius:.65rem;}
.collection-mark-status:has(.undo-study-mark) {display:flex; align-items:center; justify-content:space-between; gap:.5rem;}
.collection-mark-status .undo-study-mark {margin:0; flex:none;}
.undo-study-mark {margin-inline-start:.55rem; min-height:2.75rem;}
.workspace .topic-search>.field input {min-height:2.75rem;font-size:1rem;}
@media(max-width:650px){
  .practice-mode-choices {grid-template-columns:1fr;gap:.7rem;margin:1rem auto;}
  .practice-mode-choice {padding:.95rem;min-height:6.5rem;}
}
.compact-list {display:grid;gap:0;}
.compact-list .compact-item {
  position:relative;display:grid;align-items:center;grid-template-columns:auto minmax(0,1fr) auto auto;
  gap:.55rem;padding:.45rem .1rem;border:0;border-bottom:1px solid var(--line);
  border-radius:0;box-shadow:none;background:white;
}
.compact-list .compact-item:hover,.compact-list .compact-item:focus-within {background:var(--ruta-panel,#f4f7f9);}
.compact-list .compact-item .thumb {grid-column:1;grid-row:1;width:2.55rem;height:3.25rem;border-radius:3px;}
.compact-list .compact-item.video-card .thumb {width:4.3rem;height:auto;aspect-ratio:16/9;}
.compact-list .item-copy {grid-column:2;grid-row:1;min-width:0;}
.compact-list .item-copy h3 {text-align:start;margin:0;font-size:.94rem;line-height:1.27;overflow-wrap:anywhere;}
.compact-list .item-copy .badge-row {font-size:.76rem;gap:.2rem .48rem;margin-top:.16rem;line-height:1.3;}
.compact-list .item-copy .badge-row:empty {display:none;}
.compact-list .badge-row .compact-status{color:var(--ruta-azul);}
.compact-list .compact-reason {margin:.1rem 0 0;}
.compact-list .compact-save,.compact-list .compact-open {
  display:inline-grid;place-items:center;align-self:center;justify-self:center;
  min-height:2.45rem;min-width:2.45rem;height:2.45rem;width:2.45rem;
  margin:0;padding:0;color:var(--ruta-azul);background:transparent;border:0;border-radius:.42rem;
}
.compact-list .compact-save {grid-column:3;grid-row:1;position:relative;z-index:2;}
.compact-list .compact-save[aria-pressed=true] .symbol {fill:var(--ruta-activo);}
.compact-list .compact-open {grid-column:4;grid-row:1;}
.compact-list .compact-open::after {content:'';position:absolute;inset:0;z-index:1;}
.compact-list .compact-open:focus-visible::after {outline:2px solid var(--ruta-azul);outline-offset:-2px;}
.compact-list .compact-save .symbol,.compact-list .compact-open .symbol {height:1rem;width:1rem;}
.compact-list .collection-processes,.compact-list .compact-review {position:relative;z-index:2;}
.compact-review {padding:0;border:0;background:transparent;color:var(--ruta-azul);font:inherit;font-size:.8rem;text-decoration:underline;}
.compact-list .compact-open:disabled::after {display:none;}
.explorer-results>.load-more {min-height:2.25rem;margin:.6rem auto .25rem;}
.collection-empty {padding:.65rem .55rem;text-align:center;}
.collection-empty .empty {margin:0;}
.collection-empty .btn {margin-top:.5rem;}
@media (max-width:700px) {
  .study-explorer {grid-template-columns:minmax(0,1fr);}
  .explorer-side {border-right:0;border-bottom:1px solid var(--line);padding:.55rem .7rem;}
  .explorer-rail {display:none;}
  .workspace .explorer-side-label {text-align:center;}
  .explorer-intents {display:grid;grid-template-columns:1fr .8fr 1.45fr;}
  .explorer-intent {padding:.2rem .3rem;line-height:1.2;}
  .explorer-select {display:flex;align-items:center;gap:.55rem;margin:0;}
  .explorer-select select {flex:1;min-width:0;width:auto;max-width:100%;}
  .explorer-select label {flex:none;}
  .explorer-panel {padding:.7rem;}
  .explorer-heading {gap:.1rem .4rem;}
  .explorer-heading h3 {font-size:1.14rem;}
  .explorer-heading .fine {font-size:.77rem;}
  .compact-list .compact-item {gap:.28rem;padding:.4rem 0;}
  .compact-list .compact-item .thumb {width:2.25rem;height:2.9rem;}
  .compact-list .compact-item.video-card .thumb {width:3.6rem;height:auto;}
  .compact-list .item-copy h3 {font-size:.89rem;}
  .compact-list .compact-save {width:2.75rem;min-width:2.75rem;height:2.75rem;min-height:2.75rem;}
  .compact-list .compact-open {width:1.6rem;min-width:1.6rem;min-height:2.75rem;}
  .explorer-controls {gap:.15rem .45rem;}
  .explorer-panel .collection-scope .chip {min-height:2.55rem;}
}

/* El espacio de la colección decide cuántas fichas caben. En una tableta vertical
   puede haber menos espacio para títulos que en una ventana de escritorio. */
.library-results { container-type: inline-size; }
.workspace:has(> .library-results .material-grid) { padding-top: .8rem; }
.workspace:has(> .library-results .material-grid) > .workspace-heading {
  margin: .6rem 0 .8rem;
}
.workspace:has(> .library-results .material-grid) > .workspace-heading h1 {
  font-size: clamp(1.85rem, 3.8vw, 2.65rem);
  margin-block: .18rem;
}
.workspace:has(> .library-results .material-grid) > .collection-scope {
  margin-block: .65rem .85rem;
}
@media (min-width: 55rem) {
  .workspace:has(> .library-results .material-grid) { position: relative; padding-top: 1.35rem; }
  .workspace:has(> .library-results .material-grid) > .back-link {
    position: absolute;
    inset-inline-start: 0;
    top: 1.6rem;
    max-width: 13rem;
  }
  .workspace:has(> .library-results .material-grid) > .workspace-heading {
    margin-top: 0;
    padding-inline: 13.25rem;
  }
}
.material-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: .65rem;
  margin-top: .65rem;
}
.material-grid .collection-empty { grid-column: 1 / -1; }
.material-grid .compact-item {
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  align-items: start;
  column-gap: .85rem;
  row-gap: .2rem;
  padding: .75rem;
  border: 1px solid var(--line);
  border-radius: .85rem;
}
.material-grid .compact-item .thumb {
  grid-row: 1 / 3;
  align-self: center;
  width: 4.8rem;
  height: auto;
  aspect-ratio: 192 / 248;
  border-radius: .35rem;
}
.material-grid .compact-item.video-card .thumb {
  width: clamp(5.5rem, 22cqi, 8.25rem);
  aspect-ratio: 16 / 9;
}
.material-grid .item-copy { align-self: end; }
.material-grid .item-copy h3 { font-size: 1.02rem; line-height: 1.3; }
.material-grid .item-copy .badge-row { margin-top: .24rem; font-size: .82rem; }
.material-grid .material-actions {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .2rem;
  padding-top: .15rem;
}
.material-grid .compact-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  min-height: 2.75rem;
  max-width: 100%;
  padding: .28rem .7rem;
  font: inherit;
  font-weight: 700;
  font-size: .88rem;
  background: var(--ruta-activo, #e0edf4);
  color: var(--ruta-oscuro, #143452);
}
.material-grid .compact-open::after { border-radius: .85rem; }
.material-grid .compact-open:hover { background: #cfe4f3; }
.material-grid .compact-open:disabled { background: var(--ruta-panel); color: var(--muted); }
.material-grid .compact-save {
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  margin-inline-start: auto;
}
.material-grid .compact-save[aria-pressed=true] .symbol { fill: currentColor; }
.workspace .collection-scope.format-scopes {
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,1.65fr) minmax(0,.9fr);
  align-items:stretch;
  max-width:38rem;
}
.format-scopes .chip {
  padding:.36rem .3rem;
  line-height:1.2;
  overflow-wrap:break-word;
}
.compact-list .compact-studied {
  position:relative;
  z-index:2;
  display:inline-flex;
  align-items:center;
  min-height:44px;
  padding:.25rem .3rem;
  border:0;
  border-radius:.4rem;
  color:var(--ruta-azul);
  background:transparent;
  font:inherit;
  font-size:.85rem;
  font-weight:700;
  text-align:start;
  cursor:pointer;
}
.compact-list .compact-studied:hover {text-decoration:underline;}
.compact-list .compact-studied[aria-pressed=true] {color:#245740;}
.compact-list .compact-studied:focus-visible {outline:2px solid var(--ruta-azul);}
@container (min-width: 48rem) {
  .material-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container (max-width: 22rem) {
  .material-grid .compact-item { padding: .55rem; column-gap: .55rem; }
  .material-grid .compact-item .thumb { width: 3.7rem; }
  .material-grid .compact-item.video-card .thumb { width: 4.8rem; }
}

/* En la colección de guías, la ruta del perfil determina el documento principal. */
.guide-switch {
  display: flex;
  justify-content: center;
  margin: .5rem 0 1.25rem;
}
.guide-switch .btn, .guide-actions .btn { min-height: 44px; }
.study-sheet {
  display: grid; justify-items: center; gap: .65rem;
  max-width: 56rem; margin: .6rem auto 1.4rem;
}
.study-sheet-img { display: block; width: 100%; height: auto; border-radius: .5rem; }
.study-sheet-enlarge { width: 100%; display: grid; justify-items: center; gap: .5rem; padding: 0; border: 0; background: none; cursor: zoom-in; }
.study-sheet-note { margin: 0; padding: .65rem .85rem; background: var(--ruta-panel); border-radius: .5rem; }
.study-sheet-dialog[open] {
  width: min(76rem, calc(100% - 1rem)); max-height: 93svh;
  display: flex; flex-direction: column; overflow: hidden;
}
.study-sheet-tools { padding: .45rem .75rem; text-align: right; }
.study-sheet-pan { min-height: 0; overflow: auto; overscroll-behavior: contain; }
.study-sheet-pan img { display: block; width: max(140%, 84rem); max-width: none; height: auto; border-radius: 0; }
.library-results + .guide-switch { margin: 1rem 0; }
.guide-personal, .guide-directory { max-width: 60rem; margin-inline: auto; }
.guide-personal > h2 { margin: 0 0 .7rem; font-size: 1.25rem; }
.guide-feature {
  display: grid;
  grid-template-columns: minmax(8rem, 12.5rem) minmax(0, 1fr);
  align-items: center;
  gap: clamp(1.25rem, 4vw, 3rem);
  width: min(100%, 46rem);
  margin-inline: auto;
  padding: clamp(1rem, 3.5vw, 2rem);
  box-sizing: border-box;
  border: 1px solid #cfdeea;
  border-radius: 1.1rem;
  background: #f5f9fd;
}
.guide-cover {
  display: grid;
  place-items: center;
  overflow: hidden;
  aspect-ratio: 560/724;
  background: white;
  border: 1px solid #d2dfe8;
  border-radius: .35rem;
  color: var(--ruta-azul);
}
.guide-cover img { width: 100%; height: 100%; object-fit: contain; }
.guide-cover .symbol { width: 1.8rem; height: 1.8rem; }
.guide-copy { min-width: 0; text-align: center; }
.workspace .guide-copy :is(p,h3) { text-align: center; text-align-last: center; }
.guide-copy h3 { margin: .35rem 0; font-size: clamp(1.35rem,3vw,1.85rem); line-height: 1.2; }
.guide-copy :is(.guide-process,.guide-route,.guide-source) { margin: .35rem 0; }
.guide-process { color: var(--ruta-azul); font-size: .94rem; font-weight: 700; }
.guide-source,.guide-route,.guide-status { color: var(--muted); font-size: .88rem; }
.guide-status:empty { display: none; }
.guide-actions { display: flex; flex-wrap: wrap; gap: .3rem .75rem; justify-content: center; margin-top: 1rem; }
.guide-save, .guide-details {
  border: 0; background: transparent; color: var(--ruta-azul); font: inherit; cursor: pointer;
}
.guide-save { display: inline-flex; align-items: center; gap: .35rem; min-height: 44px; padding: .35rem; font-size: .86rem; }
.guide-save[aria-pressed=true] svg { fill: currentColor; }
.guide-group { margin-bottom: 1.6rem; }
.guide-group h2 { margin: 0 0 .6rem; font-size: clamp(1.08rem, 2vw, 1.3rem); }
.guide-cards { display: grid; grid-template-columns: repeat(auto-fill,minmax(min(100%,15.75rem),1fr)); gap: .6rem; }
.guide-card {
  position: relative;
  display: grid;
  grid-template-columns: 3.75rem minmax(0,1fr);
  align-items: center;
  gap: .7rem;
  border: 1px solid var(--line);
  border-radius: .75rem;
  background: white;
  padding: .65rem;
}
.guide-card:hover,.guide-card:focus-within { background: var(--ruta-panel); border-color: var(--ruta-control); }
.guide-card h3 { margin: 0; font-size: .97rem; line-height: 1.3; }
.guide-details { min-height: 44px; padding: .15rem; font-weight: 700; }
.guide-details::after { content: ''; position: absolute; inset: 0; border-radius: .75rem; }
.guide-details:focus-visible { outline: none; }
.guide-details:focus-visible::after { outline: 2px solid var(--ruta-azul); outline-offset: 2px; }
.badge-row .access-tag {
  display:inline-flex;align-items:center;gap:.28rem;font-weight:700;line-height:1.35;
  padding:.14rem .48rem;border-radius:.5rem;
}
.access-tag.is-included {background:#e4f2eb;color:#215a41;}
.access-tag.is-premium {background:#e9f1f9;color:#234c71;}
.access-tag .symbol {height:.9rem;width:.9rem;}
.compact-list .compact-open.access-open {
  inline-size:auto;min-inline-size:0;min-height:2.75rem;padding:.3rem .55rem;
  border:1px solid var(--ruta-control,#b5cad9);background:white;font-size:.84rem;line-height:1.15;
}
.access-dialog,.workspace .access-detail {
  box-sizing:border-box;width:min(28rem,calc(100vw - 2rem));max-width:100%;
  background:white;border:1px solid var(--line);border-radius:1rem;
  padding:1.2rem;color:var(--ruta-oscuro,#183952);
}
.access-dialog {margin:auto;max-height:calc(100dvh - 2rem);overflow-y:auto;}
.access-dialog::backdrop {background:rgb(18 45 64 / .36);}
.workspace .access-detail {margin:1rem auto;}
.access-message {display:grid;text-align:center;justify-items:stretch;gap:.65rem;}
.access-message h2 {font-size:clamp(1.3rem,3vw,1.65rem);margin:0;line-height:1.23;}
.workspace .access-message p {text-align:center;text-align-last:center;margin:0 0 .4rem;}
.access-lock {justify-self:center;padding:.58rem;background:#e9f1f9;border-radius:.7rem;display:grid;place-items:center;}
.access-lock svg {width:1.4rem;height:1.4rem;}
.access-message .btn {min-height:44px;}
.compact-list .compact-save.save-labeled {
  display:inline-flex;align-items:center;justify-content:center;gap:.35rem;
  inline-size:auto;block-size:auto;min-block-size:2.75rem;max-inline-size:100%;
  margin:0;padding:.3rem .55rem;border:1px solid var(--ruta-control,#b5cad9);
  background:white;font-size:.84rem;line-height:1.15;
}
.compact-list .save-labeled .symbol,.access-save .symbol {flex:none;}
.compact-list .save-labeled[aria-pressed=true],.access-save[aria-pressed=true] {background:#e9f1f9;}
.access-save-status {color:var(--ruta-azul);font-size:.88rem;}
.access-save-status:empty {display:none;}
@media(max-width:700px){
  .compact-list:not(.material-grid) .compact-item:has(> .save-labeled) {
    grid-template-columns:auto minmax(0,1fr) auto;
  }
  .compact-list:not(.material-grid) .compact-item:has(> .save-labeled) .item-copy {grid-column:2 / -1;}
  .compact-list:not(.material-grid) .compact-item > .save-labeled {grid-column:2;grid-row:2;justify-self:start;}
  .compact-list:not(.material-grid) .compact-item:has(> .save-labeled) .compact-open {grid-column:3;grid-row:2;}
}
.access-dismiss {display:block;margin-inline-start:auto;min-height:44px;border:0;background:transparent;color:var(--ruta-azul);font:inherit;}
.access-alternative:not(:empty) {display:grid;gap:.1rem;text-align:start;background:#e9f4ee;color:#214f40;border-radius:.7rem;padding:.65rem .8rem;}
.access-alternative>span {font-size:.8rem;}
.access-free-link {display:flex;align-items:center;gap:.45rem;background:transparent;padding:0;border:0;min-height:44px;text-align:start;font:inherit;font-weight:700;color:inherit;}
.access-free-link svg {order:1;flex:none;margin-inline-start:auto;width:1rem;height:1rem;}
@media(min-width:701px){
  .material-grid.membership-topics {grid-template-columns:minmax(0,1fr);gap:.42rem;}
  .membership-topics .compact-item {grid-template-columns:auto minmax(0,1fr) auto;grid-template-rows:auto;align-items:center;}
  .membership-topics .compact-item .thumb {grid-row:1;width:3.1rem;}
  .membership-topics .item-copy {align-self:center;}
  .membership-topics .material-actions {grid-column:3;align-self:center;}
}
@media(max-width:520px){
  .access-dialog {width:100%;max-width:100%;max-height:90dvh;margin:auto 0 0;border-radius:1.1rem 1.1rem 0 0;padding:1rem 1rem calc(1rem + env(safe-area-inset-bottom));}
}
@media (max-width: 520px) {
  .guide-feature { grid-template-columns: minmax(0,1fr); justify-items: center; gap: .75rem; }
  .guide-feature .guide-cover { width: clamp(6.75rem,30vw,9rem); }
  .guide-copy .guide-process { text-align-last: center; }
  .guide-switch { margin: .2rem 0 .95rem; }
  .guide-actions { margin-top: .65rem; }
}
