html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden; /* 防止页面出现滚动条 */
}
body {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    font-family: 'Segoe UI', 'Microsoft YaHei', Arial, sans-serif;
    background-attachment: fixed;
}
.center-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    width: 100%;
    height: 100%;
    overflow: hidden; /* 防止center-box产生滚动条 */
    position: relative;
}
.clock-box {
    margin-top: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.time {
    font-size: 8rem;
    color: #fff;
    text-shadow: 0 2px 16px rgba(0,0,0,0.5);
    font-weight: bold;
    letter-spacing: 2px;
}
.date {
    font-size: 1.2rem;
    color: #fff;
    text-shadow: 0 1px 8px rgba(0,0,0,0.4);
    margin-top: 8px;
    font-weight: 400;
}
.search-bar {
    margin: 38px 0 32px 0;
    display: flex;
    align-items: center;
    gap: 0;
    width: 650px;
    max-width: 95vw;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
}
.search-bar select {
    border: none;
    background: transparent;
    font-size: 1rem;
    padding: 0 12px;
    height: 44px;
    outline: none;
    min-width: 60px;
    cursor: pointer;
    color: #333;
    font-weight: 500;
}
.search-bar input[type="text"] {
    flex: 1;
    border: none;
    font-size: 1.1rem;
    padding: 0 14px;
    height: 44px;
    outline: none;
    background: transparent;
}
.search-bar button {
    border: none;
    background: none;
    height: 44px;
    width: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}
.search-bar button:hover {
    background: #e6f0ff;
}
.search-bar svg {
    width: 22px;
    height: 22px;
    fill: #007bff;
}
.links-container {
    flex: 1;
    width: 100%;
    max-width: 1200px; /* 限制最大宽度 */
    overflow-y: auto; /* 垂直滚动 */
    overflow-x: hidden; /* 隐藏横向滚动 */
    padding: 0 20px;
    box-sizing: border-box;
    /* 美化滚动条 */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}
.links-container::-webkit-scrollbar {
    width: 8px;
}
.links-container::-webkit-scrollbar-track {
    background: transparent;
}
.links-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}
.links-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}
.links {
    display: flex;
    flex-wrap: wrap;
    gap: 22px;
    justify-content: center;
    margin-top: 18px;
    padding-bottom: 80px; /* 为添加按钮留出空间 */
}
.link-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: grab;
    transition: transform 0.3s ease, opacity 0.2s ease;
    position: relative;
}
.link-container:active {
    cursor: grabbing;
}
.link-container.dragging {
    opacity: 0.8;
    transform: scale(1.1) rotate(5deg);
    z-index: 1000;
    cursor: grabbing;
    transition: none;
    box-shadow: 0 8px 25px rgba(0,0,0,0.25);
}
.link-container.drag-placeholder {
    opacity: 0.3;
    transform: scale(0.8);
    pointer-events: none;
}
.link-container.shifting-left {
    transform: translateX(-74px);
}
.link-container.shifting-right {
    transform: translateX(74px);
}
.link-container.shifting-up {
    transform: translateY(-82px);
}
.link-container.shifting-down {
    transform: translateY(82px);
}
.link-item {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.92);
    border-radius: 18px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    font-size: 2rem;
    color: #333;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}
