/* 导入LED数字字体 */
@import url('https://fonts.cdnfonts.com/css/ds-digital');

/* 基本样式 */
body {
    margin: 0;
    padding: 0; /* 移除body的padding */
    background-color: #000000;
    color: white;
    font-family: "Microsoft YaHei", Arial, sans-serif;
    height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    overflow: hidden;
}

.container {
    width: calc(100vw - 10vmin); /* 两侧各留5vmin间隙 */
    height: calc(100vh - 10vmin); /* 上下各留5vmin间隙 */
    margin: 5vmin; /* 均匀留出间隙 */
    display: flex;
    flex-direction: column;
    gap: calc(1vmin); /* 使用vmin保持行间距比例一致 */
    align-items: center;
    justify-content: center;
}

/* 计时器显示区域 */
.timer-display {
    width: 100%; /* 占满容器宽度 */
    display: flex;
    flex-direction: column;
    gap: calc(2vmin); /* 增加上下间距，原来是1vmin */
    align-items: center;
}

/* 计时器行 */
.timer-row {
    display: flex;
    width: 100%;
    height: calc(0.14 * 94vw); /* 收紧高度，原来是0.16 * 94vw */
    border-radius: calc(0.5vw);
    border-width: calc(0.3vw);
    border-style: solid;
    overflow: hidden;
}

/* 合并标签和时间值的容器 */
.timer-combined {
    display: flex;
    width: 100%;
    align-items: center;
    padding: 0 calc(0.01 * 94vw); /* 减小左右内边距至1% */
    height: 100%;
}

/* 标签文本样式 */
.label-text {
    margin-right: calc(0.005 * 94vw);
    font-size: calc(0.055 * 94vw); /* 略微减小标签字体大小 */
    letter-spacing: calc(0.003 * 94vw);
    font-weight: bold;
    white-space: nowrap;
}

/* 时间值样式 */
.time-value {
    flex-grow: 1;
    font-family: 'DS-Digital', monospace;
    font-size: calc(0.16 * 94vw); /* 调整字体大小，与线框高度匹配 */
    letter-spacing: 0; /* 移除字符间距以确保等宽效果 */
    font-weight: normal;
    text-align: right; /* 数字右对齐 */
    font-variant-numeric: tabular-nums; /* 使用等宽数字 */
}

/* 修改时间值样式，确保数字等宽 */
.time-value span {
    display: inline-block;
    width: calc(0.08 * 94vw); /* 调整数字宽度与字体大小匹配 */
    text-align: center;
}

/* 修改时间格式，将时间拆分为单独的数字以确保等宽 */
.timer-colon {
    width: calc(0.035 * 94vw) !important; /* 调整冒号宽度 */
    text-align: center;
}

/* ON AIR 按钮盒子 */
.on-air-box {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-top: calc(1vmin);
}

/* ON AIR 按钮 */
.on-air-btn {
    width: calc(0.15 * 94vw); /* 基于新宽度计算 */
    height: calc(0.04 * 94vw); /* 基于新宽度计算 */
    border-radius: calc(0.005 * 94vw);
    border-width: calc(0.003 * 94vw);
    border-style: solid;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Arial Black", Gadget, sans-serif;
    font-size: calc(0.025 * 94vw); /* 基于新宽度计算 */
    font-weight: bold;
    letter-spacing: calc(0.005 * 94vw); /* 基于新宽度计算 */
    cursor: pointer;
    transition: all 0.3s ease;
}

.on-air-btn:hover {
    opacity: 0.9;
    transform: scale(1.05);
}

/* 颜色方案 */
.current-time {
    background-color: rgba(0, 255, 0, 0.15);
    border-color: #00FF00;
}

.current-time .label-text,
.current-time .time-value,
.current-time span {
    color: #00FF00;
}

.on-air-time {
    background-color: rgba(255, 0, 0, 0.15);
    border-color: #FF0000;
}

.on-air-time .label-text,
.on-air-time .time-value,
.on-air-time span {
    color: #FF0000;
}

/* 设置面板样式 */
.settings-panel {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60vw;
    max-width: 800px;
    background-color: rgba(42, 42, 42, 0.95);
    padding: calc(0.05 * 80vw); /* 增大内边距 */
    border-radius: calc(0.02 * 80vw); /* 增大圆角 */
    border: calc(0.0025 * 80vw) solid #444;
    z-index: 1000;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* 添加阴影 */
}

