html {
    background: #030403;
}

body[data-page="memory"] {
    --bg: #050706;
    --bg-soft: #090c0b;
    --ink: #eff7f2;
    --muted: rgba(229, 241, 234, 0.62);
    --quiet: rgba(229, 241, 234, 0.4);
    --line: rgba(202, 255, 226, 0.11);
    --line-strong: rgba(202, 255, 226, 0.2);
    --glass: rgba(6, 10, 8, 0.58);
    --glass-strong: rgba(7, 11, 9, 0.78);
    --green: #66e6ad;
    --blue: #79a7ff;
    --gold: #d9ae5f;
    --red: #ff7373;
    min-height: 100vh;
    color: var(--ink);
    background:
        radial-gradient(circle at 18% 8%, rgba(102, 230, 173, 0.08), transparent 27%),
        radial-gradient(circle at 82% 12%, rgba(121, 167, 255, 0.07), transparent 28%),
        linear-gradient(180deg, #080b0a 0%, #050706 58%, #030403 100%) !important;
}

body[data-page="memory"] .site-header,
body[data-page="memory"] .site-nav {
    background: rgba(5, 7, 6, 0.76);
    border-color: rgba(202, 255, 226, 0.08);
    color: rgba(239, 247, 242, 0.74);
    backdrop-filter: blur(22px);
}

body[data-page="memory"] .site-footer,
body[data-page="memory"] .summer-sunbeam-layer,
body[data-page="memory"] .winter-snow-layer {
    display: none;
}

body[data-page="memory"] .site-nav a {
    color: rgba(239, 247, 242, 0.72);
}

body[data-page="memory"] .site-nav a.active {
    color: var(--green);
    border-color: var(--green);
}

body[data-page="memory"] .site-logo,
body[data-page="memory"] .header-note {
    color: rgba(239, 247, 242, 0.72);
}

.memory-main {
    width: min(1560px, calc(100vw - 28px));
    max-width: 1560px;
    margin: 0 auto;
    padding: 0 !important;
    overflow-x: hidden;
}

.memory-shell {
    display: grid;
    gap: 12px;
    min-width: 0;
}

.memory-hero {
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 2px;
}

.workbench-title {
    display: grid;
    gap: 2px;
}

.memory-kicker,
.graph-mode {
    color: var(--green);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.memory-hero h1 {
    margin: 0;
    color: var(--ink);
    font-size: 22px;
    line-height: 1.1;
    font-weight: 780;
    letter-spacing: 0;
}

.memory-telemetry {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    min-width: 0;
}

.memory-health-ring {
    --score: 0;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    background:
        radial-gradient(circle at center, rgba(7, 10, 9, 0.98) 0 56%, transparent 57%),
        conic-gradient(var(--green) calc(var(--score) * 1%), rgba(239, 247, 242, 0.1) 0);
    box-shadow: 0 0 26px rgba(102, 230, 173, 0.1);
}

.memory-health-ring span {
    color: var(--ink);
    font-size: 13px;
    font-weight: 780;
    line-height: 1;
}

.memory-health-ring small {
    display: none;
}

.memory-metric {
    min-width: 72px;
    height: 42px;
    display: grid;
    align-content: center;
    gap: 1px;
    padding: 0 11px;
    border: 1px solid rgba(202, 255, 226, 0.09);
    border-radius: 999px;
    background: rgba(239, 247, 242, 0.035);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.memory-metric-view {
    border-color: rgba(121, 167, 255, 0.2);
    background: linear-gradient(135deg, rgba(121, 167, 255, 0.11), rgba(102, 230, 173, 0.035));
}

.memory-metric span {
    color: var(--quiet);
    font-size: 9px;
    font-weight: 720;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.memory-metric strong {
    color: var(--ink);
    font-size: 14px;
    line-height: 1;
    font-weight: 780;
    letter-spacing: 0;
}

.memory-console {
    min-width: 0;
}

.memory-stage {
    position: relative;
    width: 100%;
    min-width: 0;
    height: min(820px, calc(100vh - 174px));
    min-height: 690px;
    overflow: hidden;
    border: 1px solid rgba(202, 255, 226, 0.1);
    border-radius: 24px;
    background:
        radial-gradient(circle at 18% 18%, rgba(102, 230, 173, 0.1), transparent 25%),
        radial-gradient(circle at 78% 28%, rgba(121, 167, 255, 0.09), transparent 25%),
        radial-gradient(circle at 52% 86%, rgba(217, 174, 95, 0.06), transparent 32%),
        linear-gradient(180deg, var(--bg-soft), var(--bg));
    box-shadow:
        0 34px 92px rgba(0, 0, 0, 0.42),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transition: border-color .22s ease, box-shadow .22s ease, transform .22s ease;
}

.memory-shell.orbiting .memory-stage {
    border-color: rgba(121, 167, 255, 0.28);
    box-shadow:
        0 38px 98px rgba(0, 0, 0, 0.48),
        0 0 0 1px rgba(121, 167, 255, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.memory-shell.pulsing .memory-stage {
    border-color: rgba(102, 230, 173, 0.42);
}

.memory-stage::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.024) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.024) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(circle at center, black 0%, transparent 78%);
}

.memory-stage::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 12%, transparent 86%, rgba(0, 0, 0, 0.34)),
        linear-gradient(90deg, rgba(0, 0, 0, 0.38), transparent 18%, transparent 82%, rgba(0, 0, 0, 0.34));
}

.memory-canvas {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.memory-canvas canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.memory-graph-topbar {
    position: absolute;
    top: 20px;
    left: 22px;
    right: 22px;
    z-index: 6;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    pointer-events: none;
}

.memory-graph-topbar > div:first-child {
    display: grid;
    gap: 3px;
}

.memory-graph-topbar strong {
    color: var(--ink);
    font-size: 25px;
    line-height: 1;
    font-weight: 780;
    letter-spacing: 0;
}

.memory-graph-topbar small {
    color: var(--quiet);
    font-size: 11px;
}

.graph-action-stack {
    display: grid;
    justify-items: end;
    gap: 8px;
    pointer-events: auto;
}

.graph-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 7px;
    pointer-events: auto;
}

.graph-actions button,
.memory-view-switch button,
.memory-reset,
.detail-close {
    min-height: 32px;
    border: 1px solid rgba(202, 255, 226, 0.12);
    border-radius: 999px;
    background: rgba(8, 12, 10, 0.58);
    color: rgba(239, 247, 242, 0.78);
    font: inherit;
    font-size: 11px;
    font-weight: 760;
    letter-spacing: 0;
    cursor: pointer;
    backdrop-filter: blur(18px);
    transition: border-color .16s ease, color .16s ease, background .16s ease, transform .16s ease;
}

.graph-actions button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 11px 0 8px;
}

