/* ============================================
   ARTIFACT SCANNER / INVENTORY ARCHIVE
============================================ */

#artifact-scanner {
    --glass-size: 160px;
    --accent: var(--mp-text, #fff);
    --highlight: rgba(255,255,0,.25);
    --chip-bg: rgba(255,255,255,.06);
    --glass-border: rgba(255,255,255,.18);
    margin: 1.5rem auto;
    padding: 1.75rem;
    border-radius: var(--mp-radius, 1rem);
    color: var(--accent);
    background: var(--mp-surface, rgba(255,255,255,.075)) !important;
    box-shadow: 0 .5rem 1.875rem rgba(11,12,20,.35);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial;
}

.scanner-header {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1.8em;
}

.logo-chip {
    padding: .5rem .75rem;
    border-radius: 999px;
    font-size: .875rem;
    font-weight: 700;
    letter-spacing: .04em;
    background: var(--chip-bg);
    backdrop-filter: blur(6px);
}

h3#scanner-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
}

p.lead {
    max-width: 760px;
    margin: .5rem 0 1.125rem;
    opacity: .95;
}

.scanner-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 1.125rem;
    align-items: start;
}

.archive {
    position: relative;
    min-height: 260px;
    padding: 1.125rem;
    border-radius: .9rem;
    color: rgba(255,255,255,.95);
    background: radial-gradient(circle at top left, rgba(124,140,255,.26), transparent 32rem), radial-gradient(circle at 82% 10%, rgba(168,85,247,.20), transparent 34rem), linear-gradient(180deg, #070712 0%, #111122 48%, #070712 100%);
    line-height: 1.55;
    font-size: .95rem;
}

    .archive.confidential {
        position: relative;
        isolation: isolate;
        padding: 2rem;
        color: #d0d0d0;
        background: radial-gradient(circle at 10% 0%, #11111f 0, #020208e6 40%, #000000cf 100%) !important;
        border-radius: .75rem;
        box-shadow: 0 0 0 1px rgba(0,255,180,.12), 0 1.5rem 5rem rgba(0,0,0,.9);
    }

.confidential {
    background: radial-gradient(circle at 10% 0%, #11111f 0, #020208e6 40%, #000000cf 100%) !important;
    box-shadow: 0 0 0 1px rgba(0, 255, 180, .12), 0 1.5rem 5rem rgba(0, 0, 0, .9);
}

/* Controls */
.controls {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: .75rem;
}

    .controls .btn {
        padding: .65rem .75rem;
        border-radius: .75rem;
        color: var(--accent);
        background: linear-gradient(90deg, rgba(255,255,255,.12), rgba(255,255,255,.06));
        border: 1px solid rgba(255,255,255,.08);
        cursor: pointer;
        font-weight: 700;
    }

        .controls .btn.primary {
            background: linear-gradient(90deg, rgba(255,255,255,.18), rgba(255,255,255,.08));
            box-shadow: 0 .375rem 1.125rem rgba(0,0,0,.25);
        }

    .controls .items {
        padding: .5rem;
        border-radius: .6rem;
        font-size: .82rem;
        opacity: .95;
        background: rgba(255,255,255,.03);
    }

/* Magnifier and scanner */
.magnifier {
    position: absolute;
    z-index: 40;
    width: var(--glass-size);
    height: var(--glass-size);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%);
    border: 4px solid var(--glass-border);
    box-shadow: 0 .375rem 1.25rem rgba(0,0,0,.45), inset 0 .375rem 1.125rem rgba(255,255,255,.02);
    backdrop-filter: blur(4px) saturate(1.2);
    mix-blend-mode: screen;
}

    .magnifier .zoom {
        width: 92%;
        height: 92%;
        border-radius: 50%;
        transform: scale(1.6);
        overflow: hidden;
        pointer-events: none;
    }

body.magnifier-active,
.magnifier-active .rune-block {
    cursor: none;
}

.archive {
    position: relative;
    overflow: hidden;
    /* Keep the scan beam / redaction blend modes inside the archive; left uncontained, Edge drops the
       sticky header's backdrop-filter when it repaints (e.g. hovering the favorites bar). */
    isolation: isolate;
}

#scan-beam {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 42px;
    z-index: 20;
    opacity: 0;
    pointer-events: none;
    mix-blend-mode: screen;
    background: linear-gradient( to bottom, rgba(0, 255, 180, 0), rgba(0, 255, 180, .78), rgba(0, 255, 180, 0) );
    box-shadow: 0 0 18px rgba(0, 255, 180, .35);
    transform: translateY(-42px);
    transition: opacity .25s ease;
}

/* Highlights and popovers */
.archive .scan-highlight,
.scan-highlight {
    border-radius: 3px;
    background-color: rgba(0,255,180,.35);
    transition: background-color .4s ease;
    cursor: pointer;
}

    .scan-highlight.revealed {
        background-color: rgba(0,255,180,.75);
    }

.highlight {
    animation: pop .3s ease;
}

/* Scanner / custom popover */
.popover {
    position: fixed;
    z-index: 120;
    display: none;
    width: max-content;
    min-width: 180px;
    max-width: min(320px, calc(100vw - 2rem));
    padding: .75rem .85rem;
    border-radius: .85rem;
    color: var(--mp-text);
    background: radial-gradient(circle at top left, rgba(124, 140, 255, .18), transparent 12rem), rgba(13, 13, 26, .96);
    border: 1px solid var(--mp-border);
    box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, .38);
    backdrop-filter: blur(14px);
    font-size: .82rem;
    line-height: 1.45;
    overflow-wrap: break-word;
}

    .popover .class {
        display: block;
        margin-bottom: .35rem;
        color: var(--mp-gold);
        font-size: .72rem;
        font-weight: 900;
        letter-spacing: .08em;
        text-transform: uppercase;
    }

    .popover .clue {
        color: var(--mp-muted);
        font-size: .8rem;
    }

