body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #0d1117;
    color: #c9d1d9;
    margin: 0;
    line-height: 1.6;
    padding-top: 50px;
    box-sizing: border-box;
    
    background-image:
        linear-gradient(rgba(88, 166, 255, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(88, 166, 255, 0.08) 1px, transparent 1px);
    background-size: 40px 40px;
    animation: gridScan 20s linear infinite;
    position: relative;
    z-index: 0;
    overflow-x: hidden;
}

@keyframes gridScan {
    0% { background-position: 0 0; }
    100% { background-position: 40px 40px; }
}

body::before, body::after {
    content: "";
    position: fixed;
    width: 80vmax; height: 80vmax;
    border-radius: 50%;
    z-index: -1;
    pointer-events: none;
    filter: blur(80px);
}

body::before {
    top: -20%; left: -10%;
    background: radial-gradient(circle, #005bb5 0%, transparent 70%);
    animation: deepBreath1 8s ease-in-out infinite alternate;
}

body::after {
    bottom: -20%; right: -10%;
    background: radial-gradient(circle, #3fb950 0%, transparent 70%);
    animation: deepBreath2 11s ease-in-out infinite alternate;
    animation-delay: -4s;
}

@keyframes deepBreath1 {
    0% { transform: scale(0.7); opacity: 0.02; }
    100% { transform: scale(1.3); opacity: 0.35; }
}
@keyframes deepBreath2 {
    0% { transform: scale(0.7); opacity: 0.02; }
    100% { transform: scale(1.3); opacity: 0.35; }
}

@keyframes auroraDrift1 {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(15%, 10%) scale(1.2); }
}
@keyframes auroraDrift2 {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-15%, -15%) scale(1.1); }
}
.flex-center { 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    min-height: calc(100vh - 50px); 
    flex-direction: column; 
}
.card { background: #161b22; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.5); border: 1px solid #30363d; }
.wrapper { width: 90%; max-width: 560px; background-color: #161b22; padding: 35px 40px; border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,0.8); border: 1px solid #30363d; box-sizing: border-box; margin: 40px auto; }
.wrapper-large { max-width: 1100px; padding: 25px; background-color: transparent; border: none; box-shadow: none; margin: 20px auto; }

.header-section { border-bottom: 1px solid #30363d; padding-bottom: 15px; margin-bottom: 25px; display: flex; justify-content: space-between; align-items: flex-end; }
.header-section.col { flex-direction: column; align-items: flex-start; }
h1 { color: #c9d1d9; font-size: 1.3em; font-weight: 500; margin: 0; letter-spacing: 1px; }
p.sub-text { font-size: 0.85em; color: #8b949e; font-family: monospace; margin: 0; }

/* --- 語意化按鈕設計 --- */
.btn {
    padding: 10px 16px; border: 1px solid transparent; border-radius: 6px; font-size: 13px; font-weight: 500;
    cursor: pointer; transition: all 0.2s ease; text-align: center; text-decoration: none; display: inline-block; box-sizing: border-box; font-family: inherit; letter-spacing: 0.5px;
}
.btn-block { display: block; width: 100%; margin-bottom: 12px; }

/* 藍色 (主要行動) */
.btn-primary { background-color: #005bb5; color: #ffffff; border-color: #004b96; }
.btn-primary:hover:not(:disabled) { background-color: #0071e3; border-color: #005bb5; }
/* 灰色 (次要行動) */
.btn-secondary { background-color: #21262d; color: #c9d1d9; border-color: #30363d; }
.btn-secondary:hover:not(:disabled) { background-color: #30363d; color: #ffffff; border-color: #484f58; }
/* 綠色 (推進/成功) */
.btn-success { background-color: #238636; color: #ffffff; border-color: #2ea043; }
.btn-success:hover:not(:disabled) { background-color: #2ea043; border-color: #3fb950; }
/* 紅色 (警告/異常) */
.btn-danger { background-color: #da3633; color: #ffffff; border-color: #b32d2a; }
.btn-danger:hover:not(:disabled) { background-color: #f85149; border-color: #da3633; }
/* 邊框模式 (取消/重置) */
.btn-outline { background-color: transparent; border-color: #30363d; color: #8b949e; }
.btn-outline:hover:not(:disabled) { background-color: #21262d; border-color: #8b949e; color: #c9d1d9; }

.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* --- 同色系漸進按鈕 (播放取樣秒數) --- */
.play-btn { border-radius: 4px; cursor: pointer; transition: 0.2s; flex: 1; min-width: 80px; font-family: monospace; border: 1px solid; font-size: 12px; padding: 8px 10px; }
.play-btn-1 { background-color: #001a33; border-color: #002b5e; color: #7b9cbe; }
.play-btn-1:hover:not(:disabled) { background-color: #002b5e; color: #d4e3f0; }
.play-btn-2 { background-color: #003d7a; border-color: #004b96; color: #d4e3f0; }
.play-btn-2:hover:not(:disabled) { background-color: #004b96; color: #fff; }
.play-btn-3 { background-color: #005bb5; border-color: #0071e3; color: #ffffff; }
.play-btn-3:hover:not(:disabled) { background-color: #0071e3; border-color: #005bb5; }
.play-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* --- 表單與元件 --- */
input[type="text"], input[type="number"] { width: 100%; padding: 12px 16px; margin-bottom: 15px; background-color: #0d1117; border: 1px solid #30363d; color: #c9d1d9; border-radius: 6px; box-sizing: border-box; font-size: 13px; outline: none; transition: 0.2s; }
input[type="text"]:focus, input[type="number"]:focus { border-color: #005bb5; background-color: #161b22; }
input.correct { border-color: #3fb950; color: #3fb950; }
input.incorrect { border-color: #ff7b72; color: #ff7b72; }

.loader { border: 2px solid #21262d; border-top: 2px solid #005bb5; border-radius: 50%; width: 24px; height: 24px; animation: spin 1s linear infinite; margin-bottom: 15px; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.progress-bg { width: 100%; height: 3px; background: #21262d; margin-bottom: 20px; border-radius: 2px;}
.progress-fill { height: 100%; width: 0%; background: #005bb5; transition: width 0.3s; }

.log-window { height: 240px; background: #0d1117; border: 1px solid #21262d; padding: 12px; overflow-y: auto; font-size: 12px; font-family: monospace; color: #8b949e; border-radius: 6px; margin-bottom: 20px; text-align: left; }
.log-line { border-bottom: 1px solid #161b22; padding: 4px 0; }
.log-line:last-child { color: #c9d1d9; border-bottom: none; }

.text-error { color: #ff7b72 !important; }
.text-success { color: #3fb950 !important; }

/* --- 頂部導覽列 (Top Navbar) --- */
.navbar {
    position: fixed; top: 0; left: 0; width: 100%; height: 50px;
    background-color: rgba(13, 17, 23, 0.95); /* 半透明科技黑 */
    border-bottom: 1px solid #30363d;
    display: flex; align-items: center; padding: 0 25px; box-sizing: border-box;
    z-index: 1000; justify-content: space-between; backdrop-filter: blur(10px);
}
.navbar-brand { 
    color: #c9d1d9; font-weight: 500; text-decoration: none; 
    letter-spacing: 1px; font-size: 15px;
}
.navbar-links a { 
    color: #8b949e; text-decoration: none; font-size: 12px; 
    margin-left: 20px; transition: 0.2s; font-family: monospace;
}
.navbar-links a:hover { color: #fff; }

/* 避免內容被導覽列遮擋 */
body { padding-top: 50px; }