/* ================================================================
   BLACKWALL — CYBERPUNK THEME
   ================================================================ */

/* --- Bootstrap CSS variable overrides --- */
:root {
    --bw-primary:     #22d3ee;
    --bw-muted:       #7aa8b0;
    --bw-border:      rgba(34, 211, 238, 0.2);
    --bw-success:     #4ade80;
    --bw-danger:      #f87171;

    --bs-body-bg:              #0d1117;
    --bs-body-color:           #ddeef0;
    --bs-body-font-family:     "Rajdhani", "Inter", sans-serif;
    --bs-primary:              #22d3ee;
    --bs-primary-rgb:          34, 211, 238;
    --bs-secondary:            #1a2530;
    --bs-secondary-rgb:        26, 37, 48;
    --bs-card-bg:              #121c24;
    --bs-card-border-color:    rgba(34, 211, 238, 0.2);
    --bs-border-color:         rgba(34, 211, 238, 0.2);
    --bs-link-color:           #22d3ee;
    --bs-link-hover-color:     #67e8f9;
    --bs-danger:               #f87171;
    --bs-danger-rgb:           248, 113, 113;
    --bs-success:              #4ade80;
    --bs-success-rgb:          74, 222, 128;
}

/* --- Base --- */
html, body {
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
    font-family: "Rajdhani", "Inter", sans-serif;
    background-image:
        linear-gradient(rgba(34, 211, 238, 0.022) 1px, transparent 1px),
        linear-gradient(90deg, rgba(34, 211, 238, 0.022) 1px, transparent 1px);
    background-size: 48px 48px;
}

h1:focus { outline: none; }

/* --- Custom utilities --- */
.font-display {
    font-family: "Rajdhani", "Inter", sans-serif !important;
    font-weight: 700 !important;
    letter-spacing: 0.06em !important;
    text-transform: uppercase !important;
}

.font-mono {
    font-family: "JetBrains Mono", "Courier New", monospace !important;
}

.neon-text {
    color: var(--bw-primary);
    text-shadow: 0 0 12px rgba(34, 211, 238, 0.6), 0 0 2px rgba(34, 211, 238, 0.8);
}

.neon-border {
    box-shadow:
        0 0 0 1px var(--bw-primary),
        0 0 24px rgba(34, 211, 238, 0.25),
        inset 0 0 12px rgba(34, 211, 238, 0.06);
}

.cut-corner {
    clip-path: polygon(
        0 0,
        calc(100% - 14px) 0,
        100% 14px,
        100% 100%,
        14px 100%,
        0 calc(100% - 14px)
    );
    border-radius: 0 !important;
}

/* --- Layout --- */
.bw-container {
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    height: 100%;
}

.bw-header {
    height: 64px;
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: rgba(13, 17, 23, 0.88);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(34, 211, 238, 0.15) !important;
}

/* --- Buttons --- */
.btn {
    border-radius: 0;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.btn-primary {
    background-color: var(--bw-primary);
    border-color: var(--bw-primary);
    color: #0d1117;
}

.btn-primary:hover, .btn-primary:focus {
    background-color: #67e8f9;
    border-color: #67e8f9;
    color: #0d1117;
    box-shadow: 0 0 0 1px var(--bw-primary), 0 0 20px rgba(34, 211, 238, 0.3);
}

.btn-outline-secondary {
    color: var(--bw-muted);
    border-color: rgba(34, 211, 238, 0.3);
    background: transparent;
}

.btn-outline-secondary:hover, .btn-outline-secondary:focus {
    background-color: rgba(34, 211, 238, 0.08);
    border-color: var(--bw-primary);
    color: var(--bw-primary);
    box-shadow: none;
}

.btn-outline-danger {
    color: var(--bw-danger);
    border-color: rgba(248, 113, 113, 0.4);
    background: transparent;
}

.btn-outline-danger:hover {
    background-color: rgba(248, 113, 113, 0.1);
    border-color: var(--bw-danger);
    color: var(--bw-danger);
}

.btn:focus, .btn:active:focus {
    box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.4);
}

/* --- Cards --- */
.card {
    background-color: var(--bs-card-bg);
    border-color: rgba(34, 211, 238, 0.2);
    border-radius: 0;
}

