/* 嘉航作息表样式文件 */

/* 基础变量定义 */
:root {
    /* 主题色彩 */
    --primary-color: #FF6B6B;
    --secondary-color: #4ECDC4;
    --accent-color: #45B7D1;
    --success-color: #96CEB4;
    --warning-color: #FFEAA7;

    /* 功能颜色 */
    --sleep-color: #6C5CE7;
    --nap-color: #A29BFE;
    --meal-color: #FD79A8;
    --play-color: #FDCB6E;
    --care-color: #74B9FF;

    /* 中性色 */
    --text-dark: #2D3436;
    --text-gray: #636E72;
    --text-light: #B2BEC3;
    --bg-white: #FFFFFF;
    --bg-light: #F8F9FA;
    --border-color: #DDD6FE;

    /* 字体 */
    --font-family: "PingFang SC", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-size-base: 14px;
    --font-size-small: 12px;
    --font-size-large: 16px;

    /* 间距 */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;

    /* 圆角 */
    --border-radius: 8px;
    --border-radius-large: 12px;

    /* 阴影 */
    --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* 全局重置和基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'SimSun', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    padding: 5px;
    line-height: 1.6;
    margin: 0;
}

/* 主容器 */
.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* 头部样式 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    text-align: center;
    position: relative;
}

.standard-source {
    position: absolute;
    top: 8px;
    left: 15px;
    font-size: 0.75em;
    opacity: 0.8;
    color: white;
    font-weight: normal;
    line-height: 1.2;
    max-width: 120px;
    text-align: left;
    white-space: pre-line;
}

.header h1 {
    font-size: 2em;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.title-input {
    background: transparent;
    border: none;
    color: white;
    font-size: 2em;
    font-weight: bold;
    text-align: center;
    width: 100%;
    margin: 0;
    padding: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.title-input:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
}

.title-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.header p {
    font-size: 1.1em;
    opacity: 0.9;
}

.content {
    padding: 15px 20px;
}

/* 控制面板 */
.controls {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    border-left: 5px solid #667eea;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
    color: #333;
}

.form-group input {
    width: 200px;
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* 说明区域 */
.instructions {
    background: #e3f2fd;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    border-left: 5px solid #2196f3;
}

.instructions h3 {
    color: #1976d2;
    margin-bottom: 8px;
    font-size: 1.1em;
}

.instructions ol {
    padding-left: 18px;
    margin: 0;
}

.instructions li {
    margin-bottom: 4px;
    color: #333;
    font-size: 0.9em;
}

.reference-schedule {
    background: #fff3e0;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    border-left: 5px solid #ff9800;
}

.reference-schedule h3 {
    color: #f57c00;
    margin-bottom: 15px;
}

.schedule-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.schedule-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #ffcc02;
}

.schedule-time {
    font-weight: bold;
    color: #e65100;
    font-size: 1.1em;
}

.schedule-activity {
    color: #333;
    margin-top: 5px;
}

/* 表格样式 */
.table-container {
    overflow-x: auto;
    margin-top: 10px;
    margin-bottom: 10px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

#scheduleTable {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 12px;
    border: 2px solid #333;
}

#scheduleTable th,
#scheduleTable td {
    border: 1px solid #ddd;
    padding: 4px;
    text-align: center;
    vertical-align: middle;
}

/* 统一内部边框样式 */
#scheduleTable th:not(:first-child),
#scheduleTable td:not(:first-child) {
    border-left: 1px solid #ddd;
}

#scheduleTable tr:not(:first-child) th,
#scheduleTable tr:not(:first-child) td {
    border-top: 1px solid #ddd;
}

/* 顶部边框保持粗线 */
#scheduleTable thead tr:first-child th {
    border-top: none;
}

/* 左边框保持粗线 */
#scheduleTable th:first-child,
#scheduleTable td:first-child {
    border-left: none;
}

/* 统一内部边框样式 */
#scheduleTable th:not(:first-child),
#scheduleTable td:not(:first-child) {
    border-left: 1px solid #ddd;
}

#scheduleTable tr:not(:first-child) th,
#scheduleTable tr:not(:first-child) td {
    border-top: 1px solid #ddd;
}

