#theme-toggle { padding: 7px 12px; border: 1px solid var(--border, #c9d2c6); border-radius: 8px; background: var(--card-bg, #fff); color: var(--text, #173a35); cursor: pointer; font: inherit; font-size: 13px; white-space: nowrap; }
.une-trainer { padding: 18px; margin: 20px 0; border: 1px solid var(--border); border-radius: 14px; background: var(--card-bg); }
.une-trainer summary { cursor: pointer; font-size: 19px; font-weight: 800; }
.une-trainer p { margin: 12px 0; font-size: 13px; line-height: 1.6; color: var(--muted); }
.une-trainer a { color: #164d89; }
.une-trainer iframe { display: block; width: 100%; height: min(85vh, 960px); min-height: 560px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); }
html[data-theme="dark"] {
  --bg: #10191d; --card-bg: #19272d; --text: #e7edf0; --muted: #afc0c8; --border: #39505b; --shadow: 0 2px 8px #0004;
  --study-key-bg: #243947; --study-key-text: #d5e7ee;
  --p1-light: #3e321f; --p1-dark: #ffcc78; --p2-light: #40271f; --p2-dark: #ffb29b;
  --p3-light: #20354b; --p3-dark: #a7d2ff; --p4-light: #1d3b2c; --p4-dark: #9ce2b4;
  --p5-light: #193a3d; --p5-dark: #9be0df; --p6-light: #3b2f26; --p6-dark: #e4c7a6;
  --p7-light: #342642; --p7-dark: #d9bcff; --p8-light: #402338; --p8-dark: #ffb5d8;
  --p9-light: #303b21; --p9-dark: #d1e6a1;
  color: var(--text); background: var(--bg); color-scheme: dark;
}
html[data-theme="dark"] body { background: var(--bg); color: var(--text); }
html[data-theme="dark"] :is(#topbar, #parque-nav, #ref-panel, #search, .parque-info, .muni-card, .study-nav, .study-tab, .study-search, .study-kpi, .history-card, .peak-group, .connection-card, .peak-card, .water-section, .water-river-scene, .river-card, .compound-card, .pair-card, .reference-section, .nature-card, .une-card, .une-section, .une-nav a, .une-recall, .une-solutions) { background: var(--card-bg); color: var(--text); border-color: var(--border); }
html[data-theme="dark"] :is(input, select, textarea, .edit-form input, .edit-form textarea, .study-details, .group-note, .history-via, .casillero-cell, .reference-table tr, .comarca-table tr, .nature-map) { background: #152229; color: var(--text); border-color: var(--border); }
html[data-theme="dark"] :is(.history-card > summary, .peak-group > summary, .water-river-entry) { background: linear-gradient(110deg, #20333d, #19272d); border-color: var(--border); }
html[data-theme="dark"] :is(.study-intro, .history-story, .river-memory, .compound-memory, .une-word, .pair-card, .nature-review, .water-section blockquote) { background: #352f20; color: #f3e4bc; border-color: #796838; }
html[data-theme="dark"] :is(.study-note.data, .compound-note, .nature-facts > div) { background: #19312a; color: #c4e6d6; border-color: #3f6b55; }
html[data-theme="dark"] :is(.study-note.trap, .peak-note, .une-note, .limits-contrast) { background: #39252a; color: #f3d7d9; border-color: #8d4550; }
html[data-theme="dark"] :is(.history-code, .study-chain, .compound-value, .reference-crosses, .comarca-summary, .letter) { background: #243947; color: #c4e1f9; }
html[data-theme="dark"] :is(h2, h3, .history-title, .study-search label, .study-section-title, .water-river-scene figcaption strong, .water-river-content > p:first-child, .une-topic, .une-word, .nature-facts dt, .peak-card h3, .compound-card h3, .river-card h3) { color: #d5e7ee; }
html[data-theme="dark"] :is(.study-hero, .nature-header) :is(h2, h3) { color: #fff; }
html[data-theme="dark"] :is(.une-section > summary, .study-table th) { background: #244859; color: #f5f8fa; }
html[data-theme="dark"] :is(.study-table td, .reference-table td, .comarca-table td) { color: var(--text); border-color: var(--border); }
html[data-theme="dark"] .study-table tr:nth-child(even) td { background: #203139; }
html[data-theme="dark"] :is(.reference-table td:first-child, .comarca-table td:nth-child(2), .peak-card .study-table td:first-child) { background: #243947 !important; color: #d5e7ee; }
html[data-theme="dark"] :is(.muni-data, .muni-escena, .une-card-body, .une-card figcaption, .water-river-scene figcaption, .reference-caption, .reference-source, .study-search-results, .river-caption, .limits-source, .une-breakdown) { color: var(--muted); }
html[data-theme="dark"] :is(.study-search-results button, .limits-source-button, .edit-btn) { background: #21353e; color: #d5e7ee; border-color: #53717e; }
html[data-theme="dark"] :is(.reference-section a, .water-section a, .peak-note a, .une-card a, .limits-contrast a, .compound-note a, .une-trainer a, .reference-park) { color: #94caff !important; }
html[data-theme="dark"] .study-tab.active { background: #b72c3a; color: #fff; }
html[data-theme="dark"] #study-nav { background: var(--card-bg); border-color: var(--border); }
html[data-theme="dark"] #study-nav .study-tab.active { background: #b72c3a; color: #fff; }
html[data-theme="dark"] :is(.study-kpi strong, .study-details > summary, .une-recall > summary, .une-solutions > summary, .reference-toolbar label, .reference-table td:first-child, .casillero-cell strong) { color: #a9d5ff !important; }
html[data-theme="dark"] :is(.reference-caption, .reference-source, .reference-sources, .reference-toolbar, .reference-crosses, .muni-escena, .une-breakdown, .group-note, .river-caption, .compound-kind, .pair-index, .nature-map figcaption) { color: var(--muted) !important; }
html[data-theme="dark"] :is(.municipal-party-note, .comarca-card, .comarca-summary, .comarca-table tbody tr, .une-silent-grid figure) { background: var(--card-bg); color: var(--text); border-color: var(--border); }
html[data-theme="dark"] :is(.reference-toolbar button, .study-details button) { background: #243947; color: #d5e7ee; border-color: #53717e; }
html[data-theme="dark"] :is(.reference-lead, .reference-tools label, .pair-values li, .une-recall > p, .une-solutions > p) { color: var(--muted) !important; }
html[data-theme="dark"] :is(.reference-sources > summary, .nature-questions summary, .pair-name span) { color: #d5e7ee !important; }
html[data-theme="dark"] :is(.nature-questions, .nature-questions details, .une-notice) { background: #192d29; color: #d5e7ee; border-color: var(--border); }
html[data-theme="dark"] :is(.une-scene, .une-silent-grid figcaption) { color: #ffa5b1; }
html[data-theme="dark"] .reference-heading button { background: #243947; color: #d5e7ee; border-color: #53717e; }
html[data-theme="dark"] .parque-header { background: #24353d !important; }
html[data-theme="dark"] :is(.study-image, .veh-card img) { background: #19272d; }
html[data-theme="dark"] .muni-card.done { background: #20362b; }
html[data-theme="dark"] .study-search-hit { outline-color: #ff7386 !important; }
html[data-theme="dark"] :is(.nature-review summary, .limits-contrast h3) { color: #ffd18b; }
@media (max-width: 600px) { .une-trainer { padding: 12px; } .une-trainer iframe { min-height: 680px; } }

/* Extremos municipales: el texto y los símbolos acompañan al color. */
:root {
  --near-border: #0f766e; --near-bg: #effbf7; --near-text: #115e59;
  --far-border: #b45309; --far-bg: #fff7e8; --far-text: #85400d;
  --alt-border: #7c3ab0; --alt-bg: #f8f1ff; --alt-text: #65308b;
}
html[data-theme="dark"] {
  --near-border: #4ac5b1; --near-bg: #183b35; --near-text: #a0eddd;
  --far-border: #eeb165; --far-bg: #3c3021; --far-text: #ffdaab;
  --alt-border: #c5a0ed; --alt-bg: #32263e; --alt-text: #e4caff;
}
html[data-theme] #content .muni-card.distance-near { background: var(--near-bg); border-color: var(--near-border); }
html[data-theme] #content .muni-card.distance-far { background: var(--far-bg); border-color: var(--far-border); }
html[data-theme] #content .muni-card.altitude-record:not(.distance-near):not(.distance-far) { background: var(--alt-bg); border-color: var(--alt-border); }
.municipal-distance-legend { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin: 0 0 20px; }
.municipal-distance-legend h2 { font-size: 18px; margin-bottom: 10px; }
.municipal-distance-legend p { font-size: 13px; color: var(--muted); margin-top: 10px; }
.municipal-highlights { margin: 0 12px 12px; font-size: 12px; }
.municipal-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.municipal-badge { display: inline-block; padding: 5px 8px; border: 1px solid; border-radius: 7px; font-size: 12px; font-weight: 750; line-height: 1.5; }
.municipal-badge.distance-near { background: var(--near-bg); color: var(--near-text); border-color: var(--near-border); }
.municipal-badge.distance-far { background: var(--far-bg); color: var(--far-text); border-color: var(--far-border); }
.municipal-badge.altitude-record { background: var(--alt-bg); color: var(--alt-text); border-color: var(--alt-border); }
.municipal-access { display: grid; gap: 8px; margin-top: 10px; }
.municipal-access div { min-width: 0; }
.municipal-access dt { color: var(--muted); font-size: 11px; }
.municipal-access dd { margin: 0; color: var(--text); font-weight: 700; line-height: 1.6; overflow-wrap: break-word; }
.municipal-evidence { margin-top: 10px; font-size: 11px; color: var(--muted); }
.municipal-evidence summary { cursor: pointer; line-height: 1.6; font-weight: 650; }
.municipal-evidence p { margin-top: 8px; overflow-wrap: anywhere; }
.municipal-evidence a { color: var(--near-text) !important; }
/* Referencias iniciales de Municipios: tablas compactas para repaso. */
#referencia-municipal { margin-bottom: 18px; }
#referencia-municipal .reference-section { padding: 12px; margin: 0 0 14px; border-radius: 10px; box-shadow: none; }
#referencia-municipal h2 { font-size: 18px; line-height: 1.4; margin-bottom: 7px; }
#referencia-municipal .reference-heading { margin-bottom: 6px; gap: 6px; }
#referencia-municipal .reference-heading h2 { margin: 0; }
#referencia-municipal .reference-tools { gap: 6px; }
#referencia-municipal .reference-tools :is(button, select) { padding: 5px 7px; font-size: 12px; }
#referencia-municipal .reference-table { font-size: 13px; }
#referencia-municipal .reference-table :is(th, td) { padding: 5px 8px; line-height: 1.5; }
#referencia-municipal .municipal-party-note { margin: 7px 0; padding: 0; border: 0; background: none; border-radius: 0; font-size: 12px; }
#referencia-municipal .municipal-recall { font-size: 12px; margin: 6px 0; color: var(--muted); }
#referencia-municipal .reference-sources { margin-top: 8px; padding-top: 7px; font-size: 12px; }
.provincial-relief-line { font-size: 12px; color: var(--muted); line-height: 1.6; margin: 5px 0 8px; }
#limites-provinciales .reference-table td:nth-child(3) { text-align: center; }
#limites-provinciales .reference-table td:last-child { font-size: 12px; }
@media (max-width: 760px) {
  :is(#referencia-municipal, #comarcas) .study-table-wrap, #comarcas .comarca-grid { overflow-x: auto; }
  #referencia-municipal .reference-table, #comarcas .comarca-table { display: table; min-width: 540px; }
  #referencia-municipal .reference-table thead, #comarcas .comarca-table thead { display: table-header-group; position: static; width: auto; height: auto; overflow: visible; clip-path: none; }
  #referencia-municipal .reference-table tbody, #comarcas .comarca-table tbody { display: table-row-group; }
  #referencia-municipal .reference-table tr, #comarcas .comarca-table tr { display: table-row; padding: 0; border: 0; }
  #referencia-municipal .reference-table td, #comarcas .comarca-table td { display: table-cell; border-bottom: 1px solid var(--border); border-radius: 0; }
  #referencia-municipal .reference-table td::before, #comarcas .comarca-table td::before { display: none; }
  #comarcas .ext-box { min-width: 0; }
}

/* Organización del cuaderno y práctica: mismos colores en claro y oscuro. */
.study-section-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0; }
.study-section-nav button { display: flex; align-items: center; gap: 9px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; color: var(--text); background: var(--card-bg); font: 650 14px/1.4 system-ui; cursor: pointer; }
.study-section-nav small { padding: 1px 7px; border-radius: 6px; background: var(--study-key-bg); color: var(--study-key-text); }
.section-caption { color: var(--muted); margin: 0 0 14px; line-height: 1.6; }
.study-topic, .study-practice { margin: 14px 0; border: 1px solid var(--border); border-radius: 14px; background: var(--card-bg); color: var(--text); overflow: hidden; }
.study-topic > summary, .study-practice > summary { display: flex; align-items: center; gap: 12px; padding: 18px; cursor: pointer; font-weight: 750; line-height: 1.5; list-style: none; }
.study-topic > summary::-webkit-details-marker, .study-practice > summary::-webkit-details-marker { display: none; }
.study-topic > summary::before, .study-practice > summary::before { content: '›'; font-size: 24px; line-height: 1; flex: 0 0 12px; }
.study-topic[open] > summary::before, .study-practice[open] > summary::before { transform: rotate(90deg); }
.study-topic > summary > span, .study-practice > summary > span { flex: 1; min-width: 0; }
.study-topic > summary > small, .study-practice > summary > small { color: var(--muted); font-size: 12px; font-weight: 500; }
.study-topic[open] > summary, .study-practice[open] > summary { border-bottom: 1px solid var(--border); }
.topic-body { padding: 16px; }
.topic-body > .water-section { margin: 0; box-shadow: none; }
.group-reference { margin: 14px 18px; }
.group-reference .group-note { margin: 0; }
.connection-part { margin-bottom: 20px; }
.connection-part h3 { margin-top: 0; }
.connection-card .water-section { padding: 20px; }
.study-topic .topic-body > .peak-card { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); border: 0; align-items: start; }
.study-topic .peak-card > .study-image-button { max-width: 480px; margin: 0 auto; }
.study-topic .peak-card-body { min-width: 0; padding: 0 0 0 20px; }
.study-topic .peak-card .study-image { border-radius: 10px; }
:is(.study-topic, .study-practice, #grupos-de-picos, #puertos-de-montana, #sierras-y-enclaves, #historias-de-carreteras, #conexiones-de-carreteras, .practice-quiz) { scroll-margin-top: var(--scis-header-offset, 12px); }
.study-practice { border-left: 4px solid var(--scis-red); }
.practice-body { padding: 20px; }
.practice-caption { color: var(--muted); line-height: 1.65; max-width: 80ch; margin-bottom: 18px; }
.practice-controls { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 14px; max-width: 800px; }
.practice-controls label { display: grid; gap: 7px; font-size: 13px; font-weight: 700; }
.practice-controls select { width: 100%; min-width: 0; padding: 12px; border: 1px solid var(--border); border-radius: 9px; color: var(--text); background: var(--bg); font: inherit; font-size: 16px; }
.practice-body button { min-height: 44px; padding: 10px 16px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg); color: var(--text); font: 650 15px/1.5 system-ui; cursor: pointer; }
.practice-body button.practice-primary { background: #a51f2c; border-color: #a51f2c; color: #fff; }
.practice-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 12px; }
.practice-body button:disabled { cursor: default; }
.practice-actions button:disabled { opacity: .55; }
.practice-status, .practice-storage { font-size: 13px; line-height: 1.6; color: var(--muted); }
.practice-storage { margin-top: 18px; }
.practice-quiz:not(:empty) { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.practice-step { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); }
.practice-quiz progress { display: block; width: 100%; height: 6px; margin: 10px 0 20px; accent-color: var(--scis-green); }
.practice-quiz h3 { font-size: clamp(18px, 2.2vw, 24px); line-height: 1.5; max-width: 75ch; margin: 0 0 20px; }
.practice-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.practice-choices button { display: flex; align-items: center; gap: 12px; text-align: left; min-height: 64px; }
.practice-controls-municipal { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.practice-question-image { width: min(100%, 320px); margin: 14px auto 20px; }
.practice-question-image img { max-height: 280px; object-fit: contain; }
.practice-quiz:focus { outline: none; }
#municipal-practice { margin-bottom: 20px; scroll-margin-top: var(--scis-header-offset, 12px); }
.practice-choices button.is-correct { color: var(--near-text); background: var(--near-bg); border: 2px solid var(--near-border); }
.practice-choices button.is-wrong { color: var(--far-text); background: var(--far-bg); border: 2px solid var(--far-border); }
.practice-feedback:not(:empty) { margin-top: 20px; padding: 18px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); }
.practice-feedback p { margin: 0 0 14px; line-height: 1.75; }
.practice-verdict { font-size: 18px; font-weight: 750; }
.practice-feedback figure { width: min(100%, 380px); margin: 18px 0; }
.practice-feedback .study-image { max-height: 360px; object-fit: contain; }
.practice-feedback figcaption { font-size: 12px; color: var(--muted); margin-top: 6px; }
.practice-warning { margin: 14px 0; }
.practice-warning summary { font-weight: 700; cursor: pointer; margin-bottom: 10px; }
.practice-feedback a { color: var(--study-key-text); text-underline-offset: 3px; }
:is(.study-section-nav button, .study-topic > summary, .study-practice > summary, .practice-body button, .practice-body select, #back-to-top):focus-visible { outline: 3px solid #d8a600; outline-offset: 3px; }
#back-to-top { position: fixed; z-index: 90; right: max(16px, env(safe-area-inset-right)); bottom: max(20px, env(safe-area-inset-bottom)); display: grid; place-items: center; width: 48px; height: 48px; padding: 0; border: 1px solid var(--border); border-radius: 50%; color: var(--text); background: var(--card-bg); background: color-mix(in srgb, var(--card-bg) 85%, transparent); backdrop-filter: blur(8px); box-shadow: 0 3px 16px #0002; cursor: pointer; font: 500 27px/1 system-ui; transition: background .2s, box-shadow .2s; }
#back-to-top:hover, #back-to-top:focus-visible { background: var(--card-bg); box-shadow: 0 4px 20px #0004; }
#back-to-top[hidden] { display: none; }
@media (max-width: 760px) {
  .study-topic .topic-body > .peak-card { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .study-topic .peak-card-body { padding: 0; }
  .topic-body, .practice-body { padding: 14px; }
  .practice-controls, .practice-controls-municipal, .practice-choices { grid-template-columns: minmax(0, 1fr); }
  .study-topic > summary, .study-practice > summary { padding: 14px; flex-wrap: wrap; gap: 8px; }
  .study-topic > summary > small, .study-practice > summary > small { flex-basis: 100%; padding-left: 20px; }
  .practice-feedback:not(:empty) { padding: 12px; }
  .study-section-nav button { padding: 9px 12px; }
  .group-reference { margin: 12px; }
  body { padding-bottom: 72px; }
}
@media (prefers-reduced-motion: reduce) { #back-to-top { transition: none; } }
.municipal-scene-image { border-radius: 0; }
.municipal-scene-image .muni-img { max-width: none; height: auto; aspect-ratio: auto; object-fit: contain; border-radius: 0; box-shadow: none; }
.municipal-face-front[hidden], .municipal-face-back[hidden] { display: none !important; }
.municipal-name-flip { font: inherit; font-weight: inherit; color: inherit; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; min-height: 38px; }
.municipal-name-flip span { display: inline-block; color: var(--muted); font-size: 16px; }
.municipal-flip-button { min-height: 42px; padding: 8px 12px; background: var(--card-bg); color: var(--text); border: 1px solid var(--border); border-radius: 9px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.municipal-highlights > .municipal-flip-button { margin-top: 12px; width: 100%; }
.municipal-name-flip:focus-visible, .municipal-flip-button:focus-visible { outline: 3px solid var(--scis-gold, #dba837); outline-offset: 2px; }
.municipal-reverse-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px; }
.municipal-reverse-header > div { min-width: 0; }
.municipal-reverse-header span { font-size: 10px; font-weight: 750; letter-spacing: .06em; color: var(--muted); }
.municipal-reverse-header h3 { margin: 3px 0 0; font-size: 17px; line-height: 1.35; }
.municipal-face-back > .study-image-button { width: 100%; display: block; border-radius: 0; }
.municipal-face-back .study-image { display: block; width: 100%; height: auto; aspect-ratio: auto; object-fit: contain; }
.municipal-reverse-body { padding: 14px; font-size: 14px; line-height: 1.65; }
.municipal-mnemonics { margin: 14px 0; display: grid; gap: 7px; }
.municipal-mnemonics > div { border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; background: var(--card-bg); }
.municipal-mnemonics dt { font-weight: 800; color: var(--text); }
.municipal-mnemonics dd { margin: 2px 0 0; color: var(--text); }
.municipal-reverse-access { border-top: 1px solid var(--border); padding-top: 12px; }
.municipal-reverse-access h4 { font-size: 13px; margin: 0; }
.municipal-reverse-note { margin-top: 14px; color: var(--text); font-size: 13px; }
.municipal-reverse-source { margin-top: 12px; color: var(--muted); font-size: 11px; }
.has-reverse .municipal-face-front, .has-reverse .municipal-face-back { animation: municipal-turn .18s ease-out; }
.connection-with-scene { display: grid; grid-template-columns: minmax(240px, .85fr) minmax(0, 1.4fr); gap: 18px; padding: 18px; align-items: start; }
.connection-scene { margin: 0; min-width: 0; }
.connection-scene .study-image-button { display: block; width: 100%; }
.connection-scene .study-image { width: 100%; height: auto; object-fit: contain; }
.connection-scene figcaption { font-size: 13px; line-height: 1.6; color: var(--muted); padding-top: 8px; }
.connection-with-scene > article { min-width: 0; }
.connection-with-scene :is(code, a) { overflow-wrap: anywhere; white-space: normal; }
html[data-theme="dark"] .une-card .une-notice > strong { color: var(--text); }
@keyframes municipal-turn { from { opacity: .45; transform: rotateY(-7deg); } to { opacity: 1; transform: none; } }
@media (max-width: 760px) { .connection-with-scene { grid-template-columns: minmax(0, 1fr); padding: 12px; } }
@media (prefers-reduced-motion: reduce) { .has-reverse .municipal-face-front, .has-reverse .municipal-face-back { animation: none; } }

/* Piloto compacto: solo Pedanías y Lagunas, con la escala de Municipios. */
.pedania-block { margin: 30px 0; scroll-margin-top: var(--scis-header-offset, 12px); }
.pedania-block > h2 { font-size: 23px; line-height: 1.35; margin-bottom: 7px; }
.pedania-block-caption { color: var(--muted); line-height: 1.7; margin-bottom: 18px; max-width: 90ch; }
.study-compact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 12px; align-items: start; }
.pedania-card { min-width: 0; border: 2px solid var(--border); border-top: 3px solid var(--scis-gold, #c08a24); border-radius: var(--radius); background: var(--card-bg); color: var(--text); overflow: hidden; scroll-margin-top: var(--scis-header-offset, 12px); }
.study-compact-header { padding: 10px 12px; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.study-compact-header > div { min-width: 0; }
.study-compact-header h3 { font-size: 16px; line-height: 1.4; margin: 2px 0 0; }
.pedania-priority { font-size: 11px; font-weight: 750; letter-spacing: .04em; color: var(--muted); }
.pedania-count { flex-shrink: 0; max-width: 110px; padding: 4px 7px; background: var(--study-key-bg); color: var(--study-key-text); border-radius: 6px; font-size: 10px; font-weight: 700; }
.pedania-card-body { padding: 0 12px 10px; }
.pedania-group-note, .pedania-note { font-size: 13px; line-height: 1.65; color: var(--text); margin: 10px 0; }
.pedania-scene { margin: 0 -12px 8px; }
.pedania-scene + .pedania-scene { border-top: 1px solid var(--border); padding-top: 8px; }
.pedania-scene > .study-image-button { position: relative; width: 100%; border-block: 1px solid var(--border); border-radius: 0; background: var(--bg); }
.pedania-scene > .study-image-button::after { content: '⤢'; position: absolute; right: 8px; bottom: 8px; width: 28px; height: 28px; border: 1px solid var(--border); border-radius: 6px; background: var(--card-bg); color: var(--text); font-size: 22px; line-height: 25px; pointer-events: none; }
.pedania-scene .study-image { display: block; width: 100%; max-width: 330px; height: auto; aspect-ratio: 1; object-fit: contain; border: 0; border-radius: 0; box-shadow: none; }
.pedania-scene figcaption { min-width: 0; padding: 0 12px; }
.pedania-word { display: block; font-size: 16px; line-height: 1.4; font-weight: 800; text-align: center; padding: 6px 9px; margin: 8px 0; background: var(--study-key-bg); color: var(--study-key-text); border-radius: 8px; overflow-wrap: anywhere; }
.pedania-story { font-size: 13px; line-height: 1.65; margin-top: 8px; }
.study-compact-details { margin-top: 8px; border-top: 1px solid var(--border); font-size: 13px; }
.study-compact-details > summary { padding: 9px 0; color: var(--muted); font-size: 12px; font-weight: 700; cursor: pointer; }
.study-compact-details > summary:focus-visible { outline: 3px solid #d8a600; outline-offset: 2px; }
.study-compact-card .municipal-mnemonics { gap: 6px; margin: 10px 0; }
.study-compact-card .municipal-mnemonics > div { padding: 7px 9px; font-size: 13px; }
.study-compact-links { display: flex; flex-wrap: wrap; gap: 5px 7px; margin: 10px 0; font-size: 12px; line-height: 1.5; }
.study-compact-links > span { max-width: 100%; padding: 3px 7px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); }
.study-compact-links b { color: var(--study-key-text); font-size: 10px; }
.study-compact-facts { display: grid; gap: 7px; margin: 10px 0; font-size: 12px; line-height: 1.5; }
.study-compact-facts > div { padding-bottom: 7px; border-bottom: 1px solid var(--border); }
.study-compact-facts > div:last-child { padding-bottom: 0; border-bottom: 0; }
.study-compact-facts dt { font-weight: 800; }
.study-compact-facts dd { margin: 1px 0 0; }
.study-compact-facts small { display: block; color: var(--study-key-text); font-size: 11px; }
.water-memory-card { border-top-color: #318d99; }
.bic-card { border-top-color: #ac7e35; }
.bic-card .study-compact-header h3 { overflow-wrap: anywhere; }
.bic-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin: 20px 0; }
.bic-controls label { display: grid; gap: 6px; font-size: 13px; max-width: 100%; }
.bic-controls select { max-width: 100%; min-width: 0; width: min(100%, 330px); padding: 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--card-bg); color: var(--text); font: inherit; }
.bic-controls p, .bic-locality { font-size: 13px; color: var(--muted); }
.bic-card[hidden], .bic-block[hidden], .study-section-nav [data-section-target^="bic-bloque-"][hidden] { display: none; }
.bic-media-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 7px; margin: 0 -6px 8px; }
.bic-media-pair figure { min-width: 0; margin: 0; }
.bic-media-pair figcaption { font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 5px; text-align: center; }
.bic-media-pair .study-image-button { display: block; position: relative; width: 100%; height: 178px; background: var(--bg); }
.bic-media-pair .study-image { display: block; width: 100%; height: 100%; max-width: none; border: 0; border-radius: 0; box-shadow: none; object-fit: contain; }
.bic-source-links { font-size: 12px; overflow-wrap: anywhere; }
.bic-source-links a { color: var(--study-key-text); }
.practice-quiz .bic-media-pair { max-width: 620px; margin: 12px 0; }
.practice-quiz .bic-media-pair .study-image-button { height: 250px; }
@media (max-width: 480px) { .bic-controls { display: block; } .bic-controls select { width: 100%; } .practice-quiz .bic-media-pair .study-image-button { height: 190px; } }
.water-memory-card .study-compact-facts dd { overflow-wrap: anywhere; }
.water-memory-sources { font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.water-memory-sources a { color: var(--study-key-text) !important; }
.pedania-list-title { font-size: 14px; margin: 18px 0 12px; }
.pedania-places { list-style: none; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 0; margin: 0 0 14px; }
.pedania-place { padding: 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); scroll-margin-top: var(--scis-header-offset, 12px); }
.pedania-place-heading { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.pedania-place h4 { font-size: 14px; line-height: 1.5; }
.pedania-place p { margin-top: 7px; font-size: 12px; line-height: 1.65; }
.pedania-badge { display: inline-block; padding: 4px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 11px; line-height: 1.45; font-weight: 750; color: var(--study-key-text); background: var(--study-key-bg); }
.pedania-badge[data-kind="eatim"] { color: #694800; background: #fff1c5; border-color: #cfab50; }
.pedania-badge[data-kind="patrimonio"] { color: #6c2a44; background: #fbeaf0; border-color: #d8a9ba; }
html[data-theme="dark"] .pedania-badge[data-kind="eatim"] { color: #f9dc91; background: #42351c; border-color: #9b8044; }
html[data-theme="dark"] .pedania-badge[data-kind="patrimonio"] { color: #f5c3d7; background: #3e2934; border-color: #936079; }
.pedania-alias { color: var(--muted); }
.pedania-sources { font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.pedania-sources summary { cursor: pointer; font-weight: 700; padding: 6px 0; }
.pedania-sources a { color: var(--study-key-text); text-underline-offset: 3px; }
.pedania-sources p { margin: 7px 0 12px; }
.pedania-sources ul { padding-left: 20px; }
.pedania-confusions { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 12px; align-items: start; }
.pedania-confusion { background: var(--card-bg); border: 1px solid var(--border); padding: 12px; border-radius: 12px; scroll-margin-top: var(--scis-header-offset, 12px); }
.pedania-confusion h3 { font-size: 16px; margin-bottom: 12px; line-height: 1.5; }
.pedania-confusion dl > div, .pedania-legend > div { margin: 10px 0; }
.pedania-confusion dt, .pedania-legend dt { font-weight: 750; font-size: 14px; }
.pedania-confusion dd, .pedania-legend dd { margin: 2px 0 0; font-size: 14px; line-height: 1.65; }
.pedania-confusion p { margin-top: 12px; font-size: 13px; line-height: 1.7; }
.lagoon-card { border-top-color: #318d99; }
.lagoon-territory { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.lagoon-place strong { overflow-wrap: anywhere; }
.lagoon-matices { margin: 14px 0; }
.lagoon-context { margin: 18px 0; }
.lagoon-context h4 { margin: 14px 0; font-size: 16px; }
.lagoon-context p { line-height: 1.75; }
.lagoon-comparison strong { color: var(--study-key-text); }
.municipal-arrival { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin: 8px 0; padding: 7px 9px; border: 1px solid var(--border); border-radius: 7px; font-size: 12px; }
.municipal-arrival > span, .municipal-arrival small { color: var(--muted); }
.municipal-arrival small { margin-left: auto; font-size: 12px; }
@media (max-width: 760px) {
  #study-image-dialog { width: calc(100% - 32px); max-width: calc(100% - 32px); }
}

/* La misma escala de repaso en historias, carreteras, orografía y UNE. */
.study-compact-card:is(.history-card, .peak-card, .connection-card, .une-card) { border: 2px solid var(--border); border-top: 3px solid var(--scis-gold, #c08a24); background: var(--card-bg); color: var(--text); box-shadow: none; }
.study-compact-card.une-card { display: block; padding: 0; }
.study-compact-card .study-compact-header h3, .study-compact-header > h3 { min-width: 0; margin: 2px 0 0; font-size: 16px; line-height: 1.4; overflow-wrap: anywhere; }
.study-compact-card .pedania-scene { margin: 0 -12px 8px; }
.study-compact-card .pedania-scene .study-image { display: block; width: 100%; max-width: 330px; height: auto; aspect-ratio: 1; object-fit: contain; }
.study-compact-card .une-word { display: block; font-size: 16px; margin: 8px 0; }
.study-compact-card .une-topic { margin: 8px 0; font-size: 13px; line-height: 1.55; }
.compact-card-caption { margin: 8px 0; color: var(--muted); font-size: 12px; line-height: 1.55; overflow-wrap: anywhere; }
.road-test-facts { margin: 8px 0; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.road-test-facts > div { padding: 7px 0; border-bottom: 1px solid var(--border); }
.road-test-facts dt { font-weight: 700; color: var(--study-key-text); }
.road-test-facts dt span { color: var(--text); }
.road-test-facts dd { margin: 2px 0 0; }
.study-mode .compact-peak-group.peak-group { border: 0; background: transparent; box-shadow: none; overflow: visible; }
.compact-peak-group > .study-compact-grid { margin: 12px 0; }
.study-compact-card .water-section { margin: 0; padding: 0; border: 0; background: transparent; box-shadow: none; }
.study-compact-card .study-table { min-width: 0; font-size: 13px; }
.study-compact-card .study-chain { padding: 8px; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.study-compact-card .connection-part { font-size: 13px; line-height: 1.65; }
.study-compact-card :is(.compact-card-caption, .study-compact-details) a { color: var(--study-key-text) !important; }
.study-compact-card :is(code, a) { overflow-wrap: anywhere; white-space: normal; }