.card-header {
    background-color: transparent;
    border-bottom-color: rgba(34, 211, 238, 0.12);
    font-family: "JetBrains Mono", monospace;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--bw-primary);
    padding: 0.85rem 1.25rem;
}

/* --- Forms --- */
.form-control, .form-select {
    background-color: #0f1820;
    border-color: rgba(34, 211, 238, 0.25);
    color: var(--bs-body-color);
    border-radius: 0;
    font-family: "JetBrains Mono", monospace;
}

.form-control:focus, .form-select:focus {
    background-color: #0f1820;
    border-color: var(--bw-primary);
    color: var(--bs-body-color);
    box-shadow: 0 0 0 1px var(--bw-primary), 0 0 12px rgba(34, 211, 238, 0.12);
}

.form-control::placeholder { color: rgba(34, 211, 238, 0.25); }

.form-control:disabled, .form-select:disabled,
.form-control[disabled], .form-select[disabled] {
    background-color: #0a1015;
    border-color: rgba(34, 211, 238, 0.1);
    color: rgba(221, 238, 240, 0.35);
    opacity: 0.6;
    cursor: not-allowed;
}

.form-check-input:disabled,
.form-check-input[disabled] {
    opacity: 0.35;
    cursor: not-allowed;
}

.form-check-input {
    background-color: #0f1820;
    border-color: rgba(34, 211, 238, 0.4);
    border-radius: 0;
    width: 1.15em;
    height: 1.15em;
}

.form-check-input:checked {
    background-color: var(--bw-primary);
    border-color: var(--bw-primary);
}

.form-check-input:focus { box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.3); }

.form-label {
    font-weight: 600;
    letter-spacing: 0.03em;
    margin-bottom: 0.35rem;
}

.form-text {
    color: var(--bw-muted);
    font-family: "JetBrains Mono", monospace;
    font-size: 0.72rem;
}

/* --- Warnings --- */
.bw-warning {
    font-size: 0.8rem;
    padding: 0.75rem 1.25rem;
    border: 1px solid #b8860b;
    border-radius: 0;
    background: rgba(184, 134, 11, 0.12);
    color: #e6b800;
}

/* --- Errors --- */
.bw-error {
    font-size: 0.8rem;
    padding: 0.75rem 1.25rem;
    border: 1px solid #dc3545;
    border-radius: 0;
    background: rgba(220, 53, 69, 0.12);
    color: #ff6b6b;
}

/* --- Alerts --- */
.alert { border-radius: 0; }

.alert-success {
    background-color: rgba(74, 222, 128, 0.08);
    border-color: rgba(74, 222, 128, 0.4);
    color: var(--bw-success);
}

.alert-danger {
    background-color: rgba(248, 113, 113, 0.08);
    border-color: rgba(248, 113, 113, 0.4);
    color: var(--bw-danger);
}

/* --- Guild card --- */
.bw-guild-card {
    display: block;
    background-color: var(--bs-card-bg);
    border: 1px solid rgba(34, 211, 238, 0.18);
    padding: 1rem;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.bw-guild-card:hover {
    border-color: var(--bw-primary);
    box-shadow: 0 0 0 1px var(--bw-primary), 0 0 24px rgba(34, 211, 238, 0.12);
    color: inherit;
}

/* --- Animations --- */
@keyframes bw-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.35; }
}

.bw-pulse { animation: bw-pulse 2s ease-in-out infinite; }

/* --- Validation --- */
.valid.modified:not([type=checkbox]) { outline: 1px solid var(--bw-success); }
.invalid                              { outline: 1px solid var(--bw-danger); }
.validation-message {
    color: var(--bw-danger);
    font-family: "JetBrains Mono", monospace;
    font-size: 0.72rem;
}

/* --- Blazor error boundary --- */
.blazor-error-boundary {
    background: rgba(248, 113, 113, 0.08);
    border: 1px solid rgba(248, 113, 113, 0.4);
    padding: 1rem 1.25rem;
    color: var(--bw-danger);
    font-family: "JetBrains Mono", monospace;
    font-size: 0.8rem;
}

