/* Shared styles for study pages (Spanish /estudiar and English /en/study).
   Mirrors the dark theme + header design of the main site. */

:root {
    --primary: #0ea5e9;
    --primary-dark: #0284c7;
    --primary-light: #38bdf8;
    --accent: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg-dark: #030712;
    --bg-card: #111827;
    --bg-card-hover: #1f2937;
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --border-subtle: rgba(255,255,255,0.06);
    --border-hover: rgba(255,255,255,0.12);
    --gradient-hero: linear-gradient(135deg, #0ea5e9 0%, #22c55e 50%, #0ea5e9 100%);
    --gradient-cta: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    --shadow-card: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    /* Protection: kill text selection / callouts by default. Inputs opt back in. */
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}
input, textarea, [contenteditable] {
    user-select: text;
    -webkit-user-select: text;
}

a { color: var(--primary-light); text-decoration: none; }
a:hover { text-decoration: underline; }

img, canvas { -webkit-user-drag: none; user-drag: none; pointer-events: none; }
canvas.interactive { pointer-events: auto; }

/* ===== Unified header (matches main site dgtexam.es) ===== */
header#header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    padding: 12px 24px;
    background: rgba(3, 7, 18, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
    transition: all 0.3s;
}
.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
}
.logo img { width: 38px; height: 38px; border-radius: 10px; }
.logo-text {
    font-weight: 800;
    font-size: 1.25rem;
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 26px;
    flex: 1;
    justify-content: center;
    min-width: 0;
}
.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.94rem;
    transition: color 0.2s;
    position: relative;
    white-space: nowrap;
}
.nav-links a:hover { color: var(--text-primary); text-decoration: none; }
.nav-links a.active { color: var(--text-primary); }
.nav-links a.active::after,
.nav-links a:hover::after {
    content: '';
    position: absolute;
    bottom: -4px; left: 0;
    width: 100%; height: 2px;
    background: var(--primary);
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
/* Language picker — compact dropdown shown in the study header */
.lang-select { position: relative; }
.lang-select-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 22px;
    padding: 0 10px;
    height: 34px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: all 0.2s;
}
.lang-select-btn:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.25); }
.lang-current-flag { font-size: 1rem; line-height: 1; }
.lang-chev { opacity: 0.6; transition: transform 0.2s; }
.lang-select.open .lang-chev { transform: rotate(180deg); }
.lang-select-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 6px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    z-index: 300;
}
.lang-select.open .lang-select-menu { display: block; }
.lang-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    text-decoration: none;
    transition: all 0.15s;
}
.lang-option:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); text-decoration: none; }
.lang-option.active { background: rgba(34,197,94,0.12); color: var(--text-primary); font-weight: 600; }
.lang-option .flag { font-size: 1.1rem; line-height: 1; }
.auth-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 22px;
    padding: 0 14px 0 10px;
    height: 34px;
    box-sizing: border-box;
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.2s;
}
.auth-btn:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.25); text-decoration: none; }
.user-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    color: var(--text-primary);
    height: 34px;
    padding: 0 12px 0 4px;
    border-radius: 22px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}
.user-pill .avatar {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: var(--gradient-hero);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.78rem; font-weight: 700;
}
.user-pill:hover { background: rgba(255,255,255,0.1); text-decoration: none; }

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
}
.mobile-menu-btn svg { width: 26px; height: 26px; }

