/* ---------------------------------------------------------------
   Encantamientos (selector, etiqueta sobre el retrato y brillo de bordes)
   --------------------------------------------------------------- */
:root {
    --pixel: 'Pixelify Sans', 'Press Start 2P', 'Courier New', monospace;
    --enc-border: #a8693a;
}

/* ---------- Brillo periódico sobre el borde ----------
   Un destello blanco recorre SOLO el aro del borde (máscara) cada pocos
   segundos. El tamaño del aro sale de --ring. */
.enc-shine { position: relative; }
.enc-shine::after {
    content: '';
    position: absolute; inset: 0;
    border-radius: inherit;
    padding: var(--ring, 3px);
    background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,.95) 50%, transparent 60%) no-repeat;
    background-size: 250% 100%;
    background-position: 100% 0;
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
    pointer-events: none;
    display: none;   /* brillo del borde desactivado */
}
@keyframes encRing {
    0%   { background-position: 100% 0; }
    28%  { background-position: 0 0; }
    100% { background-position: 0 0; }
}
.portrait-wrap.enc-shine { --ring: 4px; }
.portrait-wrap.enc-shine::after { z-index: 2; }

/* ---------- Etiqueta con el nombre, sobre el retrato ---------- */
.portrait-wrap.enc-on { box-shadow: 0 8px 40px rgba(0,0,0,.6); }   /* sin resplandor de color */
.enc-label {
    /* Dentro de la carta, algo por debajo del borde superior, como en el juego */
    position: absolute; left: 50%; top: 7%; z-index: 3;
    transform: translateX(-50%);
    display: inline-grid;
    white-space: nowrap; pointer-events: none; text-transform: uppercase;
    font-family: 'Press Start 2P', var(--pixel); font-weight: 400; letter-spacing: 0; line-height: 1;
    font-size: var(--fs, 24px);
    /* caja oscura del color del encantamiento, con esquinas "escalonadas" de píxel */
    padding: .14em .2em .1em;
    background: color-mix(in srgb, var(--t2, #aaa) 28%, #000);
    --px: .14em;
    clip-path: polygon(0 var(--px), var(--px) var(--px), var(--px) 0,
        calc(100% - var(--px)) 0, calc(100% - var(--px)) var(--px), 100% var(--px),
        100% calc(100% - var(--px)), calc(100% - var(--px)) calc(100% - var(--px)), calc(100% - var(--px)) 100%,
        var(--px) 100%, var(--px) calc(100% - var(--px)), 0 calc(100% - var(--px)));
}
.enc-label > span { grid-area: 1 / 1; }
.enc-stroke { display: none; }
.enc-fill {
    color: transparent;
    background:
        linear-gradient(105deg, transparent 42%, rgba(255,255,255,.95) 50%, transparent 58%) no-repeat,
        linear-gradient(var(--tdir, 180deg), var(--t1, #fff) var(--t1s, 0%), var(--t2, #aaa) var(--t2s, 100%));
    background-size: 250% 100%, 100% 100%;
    background-position: 100% 0, 0 0;
    -webkit-background-clip: text; background-clip: text;
    animation: encText 5s ease-in-out infinite;
}
@keyframes encText {
    0%   { background-position: 100% 0, 0 0; }
    28%  { background-position: 0 0, 0 0; }
    100% { background-position: 0 0, 0 0; }
}
.enc-label.enc-pop { animation: encPop .35s ease-out; }
@keyframes encPop {
    from { opacity: 0; transform: translateX(-50%) scale(.85); }
    to   { opacity: 1; transform: translateX(-50%) scale(1); }
}

/* ---------- Desplegable (mismo aspecto que el del juego) ---------- */
.enc-picker { position: relative; max-width: 560px; font-family: var(--pixel); }
.enc-trigger {
    width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
    background: #0b0916; color: #8a8697;
    border: 2px solid var(--enc-border); border-radius: 12px;
    padding: 10px 14px; cursor: pointer;
    font: 700 17px/1.2 var(--pixel); letter-spacing: .5px; text-align: left;
    --ring: 2px;
}
.enc-trigger.has-value { color: #fff; border-color: transparent;
    background: linear-gradient(#0b0916, #0b0916) padding-box,
                linear-gradient(135deg, var(--c1), var(--c2)) border-box; }
.enc-trigger:hover { border-color: #d28a4a; }
.enc-trigger.has-value:hover { border-color: transparent; }
.enc-trigger:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.enc-trigger-text { display: inline-flex; align-items: center; gap: 10px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.enc-caret { font-size: 13px; opacity: .8; }

.enc-list {
    position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 60;
    list-style: none; margin: 0; padding: 0;
    max-height: 340px; overflow-y: auto;
    background: #0b0916; border: 2px solid var(--enc-border); border-radius: 14px;
    box-shadow: 0 14px 40px rgba(0,0,0,.7);
    scrollbar-width: thin; scrollbar-color: #7a4f2c #0b0916;
}
.enc-list::-webkit-scrollbar { width: 8px; }
.enc-list::-webkit-scrollbar-thumb { background: #7a4f2c; border-radius: 4px; }
.enc-option {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; cursor: pointer; outline: none;
    color: #fff; font-weight: 700; font-size: 15px; line-height: 1.3;
    border-bottom: 1px solid #2a1018;
}
.enc-option:last-child { border-bottom: none; }
.enc-option-none { color: #6f6b7d; }
.enc-option:hover, .enc-option:focus { background: linear-gradient(90deg, #2a1236, #3a1a4a); }
.enc-option[aria-selected="true"] { background: #1a1026; }
.enc-option-text { min-width: 0; overflow-wrap: anywhere; }
.enc-dot {
    flex: none; width: 14px; height: 14px; border-radius: 4px;
    background: linear-gradient(135deg, var(--c1), var(--c2));
    box-shadow: 0 0 0 1px rgba(255,255,255,.25);
}

/* ---------- Panel de información ---------- */
.enc-info { margin-top: 18px; }
.enc-head { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.enc-name { font: 800 1.35rem/1 var(--pixel); color: #ff9a4a; letter-spacing: 1px; }
.enc-icon {
    flex: none; width: 48px; height: 48px; border-radius: 12px;
    display: grid; place-items: center; overflow: hidden;
    background: linear-gradient(#14101e, #14101e) padding-box,
                linear-gradient(135deg, var(--c1), var(--c2)) border-box;
    border: 3px solid transparent;
    --ring: 3px;
}
.enc-icon img { width: 100%; height: 100%; padding: 3px; object-fit: contain; display: block; }
.enc-glyph { font-size: 22px; line-height: 1; }
.enc-sec { margin: 12px 0 4px; font: 800 13px/1 var(--pixel); letter-spacing: 1.5px; color: #ff9a4a; text-transform: uppercase; }
.enc-ul { list-style: none; margin: 0; padding: 0; font-size: 13px; font-weight: 700; color: #dcdcec; }
.enc-ul li::before { content: '● '; font-size: 9px; vertical-align: middle; color: #cfcfe0; }
.enc-ul li { margin: 2px 0; }
.enc-note { margin-top: 12px; font-size: 11px; color: var(--muted); }

@media (max-width: 700px) {
    .enc-option { font-size: 13px; padding: 11px 12px; }
}
@media (prefers-reduced-motion: reduce) {
    .enc-shine::after, .enc-fill, .enc-label.enc-pop { animation: none !important; }
    .enc-shine::after { display: none; }
}