/* Mobile fix */
@media (max-width: 575.98px) {
    .popover {
        left: .75rem !important;
        right: .75rem !important;
        bottom: .75rem !important;
        top: auto !important;
        width: auto;
        min-width: 0;
        max-width: none;
        padding: .85rem;
        border-radius: 1rem;
        font-size: .8rem;
    }
}

.popover .clue {
    opacity: .9;
}

/* Runes / words */
.rune-block {
    display: inline-block;
    font-family: monospace;
    white-space: pre;
    cursor: pointer;
    transition: transform .2s ease, filter .3s ease;
}

    .rune-block:hover {
        transform: scale(1.25) rotate(3deg);
        filter: brightness(1.4);
    }

.rune-decoding {
    animation: decodeFade .4s ease forwards;
}

.word {
    position: relative;
    transition: color .25s ease;
}

    .word.ghost-reveal {
        color: #9ff;
        text-shadow: 0 0 .5rem #4df;
        font-weight: 800;
    }

    .word.voidborn-reveal {
        color: #ff3b3b;
        text-shadow: 0 0 .75rem #ff0000aa;
        animation: glitch .25s infinite;
    }

    .word.mv-active {
        color: #9fffe0;
        text-shadow: 0 0 .375rem #7fffd4, 0 0 .75rem rgba(127,255,212,.6);
        animation: mvShimmer 1.6s ease-in-out infinite;
    }

        .word.mv-active::after {
            content: "";
            position: absolute;
            left: 50%;
            top: 50%;
            width: 36px;
            height: 36px;
            border-radius: 50%;
            transform: translate(-50%, -50%);
            pointer-events: none;
            box-shadow: 0 0 .75rem .25rem rgba(127,255,212,.35);
            animation: mvPulse 2.4s ease-out infinite;
        }

.ghost-text {
    filter: blur(8px);
    opacity: .4;
    transition: filter .6s ease, opacity .6s ease;
    line-break: anywhere;
}

    .ghost-text.unlocked {
        opacity: 1;
        text-shadow: 0 0 .75rem #fff;
        filter: blur(.07em);
    }

/* Effects */
.helix-beam {
    position: absolute;
    width: 60px;
    height: 100%;
    background: repeating-linear-gradient(45deg, rgba(0,255,255,.25) 0 6px, transparent 6px 12px);
    animation: helix-spin 1.2s linear infinite;
    pointer-events: none;
    opacity: .7;
}

.archive-phase {
    filter: hue-rotate(220deg) invert(1);
    transition: filter .6s ease, opacity .6s ease;
}

.scan-status {
    position: sticky;
    bottom: .75rem;
    z-index: 9;
    width: fit-content;
    padding: .65rem 1rem;
    border-radius: .45rem;
    color: #18144b;
    background: rgba(219,227,231,.89);
    border: 1px solid #6458ff;
    box-shadow: 0 0 .5rem #5e34e8, 0 0 1rem rgb(210 33 142);
    backdrop-filter: blur(6px);
    text-shadow: 0 0 .125rem #6a5dff;
    font-family: "Orbitron", sans-serif;
    font-size: .875rem;
    letter-spacing: .06em;
    animation: flicker 2.5s infinite alternate ease-in-out;
}

    .scan-status::after {
        content: "";
        display: inline-block;
        width: 7px;
        height: 7px;
        margin-left: .5rem;
        border-radius: 50%;
        background: #6d6de1;
        box-shadow: 0 0 .5rem #ff008c;
        animation: pulse 1.2s infinite ease-in-out;
    }