.action-symbol {
    width: 18px;
    height: 18px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(239, 247, 242, 0.08);
    color: rgba(239, 247, 242, 0.78);
    font-size: 9px;
    font-weight: 850;
}

.memory-view-switch {
    display: inline-flex;
    padding: 3px;
    border: 1px solid rgba(202, 255, 226, 0.1);
    border-radius: 999px;
    background: rgba(6, 9, 8, 0.46);
    backdrop-filter: blur(18px);
}

.memory-view-switch button {
    min-height: 26px;
    padding: 0 10px;
    border-color: transparent;
    background: transparent;
    color: rgba(239, 247, 242, 0.52);
    font-size: 10px;
}

.graph-actions button:hover,
.graph-actions button[aria-expanded="true"],
.graph-actions button[aria-pressed="true"],
.memory-view-switch button:hover,
.memory-view-switch button[aria-pressed="true"],
.memory-reset:hover,
.detail-close:hover {
    border-color: rgba(102, 230, 173, 0.5);
    color: #fff;
    background: rgba(15, 24, 20, 0.82);
}

.graph-actions button:hover,
.memory-view-switch button:hover {
    transform: translateY(-1px);
}

.memory-legend {
    position: absolute;
    left: 22px;
    top: 94px;
    z-index: 6;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-width: 360px;
}

.memory-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 24px;
    padding: 0 9px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 999px;
    background: rgba(6, 9, 8, 0.48);
    color: rgba(239, 247, 242, 0.62);
    font-size: 10px;
    backdrop-filter: blur(16px);
}

.memory-legend i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    box-shadow: 0 0 12px currentColor;
}

