/* =========================================================
   TORACLES OBSERVATORY — SISTEMA DE TOKENS VISUALES
   Identidad: Tinta profunda mineral, pergamino y cobre envejecido
   ========================================================= */

:root {
    /* Fondos y superficies minerales */
    --bg-canvas: #101615;             /* Tinta profunda de fondo */
    --bg-surface: #161f1e;            /* Paneles y estantería de navegación */
    --bg-surface-elevated: #1c2726;   /* Tarjetas elevadas y modal */
    --bg-surface-hover: #233432;      /* Resalte de interacción sobrio */
    --bg-input: #0c1211;              /* Profundidad de campo de formulario */
    --bg-chip: #192523;               /* Fichas léxicas y controles auxiliares */

    /* Encuadernación y filamentos */
    --border-subtle: #243532;         /* Línea fina de encuadernación */
    --border-muted: #344844;          /* Borde para controles secundarios */
    --border-copper: #cd9b66;         /* Cobre envejecido / acento activo */
    --border-copper-subtle: rgba(205, 155, 102, 0.28);
    --copper-glow: rgba(205, 155, 102, 0.16);

    /* Tinta de lectura y pergamino */
    --ink-text-primary: #eee8d8;      /* Pergamino claro / lectura óptima */
    --ink-text-secondary: #c5beae;    /* Papiro envejecido / descripción */
    --ink-text-muted: #9eafa0;        /* Muted sage / metadatos */
    --copper-base: #cd9b66;           /* Cobre envejecido base */
    --copper-hover: #deb382;          /* Cobre bruñido al paso */
    --copper-deep: #9d6f3e;           /* Cobre oxidado */
    --sage-accent: #9eafa0;           /* Salvia apagada mineral */
    --sage-subtle: rgba(158, 175, 160, 0.12);

    /* Estados de cotización y mercado */
    --market-gain: #52a384;           /* Cardenillo / verdín de cobre (subidas) */
    --market-gain-bg: rgba(82, 163, 132, 0.14);
    --market-gain-border: rgba(82, 163, 132, 0.35);
    --market-loss: #c85647;           /* Arcilla tostada / almagre (bajadas) */
    --market-loss-bg: rgba(200, 86, 71, 0.14);
    --market-loss-border: rgba(200, 86, 71, 0.35);
    --gold-ancient: #d4af37;          /* Oro viejo para precios y sellos */

    /* Tipografías */
    --font-heading: 'Cinzel', 'EB Garamond', Georgia, serif;
    --font-body: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;

    /* Dimensiones y sombras */
    --max-content-width: 1440px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 16px 44px rgba(0, 0, 0, 0.75), 0 0 28px rgba(205, 155, 102, 0.12);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --transition-base: 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

/* =========================================================
   REINICIO Y BASE DE ACCESIBILIDAD
   ========================================================= */

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

html {
    font-size: 16px;
    background-color: var(--bg-canvas);
    color: var(--ink-text-primary);
    scroll-behavior: smooth;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bg-canvas);
    color: var(--ink-text-primary);
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Enfoque visible de alto contraste */
:focus-visible {
    outline: 2px solid var(--copper-base);
    outline-offset: 2px;
}

a {
    color: var(--copper-base);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    transition: color var(--transition-base);
}

a:hover {
    color: var(--copper-hover);
}

button, input, select, textarea {
    font: inherit;
    color: inherit;
}

.visually-hidden, .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* =========================================================
   ENCABEZADO EDITORIAL TORACLES (MASTHEAD)
   ========================================================= */

.toracles-masthead {
    background: rgba(22, 31, 30, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-copper-subtle);
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
}

.masthead-inner {
    max-width: var(--max-content-width);
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
}

.brand-container {
    display: flex;
    align-items: center;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    text-decoration: none;
    color: var(--ink-text-primary);
}

.brand-sigil {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--copper-base);
    filter: drop-shadow(0 0 6px var(--copper-glow));
    transition: transform var(--transition-base), filter var(--transition-base);
}