.link-item:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.link-item .icon-img {
    width: 70%;
    height: 70%;
    border-radius: 18px;
    object-fit: cover;
    background: none;
}
.link-item .icon-text {
    font-size: 2rem;
    font-weight: bold;
    color: #007bff;
    background: none;
    border-radius: 0;
    width: 70%;
    height: 70%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.link-name {
    font-size: 0.95rem;
    color: #fff;
    text-align: center;
    line-height: 1.1;
    max-width: 80px;
    word-wrap: break-word;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0);
    font-weight: 500;
}
.link-actions {
    display: none;
}
.context-menu {
    position: fixed;
    z-index: 2000;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.18);
    min-width: 100px;
    font-size: 1rem;
    display: none;
    flex-direction: column;
    padding: 6px 0;
}
.context-menu.active {
    display: flex;
}
.context-menu-item {
    padding: 8px 18px;
    cursor: pointer;
    color: #333;
    background: none;
    border: none;
    text-align: left;
    outline: none;
    transition: background 0.2s;
}
.context-menu-item:hover {
    background: #e6f0ff;
    color: #007bff;
}
.add-link-btn {
    position: fixed;
    bottom: 80px;
    background: none;
    border: none;
    cursor: pointer;
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    z-index: 90;
}
.add-link-btn:hover {
    transform: scale(1.05);
}
.add-link-btn svg {
    display: block;
}
.add-link-btn svg circle {
    fill: rgba(255,255,255,0.5);
    transition: fill 0.2s;
}
.add-link-btn svg rect {
    fill: #5a5a5a;
}
.add-link-btn:hover svg circle {
    fill: rgba(255,255,255,0.95);
}
.add-link-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0; top: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.35);
    justify-content: center;
    align-items: center;
}
.add-link-modal.active {
    display: flex;
}
.modal-content {
    background: rgba(255,255,255,0.70);
    border-radius: 16px;
    padding: 32px 28px 24px 28px;
    box-shadow: 0 8px 32px rgba(0,123,255,0.15);
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-width: 320px;
    position: relative;
    backdrop-filter: blur(10px);
    animation: modalFadeIn 0.3s ease-out;
}
@keyframes modalFadeIn {
    0% { transform: scale(0.9); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
.modal-content input, .modal-content label {
    padding: 12px 14px;
    border-radius: 8px;
    border: 1.5px solid #e1e8f0;
    outline: none;
    font-size: 1.05rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.modal-content input:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}
.modal-content input[type="file"] {
    border: none;
    padding: 8px 0;
    font-size: 0.95rem;
}
.modal-content button {
    padding: 12px 0;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: #fff;
    font-size: 1.05rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 3px 12px rgba(0,123,255,0.2);
}
.modal-content button:hover {
    background: linear-gradient(135deg, #0056b3 0%, #004494 100%);
    box-shadow: 0 5px 16px rgba(0,123,255,0.3);
    transform: translateY(-1px);
}
.close {
    position: absolute;
    right: 14px;
    top: 10px;
    font-size: 1.8rem;
    color: #aaa;
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
    font-weight: 300;
    line-height: 1;
}
.close:hover {
    color: #007bff;
    transform: scale(1.1);
}
.daily_sentences {
    width: 100%;
    margin: 0 auto;
    text-align: center;
    color: #fff;
    font-size: 1rem;
    padding: 5px 20px 5px 20px;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
}
.jinrishici-content {
    text-align: center;
    color: #fff;
    font-size: 1rem;
    padding: 5px 10px 5px 10px;
}
.jinrishici-info {
    text-align: center;
    color: #fff;
    font-size: 0.9rem;
    padding: 0px 10px 5px 10px;
}
.icp {
    width: 100%;
    margin: 0 auto;
    text-align: center;
    color: #fff;
    background: rgba(0,0,0,0.3);
    font-size: 0.95rem;
    padding: 3px 20px 3px 20px;
    letter-spacing: 1px;
    position: relative;
    border-radius: 0px;
}
.edit-link-modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0; top: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.35);
    justify-content: center;
    align-items: center;
}
.edit-link-modal.active {
    display: flex;
}
.edit-modal-content {
    background: #fff;
    border-radius: 10px;
    padding: 28px 24px 18px 24px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 260px;
    position: relative;
}
.edit-modal-content input, .edit-modal-content label {
    padding: 8px 10px;
    border-radius: 4px;
    border: 1px solid #ccc;
    outline: none;
    font-size: 1rem;
}
.edit-modal-content input[type="file"] {
    border: none;
    padding: 0;
}
.edit-modal-content button {
    padding: 8px 0;
    border-radius: 4px;
    border: none;
    background: #007bff;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}
.edit-modal-content button:hover {
    background: #0056b3;
}
.edit-close {
    position: absolute;
    right: 12px;
    top: 8px;
    font-size: 1.5rem;
    color: #888;
    cursor: pointer;
}
@media (max-width: 600px) {
    .clock-box { margin-top: 30px;}
    .time { font-size: 3rem; }
    .search-bar { margin-top: 20px; margin-bottom: 20px;}
    .links-container {
        max-width: 100%;
        padding: 0 10px;
        max-height: 50%;
    }
    .links {
        gap: 16px;
        padding-bottom: 120px; /* 增加底部间距，为移动端按钮留空间 */
    }
    .add-link-btn {
        bottom: 90px;
    }
    .link-container {
        gap: 6px;
        /* 移动端拖拽优化 */
        touch-action: none;
        user-select: none;
        transition: transform 0.25s ease, opacity 0.2s ease;
    }
    .link-container.dragging {
        opacity: 0.8;
        transform: scale(1.15) rotate(3deg);
        z-index: 1000;
        box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    }
    .link-container.drag-placeholder {
        opacity: 0.3;
        transform: scale(0.7);
    }
    .link-container.shifting-left {
        transform: translateX(-54px); /* 调整移动端的偏移距离 */
    }
    .link-container.shifting-right {
        transform: translateX(54px);
    }
    .link-container.shifting-up {
        transform: translateY(-62px);
    }
    .link-container.shifting-down {
        transform: translateY(62px);
    }
    .link-item { 
        font-size: 1rem; 
        width: 48px;
        height: 48px;
    }
    .link-item .icon-img {
        width: 70%;
        height: 70%;
        border-radius: 12px;
    }
    .link-item .icon-text {
        font-size: 1.6rem;
        width: 70%;
        height: 70%;
    }
    .link-name {
        font-size: 0.65rem;
        max-width: 60px;
        line-height: 1.0;
    }
    .daily_sentences {
        width: 90%;
        max-width: 350px;
        margin: 0 auto;
        padding: 12px 16px 8px 16px;
        position: fixed;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 50;
    }
    .icp {
        width: 100%;
        max-width: 400px;
        margin: 0 auto;
        padding: 12px 16px 8px 16px;
        position: fixed;
        bottom: 0;
        left: 50%;
        transform: translateX(-50%);
        z-index: 50;
    }
    /* 修复搜索栏按钮显示问题 */
    .search-bar {
        width: 350px;
        max-width: 85vw;
    }
    .search-bar input[type="text"] {
        flex: 1;
        min-width: 0;
        padding: 0 10px;
    }
    .search-bar button {
        width: 36px;
        height: 44px;
        min-width: 36px;
        flex-shrink: 0;
        padding: 0;
        margin: 0;
    }
    .search-bar svg {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }
    /* 修复搜索引擎选择器显示问题 */
    .search-bar select {
        min-width: 60px;
        max-width: 80px;
        padding: 0 8px;
        font-size: 0.9rem;
    }
    /* 手机端登录按钮调整 */
    #loginLogoutBtn .icon {
        width: 14px;
        height: 14px;
    }
}
/* 美化登录/退出按钮 */
#loginLogoutBtn {
    position: absolute;
    right: 24px;
    top: 24px;
    background: none;
    border: none;
    box-shadow: none;
    padding: 0;
    border-radius: 0;
    font-size: 1.15rem;
    cursor: pointer;
    z-index: 100;
    display: flex;
    align-items: center;
    color: #007bff;
    transition: none;
}
#loginLogoutBtn .icon {
    width: 20px;
    height: 20px;
    display: inline-block;
    vertical-align: middle;
}
#loginLogoutBtn .tooltip {
    display: block;
    position: absolute;
    left: 50%;
    top: 110%;
    transform: translateX(-50%) scale(0.95);
    background: rgba(30, 42, 80, 0.98);
    color: #fff;
    padding: 7px 18px;
    border-radius: 8px;
    font-size: 1.02rem;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0,0,0,0.13);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s, transform 0.18s;
    margin-top: 6px;
    font-weight: 400;
}
#loginLogoutBtn .tooltip::after {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 0 8px 8px 8px;
    border-style: solid;
    border-color: transparent transparent rgba(30,42,80,0.98) transparent;
}
#loginLogoutBtn:hover .tooltip {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) scale(1);
}
/* 美化登录/注册弹窗 */
.login-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0; top: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.25);
    justify-content: center;
    align-items: center;
}
.login-modal.active {
    display: flex;
}
.login-modal .modal-card {
    background: rgba(255,255,255,0.85); /* 半透明 */
    border-radius: 18px;
    padding: 38px 32px 28px 32px;
    box-shadow: 0 8px 32px rgba(0,123,255,0.13);
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-width: 300px;
    align-items: center;
    position: relative;
    animation: popIn 0.25s cubic-bezier(.4,2,.6,1) 1;
    backdrop-filter: blur(8px); /* 磨砂 */
}
@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
.login-modal h3 {
    margin: 0 0 8px 0;
    font-size: 1.35rem;
    font-weight: bold;
    color: #007bff;
    letter-spacing: 1px;
}
.login-modal input[type="text"],
.login-modal input[type="password"] {
    width: 220px;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1.5px solid #d0d7e2;
    font-size: 1.08rem;
    outline: none;
    margin-bottom: 2px;
    transition: border 0.2s;
}
.login-modal input[type="text"]:focus,
.login-modal input[type="password"]:focus {
    border: 1.5px solid #007bff;
}
.login-modal button {
    padding: 10px 0;
    border-radius: 8px;
    border: none;
    background: linear-gradient(90deg, #007bff 0%, #4f8cff 100%);
    color: #fff;
    font-size: 1.08rem;
    font-weight: 500;
    cursor: pointer;
    margin-top: 6px;
    margin-bottom: 2px;
    width: 100%;
    transition: background 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(0,123,255,0.08);
}
.login-modal button:hover {
    background: linear-gradient(90deg, #0056b3 0%, #007bff 100%);
}
.login-modal .switch-btn {
    background: none;
    color: #007bff;
    font-size: 1rem;
    font-weight: 400;
    box-shadow: none;
    margin-top: 0;
}
.login-modal .switch-btn:hover {
    background: #f0f6ff;
}
.login-modal .close-x {
    position: absolute;
    right: 18px;
    top: 12px;
    font-size: 1.7rem;
    color: #bbb;
    cursor: pointer;
    font-weight: bold;
    transition: color 0.2s, transform 0.2s;
}
.login-modal .close-x:hover {
    color: #007bff;
    transform: scale(1.18);
}
.login-modal .msg {
    color: #e74c3c;
    font-size: 0.98rem;
    min-height: 1.2em;
    margin-top: 2px;
    text-align: center;
}