.legend-active { color: var(--green); background: var(--green); }
.legend-decaying { color: var(--gold); background: var(--gold); }
.legend-stale { color: var(--red); background: var(--red); }
.legend-archived { color: #98a6a0; background: #98a6a0; }

.memory-filters {
    position: absolute;
    left: 22px;
    top: 136px;
    z-index: 7;
    width: 330px;
    max-width: calc(100% - 44px);
    padding: 14px;
    border: 1px solid rgba(202, 255, 226, 0.11);
    border-radius: 18px;
    background: rgba(6, 9, 8, 0.68);
    box-shadow: 0 22px 56px rgba(0, 0, 0, 0.26);
    backdrop-filter: blur(24px);
    transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
}

.memory-shell:not(.command-open) .memory-filters {
    opacity: 0;
    visibility: hidden;
    transform: translateX(-10px);
    pointer-events: none;
}

.memory-panel-title {
    margin: 0 0 10px;
    color: rgba(239, 247, 242, 0.86);
    font-size: 11px;
    font-weight: 790;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.memory-panel-title.compact {
    margin-top: 17px;
}

.memory-filters label {
    display: grid;
    gap: 6px;
    min-width: 0;
    color: var(--quiet);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.search-field {
    margin-bottom: 10px;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.memory-filters input,
.memory-filters select {
    width: 100%;
    min-width: 0;
    height: 36px;
    border: 1px solid rgba(202, 255, 226, 0.11);
    border-radius: 11px;
    padding: 0 10px;
    background: rgba(255, 255, 255, 0.045);
    color: rgba(239, 247, 242, 0.84);
    font: inherit;
    font-size: 12px;
    outline: none;
}

.memory-filters option {
    color: #0a0f0c;
}

.memory-filters input:focus,
.memory-filters select:focus {
    border-color: rgba(102, 230, 173, 0.52);
    box-shadow: 0 0 0 3px rgba(102, 230, 173, 0.08);
}

.memory-reset {
    width: 100%;
    margin-top: 11px;
    color: rgba(102, 230, 173, 0.92);
}

.memory-advice {
    display: grid;
    gap: 7px;
    max-height: 108px;
    margin-top: 12px;
    overflow: auto;
}

.memory-advice-item,
.memory-empty {
    padding: 9px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.035);
    color: rgba(239, 247, 242, 0.58);
    font-size: 11px;
    line-height: 1.5;
}

.memory-timeline {
    position: absolute;
    left: 22px;
    right: 178px;
    bottom: 22px;
    z-index: 6;
    display: flex;
    gap: 8px;
    min-height: 64px;
    padding: 8px;
    border: 1px solid rgba(202, 255, 226, 0.11);
    border-radius: 18px;
    background: rgba(6, 9, 8, 0.52);
    box-shadow: 0 18px 52px rgba(0, 0, 0, 0.24);
    overflow-x: auto;
    pointer-events: auto;
    backdrop-filter: blur(18px);
}

.time-chip {
    position: relative;
    min-width: 98px;
    min-height: 46px;
    display: grid;
    align-content: center;
    gap: 2px;
    padding: 7px 10px;
    border: 1px solid rgba(202, 255, 226, 0.1);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.035);
    color: rgba(239, 247, 242, 0.66);
    font: inherit;
    cursor: pointer;
    overflow: hidden;
    text-align: left;
    transition: border-color .18s ease, background .18s ease, color .18s ease, transform .18s ease;
}

.time-chip span,
.time-chip strong {
    position: relative;
    z-index: 1;
}

.time-chip span {
    font-size: 10px;
    font-weight: 760;
    letter-spacing: .04em;
}

.time-chip strong {
    color: rgba(239, 247, 242, 0.9);
    font-size: 15px;
    line-height: 1;
}

.time-chip i {
    position: absolute;
    left: 0;
    right: auto;
    bottom: 0;
    width: var(--fill, 20%);
    height: 3px;
    background: linear-gradient(90deg, var(--green), var(--blue));
    opacity: .56;
}

.time-chip:hover,
.time-chip[aria-pressed="true"] {
    transform: translateY(-1px);
    border-color: rgba(102, 230, 173, 0.44);
    background: rgba(102, 230, 173, 0.08);
    color: rgba(255, 255, 255, 0.92);
}

.memory-minimap {
    position: absolute;
    right: 22px;
    bottom: 22px;
    z-index: 6;
    width: 132px;
    height: 86px;
    border: 1px solid rgba(202, 255, 226, 0.11);
    border-radius: 15px;
    background: rgba(6, 9, 8, 0.52);
    overflow: hidden;
    backdrop-filter: blur(18px);
}

.minimap-dot {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: .72;
}

.minimap-dot.active {
    width: 6px;
    height: 6px;
    box-shadow: 0 0 13px currentColor;
}

.memory-detail {
    position: absolute;
    top: 86px;
    right: 22px;
    bottom: 22px;
    z-index: 8;
    width: 350px;
    max-width: calc(100% - 44px);
    padding: 16px;
    border: 1px solid rgba(202, 255, 226, 0.12);
    border-radius: 20px;
    background: rgba(6, 9, 8, 0.76);
    box-shadow: 0 26px 66px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(26px);
    overflow: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateX(16px);
    pointer-events: none;
    transition: opacity .22s ease, transform .22s ease, visibility .22s ease;
}

.memory-shell.inspector-open .memory-detail {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    pointer-events: auto;
}

.detail-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 30px;
    min-height: 30px;
    padding: 0;
    font-size: 18px;
    line-height: 1;
}

.memory-detail-empty {
    color: rgba(239, 247, 242, 0.46);
    font-size: 12px;
}

.detail-status {
    display: inline-flex;
    min-height: 24px;
    align-items: center;
    padding: 0 9px;
    border: 1px solid rgba(102, 230, 173, 0.18);
    border-radius: 999px;
    background: rgba(102, 230, 173, 0.08);
    color: var(--green);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.memory-detail h2 {
    margin: 13px 0 8px;
    color: var(--ink);
    font-size: 18px;
    line-height: 1.35;
    font-weight: 780;
    letter-spacing: 0;
}

.memory-detail p {
    margin: 0;
    color: rgba(239, 247, 242, 0.64);
    font-size: 12px;
    line-height: 1.65;
    word-break: break-word;
}

.memory-detail dl {
    display: grid;
    gap: 7px;
    margin: 14px 0 0;
}

.memory-detail dl div {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 7px;
    border-bottom: 1px solid rgba(202, 255, 226, 0.08);
}

.memory-detail dt {
    color: rgba(239, 247, 242, 0.38);
    font-size: 11px;
}

.memory-detail dd {
    margin: 0;
    color: rgba(239, 247, 242, 0.78);
    font-size: 11px;
    font-weight: 740;
    text-align: right;
}

.inspector-note {
    padding: 10px;
    border: 1px solid rgba(202, 255, 226, 0.1);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.035);
    color: rgba(239, 247, 242, 0.62);
    font-size: 11px;
    line-height: 1.58;
}

.detail-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.detail-chip {
    max-width: 100%;
    padding: 5px 8px;
    border: 1px solid rgba(202, 255, 226, 0.08);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.035);
    color: rgba(239, 247, 242, 0.58);
    font-size: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.memory-hover-tip {
    position: absolute;
    z-index: 10;
    max-width: 260px;
    padding: 10px 11px;
    border: 1px solid rgba(202, 255, 226, 0.16);
    border-radius: 14px;
    background: rgba(6, 9, 8, 0.82);
    box-shadow: 0 20px 56px rgba(0, 0, 0, 0.36);
    color: rgba(239, 247, 242, 0.88);
    font-size: 11px;
    line-height: 1.45;
    pointer-events: none;
    backdrop-filter: blur(18px);
}

.memory-hover-tip strong,
.memory-hover-tip em {
    display: block;
}

.memory-hover-tip strong {
    margin-bottom: 4px;
    color: var(--green);
    font-style: normal;
}

.memory-hover-tip em {
    margin-top: 5px;
    color: rgba(239, 247, 242, 0.44);
    font-style: normal;
}

.memory-loading {
    position: absolute;
    inset: 0;
    z-index: 12;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 10px;
    background: rgba(5, 7, 6, 0.86);
    color: rgba(239, 247, 242, 0.68);
    font-size: 12px;
    transition: opacity .22s ease, visibility .22s ease;
}

.memory-loading.hidden {
    display: none;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.memory-spinner {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid rgba(102, 230, 173, 0.14);
    border-top-color: var(--green);
    animation: memory-spin .85s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
    .memory-filters,
    .memory-detail,
    .graph-actions button,
    .memory-view-switch button,
    .time-chip,
    .memory-reset,
    .detail-close {
        transition: none;
    }

    .memory-spinner {
        animation: none;
    }
}

@media (max-width: 1180px) {
    .memory-telemetry {
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: 2px;
    }

    .memory-stage {
        height: 740px;
    }
}

@media (max-width: 760px) {
    .memory-main {
        width: min(100vw - 20px, 520px);
    }

    .memory-hero {
        display: grid;
        gap: 10px;
        padding-top: 2px;
    }

    .memory-telemetry {
        width: 100%;
    }

    .memory-metric {
        min-width: 64px;
    }

    .memory-stage {
        height: 690px;
        min-height: 690px;
        border-radius: 20px;
    }

    .memory-graph-topbar {
        left: 16px;
        right: 16px;
        top: 16px;
        display: grid;
        align-items: start;
        gap: 10px;
    }

    .memory-graph-topbar strong {
        font-size: 20px;
    }

    .graph-actions {
        gap: 6px;
        justify-content: flex-start;
    }

    .graph-actions button {
        min-height: 30px;
        padding: 0 9px 0 7px;
    }

    .graph-action-stack {
        justify-items: start;
    }

    .memory-view-switch {
        max-width: 100%;
        overflow-x: auto;
    }

    .memory-timeline {
        left: 12px;
        right: 128px;
        bottom: 14px;
        min-height: 58px;
        padding: 7px;
        border-radius: 16px;
    }

    .time-chip {
        min-width: 82px;
        min-height: 42px;
        padding: 6px 8px;
    }

    .memory-legend {
        display: none;
    }

    .memory-filters {
        left: 12px;
        top: 134px;
        width: calc(100% - 24px);
        max-height: 430px;
        overflow: auto;
    }

    .filter-grid {
        grid-template-columns: 1fr 1fr;
    }

    .memory-minimap {
        right: 14px;
        bottom: 14px;
        width: 104px;
        height: 70px;
    }

    .memory-detail {
        left: 12px;
        right: 12px;
        top: auto;
        bottom: 12px;
        width: auto;
        max-height: 430px;
        border-radius: 18px;
        transform: translateY(16px);
    }

    .memory-shell.inspector-open .memory-timeline,
    .memory-shell.inspector-open .memory-minimap {
        opacity: 0;
        pointer-events: none;
    }

    .memory-shell.inspector-open .memory-detail {
        transform: translateY(0);
    }
}

@media (max-width: 520px) {
    .memory-main {
        width: min(100vw - 20px, 370px);
        margin-left: 10px;
        margin-right: auto;
    }

    .memory-telemetry {
        display: grid;
        grid-template-columns: 42px repeat(3, minmax(0, 1fr));
        overflow: visible;
    }

    .memory-metric {
        min-width: 0;
    }
}

@media (max-width: 420px) {
    .memory-main {
        width: calc(100vw - 20px);
        margin-left: 10px;
        margin-right: 10px;
    }

    .memory-stage {
        height: 660px;
        min-height: 660px;
    }

    .graph-actions button span:not(.action-symbol) {
        display: none;
    }

    .graph-actions button {
        width: 32px;
        justify-content: center;
        padding: 0;
    }

    .memory-view-switch button {
        padding: 0 8px;
    }

    .memory-timeline {
        right: 12px;
        bottom: 92px;
    }

    .memory-telemetry {
        gap: 6px;
    }

    .memory-health-ring {
        width: 38px;
        height: 38px;
    }

    .memory-metric {
        min-width: 60px;
        height: 38px;
        padding: 0 9px;
    }
}

/* Performance Monitor */
.memory-perf-monitor {
    position: fixed;
    top: 12px;
    right: 12px;
    background: var(--glass-strong);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 8px 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--muted);
    z-index: 1000;
    backdrop-filter: blur(12px);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.memory-perf-monitor.visible {
    opacity: 1;
}

.memory-perf-monitor .fps-good { color: var(--green); }
.memory-perf-monitor .fps-warning { color: var(--gold); }
.memory-perf-monitor .fps-bad { color: var(--red); }

/* Touch gesture hints */
.memory-gesture-hint {
    position: absolute;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--glass-strong);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 11px;
    color: var(--quiet);
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
    z-index: 10;
}

.memory-shell:hover .memory-gesture-hint {
    opacity: 0.6;
}

/* Loading state enhancement */
.memory-loading {
    background: linear-gradient(135deg, var(--bg) 0%, var(--bg-soft) 100%);
}

.memory-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--line);
    border-top-color: var(--green);
    border-radius: 50%;
    animation: memory-spin 1s linear infinite;
}

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

