/* 基础样式 */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #ffffff;
    color: #333;
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    background: #ffffff;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    border: 1px solid #e1e8ed;
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    margin: 0 0 10px 0;
    color: #2c3e50;
    font-size: 2.2em;
    font-weight: 600;
}

header p {
    color: #666;
    margin: 0;
    font-size: 1.1em;
}

/* 输入区域 */
.input-section {
    margin-bottom: 25px;
}

label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    color: #555;
}

.input-wrapper {
    position: relative;
}

textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    resize: vertical;
    min-height: 200px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.clear-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.clear-btn:hover {
    background: #c0392b;
    transform: scale(1.1);
}

/* 错误消息 */
.error-msg {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    background: #fee;
    color: #c0392b;
    border: 1px solid #f5c6cb;
}

.error-msg.show {
    opacity: 1;
    transform: translateY(0);
}

.error-msg.success {
    background: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

/* 按钮组 */
.button-group {
    text-align: center;
    margin-bottom: 30px;
}

.primary-btn {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.3);
}

.primary-btn:active {
    transform: translateY(0);
}

.btn-shortcut {
    font-size: 12px;
    opacity: 0.8;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
}

/* 结果区域 */
.result-section {
    display: none;
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-content {
    display: flex;
    gap: 20px;
}

.result-main {
    flex: 1;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.speed-section {
    background: #f0f7ff;
    padding: 20px;
    border-radius: 8px;
    min-width: 160px;
}

.speed-section h4 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 14px;
}

.speed-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e1e8ed;
}

.speed-item:last-child {
    border-bottom: none;
}

.speed-label {
    font-weight: 500;
    color: #666;
}

.speed-value {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: #3498db;
}

.result-main h3 {
    margin: 0 0 15px 0;
    color: #2c3e50;
}

.total-time {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.2em;
}

.duration {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
}

.copy-btn {
    background: #27ae60;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    background: #229954;
    transform: scale(1.05);
}

/* 统计信息 */
.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.stat-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.stat-label {
    display: block;
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 18px;
    font-weight: bold;
    color: #2c3e50;
}

/* 页脚 */
footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    font-size: 14px;
    color: #666;
}

footer a {
    color: #3498db;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    transition: color 0.2s ease;
}

.close:hover {
    color: #333;
}

.help-content h4 {
    color: #2c3e50;
    margin: 20px 0 10px 0;
}

.help-content ol, .help-content ul {
    padding-left: 20px;
}

.help-content code {
    background: #f4f4f4;
    padding: 10px;
    border-radius: 4px;
    display: block;
    margin: 10px 0;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    word-break: break-all;
}

.code-block {
    position: relative;
    margin: 15px 0;
}

.copy-code-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #3498db;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s ease;
}

.copy-code-btn:hover {
    background: #2980b9;
}

.tip {
    background: #e8f4fd;
    border-left: 4px solid #3498db;
    padding: 10px 15px;
    margin: 15px 0;
    border-radius: 0 4px 4px 0;
    font-size: 14px;
}

kbd {
    background: #f1f1f1;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 2px 6px;
    font-family: monospace;
    font-size: 12px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 20px;
    }
    
    h1 {
        font-size: 1.8em;
    }
    
    textarea {
        min-height: 150px;
        font-size: 13px;
    }
    
    .primary-btn {
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .btn-shortcut {
        display: none;
    }
    
    .total-time {
        flex-direction: column;
        gap: 8px;
    }
    
    .result-content {
        flex-direction: column;
    }
    
    .stats-section {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .modal-content {
        margin: 10% auto;
        padding: 20px;
        width: 95%;
        max-width: 550px;
    }
    
    .help-content code {
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 15px;
    }
    
    h1 {
        font-size: 1.6em;
    }
    
    .primary-btn {
        width: 100%;
        padding: 15px;
    }
    
    .total-time {
        font-size: 1em;
    }
    
    .stat-item {
        padding: 12px;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    }
    
    .container {
        background: rgba(44, 62, 80, 0.95);
        color: #ecf0f1;
    }
    
    h1, .result-main h3 {
        color: #ecf0f1;
    }
    
    textarea {
        background: #34495e;
        border-color: #4a6741;
        color: #ecf0f1;
    }
    
    textarea:focus {
        border-color: #3498db;
    }
    
    .result-main {
        background: #34495e;
    }
    
    .speed-section {
        background: #2a4a5e;
    }
    
    .speed-section h4 {
        color: #ecf0f1;
    }
    
    .speed-item {
        border-bottom-color: #4a6741;
    }
    
    .speed-label {
        color: #bdc3c7;
    }
    
    .stat-item {
        background: #34495e;
    }
    
    .stat-label {
        color: #bdc3c7;
    }
    
    .stat-value {
        color: #ecf0f1;
    }
    
    .modal-content {
        background: #2c3e50;
        color: #ecf0f1;
    }
    
    .help-content code {
        background: #34495e;
        color: #ecf0f1;
    }
    
    .tip {
        background: #2c3e50;
        border-left-color: #3498db;
        color: #ecf0f1;
    }
    
    kbd {
        background: #34495e;
        border-color: #4a6741;
        color: #ecf0f1;
    }
    
    .copy-code-btn {
        background: #3498db;
    }
    
    .copy-code-btn:hover {
        background: #2980b9;
    }
}