/* Mobile nav overlay (mirrors main site) */
.mobile-nav-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    z-index: 1050;
}
.mobile-nav-overlay.open { display: block; }
.mobile-nav-panel {
    position: absolute; top: 0; right: 0;
    width: min(280px, 85vw);
    height: 100%;
    background: var(--bg-card);
    border-left: 1px solid var(--border-subtle);
    padding: 24px;
    display: flex; flex-direction: column;
    gap: 8px;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
    overflow-y: auto;
}
.mobile-nav-overlay.open .mobile-nav-panel { transform: translateX(0); }
.mobile-nav-close {
    align-self: flex-end;
    background: none; border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px 8px;
    margin-bottom: 12px;
}
.mobile-nav-panel a {
    display: block;
    padding: 12px 14px;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-size: 0.98rem;
    font-weight: 500;
}
.mobile-nav-panel a:hover { background: rgba(255,255,255,0.06); text-decoration: none; }
.mobile-nav-panel a.active { background: rgba(34,197,94,0.12); color: var(--text-primary); }
.mobile-nav-divider { height: 1px; background: var(--border-subtle); margin: 8px 0; }
.mobile-lang-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 8px 0;
    margin-bottom: 8px;
}
.mobile-lang-list .lang-option {
    border: 1px solid var(--border-subtle);
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 0.88rem;
}
.mobile-lang-list .lang-option.active { border-color: var(--accent); }
.mobile-nav-section-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 4px 14px;
}

/* Sub-nav under the main header (study section tabs) */
.study-subnav {
    position: sticky;
    top: 60px;
    z-index: 40;
    background: rgba(17,24,39,0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    padding: 8px 24px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.study-subnav-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
}
.study-subnav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: 999px;
    white-space: nowrap;
    transition: all 0.2s;
}
.study-subnav a:hover { color: var(--text-primary); background: rgba(255,255,255,0.04); text-decoration: none; }
.study-subnav a.active {
    color: var(--text-primary);
    background: rgba(34,197,94,0.18);
    border: 1px solid rgba(34,197,94,0.32);
}

@media (max-width: 900px) {
    .nav-links { display: none; }
    .header-actions { display: none; }
    .mobile-menu-btn { display: block; }
    header#header { padding: 10px 16px; }
}

body { padding-top: 60px; }
.study-wrap {
    max-width: 1280px;
    margin: 0 auto;
    padding: 32px 20px 80px;
}
@media (max-width: 900px) {
    body { padding-top: 56px; }
}