/* Smooth transitions for LOD changes */
.memory-canvas canvas {
    transition: opacity 0.2s ease;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .memory-spinner {
        animation: none;
        border-top-color: var(--line);
    }

    .memory-canvas canvas {
        transition: none;
    }
}

/* ─── 智能分析面板 ─── */
.memory-analysis {
    position: absolute;
    left: 22px;
    top: 430px;
    z-index: 6;
    width: 280px;
    max-height: 320px;
    padding: 14px;
    border: 1px solid rgba(202, 255, 226, 0.11);
    border-radius: 18px;
    background: rgba(6, 9, 8, 0.68);
    box-shadow: 0 22px 56px rgba(0, 0, 0, 0.26);
    backdrop-filter: blur(24px);
    overflow: auto;
    transition: opacity .2s ease, transform .2s ease;
}

.memory-shell.command-open .memory-analysis {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-10px);
}

.analysis-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    padding: 3px;
    border: 1px solid rgba(202, 255, 226, 0.08);
    border-radius: 999px;
    background: rgba(6, 9, 8, 0.46);
}

.analysis-tabs button {
    flex: 1;
    min-height: 26px;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: rgba(239, 247, 242, 0.52);
    font: inherit;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all .16s ease;
}

.analysis-tabs button.active,
.analysis-tabs button:hover {
    border-color: rgba(102, 230, 173, 0.44);
    background: rgba(102, 230, 173, 0.08);
    color: rgba(255, 255, 255, 0.92);
}

