/* --- 基础变量与全局设置 --- */
:root {
    --glass: rgba(255, 255, 255, 0.1);
    --border: rgba(255, 255, 255, 0.2);
    --ui-height: 46px; /* 统一 UI 元素高度 */
}

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

/* 核心布局：确保 body 撑满全屏且内容垂直居中 */
body {
    font-family: 'Segoe UI', 'Hiragino Kaku Gothic Pro', 'Malgun Gothic', 'PingFang SC', -apple-system, sans-serif;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    color: white;
    background-color: #000; /* 默认底色全黑 */
    display: flex;
    flex-direction: column;
}

/* --- 背景层与遮罩 --- */
#bg-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: 1.5s ease-in-out;
    z-index: -2;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: -1;
}

/* --- 专注模式：动画过渡 --- */
.fade-out {
    opacity: 0 !important;
    pointer-events: none;
    transition: 0.5s ease;
}

/* --- 页眉（Logo与语言切换） --- */
header {
    height: 80px;
    padding: 0 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

/* 下拉框通用样式 */
.select-styled {
    background: var(--glass);
    border: 1px solid var(--border);
    color: white;
    padding: 0 12px;
    cursor: pointer;
    border-radius: 10px;
    height: 32px;
    font-size: 0.8rem;
    outline: none;
    transition: 0.3s;
}

.select-styled:hover {
    background: rgba(255, 255, 255, 0.2);
}

.select-styled option {
    color: #333;
}

/* --- 主体区域：绝对居中控制 --- */
main {
    flex: 1; /* 占据 Header 和 Footer 之外的所有空间 */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; /* 确保内容在几何中心 */
    text-align: center;
    z-index: 5;
    width: 100%;
}

/* 设置栏布局 */
.settings-bar {
    margin-bottom: 50px;
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
}

/* 统一输入框与选择框高度 */
.input-unit, .task-field, .bg-selector {
    height: var(--ui-height);
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: white;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    transition: 0.3s;
}

.task-field {
    width: 260px;
    padding: 0 18px;
    outline: none;
}

.input-unit {
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.input-unit input {
    background: transparent;
    border: none;
    color: white;
    width: 40px;
    text-align: center;
    font-size: 1.1rem;
    outline: none;
}

/* 隐藏数字输入框箭头 */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

.bg-selector {
    padding: 0 10px;
    appearance: none;
    text-align: center;
}

/* --- 倒计时显示卡片 --- */
.timer-card {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#current-task-display {
    font-size: 1.4rem;
    font-weight: 300;
    margin-bottom: 15px;
    min-height: 1.5em;
    letter-spacing: 4px;
    opacity: 0.6;
}

#timer-display {
    font-size: clamp(5rem, 18vw, 12rem);
    font-weight: 800;
    letter-spacing: -4px;
    line-height: 0.9;
    margin-bottom: 50px;
    font-variant-numeric: tabular-nums; /* 防止数字宽度不同导致闪烁 */
}

/* --- 按钮样式 --- */
.btn-group {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 60px;
}

.btn {
    height: 50px;
    padding: 0 40px;
    border-radius: 25px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: transparent;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
    font-size: 0.9rem;
    letter-spacing: 2px;
}

.btn:hover {
    background: white;
    color: black;
    border-color: white;
}

/* 专注模式下的 PAUSE 按钮：弱化处理 */
.btn-pause-mode {
    border-color: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.4);
}

/* --- 页脚 --- */
footer {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    opacity: 0.3;
}

/* --- 庆祝全屏遮罩 --- */
#celeb-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.98);
    z-index: 1000;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#celeb-title {
    font-size: 3.5rem;
    margin-bottom: 20px;
}

/* --- 响应式适配 --- */
@media (max-width: 768px) {
    .settings-bar {
        flex-direction: column;
        height: auto;
    }
    #timer-display {
        font-size: 5rem;
    }
}