.brand-link:hover .brand-sigil {
    transform: scale(1.04);
    filter: drop-shadow(0 0 10px var(--copper-base));
}

.sigil-icon {
    display: block;
}

.brand-titles {
    display: flex;
    flex-direction: column;
}

.brand-name {
    font-family: var(--font-heading);
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--ink-text-primary);
    line-height: 1.1;
    background: linear-gradient(180deg, #ffffff 0%, #eee8d8 60%, #cd9b66 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-sub {
    font-family: var(--font-heading);
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-text-muted);
    margin-top: 2px;
}

/* Estantería de Navegación */
.nav-shelf {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--bg-canvas);
    padding: 0.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.nav-tab {
    background: transparent;
    border: 1px solid transparent;
    color: var(--ink-text-secondary);
    padding: 0.55rem 1.15rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.92rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    transition: all var(--transition-base);
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 44px;
    position: relative;
    user-select: none;
}

.nav-tab:hover {
    color: var(--ink-text-primary);
    background: var(--bg-surface-hover);
}

.nav-tab.active {
    color: var(--ink-text-primary);
    background: var(--bg-surface-elevated);
    border-color: var(--border-copper-subtle);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(205, 155, 102, 0.2);
}

.nav-tab.active .tab-label {
    color: var(--copper-hover);
    font-weight: 600;
}

.tab-shortcut {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--ink-text-muted);
    border: 1px solid var(--border-muted);
    padding: 1px 5px;
    border-radius: 3px;
    background: var(--bg-canvas);
    transition: all var(--transition-base);
}

.nav-tab.active .tab-shortcut {
    color: var(--copper-base);
    border-color: var(--border-copper-subtle);
}

.masthead-actions {
    display: flex;
    align-items: center;
}

.btn-share {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--ink-text-secondary);
    padding: 0.45rem 0.85rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 44px;
    transition: all var(--transition-base);
}

.btn-share:hover {
    color: var(--ink-text-primary);
    border-color: var(--border-copper-subtle);
    background: var(--bg-surface);
}

/* =========================================================
   BANNER EDITORIAL COMPACTO
   ========================================================= */

.editorial-banner {
    background: linear-gradient(180deg, rgba(22, 31, 30, 0.65) 0%, rgba(16, 22, 21, 0.95) 100%);
    border-bottom: 1px solid var(--border-subtle);
    padding: 2rem 1.5rem 1.75rem;
    position: relative;
}

.banner-inner {
    max-width: var(--max-content-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 2.5rem;
    flex-wrap: wrap;
}

.banner-prose {
    flex: 1;
    min-width: 320px;
}

.banner-heading {
    font-family: var(--font-heading);
    font-size: 1.85rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--ink-text-primary);
    line-height: 1.25;
    margin-bottom: 0.45rem;
}

.banner-description {
    font-size: 0.98rem;
    color: var(--ink-text-secondary);
    max-width: 680px;
    line-height: 1.6;
}

.banner-stats {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.85rem 1.5rem;
    box-shadow: var(--shadow-sm);
}

.stat-cell {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--copper-base);
    line-height: 1.1;
}

.stat-caption {
    font-size: 0.76rem;
    color: var(--ink-text-muted);
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.stat-separator {
    width: 1px;
    height: 32px;
    background: var(--border-subtle);
}

/* =========================================================
   CONTENEDOR PRINCIPAL Y PANELES
   ========================================================= */

.observatory-main {
    flex: 1;
    max-width: var(--max-content-width);
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
    width: 100%;
}

.observatory-panel {
    display: none;
    animation: panelFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.observatory-panel.active,
.observatory-panel:not([hidden]) {
    display: block;
}

.observatory-panel[hidden] {
    display: none !important;
}

@keyframes panelFadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.panel-header {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 0.85rem;
}

.panel-meta-title {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.panel-tag {
    font-family: var(--font-heading);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--copper-base);
    font-weight: 600;
}

.panel-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ink-text-primary);
    line-height: 1.2;
}