.settings-title {
    font-size: calc(0.04 * 80vw);
    text-align: center;
    margin-bottom: calc(0.025 * 80vw);
    border-bottom: 1px solid #555;
    padding-bottom: calc(0.0125 * 80vw);
}

.settings-section {
    margin-bottom: calc(0.025 * 80vw);
}

.control-buttons {
    display: flex;
    justify-content: center;
    gap: calc(0.0125 * 80vw);
    padding: calc(0.0125 * 80vw) 0;
    border-top: 1px solid #555;
    border-bottom: 1px solid #555;
}

.settings-row {
    margin-bottom: calc(0.0125 * 80vw);
    display: flex;
    align-items: center;
}

.settings-label {
    width: 30%;
    font-size: calc(0.025 * 80vw);
    color: #fff;
}

.settings-input {
    background-color: rgba(51, 51, 51, 0.8);
    border: calc(0.0025 * 80vw) solid #444;
    color: white;
    padding: calc(0.02 * 80vw); /* 增大内边距 */
    border-radius: calc(0.00625 * 80vw);
    font-size: calc(0.03 * 80vw); /* 增大字体 */
    width: 70%;
}

.settings-actions {
    display: flex;
    justify-content: center;
    gap: calc(0.05 * 80vw); /* 增大按钮间距 */
    margin-top: calc(0.025 * 80vw);
}

/* 按钮样式 */
.btn {
    background-color: rgba(51, 51, 51, 0.8);
    color: white;
    border: calc(0.0025 * 80vw) solid #555;
    padding: calc(0.02 * 80vw) calc(0.04 * 80vw); /* 增大按钮内边距 */
    font-size: calc(0.03 * 80vw); /* 增大字体 */
    cursor: pointer;
    border-radius: calc(0.01 * 80vw); /* 增大圆角 */
    transition: all 0.3s ease;
    min-width: calc(0.125 * 80vw);
}

.btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-start {
    background-color: rgba(76, 175, 80, 0.8);
    border-color: #4CAF50;
}

.btn-end {
    background-color: rgba(244, 67, 54, 0.8);
    border-color: #F44336;
}

.btn-reset {
    background-color: rgba(33, 150, 243, 0.8);
    border-color: #2196F3;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    /* 不再需要基于百分比调整宽度 */
}

/* 纵向屏幕优化（高度大于宽度） */
@media (orientation: portrait) {
    .container {
        width: calc(100vw - 6vmin);
        height: auto;
        margin: 3vmin;
        justify-content: flex-start;
        padding-top: 3vmin;
        padding-bottom: 3vmin;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        overflow-y: auto;
    }
    
    .timer-row {
        height: auto;
        margin-bottom: calc(1vmin);
    }
    
    .timer-combined {
        flex-direction: column;
        align-items: center;
        padding: calc(0.01 * 100vw); /* 使用100vw替代94vw */
    }
    
    .label-text {
        margin-right: 0;
        margin-bottom: calc(0.005 * 100vw);
        text-align: center;
        font-size: calc(0.05 * 100vw); /* 使用100vw替代94vw */
    }
    
    .time-value {
        width: 100%;
        text-align: center;
        font-size: calc(0.24 * 100vw); /* 大幅增加字体大小，确保竖屏下足够大 */
    }
    
    .time-value span {
        width: calc(0.12 * 100vw); /* 增大数字宽度 */
    }
    
    .timer-colon {
        width: calc(0.06 * 100vw) !important; /* 调整冒号宽度 */
    }
    
    /* ON AIR 按钮也使用100vw */
    .on-air-btn {
        width: calc(0.3 * 100vw); /* 增大宽度 */
        height: calc(0.1 * 100vw); /* 增大高度 */
        font-size: calc(0.05 * 100vw); /* 增大字体 */
    }
}

@media (max-width: 768px) {
    .timer-combined {
        padding: 0 calc(0.01 * 94vw);
    }
    
    .label-text {
        font-size: calc(0.055 * 94vw);
        margin-right: calc(0.005 * 94vw);
    }
    
    .time-value {
        font-size: calc(0.15 * 94vw);
    }
    
    .control-buttons {
        flex-direction: column;
        align-items: center;
        gap: calc(0.02 * 94vw);
    }
    
    .time-value span {
        width: calc(0.085 * 94vw);
    }
    
    .timer-colon {
        width: calc(0.035 * 94vw) !important;
    }
    
    .timer-row {
        height: calc(0.15 * 94vw); /* 减小高度，原来是0.17 * 94vw */
    }
}