/* 顶部边框保持粗线 */
#scheduleTable thead tr:first-child th {
    border-top: none;
}

/* 左边框保持粗线 */
#scheduleTable th:first-child,
#scheduleTable td:first-child {
    border-left: none;
}

#scheduleTable th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: bold;
    font-size: 11px;
    position: sticky;
    top: 0;
    z-index: 10;
}

#scheduleTable tr:nth-child(even) {
    background-color: #f8f9fa;
}

#scheduleTable tr:hover {
    background-color: #e3f2fd;
}

/* 第一列（夏季时间）特殊样式 */
#scheduleTable td:first-child,
#scheduleTable th:first-child {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    font-weight: bold;
    width: 45px;
    min-width: 45px;
    font-size: 7px;
}

/* 第二列（冬季时间）特殊样式 */
#scheduleTable td:nth-child(2),
#scheduleTable th:nth-child(2) {
    background: linear-gradient(135deg, #9c27b0 0%, #673ab7 100%);
    color: white;
    font-weight: bold;
    width: 45px;
    min-width: 45px;
    font-size: 7px;
    text-align: center;
}

/* 第三列（标准作息）特殊样式 */
#scheduleTable td:nth-child(3),
#scheduleTable th:nth-child(3) {
    background: #fff3e0 !important;
    color: #e65100 !important;
    font-weight: bold;
    font-size: 8px;
    width: 50px;
    min-width: 50px;
    text-align: center !important;
}

/* 日期列样式 */
#scheduleTable td:nth-child(n+4),
#scheduleTable th:nth-child(n+4) {
    width: 28px;
    min-width: 26px;
    font-size: 10px;
}

/* 预览模式样式 */
.print-preview {
    background: white !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

.print-preview .controls,
.print-preview .instructions,
.print-preview .reference-schedule,
.print-preview .saved-records,
.print-preview .table-tools {
    display: none !important;
}

.print-preview .header {
    background: white !important;
    color: #333 !important;
    padding: 20px 5px 5px 5px !important;
    text-align: center;
    border-bottom: 2px solid #333;
    position: relative;
}

.print-preview .standard-source {
    color: #666 !important;
    font-size: 0.7em !important;
    position: absolute !important;
    top: 2px !important;
    left: 5px !important;
    max-width: 120px !important;
    max-height: 25px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    line-height: 1.1 !important;
    white-space: pre-line !important;
    text-align: left !important;
}

.print-preview .header h1 {
    font-size: 1.3em !important;
    margin: 0 !important;
    color: #333 !important;
    text-shadow: none !important;
}

.print-preview .title-input {
    font-size: 1.3em !important;
    margin: 0 !important;
    color: #333 !important;
    text-shadow: none !important;
    background: transparent !important;
    border: none !important;
    outline: none !important;
}

.print-preview .content {
    padding: 0 !important;
}

.print-preview .table-container {
    box-shadow: none !important;
    border-radius: 0 !important;
    margin-top: 0 !important;
}

.print-preview #scheduleTable {
    font-size: 8px !important;
    width: 100% !important;
}

.print-preview #scheduleTable th,
.print-preview #scheduleTable td {
    padding: 3px 1px !important;
    height: 30px !important;
    min-height: 30px !important;
    max-height: 30px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    line-height: 1.0 !important;
    white-space: nowrap !important;
}

.print-preview #scheduleTable td:first-child,
.print-preview #scheduleTable th:first-child {
    width: 35px !important;
    font-size: 6px !important;
}

.print-preview #scheduleTable td:nth-child(2),
.print-preview #scheduleTable th:nth-child(2) {
    width: 35px !important;
    font-size: 6px !important;
    text-align: center !important;
}

.print-preview #scheduleTable td:nth-child(3),
.print-preview #scheduleTable th:nth-child(3) {
    width: 40px !important;
    font-size: 6px !important;
    text-align: center !important;
}

.print-preview #scheduleTable td:nth-child(n+4),
.print-preview #scheduleTable th:nth-child(n+4) {
    width: 22px !important;
    min-width: 20px !important;
    font-size: 7px !important;
}