.blazor-error-boundary::after {
    content: "// BARRIER BREACH: An unhandled exception occurred."
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: #0d1117; }
::-webkit-scrollbar-thumb { background: rgba(34, 211, 238, 0.25); border-radius: 0; }
::-webkit-scrollbar-thumb:hover { background: rgba(34, 211, 238, 0.45); }

/* --- Form field rows (Guild settings) --- */
.bw-field {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    border-top: 1px solid rgba(34, 211, 238, 0.1);
    padding: 1.1rem 0;
}

.bw-field:first-of-type {
    border-top: none;
    padding-top: 0;
}

.bw-field-label {
    flex: 1;
    min-width: 0;
}

/* --- Settings sidebar nav --- */
.bw-sidebar-layout {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    align-items: flex-start;
}

.bw-sidebar-nav {
    flex: 0 0 170px;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--bw-border);
    background: rgba(18, 28, 36, 0.6);
    position: sticky;
    top: 1.5rem;
}

.bw-sidebar-header {
    font-size: 0.6rem;
    letter-spacing: 0.2em;
    color: var(--bw-muted);
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--bw-border);
    text-transform: uppercase;
}

.bw-sidebar-btn {
    background: transparent;
    border: none;
    border-left: 3px solid transparent;
    color: var(--bw-muted);
    font-family: "JetBrains Mono", monospace;
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 0.65rem 1rem;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    text-align: left;
    white-space: nowrap;
}

.bw-sidebar-btn:hover {
    color: var(--bw-primary);
    background: rgba(34, 211, 238, 0.05);
}

.bw-sidebar-btn.active {
    color: var(--bw-primary);
    border-left-color: var(--bw-primary);
    background: rgba(34, 211, 238, 0.08);
}

.bw-sidebar-content {
    flex: 1;
    min-width: 0;
}

@media (max-width: 640px) {
    .bw-sidebar-layout {
        flex-direction: column;
        gap: 1rem;
    }

    .bw-sidebar-nav {
        flex: none;
        position: static;
        flex-direction: row;
        overflow-x: auto;
    }

    .bw-sidebar-header {
        display: none;
    }

    .bw-sidebar-btn {
        border-left: none;
        border-bottom: 2px solid transparent;
        padding: 0.6rem 0.9rem;
    }

    .bw-sidebar-btn.active {
        border-left: none;
        border-bottom-color: var(--bw-primary);
    }
}

/* --- Legal pages --- */
.bw-legal h2 {
    font-family: "Rajdhani", "Inter", sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--bw-primary);
    margin-top: 2rem;
    margin-bottom: 0.6rem;
}

.bw-legal h2:first-child { margin-top: 0; }

.bw-legal h3 {
    font-family: "JetBrains Mono", monospace;
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    color: var(--bs-body-color);
    margin-top: 1.25rem;
    margin-bottom: 0.4rem;
}

.bw-legal p {
    font-family: "JetBrains Mono", monospace;
    font-size: 0.8rem;
    line-height: 1.7;
    color: var(--bw-muted);
    margin-bottom: 0.8rem;
}

.bw-legal ul {
    font-family: "JetBrains Mono", monospace;
    font-size: 0.8rem;
    line-height: 1.7;
    color: var(--bw-muted);
    padding-left: 1.2rem;
    margin-bottom: 0.8rem;
}

.bw-legal ul li { margin-bottom: 0.3rem; }

.bw-legal a {
    color: var(--bw-primary);
    text-decoration: none;
}

.bw-legal a:hover { text-decoration: underline; }

/* --- Guild settings cards --- */
.bw-card { background: var(--bs-card-bg); }
.bw-card-danger { background: var(--bs-card-bg); border-color: var(--bw-danger) !important; }
.bw-header-danger { color: var(--bw-danger); }

/* --- Section description / empty state text --- */
.bw-desc { font-size: 0.75rem; color: var(--bw-muted); }

/* --- Toggle switch sizing --- */
.bw-switch { width: 2.5em; height: 1.3em; }

/* --- Input max widths --- */
.bw-input-narrow { max-width: 140px; }
.bw-input-select { max-width: 200px; }

/* --- Last field in a section --- */
.bw-field-last { border-bottom: none; padding-bottom: 0; }