.analysis-content {
    font-size: 11px;
    line-height: 1.5;
}

.analysis-loading {
    color: var(--quiet);
    text-align: center;
    padding: 20px 0;
}

.analysis-section {
    margin-bottom: 12px;
}

.analysis-section-title {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.analysis-section-title .badge {
    display: inline-flex;
    align-items: center;
    min-height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--quiet);
    font-size: 9px;
    font-weight: 700;
}

.analysis-list {
    display: grid;
    gap: 6px;
}

.analysis-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid rgba(202, 255, 226, 0.06);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.025);
    cursor: pointer;
    transition: all .16s ease;
}

.analysis-item:hover {
    border-color: rgba(102, 230, 173, 0.3);
    background: rgba(102, 230, 173, 0.05);
    transform: translateX(2px);
}

.analysis-item .rank {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(121, 167, 255, 0.12);
    color: var(--blue);
    font-size: 10px;
    font-weight: 800;
    flex-shrink: 0;
}

.analysis-item .rank.top {
    background: rgba(102, 230, 173, 0.15);
    color: var(--green);
}

.analysis-item .info {
    flex: 1;
    min-width: 0;
}

.analysis-item .info .label {
    color: rgba(239, 247, 242, 0.78);
    font-size: 11px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.analysis-item .info .meta {
    color: var(--quiet);
    font-size: 10px;
}

.analysis-item .score {
    color: var(--green);
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.analysis-item .score.warning {
    color: var(--gold);
}

.analysis-item .score.danger {
    color: var(--red);
}

.analysis-bar {
    height: 4px;
    margin-top: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    overflow: hidden;
}

.analysis-bar .fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--green), var(--blue));
    transition: width .6s ease;
}

.analysis-bar .fill.warning {
    background: linear-gradient(90deg, var(--gold), var(--red));
}

.analysis-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.analysis-summary-item {
    text-align: center;
    padding: 10px 6px;
    border: 1px solid rgba(202, 255, 226, 0.06);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.025);
}

.analysis-summary-item .value {
    color: var(--ink);
    font-size: 18px;
    font-weight: 780;
    line-height: 1;
}

.analysis-summary-item .label {
    color: var(--quiet);
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    margin-top: 4px;
}

/* 移动端适配 */
@media (max-width: 760px) {
    .memory-analysis {
        left: 12px;
        top: auto;
        bottom: 120px;
        width: calc(100% - 24px);
        max-height: 280px;
    }
}
