/* ==========================================================================
   COMPONENTS — BOOT CURTAIN, CURSOR, POPOVERS, MODALS, TOAST, COLLAPSE BAR
   ========================================================================== */

/* BIOS BOOT CURTAIN */
.boot-curtain {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: #090a0c;
    background-image: repeating-linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.02) 0 1px,
        transparent 1px 3px
    );
    color: #f4f4f0;
    font-family: var(--font-mono);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    transition: transform 0.38s cubic-bezier(0.76, 0, 0.24, 1), opacity 0.28s ease;
}

.boot-curtain.done {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

.boot-box {
    width: 100%;
    max-width: 530px;
    border: 2px solid #f4f4f0;
    box-shadow: 8px 8px 0 #df1b2f;
    padding: 1.55rem;
    background: #101216;
}

.boot-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #2b303a;
    padding-bottom: 0.6rem;
    margin-bottom: 0.95rem;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: #ff4763;
}

.boot-line {
    font-size: 0.79rem;
    margin-bottom: 0.38rem;
    word-break: break-word;
}

.boot-ok { color: #4ade80; font-weight: 700; }
.boot-lock { color: #facc15; font-weight: 700; }

.boot-bar {
    height: 10px;
    border: 2px solid #f4f4f0;
    margin: 1rem 0 0.7rem;
    background: #08090b;
}

.boot-fill {
    height: 100%;
    width: 0%;
    background: #df1b2f;
    transition: width 0.68s linear;
}

.boot-skip {
    font-size: 0.67rem;
    color: #9ca0ab;
    text-transform: uppercase;
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
}

/* COLLAPSE EASTER EGG BANNER */
.rebuild-bar {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%) translateY(-160%);
    z-index: 1500;
    background: var(--accent);
    color: var(--accent-ink);
    border: var(--border);
    box-shadow: var(--shadow-lg);
    padding: 0.72rem 1.15rem;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 800;
    transition: transform 0.28s var(--ease-snappy);
}

.rebuild-bar.show {
    transform: translateX(-50%) translateY(0);
}

body.collapsed .collapsible {
    transition: transform 0.95s var(--ease-snappy) !important;
    transform: translate(var(--cx, 0px), var(--cy, 90px)) rotate(var(--cr, 8deg)) !important;
}

/* PARTICLE FX CANVAS + CROSSHAIR RETICLE */
#fxCanvas {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 950;
}

.cursor-ring {
    position: fixed;
    top: 0;
    left: 0;
    width: 22px;
    height: 22px;
    border: 2px solid var(--accent);
    pointer-events: none;
    z-index: 960;
    opacity: 0;
    transform: translate3d(-100px, -100px, 0);
    transition: width 0.14s ease, height 0.14s ease, background-color 0.14s ease, opacity 0.2s ease;
    mix-blend-mode: difference;
}

.cursor-ring.visible { opacity: 1; }

.cursor-ring.active {
    width: 34px;
    height: 34px;
    background: rgba(255, 255, 255, 0.14);
}

.cursor-ring.pressed {
    width: 15px;
    height: 15px;
    background: var(--accent);
}

@media (hover: none), (pointer: coarse) {
    .cursor-ring { display: none !important; }
}

/* LAB MISSION CHECKLIST POPOVER */
.xp-popover {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    width: 304px;
    max-width: calc(100vw - 1.5rem);
    background: var(--surface);
    border: var(--border);
    box-shadow: var(--shadow-lg);
    padding: 0.95rem;
    z-index: 300;
    display: none;
    font-family: var(--font-mono);
}

.xp-popover.open {
    display: block;
    animation: modalPop 0.16s ease;
}

.xp-pop-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: var(--border);
    padding-bottom: 0.48rem;
    margin-bottom: 0.68rem;
    font-size: 0.71rem;
    font-weight: 800;
}

.xp-list {
    list-style: none;
    display: grid;
    gap: 0.45rem;
    font-size: 0.71rem;
}

.xp-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.32rem 0.44rem;
    border: 1.5px dashed var(--hairline-strong);
}

.xp-list li.done {
    background: var(--surface-2);
    border-style: solid;
    border-color: var(--border-color);
    font-weight: 700;
}

.xp-jump {
    background: var(--surface-invert);
    color: var(--ink-invert);
    border: none;
    padding: 0.16rem 0.42rem;
    font-family: inherit;
    font-size: 0.64rem;
    font-weight: 800;
    cursor: pointer;
    text-transform: uppercase;
}

