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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #a8e6cf 0%, #88d8b0 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* 主布局容器 */
.main-wrapper {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    max-width: 1200px;
    width: 100%;
}

.container {
    background: white;
    padding: 20px 30px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 510px;
    width: 95%;
    height: 85vh;
    display: flex;
    flex-direction: column;
}

h1 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.8em;
}

/* 标签页样式 */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.tab {
    padding: 10px 20px;
    border: 2px solid #4CAF50;
    background: white;
    color: #4CAF50;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
}

.tab.active {
    background: #4CAF50;
    color: white;
}

.tab[data-mode="continuous"].active {
    background: linear-gradient(135deg, #4CAF50, #8BC34A);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

.tab:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

/* 倒计时显示 */
.timer-display {
    font-size: 70px;
    font-weight: bold;
    color: #333;
    margin: 15px 0;
    font-family: 'Courier New', monospace;
}

/* 控制按钮 */
.controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 25px;
}

.controls button {
    padding: 15px 30px;
    font-size: 18px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
}

#startBtn {
    background: #4CAF50;
    color: white;
}

#pauseBtn {
    background: #ff9800;
    color: white;
}

#resetBtn {
    background: #f44336;
    color: white;
}

.controls button:hover {
    transform: scale(1.05);
}

.controls button:active {
    transform: scale(0.95);
}

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

/* 设置区域 */
.settings {
    border-top: 2px solid #eee;
    padding-top: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 0;
}

