/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #1e1e2e 0%, #2d2d44 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: #ffffff;
    overflow-x: hidden;
}

/* 时钟头部样式 */
.clock-header {
    padding: 20px;
    text-align: left;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.clock-display {
    font-size: 1.2rem;
    font-weight: 300;
    letter-spacing: 0.5px;
    color: #00ff88;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
    font-family: 'Courier New', monospace;
}

/* 主容器 */
.calculator-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
}

/* 模式切换 */
.mode-switch {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.1);
    padding: 5px;
    border-radius: 25px;
    backdrop-filter: blur(10px);
}

.mode-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.mode-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.mode-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* 显示屏 */
.display {
    width: 100%;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 120px;
}

.formula-text {
    text-align: right;
    font-size: 1.2rem;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.6);
    word-wrap: break-word;
    word-break: break-all;
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 10px;
}

.display-text {
    text-align: right;
    font-size: 2.5rem;
    font-weight: 300;
    color: #ffffff;
    word-wrap: break-word;
    word-break: break-all;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

/* 计算器按钮容器 */
.calculator-buttons {
    display: grid;
    gap: 10px;
    width: 100%;
    transition: all 0.3s ease;
}

/* 基础模式布局 */
.basic-mode {
    grid-template-columns: repeat(4, 1fr);
}

.basic-mode .btn-zero {
    grid-column: span 2;
}

/* 科学模式布局 */
.scientific-mode {
    grid-template-columns: repeat(5, 1fr);
}

/* 按钮通用样式 */
.btn {
    padding: 20px;
    border: none;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

/* 按钮悬停效果 */
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

/* 按钮点击效果 */
.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* 按钮涟漪效果 */
.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.btn:active::before {
    width: 100px;
    height: 100px;
}

/* 不同类型按钮的样式 */
.btn-number {
    background: rgba(255, 255, 255, 0.15);
}

.btn-number:hover {
    background: rgba(255, 255, 255, 0.25);
}

.btn-operator {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.btn-operator:hover {
    background: linear-gradient(135deg, #7c8ff0 0%, #8a5bb8 100%);
}

.btn-equals {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    grid-row: span 2;
}

.btn-equals:hover {
    background: linear-gradient(135deg, #f2a5fd 0%, #f7697c 100%);
}

.btn-clear {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.btn-clear:hover {
    background: linear-gradient(135deg, #fc82aa 0%, #fee560 100%);
}

.btn-back {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    color: #333;
}

.btn-back:hover {
    background: linear-gradient(135deg, #b8f0ed 0%, #fee0eb 100%);
}

.btn-decimal {
    background: rgba(255, 255, 255, 0.15);
}

.btn-decimal:hover {
    background: rgba(255, 255, 255, 0.25);
}

.btn-scientific {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    font-size: 1rem;
    padding: 15px 10px;
}

.btn-scientific:hover {
    background: linear-gradient(135deg, #5fb9ff 0%, #1af3fe 100%);
}

/* 隐藏类 */
.hidden {
    display: none !important;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .clock-header {
        padding: 15px;
    }
    
    .clock-display {
        font-size: 1rem;
    }
    
    .calculator-container {
        padding: 15px;
    }
    
    .display-text {
        font-size: 2rem;
        min-height: 50px;
    }
    
    .formula-text {
        font-size: 1rem;
        min-height: 25px;
    }
    
    .btn {
        padding: 15px;
        font-size: 1rem;
    }
    
    .btn-scientific {
        padding: 12px 8px;
        font-size: 0.9rem;
    }
    
    .scientific-mode {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }
    
    .scientific-mode .btn-scientific:nth-child(n+6) {
        grid-column: span 1;
    }
}

@media (max-width: 480px) {
    .clock-display {
        font-size: 0.9rem;
    }
    
    .display-text {
        font-size: 1.5rem;
        min-height: 40px;
    }
    
    .formula-text {
        font-size: 0.9rem;
        min-height: 20px;
    }
    
    .btn {
        padding: 12px;
        font-size: 0.9rem;
    }
    
    .btn-scientific {
        padding: 10px 6px;
        font-size: 0.8rem;
    }
    
    .mode-btn {
        padding: 8px 15px;
        font-size: 0.8rem;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.calculator-container {
    animation: fadeIn 0.5s ease-out;
}

/* 错误状态样式 */
.error {
    color: #ff6b6b;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}