.xp-jump:hover {
    background: var(--accent);
    color: var(--accent-ink);
}

/* MODALS */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(8, 9, 12, 0.76);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.15rem;
    z-index: 600;
}

.modal-backdrop.open {
    display: flex;
    animation: fadeIn 0.14s ease;
}

.modal-card {
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    max-height: 90dvh;
    overflow-y: auto;
    background: var(--surface);
    color: var(--ink);
    border: var(--border);
    box-shadow: var(--shadow-lg);
    animation: modalPop 0.18s var(--ease-snappy);
}

.modal-head {
    background: var(--surface-invert);
    color: var(--ink-invert);
    padding: 0.85rem 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    font-family: var(--font-mono);
    border-bottom: var(--border);
    position: sticky;
    top: 0;
    z-index: 5;
}

.modal-head-title {
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.modal-close {
    background: var(--accent);
    color: var(--accent-ink);
    border: 2px solid var(--ink-invert);
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: 0.72rem;
    padding: 0.24rem 0.56rem;
    cursor: pointer;
    flex-shrink: 0;
}

.modal-body {
    padding: 1.45rem;
    display: flex;
    flex-direction: column;
    gap: 0.95rem;
}

.modal-stamp {
    display: inline-block;
    width: fit-content;
    font-family: var(--font-mono);
    font-size: 0.69rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: var(--accent);
    border: 1.5px solid var(--accent);
    background: var(--accent-soft);
    padding: 0.18rem 0.52rem;
    text-transform: uppercase;
}

.modal-body h3 {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 1.62rem;
    letter-spacing: -0.025em;
    text-transform: uppercase;
    line-height: 1.08;
}

.modal-body p {
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.6;
    word-break: break-word;
}

.arch-box {
    border: var(--border);
    background: var(--bg-elev);
    padding: 0.75rem;
    overflow-x: auto;
}

.arch-svg {
    width: 100%;
    min-width: 340px;
    height: auto;
    display: block;
}

.arch-flow {
    stroke-dasharray: 7 5;
    animation: dashFlow 1.1s linear infinite;
}

.modal-highlights {
    list-style: none;
    border-top: 1px solid var(--hairline-strong);
    border-bottom: 1px solid var(--hairline-strong);
    padding: 0.9rem 0;
    display: grid;
    gap: 0.48rem;
    font-family: var(--font-mono);
    font-size: 0.79rem;
    line-height: 1.55;
}

.modal-highlights li::before {
    content: "▸ ";
    color: var(--accent);
    font-weight: 800;
}

.modal-omega {
    background: var(--surface-invert);
    color: var(--ink-invert);
    padding: 0.82rem 1rem;
    border-left: 5px solid var(--accent);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    line-height: 1.55;
}

.modal-omega strong {
    color: var(--accent);
    display: block;
    margin-bottom: 0.22rem;
    text-transform: uppercase;
}

.modal-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.7rem;
}

/* COMMAND PALETTE */
.cmdk-card {
    max-width: 560px;
}

.cmdk-input {
    width: 100%;
    font-family: var(--font-mono);
    font-size: 0.88rem;
    font-weight: 700;
    padding: 0.92rem 1.15rem;
    border: none;
    border-bottom: var(--border);
    background: var(--surface-2);
    color: var(--ink);
}

.cmdk-list {
    list-style: none;
    max-height: 330px;
    overflow-y: auto;
}

.cmdk-item {
    padding: 0.76rem 1.15rem;
    border-bottom: 1px solid var(--hairline);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.79rem;
}

.cmdk-item:hover,
.cmdk-item.active {
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 800;
}

.cmdk-cat {
    font-size: 0.65rem;
    opacity: 0.78;
    text-transform: uppercase;
    flex-shrink: 0;
}

/* DISPATCH FORM FIELDS */
.field-label {
    font-family: var(--font-mono);
    font-size: 0.71rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    display: block;
    margin-bottom: 0.34rem;
}

.field-input,
.field-textarea {
    width: 100%;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    padding: 0.65rem 0.78rem;
    border: var(--border);
    background: var(--surface-2);
    color: var(--ink);
}

.field-textarea {
    min-height: 98px;
    resize: vertical;
}

.topic-row {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
}

/* TOAST */
.toast {
    position: fixed;
    bottom: 1.4rem;
    right: 1.4rem;
    background: var(--surface-invert);
    color: var(--ink-invert);
    border: var(--border);
    box-shadow: var(--shadow);
    padding: 0.75rem 1.15rem;
    font-family: var(--font-mono);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 999;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