/* --- Button text sizes --- */
.bw-btn-xxs { font-size: 0.65rem; letter-spacing: 0.1em; }
.bw-btn-xs { font-size: 0.7rem; letter-spacing: 0.1em; }
.bw-btn-xs-nowrap { font-size: 0.7rem; letter-spacing: 0.1em; white-space: nowrap; }
.bw-btn-sm { font-size: 0.72rem; letter-spacing: 0.1em; }
.bw-btn-md { font-size: 0.75rem; letter-spacing: 0.1em; }
.bw-btn-remove { font-size: 0.7rem; }

/* --- Form labels --- */
.bw-label { font-size: 0.7rem; letter-spacing: 0.1em; }

/* --- Loading / error text --- */
.bw-loading { color: var(--bw-muted); font-size: 0.85rem; }
.bw-err { color: var(--bw-danger); font-size: 0.85rem; }

/* --- Alert text size --- */
.bw-alert-text { font-size: 0.8rem; }

/* --- Meta text (footer, dates, status) --- */
.bw-meta { font-size: 0.68rem; color: var(--bw-muted); }

/* --- Text color helpers --- */
.bw-text-muted { color: var(--bw-muted); }
.bw-text-primary { color: var(--bw-primary); }

/* --- Dashboard --- */
.bw-section-label { font-size: 0.72rem; letter-spacing: 0.15em; }
.bw-role { font-size: 0.65rem; color: var(--bw-muted); letter-spacing: 0.1em; }
.bw-status { font-size: 0.68rem; letter-spacing: 0.12em; }
.bw-divider { height: 1px; background: rgba(34, 211, 238, 0.15); }
.bw-empty-box { border: 1px dashed rgba(34, 211, 238, 0.2); padding: 2.5rem; text-align: center; font-size: 0.8rem; color: var(--bw-muted); }
.bw-guild-name { font-size: 0.95rem; letter-spacing: 0.04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- Ban list item --- */
.bw-ban-user { font-size: 0.78rem; }

/* --- Reconnect modal --- */
#components-reconnect-modal { display: none; }

/* --- Audit modal --- */
.bw-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(13, 17, 23, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.bw-modal {
    background: var(--bs-card-bg);
    border: 1px solid var(--bw-primary);
    box-shadow: 0 0 0 1px var(--bw-primary), 0 0 48px rgba(34, 211, 238, 0.2);
    width: 100%;
    max-width: 1100px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.bw-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid rgba(34, 211, 238, 0.15);
    font-size: 0.75rem;
    letter-spacing: 0.12em;
}

.bw-modal-close {
    background: transparent;
    border: none;
    color: var(--bw-muted);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.25rem;
    transition: color 0.15s;
}

.bw-modal-close:hover { color: var(--bw-danger); }

.bw-modal-body {
    flex: 1;
    overflow: hidden;
    padding: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* --- Audit layout --- */
.bw-audit-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.bw-audit-event-list {
    flex: 0 0 320px;
    border-right: 1px solid rgba(34, 211, 238, 0.12);
    overflow-y: auto;
    padding: 0.5rem;
    min-height: 0;
}

.bw-audit-event-item {
    padding: 0.65rem 0.75rem;
    border: 1px solid transparent;
    border-left: 3px solid transparent;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    margin-bottom: 0.25rem;
}

.bw-audit-event-item:hover {
    background: rgba(34, 211, 238, 0.05);
    border-left-color: rgba(34, 211, 238, 0.3);
}

.bw-audit-event-item.active {
    background: rgba(34, 211, 238, 0.08);
    border-left-color: var(--bw-primary);
}

.bw-audit-event-user { font-size: 0.78rem; margin-bottom: 0.2rem; }
.bw-audit-event-meta { font-size: 0.68rem; margin-bottom: 0.15rem; }
.bw-audit-event-time { font-size: 0.62rem; }

.bw-audit-viol { color: var(--bw-danger); margin-right: 0.35rem; }
.bw-audit-dryrun {
    color: #e6b800;
    margin-right: 0.35rem;
    font-weight: 700;
    font-size: 0.6rem;
}

/* --- Audit detail --- */
.bw-audit-detail {
    flex: 1;
    overflow: hidden;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.bw-audit-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(34, 211, 238, 0.12);
    flex-shrink: 0;
}

.bw-audit-detail-info { font-size: 0.72rem; line-height: 1.6; }

.bw-audit-messages {
    padding: 0.75rem 1rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* --- Discord-like message --- */
.bw-discord-msg {
    background: #0f1820;
    border: 1px solid rgba(34, 211, 238, 0.1);
    border-left: 3px solid var(--bw-primary);
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
}

.bw-discord-msg-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.bw-discord-msg-author { font-weight: 700; font-size: 0.8rem; }
.bw-discord-msg-channel { font-size: 0.7rem; }
.bw-discord-msg-time { font-size: 0.62rem; }

.bw-discord-msg-content {
    font-size: 0.78rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--bs-body-color);
    margin-bottom: 0.5rem;
}

/* --- Discord embed --- */
.bw-discord-embeds { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.5rem; }

.bw-discord-embed {
    background: #0a1015;
    border: 1px solid rgba(34, 211, 238, 0.08);
    border-left: 4px solid var(--bw-primary);
    border-radius: 0;
    padding: 0.65rem 0.85rem;
    max-width: 520px;
}

.bw-discord-embed-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--bw-primary);
    margin-bottom: 0.35rem;
}

.bw-discord-embed-desc {
    font-size: 0.72rem;
    line-height: 1.5;
    color: var(--bs-body-color);
    margin-bottom: 0.4rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.bw-discord-embed-fields { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.4rem; }

.bw-discord-embed-field { width: 100%; }
.bw-discord-embed-field.inline { flex: 1 1 45%; min-width: 120px; }

.bw-discord-embed-field-name {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--bw-primary);
    margin-bottom: 0.15rem;
}

.bw-discord-embed-field-value {
    font-size: 0.68rem;
    line-height: 1.4;
    color: var(--bs-body-color);
    white-space: pre-wrap;
    word-break: break-word;
}

.bw-discord-embed-footer {
    font-size: 0.6rem;
    color: var(--bw-muted);
    margin-top: 0.35rem;
    border-top: 1px solid rgba(34, 211, 238, 0.08);
    padding-top: 0.3rem;
}

.bw-discord-embed-image { max-width: 100%; max-height: 300px; margin-top: 0.4rem; }
.bw-discord-embed-thumb { max-width: 80px; max-height: 80px; float: right; margin-left: 0.5rem; margin-bottom: 0.25rem; }

@media (max-width: 768px) {
    .bw-audit-layout { flex-direction: column; }
    .bw-audit-event-list { flex: none; max-height: 200px; border-right: none; border-bottom: 1px solid rgba(34, 211, 238, 0.12); }
    .bw-modal { max-height: 90vh; }
}

/* ================================================================
   CYBERPUNK 2077 TERMINAL ANIMATIONS
   ================================================================ */

/* --- CRT vignette --- */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 9997;
    pointer-events: none;
    box-shadow: inset 0 0 120px rgba(0, 0, 0, 0.45);
}