.scan-area {
    position: relative;
}

.glyph {
    position: absolute;
    top: -100px;
    left: 200px;
    width: 300px;
    pointer-events: none;
}

.vote-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
    background: rgba(0,0,0,.4);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,.3);
}

/* Classified theme */
#artifact-scanner .classified-header {
    padding: .875rem;
    border-radius: .65rem;
    color: var(--accent);
    background: rgba(0,0,0,.25);
    border: 2px solid var(--accent);
    text-transform: uppercase;
    letter-spacing: .18em;
    font-weight: 800;
}

#artifact-scanner .section-title {
    margin-bottom: .75rem;
    padding-bottom: .25rem;
    border-bottom: 1px solid rgba(255,255,255,.18);
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: .12em;
    font-size: .85rem;
}

#artifact-scanner .meta-label {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    opacity: .75;
}

#artifact-scanner .badge-clearance {
    color: var(--accent);
    background: rgba(255,0,0,.15);
    border: 1px solid var(--accent);
}

#artifact-scanner .redacted {
    padding: 0 .375rem;
    border-radius: .2rem;
    color: #000;
    background: #000;
}

#artifact-scanner .code-line {
    display: inline-block;
    padding: .375rem .65rem;
    border-radius: .45rem;
    color: var(--accent);
    background: rgba(0,0,0,.35);
    font-family: "JetBrains Mono", monospace;
}

#artifact-scanner .incident-card {
    border-radius: .65rem;
    background: rgba(0,0,0,.25);
    border: 1px solid rgba(255,255,255,.1);
}

#artifact-scanner .subsection {
    margin-top: .75rem;
    font-size: .8rem;
    text-transform: uppercase;
    opacity: .8;
}

.redacted.reactive {
    position: relative;
    display: inline-block;
    padding: .05em .35em;
    color: transparent;
    background: #000;
    border-radius: 2px;
    overflow: hidden;
    text-shadow: none;
    user-select: none;
    cursor: default;
    box-shadow: 0 0 0 1px rgba(0,255,180,.08), 0 0 .75rem rgba(0,0,0,.9);
}

    .redacted.reactive::before {
        content: "";
        position: absolute;
        inset: 0;
        background: repeating-linear-gradient(0deg, #000 0 2px, #050505 2px 3px);
        opacity: .95;
        mix-blend-mode: multiply;
    }

    .redacted.reactive::after {
        content: attr(data-true);
        position: absolute;
        inset: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        color: rgba(0,255,180,0);
        text-transform: uppercase;
        letter-spacing: .06em;
        filter: blur(3px);
        opacity: 0;
        mix-blend-mode: screen;
        pointer-events: none;
    }

    .redacted.reactive.glitching::after {
        opacity: .35;
        color: rgba(0,255,180,.7);
        filter: blur(.8px);
        animation: chromaTear .25s steps(3,end) infinite;
    }

    .redacted.reactive.glitching::before {
        animation: blackoutFight .25s steps(4,end) infinite;
    }

/* Text the Authority Seal decoded (js/Pages/decrypt.js): shown in full, marked as declassified. */
.declassified {
    padding: 0 .3em;
    border-radius: 2px;
    color: #00ffb4;
    background: rgba(0,255,180,.1);
    box-shadow: 0 0 0 1px rgba(0,255,180,.25);
    animation: declassify .6s ease-out;
}

@keyframes declassify {
    from { color: transparent; background: #000; }
    to { color: #00ffb4; background: rgba(0,255,180,.1); }
}

.file-status {
    font-size: x-small;
}

/* MV-7 states */
.mv7-vibrate {
    animation: mv7Vibrate 90ms infinite linear;
}

.mv7-flicker {
    animation: mv7Flicker .8s infinite steps(2);
}

.mv7-glow {
    text-shadow: 0 0 .375rem #ffd100, 0 0 .75rem #c9ff04;
    animation: mv7Glow 1.2s infinite ease-in-out;
}

/* Mobile */
@media (max-width: 880px) {
    .scanner-body {
        grid-template-columns: 1fr;
    }

    .controls {
        flex-direction: row;
        flex-wrap: wrap;
        gap: .65rem;
    }

        .controls .btn,
        .controls .items {
            flex: 1 1 calc(50% - .65rem);
        }

    .popover {
        left: .75rem;
        right: .75rem;
        bottom: .75rem;
        min-width: 0;
    }
}

@media (max-width: 768px) {
    #artifact-scanner {
        padding: 1rem;
    }

    .archive.confidential {
        padding: 1.125rem;
        font-size: .9rem;
        line-height: 1.45;
    }

    .redacted.reactive {
        max-width: 100%;
        overflow-wrap: break-word;
        word-break: break-word;
        white-space: normal;
    }

    .code-line,
    #artifact-scanner .code-line {
        display: block;
        max-width: 100%;
        overflow-x: auto;
        white-space: nowrap;
    }

    #artifact-scanner .section-title {
        font-size: .75rem;
        letter-spacing: .1em;
    }

    .classified-header,
    #artifact-scanner .classified-header {
        font-size: .85rem;
        text-align: center;
        line-height: 1.3;
    }

    .incident-card {
        width: 100%;
        padding: .875rem;
    }

    .magnifier {
        width: 120px;
        height: 120px;
    }

        .magnifier .zoom {
            transform: scale(1.3);
        }

    .artifact-card,
    .artifact-image {
        width: 100%;
        max-width: 100%;
        height: auto;
    }
}

