/* =========================================
   CSS 樣式設計 (UI/UX)
   ========================================= */
:root {
    --primary-cyan: #00f3ff;
    --primary-purple: #bc13fe;
    --secondary-blue: #0a1f30;
    --text-white: #ffffff;
    --text-dim: #8b9bb4;
    --glass-bg: rgba(10, 14, 23, 0.85);
    --border-glow: 0 0 10px rgba(0, 243, 255, 0.4);
    --error-red: #ff3366;
}

#mainBlock {
    font-family: 'Roboto', sans-serif;
    background-color: #050505;
    /* 背景圖片設定 */
    background-image: url('../../images/normal/p-16.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    color: var(--text-white);
    overflow-x: hidden;
    /* [新增] 僅隱藏水平捲軸 */
    overflow-y: auto;
    /* [新增] 允許垂直捲動 */
    position: relative;
    padding: 40px 0;
    /* [新增] 增加上下緩衝空間 */
}

/* --- 背景特效層 --- */
.bg-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image:
        linear-gradient(rgba(0, 243, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 243, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 0;
}

.bg-scanline {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(to bottom,
        transparent 50%,
        rgba(0, 243, 255, 0.02) 51%,
        transparent 51%);
    background-size: 100% 4px;
    animation: scanline 8s linear infinite;
    pointer-events: none;
    z-index: 1;
    opacity: 0.7;
}

#mainBlock .row {
    max-width: 650px;
    width: 90%;
}

#mainBlock .row .col {
    display: flex;
    justify-content: center;
    /* 水平 */
}

.vignette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, transparent 50%, rgba(0, 0, 0, 0.8) 120%);
    z-index: 1;
    pointer-events: none;
}

/* 主容器：戰術面板 */
.tactical-terminal {
    width: 100%;
    position: relative;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 243, 255, 0.3);
    padding: 35px 25px;
    clip-path: polygon(20px 0, 100% 0,
        100% calc(100% - 20px), calc(100% - 20px) 100%,
        0 100%, 0 20px);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8), inset 0 0 20px rgba(0, 243, 255, 0.05);
    z-index: 10;
    transition: all 0.5s ease;
    margin: auto;
    /* [新增] 在 flex 容器中自動分配邊距，達成空間足夠時垂直置中，空間不足時可捲動 */
}

/* 裝飾角落 */
.corner-deco {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary-cyan);
    box-shadow: 0 0 8px var(--primary-cyan);
    pointer-events: none;
    transition: 0.3s;
}

.corner-tl {
    top: 0;
    left: 0;
    border-right: none;
    border-bottom: none;
}

.corner-tr {
    top: 0;
    right: 0;
    border-left: none;
    border-bottom: none;
}

.corner-bl {
    bottom: 0;
    left: 0;
    border-right: none;
    border-top: none;
}

.corner-br {
    bottom: 0;
    right: 0;
    border-left: none;
    border-top: none;
}

/* 標題區 */
.header {
    text-align: center;
    margin-bottom: 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 15px;
}

.header h1 {
    font-family: 'Oxanium', display;
    font-weight: 800;
    font-size: 1.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #fff;
    text-shadow: 0 0 15px var(--primary-cyan);
}

.header span {
    display: block;
    font-size: 0.8rem;
    color: var(--primary-purple);
    letter-spacing: 4px;
    margin-top: 5px;
    font-weight: bold;
    text-transform: uppercase;
}

.event-duration {
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--primary-cyan);
    font-family: 'Oxanium', sans-serif;
    text-shadow: 0 0 8px rgba(0, 243, 255, 0.3);
    letter-spacing: 0.5px;
    background: rgba(0, 243, 255, 0.05);
    display: inline-block;
    padding: 5px 15px;
    border-radius: 15px;
    border: 1px solid rgba(0, 243, 255, 0.15);
    transition: all 0.3s ease;
}

/* 官方公告按鈕樣式 */
.btn-official-link {
    display: inline-block;
    margin-top: 15px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 6px 16px;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-family: 'Oxanium', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: rgba(0, 0, 0, 0.3);
    cursor: pointer;
}

.btn-official-link:hover {
    color: var(--primary-cyan);
    border-color: var(--primary-cyan);
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.3);
    background: rgba(0, 243, 255, 0.05);
    transform: translateY(-1px);
}

.btn-official-link::before {
    content: '🔗 ';
    opacity: 0.7;
}

/* 提示訊息 */
.notice-box {
    background: rgba(255, 51, 102, 0.1);
    border: 1px solid rgba(255, 51, 102, 0.3);
    padding: 10px;
    margin-bottom: 20px;
    font-size: 0.8rem;
    color: #ff99aa;
    display: flex;
    align-items: center;
    gap: 10px;
}

.notice-icon {
    font-weight: bold;
    font-family: monospace;
    background: var(--error-red);
    color: white;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 12px;
}

