:root {
    --core-black: #030305;
    --neon-cyan: #00f3ff;
    --neon-purple: #bc13fe;
    --alert-red: #ff2a6d;
    --ui-glass: rgba(10, 15, 20, 0.65);
    --font-main: 'Orbitron', sans-serif;
    --font-mono: 'Share Tech Mono', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background-color: var(--core-black);
    color: #fff;
    height: 100vh;
    overflow: hidden;
    font-family: var(--font-main);
    display: flex;
    justify-content: center;
    align-items: center;
}

/* === 背景特效層 === */
#neural-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
}

.vignette {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at center, transparent 0%, #000 120%);
    pointer-events: none;
    z-index: 1;
}

.noise-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
    opacity: 0.07;
    pointer-events: none;
    z-index: 2;
}

/* === 主介面容器 === */
.interface-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 480px;
    padding: 20px;
    /* 3D 透視感 */
    perspective: 1000px; 
}

.login-frame {
    background: var(--ui-glass);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 60px 40px;
    position: relative;
    
    /* 幾何切割造型 - 這是靈魂 */
    clip-path: polygon(
        0 0, 100% 0, 
        100% 85%, 90% 100%, 
        0 100%, 0 15%
    );
    
    transform: rotateX(5deg) scale(0.9);
    opacity: 0;
    animation: frame-entry 1s cubic-bezier(0.2, 0.8, 0.2, 1) forwards 0.5s;
    box-shadow: 0 0 40px rgba(0, 243, 255, 0.05);
}

@keyframes frame-entry {
    to { transform: rotateX(0) scale(1); opacity: 1; }
}

/* 邊框裝飾線條 */
.frame-decor {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    border-top: 2px solid var(--neon-cyan);
    border-bottom: 2px solid var(--neon-cyan);
    opacity: 0.5;
    z-index: -1;
}

/* === 標題區域 === */
.system-header {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    color: rgba(255,255,255,0.4);
    font-size: 0.7rem;
    margin-bottom: 40px;
    letter-spacing: 1px;
}

.pulse-dot {
    display: inline-block;
    width: 6px; height: 6px;
    background: var(--neon-cyan);
    border-radius: 50%;
    margin-right: 5px;
    box-shadow: 0 0 8px var(--neon-cyan);
    animation: blink 2s infinite;
}

.mega-title {
    font-size: 3.5rem;
    font-weight: 900;
    text-align: center;
    position: relative;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 4px;
    margin-bottom: 10px;
    mix-blend-mode: overlay;
    text-shadow: 0 0 20px rgba(255,255,255,0.5);
}

/* 故障文字效果 */
.mega-title::before, .mega-title::after {
    content: attr(data-text);
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    opacity: 0.8;
}
.mega-title::before {
    color: var(--neon-cyan);
    z-index: -1;
    clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
    animation: glitch-anim-1 2.5s infinite linear alternate-reverse;
}
.mega-title::after {
    color: var(--neon-purple);
    z-index: -2;
    clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
    animation: glitch-anim-2 3s infinite linear alternate-reverse;
}

.subtitle-box {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 50px;
}
.deco-line { height: 1px; width: 40px; background: rgba(255,255,255,0.2); }
.sub-text { font-family: var(--font-mono); color: var(--neon-cyan); letter-spacing: 3px; font-size: 0.8rem; }

/* === 輸入框 === */
.input-wrapper {
    position: relative;
    margin-bottom: 35px;
}

input {
    width: 100%;
    padding: 15px 10px;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.2rem;
    letter-spacing: 2px;
    transition: 0.4s;
    z-index: 2;
    position: relative;
}

input:focus { outline: none; border-bottom-color: transparent; }

label {
    position: absolute;
    left: 10px; top: 15px;
    color: rgba(255,255,255,0.3);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    pointer-events: none;
    transition: 0.4s;
}

/* 輸入框動畫邏輯：Floating Label */
input:focus ~ label,
input:not(:placeholder-shown) ~ label {
    top: -15px;
    left: 0;
    font-size: 0.7rem;
    color: var(--neon-cyan);
}

.input-highlight {
    position: absolute;
    bottom: 0; left: 0; width: 0%; height: 2px;
    background: linear-gradient(90deg, var(--neon-cyan), var(--neon-purple));
    transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 15px var(--neon-cyan);
}
input:focus ~ .input-highlight { width: 100%; }

/* === 按鈕 === */
.init-btn {
    width: 100%;
    padding: 20px;
    background: transparent;
    border: 1px solid var(--neon-cyan);
    color: var(--neon-cyan);
    font-family: var(--font-main);
    font-size: 1rem;
    letter-spacing: 3px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: 0.3s;
    margin-top: 20px;
    /* 切角按鈕 */
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}