/* Keyframes */
@keyframes pop {
    0%, 100% {
        transform: scale(1);
        background: yellow;
    }

    50% {
        transform: scale(1.2);
        background: gold;
    }
}

@keyframes decodeFade {
    from {
        opacity: 0;
        transform: scale(1.3);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes helix-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(.8);
        opacity: .6;
    }

    50% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes flicker {
    0% {
        opacity: .8;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: .9;
    }
}

@keyframes mv7Vibrate {
    0%, 100% {
        transform: translate(0,0);
    }

    25% {
        transform: translate(1px,-1px);
    }

    50% {
        transform: translate(-1px,1px);
    }

    75% {
        transform: translate(1px,1px);
    }
}

@keyframes mv7Flicker {
    0%, 50%, 100% {
        opacity: 1;
    }

    10% {
        opacity: .4;
    }

    20% {
        opacity: .9;
    }

    35% {
        opacity: .2;
    }

    65% {
        opacity: .3;
    }

    80% {
        opacity: .8;
    }
}

@keyframes mv7Glow {
    0%, 100% {
        opacity: .7;
    }

    50% {
        opacity: 1;
    }
}

@keyframes mvShimmer {
    0%, 100% {
        opacity: .85;
        text-shadow: 0 0 .25rem #7fffd4;
    }

    50% {
        opacity: 1;
        text-shadow: 0 0 .75rem #aaffee;
    }
}

@keyframes mvPulse {
    0%, 100% {
        transform: translate(-50%,-50%) scale(.85);
        opacity: .45;
    }

    70% {
        transform: translate(-50%,-50%) scale(1.25);
        opacity: .15;
    }
}

@keyframes chromaTear {
    0%, 100% {
        transform: translate(0,0);
    }

    25% {
        transform: translate(-1px,-1px);
    }

    50% {
        transform: translate(1px,1px);
    }

    75% {
        transform: translate(-1px,1px);
    }
}

@keyframes blackoutFight {
    0%, 100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-1px);
    }

    50% {
        transform: translateX(1px);
    }

    75% {
        transform: translateX(-2px);
    }
}
/* Scanner Aside */
.scanner-side-panel {
    display: grid;
    gap: 1rem;
    align-content: start;
}

/* Stats */
.scanner-status-grid {
    display: grid;
    gap: .75rem;
}

.scanner-stat-card {
    display: grid;
    grid-template-columns: 2.75rem minmax(0, 1fr);
    align-items: center;
    gap: .75rem;
    padding: .85rem;
    border-radius: var(--mp-radius);
}