/* =========================================================
   FORMULARIOS EDITORIALES Y CONTROLES ANALÍTICOS
   ========================================================= */

.editorial-form {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    position: relative;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 1.15rem;
    align-items: flex-end;
}

.cards-form-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.form-group.span-2 {
    grid-column: span 2;
}

.form-group.span-all {
    grid-column: 1 / -1;
}

.form-group label {
    font-family: var(--font-heading);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-text-muted);
    font-weight: 600;
}

input[type="text"],
input[type="number"],
select {
    background-color: var(--bg-input);
    border: 1px solid var(--border-muted);
    color: var(--ink-text-primary);
    padding: 0.65rem 0.95rem;
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    min-height: 44px;
    width: 100%;
    outline: none;
    transition: border-color var(--transition-base), box-shadow var(--transition-base), background-color var(--transition-base);
}

input[type="text"]::placeholder,
input[type="number"]::placeholder {
    color: #5d6f6b;
    font-style: italic;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
    border-color: var(--border-copper);
    background-color: #0e1615;
    box-shadow: 0 0 0 3px var(--copper-glow);
}

select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23cd9b66' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.95rem center;
    padding-right: 2.4rem;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Botones de acción principal */
.form-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.35rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    min-height: 44px;
    border: 1px solid transparent;
    transition: all var(--transition-base);
    user-select: none;
}

.btn-submit {
    background: linear-gradient(180deg, var(--copper-hover) 0%, var(--copper-base) 100%);
    color: #101615;
    border-color: #e5b98a;
    box-shadow: 0 4px 14px rgba(205, 155, 102, 0.25);
}

.btn-submit:hover {
    background: linear-gradient(180deg, #ebd0b0 0%, var(--copper-hover) 100%);
    box-shadow: 0 6px 18px rgba(205, 155, 102, 0.35);
    transform: translateY(-1px);
}

.btn-secondary {
    background: transparent;
    border-color: var(--border-muted);
    color: var(--ink-text-secondary);
}

.btn-secondary:hover {
    background: var(--bg-surface-hover);
    color: var(--ink-text-primary);
    border-color: var(--border-copper-subtle);
}

/* Fichas léxicas y avisos */
.form-footer-aux {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-subtle);
}

.example-chips {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.chips-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-text-muted);
    font-weight: 600;
}

.chip-btn {
    background: var(--bg-chip);
    border: 1px solid var(--border-subtle);
    color: var(--ink-text-secondary);
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    transition: all var(--transition-base);
}

.chip-btn:hover {
    background: var(--bg-surface-hover);
    color: var(--copper-hover);
    border-color: var(--border-copper-subtle);
    transform: translateY(-1px);
}

.cards-notice {
    font-size: 0.82rem;
    color: var(--ink-text-muted);
    font-style: italic;
    line-height: 1.45;
}

/* Anunciador de estado accesible (ARIA live status) */
.status-announcer {
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    color: var(--ink-text-secondary);
    min-height: 1.25rem;
}

.status-announcer:not(:empty) {
    padding: 0.75rem 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--copper-base);
    border-radius: var(--radius-sm);
}

/* =========================================================
   REJILLA DE CARTAS Y TARJETAS EDITORIALES (CONTRACT CLASSES)
   ========================================================= */

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
    gap: 1.5rem;
    width: 100%;
}

.card-tile, .card-item {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: transform var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base);
    box-shadow: var(--shadow-sm);
    position: relative;
}

.card-tile:hover, .card-item:hover {
    transform: translateY(-4px);
    border-color: var(--border-copper-subtle);
    box-shadow: var(--shadow-md), 0 0 16px var(--copper-glow);
}

