@keyframes targetFlash {
    0%   { color: var(--accent-2); }
    100% { color: var(--strong, var(--text)); }
}
@keyframes cardFlash {
    0%   { border-color: rgba(154, 140, 255, 0.8); box-shadow: 0 0 0 4px rgba(154, 140, 255, 0.22); }
    100% { border-color: var(--border); box-shadow: 0 0 0 4px transparent; }
}
.wiki-content :is(h2, h3, h4):target { animation: targetFlash 2.2s ease-out; }
@media (prefers-reduced-motion: reduce) {
    .wiki-content :is(h2, h3, h4):target { animation: none; color: var(--accent-2); }
}
.copyable {
    position: relative;
    cursor: pointer;
}
.cmd-list .command.copyable:hover {
    filter: brightness(1.25);
}
.wiki-content code.copyable:hover {
    box-shadow: 0 0 0 1px rgba(154, 140, 255, 0.5);
}
.copyable:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.copyable.copied::after {
    content: "Copied!";
    position: absolute;
    left: 50%;
    bottom: calc(100% + 6px);
    transform: translateX(-50%);
    padding: 2px 9px;
    border-radius: 6px;
    background: #55FF55;
    color: #0b2a0b;
    font: 600 0.72rem/1.5 system-ui, sans-serif;
    white-space: nowrap;
    pointer-events: none;
    z-index: 5;
}
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(8, 6, 6, 0.92);
}
.lightbox[hidden] { display: none; }
.lightbox figure {
    margin: 0;
    max-width: 100%;
    text-align: center;
}
.lightbox img {
    display: block;
    max-width: min(92vw, 1600px);
    max-height: 80vh;
    margin: 0 auto;
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.lightbox figcaption {
    margin-top: 12px;
    color: var(--muted);
    font-size: 0.9rem;
}
.lightbox button {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    background: rgba(24, 20, 20, 0.92);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: border-color .2s;
}
.lightbox button:hover { border-color: rgba(255, 159, 67, 0.55); }
.lightbox .lb-close { top: 16px; right: 16px; }
.lightbox .lb-prev,
.lightbox .lb-next { top: 50%; transform: translateY(-50%); }
.lightbox .lb-prev { left: 16px; }
.lightbox .lb-next { right: 16px; }
.lightbox.single .lb-prev,
.lightbox.single .lb-next { display: none; }
@media (max-width: 600px) {
    .lightbox .lb-prev,
    .lightbox .lb-next { top: auto; bottom: 16px; transform: none; }
}
.to-top {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--accent);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity .2s, transform .2s, border-color .2s;
}
.to-top.show {
    opacity: 1;
    pointer-events: auto;
    transform: none;
}
.to-top:hover { border-color: rgba(255, 159, 67, 0.55); }
@media (max-width: 900px) {
    body:has(.toc-fab) .to-top { bottom: 80px; }
}