.study-breadcrumb {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.study-breadcrumb a { color: var(--text-secondary); }

.study-hero {
    text-align: center;
    margin: 24px 0 32px;
}
.study-hero h1 {
    margin: 0 0 12px;
    font-size: clamp(1.75rem, 4vw, 2.4rem);
    font-weight: 800;
    line-height: 1.15;
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.study-hero p {
    margin: 0 auto;
    max-width: 640px;
    color: var(--text-secondary);
    font-size: 1.05rem;
}

/* Hub cards */
.hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-top: 24px;
}
.hub-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 22px 20px;
    transition: all 0.2s;
    text-decoration: none !important;
    display: block;
    color: inherit;
}
.hub-card:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
    transform: translateY(-2px);
}
.hub-card .ico {
    width: 44px; height: 44px;
    border-radius: 12px;
    background: rgba(34,197,94,0.12);
    color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 14px;
}
.hub-card h3 {
    margin: 0 0 6px;
    font-size: 1.1rem;
}
.hub-card p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.92rem;
}
.hub-card .count {
    display: inline-block;
    margin-top: 12px;
    background: rgba(255,255,255,0.05);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

/* Featured exam card */
.hub-card.featured {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px;
    background: linear-gradient(135deg, rgba(14,165,233,0.1) 0%, rgba(34,197,94,0.06) 100%);
    border-color: rgba(14,165,233,0.35);
    box-shadow: 0 0 40px rgba(14,165,233,0.08);
}
.hub-card.featured:hover {
    border-color: rgba(14,165,233,0.6);
    background: linear-gradient(135deg, rgba(14,165,233,0.15) 0%, rgba(34,197,94,0.09) 100%);
}
.hub-featured-inner {
    display: flex;
    align-items: center;
    gap: 20px;
}
.hub-card.featured .ico {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    background: rgba(14,165,233,0.15);
    color: var(--primary);
    flex-shrink: 0;
    margin-bottom: 0;
}
.hub-card.featured h3 {
    font-size: 1.25rem;
    margin-bottom: 4px;
}
.hub-card.featured p {
    margin-bottom: 6px;
}
.hub-featured-cta {
    flex-shrink: 0;
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.2s, background 0.2s;
}
.hub-card.featured:hover .hub-featured-cta {
    transform: translateX(3px);
    background: var(--primary-light);
}

/* Subnav exam link */
.study-subnav .subnav-exam {
    margin-left: auto;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    color: #fff !important;
    border-radius: 999px;
    padding: 5px 16px;
    font-weight: 600;
    font-size: 0.82rem;
}
.study-subnav .subnav-exam:hover {
    opacity: 0.88;
}

/* Category lazy-load placeholder */
.cat-placeholder {
    grid-column: 1 / -1;
    padding: 32px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}
.cat-placeholder span {
    display: inline-block;
    padding: 6px 16px;
    border: 1px dashed var(--border-subtle);
    border-radius: 8px;
}

/* Rule title lazy placeholder */
.rule-title-ph {
    height: 48px;
    border-radius: 8px;
    background: linear-gradient(90deg, var(--bg-card) 25%, rgba(255,255,255,0.04) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    margin: 12px 0;
}

/* Preview block (visible without auth, indexed) */
.preview-block {
    margin-top: 16px;
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
}
.preview-fade {
    pointer-events: none;
    position: absolute; inset: auto 0 0 0;
    height: 120px;
    background: linear-gradient(to bottom, transparent, var(--bg-card) 90%);
}

/* Auth CTA overlay */
.auth-cta {
    margin-top: 24px;
    padding: 28px;
    background: linear-gradient(135deg, rgba(14,165,233,0.08), rgba(34,197,94,0.08));
    border: 1px solid rgba(34,197,94,0.25);
    border-radius: var(--radius-md);
    text-align: center;
}
.auth-cta h3 { margin: 0 0 8px; font-size: 1.2rem; }
.auth-cta p { margin: 0 0 16px; color: var(--text-secondary); }
.auth-cta .btn {
    display: inline-block;
    background: var(--gradient-cta);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none !important;
}
.auth-cta .btn.secondary {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
}
.auth-cta .links {
    margin-top: 14px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Full content area (loaded after auth) */
#fullContent { display: none; }
#fullContent.ready { display: block; }
#loadingSpinner { display: none; text-align: center; padding: 40px; color: var(--text-secondary); }
#loadingSpinner.show { display: block; }
.spinner {
    width: 32px; height: 32px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--primary-light);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
    margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ===== Sidebar layout (sticky on desktop, drawer on mobile) ===== */
.study-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
    align-items: start;
}
.study-sidebar {
    position: sticky;
    top: 130px;
    max-height: calc(100vh - 150px);
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px 10px;
    font-size: 0.9rem;
}
.study-sidebar::-webkit-scrollbar { width: 6px; }
.study-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }
.study-content {
    min-width: 0;
}
.sidebar-toggle {
    display: none;
}
.sb-root, .sb-root ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.sb-root ul {
    display: none;
    margin-left: 14px;
    padding-left: 8px;
    border-left: 1px solid var(--border-subtle);
}
.sb-li.open > ul { display: block; }
.sb-row {
    display: flex;
    align-items: stretch;
    gap: 2px;
    border-radius: 8px;
    transition: background 0.15s;
}
.sb-row:hover { background: rgba(255,255,255,0.04); }
.sb-toggle {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 4px 4px 6px;
    display: flex;
    align-items: center;
    transition: transform 0.15s;
}
.sb-toggle svg { transition: transform 0.15s; }
.sb-li.open > .sb-row > .sb-toggle svg { transform: rotate(90deg); }
.sb-item {
    flex: 1;
    min-width: 0;
    padding: 7px 10px 7px 4px;
    color: var(--text-secondary);
    text-decoration: none;
    line-height: 1.35;
    border-radius: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.88rem;
}
.sb-li:not(.has-children) > .sb-row > .sb-item { padding-left: 18px; }
.sb-li.lvl-1 > .sb-row > .sb-item { font-weight: 600; color: var(--text-primary); font-size: 0.92rem; }
.sb-li.lvl-2 > .sb-row > .sb-item { color: var(--text-secondary); }
.sb-li.lvl-3 > .sb-row > .sb-item { color: var(--text-muted); font-size: 0.84rem; }
.sb-li.lvl-4 > .sb-row > .sb-item { color: var(--text-muted); font-size: 0.82rem; }
.sb-item:hover { color: var(--text-primary); text-decoration: none; background: rgba(255,255,255,0.03); }
.sb-item.active {
    color: var(--text-primary);
    background: rgba(34,197,94,0.18);
    box-shadow: inset 2px 0 0 var(--accent);
}

@media (max-width: 900px) {
    .study-layout {
        display: block;
    }
    .sidebar-toggle {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        background: var(--bg-card);
        border: 1px solid var(--border-subtle);
        color: var(--text-primary);
        font-size: 0.88rem;
        font-weight: 600;
        padding: 9px 14px;
        border-radius: 999px;
        margin-bottom: 16px;
        cursor: pointer;
    }
    .sidebar-toggle:hover { background: var(--bg-card-hover); }
    .study-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 320px;
        max-width: 88vw;
        max-height: none;
        border-radius: 0;
        border-right: 1px solid var(--border-subtle);
        z-index: 1100;
        transform: translateX(-100%);
        transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
        padding-top: 50px;
    }
    html.sidebar-open .study-sidebar {
        transform: translateX(0);
        box-shadow: 0 0 60px rgba(0,0,0,0.6);
    }
    html.sidebar-open::after {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1090;
    }
}