.card-art, .card-img-wrapper {
    position: relative;
    width: 100%;
    padding-top: 139%; /* Proporción estándar carta MTG */
    background: #080c0b;
    overflow: hidden;
}

.card-art img, .card-img-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.card-tile:hover .card-art img,
.card-item:hover .card-img-wrapper img {
    transform: scale(1.04);
}

.card-info {
    padding: 0.95rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    flex: 1;
}

.card-name {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.96rem;
    line-height: 1.3;
    color: var(--ink-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-meta {
    font-size: 0.78rem;
    color: var(--ink-text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    line-height: 1.2;
}

.card-meta-set {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-meta-rarity {
    text-transform: capitalize;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    padding: 1px 5px;
    border-radius: 3px;
    background: var(--bg-canvas);
    border: 1px solid var(--border-subtle);
}

.card-price, .price-tag {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--gold-ancient);
    margin-top: auto;
    padding-top: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.badge-delta {
    font-size: 0.78rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    font-family: var(--font-mono);
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.badge-delta.positive, .positive {
    background: var(--market-gain-bg);
    color: var(--market-gain);
    border: 1px solid var(--market-gain-border);
}

.badge-delta.negative, .negative {
    background: var(--market-loss-bg);
    color: var(--market-loss);
    border: 1px solid var(--market-loss-border);
}

/* Barra de Paginación */
.pagination-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.25rem;
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-subtle);
}

.btn-page {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--ink-text-primary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 500;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: all var(--transition-base);
}

.btn-page:not(:disabled):hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-copper-subtle);
    color: var(--copper-hover);
}

.btn-page:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: transparent;
}

.page-indicator {
    font-family: var(--font-mono);
    font-size: 0.88rem;
    color: var(--ink-text-muted);
}

/* =========================================================
   SECCIÓN DE COMBOS (ARCHIVO EDH Y SINTAXIS)
   ========================================================= */

.combo-search-box {
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
    flex-wrap: wrap;
}

.combo-input-wrapper {
    flex: 1;
    min-width: 280px;
    position: relative;
    display: flex;
    align-items: center;
}

.combo-input-icon {
    position: absolute;
    left: 1rem;
    color: var(--copper-base);
    pointer-events: none;
}

.combo-input-wrapper input[type="text"] {
    padding-left: 2.75rem;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    background-color: var(--bg-input);
    border-color: var(--border-muted);
}

.combo-buttons-wrapper {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Guía desplegable de sintaxis */
.syntax-guide {
    background: var(--bg-canvas);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-top: 0.5rem;
    transition: border-color var(--transition-base);
}

.syntax-guide[open] {
    border-color: var(--border-copper-subtle);
}

.syntax-summary {
    padding: 0.85rem 1.15rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--ink-text-secondary);
    font-size: 0.88rem;
    font-weight: 500;
    user-select: none;
    list-style: none;
}

.syntax-summary::-webkit-details-marker {
    display: none;
}

.summary-title-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--ink-text-primary);
}

.summary-icon {
    color: var(--copper-base);
}

.summary-caret {
    color: var(--ink-text-muted);
    transition: transform var(--transition-base);
}

.syntax-guide[open] .summary-caret {
    transform: rotate(180deg);
}

.syntax-body {
    padding: 1.15rem 1.25rem 1.35rem;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.88rem;
    color: var(--ink-text-secondary);
    line-height: 1.6;
}

.syntax-intro {
    margin-bottom: 0.75rem;
}

.syntax-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.syntax-list li {
    padding-left: 1rem;
    position: relative;
}

.syntax-list li::before {
    content: "•";
    color: var(--copper-base);
    position: absolute;
    left: 0;
    font-weight: bold;
}

.syntax-list code {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    background: var(--bg-surface);
    color: var(--copper-hover);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border-subtle);
}

.syntax-limitations {
    background: rgba(205, 155, 102, 0.06);
    border: 1px solid var(--border-copper-subtle);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-size: 0.82rem;
    color: var(--ink-text-muted);
}