/* --- Scanline overlay --- */
.bw-scanlines {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0) 0px,
        rgba(0, 0, 0, 0) 2px,
        rgba(34, 211, 238, 0.018) 3px,
        rgba(34, 211, 238, 0.018) 3px
    );
    animation: bw-scanline-move 8s linear infinite;
}

@keyframes bw-scanline-move {
    0%   { background-position: 0 0; }
    100% { background-position: 0 100px; }
}

/* --- CRT flicker layer --- */
.bw-scanlines::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(34, 211, 238, 0.008);
    animation: bw-crt-flicker 0.12s infinite;
}

@keyframes bw-crt-flicker {
    0%   { opacity: 0.9; }
    50%  { opacity: 1; }
    100% { opacity: 0.92; }
}

/* --- Scan sweep (bright line traveling down) --- */
.bw-scan-sweep {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 140px;
    z-index: 9998;
    pointer-events: none;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(34, 211, 238, 0.025) 45%,
        rgba(34, 211, 238, 0.04) 50%,
        rgba(34, 211, 238, 0.025) 55%,
        transparent 100%
    );
    animation: bw-scan-sweep 7s linear infinite;
}

@keyframes bw-scan-sweep {
    0%   { transform: translateY(-140px); }
    100% { transform: translateY(100vh); }
}