/* 预览模式的育儿建议样式 */
.print-preview .parenting-tips {
    margin-top: 3px !important;
    padding: 3px 0 !important;
}

/* 移除预览模式的h3样式 */

.print-preview .tips-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 2px !important;
    margin-bottom: 0 !important;
}

.print-preview .tip-card {
    background: #f9f9f9 !important;
    border: 1px solid #ddd !important;
    border-radius: 1px !important;
    padding: 2px !important;
    box-shadow: none !important;
    text-align: center !important;
}

.print-preview .tip-card h4 {
    font-size: 6px !important;
    margin-bottom: 1px !important;
    color: #333 !important;
    font-weight: bold !important;
}

.print-preview .tip-card p {
    font-size: 5px !important;
    line-height: 1.0 !important;
    color: #555 !important;
    margin: 0 !important;
    white-space: pre-line !important;
}

/* 育儿建议区域 */
.parenting-tips {
    margin-top: 2px;
    padding: 2px 0;
}

.tips-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 3px;
    margin-bottom: 0;
}

.tip-card {
    background: white;
    padding: 3px;
    border: 1px solid #ddd;
    border-radius: 2px;
    text-align: center;
}

.tip-card h4 {
    color: #333;
    margin-bottom: 1px;
    font-size: 8px;
    font-weight: bold;
}

.tip-card p {
    color: #555;
    line-height: 1.1;
    font-size: 6px;
    margin: 0;
    white-space: pre-line;
}

/* 隐藏类 */
.hidden {
    display: none !important;
}

