/* V21 MATRIX LOGIN — 深綠高速雨碼模式 */

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background: #000;
    overflow-x: hidden;
    font-family: Consolas, "Cascadia Code", monospace;
    color: #0f0;
}

/* 全螢幕 canvas Rain */
#matrixCanvas {
    position: fixed;
    inset: 0;
    z-index: 0;
}
canvas {
    display: block;
    pointer-events: none;
}

/* 上層 HUD Login 面板 */
.matrix-login-wrap {
    position: relative;
    z-index: 2;
    width: min(420px, calc(100vw - 24px));
    margin: 72px auto 24px auto;
    padding: 20px 18px;
    border-radius: 10px;
    backdrop-filter: blur(6px);
    background: rgba(10,20,10,0.65);
    border: 1px solid rgba(0,255,0,0.5);
    box-shadow:
        0 0 20px rgba(0,255,0,0.6),
        0 0 60px rgba(0,255,0,0.25);
}

.matrix-title {
    text-align: center;
    letter-spacing: 0.2em;
    font-size: 1.1rem;
    color: #0f0;
    text-shadow: 0 0 8px #0f0;
    margin-bottom: 10px;
}

.matrix-sub {
    text-align: center;
    font-size: 0.8rem;
    color: #8f8;
    margin-bottom: 12px;
}

.matrix-status {
    font-size: 0.8rem;
    margin-bottom: 10px;
    padding: 6px;
    border-radius: 6px;
}

/* Input 區域 */
.matrix-form {
    text-align: center;
}

.matrix-input {
    width: 100%;
    padding: 12px 10px;
    margin: 6px 0;
    border: none;
    border-bottom: 1px solid #0f0;
    background: transparent;
    color: #0f0;
    text-align: center;
    outline: none;
    font-size: 16px; /* 防 iOS 自動縮放 */
}
.matrix-input::placeholder {
    color: #0a0;
}

.matrix-input:focus {
    box-shadow: 0 0 8px #0f0;
}

/* 按鈕 */
.matrix-btn {
    display: inline-block;
    width: 100%;
    padding: 12px 20px;
    margin-top: 12px;
    border-radius: 6px;
    border: 1px solid #0f0;
    background: rgba(0,0,0,0.7);
    color: #0f0;
    cursor: pointer;
    font-size: 1rem;
    text-decoration: none;
    transition: 0.2s;
}
.matrix-btn:hover {
    background: rgba(0,80,0,0.8);
    box-shadow: 0 0 12px #0f0;
}

/* 小提示 */
.matrix-note {
    margin-top: 12px;
    font-size: 0.75rem;
    color: #9f9;
    text-align: center;
    opacity: 0.9;
    line-height: 1.6;
    word-break: break-word;
}

/* DOS typing line */
.matrix-dosline{
    margin-top: 10px;
    margin-bottom: 12px;
    font-size: 0.78rem;
    color: #bfffbf;
    opacity: 0.95;
    text-align: center;
    letter-spacing: 0.04em;
    line-height: 1.6;
    word-break: break-word;
    min-height: 2.8em;
}

.matrix-caret{
    display:inline-block;
    width: 8px;
    margin-left: 6px;
    color: #0f0;
    animation: v21blink 0.9s step-end infinite;
}
@keyframes v21blink{
    50%{ opacity: 0; }
}

.login-fx{
    position: fixed;
    inset: 0;
    display: none;
    background: rgba(0,0,0,.65);
    backdrop-filter: blur(2px);
    z-index: 9999;
}
.login-fx.show{ display:block; animation: fxFade .45s ease-out; }

.scanline{
    position: absolute;
    left: 0;
    right: 0;
    top: -20%;
    height: 22%;
    background: linear-gradient(to bottom, rgba(0,255,0,0), rgba(0,255,0,.25), rgba(0,255,0,0));
    animation: scan 0.85s ease-in-out 2;
}

.fx-text{
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%,-50%);
    font: 700 26px ui-monospace;
    color: #7CFF7C;
    text-shadow: 0 0 14px rgba(0,255,0,.55);
    letter-spacing: 2px;
    animation: pop .45s ease-out;
    text-align: center;
    width: min(92vw, 420px);
}

@keyframes scan{ to{ top:110%; } }
@keyframes fxFade{ from{opacity:0} to{opacity:1} }
@keyframes pop{ from{transform:translate(-50%,-50%) scale(.96); opacity:.3} to{transform:translate(-50%,-50%) scale(1); opacity:1} }

/* 紅色警報 */
.alarm-red::before{
    content:"";
    position: fixed;
    inset: 0;
    background: rgba(255,0,0,.18);
    animation: alarmFlash .22s infinite alternate;
    z-index: 9998;
    pointer-events: none;
}
@keyframes alarmFlash{
    from{opacity:.25}
    to{opacity:.9}
}

/* 錯誤訊息 */
.matrix-error {
    color: #ff6b6b;
    margin: 8px 0;
    font-size: 0.9rem;
}

/* 手機優化 */
@media (max-width: 480px) {
    .matrix-login-wrap {
        width: min(330px, calc(100vw - 16px));
        margin: 20px auto 16px auto;
        padding: 16px 14px;
        border-radius: 12px;
        box-sizing: border-box;
    }

    .matrix-title {
        font-size: 1rem;
        letter-spacing: 0.12em;
    }

    .matrix-sub {
        font-size: 0.74rem;
    }

    .matrix-dosline {
        margin: 4px 0 8px 0;
        min-height: 1.8em;
    }

    .matrix-note {
        font-size: 0.72rem;
        line-height: 1.45;
    }

    .fx-text {
        font-size: 20px;
        letter-spacing: 1px;
    }
}