/* 全域設定 */
html, body {
    height: 100%; /* 強制填滿 */
    margin: 0;
    padding: 0;
    background-color: #0d1117;
    color: #00ff00;
    font-family: 'Courier New', Courier, monospace;
    overflow: hidden; /* 禁止 body 捲動，只讓內部元素捲動 */
}

/* 終端機輸出區 - [FIX] 增加頂部內距 */
#terminal-output {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 80px; 
    overflow-y: auto;
    
    /* [MODIFIED] 大幅增加頂部留白，確保第一行訊息不會被狀態列擋住 */
    /* 50px 應該足夠避開大多數狀態列 */
    padding: 60px 15px 20px 15px;
    
    font-size: 16px;
    line-height: 1.5;
    word-wrap: break-word;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* 輸入區 (隱藏式，需要時顯示) */
#input-line {
    display: none; /* JS 控制顯示 */
    padding: 12px;
    background-color: #0d1117;
    border-top: 1px solid #333;
    
    /* [KEY] 強制固定在底部，覆蓋在按鈕層之上 */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200; /* 比按鈕層高 */
    
    /* 排版設定 */
    align-items: center;
    gap: 10px;
}

#cmd-input {
    background: transparent;
    border: none;
    color: #fff;
    font-family: inherit;
    font-size: 16px;
    flex: 1;
    outline: none;
}

/* [KEY] 按鈕面板：固定在底部 */
#btn-panel {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 10px;
    padding: 12px;
    background-color: #161b22;
    border-top: 1px solid #333;
    align-items: center;
    
    /* [KEY] 固定定位 */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: 60px; /* 固定高度，配合 terminal-output 的 bottom */
    
    /* iOS 優化 */
    -webkit-overflow-scrolling: touch;
    padding-bottom: env(safe-area-inset-bottom, 12px);
}

/* 隱藏捲軸 */
#btn-panel::-webkit-scrollbar { height: 0px; background: transparent; }

/* 按鈕樣式 */
button {
    background: #0d1117;
    border: 1px solid #30363d;
    color: #00ff00;
    padding: 10px 16px;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    flex: 0 0 auto;
    border-radius: 6px;
    transition: all 0.2s;
    user-select: none;
}
button:hover { background-color: #21262d; border-color: #00ff00; }
button:active { background-color: #00ff00; color: #000; transform: translateY(1px); }

/* 每一行的樣式 */
.line { margin-bottom: 6px; animation: fadeIn 0.2s ease-out; }
.line.system { color: #888; }
.line.error { color: #ff5555; }
.line.success { color: #55ff55; }
.line.warning { color: #ffaa00; }
.line.input { color: #fff; font-weight: bold; }

/* 連結樣式 */
.cmd-link {
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: background-color 0.2s;
    padding: 2px 4px;
    border-radius: 3px;
}
.cmd-link:hover { background-color: #333; color: #fff !important; }

/* 狀態列 (右上角) - [FIX] 強化背景遮擋 */
#status-bar {
    position: fixed;
    top: 0;
    right: 0;
    padding: 8px 15px; 
    
    /* [KEY] 改為完全不透明的深色背景，確保遮擋 */
    background-color: #0d1117; 
    
    /* 加上邊框讓它看起來像個獨立區塊 */
    border: 1px solid #333;
    border-top: none;
    border-right: none;
    
    font-size: 14px; 
    border-bottom-left-radius: 8px;
    
    /* [KEY] 確保層級最高，蓋過捲動文字 */
    z-index: 9999; 
    
    /* 增加陰影 */
    box-shadow: -2px 2px 10px rgba(0,0,0,0.8);
}

/* 動畫 */
@keyframes blinkRed {
    0% { box-shadow: inset 0 0 0 0 rgba(255, 0, 0, 0); }
    50% { box-shadow: inset 0 0 30px 10px rgba(255, 0, 0, 0.3); }
    100% { box-shadow: inset 0 0 0 0 rgba(255, 0, 0, 0); }
}
.red-alert { animation: blinkRed 1.5s infinite; }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 捲軸美化 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #0d1117; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

/* 表格 */
table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 14px; }
th, td { border: 1px solid #333; padding: 8px; text-align: left; }
th { background-color: #161b22; color: #fff; }