.syntax-link {
    color: var(--copper-hover);
    font-weight: 500;
}

/* Rejilla de Combos (Contract Classes) */
.combos-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
}

.combo-tile, .combo-card {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.35rem;
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
    transition: transform var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base);
    box-shadow: var(--shadow-sm);
}

.combo-tile:hover, .combo-card:hover {
    border-color: var(--border-copper-subtle);
    box-shadow: var(--shadow-md), 0 0 16px var(--copper-glow);
}

.combo-header, .combo-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.combo-results-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.combo-badge-result {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(205, 155, 102, 0.12);
    color: var(--copper-hover);
    border: 1px solid var(--border-copper-subtle);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-sm);
    letter-spacing: 0.02em;
}

.combo-colors-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-family: var(--font-mono);
    font-size: 0.76rem;
    color: var(--ink-text-muted);
}

/* Tira de cartas integrantes del combo (combo-art-strip) */
.combo-art-strip, .combo-card-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    align-items: stretch;
    background: rgba(10, 15, 14, 0.6);
    padding: 0.85rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.combo-piece {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    background: var(--bg-surface);
    padding: 0.45rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: all var(--transition-base);
    min-height: 44px;
}

.combo-piece:hover {
    transform: translateY(-2px);
    border-color: var(--border-copper-subtle);
    background: var(--bg-surface-hover);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.combo-piece-img {
    width: 34px;
    height: 48px;
    object-fit: cover;
    border-radius: 4px;
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.combo-piece-name {
    font-family: var(--font-heading);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--ink-text-primary);
    line-height: 1.2;
}

.combo-piece-zone {
    font-size: 0.74rem;
    color: var(--ink-text-muted);
    font-style: italic;
}

/* Detalles e instrucciones del combo */
.combo-details, .combo-steps {
    font-size: 0.9rem;
    color: var(--ink-text-secondary);
    background: var(--bg-canvas);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    line-height: 1.6;
    white-space: pre-line;
}

.combo-meta-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    font-size: 0.78rem;
    color: var(--ink-text-muted);
    border-top: 1px solid var(--border-subtle);
    padding-top: 0.75rem;
}

.combo-source-link {
    color: var(--copper-base);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.combo-source-link:hover {
    color: var(--copper-hover);
    text-decoration: underline;
}

/* =========================================================
   SECCIÓN DE MERCADO (COTIZACIONES REALES)
   ========================================================= */

.market-disclaimer-box {
    background: rgba(22, 31, 30, 0.8);
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--copper-base);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1.25rem;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
    color: var(--ink-text-secondary);
    line-height: 1.5;
}

.market-form-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.market-actions {
    grid-column: 1 / -1;
    margin-top: 0.25rem;
}

.market-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    width: 100%;
}

.market-row {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.85rem 1.25rem;
    display: grid;
    grid-template-columns: 48px 52px 2fr 1.2fr 1fr 1fr 1fr;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: all var(--transition-base);
}

.market-row:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-copper-subtle);
    transform: translateX(3px);
    box-shadow: var(--shadow-sm);
}

.market-rank {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--ink-text-muted);
}

.market-thumb {
    width: 44px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: #000;
}

.market-card-name {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.98rem;
    color: var(--ink-text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.market-card-set {
    font-size: 0.82rem;
    color: var(--ink-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.market-price-current {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--gold-ancient);
}

.market-delta-pct {
    font-family: var(--font-mono);
    font-size: 0.84rem;
}

.market-delta-abs {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.88rem;
}

/* =========================================================
   MODAL DE DETALLE: NATIVE DIALOG (CONTRACT ID: card-dialog)
   ========================================================= */

dialog.toracles-dialog,
dialog#card-dialog {
    border: 1px solid var(--border-copper-subtle);
    border-radius: var(--radius-lg);
    background: var(--bg-surface-elevated);
    color: var(--ink-text-primary);
    max-width: 980px;
    width: 94vw;
    max-height: 90vh;
    padding: 0;
    margin: auto;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

dialog.toracles-dialog::backdrop,
dialog#card-dialog::backdrop {
    background: rgba(10, 14, 13, 0.82);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.dialog-shell {
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    width: 100%;
}

.dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.75rem;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(22, 31, 30, 0.95);
    position: sticky;
    top: 0;
    z-index: 10;
}

.dialog-header-text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.dialog-pretitle {
    font-family: var(--font-heading);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--copper-base);
}

.dialog-title {
    font-family: var(--font-heading);
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--ink-text-primary);
    line-height: 1.2;
}