.init-btn:hover {
    background: rgba(0, 243, 255, 0.1);
    box-shadow: 0 0 30px rgba(0, 243, 255, 0.2);
    letter-spacing: 5px;
    text-shadow: 4px 0 var(--alert-red); /* 色散 */
}

.icon-arrow {
    width: 20px; vertical-align: middle; stroke: currentColor; fill: none; stroke-width: 2; margin-left: 10px;
    transition: 0.3s;
}
.init-btn:hover .icon-arrow { transform: translateX(5px); }

/* === HUD 角落裝飾 === */
.hud-marker {
    position: absolute;
    width: 20px; height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    transition: 1s;
}
.top-left { top: -30px; left: -30px; border-right: none; border-bottom: none; }
.top-right { top: -30px; right: -30px; border-left: none; border-bottom: none; }
.bottom-left { bottom: -30px; left: -30px; border-right: none; border-top: none; }
.bottom-right { bottom: -30px; right: -30px; border-left: none; border-top: none; }

.interface-container:hover .hud-marker {
    border-color: var(--neon-cyan);
    width: 30px; height: 30px;
}

.stealth-link {
    display: block; text-align: center; margin-top: 30px;
    color: #444; text-decoration: none; font-family: var(--font-mono); font-size: 0.8rem;
    transition: 0.3s;
}
.stealth-link:hover { color: #fff; text-shadow: 0 0 10px #fff; }

.error-msg {
    margin-top: 15px; color: var(--alert-red); font-family: var(--font-mono); font-size: 0.9rem;
    border-left: 3px solid var(--alert-red); padding-left: 10px;
}

/* 動畫 Keyframes */
@keyframes blink { 50% { opacity: 0.3; } }
@keyframes glitch-anim-1 {
    0% { clip-path: inset(20% 0 80% 0); transform: translate(-2px, 1px); }
    100% { clip-path: inset(60% 0 10% 0); transform: translate(2px, -1px); }
}
@keyframes glitch-anim-2 {
    0% { clip-path: inset(10% 0 60% 0); transform: translate(2px, 0); }
    100% { clip-path: inset(80% 0 5% 0); transform: translate(-2px, 0); }
}

/* =========================================
   RESPONSIVE DESIGN (RWD) PATCH
   請貼在 CSS 檔案最下方
   ========================================= */

/* --- 平板與小筆電 (寬度 < 768px) --- */
@media screen and (max-width: 768px) {
    .interface-container {
        max-width: 90%; /* 放寬容器佔比 */
        padding: 10px;
    }

    .mega-title {
        font-size: 2.8rem; /* 標題稍微縮小 */
    }
}

/* --- 手機版 (寬度 < 480px) --- */
@media screen and (max-width: 480px) {
    .interface-container {
        padding: 0;
        perspective: none; /* 手機上取消 3D 透視，增加清晰度 */
    }

    .login-frame {
        width: 100%;
        padding: 40px 25px; /* 大幅減少內距，讓出空間給輸入框 */
        transform: none !important; /* 強制取消歪斜效果 */
        
        /* 調整切割造型，讓手機版邊緣不要切太多 */
        clip-path: polygon(
            0 0, 100% 0, 
            100% 90%, 92% 100%, 
            0 100%, 0 10%
        );
    }

    /* 調整標題大小，避免換行 */
    .mega-title {
        font-size: 2.2rem;
        letter-spacing: 2px;
    }

    .sub-text {
        font-size: 0.7rem;
        letter-spacing: 1px;
    }

    .deco-line {
        width: 20px; /* 縮短裝飾線 */
    }

    /* 收縮四個角落的 HUD 裝飾，避免跑版 */
    .top-left { top: -10px; left: -10px; }
    .top-right { top: -10px; right: -10px; }
    .bottom-left { bottom: -10px; left: -10px; }
    .bottom-right { bottom: -10px; right: -10px; }
    
    /* 確保輸入框文字在手機上夠大，防止 iOS 自動放大 */
    input {
        font-size: 16px; 
    }
}

/* --- 手機橫向模式 (高度 < 600px) --- */
/* 當使用者在手機橫著拿，或是鍵盤彈出時 */
@media screen and (max-height: 600px) {
    body {
        align-items: flex-start; /* 讓內容從上面開始，避免被切掉 */
        overflow-y: auto; /* 允許上下捲動 */
    }

    .interface-container {
        padding-top: 20px;
        padding-bottom: 20px;
        height: auto;
    }

    /* 隱藏非必要元素以節省空間 */
    .subtitle-box, .system-header {
        margin-bottom: 15px;
        display: none; /* 空間真的不夠時，隱藏裝飾字 */
    }

    .mega-title {
        font-size: 1.8rem;
        margin-bottom: 5px;
    }

    .login-frame {
        padding: 20px 30px;
    }
}