/* 中等宽度屏幕特定优化 - 修复特定宽度范围显示问题 */
@media (min-width: 481px) and (max-width: 855px) {
    /* 强制布局为纵向排列，确保所有内容可见 */
    .container {
        width: calc(100vw - 4vmin);
        height: auto;
        margin: 2vmin;
        justify-content: flex-start;
        overflow-y: auto;
        padding: 2vmin 0;
        box-sizing: border-box; /* 确保内边距包含在宽度内 */
    }
    
    .timer-display {
        width: 100%;
        box-sizing: border-box; /* 确保内边距包含在宽度内 */
    }
    
    .timer-row {
        width: 100%;
        max-width: 100%;
        height: auto;
        margin-bottom: 1vmin;
        box-sizing: border-box; /* 确保边框包含在宽度内 */
        border-width: calc(0.2vw); /* 减小边框宽度，避免溢出 */
    }
    
    .timer-combined {
        flex-direction: column;
        padding: 1vmin 2vmin;
        align-items: center;
        width: 100%;
        box-sizing: border-box; /* 确保内边距包含在宽度内 */
    }
    
    .label-text {
        margin-right: 0;
        margin-bottom: 0.5vmin;
        text-align: center;
    }
    
    .time-value {
        width: 100%;
        text-align: center;
        font-size: calc(0.14 * 100vw); /* 使用100vw */
        box-sizing: border-box;
    }
    
    .time-value span {
        width: calc(0.07 * 100vw); /* 使用100vw */
    }
    
    .timer-colon {
        width: calc(0.03 * 100vw) !important; /* 使用100vw */
    }
    
    /* 确保竖屏模式在这个宽度范围内也能正确显示 */
    @media (orientation: portrait) {
        .time-value {
            font-size: calc(0.22 * 100vw); /* 在竖屏模式下增大字体 */
        }
        
        .time-value span {
            width: calc(0.11 * 100vw);
        }
        
        .timer-colon {
            width: calc(0.055 * 100vw) !important;
        }
    }
}

@media (max-width: 480px) {
    .container {
        width: calc(100vw - 2vmin);
        height: auto;
        margin: 1vmin;
        justify-content: flex-start;
        padding-top: 1vmin;
        padding-bottom: 1vmin;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        overflow-y: auto;
    }
    
    .timer-display {
        height: auto;
        width: 100%;
        gap: calc(0.8vmin);
    }
    
    .timer-row {
        height: auto;
        margin-bottom: calc(0.5vmin);
        border-width: calc(0.2vw);
    }
    
    /* 调整按钮大小和位置 */
    .on-air-box {
        margin-top: calc(0.8vmin);
    }
    
    .on-air-btn {
        width: calc(0.2 * 90vw);
        height: calc(0.05 * 90vw);
        font-size: calc(0.03 * 90vw);
        border-width: calc(0.2vw);
    }
    
    .settings-panel {
        width: 90vw;
        max-height: 80vh;
        overflow-y: auto;
    }
    
    /* 手机纵向模式下的特殊调整 */
    @media (orientation: portrait) {
        .container {
            padding-top: 0;
            padding-bottom: 0;
        }
        
        .timer-display {
            gap: calc(0.5vmin);
            transform: scale(0.95);
        }
        
        .time-value {
            font-size: calc(0.2 * 100vw); /* 增大字体大小，使用100vw */
        }
        
        .time-value span {
            width: calc(0.1 * 100vw); /* 增大宽度 */
        }
        
        .timer-colon {
            width: calc(0.05 * 100vw) !important;
        }
        
        .label-text {
            font-size: calc(0.045 * 100vw);
        }
        
        /* 极小屏幕适配 */
        @media (max-height: 600px) {
            .timer-display {
                transform: scale(0.9);
            }
            
            .time-value {
                font-size: calc(0.12 * 90vw);
            }
            
            .time-value span {
                width: calc(0.06 * 90vw);
            }
            
            .timer-colon {
                width: calc(0.03 * 90vw) !important;
            }
            
            .label-text {
                font-size: calc(0.035 * 90vw);
            }
            
            .on-air-btn {
                width: calc(0.18 * 90vw);
                height: calc(0.04 * 90vw);
                font-size: calc(0.025 * 90vw);
            }
        }
    }
}

