/* Sys Defense — Virtual_OS intrusion response (flat, no glow) */

#win-defense.sd-window,
#win-incoming-alert.sd-window {
    width: 920px;
    height: 620px;
    background: #1a1a1a;
    border: 1px solid #3a3a3a;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
    display: none;
    flex-direction: column;
    font-family: "Segoe UI", "Ubuntu", system-ui, sans-serif;
    color: #d4d4d4;
    z-index: 9999;
}

#win-incoming-alert.sd-window {
    z-index: 12000;
}

#win-defense.sd-window .sd-header,
#win-incoming-alert.sd-window .sd-header {
    background: #222 !important;
    border-bottom: 1px solid #3a3a3a !important;
    color: #ccc !important;
    text-shadow: none !important;
    font-family: "Segoe UI", system-ui, sans-serif !important;
    font-weight: 600 !important;
    letter-spacing: 0 !important;
    height: 38px;
    min-height: 38px;
    padding: 0 12px !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.sd-header__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.sd-header__icon {
    width: 22px;
    height: 22px;
    background: #c0392b;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #fff;
}

.sd-header__sub {
    font-size: 11px;
    color: #888;
    font-weight: 400;
}

.sd-header__meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sd-badge {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 3px 8px;
    border-radius: 3px;
    border: 1px solid;
}

.sd-badge--critical {
    color: #ff6b6b;
    border-color: #5a2020;
    background: #2a1515;
    animation: sdBadgePulse 1.2s ease-in-out infinite;
}

.sd-badge--live {
    color: #4ecdc4;
    border-color: #1a4a44;
    background: #122824;
}

.sd-badge--warn {
    color: #ffc857;
    border-color: #4a4020;
    background: #282010;
}

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

.sd-timer {
    font-family: "JetBrains Mono", Consolas, monospace;
    font-size: 12px;
    color: #999;
    min-width: 48px;
    text-align: right;
}

#win-defense .w-close,
#win-incoming-alert .w-close {
    color: #999 !important;
    text-shadow: none !important;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 3px;
}

#win-defense .w-close:hover,
#win-incoming-alert .w-close:hover {
    color: #fff !important;
    background: #333;
}

.sd-shell {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 0 !important;
    background: #1a1a1a !important;
    overflow: hidden;
}

.sd-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 14px;
    background: #222;
    border-bottom: 1px solid #333;
    font-size: 11px;
    color: #888;
}

.sd-toolbar__stat b {
    color: #ddd;
    font-family: "JetBrains Mono", monospace;
}

.sd-body {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 200px 1fr 210px;
    gap: 0;
}

.sd-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #1e1e1e;
    border-right: 1px solid #333;
}

.sd-panel:last-child {
    border-right: none;
    border-left: 1px solid #333;
}

.sd-panel__head {
    padding: 8px 12px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #888;
    border-bottom: 1px solid #2a2a2a;
    background: #222;
}

.sd-panel__body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 10px 12px;
    font-family: "JetBrains Mono", Consolas, monospace;
    font-size: 10px;
    line-height: 1.5;
}

.sd-log-line {
    margin-bottom: 4px;
    color: #aaa;
}

