@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 300 600;
    font-display: swap;
    src: url('/static/fonts/JetBrainsMono-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 300 600;
    font-display: swap;
    src: url('/static/fonts/JetBrainsMono-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg-primary:   #1e1e1e;
    --bg-secondary: #252526;
    --bg-tertiary:  #2d2d30;
    --bg-elevated:  #323233;
    --border:       #3e3e42;
    --border-hover: #4e4e52;
    --text-primary: #ffffff;
    --text-secondary:#cccccc;
    --text-muted:   #858585;
    --accent:       #0e639c;
    --accent-hover: #1177bb;
    --accent-light: #4fc3f7;
    --error:        #f44747;
    --font: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
}

body {
    font-family: var(--font);
    background: #0d1117;
    color: var(--text-secondary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-font-smoothing: antialiased;
}

#bgCanvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.login-wrap {
    width: 100%;
    max-width: 340px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 28px;
    position: relative;
    z-index: 1;
}

/* ── Glitch text ──────────────────────────────────────────────────────────────── */

.glitch {
    position: relative;
    animation: glitch-main 4s infinite;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    overflow: hidden;
    background: transparent;
}

.glitch::before {
    color: #ff004d;
    animation: glitch-top 4s infinite;
    clip-path: polygon(0 0, 100% 0, 100% 40%, 0 40%);
    text-shadow: -2px 0 #ff004d;
}

.glitch::after {
    color: #00ffea;
    animation: glitch-bot 4s infinite;
    clip-path: polygon(0 60%, 100% 60%, 100% 100%, 0 100%);
    text-shadow: 2px 0 #00ffea;
}

@keyframes glitch-main {
    0%, 90%, 100%  { transform: none; }
    92%            { transform: skewX(-1deg) translateX(2px); }
    94%            { transform: skewX(1deg) translateX(-2px); }
    96%            { transform: none; }
    97%            { transform: translateX(1px) skewX(-0.5deg); }
    99%            { transform: none; }
}

@keyframes glitch-top {
    0%, 90%, 100%  { transform: none; opacity: 0; }
    92%            { transform: translateX(-3px); opacity: 1; }
    94%            { transform: translateX(3px); opacity: 1; }
    96%            { transform: none; opacity: 0; }
    98%            { transform: translateX(-2px); opacity: 1; }
    99%            { opacity: 0; }
}

@keyframes glitch-bot {
    0%, 90%, 100%  { transform: none; opacity: 0; }
    91%            { transform: translateX(3px); opacity: 1; }
    93%            { transform: translateX(-3px); opacity: 1; }
    95%            { transform: none; opacity: 0; }
    97%            { transform: translateX(2px); opacity: 1; }
    99%            { opacity: 0; }
}

/* ── Brand ────────────────────────────────────────────────────────────────── */
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 30px;
    font-weight: 600;
    color: var(--text-primary);
    justify-content: center;
}

.brand svg { color: var(--accent-light); width: 38px; height: 38px; }