/* Per-section chip nav — built dynamically inside #fullContent above the rendered content */
.section-chip-nav {
    position: sticky;
    top: 110px;
    z-index: 30;
    margin: 8px -20px 18px;
    padding: 12px 20px;
    background: rgba(3, 7, 18, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
}
.section-chip-nav-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    overflow-x: auto;
}
.section-chip {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-subtle);
    white-space: nowrap;
    transition: all 0.15s;
}
.section-chip:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.08);
    text-decoration: none;
}
.section-chip.active {
    color: var(--text-primary);
    background: rgba(34,197,94,0.18);
    border-color: rgba(34,197,94,0.4);
}
.cat-count {
    display: inline-block;
    margin-left: 8px;
    padding: 1px 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.06);
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    vertical-align: middle;
}

/* Smooth preview→full transition (mitigates the flash the user notices) */
.preview-block, #fullContent {
    transition: opacity 0.18s ease;
}
.preview-block.fading { opacity: 0; pointer-events: none; }
html.skip-preview .preview-block { display: none !important; }
html.skip-preview #loadingSpinner { display: block; }
/* JS removes the skip-preview class once content renders so the spinner hides. */

/* Section: Reglamento */
.rule-title { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--border-subtle); }
.rule-title h2 { margin: 0 0 8px; font-size: 1.3rem; color: var(--primary-light); }
.rule-chapter h3 { font-size: 1.1rem; color: var(--text-primary); margin: 18px 0 6px; }
.rule-article {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin: 10px 0;
}
.rule-article h4 {
    margin: 0 0 8px;
    font-size: 0.98rem;
    color: var(--accent);
}
.rule-article p { margin: 6px 0; color: var(--text-secondary); }
.rule-article ol, .rule-article ul {
    color: var(--text-secondary);
    padding-left: 22px;
    margin: 6px 0;
}
.rule-article li { margin: 4px 0; }

/* Section: Señales */
.signs-cat { margin-top: 28px; }
.signs-cat h2 { font-size: 1.25rem; color: var(--primary-light); margin: 0 0 14px; }
.signs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}
.sign-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 14px;
    text-align: center;
}
.sign-card .sign-img {
    width: 100%;
    height: 140px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.04);
    border-radius: 10px;
    margin-bottom: 10px;
    overflow: hidden;
}
.sign-card .sign-img canvas,
.sign-card .sign-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.sign-card .sign-img.loaded img,
.sign-card .sign-img.loaded canvas { opacity: 1; }