/* --- Neon flicker --- */
@keyframes bw-neon-flicker {
    0%, 100% {
        opacity: 1;
        text-shadow: 0 0 12px rgba(34, 211, 238, 0.6), 0 0 2px rgba(34, 211, 238, 0.8);
    }
    91% { opacity: 1; }
    92% {
        opacity: 0.5;
        text-shadow: 0 0 6px rgba(34, 211, 238, 0.25);
    }
    93% {
        opacity: 1;
        text-shadow: 0 0 12px rgba(34, 211, 238, 0.6), 0 0 2px rgba(34, 211, 238, 0.8);
    }
    94% { opacity: 0.85; }
    95% { opacity: 1; }
    96% {
        opacity: 0.35;
        text-shadow: 0 0 3px rgba(34, 211, 238, 0.15);
    }
    97% {
        opacity: 1;
        text-shadow: 0 0 12px rgba(34, 211, 238, 0.6), 0 0 2px rgba(34, 211, 238, 0.8);
    }
    98% { opacity: 0.9; }
    99% { opacity: 1; }
}

/* --- Glitch text effect --- */
.bw-glitch {
    position: relative;
    animation: bw-glitch-skew 5s infinite;
}

.bw-glitch::before,
.bw-glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.bw-glitch::before {
    left: 2px;
    text-shadow: -2px 0 var(--bw-danger);
    animation: bw-glitch-anim-1 3s infinite linear alternate-reverse;
}

.bw-glitch::after {
    left: -2px;
    text-shadow: 2px 0 var(--bw-primary);
    animation: bw-glitch-anim-2 2.5s infinite linear alternate-reverse;
}

@keyframes bw-glitch-anim-1 {
    0%   { clip-path: polygon(0 2%, 100% 2%, 100% 5%, 0 5%); }
    10%  { clip-path: polygon(0 15%, 100% 15%, 100% 16%, 0 16%); }
    20%  { clip-path: polygon(0 10%, 100% 10%, 100% 22%, 0 22%); }
    30%  { clip-path: polygon(0 1%, 100% 1%, 100% 3%, 0 3%); }
    40%  { clip-path: polygon(0 30%, 100% 30%, 100% 32%, 0 32%); }
    50%  { clip-path: polygon(0 44%, 100% 44%, 100% 46%, 0 46%); }
    60%  { clip-path: polygon(0 50%, 100% 50%, 100% 55%, 0 55%); }
    70%  { clip-path: polygon(0 70%, 100% 70%, 100% 72%, 0 72%); }
    80%  { clip-path: polygon(0 80%, 100% 80%, 100% 82%, 0 82%); }
    90%  { clip-path: polygon(0 50%, 100% 50%, 100% 55%, 0 55%); }
    100% { clip-path: polygon(0 70%, 100% 70%, 100% 80%, 0 80%); }
}

@keyframes bw-glitch-anim-2 {
    0%   { clip-path: polygon(0 80%, 100% 80%, 100% 90%, 0 90%); }
    10%  { clip-path: polygon(0 20%, 100% 20%, 100% 25%, 0 25%); }
    20%  { clip-path: polygon(0 60%, 100% 60%, 100% 65%, 0 65%); }
    30%  { clip-path: polygon(0 30%, 100% 30%, 100% 35%, 0 35%); }
    40%  { clip-path: polygon(0 45%, 100% 45%, 100% 50%, 0 50%); }
    50%  { clip-path: polygon(0 75%, 100% 75%, 100% 85%, 0 85%); }
    60%  { clip-path: polygon(0 10%, 100% 10%, 100% 15%, 0 15%); }
    70%  { clip-path: polygon(0 55%, 100% 55%, 100% 60%, 0 60%); }
    80%  { clip-path: polygon(0 90%, 100% 90%, 100% 95%, 0 95%); }
    90%  { clip-path: polygon(0 40%, 100% 40%, 100% 45%, 0 45%); }
    100% { clip-path: polygon(0 25%, 100% 25%, 100% 30%, 0 30%); }
}