.sd-log-line--warn { color: #ff8a65; }
.sd-log-line--ok { color: #66bb6a; }
.sd-log-line--err { color: #ef5350; }

.sd-arena {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 14px;
    gap: 14px;
    overflow-y: auto;
}

.sd-gauges {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.sd-gauge {
    background: #222;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 14px;
    text-align: center;
}

.sd-gauge__ring-wrap {
    position: relative;
    width: 130px;
    height: 130px;
    margin: 0 auto 10px;
}

.sd-gauge__ring-wrap svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.sd-gauge__center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.sd-gauge__val {
    font-size: 22px;
    font-weight: 700;
    color: #eee;
    font-family: "JetBrains Mono", monospace;
}

.sd-gauge__label {
    font-size: 9px;
    letter-spacing: 0.1em;
    color: #777;
    margin-top: 2px;
}

.sd-gauge--hp .sd-gauge__val { color: #ff6b6b; }
.sd-gauge--analysis .sd-gauge__val { color: #4ecdc4; }

.sd-graph {
    margin-top: 8px;
    border: 1px solid #333;
    background: #181818;
    border-radius: 4px;
    padding: 6px;
}

.sd-graph__label {
    font-size: 8px;
    color: #666;
    text-align: left;
    margin-bottom: 4px;
    letter-spacing: 0.06em;
}

.sd-feeds {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    flex: 1;
    min-height: 120px;
}

.sd-feed {
    background: #181818;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 8px 10px;
    font-family: "JetBrains Mono", monospace;
    font-size: 9px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 100px;
}

.sd-feed__title {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid #333;
}

.sd-feed--virus .sd-feed__title { color: #ff6b6b; }
.sd-feed--ice .sd-feed__title { color: #4ecdc4; }

.sd-feed > div:not(.sd-feed__title) {
    margin-bottom: 2px;
    color: #888;
}

.sd-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid #333;
    background: #222;
}

.sd-btn {
    padding: 8px 14px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid #444;
    border-radius: 4px;
    background: #2a2a2a;
    color: #ddd;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    font-family: inherit;
}

.sd-btn:hover:not(:disabled) {
    background: #333;
    border-color: #555;
    color: #fff;
}

.sd-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.sd-btn--primary {
    border-color: #4ecdc4;
    color: #4ecdc4;
    background: #1a2828;
}

.sd-btn--primary:hover:not(:disabled) {
    background: #1f3333;
}

.sd-btn--danger {
    border-color: #c0392b;
    color: #ff6b6b;
    background: #281818;
}

.sd-btn--danger:hover:not(:disabled) {
    background: #331f1f;
}

.sd-btn--ghost {
    background: transparent;
    border-color: #444;
    color: #999;
}

.sd-ice-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid #2a2a2a;
    font-size: 11px;
}

.sd-ice-row:last-child { border-bottom: none; }

.sd-ice-row__label { color: #888; }
.sd-ice-row__val { color: #ccc; font-weight: 600; font-size: 10px; text-align: right; max-width: 120px; }

.sd-progress {
    height: 8px;
    background: #141414;
    border: 1px solid #333;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 6px;
}

.sd-progress__fill {
    height: 100%;
    transition: width 0.25s ease;
}

.sd-progress__fill--hp {
    background: linear-gradient(90deg, #c0392b, #ff6b6b);
}

.sd-progress__fill--analysis {
    background: linear-gradient(90deg, #1a6b6b, #4ecdc4);
}

.sd-progress__fill--integrity {
    background: linear-gradient(90deg, #8b0000, #ff3366);
}

/* Glitch overlay */
#def-glitch.sd-glitch {
    position: absolute;
    inset: 0;
    background: rgba(192, 57, 43, 0.08);
    z-index: 10;
    pointer-events: none;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: #ff6b6b;
    border: 2px dashed rgba(192, 57, 43, 0.35);
}

#def-glitch.sd-glitch--active {
    display: flex;
    animation: sdGlitchFlash 0.35s step-end infinite;
}

@keyframes sdGlitchFlash {
    0% { opacity: 1; transform: translate(0); }
    33% { opacity: 0.7; transform: translate(-2px, 1px); }
    66% { opacity: 0.9; transform: translate(2px, -1px); }
}

/* Manual typer overlay */
#def-typer-ui.sd-typer {
    position: absolute;
    inset: 0;
    background: #141414;
    z-index: 100;
    display: none;
    flex-direction: column;
    padding: 16px;
    border-top: 1px solid #333;
}

#def-typer-ui.sd-typer--open {
    display: flex;
}

.sd-typer__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.sd-typer__title {
    font-size: 12px;
    font-weight: 600;
    color: #4ecdc4;
}

.sd-typer__counter {
    font-family: "JetBrains Mono", monospace;
    font-size: 11px;
    color: #ffc857;
}

.sd-typer__console {
    flex: 1;
    background: #0d0d0d;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 10px;
    overflow-y: auto;
    font-family: "JetBrains Mono", monospace;
    font-size: 11px;
    margin-bottom: 8px;
}

.sd-typer__input-line {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 8px 12px;
    font-family: "JetBrains Mono", monospace;
    font-size: 11px;
    color: #66bb6a;
    min-height: 22px;
}

.sd-typer__hint {
    font-size: 9px;
    color: #555;
    text-align: center;
    margin-top: 8px;
}

/* PvP incoming alert content */
.sd-pvp {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 14px;
    gap: 12px;
    overflow-y: auto;
}

.sd-pvp__intel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 10px 12px;
    background: #222;
    border: 1px solid #333;
    border-radius: 6px;
    font-size: 11px;
}

.sd-pvp__intel span { color: #888; }
.sd-pvp__intel b { color: #eee; font-family: "JetBrains Mono", monospace; }

.sd-vector-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.sd-vector-btn {
    padding: 10px 12px;
    text-align: left;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    background: #252525;
    color: #ccc;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    font-family: inherit;
    font-size: 11px;
}

.sd-vector-btn:hover {
    border-color: #555;
    background: #2a2a2a;
}

.sd-vector-btn.selected {
    border-color: #4ecdc4;
    background: #1a2828;
    color: #4ecdc4;
}

.sd-vector-btn__name {
    font-weight: 700;
    display: block;
    margin-bottom: 2px;
}

.sd-vector-btn__desc {
    font-size: 9px;
    color: #777;
}

.sd-code-box {
    flex: 1;
    min-height: 140px;
    background: #0d0d0d;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 12px;
    font-family: "JetBrains Mono", monospace;
    font-size: 11px;
    line-height: 1.55;
    overflow-y: auto;
    white-space: pre-wrap;
    color: #666;
}

.sd-ddos-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sd-ddos-action {
    border: 1px solid #333;
    border-radius: 6px;
    padding: 10px 12px;
    background: #222;
}

.sd-ddos-action__title {
    font-size: 10px;
    color: #888;
    margin-bottom: 8px;
}

.sd-ddos-action__row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.sd-alert-overlay {
    position: fixed;
    inset: 0;
    background: rgba(192, 57, 43, 0.15);
    z-index: 99998;
    pointer-events: none;
    animation: sdAlertPulse 1s ease-in-out infinite;
}

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

#win-defense ::-webkit-scrollbar,
#win-incoming-alert ::-webkit-scrollbar {
    width: 6px;
}

#win-defense ::-webkit-scrollbar-track,
#win-incoming-alert ::-webkit-scrollbar-track {
    background: #141414;
}

#win-defense ::-webkit-scrollbar-thumb,
#win-incoming-alert ::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 3px;
}

#win-defense ::-webkit-scrollbar-thumb:hover,
#win-incoming-alert ::-webkit-scrollbar-thumb:hover {
    background: #555;
}