.settings-row {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.settings label {
    color: #666;
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings input {
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 5px;
    width: 80px;
    text-align: center;
    font-size: 16px;
}

.settings select {
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    background: white;
}

.audio-setting {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: center;
}

.audio-label {
    margin: 0;
    white-space: nowrap;
}

.duration-label {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: 5px;
    white-space: nowrap;
}

.duration-input {
    padding: 5px;
    border: 2px solid #ddd;
    border-radius: 5px;
    width: 50px;
    text-align: center;
    font-size: 14px;
}

.btn-test {
    padding: 6px 15px;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-test:hover {
    background: #0b7dda;
    transform: scale(1.05);
}

#applySettings {
    margin-top: 8px;
    padding: 8px 8px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-size: 13px;
    display: inline-block;
    width: 100px;
    align-self: center;
    flex-shrink: 0;
}

#applySettings:hover {
    background: #45a049;
}

/* 预设选择器 */
.preset-selector {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    margin-bottom: 10px;
}

.preset-selector label {
    color: #666;
    font-size: 16px;
}

.preset-selector select {
    padding: 8px 15px;
    border: 2px solid #4CAF50;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    background: white;
    min-width: 150px;
}

.preset-selector select:hover {
    border-color: #45a049;
}

.btn-delete {
    padding: 8px 12px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
}

.btn-delete:hover {
    background: #da190b;
    transform: scale(1.05);
}

.default-preset-label {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #666;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}

.default-preset-label input {
    cursor: pointer;
}

/* 保存预设区域 */
.preset-save-row {
    background: #f5f5f5;
    padding: 8px;
    border-radius: 10px;
    margin-bottom: 8px;
}

.preset-name-label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.preset-name-label input {
    width: 150px;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.btn-save {
    padding: 8px 20px;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-save:hover {
    background: #0b7dda;
    transform: scale(1.05);
}

/* ========== 任务面板 ========== */
.task-panels {
    display: flex;
    flex-direction: row;
    gap: 15px;
}

.task-panel {
    background: white;
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
    height: 85vh;
    display: flex;
    flex-direction: column;
}

.task-panel:first-child {
    width: 360px;
}

.task-panel:last-child {
    width: 320px;
}

.task-panel h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.3em;
    text-align: center;
}

/* 任务表单 */
.task-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
}

.task-form label {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    color: #666;
    font-size: 13px;
    text-align: left;
}

.task-form label input,
.task-form label select {
    flex: 1;
}

/* 星期选择器 */
.weekday-selector {
    flex-direction: row !important;
    justify-content: center;
}

/* 音频设置行 */
.audio-settings-row {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.audio-settings-row label {
    display: flex;
    align-items: center;
    gap: 5px;
    flex: 1;
}

.audio-settings-row label span {
    white-space: nowrap;
}

.audio-settings-row label select,
.audio-settings-row label input {
    flex: 1;
}

.weekdays {
    display: flex;
    gap: 3px;
    flex-wrap: nowrap;
    width: 100%;
    justify-content: space-between;
}

.weekdays label {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px 6px;
    background: #f5f5f5;
    border-radius: 5px;
    cursor: pointer;
    font-size: 11px;
    color: #666;
    transition: all 0.2s;
    flex: 1;
    justify-content: center;
}

.weekdays label:hover {
    background: #e0e0e0;
}

.weekdays label input {
    width: auto;
    flex: none;
    cursor: pointer;
}

.weekdays label:has(input:checked) {
    background: #4CAF50;
    color: white;
}

.task-form input[type="text"] {
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
}

.task-form input[type="datetime-local"] {
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
}

.task-form select {
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    background: white;
}

.task-duration-input {
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
}

.btn-add-task {
    padding: 10px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s;
}

.btn-add-task:hover {
    background: #45a049;
    transform: scale(1.02);
}

/* 表单按钮组 */
.form-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn-cancel-edit {
    padding: 10px;
    background: #9e9e9e;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s;
    flex: 1;
}

.btn-cancel-edit:hover {
    background: #757575;
}

.btn-add-task.editing {
    background: #ff9800;
}

.btn-add-task.editing:hover {
    background: #f57c00;
}

.task-item.editing {
    background: #fff3e0;
    border-left-width: 6px;
}

/* 任务列表 */
.task-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.task-list::-webkit-scrollbar {
    width: 6px;
}

.task-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.task-list::-webkit-scrollbar-thumb {
    background: #4CAF50;
    border-radius: 3px;
}

.task-item {
    background: #f9f9f9;
    border-radius: 10px;
    padding: 12px;
    border-left: 4px solid #4CAF50;
    transition: all 0.3s;
}

.task-item.completed {
    border-left-color: #9e9e9e;
    opacity: 0.7;
}

.task-item.overdue {
    border-left-color: #f44336;
    background: #fff5f5;
}

.task-item.completed .task-title {
    text-decoration: line-through;
    color: #999;
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.task-title {
    font-weight: bold;
    color: #333;
    font-size: 14px;
    flex: 1;
    word-break: break-word;
}

.task-actions {
    display: flex;
    gap: 5px;
}

.btn-task-action {
    padding: 4px 8px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.btn-task-complete {
    background: #4CAF50;
    color: white;
}

.btn-task-complete:hover {
    background: #45a049;
}

.btn-task-edit {
    background: #2196F3;
    color: white;
}

.btn-task-edit:hover {
    background: #0b7dda;
}

.btn-task-delete {
    background: #f44336;
    color: white;
}

.btn-task-delete:hover {
    background: #da190b;
}

.task-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: #666;
}

.task-time {
    display: flex;
    align-items: center;
    gap: 5px;
}

.task-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: bold;
}

.task-status.pending {
    background: #fff3cd;
    color: #856404;
}

.task-status.completed {
    background: #d4edda;
    color: #155724;
}

.task-status.overdue {
    background: #f8d7da;
    color: #721c24;
}

.empty-tasks {
    text-align: center;
    color: #999;
    padding: 40px 20px;
    font-size: 14px;
}

/* ========== 任务弹窗 ========== */
.task-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.task-modal.show {
    display: flex;
}

.task-modal-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    min-width: 300px;
    max-width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.task-modal-content h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.task-modal-content p {
    color: #666;
    margin-bottom: 20px;
    font-size: 14px;
}

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

.btn-modal-complete,
.btn-modal-close {
    padding: 10px 20px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s;
}

.btn-modal-complete {
    background: #4CAF50;
    color: white;
}

.btn-modal-complete:hover {
    background: #45a049;
}

.btn-modal-close {
    background: #9e9e9e;
    color: white;
}

.btn-modal-close:hover {
    background: #757575;
}

/* 响应式 */
@media (max-width: 1200px) {
    .main-wrapper {
        flex-direction: column;
        align-items: center;
    }

    .task-panels {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 700px) {
    .task-panels {
        flex-direction: column;
    }

    .task-panel {
        width: 100%;
        max-width: 340px;
    }

    .container {
        height: auto;
        min-height: 50vh;
    }

    .task-panel {
        height: 60vh;
    }
}