.scanner-stat-icon {
    width: 2.75rem;
    height: 2.75rem;
    display: grid;
    place-items: center;
    border-radius: .9rem;
    color: #111122;
    background: linear-gradient(135deg, var(--mp-gold), #fff2b8);
    box-shadow: 0 0 1.5rem rgba(246, 200, 95, .12);
}

    .scanner-stat-icon i {
        font-size: 1.15rem;
    }

.scanner-stat-label {
    display: block;
    margin-bottom: .2rem;
    color: var(--mp-muted);
    font-size: .68rem;
    font-weight: 900;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.scanner-stat-card strong {
    display: block;
    color: var(--mp-text);
    font-size: .95rem;
    font-weight: 950;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

/* Inventory Panel */
.scanner-inventory-panel {
    padding: 1rem;
    border-radius: var(--mp-radius);
    overflow: hidden;
}

.scanner-inventory-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: 1rem;
}

    .scanner-inventory-header h3 {
        margin: .35rem 0 0;
        color: var(--mp-text);
        font-size: 1.15rem;
        font-weight: 950;
        letter-spacing: -.03em;
    }

.scanner-inventory-count {
    min-width: 2rem;
    height: 2rem;
    display: grid;
    place-items: center;
    padding: 0 .55rem;
    border-radius: 999px;
    color: #111122;
    background: linear-gradient(135deg, var(--mp-gold), #fff2b8);
    font-size: .8rem;
    font-weight: 950;
}

/* Inventory Grid */
.scanner-inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: .75rem;
}

    .scanner-inventory-grid::-webkit-scrollbar {
        width: 7px;
    }

    .scanner-inventory-grid::-webkit-scrollbar-track {
        background: var(--mp-card);
        border-radius: 999px;
    }

    .scanner-inventory-grid::-webkit-scrollbar-thumb {
        background: rgba(246, 200, 95, .45);
        border-radius: 999px;
    }

/* Artifact Card */
/* A fixed 3:4 tile whatever the image (or no image) is, so the tools grid never stretches. */
.scanner-artifact-card {
    position: relative;
    aspect-ratio: 3 / 4;
    border-radius: 1rem;
    background: rgba(255, 255, 255, .055);
    border: 1px solid var(--mp-card-hover);
    overflow: hidden;
    box-shadow: 0 .9rem 2rem rgba(0, 0, 0, .18);
}

.scanner-artifact-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.scanner-artifact-placeholder {
    display: grid;
    place-items: center;
    color: var(--mp-gold);
    font-size: 1.6rem;
    background: radial-gradient(circle at 50% 35%, rgba(247, 211, 122, .18), transparent 70%), var(--mp-card);
}

.scanner-edition-badge {
    position: absolute;
    top: .45rem;
    right: .45rem;
    z-index: 3;
    min-width: 1.75rem;
    height: 1.75rem;
    display: grid;
    place-items: center;
    padding: 0 .45rem;
    border-radius: 999px;
    color: #111122;
    background: linear-gradient(135deg, var(--mp-gold), #fff2b8);
    font-size: .72rem;
    font-weight: 950;
    border: 1px solid rgba(255, 255, 255, .22);
}

/* Select Overlay */
.scanner-artifact-select {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: .55rem;
    border: 0;
    color: var(--mp-text);
    background: linear-gradient( 180deg, rgba(7, 7, 18, 0) 35%, rgba(7, 7, 18, .86) 100% );
    cursor: pointer;
    opacity: 0;
    transition: opacity .2s ease;
}

.scanner-artifact-card:hover .scanner-artifact-select,
.scanner-artifact-card:focus-within .scanner-artifact-select {
    opacity: 1;
}

.scanner-artifact-select span {
    position: absolute;
    left: .55rem;
    right: .55rem;
    bottom: 4.5rem;
    color: var(--mp-text);
    font-weight: 850;
    line-height: 1.15;
    text-align: center;
    overflow-wrap: anywhere;
}

.scanner-artifact-select strong {
    width: 100%;
    min-height: 2rem;
    display: grid;
    place-items: center;
    border-radius: 999px;
    color: #111122;
    background: linear-gradient(135deg, var(--mp-gold), #fff2b8);
    font-size: .72rem;
    font-weight: 950;
    letter-spacing: .05em;
    text-transform: uppercase;
}

/* Mobile */
@media (max-width: 991.98px) {
    .scanner-status-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .scanner-stat-card {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .scanner-stat-icon {
        margin: 0 auto;
    }

    .scanner-inventory-grid {
        max-height: none;
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    }
}

@media (max-width: 575.98px) {
    .scanner-status-grid {
        grid-template-columns: 1fr;
    }

    .scanner-inventory-panel {
        padding: .85rem;
    }

    .scanner-inventory-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .65rem;
    }

    .scanner-artifact-card {
        min-height: 0;
    }

    .scanner-artifact-select {
        opacity: 1;
    }
}

.magnifier {
    width: 120px;
    height: 120px;
}

    .magnifier .zoom {
        transform: scale(1.3);
    }
.unlock-seal {
    width: 21em;
    animation: pulse 2s infinite;
    display: block;
    margin: auto;
}
.contract-seal-bg {
    position: absolute;
    bottom: 12em;
    right: 0em;
    width: 10em;
    height: 10em;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 99;
}