.btn-dialog-close {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--ink-text-muted);
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all var(--transition-base);
}

.btn-dialog-close:hover {
    color: var(--ink-text-primary);
    background: var(--bg-surface-hover);
    border-color: var(--border-copper-subtle);
}

.dialog-scroll-body {
    padding: 1.75rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Distribución del Detalle de Carta (detail-layout) */
.detail-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    align-items: start;
}

.detail-visual {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.detail-card-img {
    width: 100%;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-copper-subtle);
    box-shadow: var(--shadow-md);
    aspect-ratio: 5 / 7;
    object-fit: cover;
    background: #000;
}

.detail-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.detail-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.88rem;
    color: var(--ink-text-muted);
}

.detail-oracle-box {
    background: var(--bg-canvas);
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--border-copper);
    padding: 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.94rem;
    line-height: 1.6;
    color: var(--ink-text-primary);
    white-space: pre-wrap;
}

/* Párrafo de texto de oráculo: preserva saltos de línea reales */
.oracle-text {
    white-space: pre-line;
}

/* =========================================================
   HISTÓRICO DE PRECIOS Y GRÁFICO SVG ACCESIBLE
   ========================================================= */

.dialog-chart-section {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.chart-section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.chart-section-titles {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.chart-section-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--ink-text-primary);
}

.chart-section-note {
    font-size: 0.78rem;
    color: var(--ink-text-muted);
    font-style: italic;
}

.chart-controls-form {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.chart-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.chart-field label {
    font-family: var(--font-heading);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-text-muted);
}

.chart-field select {
    padding: 0.45rem 2rem 0.45rem 0.75rem;
    font-size: 0.85rem;
    min-height: 38px;
}

/* Métrica de resumen estadístico (summary-item) */
.chart-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.75rem;
}

.summary-item {
    background: var(--bg-canvas);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.summary-item-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-text-muted);
}

.summary-item-val {
    font-family: var(--font-mono);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ink-text-primary);
}

/* Aviso de cobertura de datos: ocupa todo el ancho de la rejilla */
.chart-notice {
    grid-column: 1 / -1;
    background: rgba(205, 155, 102, 0.06);
    border: 1px solid var(--border-copper-subtle);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.95rem;
    font-size: 0.84rem;
    color: var(--ink-text-muted);
    font-style: italic;
    line-height: 1.5;
}

