@font-face {
    font-family: 'Fuzzy Bubbles';
    src: url('fonts/FuzzyBubbles-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}
@font-face {
    font-family: 'Fuzzy Bubbles';
    src: url('fonts/FuzzyBubbles-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
}

:root {
    --bg: #f4f6f8;
    --card-bg: #ffffff;
    --text: #2c3e50;
    --accent: #5a7d9a;
    --good: #2e7d32;
    --hard: #ef6c00;
    --again: #c62828;
    --perfect: #1976d2;
    --border: #dce1e6;
    --shadow: 0 4px 12px rgba(0,0,0,0.05);
    --radius: 12px;
    --theme-color: GhostWhite;
    --button-color: SlateBlue;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-weight: 400;
    background: var(--theme-color);
    color: var(--text);
}

.page-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    flex-direction: column;
    padding: 1rem;
    background: transparent;
}

.app-shell {
    width: 100%;
    max-width: 680px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2.8rem 1.5rem 1.5rem 1.5rem;
    position: relative;
}

button {
    background: var(--button-color);
    color: white;
    border: none;
    padding: 0.6rem 1.3rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: background 0.2s, opacity 0.2s;
    outline: none;
}
button:hover { opacity: 0.9; }
button:disabled { opacity: 0.5; cursor: default; }
button.secondary { background: #757575; }
button.danger { background: var(--again); }
button.small { padding: 0.3rem 0.9rem; font-size: 0.8rem; }

/* Solo los campos de texto ocupan el ancho. Radios y casillas se quedan con su
   tamaño natural: la regla anterior los convertía en bloques y descuadraba todos
   los formularios. */
input:not([type="radio"]):not([type="checkbox"]):not([type="range"]), textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font: inherit;
    font-size: 0.95rem;
    background: #fafafa;
}
input[type="radio"], input[type="checkbox"] {
    width: auto;
    margin: 0 0.4rem 0 0;
    padding: 0;
    vertical-align: middle;
}

/* Formularios: un mismo esqueleto para todos. */
.form { display: flex; flex-direction: column; gap: 0.9rem; }
.form-field { display: flex; flex-direction: column; gap: 0.3rem; }
.form-field > label, .form-label { font-size: 0.85rem; color: #666; font-weight: 500; }
.form-help { font-size: 0.8rem; color: #777; margin: 0; }
.form-check { display: flex; align-items: center; gap: 0.1rem; font-size: 0.9rem; }
.form-radio { display: flex; flex-direction: column; gap: 0.35rem; }
.form-radio label { display: flex; align-items: center; font-size: 0.9rem; font-weight: 400; color: inherit; }
.form-actions { display: flex; gap: 0.6rem; justify-content: flex-end; }
fieldset.form-field { border: 0; padding: 0; margin: 0; min-width: 0; }

.hidden { display: none !important; }

/* Pestañas */
.tab-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 1.5rem;
    justify-content: center;
}
.tab-btn {
    padding: 0.4rem 0.8rem;
    background: transparent;
    color: #555;
    border-radius: 0;
    border-bottom: 2px solid transparent;
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
    font-size: 1rem;
    text-decoration: none;
}
.tab-btn.active {
    background: transparent;
    color: var(--accent);
    border-bottom-color: var(--accent);
}
a.tab-btn { text-decoration: none !important; }

/* Nombre de categoría (enlace) */
.category-name {
    font-family: 'Fuzzy Bubbles', 'Comic Sans MS', cursive;
    color: var(--button-color);
    text-align: center;
    font-size: 1.1rem;
    margin-top: 0.2rem;
    margin-bottom: 1rem;
    text-decoration: none;
    display: block;
}
.category-name:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* Icono de ayuda */
.help-link {
    position: absolute;
    top: 0.8rem;
    right: 0.8rem;
    font-size: 1rem;
    text-decoration: none;
    color: #aaa;
    transition: color 0.2s;
    z-index: 10;
}
.help-link:hover { color: var(--accent); }

/* Acceso a la cuenta, junto al número de versión */
.account-link {
    position: absolute;
    top: 0.8rem;
    right: 2.2rem;
    font-size: 1rem;
    text-decoration: none;
    color: #aaa;
    transition: color 0.2s;
    z-index: 10;
}
.account-link:hover { color: var(--accent); }


/* Cabecera principal */
.app-header {
    position: absolute;
    top: 0.8rem;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Courier', monospace;
    font-size: 1rem;
    color: var(--text);
    font-weight: 700;
    white-space: nowrap;
    z-index: 9;
    margin: 0;
    line-height: 1.2;
}
.app-header a { text-decoration: none; color: inherit; }
.app-header a:hover { opacity: 0.8; }

.version-badge {
    position: absolute;
    top: 0.8rem;
    right: 3.8rem;
    font-size: 0.7rem;
    color: #999;
    z-index: 11;
    font-weight: 400;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    margin-bottom: 1.2rem;
    font-size: 0.85rem;
    color: #777;
}

/* La copia en la nube va centrada y fuera del flujo: así «N tarjetas restantes»
   sigue pegado a la derecha, como antes. */
#sync-status {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    max-width: 52%;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.8rem;
    pointer-events: none;
}

.card-face {
    background: #fdfdfd;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.3rem;
    margin-bottom: 1rem;
    position: relative;
}

.question-text { font-size: 1.1rem; margin-bottom: 1rem; line-height: 1.5; }
.answer-area { margin: 1rem 0; }
#user-answer { height: auto; min-height: 2.5rem; margin-bottom: 0.8rem; }

.feedback-box {
    padding: 1rem;
    border-radius: 10px;
    margin: 1rem 0;
    font-weight: 500;
}
.feedback-box.again { background: #ffebee; border-left: 4px solid var(--again); }
.feedback-box.hard  { background: #fff3e0; border-left: 4px solid var(--hard); }
.feedback-box.good  { background: #e8f5e9; border-left: 4px solid var(--good); }
.feedback-box.perfect { background: #e3f2fd; border-left: 4px solid var(--perfect); }

.extra-info {
    background: #f3f5fd;
    padding: 1rem;
    border-radius: 10px;
    margin: 1rem 0;
    line-height: 1.5;
}

.discard-btn {
    position: absolute;
    top: 0.4rem;
    right: 0.6rem;
    background: none;
    border: none;
    color: #aaa;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
}
.discard-btn:hover { color: var(--again); }

.settings-block {
    background: #f8f8f8;
    border-radius: 12px;
    padding: 1.2rem;
    margin-bottom: 1.2rem;
}
.settings-block h3 { margin-bottom: 0.8rem; }

/* Rejilla colapsable */
details.card-grid-details {
    margin: 1rem 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.8rem 1rem;
    background: #fafbfc;
    transition: background 0.2s;
}
details.card-grid-details[open] {
    background: #f0f2f5;
}
details.card-grid-details summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
details.card-grid-details summary::-webkit-details-marker {
    display: none;
}
details.card-grid-details summary::before {
    content: '▶';
    display: inline-block;
    font-size: 0.8rem;
    transition: transform 0.2s;
    margin-right: 0.3rem;
}
details.card-grid-details[open] summary::before {
    transform: rotate(90deg);
}

.card-grid {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

.card-dot {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: white;
    cursor: default;
    transition: background 0.2s;
}

.dot-pending  { background: #9e9e9e; }
.dot-new      { background: #fdd835; color: #333; }
.dot-again    { background: #c62828; }
.dot-hard     { background: #ef6c00; }
.dot-good     { background: #2e7d32; }
.dot-perfect  { background: #1976d2; }
.dot-mastered { background: #7b1fa2; }
.dot-discarded{ background: #e53935; }
.dot-obsolete { background: #a1887f; }

.card-grid a.card-dot {
    text-decoration: none !important;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: none !important;
    box-shadow: none !important;
}
.card-grid a.card-dot:hover {
    text-decoration: none !important;
    opacity: 0.8;
    transform: scale(1.1);
    transition: 0.2s;
}
/* Especificidad aumentada para no depender del orden en el archivo */
.card-grid a.card-dot.dot-new { color: #333; }

#level-indicator {
    font-size: 1rem;
    color: var(--accent);
    margin: 0.8rem 0;
    text-align: center;
    font-weight: 500;
}

.progress-link {
    display: block;
    margin: 1.5rem auto 0 auto;
    text-align: center;
    text-decoration: none !important;
}

.breadcrumb { margin-bottom: 1.5rem; font-size: 0.9rem; color: #777; }
.breadcrumb a { color: var(--accent); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

.summary-title { font-size: 1.4rem; margin-bottom: 1.5rem; font-weight: 600; color: var(--text); }

.stats-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.6rem;
    margin-bottom: 1.5rem;
}
.stat-item {
    background: #f0f3f6;
    border-radius: 6px;
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: #555;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
.stat-item strong { color: var(--text); margin-right: 0.1rem; }

.level-section h3 {
    font-size: 1rem;
    font-weight: 500;
    color: var(--accent);
    background: #edf1f4;
    padding: 0.5rem 0.8rem;
    border-radius: 6px;
    margin: 1rem 0 0.5rem;
}

.card-detail-title { font-size: 1.3rem; margin-bottom: 0.5rem; font-weight: 600; }
.card-detail-subtitle { font-size: 0.9rem; color: #777; margin-bottom: 1.2rem; }
.detail-section { margin-bottom: 1.2rem; }
.detail-section h3 { font-size: 1rem; font-weight: 500; margin-bottom: 0.5rem; color: var(--accent); }

.detail-table { width: 100%; border-collapse: collapse; }
.detail-table td { padding: 0.3rem 0; font-size: 0.9rem; border-bottom: 1px solid #f0f0f0; }
.detail-table td:first-child { font-weight: 500; color: #555; width: 40%; }

.meta-block, .progress-block { background: #f8f8f8; border-radius: 12px; padding: 1rem; margin: 1rem 0; }
.progress-block ul { list-style: none; padding-left: 0; }
.progress-block li { margin: 0.2rem 0; }

/* Footer blanco */
.app-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.75rem;
    color: #ffffff;
    background: transparent;
    padding: 0.5rem;
}
.app-footer a { color: #ffffff; text-decoration: none; }
.app-footer a:hover { text-decoration: underline; }

/* Píldoras de tags (botones pequeños) */
.tag-pill {
    display: inline-block;
    padding: 0.3rem 0.7rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: white !important;
    text-decoration: none !important;
    margin: 0.15rem 0.2rem;
    transition: opacity 0.2s, transform 0.1s;
}
.tag-pill:hover,
.tag-pill:focus {
    opacity: 0.85;
    transform: scale(1.05);
    text-decoration: none !important;
}
.tag-pill:active {
    transform: scale(0.97);
}

/* CONTENIDO RENDERIZADO MARKDOWN */

:is(.card-face, .extra-info, .detail-section, #wiki-content) p {
  margin-bottom: 0.8rem;
}

:is(.card-face, .extra-info, .detail-section, #wiki-content) :is(h1, h2, h3, h4, h5, h6) {
  margin-top: 1.2rem;
  margin-bottom: 0.6rem;
}

/* Listas, incluidas las anidadas */

:is(.card-face, .extra-info, .detail-section, #wiki-content) :is(ul, ol) {
  padding-left: 1.5rem;
  margin-bottom: 0.8rem;
}

:is(.card-face, .extra-info, .detail-section, #wiki-content) li {
  margin-bottom: 0.3rem;
}

:is(.card-face, .extra-info, .detail-section, #wiki-content) :is(ul, ol) :is(ul, ol) {
  margin-top: 0.3rem;
  margin-bottom: 0.3rem;
}

/* Tablas */

/* Tablas: scroll propio, para que no desplace la pagina */
.table-wrap {
  overflow-x: auto;
  margin: 0.8rem 0;
  -webkit-overflow-scrolling: touch;
}

:is(.card-face, .extra-info, .detail-section, #wiki-content) table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
}

:is(.card-face, .extra-info, .detail-section, #wiki-content) :is(th, td) {
  border: 1px solid #ddd;
  padding: 8px;
}

:is(.card-face, .extra-info, .detail-section, #wiki-content) th {
  background: var(--button-color);
  color: #fff;
  text-align: left;
}

:is(.card-face, .extra-info, .detail-section, #wiki-content) tr:nth-child(even) {
  background-color: #f9f9f9;
}

:is(.card-face, .extra-info, .detail-section, #wiki-content) tr:hover {
  background-color: #f1f1f1;
}

/* Citas y codigo */

:is(.card-face, .extra-info, .detail-section, #wiki-content) blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.4rem 0.8rem;
  margin: 0.8rem 0;
  background: #f0f3f6;
  border-radius: 0 6px 6px 0;
}

:is(.card-face, .extra-info, .detail-section, #wiki-content) pre {
  background: #f0f3f6;
  padding: 0.8rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 0.8rem 0;
  font-size: 0.85rem;
}

:is(.card-face, .extra-info, .detail-section, #wiki-content) code {
  background: #f0f3f6;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-size: 0.85rem;
}

:is(.card-face, .extra-info, .detail-section, #wiki-content) pre code {
  background: none;
  padding: 0;
}

@media (max-width: 480px) {
    .stats-cards { flex-direction: column; align-items: flex-start; gap: 0.3rem; }
    .stat-item { width: 100%; }
}

.start-session-wrapper { display: flex; justify-content: flex-end; margin-top: 1rem; }

/* Modal de cambios */
#change-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.change-modal-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}
.change-modal-content h2 {
    margin-bottom: 1rem;
    color: var(--text);
}
.change-modal-content h3 {
    margin: 1rem 0 0.5rem;
    color: var(--accent);
}
.change-modal-content ul {
    list-style: none;
    padding-left: 0;
    margin: 0.5rem 0;
}
.change-modal-content li {
    margin-bottom: 0.3rem;
}
.change-modal-content a {
    color: var(--accent);
    text-decoration: none;
}
.change-modal-content a:hover {
    text-decoration: underline;
}
#change-modal-close {
    margin-top: 1.5rem;
    width: 100%;
}

/* Banner de tarjeta archivada */
.obsolete-banner {
    background: #fff3e0;
    color: #e65100;
    padding: 0.8rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-weight: 500;
}

/* Salto de pagina en el contenido */
:is(.card-face, .extra-info, .detail-section, #wiki-content) .page-break {
  border-top: 1px dashed #c8cfd6;
  margin: 1.4em 0;
  height: 0;
}

/* Imagenes del contenido: nunca mas anchas que su contenedor */
img { max-width: 100%; height: auto; }

/* Buscador */
.search-panel { background: #fff; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); padding: 0.8rem; margin-bottom: 1.2rem; }
.search-row { display: flex; gap: 0.5rem; align-items: center; }
.search-row input { flex: 1; width: auto; padding: 0.5rem 0.7rem; border: 1px solid #ccc; border-radius: 8px; font-size: 0.95rem; }
.search-close { background: none; border: none; color: #777; cursor: pointer; font-size: 1.1rem; padding: 0.2rem 0.4rem; }
.search-results { margin-top: 0.7rem; max-height: 55vh; overflow-y: auto; }
.search-group { margin-bottom: 0.8rem; }
.search-group h4 { font-size: 0.8rem; text-transform: uppercase; color: #777; margin-bottom: 0.3rem; letter-spacing: 0.03em; }
.search-item { display: block; padding: 0.35rem 0.5rem; border-radius: 6px; text-decoration: none; color: #2c2c2c; }
.search-item:hover { background: #f0f4f8; }
.search-item strong { display: block; font-size: 0.9rem; }
.search-snippet { display: block; font-size: 0.8rem; color: #777; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-hint { font-size: 0.85rem; color: #777; margin-top: 0.5rem; }

/* Diagramas (Pele) */
.pele { margin: 0.8rem 0; overflow-x: auto; --pele-bg: #ffffff; --pele-fg: #2c2c2c;
        --pele-line: #2c2c2c; --pele-muted: #6f6e69; --pele-surface: #f2f0e5;
        --pele-surface-alt: #e6e4d9; --pele-border: #cecdc3; }
.pele svg { max-width: 100%; height: auto; }
.diagram-error-msg { font-size: 0.8rem; color: #8a1f1f; background: #fff3f3;
                     border-left: 3px solid #c62828; padding: 0.3rem 0.5rem; margin: 0.3rem 0; }


/* En pantallas grandes, el contenedor central se queda corto con 680px */
@media (min-width: 1100px) {
  .app-shell { max-width: 900px; }
}
@media (min-width: 1500px) {
  .app-shell { max-width: 1040px; }
}

/* === Bloques de maquetación (libs/bloques.js) === */
/* El tono lo pone el tema (tinte-…); sin tema, el acento de la app. */
.bloque { --tono: var(--accent); --fondo: #fbfcfd; margin: 1.1rem 0; }
.bloque-titulo { font-weight: 700; font-size: 0.78rem; letter-spacing: 0.06em;
    text-transform: uppercase; color: var(--tono-titulo, var(--accent)); margin-bottom: 0.45rem; }
.bloque-cuerpo > :first-child { margin-top: 0; }
.bloque-cuerpo > :last-child { margin-bottom: 0; }

.bloque-card { border: 1.5px solid var(--border); border-left: 4px solid var(--tono);
    border-radius: var(--radius, 8px); padding: 0.9rem 1.1rem; background: var(--fondo); }

.bloque-cita { margin: 1.2rem 0; padding: 0.8rem 1.1rem; border-left: 4px solid var(--tono);
    background: var(--fondo); border-radius: 0 var(--radius, 8px) var(--radius, 8px) 0; }
.bloque-cita-autor { margin-top: 0.4rem; font-size: 0.85rem; color: #7a8a99; font-style: italic; }
.bloque-cita-autor::before { content: "— "; }

.bloque-pasos { list-style: none; counter-reset: paso; margin: 0; padding: 0; }
.bloque-pasos li { counter-increment: paso; position: relative; padding-left: 2.2rem;
    margin-bottom: 0.7rem; }
.bloque-pasos li:last-child { margin-bottom: 0; }
.bloque-pasos li::before { content: counter(paso); position: absolute; left: 0; top: 0;
    width: 1.55rem; height: 1.55rem; border-radius: 50%; background: var(--tono); color: #fff;
    font-size: 0.8rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.paso-titulo { font-weight: 600; }

.bloque-linea-items { list-style: none; margin: 0; padding: 0; }
.bloque-linea-items .hito { position: relative; padding: 0 0 1rem 1.6rem;
    border-left: 2px solid var(--border); }
.bloque-linea-items .hito:last-child { border-left-color: transparent; padding-bottom: 0; }
.hito::before { content: ""; position: absolute; left: -0.42rem; top: 0.35rem;
    width: 0.62rem; height: 0.62rem; border-radius: 50%; background: var(--tono); }
.hito-cuando { display: inline-block; font-size: 0.78rem; font-weight: 700; color: var(--tono-titulo, var(--accent));
    letter-spacing: 0.03em; }
.hito-titulo { font-weight: 600; }
.hito-texto { font-size: 0.92rem; color: #4a5a68; }

.bloque-cifras { display: flex; flex-wrap: wrap; gap: 0.7rem; }
.cifra { flex: 1 1 7rem; border: 1px solid var(--border); border-radius: var(--radius, 8px);
    padding: 0.7rem 0.9rem; background: var(--fondo); }
.cifra-valor { font-size: 1.5rem; font-weight: 700; color: var(--tono-titulo, var(--accent)); line-height: 1.1; }
.cifra-etiqueta { font-size: 0.8rem; color: #6b7c8a; margin-top: 0.15rem; }

.bloque-columnas { display: grid; gap: 1rem; }
/* El título es un hijo de la rejilla: sin esto se come una columna y el resto
   se descuadra. Ocupa toda la fila, sea cual sea el número de columnas. */
.bloque-columnas > .bloque-titulo { grid-column: 1 / -1; margin-bottom: 0; }
.columnas-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.columnas-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.columnas-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.columnas-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.columnas-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.bloque-columna { min-width: 0; }
@media (max-width: 640px) {
    .bloque-columnas { grid-template-columns: minmax(0, 1fr) !important; }
}

.bloque-datos { width: 100%; border-collapse: collapse; font-size: 0.94rem; }
.bloque-datos th, .bloque-datos td { text-align: left; padding: 0.42rem 0.6rem;
    border-bottom: 1px solid #eef1f4; vertical-align: top; }
.bloque-datos th { font-weight: 600; color: #5a6b79; white-space: nowrap; width: 1%; }
.bloque-datos tr:last-child th, .bloque-datos tr:last-child td { border-bottom: none; }
/* Temas semánticos: tono de acento, fondo suave y un tono más oscuro para el
   texto, que es lo que se lee. */
.tinte-info { --tono: #2563eb; --fondo: #eff6ff; --tono-titulo: #1d4ed8; }
.tinte-tip { --tono: #0d9488; --fondo: #ecfdf5; --tono-titulo: #0f766e; }
.tinte-note { --tono: #4b5563; --fondo: #f3f4f6; --tono-titulo: #374151; }
.tinte-cite { --tono: #7c3aed; --fondo: #f5f3ff; --tono-titulo: #6d28d9; }
.tinte-success { --tono: #16a34a; --fondo: #f0fdf4; --tono-titulo: #15803d; }
.tinte-warning { --tono: #d97706; --fondo: #fffbeb; --tono-titulo: #b45309; }
.tinte-danger { --tono: #ea580c; --fondo: #fff7ed; --tono-titulo: #c2410c; }
.tinte-question { --tono: #0284c7; --fondo: #f0f9ff; --tono-titulo: #0369a1; }
.tinte-example { --tono: #0891b2; --fondo: #ecfeff; --tono-titulo: #0e7490; }
.tinte-error { --tono: #dc2626; --fondo: #fef2f2; --tono-titulo: #b91c1c; }
.tinte-task { --tono: #475569; --fondo: #f8fafc; --tono-titulo: #334155; }
.tinte-practice { --tono: #059669; --fondo: #ecfdf5; --tono-titulo: #047857; }


/* Tintes de color: el tono para los acentos y un fondo muy suave.
   Se generan a partir de los nombres de js/colores.js. */
.tinte-aliceblue { --tono: AliceBlue; --fondo: #fdfeff; }
.tinte-antiquewhite { --tono: AntiqueWhite; --fondo: #fefdfa; }
.tinte-aqua { --tono: Aqua; --fondo: #e0ffff; }
.tinte-aquamarine { --tono: Aquamarine; --fondo: #f0fffa; }
.tinte-azure { --tono: Azure; --fondo: #fdffff; }
.tinte-beige { --tono: Beige; --fondo: #fefefb; }
.tinte-bisque { --tono: Bisque; --fondo: #fffcf8; }
.tinte-black { --tono: Black; --fondo: #e0e0e0; }
.tinte-blanchedalmond { --tono: BlanchedAlmond; --fondo: #fffdf9; }
.tinte-blue { --tono: Blue; --fondo: #e0e0ff; }
.tinte-blueviolet { --tono: BlueViolet; --fondo: #f1e6fc; }
.tinte-brown { --tono: Brown; --fondo: #f4e5e5; }
.tinte-burlywood { --tono: BurlyWood; --fondo: #fbf6f1; }
.tinte-cadetblue { --tono: CadetBlue; --fondo: #ecf3f4; }
.tinte-chartreuse { --tono: Chartreuse; --fondo: #f0ffe0; }
.tinte-chocolate { --tono: Chocolate; --fondo: #faede4; }
.tinte-coral { --tono: Coral; --fondo: #fff0ea; }
.tinte-cornflowerblue { --tono: CornflowerBlue; --fondo: #ecf2fd; }
.tinte-cornsilk { --tono: Cornsilk; --fondo: #fffefb; }
.tinte-crimson { --tono: Crimson; --fondo: #fbe3e8; }
.tinte-cyan { --tono: Cyan; --fondo: #e0ffff; }
.tinte-darkblue { --tono: DarkBlue; --fondo: #e0e0f1; }
.tinte-darkcyan { --tono: DarkCyan; --fondo: #e0f1f1; }
.tinte-darkgoldenrod { --tono: DarkGoldenrod; --fondo: #f6f0e2; }
.tinte-darkgray { --tono: DarkGray; --fondo: #f5f5f5; }
.tinte-darkgreen { --tono: DarkGreen; --fondo: #e0ece0; }
.tinte-darkkhaki { --tono: DarkKhaki; --fondo: #f7f6ed; }
.tinte-darkmagenta { --tono: DarkMagenta; --fondo: #f1e0f1; }
.tinte-darkolivegreen { --tono: DarkOliveGreen; --fondo: #ebede6; }
.tinte-darkorange { --tono: DarkOrange; --fondo: #fff1e0; }
.tinte-darkorchid { --tono: DarkOrchid; --fondo: #f3e6f9; }
.tinte-darkred { --tono: DarkRed; --fondo: #f1e0e0; }
.tinte-darksalmon { --tono: DarkSalmon; --fondo: #fcf2ef; }
.tinte-darkseagreen { --tono: DarkSeaGreen; --fondo: #f2f7f2; }
.tinte-darkslateblue { --tono: DarkSlateBlue; --fondo: #e9e8f1; }
.tinte-darkslategray { --tono: DarkSlateGray; --fondo: #e6eaea; }
.tinte-darkturquoise { --tono: DarkTurquoise; --fondo: #e0f9f9; }
.tinte-darkviolet { --tono: DarkViolet; --fondo: #f2e0fa; }
.tinte-deeppink { --tono: DeepPink; --fondo: #ffe3f2; }
.tinte-deepskyblue { --tono: DeepSkyBlue; --fondo: #e0f7ff; }
.tinte-dimgray { --tono: DimGray; --fondo: #ededed; }
.tinte-dodgerblue { --tono: DodgerBlue; --fondo: #e4f2ff; }
.tinte-firebrick { --tono: FireBrick; --fondo: #f6e4e4; }
.tinte-floralwhite { --tono: FloralWhite; --fondo: #fffefd; }
.tinte-forestgreen { --tono: ForestGreen; --fondo: #e4f1e4; }
.tinte-fuchsia { --tono: Fuchsia; --fondo: #ffe0ff; }
.tinte-gainsboro { --tono: Gainsboro; --fondo: #fbfbfb; }
.tinte-ghostwhite { --tono: GhostWhite; --fondo: #fefeff; }
.tinte-gold { --tono: Gold; --fondo: #fffae0; }
.tinte-goldenrod { --tono: Goldenrod; --fondo: #fbf4e4; }
.tinte-gray { --tono: Gray; --fondo: #f0f0f0; }
.tinte-green { --tono: Green; --fondo: #e0f0e0; }
.tinte-greenyellow { --tono: GreenYellow; --fondo: #f5ffe6; }
.tinte-honeydew { --tono: Honeydew; --fondo: #fdfffd; }
.tinte-hotpink { --tono: HotPink; --fondo: #ffedf6; }
.tinte-indianred { --tono: IndianRed; --fondo: #f9ebeb; }
.tinte-indigo { --tono: Indigo; --fondo: #e9e0f0; }
.tinte-ivory { --tono: Ivory; --fondo: #fffffd; }
.tinte-khaki { --tono: Khaki; --fondo: #fdfcf1; }
.tinte-lavender { --tono: Lavender; --fondo: #fcfcfe; }
.tinte-lavenderblush { --tono: LavenderBlush; --fondo: #fffdfe; }
.tinte-lawngreen { --tono: LawnGreen; --fondo: #efffe0; }
.tinte-lemonchiffon { --tono: LemonChiffon; --fondo: #fffef9; }
.tinte-lightblue { --tono: LightBlue; --fondo: #f5fafc; }
.tinte-lightcoral { --tono: LightCoral; --fondo: #fdf0f0; }
.tinte-lightcyan { --tono: LightCyan; --fondo: #fbffff; }
.tinte-lightgoldenrodyellow { --tono: LightGoldenrodYellow; --fondo: #fefefa; }
.tinte-lightgray { --tono: LightGray; --fondo: #fafafa; }
.tinte-lightgreen { --tono: LightGreen; --fondo: #f2fdf2; }
.tinte-lightpink { --tono: LightPink; --fondo: #fff6f8; }
.tinte-lightsalmon { --tono: LightSalmon; --fondo: #fff4ef; }
.tinte-lightseagreen { --tono: LightSeaGreen; --fondo: #e4f6f5; }
.tinte-lightskyblue { --tono: LightSkyBlue; --fondo: #f1f9fe; }
.tinte-lightslategray { --tono: LightSlateGray; --fondo: #eff1f3; }
.tinte-lightsteelblue { --tono: LightSteelBlue; --fondo: #f6f8fb; }
.tinte-lightyellow { --tono: LightYellow; --fondo: #fffffb; }
.tinte-lime { --tono: Lime; --fondo: #e0ffe0; }
.tinte-limegreen { --tono: LimeGreen; --fondo: #e6f9e6; }
.tinte-linen { --tono: Linen; --fondo: #fefdfc; }
.tinte-magenta { --tono: Magenta; --fondo: #ffe0ff; }
.tinte-maroon { --tono: Maroon; --fondo: #f0e0e0; }
.tinte-mediumaquamarine { --tono: MediumAquamarine; --fondo: #edf9f5; }
.tinte-mediumblue { --tono: MediumBlue; --fondo: #e0e0f9; }
.tinte-mediumorchid { --tono: MediumOrchid; --fondo: #f7ebfa; }
.tinte-mediumpurple { --tono: MediumPurple; --fondo: #f2eefb; }
.tinte-mediumseagreen { --tono: MediumSeaGreen; --fondo: #e8f6ee; }
.tinte-mediumslateblue { --tono: MediumSlateBlue; --fondo: #efedfd; }
.tinte-mediumspringgreen { --tono: MediumSpringGreen; --fondo: #e0fef3; }
.tinte-mediumturquoise { --tono: MediumTurquoise; --fondo: #e9f9f9; }
.tinte-mediumvioletred { --tono: MediumVioletRed; --fondo: #f8e3f0; }
.tinte-midnightblue { --tono: MidnightBlue; --fondo: #e3e3ee; }
.tinte-mintcream { --tono: MintCream; --fondo: #fefffe; }
.tinte-mistyrose { --tono: MistyRose; --fondo: #fffcfb; }
.tinte-moccasin { --tono: Moccasin; --fondo: #fffcf6; }
.tinte-navajowhite { --tono: NavajoWhite; --fondo: #fffbf5; }
.tinte-navy { --tono: Navy; --fondo: #e0e0f0; }
.tinte-oldlace { --tono: OldLace; --fondo: #fffefc; }
.tinte-olive { --tono: Olive; --fondo: #f0f0e0; }
.tinte-olivedrab { --tono: OliveDrab; --fondo: #edf1e5; }
.tinte-orange { --tono: Orange; --fondo: #fff4e0; }
.tinte-orangered { --tono: OrangeRed; --fondo: #ffe9e0; }
.tinte-orchid { --tono: Orchid; --fondo: #fbeefa; }
.tinte-palegoldenrod { --tono: PaleGoldenrod; --fondo: #fdfcf5; }
.tinte-palegreen { --tono: PaleGreen; --fondo: #f3fff3; }
.tinte-paleturquoise { --tono: PaleTurquoise; --fondo: #f5fdfd; }
.tinte-palevioletred { --tono: PaleVioletRed; --fondo: #fbeef2; }
.tinte-papayawhip { --tono: PapayaWhip; --fondo: #fffdfa; }
.tinte-peachpuff { --tono: PeachPuff; --fondo: #fffbf7; }
.tinte-peru { --tono: Peru; --fondo: #f9f0e8; }
.tinte-pink { --tono: Pink; --fondo: #fff7f9; }
.tinte-plum { --tono: Plum; --fondo: #fbf4fb; }
.tinte-powderblue { --tono: PowderBlue; --fondo: #f6fbfc; }
.tinte-purple { --tono: Purple; --fondo: #f0e0f0; }
.tinte-rebeccapurple { --tono: RebeccaPurple; --fondo: #ede7f3; }
.tinte-red { --tono: Red; --fondo: #ffe0e0; }
.tinte-rosybrown { --tono: RosyBrown; --fondo: #f7f2f2; }
.tinte-royalblue { --tono: RoyalBlue; --fondo: #e8edfb; }
.tinte-saddlebrown { --tono: SaddleBrown; --fondo: #f1e9e3; }
.tinte-salmon { --tono: Salmon; --fondo: #fef0ee; }
.tinte-sandybrown { --tono: SandyBrown; --fondo: #fef4ec; }
.tinte-seagreen { --tono: SeaGreen; --fondo: #e6f1eb; }
.tinte-seashell { --tono: Seashell; --fondo: #fffefd; }
.tinte-sienna { --tono: Sienna; --fondo: #f4eae6; }
.tinte-silver { --tono: Silver; --fondo: #f7f7f7; }
.tinte-skyblue { --tono: SkyBlue; --fondo: #f1f9fd; }
.tinte-slateblue { --tono: SlateBlue; --fondo: #edebf9; }
.tinte-slategray { --tono: SlateGray; --fondo: #eef0f2; }
.tinte-snow { --tono: Snow; --fondo: #fffefe; }
.tinte-springgreen { --tono: SpringGreen; --fondo: #e0fff0; }
.tinte-steelblue { --tono: SteelBlue; --fondo: #e9f0f6; }
.tinte-tan { --tono: Tan; --fondo: #faf6f1; }
.tinte-teal { --tono: Teal; --fondo: #e0f0f0; }
.tinte-thistle { --tono: Thistle; --fondo: #faf7fa; }
.tinte-tomato { --tono: Tomato; --fondo: #ffece9; }
.tinte-turquoise { --tono: Turquoise; --fondo: #e8fbf9; }
.tinte-violet { --tono: Violet; --fondo: #fdf0fd; }
.tinte-wheat { --tono: Wheat; --fondo: #fefbf6; }
.tinte-white { --tono: White; --fondo: #ffffff; }
.tinte-whitesmoke { --tono: WhiteSmoke; --fondo: #fefefe; }
.tinte-yellow { --tono: Yellow; --fondo: #ffffe0; }
.tinte-yellowgreen { --tono: YellowGreen; --fondo: #f3f9e6; }

/* Diálogo de confirmación (configuración) */
.dialog-backdrop { position: fixed; inset: 0; background: rgba(44,62,80,0.45);
    display: flex; align-items: center; justify-content: center; z-index: 100; padding: 1rem; }
.dialog { background: #fff; border-radius: 12px; padding: 1.2rem 1.4rem; max-width: 26rem;
    width: 100%; max-height: 85vh; overflow-y: auto;
    box-shadow: 0 12px 32px rgba(0,0,0,0.18); }
.dialog h3 { margin: 0 0 0.6rem; font-size: 1.1rem; }
.dialog p { margin: 0 0 0.6rem; line-height: 1.45; font-size: 0.95rem; }
.dialog-note { color: #666; font-size: 0.88rem; }
.dialog-actions { display: flex; gap: 0.6rem; justify-content: flex-end; margin-top: 1rem; }


/* Desplegable de los datos delicados del mazo */
.form-advanced { border-top: 1px solid var(--border); padding-top: 0.8rem; }
.form-advanced > summary { cursor: pointer; font-size: 0.85rem; color: #555; font-weight: 500; }
.form-advanced[open] > summary { margin-bottom: 0.8rem; }
.form-advanced .form-field { margin-top: 0.7rem; }
/* Cabecera de grupo en la zona de profesor. */
.deck-group-title { margin: 1.2rem 0 0.5rem; }

/* Mazos retirados en el lobby: se ven, pero apagados y sin invitar a entrar. */
.deck-inactive { opacity: 0.55; filter: grayscale(0.6); }
.deck-inactive:hover { opacity: 0.85; }
.deck-retired-tag { color: #a1887f; font-size: 0.85em; }
/* Los retirados, en su propia fila y centrados, sin título que los anuncie. */
.deck-retired-group { flex-basis: 100%; display: flex; flex-wrap: wrap; justify-content: center; margin-top: 1.2rem; }

/* Mazo retirado: el marrón de «archivadas», sin fondo ni filete. */
.retired-banner {
    margin: 0 0 0.8rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: #a1887f;
}

/* Modo relajado: discreto, sin fondo ni filete; solo la sombrilla y el naranja. */
.relaxed-banner {
    margin: 0 0 0.6rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: #b45309;
}

.form-warning { font-size: 0.8rem; color: #b26a00; margin: 0 0 0.4rem; }

/* Fila de campo con algo al lado: el campo se lleva el ancho y la muestra no se mueve */
.form-row { display: flex; align-items: center; gap: 0.5rem; }
.form-row > input { flex: 1; min-width: 0; }
.color-preview { flex: 0 0 auto; width: 1.4rem; height: 1.4rem; border-radius: 4px;
    border: 1px solid var(--border); }

/* Desplegable de color: botón con muestra y lista de nombres */
.dropdown { position: relative; }
.dropdown-toggle { display: flex; align-items: center; gap: 0.5rem; width: 100%;
    padding: 0.6rem 0.7rem; border: 1px solid var(--border); border-radius: 10px;
    background: #fafafa; color: inherit; font: inherit; font-size: 0.95rem; text-align: left; }
.dropdown-toggle:hover { opacity: 1; background: #f2f4f7; }
.dropdown-caret { margin-left: auto; color: #999; }
.dropdown-menu { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 50;
    box-sizing: border-box; max-height: 12rem; overflow-y: auto; padding: 0.25rem; margin: 0;
    list-style: none; background: #fff; border: 1px solid var(--border); border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12); }
.dropdown-menu li { display: flex; align-items: center; gap: 0.7rem; padding: 0.45rem 0.6rem;
    border-radius: 6px; cursor: pointer; font-size: 0.9rem; list-style: none; }
.dropdown-menu li:hover { background: #eef1f5; }
.dropdown-menu li[aria-selected="true"] { font-weight: 600; }
.swatch { flex: 0 0 auto; width: 14px; height: 14px; border-radius: 3px;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.15); }

/* Enlaces que se ven como botones (zona de profesor) */
.button-link { display: inline-block; padding: 0.45rem 0.85rem; border-radius: 8px;
    background: var(--button-color); color: #fff; text-decoration: none; font-size: 0.85rem; }
.button-link:hover { opacity: 0.9; }