@keyframes bw-glitch-skew {
    0%, 90%, 100% { transform: skew(0deg); }
    91% { transform: skew(0.5deg); }
    92% { transform: skew(-0.5deg); }
    93% { transform: skew(0.3deg); }
    94% { transform: skew(0deg); }
    95% { transform: skew(-0.3deg); }
    96% { transform: skew(0deg); }
}

/* --- Typewriter cursor --- */
.bw-typewriter::after {
    content: "_";
    color: var(--bw-primary);
    animation: bw-cursor-blink 1s step-end infinite;
}

@keyframes bw-cursor-blink {
    0%, 50%   { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* --- Boot fade-in --- */
.bw-boot-fade {
    animation: bw-boot-fade 0.5s ease-out forwards;
}

@keyframes bw-boot-fade {
    0%   { opacity: 0; transform: translateY(8px); filter: blur(3px); }
    60%  { opacity: 0.6; filter: blur(1px); }
    100% { opacity: 1; transform: translateY(0); filter: blur(0); }
}

/* --- Card hover scan effect --- */
.bw-guild-card::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(34, 211, 238, 0.07) 50%,
        transparent 100%
    );
    transition: left 0.5s ease;
    pointer-events: none;
    z-index: 1;
}

.bw-guild-card:hover::after {
    left: 100%;
}

/* --- Button press glitch --- */
.btn-primary:active {
    animation: bw-btn-glitch 0.15s;
}

@keyframes bw-btn-glitch {
    0%   { transform: translate(0); }
    25%  { transform: translate(-1px, 1px); }
    50%  { transform: translate(1px, -1px); }
    75%  { transform: translate(-1px, 0); }
    100% { transform: translate(0); }
}

/* --- Modal boot-in --- */
.bw-modal {
    animation: bw-modal-in 0.3s ease-out;
}

@keyframes bw-modal-in {
    0%   { opacity: 0; transform: scale(0.96); filter: blur(6px); }
    100% { opacity: 1; transform: scale(1); filter: blur(0); }
}

/* --- Boot sequence overlay --- */
.bw-boot-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: #0d1117;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease;
}

.bw-boot-overlay.bw-boot-done {
    opacity: 0;
    pointer-events: none;
}

.bw-boot-content {
    font-family: "JetBrains Mono", "Courier New", monospace;
    color: var(--bw-primary);
    font-size: 0.8rem;
    max-width: 420px;
    padding: 2rem;
}

.bw-boot-line {
    opacity: 0;
    animation: bw-boot-line 0.3s ease-out forwards;
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
    text-shadow: 0 0 6px rgba(34, 211, 238, 0.3);
}

.bw-boot-line:nth-child(1) { animation-delay: 0.1s; }
.bw-boot-line:nth-child(2) { animation-delay: 0.3s; }
.bw-boot-line:nth-child(3) { animation-delay: 0.5s; }
.bw-boot-line:nth-child(4) { animation-delay: 0.7s; }
.bw-boot-line:nth-child(5) { animation-delay: 0.9s; }

@keyframes bw-boot-line {
    from { opacity: 0; transform: translateX(-10px); }
    to   { opacity: 1; transform: translateX(0); }
}

.bw-boot-bar {
    margin-top: 1.5rem;
    height: 2px;
    background: rgba(34, 211, 238, 0.15);
    overflow: hidden;
}

.bw-boot-bar-fill {
    height: 100%;
    width: 0;
    background: var(--bw-primary);
    box-shadow: 0 0 8px rgba(34, 211, 238, 0.6);
    animation: bw-boot-bar 1.2s ease-out 0.2s forwards;
}

@keyframes bw-boot-bar {
    to { width: 100%; }
}

/* --- Reduced motion accessibility --- */
@media (prefers-reduced-motion: reduce) {
    .bw-scanlines,
    .bw-scan-sweep,
    .bw-scanlines::after,
    .bw-glitch,
    .bw-glitch::before,
    .bw-glitch::after,
    .neon-text,
    .bw-pulse,
    .bw-typewriter::after,
    .bw-boot-fade,
    .bw-modal,
    .btn-primary:active {
        animation: none !important;
    }
}