/* Contenedor de Gráfico y SVG (chart-svg) */
.chart-container {
    width: 100%;
    min-height: 220px;
    background: var(--bg-canvas);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.chart-svg {
    width: 100%;
    height: 100%;
    min-height: 200px;
    display: block;
}

.chart-svg-line {
    stroke: var(--copper-base);
    stroke-width: 2.2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chart-svg-area {
    fill: url(#chartGradient);
    opacity: 0.25;
}

.chart-svg-grid {
    stroke: var(--border-subtle);
    stroke-width: 1;
    stroke-dasharray: 2 4;
}

.chart-svg-point {
    fill: var(--copper-hover);
    stroke: var(--bg-canvas);
    stroke-width: 2;
    r: 3.5;
    transition: r var(--transition-base), fill var(--transition-base);
}

.chart-svg-point:hover {
    r: 6;
    fill: #ffffff;
    cursor: pointer;
}

/* Tabla histórica accesible */
.chart-table-details {
    background: var(--bg-canvas);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.chart-table-summary {
    padding: 0.75rem 1rem;
    font-size: 0.82rem;
    color: var(--ink-text-secondary);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.table-wrapper {
    max-height: 220px;
    overflow-y: auto;
    border-top: 1px solid var(--border-subtle);
}

.historical-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
    text-align: left;
}

.historical-table th,
.historical-table td {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.historical-table th {
    background: var(--bg-surface);
    color: var(--ink-text-muted);
    font-family: var(--font-heading);
    font-size: 0.76rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    position: sticky;
    top: 0;
}

.historical-table td {
    font-family: var(--font-mono);
    color: var(--ink-text-primary);
}

/* Combos relacionados dentro del modal */
.dialog-combos-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.dialog-combos-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--ink-text-primary);
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 0.5rem;
}

/* =========================================================
   ESTADOS DE VACÍO Y CARGA (CONTRACT CLASSES)
   ========================================================= */

.empty-state {
    padding: 3.5rem 1.5rem;
    text-align: center;
    background: var(--bg-surface);
    border: 1px dashed var(--border-muted);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    color: var(--ink-text-muted);
    width: 100%;
}

.empty-state-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    color: var(--ink-text-primary);
}

.empty-state-desc {
    max-width: 480px;
    font-size: 0.92rem;
    line-height: 1.5;
}

.loading-state {
    padding: 3rem 1.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: var(--copper-base);
    font-family: var(--font-heading);
    font-size: 1rem;
    width: 100%;
}

.loading-sigil-pulse {
    animation: sigilPulse 1.6s ease-in-out infinite;
    color: var(--copper-base);
}

@keyframes sigilPulse {
    0%, 100% {
        transform: scale(0.95);
        opacity: 0.5;
        filter: drop-shadow(0 0 4px var(--copper-glow));
    }
    50% {
        transform: scale(1.08);
        opacity: 1;
        filter: drop-shadow(0 0 14px var(--copper-base));
    }
}

/* =========================================================
   PIE DE PÁGINA EDITORIAL TORACLES
   ========================================================= */

.toracles-footer {
    border-top: 1px solid var(--border-copper-subtle);
    background: #0b0f0e;
    padding: 3.5rem 1.5rem 3rem;
    margin-top: auto;
    width: 100%;
}

.footer-inner {
    max-width: var(--max-content-width);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1.6fr;
    gap: 3.5rem;
    align-items: flex-start;
}

.footer-brand-column {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.footer-brand-title {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--ink-text-primary);
}

.footer-sigil {
    color: var(--copper-base);
    display: flex;
}

.footer-tagline {
    font-size: 0.9rem;
    color: var(--ink-text-muted);
    line-height: 1.55;
}

.footer-main-link {
    margin-top: 0.35rem;
}

.external-editorial-link {
    color: var(--copper-base);
    font-weight: 500;
    font-size: 0.9rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: color var(--transition-base);
}

.external-editorial-link:hover {
    color: var(--copper-hover);
    text-decoration: underline;
}

.footer-disclaimer-column {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    font-size: 0.82rem;
    color: var(--ink-text-muted);
    line-height: 1.6;
}

.footer-spellbook-ack {
    color: var(--ink-text-secondary);
}

.footer-legal-copy {
    font-size: 0.76rem;
    opacity: 0.8;
}

/* =========================================================
   ADAPTACIÓN RESPONSIVA Y RESTRICCIONES DE MEDIOS
   ========================================================= */

@media (max-width: 1024px) {
    .market-row {
        grid-template-columns: 36px 44px 1.5fr 1fr 1fr 1fr;
    }
    .footer-inner {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

@media (max-width: 768px) {
    .masthead-inner {
        padding: 0.65rem 1rem;
        gap: 0.75rem;
    }
    .brand-sub {
        display: none;
    }
    .editorial-banner {
        padding: 1.5rem 1rem;
    }
    .banner-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 1.25rem;
        width: 100%;
        min-width: 0;
    }
    .banner-prose {
        min-width: 0;
    }
    .banner-stats {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.5rem;
        max-width: 100%;
        padding: 0.75rem 0.75rem;
        align-items: start;
    }
    .banner-stats .stat-separator {
        display: none;
    }
    .banner-stats .stat-value {
        font-size: 1.05rem;
    }
    .banner-stats .stat-caption {
        white-space: normal;
    }
    .observatory-main {
        padding: 1.25rem 1rem 2rem;
    }
    .cards-form-grid,
    .market-form-grid {
        grid-template-columns: 1fr;
    }
    .form-group.span-2 {
        grid-column: 1;
    }
    .detail-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    .detail-visual {
        max-width: 240px;
        margin: 0 auto;
    }
    .chart-section-header {
        flex-direction: column;
    }
    .chart-controls-form {
        width: 100%;
        justify-content: space-between;
    }
    .market-row {
        grid-template-columns: 32px 40px 1fr 1fr;
        gap: 0.65rem;
        padding: 0.75rem;
    }
    .market-card-set, .market-delta-abs {
        display: none;
    }
}

@media (max-width: 480px) {
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    .card-info {
        padding: 0.65rem;
        gap: 0.3rem;
    }
    .card-name {
        font-size: 0.85rem;
    }
    .card-meta {
        font-size: 0.7rem;
    }
    .card-price {
        font-size: 0.95rem;
    }
    .combos-grid {
        grid-template-columns: 1fr;
    }
    .nav-tab {
        padding: 0.5rem 0.75rem;
        font-size: 0.84rem;
    }
    .btn-share .share-text {
        display: none;
    }
    .btn-share {
        padding: 0.45rem;
    }
    .banner-heading {
        font-size: 1.45rem;
    }
}

/* Restricción contra sticky hover en dispositivos táctiles */
@media (hover: none) and (pointer: coarse) {
    .card-tile:hover, .card-item:hover,
    .combo-tile:hover, .combo-card:hover,
    .market-row:hover {
        transform: none;
    }
    .card-tile:hover .card-art img,
    .card-item:hover .card-img-wrapper img {
        transform: none;
    }
}

/* Integration: the client emits images, not padded art wrappers. */
img.card-art { display:block; padding:0; aspect-ratio: 488 / 680; height:auto; object-fit:contain; }
.card-tile { text-align:left; min-width:0; }
.card-tile > .card-meta { padding: .85rem; display:flex; flex-direction:column; align-items:flex-start; gap:.45rem; }
.card-tile > .card-meta strong { font:600 1rem var(--font-heading); color:var(--ink-text-primary); }
.card-tile > .card-price { padding:0 .85rem .85rem; }
.market-row { grid-template-columns:52px minmax(0,1fr) auto; text-align:left; }
.market-row > img.card-art { width:52px; }
.market-row > .card-meta { display:flex; flex-direction:column; align-items:flex-start; }
.detail-layout > img.card-art { max-width:280px; margin:auto; }
.detail-layout > .card-meta { display:flex; flex-direction:column; align-items:flex-start; font-size:.95rem; line-height:1.65; }
.banner-prose { min-width:0; }
@media (max-width:768px) {
 .masthead-inner { flex-wrap:wrap; }
 .masthead-actions { margin-left:auto; }
 .nav-shelf { order:3; width:100%; justify-content:space-around; }
 .tab-shortcut { display:none; }
 .nav-tab { flex:1; justify-content:center; }
 .market-row { grid-template-columns:42px minmax(0,1fr) auto; }
 .market-row > img.card-art { width:42px; }
 .card-tile > .card-meta { padding:.6rem; }
 .card-tile > .card-meta strong { font-size:.85rem; }
 .chart-controls-form { flex-wrap:wrap; }
}

/* Soporte para preferencias de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