.error-message {
    color: var(--error-red);
    font-size: 0.8rem;
    text-align: center;
    margin-top: 10px;
    margin-bottom: 10px;
    height: 1.2rem;
    font-family: 'Oxanium', sans-serif;
    text-shadow: 0 0 5px rgba(255, 51, 102, 0.5);
}

/* 登入區 */
.section-login {
    transition: opacity 0.5s ease;
}

.input-group {
    margin-bottom: 15px;
}

.input-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 5px;
    font-family: 'Oxanium', sans-serif;
    text-transform: uppercase;
}

/* 修改：UID 輸入框強制為數字樣式，但保持外觀一致 */
input[type="text"],
input[type="number"] {
    width: 100%;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--text-dim);
    color: var(--primary-cyan);
    padding: 12px 15px;
    font-size: 1rem;
    outline: none;
    transition: 0.3s;
    font-family: 'Oxanium', sans-serif;
    letter-spacing: 1px;
    border-radius: 2px;
}

input:focus {
    border-color: var(--primary-cyan);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.3);
    background: rgba(0, 15, 20, 0.9);
}

/* 按鈕樣式 */
.btn-main {
    width: 100%;
    background: linear-gradient(90deg, var(--primary-purple) 0%, #d42eff 100%);
    color: #fff;
    border: none;
    padding: 14px;
    font-family: 'Oxanium', sans-serif;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: 0.3s;
    text-transform: uppercase;
    letter-spacing: 2px;
    clip-path: polygon(15px 0, 100% 0, 100% 100%, 0 100%, 0 15px);
    margin-top: 5px;
}

.btn-main:hover {
    box-shadow: 0 0 25px var(--primary-purple);
    transform: translateY(-2px);
    filter: brightness(1.2);
}

.btn-disconnect {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-top: 20px;
    color: var(--text-dim);
}

.btn-disconnect:hover {
    background: rgba(255, 51, 102, 0.2);
    border-color: var(--error-red);
    color: #fff;
    box-shadow: 0 0 15px rgba(255, 51, 102, 0.4);
}

/* === 週期切換器 (Cycle Switcher) === */
.cycle-switcher {
    display: flex;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--text-dim);
    border-radius: 4px;
    margin-bottom: 20px;
    overflow: hidden;
}

.cycle-btn {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-family: 'Oxanium', sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.cycle-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.cycle-btn.active {
    background: rgba(0, 243, 255, 0.15);
    color: var(--primary-cyan);
    font-weight: bold;
    box-shadow: inset 0 0 10px rgba(0, 243, 255, 0.2);
}

.cycle-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-cyan);
    box-shadow: 0 0 8px var(--primary-cyan);
}

/* 儀表板 */
.section-dashboard {
    display: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.data-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.stat-item {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0) 100%);
    border-left: 3px solid var(--text-dim);
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    opacity: 0;
    transform: translateX(-10px);
}

.stat-item:hover {
    background: linear-gradient(90deg, rgba(0, 243, 255, 0.15) 0%, rgba(0, 0, 0, 0) 100%);
    border-left-color: var(--primary-cyan);
    padding-left: 20px;
    transition: 0.3s;
}

.stat-label, .stat-next-title, .stat-next-value {
    font-size: 0.85rem;
    color: var(--text-dim);
    text-transform: uppercase;
}

.stat-value {
    font-family: 'Oxanium', monospace;
    font-size: 1.4rem;
    font-weight: 600;
    color: #fff;
}

.highlight-gold {
    border-left-color: #ffd700;
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.15) 0%, rgba(0, 0, 0, 0) 100%);
}

.highlight-gold .stat-value {
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
}

.highlight-cyan .stat-value {
    color: var(--primary-cyan);
    text-shadow: 0 0 10px var(--primary-cyan);
}

/* 狀態列 */
.status-bar {
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px dashed rgba(255, 255, 255, 0.15);
    font-size: 0.75rem;
    color: #666;
    display: flex;
    justify-content: space-between;
    font-family: 'Oxanium', monospace;
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #333;
    border-radius: 50%;
    margin-right: 5px;
}

.status-dot.active {
    background-color: #0f0;
    box-shadow: 0 0 8px #0f0;
    animation: blink 1s infinite;
}

@keyframes blink {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }

    100% {
        opacity: 1;
    }
}

@keyframes slideIn {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scanline {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 0 100%;
    }
}

.hidden {
    display: none !important;
}

@media (min-width: 600px) {
    .tactical-terminal {
        max-width: 650px;
    }

    .data-grid {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }

    .full-width {
        grid-column: span 2;
    }

    .section-login .inputs-row {
        display: flex;
        gap: 15px;
    }

    .inputs-row .input-group {
/*        flex: 1;*/
        margin-bottom: 0;
    }

    .inputs-row .input-group:nth-child(1), .inputs-row .input-group:nth-child(2) {
        width: 28%;
        flex-shrink: 0;
    }
}
