@charset "utf-8";

/* ========== 页面滚动布局（覆盖原版单屏定位） ========== */
section.section {
    position: relative;
    height: auto;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
}

main.main {
    height: auto;
    min-height: auto;
    background: none;
    align-items: center;
    padding-top: 1.5rem;
    padding-bottom: 0.75rem;
}

/* 首屏不再整体下移 40px，与右侧卡片同轴对齐，缩小与导航区块的间隙 */
.main-left {
    transform: none;
}

/* 首屏内容与下方导航/画廊之间、Logo 与 Hello World 之间的上下间距收紧 */
.message {
    margin-top: 2.5rem;
}

#page {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    padding: 0 1rem 1.5rem 1rem;
}

.block {
    margin-bottom: 1.75rem;
}

.block .line {
    margin-top: 0.75rem;
    margin-bottom: 0.9rem;
    position: relative;
}

/* 管理按钮 */
.btn-edit {
    margin-left: auto;
    border: none;
    outline: none;
    background: rgb(0 0 0 / 25%);
    backdrop-filter: blur(10px);
    color: #efefef;
    font-size: 0.9rem;
    padding: 0.35rem 0.9rem;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.3s;
}

.btn-edit:hover {
    background: rgb(0 0 0 / 40%);
    color: #ffffff;
}

/* ========== 网站导航 ========== */
.navs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.nav-card {
    position: relative;
    height: 96px;
    border-radius: 6px;
    background: rgb(0 0 0 / 25%);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}

.nav-card:hover {
    background: rgb(0 0 0 / 40%);
    transform: scale(1.03);
}

.nav-card i {
    font-size: 2rem;
    margin-bottom: 0.4rem;
}

.nav-card span {
    font-size: 0.95rem;
}

/* 编辑模式下卡片上的删除按钮 */
.nav-card .del,
.gallery-item .del {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    border-radius: 50%;
    background: #ef4f4f;
    color: #ffffff;
    font-size: 0.75rem;
    cursor: pointer;
    display: none;
    z-index: 5;
}

.navs.editing .del,
.gallery.editing .del {
    display: block;
}

/* ========== 图片画廊 ========== */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.9rem;
}

.gallery-item {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: rgb(0 0 0 / 25%);
    cursor: zoom-in;
    transition: 0.3s;
}

.gallery-item:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 24px rgb(0 0 0 / 40%);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 6px;
}

.gallery-item .gallery-mask {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 1.6rem 0.6rem 0.5rem 0.6rem;
    font-size: 0.85rem;
    background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.65));
    opacity: 0;
    transition: 0.3s;
}

.gallery-item:hover .gallery-mask {
    opacity: 1;
}

/* ========== 遮罩 / 弹窗 ========== */
.mask {
    display: none;
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgb(0 0 0 / 60%);
    backdrop-filter: blur(4px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 1rem;
}

.mask.show {
    display: flex;
}

.modal-box {
    width: 100%;
    max-width: 440px;
    background: rgb(0 0 0 / 45%);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    padding: 1.2rem 1.4rem;
    animation: fade 0.3s;
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.8rem;
}

.modal-title {
    font-size: 1.15rem;
}

.modal-close {
    cursor: pointer;
    font-size: 1.2rem;
}

.modal-close:hover {
    transform: scale(1.2);
}

.form-row {
    display: flex;
    align-items: center;
    margin-bottom: 0.8rem;
}

.form-row label {
    width: 80px;
    flex-shrink: 0;
    font-size: 0.95rem;
    color: #dddddd;
}

.form-row input,
.form-row select {
    flex: 1;
    min-width: 0;
    background: rgb(255 255 255 / 10%);
    border: 1px solid rgb(255 255 255 / 20%);
    color: #efefef;
    padding: 0.5rem 0.7rem;
    border-radius: 6px;
    outline: none;
    font-size: 0.95rem;
    transition: 0.3s;
}

.form-row input:focus,
.form-row select:focus {
    border-color: rgb(255 255 255 / 55%);
}

.form-row select option {
    color: #222222;
}

.form-row input[type="file"] {
    padding: 0.4rem;
}

.btn-save {
    width: 100%;
    margin-top: 0.2rem;
    border: none;
    outline: none;
    background: #efefef;
    color: #333333;
    font-size: 0.95rem;
    padding: 0.55rem;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.3s;
}

.btn-save:hover {
    background: #ffffff;
}

.modal-list {
    margin-top: 1.2rem;
    border-top: 1px dashed rgb(255 255 255 / 25%);
    padding-top: 0.8rem;
    max-height: 240px;
    overflow-y: auto;
}

.modal-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.2rem;
    border-bottom: 1px solid rgb(255 255 255 / 10%);
    font-size: 0.9rem;
}

.modal-item .item-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
}