/* 弹窗样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease-out;
}

.modal-header {
    padding: 25px 30px 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px 20px 0 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5em;
    font-weight: bold;
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.modal-body {
    padding: 30px;
}

.guide-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 15px;
    border-left: 5px solid #667eea;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.guide-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.guide-item:last-child {
    margin-bottom: 0;
}

.guide-icon {
    font-size: 2.5em;
    margin-right: 20px;
    flex-shrink: 0;
}

.guide-text h3 {
    margin: 0 0 8px 0;
    color: #333;
    font-size: 1.2em;
    font-weight: bold;
}

.guide-text p {
    margin: 0;
    color: #666;
    line-height: 1.6;
    font-size: 0.95em;
}

.modal-footer {
    padding: 20px 30px 30px;
    text-align: center;
}

.modal-footer .btn {
    padding: 12px 30px;
    font-size: 1.1em;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

/* 弹窗动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 打印样式 */
@media print {
    @page {
        size: A4 landscape;
        margin: 0.5cm;
    }

    body {
        background: white !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .container {
        box-shadow: none !important;
        border-radius: 0 !important;
        margin: 0 !important;
        max-width: none !important;
    }

    .controls,
    .instructions,
    .reference-schedule,
    .saved-records,
    .table-tools {
        display: none !important;
    }

    .header {
        background: white !important;
        color: #333 !important;
        padding: 20px 5px 5px 5px !important;
        text-align: center;
        border-bottom: 2px solid #333;
        position: relative;
    }

    .standard-source {
        color: #666 !important;
        font-size: 0.7em !important;
        position: absolute !important;
        top: 2px !important;
        left: 5px !important;
        max-width: 120px !important;
        max-height: 25px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        line-height: 1.1 !important;
        white-space: pre-line !important;
        text-align: left !important;
    }

    .header h1 {
        font-size: 1.1em !important;
        margin: 0 !important;
        color: #333 !important;
        text-shadow: none !important;
    }

    .title-input {
        font-size: 1.1em !important;
        margin: 0 !important;
        color: #333 !important;
        text-shadow: none !important;
        background: transparent !important;
        border: none !important;
        outline: none !important;
    }

    .content {
        padding: 0 !important;
    }

    .table-container {
        box-shadow: none !important;
        border-radius: 0 !important;
        margin-top: 0 !important;
    }

    #scheduleTable {
        font-size: 7px !important;
        page-break-inside: auto;
        width: 100% !important;
    }

    #scheduleTable th,
    #scheduleTable td {
        padding: 2px 1px !important;
        border: 1px solid #333 !important;
        min-height: 20px !important;
        max-height: 20px !important;
        height: 20px !important;
        vertical-align: middle;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        line-height: 1.0 !important;
        font-size: 6px !important;
        white-space: nowrap !important;
    }

    #scheduleTable th {
        background: #f0f0f0 !important;
        color: #333 !important;
        font-weight: bold;
    }

    #scheduleTable td:first-child,
    #scheduleTable th:first-child {
        background: #f0f0f0 !important;
        color: #333 !important;
        width: 30px !important;
        font-size: 5px !important;
    }

    #scheduleTable td:nth-child(2),
    #scheduleTable th:nth-child(2) {
        background: #f0f0f0 !important;
        color: #333 !important;
        width: 30px !important;
        font-size: 5px !important;
        text-align: center !important;
    }

    #scheduleTable td:nth-child(3),
    #scheduleTable th:nth-child(3) {
        background: #f8f8f8 !important;
        color: #333 !important;
        width: 35px !important;
        font-size: 5px !important;
        text-align: center !important;
    }

    #scheduleTable td:nth-child(n+4),
    #scheduleTable th:nth-child(n+4) {
        width: calc((100% - 95px) / 31) !important;
        min-width: 16px !important;
        font-size: 6px !important;
    }

    /* 打印时的育儿建议样式 */
    .parenting-tips {
        page-break-inside: avoid;
        margin-top: 2px !important;
        padding: 2px 0 !important;
    }

    /* 移除打印模式的h3样式 */

    .tips-grid {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 1px !important;
        margin-bottom: 0 !important;
    }

    .tip-card {
        background: white !important;
        border: 1px solid #333 !important;
        border-radius: 1px !important;
        padding: 2px !important;
        box-shadow: none !important;
        page-break-inside: avoid;
        text-align: center !important;
    }

    .tip-card h4 {
        font-size: 5px !important;
        margin-bottom: 1px !important;
        color: #333 !important;
        font-weight: bold !important;
    }

    .tip-card p {
        font-size: 4px !important;
        line-height: 1.1 !important;
        color: #333 !important;
        margin: 0 !important;
        white-space: pre-line !important;
    }

    /* 合并单元格在打印模式下的特殊处理 */
    .merged-cell {
        white-space: pre-line !important;
        overflow: hidden !important;
        max-height: 40px !important;
        font-size: 5px !important;
        line-height: 1.1 !important;
        text-overflow: ellipsis !important;
    }

    /* 预览模式下的合并单元格 */
    .print-preview .merged-cell {
        white-space: pre-line !important;
        overflow: hidden !important;
        max-height: 60px !important;
        font-size: 7px !important;
        line-height: 1.1 !important;
        text-overflow: ellipsis !important;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 5px;
    }

    .container {
        border-radius: 10px;
        margin: 0;
    }

    .header {
        padding: 12px;
    }

    .header h1 {
        font-size: 1.6em;
    }

    .title-input {
        font-size: 1.6em;
    }

    .standard-source {
        font-size: 0.65em;
        top: 6px;
        left: 10px;
    }

    .content {
        padding: 12px;
    }

    .controls {
        padding: 12px;
        margin-bottom: 12px;
    }

    .button-group {
        flex-direction: column;
        gap: 8px;
    }

    .btn {
        width: 100%;
        margin-bottom: 0;
        padding: 14px 20px;
        font-size: 16px;
        min-height: 48px;
        /* 符合移动端最小触摸区域 */
        border-radius: 8px;
    }

    .instructions {
        padding: 10px;
        margin-bottom: 10px;
    }

    .instructions h3 {
        font-size: 1.1em;
    }

    .instructions li {
        font-size: 0.9em;
        line-height: 1.4;
    }

    .reference-schedule {
        padding: 10px;
        margin-bottom: 10px;
    }

    .reference-schedule h3 {
        font-size: 1.1em;
        margin-bottom: 10px;
    }

    .schedule-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .schedule-item {
        padding: 10px;
    }

    .schedule-time {
        font-size: 1em;
    }

    /* 表格容器优化 */
    .table-container {
        position: relative;
        margin-bottom: 15px;
    }

    /* 添加横向滚动提示 */
    .table-container::before {
        content: '← 左右滑动查看更多日期 →';
        display: block;
        text-align: center;
        color: #666;
        font-size: 12px;
        padding: 8px;
        background: #f0f8ff;
        border: 1px solid #ddeeff;
        border-radius: 5px;
        margin-bottom: 5px;
    }

    #scheduleTable {
        font-size: 11px;
        min-width: 1000px;
        /* 确保表格有足够宽度 */
    }

    #scheduleTable th,
    #scheduleTable td {
        padding: 8px 4px;
        min-height: 40px;
        height: 40px;
    }

    /* 优化可编辑单元格在移动端的体验 */
    #scheduleTable td[contenteditable="true"]:focus {
        transform: scale(1.05);
        z-index: 10;
        position: relative;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    /* 第一列和第二列在小屏幕上的特殊处理 */
    #scheduleTable td:first-child,
    #scheduleTable th:first-child {
        font-size: 7px;
        width: 35px;
        min-width: 35px;
    }

    #scheduleTable td:nth-child(2),
    #scheduleTable th:nth-child(2) {
        font-size: 7px;
        width: 35px;
        min-width: 35px;
    }

    #scheduleTable td:nth-child(3),
    #scheduleTable th:nth-child(3) {
        font-size: 7px;
        width: 40px;
        min-width: 40px;
    }

    /* 日期列在小屏幕上的优化 */
    #scheduleTable td:nth-child(n+4),
    #scheduleTable th:nth-child(n+4) {
        width: 24px;
        min-width: 22px;
        font-size: 8px;
    }

    .tips-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }

    .tip-card {
        padding: 8px;
        border-radius: 6px;
    }

    .tip-card h4 {
        font-size: 0.7em;
        margin-bottom: 3px;
    }

    .tip-card p {
        font-size: 0.6em;
        line-height: 1.2;
    }
}