/* Form card */
.login-form {
    background: rgba(30, 30, 30, 0.35);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(79, 195, 247, 0.12);
    border-radius: 6px;
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.login-notice {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 12px;
    margin-top: -16px;
    background: rgba(79, 195, 247, 0.05);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(79, 195, 247, 0.15);
    border-radius: 4px;
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
}

.login-notice svg {
    flex-shrink: 0;
    color: #4fc3f7;
    opacity: 0.8;
}

.field label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.field input {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 7px 10px;
    font-size: 13px;
    font-family: var(--font);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s;
    width: 100%;
}

.field input:focus { border-color: var(--accent); }
.field input::placeholder { color: var(--text-muted); }

/* Error message */
.login-error {
    font-size: 12px;
    color: var(--error);
    background: rgba(244, 71, 71, 0.08);
    border: 1px solid rgba(244, 71, 71, 0.25);
    border-radius: 3px;
    padding: 7px 10px;
}

.login-success {
    font-size: 12px;
    color: #4ec9b0;
    background: rgba(78, 201, 176, 0.08);
    border: 1px solid rgba(78, 201, 176, 0.25);
    border-radius: 3px;
    padding: 7px 10px;
}

/* Suspended modal */
.susp-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(4px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}
.susp-backdrop.visible { display: flex; }
.susp-box {
    background: #141820;
    border: 1px solid rgba(244,71,71,0.35);
    border-radius: 8px;
    padding: 36px 40px 28px;
    width: 320px;
    text-align: center;
    animation: suspSlideIn 0.25s ease;
}
@keyframes suspSlideIn {
    from { opacity: 0; transform: translateY(-16px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)     scale(1); }
}
.susp-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 18px;
    color: #f44747;
}
.susp-icon svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}
/* Circle draws in */
.susp-circle {
    stroke-dasharray: 126;
    stroke-dashoffset: 126;
    animation: suspCircle 0.55s cubic-bezier(.4,0,.2,1) 0.1s forwards;
}
@keyframes suspCircle {
    to { stroke-dashoffset: 0; }
}
/* Slash draws in after circle */
.susp-slash {
    stroke-dasharray: 40;
    stroke-dashoffset: 40;
    animation: suspSlash 0.3s ease 0.6s forwards;
}
@keyframes suspSlash {
    to { stroke-dashoffset: 0; }
}
.susp-title {
    font-size: 15px;
    font-weight: 600;
    color: #f44747;
    letter-spacing: 0.02em;
    margin-bottom: 8px;
}
.susp-msg {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 22px;
}
.susp-close {
    font-family: inherit;
    font-size: 12px;
    padding: 7px 24px;
    background: rgba(244,71,71,0.1);
    color: #f44747;
    border: 1px solid rgba(244,71,71,0.3);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
}
.susp-close:hover { background: rgba(244,71,71,0.18); }

/* Logged-elsewhere warning modal theme */
.warn-modal .susp-box {
    border-color: rgba(255, 186, 73, 0.35);
}

.warn-modal .susp-icon {
    color: #ffba49;
}

.warn-modal .susp-title {
    color: #ffba49;
}

.warn-modal .susp-close {
    background: rgba(255, 186, 73, 0.1);
    color: #ffba49;
    border-color: rgba(255, 186, 73, 0.3);
}

.warn-modal .susp-close:hover {
    background: rgba(255, 186, 73, 0.18);
}

.elsewhere-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.elsewhere-recover {
    font-family: inherit;
    font-size: 12px;
    padding: 7px 16px;
    background: rgba(79, 195, 247, 0.1);
    color: var(--accent-light);
    border: 1px solid rgba(79, 195, 247, 0.35);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
}

.elsewhere-recover:hover {
    background: rgba(79, 195, 247, 0.18);
}

.register-link {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: -4px;
}

.register-link a { color: var(--accent-light); text-decoration: none; }
.register-link a:hover { text-decoration: underline; }

/* Submit button */
.login-btn {
    margin-top: 4px;
    width: 100%;
    padding: 8px;
    background: var(--accent);
    border: none;
    border-radius: 3px;
    color: #fff;
    font-size: 13px;
    font-family: var(--font);
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.login-btn:hover { background: var(--accent-hover); }
.login-btn:active { transform: scale(0.98); }

::selection { background: rgba(14,99,156,0.4); color: var(--text-primary); }

.login-copyright {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    opacity: 0.5;
    width: 100%;
}

.login-status-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 24px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border);
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 11px;
    color: var(--text-muted);
}

.login-status-bar .status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border-hover);
    flex-shrink: 0;
}

.login-status-bar .status-dot.online  { background: #4ec9b0; }
.login-status-bar .status-dot.offline { background: var(--col-red, #f44747); }

.login-status-copy {
    margin-left: auto;
    opacity: 0.6;
}