.modal-item .item-info i {
    font-size: 1.1rem;
}

.modal-item .item-info img {
    width: 34px;
    height: 34px;
    object-fit: cover;
    border-radius: 4px;
}

.modal-item .item-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 220px;
}

.modal-item .item-del {
    color: #ff8f8f;
    cursor: pointer;
    flex-shrink: 0;
}

.modal-item .item-del:hover {
    color: #ef4f4f;
}

/* ========== 灯箱 ========== */
.mask.lightbox {
    background: rgb(0 0 0 / 85%);
    flex-direction: column;
    cursor: zoom-out;
}

#lightbox-img {
    max-width: 88%;
    max-height: 82vh;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgb(0 0 0 / 60%);
}

.lightbox-title {
    margin-top: 1rem;
    font-size: 1rem;
    color: #eeeeee;
}

.lightbox-close {
    position: fixed;
    right: 2rem;
    top: 1.5rem;
    font-size: 1.8rem;
    cursor: pointer;
}

.lightbox-close:hover {
    transform: scale(1.2);
}

/* ========== 页脚 ========== */
footer.footer {
    position: relative;
    bottom: auto;
    width: 100%;
    margin-top: 1.5rem;
    border-radius: 6px;
    padding-top: 0.6rem;
}

/* ========== 社交链接（位于一言/时间下方整行） ========== */
.socials-row {
    width: 100%;
    margin-top: 0.75rem;
}

.social.cards {
    width: 100%;
    height: auto;
    min-height: 66px;
    margin-top: 0;
    max-width: 100%;
    background: rgb(0 0 0 / 25%);
    backdrop-filter: blur(10px);
    padding: 12px 20px;
    border-radius: 6px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
}

.social-icons {
    display: flex;
    align-items: center;
    justify-content: center;
}

.social .link i {
    font-size: 1.75rem;
    margin: 0 10px;
    transition: 0.3s;
}

.social .link i:hover {
    transform: translateY(-4px);
    color: #ffffff;
    text-shadow: 0 4px 12px rgb(0 0 0 / 40%);
}

#link-text {
    display: block !important;
    flex: none;
    text-align: center;
    margin: 0 0 0 0.6rem;
    font-size: 0.95rem;
    color: #eeeeee;
}

/* ========== 一言卡片放大 ========== */
.hitokoto {
    height: 210px;
}

.hitokoto-text {
    font-size: 1.3rem;
}

#hitokoto_text {
    -webkit-line-clamp: 3;
}

/* ========== 背景管理按钮 ========== */
.bg-toggle {
    position: fixed;
    right: 1.4rem;
    bottom: 1.4rem;
    z-index: 999;
    width: 48px;
    height: 48px;
    border: none;
    outline: none;
    border-radius: 50%;
    background: rgb(0 0 0 / 30%);
    backdrop-filter: blur(10px);
    color: #efefef;
    font-size: 1.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}

.bg-toggle:hover {
    background: rgb(0 0 0 / 50%);
    transform: scale(1.1);
}

/* ========== 背景编辑弹窗 ========== */
.form-row-top {
    align-items: flex-start;
}

.form-row-top label {
    padding-top: 0.3rem;
}

.bg-picker {
    flex: 1;
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
    gap: 0.4rem;
    max-height: 132px;
    overflow-y: auto;
}

.bg-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: 0.25s;
    background: rgb(255 255 255 / 10%);
}

.bg-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.bg-thumb:hover {
    border-color: rgb(255 255 255 / 60%);
}

.bg-thumb.active {
    border-color: #efefef;
    box-shadow: 0 0 0 2px rgb(0 0 0 / 35%);
}

.btn-ghost {
    margin-top: 0.6rem;
    background: rgb(255 255 255 / 12%);
    color: #efefef;
}

.btn-ghost:hover {
    background: rgb(255 255 255 / 25%);
    color: #ffffff;
}

/* ========== 移动端适配 ========== */
@media (max-width: 992px) {
    main.main {
        min-height: auto;
    }

    .navs {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 0.8rem;
    }

    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.6rem;
    }
}

/* 小于 720px：右侧功能区改为纵向堆叠，避免被原版规则隐藏 */
@media (max-width: 720px) {
    .col.right {
        display: block !important;
        margin-left: 0;
        margin-top: 0.75rem;
    }

    .row.rightone {
        margin: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .col.hitokotos,
    .col.times {
        margin-left: 0;
        margin-right: 0;
    }

    .social.cards {
        padding: 12px 16px;
    }
}

@media (max-width: 600px) {
    #page {
        padding: 0 0.75rem 1.5rem 0.75rem;
    }

    .block .line {
        flex-wrap: wrap;
    }

    .btn-edit {
        font-size: 0.8rem;
        padding: 0.25rem 0.6rem;
    }

    .form-row label {
        width: 68px;
    }
}