/* 中等手机屏幕适配 (480px - 768px) */
@media (max-width: 480px) {
    body {
        padding: 3px;
    }

    .container {
        border-radius: 5px;
    }

    .header {
        padding: 10px;
    }

    .header h1 {
        font-size: 1.4em;
    }

    .title-input {
        font-size: 1.4em;
    }

    .standard-source {
        position: static;
        display: block;
        text-align: center;
        margin-bottom: 5px;
        font-size: 0.7em;
    }

    .content {
        padding: 8px;
    }

    .controls {
        padding: 10px;
    }

    .btn {
        padding: 16px 20px;
        font-size: 15px;
        min-height: 50px;
    }

    .instructions {
        padding: 8px;
    }

    .instructions h3 {
        font-size: 1em;
    }

    .instructions ol {
        padding-left: 15px;
    }

    .instructions li {
        font-size: 0.85em;
        margin-bottom: 3px;
    }

    .reference-schedule {
        padding: 8px;
    }

    .reference-schedule h3 {
        font-size: 1em;
        margin-bottom: 8px;
    }

    .reference-schedule p {
        font-size: 0.85em;
    }

    .schedule-item {
        padding: 8px;
    }

    .schedule-time {
        font-size: 0.9em;
    }

    .schedule-activity {
        font-size: 0.85em;
    }

    #scheduleTable {
        font-size: 10px;
    }

    #scheduleTable th,
    #scheduleTable td {
        padding: 6px 2px;
        min-height: 35px;
        height: 35px;
    }

    /* 第一列和第二列在小屏幕上的特殊处理 */
    #scheduleTable td:first-child,
    #scheduleTable th:first-child {
        font-size: 7px;
        width: 35px;
        min-width: 35px;
    }

    #scheduleTable td:nth-child(2),
    #scheduleTable th:nth-child(2) {
        font-size: 7px;
        width: 35px;
        min-width: 35px;
    }

    #scheduleTable td:nth-child(3),
    #scheduleTable th:nth-child(3) {
        font-size: 7px;
        width: 40px;
        min-width: 40px;
    }

    /* 日期列在小屏幕上的优化 */
    #scheduleTable td:nth-child(n+4),
    #scheduleTable th:nth-child(n+4) {
        width: 24px;
        min-width: 22px;
        font-size: 8px;
    }

    .parenting-tips {
        margin-top: 15px;
        padding: 8px 0;
    }

    .tip-card {
        padding: 10px;
    }

    .tip-card h4 {
        font-size: 0.9em;
        margin-bottom: 4px;
    }

    .tip-card p {
        font-size: 0.8em;
        line-height: 1.2;
    }
}

