/* Copyright (c) 2026 Yuheng. All rights reserved. Unauthorised copying, reuse or redistribution is not permitted. */
/* ==========================================
   CIRCUIT LAB: INSIDE THE PARTS (the explorer window)
   The window is always dark: it is a stage, whatever the theme of the page is.
========================================== */

.cl-inside-open {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin: 0 0 12px;
}

.cl-inside-open svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.cl-inside-inspect {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin: 4px 0 12px;
    border-color: #5b8fe8;
    background: linear-gradient(135deg, rgba(63, 114, 197, 0.16), rgba(111, 76, 214, 0.16));
}

.cl-inside-inspect svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

body.ci-open {
    overflow: hidden;
}

.ci {
    position: fixed;
    inset: 0;
    z-index: 99997;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(5, 9, 18, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    color: #e8eefc;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.ci.visible {
    opacity: 1;
    visibility: visible;
}

.ci:fullscreen {
    padding: 0;
    background: #070b14;
}

.ci-window {
    position: relative;
    display: flex;
    width: min(1560px, 100%);
    height: min(900px, 100%);
    overflow: hidden;
    border: 1px solid rgba(120, 150, 220, 0.28);
    border-radius: 22px;
    background: radial-gradient(1200px 700px at 30% 0%, #16223d 0%, #0b1224 55%, #070b16 100%);
    box-shadow: 0 40px 120px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transform: translateY(16px) scale(0.985);
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.ci.visible .ci-window {
    transform: none;
}

.ci:fullscreen .ci-window {
    width: 100%;
    height: 100%;
    border-radius: 0;
}

/* ---------- the list of scenes ---------- */

.ci-side {
    flex: 0 0 232px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-right: 1px solid rgba(120, 150, 220, 0.2);
    background: rgba(8, 13, 26, 0.55);
}

.ci-side-head {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px 14px 12px;
    font-size: 15px;
}

.ci-side-head input {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 12px;
    border: 1px solid rgba(120, 150, 220, 0.3);
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.06);
    color: inherit;
    font: inherit;
    font-size: 13px;
}

.ci-side-head input::placeholder {
    color: rgba(232, 238, 252, 0.45);
}

.ci-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0 8px 14px;
    scrollbar-width: thin;
    scrollbar-color: rgba(120, 150, 220, 0.35) transparent;
}

.ci-group h4 {
    margin: 14px 8px 6px;
    color: rgba(160, 185, 245, 0.8);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ci-item {
    display: block;
    width: 100%;
    margin: 1px 0;
    padding: 8px 10px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: rgba(232, 238, 252, 0.84);
    font: inherit;
    font-size: 13.5px;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.ci-item:hover {
    background: rgba(120, 150, 220, 0.16);
    color: #fff;
}

.ci-item.is-on {
    background: linear-gradient(135deg, #3f72c5, #6a55d6);
    color: #fff;
    font-weight: 700;
}

.ci-none {
    margin: 14px 10px;
    color: rgba(232, 238, 252, 0.5);
    font-size: 13px;
}

/* ---------- the main part ---------- */

.ci-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

.ci-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px 10px 20px;
    border-bottom: 1px solid rgba(120, 150, 220, 0.18);
}

.ci-titles {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ci-titles h2 {
    margin: 0;
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ci-cat {
    color: rgba(160, 185, 245, 0.8);
    font-size: 12px;
    font-weight: 700;
}

.ci-variants {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-left: auto;
    padding: 3px;
    border: 1px solid rgba(120, 150, 220, 0.25);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
}

.ci-variants[hidden] {
    display: none;
}

.ci-variants button {
    padding: 6px 12px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: rgba(232, 238, 252, 0.8);
    font: inherit;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
}

.ci-variants button.is-on {
    background: #3f72c5;
    color: #fff;
}

.ci-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    border: 1px solid rgba(120, 150, 220, 0.3);
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.06);
    color: inherit;
    cursor: pointer;
    transition: background 0.15s ease;
}

.ci-icon:hover {
    background: rgba(255, 255, 255, 0.14);
}

.ci-head .ci-icon:last-child {
    margin-left: 4px;
}

.ci-variants[hidden] + .ci-icon {
    margin-left: auto;
}

.ci-menu {
    display: none;
}

.ci-body {
    flex: 1;
    display: flex;
    min-height: 0;
}

/* ---------- the picture ---------- */

.ci-stage {
    position: relative;
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.ci-stage canvas#ciCanvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    outline: none;
    cursor: grab;
    touch-action: none;
}

.ci-stage canvas#ciCanvas:active {
    cursor: grabbing;
}

.ci-labels {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.ci-label {
    position: absolute;
    left: 0;
    top: 0;
    display: flex;
    align-items: center;
    gap: 7px;
    transition: opacity 0.25s ease;
    will-change: transform;
}

.ci-label i {
    flex: 0 0 auto;
    width: 9px;
    height: 9px;
    margin-left: -4px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #3f72c5;
    box-shadow: 0 0 0 3px rgba(63, 114, 197, 0.35);
}

.ci-label span {
    padding: 4px 9px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    background: rgba(8, 13, 26, 0.82);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.ci-label.is-hi i {
    background: #ffcf40;
    box-shadow: 0 0 0 4px rgba(255, 207, 64, 0.4);
}

.ci-label.is-hi span {
    border-color: #ffcf40;
    background: rgba(60, 44, 6, 0.9);
}

.ci-readout {
    position: absolute;
    left: 14px;
    top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-width: calc(100% - 28px);
    pointer-events: none;
}

.ci-readout span {
    display: flex;
    flex-direction: column;
    padding: 6px 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    background: rgba(8, 13, 26, 0.72);
    backdrop-filter: blur(4px);
}

.ci-readout em {
    color: rgba(160, 185, 245, 0.85);
    font-size: 10.5px;
    font-style: normal;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.ci-readout b {
    font-size: 16px;
    font-variant-numeric: tabular-nums;
}

.ci-graph {
    position: absolute;
    right: 14px;
    top: 12px;
    width: 300px;
    height: 167px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    pointer-events: none;
}

.ci-graph[hidden] {
    display: none;
}

.ci-loader {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(7, 11, 22, 0.7);
    font-weight: 700;
}

.ci-loader.is-on {
    display: flex;
}

.ci-spin {
    width: 22px;
    height: 22px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #6aa0ff;
    border-radius: 50%;
    animation: ci-turn 0.8s linear infinite;
}

@keyframes ci-turn {
    to { transform: rotate(360deg); }
}

.ci-toolbar {
    position: absolute;
    left: 50%;
    bottom: 14px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    max-width: calc(100% - 24px);
    padding: 5px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 16px;
    background: rgba(8, 13, 26, 0.8);
    backdrop-filter: blur(8px);
    transform: translateX(-50%);
}

.ci-toolbar button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 11px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: rgba(232, 238, 252, 0.85);
    font: inherit;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease;
}

.ci-toolbar button[hidden] {
    display: none;
}

.ci-toolbar button:hover {
    background: rgba(255, 255, 255, 0.12);
}

.ci-toolbar button.is-on {
    background: rgba(63, 114, 197, 0.55);
    color: #fff;
}

/* ---------- the side panel ---------- */

.ci-info {
    flex: 0 0 372px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 0;
    overflow-y: auto;
    padding: 16px 18px 20px;
    border-left: 1px solid rgba(120, 150, 220, 0.2);
    background: rgba(8, 13, 26, 0.5);
    scrollbar-width: thin;
    scrollbar-color: rgba(120, 150, 220, 0.35) transparent;
}

.ci-summary {
    margin: 0;
    color: rgba(232, 238, 252, 0.92);
    font-size: 14.5px;
    line-height: 1.5;
}

.ci-live {
    padding: 8px 12px;
    border: 1px solid rgba(255, 207, 64, 0.5);
    border-radius: 11px;
    background: rgba(255, 207, 64, 0.1);
    color: #ffe39a;
    font-size: 12.5px;
}

.ci-live[hidden] {
    display: none;
}

.ci-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ci-controls:empty {
    display: none;
}

.ci-slider {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ci-slider-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 13px;
    font-weight: 700;
}

.ci-slider output {
    color: #ffd25a;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.ci-slider input[type="range"] {
    width: 100%;
    height: 22px;
    margin: 0;
    background: transparent;
    accent-color: #5b8fe8;
    cursor: pointer;
}

.ci-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.ci-toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.ci-track {
    position: relative;
    flex: 0 0 auto;
    width: 38px;
    height: 22px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    transition: background 0.2s ease;
}

.ci-track::after {
    content: "";
    position: absolute;
    left: 3px;
    top: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s ease;
}

.ci-toggle input:checked + .ci-track {
    background: #3f72c5;
}

.ci-toggle input:checked + .ci-track::after {
    transform: translateX(16px);
}

.ci-toggle input:focus-visible + .ci-track {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.ci-tour-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.ci-tour-head h3 {
    margin: 0;
    font-size: 14px;
}

.ci-tour-buttons {
    display: flex;
    align-items: center;
    gap: 5px;
}

.ci-small {
    width: 30px;
    height: 30px;
    border-radius: 9px;
}

.ci-tour-play {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 12px;
    border: 0;
    border-radius: 9px;
    background: linear-gradient(135deg, #3f72c5, #6a55d6);
    color: #fff;
    font: inherit;
    font-size: 12.5px;
    font-weight: 800;
    cursor: pointer;
    width: auto;
}

.ci-tour-play.is-on {
    background: #c24b3f;
}

.ci-steps {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ci-steps button {
    display: flex;
    gap: 11px;
    width: 100%;
    padding: 9px 11px;
    border: 1px solid rgba(120, 150, 220, 0.2);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.04);
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.ci-steps button:hover {
    background: rgba(255, 255, 255, 0.09);
}

.ci-steps li.is-on button {
    border-color: #ffcf40;
    background: rgba(255, 207, 64, 0.1);
}

.ci-steps b {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(120, 150, 220, 0.3);
    font-size: 12px;
}

.ci-steps li.is-on b {
    background: #ffcf40;
    color: #231a00;
}

.ci-steps span {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 13px;
}

.ci-steps em {
    color: rgba(232, 238, 252, 0.72);
    font-style: normal;
    line-height: 1.45;
}

.ci-steps li:not(.is-on) em {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---------- small screens ---------- */

@media (max-width: 1180px) {

    .ci-info {
        flex-basis: 320px;
    }

}

@media (max-width: 900px) {

    .ci {
        padding: 0;
    }

    .ci-window {
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .ci-side {
        position: absolute;
        z-index: 5;
        left: 0;
        top: 0;
        bottom: 0;
        width: min(300px, 86%);
        transform: translateX(-102%);
        background: rgba(8, 13, 26, 0.97);
        transition: transform 0.3s ease;
    }

    .ci.ci-menu-open .ci-side {
        transform: none;
    }

    .ci-menu {
        display: grid;
    }

    .ci-body {
        flex-direction: column;
        overflow-y: auto;
    }

    .ci-stage {
        flex: 0 0 62vh;
        min-height: 320px;
    }

    .ci-info {
        flex: 0 0 auto;
        overflow: visible;
        border-left: 0;
        border-top: 1px solid rgba(120, 150, 220, 0.2);
    }

    .ci-graph {
        width: 200px;
        height: 111px;
        right: 8px;
    }

    .ci-toolbar button span {
        display: none;
    }

    .ci-variants {
        margin-left: 0;
    }

    .ci-head {
        flex-wrap: wrap;
    }

}

@media (prefers-reduced-motion: reduce) {

    .ci,
    .ci-window,
    .ci-side,
    .ci-label {
        transition: none;
    }

    .ci-spin {
        animation-duration: 3s;
    }

}