/* 闪烁提醒样式 */
.flash-alert {
    position: fixed;
    background-color: rgba(255, 0, 0, 1); /* 修改为完全不透明的红色 */
    z-index: 9999;
    pointer-events: none; /* 允许点击穿透 */
    opacity: 0;
    display: none;
    transition: opacity 0.15s ease; /* 添加过渡效果使闪烁更平滑 */
}

/* 线框闪烁区域 - 这些区域会通过JS动态设置位置 */
.flash-time1, .flash-time2 {
    position: absolute; /* 改为absolute以便准确定位 */
}

/* 上部闪烁区域 */
.flash-top {
    top: 0;
    left: 0;
    width: 100%;
    height: 5vmin; /* 与container上边距相同 */
}

/* 下部闪烁区域 */
.flash-bottom {
    bottom: 0;
    left: 0;
    width: 100%;
    height: 5vmin; /* 与container下边距相同 */
}

/* 左侧闪烁区域 */
.flash-left {
    top: 5vmin;
    left: 0;
    width: 5vmin; /* 与container左边距相同 */
    height: calc(100vh - 10vmin); /* 减去上下边距 */
}

/* 右侧闪烁区域 */
.flash-right {
    top: 5vmin;
    right: 0;
    width: 5vmin; /* 与container右边距相同 */
    height: calc(100vh - 10vmin); /* 减去上下边距 */
}

/* 不同屏幕大小下的闪烁区域调整 */
@media (max-width: 855px) {
    .flash-top, .flash-bottom {
        height: 2vmin;
    }
    
    .flash-left, .flash-right {
        top: 2vmin;
        width: 2vmin;
        height: calc(100vh - 4vmin);
    }
}

@media (max-width: 480px) {
    .flash-top, .flash-bottom {
        height: 1vmin;
    }
    
    .flash-left, .flash-right {
        top: 1vmin;
        width: 1vmin;
        height: calc(100vh - 2vmin);
    }
}

/* 设置区域的时间显示样式 */
.time-display {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 15px;
    background: transparent;
    border-radius: 8px;
}

/* 帮助相关样式 */
.btn-help {
    background-color: #007AFF !important;
    color: white !important;
}

.help-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.help-content {
    background-color: #ffffff;
    padding: 30px;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: calc(90vh - 60px);
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.help-content h2 {
    margin: 0 0 25px 0;
    color: #333;
    font-size: 24px;
    text-align: center;
    font-weight: 600;
}

.help-section {
    margin-bottom: 30px;
}

.help-section h3 {
    color: #007AFF;
    margin: 0 0 15px 0;
    font-size: 18px;
    font-weight: 600;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.help-item {
    margin-bottom: 15px;
    padding-left: 15px;
}

.help-item-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.help-item-desc {
    color: #666;
    line-height: 1.6;
    font-size: 14px;
    padding-left: 8px;
}

#closeHelpBtn {
    display: block;
    margin: 20px auto 0;
    padding: 10px 30px;
    background-color: #007AFF;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.2s;
}

#closeHelpBtn:hover {
    background-color: #0056b3;
}

/* iOS风格设置面板 */
.settings-panel {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    width: 90%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    z-index: 1000;
    padding: 20px;
}

.settings-title {
    font-size: 20px;
    font-weight: 600;
    color: #000;
    margin-bottom: 24px;
    text-align: center;
    letter-spacing: -0.5px;
}

.settings-section {
    margin-bottom: 24px;
}

.settings-row {
    margin-bottom: 20px;
}

.settings-label {
    font-size: 15px;
    color: #3a3a3c;
    margin-bottom: 8px;
    font-weight: 500;
    letter-spacing: -0.2px;
}

.settings-input {
    width: 100%;
    padding: 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    font-size: 16px;
    color: #000;
    background-color: rgba(242, 242, 247, 0.8);
    transition: all 0.2s;
}

.settings-input:focus {
    border-color: #007AFF;
    background-color: #fff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.control-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
}

.btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: -0.2px;
}

.btn-start {
    background-color: #34C759;
    color: white;
}

.btn-end {
    background-color: #FF3B30;
    color: white;
}