/* Skeleton shimmer while a sign image is in flight */
.sign-card .sign-img.sign-img-skeleton {
    background:
        linear-gradient(110deg, rgba(255,255,255,0.04) 30%, rgba(255,255,255,0.10) 50%, rgba(255,255,255,0.04) 70%) 0 0 / 200% 100%,
        rgba(255,255,255,0.04);
    animation: signSkeleton 1.4s linear infinite;
}
.sign-card .sign-img.loaded { animation: none; background: rgba(255,255,255,0.04); }
.sign-card .sign-img.sign-img-missing {
    animation: none;
    background: rgba(255,255,255,0.04);
    color: var(--text-muted);
    font-size: 1.6rem;
}
@keyframes signSkeleton {
    0% { background-position: 200% 0, 0 0; }
    100% { background-position: -200% 0, 0 0; }
}

.sign-card .sign-img.preview {
    background: linear-gradient(135deg, rgba(14,165,233,0.12), rgba(34,197,94,0.12));
    border: 1px dashed rgba(255,255,255,0.18);
}
.sign-placeholder {
    text-align: center;
}
.sign-placeholder-code {
    font-family: ui-monospace, Menlo, monospace;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-secondary);
}
.sign-placeholder-lock {
    font-size: 1.4rem;
    margin-top: 8px;
    opacity: 0.6;
}
.sign-card .sign-code {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: ui-monospace, Menlo, monospace;
}
.sign-card .sign-name {
    font-size: 0.92rem;
    font-weight: 600;
    margin: 4px 0;
    line-height: 1.3;
}
.sign-card .sign-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Section: Sanciones */
.sanc-cat { margin-top: 28px; }
.sanc-cat h2 {
    font-size: 1.2rem;
    color: var(--primary-light);
    margin: 0 0 12px;
    display: flex; align-items: center; gap: 10px;
}
.sanc-cat h2 .cat-dot {
    width: 12px; height: 12px;
    border-radius: 50%;
}
.sanc-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 14px;
    align-items: start;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: 8px;
}
.sanc-row .sanc-title { font-weight: 600; font-size: 0.96rem; }
.sanc-row .sanc-desc { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }
.sanc-row .sanc-fine {
    font-weight: 700;
    color: var(--accent);
    font-size: 1rem;
    white-space: nowrap;
}
.sanc-row .sanc-points {
    background: rgba(245,158,11,0.12);
    color: var(--warning);
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 0.78rem;
    white-space: nowrap;
}
.sanc-row .sanc-points.zero { background: rgba(255,255,255,0.05); color: var(--text-muted); }
.sanc-row .sanc-type {
    display: inline-block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Section: Prácticas */
.game-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 22px;
    margin-top: 20px;
}
.game-card h2 { margin: 0 0 6px; font-size: 1.15rem; color: var(--primary-light); }
.game-card .game-meta { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 14px; }
.scenario {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin: 8px 0;
}
.scenario .situation { font-weight: 600; margin-bottom: 6px; }
.scenario .options { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.scenario .options .opt {
    background: rgba(14,165,233,0.08);
    border: 1px solid rgba(14,165,233,0.18);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.88rem;
    cursor: pointer;
}
.scenario .options .opt.correct { background: rgba(34,197,94,0.15); border-color: rgba(34,197,94,0.35); color: var(--accent); }
.scenario .options .opt.wrong { background: rgba(239,68,68,0.12); border-color: rgba(239,68,68,0.3); color: var(--danger); }
.scenario .explanation {
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
    display: none;
}
.scenario.revealed .explanation { display: block; }

/* Print kill-switch */
@media print {
    body * { visibility: hidden !important; }
    body::before {
        content: 'Contenido protegido. dgtexam.es';
        visibility: visible;
        display: block;
        font-size: 24px;
        text-align: center;
        margin-top: 40vh;
        color: black;
    }
}
