/* 手机端头部和登录/注册/设置模态框样式 */

@media (max-width: 768px) {
    /* 手机端头部 - 两行布局 */
    .header {
        display: grid;
        grid-template-columns: auto 1fr;
        grid-template-rows: auto auto;
        padding: 10px 8px;
        gap: 8px;
        min-height: auto;
    }

    /* 第一行左侧：用户信息容器 */
    .user-info {
        position: static;
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 10px;
        grid-row: 1;
        grid-column: 1;
        justify-self: start;
    }

    .user-name {
        font-size: 10px;
        padding: 3px 8px;
        white-space: nowrap;
        max-width: 90px;
        overflow: hidden;
        text-overflow: ellipsis;
        flex-shrink: 1;
    }

    .btn-settings {
        font-size: 16px;
        padding: 3px 5px;
        flex-shrink: 0;
    }

    .btn-logout {
        font-size: 10px;
        padding: 3px 7px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* 第一行右侧：工具按钮容器 */
    .tool-buttons-container {
        position: static;
        display: flex;
        flex-direction: row;
        gap: 4px;
        flex-shrink: 0;
        grid-row: 1;
        grid-column: 2;
        justify-self: end;
        align-self: center;
    }

    .tool-btn {
        font-size: 16px;
        padding: 4px 6px;
        width: auto;
        min-width: auto;
        text-align: center;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 3px;
        border-radius: 6px;
        height: 32px;
    }

    .tool-btn .tool-btn-text {
        display: none;
    }

    /* 第二行：标题居中，跨越两列 */
    .header h1 {
        font-size: 20px;
        letter-spacing: 6px;
        margin: 0;
        text-align: center;
        grid-row: 2;
        grid-column: 1 / -1;
        width: 100%;
    }

    /* 手机端登录/注册/忘记密码模态框 */
    .auth-box {
        width: 92%;
        padding: 20px;
        margin: 5vh auto;
        max-height: 85vh;
    }

    #auth-title {
        font-size: 18px;
        margin-bottom: 18px;
    }

    .auth-form {
        gap: 12px;
    }

    .auth-form input {
        padding: 10px;
        font-size: 13px;
    }

    .auth-form .btn {
        padding: 10px;
        font-size: 14px;
        margin-top: 8px;
    }

    .auth-switch {
        margin-top: 12px;
        font-size: 12px;
    }

    /* 手机端设置模态框 */
    #settings-modal .auth-box h3 {
        font-size: 18px !important;
        margin-bottom: 15px !important;
        font-weight: 600 !important;
    }

    #settings-modal .settings-form {
        gap: 10px !important;
    }

    #settings-modal .settings-info {
        padding: 12px !important;
    }

    #settings-modal .info-item {
        padding: 8px 0 !important;
        gap: 10px !important;
        font-size: 13px !important;
        flex-wrap: nowrap !important;
        flex-direction: row !important;
        align-items: center !important;
    }

    #settings-modal .info-label {
        font-size: 13px !important;
        min-width: 55px !important;
        flex-shrink: 0 !important;
    }

    #settings-modal #settings-username,
    #settings-modal #settings-phone {
        font-size: 13px !important;
        flex: 1 !important;
        text-align: right !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    #settings-modal #settings-nickname {
        padding: 8px !important;
        font-size: 13px !important;
        flex: 1 !important;
        margin: 0 !important;
    }

    #settings-modal .info-item .btn-cyan {
        padding: 8px 12px !important;
        font-size: 12px !important;
        height: auto !important;
        white-space: nowrap !important;
        margin-left: 6px !important;
        margin-top: 0 !important;
        width: auto !important;
    }

    #settings-modal .cache-management-section {
        margin-top: 10px !important;
        padding: 12px !important;
    }

    #settings-modal .cache-management-section h4 {
        font-size: 13px !important;
        margin-bottom: 8px !important;
    }

    #settings-modal .cache-management-section p {
        font-size: 11px !important;
        margin-bottom: 8px !important;
        line-height: 1.4 !important;
    }

    #settings-modal .cache-management-section .btn-gold {
        padding: 10px !important;
        font-size: 14px !important;
        height: auto !important;
    }

    #settings-modal .change-password-section {
        padding: 12px !important;
        margin-top: 10px !important;
    }

    #settings-modal .change-password-section h4 {
        font-size: 14px !important;
        margin-bottom: 12px !important;
    }

    #settings-modal .change-password-section input {
        padding: 10px !important;
        font-size: 13px !important;
        margin-bottom: 10px !important;
    }

    #settings-modal .change-password-section .btn-gold {
        padding: 10px !important;
        font-size: 14px !important;
        margin-top: 0px !important;
        height: auto !important;
    }
}

/* 动态日历图标 - 手机端 */
@media (max-width: 768px) {
    .header-dynamic-icon {
        width: 24px;
        height: 24px;
        background: #f9f9f9;
        border-radius: 4px;
        border: 1px solid #bbb;
        display: inline-flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        overflow: hidden;
        box-shadow: 0 1px 2px rgba(0,0,0,0.15);
        vertical-align: middle;
        margin: 0;
        flex-shrink: 0;
    }

    .hdi-top {
        width: 100%;
        height: 7px;
        background: #e74c3c;
        flex-shrink: 0;
    }

    .hdi-num {
        font-size: 12px;
        font-weight: 700;
        color: #333;
        flex-grow: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
    }

    .tool-btn .header-dynamic-icon {
        margin: 0;
    }

    .modal-icon {
        transform: scale(1.15);
        margin-right: 6px;
    }

    /* 日期变更提示框 - 手机端 */
    .date-change-toast {
        top: 60px;
        padding: 10px 20px;
        font-size: 13px;
        border-radius: 20px;
    }
}