/* 小手机屏幕适配 (320px - 480px) */
@media (max-width: 320px) {
    .header h1 {
        font-size: 1.2em;
    }

    .title-input {
        font-size: 1.2em;
    }

    .btn {
        font-size: 14px;
        padding: 14px 16px;
    }

    .instructions li {
        font-size: 0.8em;
    }

    .reference-schedule h3 {
        font-size: 0.9em;
    }

    .reference-schedule p {
        font-size: 0.8em;
    }

    #scheduleTable {
        font-size: 9px;
        min-width: 950px;
        /* 在最小屏幕上仍保持表格可用性 */
    }

    #scheduleTable th,
    #scheduleTable td {
        padding: 4px 1px;
        min-height: 32px;
        height: 32px;
    }

    #scheduleTable td:first-child,
    #scheduleTable th:first-child {
        font-size: 7px;
        width: 35px;
        min-width: 35px;
    }

    #scheduleTable td:nth-child(2),
    #scheduleTable th:nth-child(2) {
        font-size: 7px;
        width: 35px;
        min-width: 35px;
    }

    #scheduleTable td:nth-child(3),
    #scheduleTable th:nth-child(3) {
        font-size: 7px;
        width: 40px;
        min-width: 40px;
    }

    #scheduleTable td:nth-child(n+4),
    #scheduleTable th:nth-child(n+4) {
        width: 24px;
        min-width: 22px;
        font-size: 8px;
    }

    .tip-card h4 {
        font-size: 0.55em;
    }

    .tip-card p {
        font-size: 0.45em;
    }
}

/* 移动端触摸优化 */
@media (max-width: 768px) {

    /* 改善触摸体验 */
    #scheduleTable td[contenteditable="true"] {
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(33, 150, 243, 0.3);
    }

    /* 焦点状态优化 */
    #scheduleTable td[contenteditable="true"]:focus {
        outline: 3px solid #2196f3;
        outline-offset: 2px;
        background-color: #e3f2fd !important;
    }

    /* 时间和标准作息列的触摸优化 */
    #scheduleTable td:first-child,
    #scheduleTable td:nth-child(2),
    #scheduleTable td:nth-child(3) {
        min-height: 45px;
    }

    /* 避免双击缩放 */
    .table-container {
        touch-action: pan-x pan-y;
    }

    /* 滚动条样式 */
    .table-container::-webkit-scrollbar {
        height: 8px;
    }

    .table-container::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 4px;
    }

    .table-container::-webkit-scrollbar-thumb {
        background: #c1c1c1;
        border-radius: 4px;
    }

    .table-container::-webkit-scrollbar-thumb:hover {
        background: #a8a8a8;
    }
}

/* 弹窗在移动端的优化 */
@media (max-width: 768px) {
    .modal-content {
        margin: 15px;
        width: calc(100% - 30px);
        max-height: 85vh;
        border-radius: 15px;
    }

    .modal-header {
        padding: 18px 20px 12px;
    }

    .modal-header h2 {
        font-size: 1.2em;
    }

    .modal-close {
        width: 32px;
        height: 32px;
        font-size: 20px;
    }

    .modal-body {
        padding: 20px;
    }

    .guide-item {
        padding: 12px;
        margin-bottom: 15px;
        border-radius: 10px;
    }

    .guide-icon {
        font-size: 1.8em;
        margin-right: 12px;
    }

    .guide-text h3 {
        font-size: 1em;
        margin-bottom: 5px;
    }

    .guide-text p {
        font-size: 0.85em;
        line-height: 1.4;
    }

    .modal-footer {
        padding: 12px 20px 20px;
    }

    .modal-footer .btn {
        width: 100%;
        padding: 14px 20px;
        font-size: 1em;
        min-height: 48px;
    }
}