.btn-reset {
    background-color: #FF9500;
    color: white;
}

.btn-cancel {
    background-color: rgba(142, 142, 147, 0.2);
    color: #3a3a3c;
}

.settings-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.settings-actions .btn {
    flex: 0 1 auto;
    min-width: 80px;
    background-color: #007AFF;
    color: white;
}

.btn:active {
    transform: scale(0.98);
    opacity: 0.9;
}

/* 暗色模式适配 */
@media (prefers-color-scheme: dark) {
    .help-content {
        background-color: #1c1c1e;
        color: #fff;
    }

    .help-content h2 {
        color: #fff;
    }

    .help-section h3 {
        color: #0A84FF;
        border-bottom-color: #333;
    }

    .help-item-title {
        color: #fff;
    }

    .help-item-desc {
        color: #999;
    }

    .settings-panel {
        background-color: rgba(28, 28, 30, 0.95);
    }

    .settings-title {
        color: #fff;
    }

    .settings-label {
        color: #fff;
    }

    .settings-input {
        background-color: rgba(44, 44, 46, 0.8);
        border-color: rgba(255, 255, 255, 0.1);
        color: #fff;
    }

    .settings-input:focus {
        background-color: rgba(44, 44, 46, 1);
        border-color: #0A84FF;
        box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.1);
    }

    .btn-cancel {
        background-color: rgba(142, 142, 147, 0.2);
        color: #fff;
    }
}

/* 移动设备适配 */
@media (max-width: 480px) {
    .help-content {
        padding: 20px;
    }

    .help-content h2 {
        font-size: 20px;
        margin-bottom: 20px;
    }

    .help-section h3 {
        font-size: 16px;
    }

    .help-item {
        padding-left: 10px;
    }

    .help-item-desc {
        font-size: 13px;
    }

    .settings-panel {
        width: 92%;
        padding: 16px;
        max-height: 88vh;
        position: fixed;
        bottom: 0;
        transform: translate(-50%, 0);
        transition: transform 0.3s ease-out;
    }

    .settings-panel.keyboard-open {
        transform: translate(-50%, -40%);
    }

    .settings-input {
        font-size: 16px;
        padding: 8px;
    }

    .settings-section {
        margin-bottom: 16px;
    }

    .settings-row {
        position: relative;
        margin-bottom: 12px;
    }

    .btn {
        min-height: 44px;
        padding: 12px 20px;
        touch-action: manipulation;
    }

    .time-display {
        font-size: 7vw;
        line-height: 1.2;
        word-break: break-all;
    }
}

/* 处理虚拟键盘 */
@media (max-height: 400px) {
    .settings-panel {
        max-height: 100vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* 处理横屏模式下的宽高比限制 */
@media (orientation: landscape) and (min-aspect-ratio: 64/33) {
    body {
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 100vh;
        margin: 0;
        padding: 0;
    }

    .container {
        transform: scale(0.85);
        transform-origin: center;
        position: relative;
        margin: auto;
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100%;
        height: 100vh;
        justify-content: center;
    }

    .timer-display {
        margin: 0;
        position: relative;
        width: 100%;
    }

    .settings-panel {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) scale(0.9);
        max-height: 95vh;
    }

    .help-content {
        transform: scale(0.9);
        transform-origin: center;
        max-height: 95vh;
    }

    .on-air-box {
        margin-top: 2vh;
        position: relative;
    }
}

/* 更极端的宽高比处理 */
@media (orientation: landscape) and (min-aspect-ratio: 2/1) {
    .container {
        transform: scale(0.8);
    }

    .timer-display {
        margin: 0;
    }

    .on-air-box {
        margin-top: 2vh;
    }

    .settings-panel {
        transform: translate(-50%, -50%) scale(0.85);
    }
}

.help-contact {
    text-align: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    color: #666;
    font-size: 14px;
}

.help-contact a {
    color: #007AFF;
    text-decoration: none;
}

.help-contact a:hover {
    text-decoration: underline;
}

/* 暗色模式适配 */
@media (prefers-color-scheme: dark) {
    .help-contact {
        border-top-color: #333;
        color: #999;
    }

    .help-contact a {
        color: #0A84FF;
    }
}

@media (max-width: 480px) {
    .help-contact {
        font-size: 13px;
        margin-top: 15px;
        padding-top: 12px;
    }
} 