@media (max-width: 480px) {
    .modal-content {
        margin: 10px;
        width: calc(100% - 20px);
        max-height: 90vh;
        border-radius: 12px;
    }

    .modal-header {
        padding: 15px 18px 10px;
    }

    .modal-header h2 {
        font-size: 1.1em;
    }

    .modal-body {
        padding: 18px;
    }

    .guide-item {
        padding: 10px;
        margin-bottom: 12px;
    }

    .guide-icon {
        font-size: 1.6em;
        margin-right: 10px;
    }

    .guide-text h3 {
        font-size: 0.95em;
    }

    .guide-text p {
        font-size: 0.8em;
    }

    .modal-footer {
        padding: 10px 18px 18px;
    }
}

/* 加载动画 */
.loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #667eea;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* 新增功能样式 */

/* 表格操作工具栏 */
.table-tools {
    background: #f0f8ff;
    padding: 10px;
    border-radius: 8px;
    border-left: 5px solid #4ECDC4;
}

.btn-tool {
    background: linear-gradient(135deg, #2E7D32 0%, #1B5E20 100%);
    color: white;
    padding: 8px 16px;
    font-size: 12px;
    margin-right: 8px;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-tool:hover {
    background: linear-gradient(135deg, #388E3C 0%, #2E7D32 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.btn-tool:disabled {
    background: linear-gradient(135deg, #9E9E9E 0%, #757575 100%);
    cursor: not-allowed;
    opacity: 0.8;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
    transform: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
    background: linear-gradient(135deg, #FF6B6B 0%, #EE5A24 100%);
    color: white;
}

/* 单元格选择状态 */
.cell-selected {
    background: rgba(33, 150, 243, 0.3) !important;
    border: 2px solid #2196f3 !important;
    box-shadow: inset 0 0 0 1px #2196f3;
}

.cell-selecting {
    background: rgba(33, 150, 243, 0.15) !important;
    border: 1px dashed #2196f3 !important;
}

/* 合并单元格样式 */
.merged-cell {
    background: linear-gradient(135deg, #e8f5e8 0%, #c8e6c9 100%) !important;
    border: 2px solid #4caf50 !important;
    font-weight: bold;
    text-align: center;
    vertical-align: middle;
}

/* 选择信息显示 */
.selection-info {
    margin-top: 8px;
    font-size: 12px;
    color: #666;
    font-style: italic;
}

/* 保存记录区域 */
.saved-records {
    background: #fff8e1;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    border-left: 5px solid #ffc107;
}

.saved-records h3 {
    color: #f57c00;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.records-list {
    max-height: 200px;
    overflow-y: auto;
}

.record-item {
    background: white;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.record-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.record-info {
    flex: 1;
}

.record-title {
    font-weight: bold;
    color: #333;
    margin-bottom: 2px;
    cursor: pointer;
    border: none;
    background: transparent;
    font-size: 14px;
    width: 100%;
    text-align: left;
}

.record-title:focus {
    background: #e3f2fd;
    outline: 2px solid #2196f3;
    border-radius: 4px;
}

.record-date {
    font-size: 12px;
    color: #666;
}

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

.btn-small {
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-load {
    background: #4caf50;
    color: white;
}

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

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

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

.no-records {
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 20px;
}

/* 可编辑来源样式 */
.editable-source {
    border-bottom: 1px dashed #f57c00;
    cursor: text;
    transition: all 0.3s ease;
}

.editable-source:hover {
    background: rgba(245, 124, 0, 0.1);
}

.editable-source:focus {
    background: #e3f2fd;
    outline: 2px solid #2196f3;
    border-radius: 4px;
    border-bottom: 1px solid #2196f3;
}

/* 头部区域的可编辑来源特殊样式 */
.header .editable-source:focus {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    outline: 2px solid #fff;
    border-radius: 4px;
    padding: 2px 4px;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .table-tools {
        padding: 8px;
    }

    .btn-tool {
        padding: 6px 12px;
        font-size: 11px;
        margin-right: 4px;
        margin-bottom: 4px;
    }

    .record-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .record-actions {
        margin-top: 8px;
        width: 100%;
        justify-content: flex-end;
    }

    .saved-records {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .button-group {
        flex-direction: column;
    }

    .btn-tool {
        width: 100%;
        margin-right: 0;
    }
}