html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    font-family: "Segoe UI", "Microsoft JhengHei", sans-serif;
}

body {
    background-image: url('/images/main-bg.jpg'), linear-gradient(120deg, #f8d9e8 0%, #f3d8ea 32%, #eddcf3 62%, #e6e7fb 100%);
    background-size: cover, cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow-x: hidden;
    position: relative;
}

    body::before,
    body::after {
        content: "";
        position: fixed;
        inset: -30%;
        pointer-events: none;
    }

    body::before {
        z-index: -2;
        background: radial-gradient(circle at 50% 45%, rgba(255,105,180,0.14) 0%, rgba(255,105,180,0.07) 18%, rgba(255,105,180,0.03) 32%, transparent 50%), radial-gradient(circle at 34% 62%, rgba(255,170,210,0.12) 0%, rgba(255,170,210,0.05) 22%, transparent 46%), radial-gradient(circle at 68% 34%, rgba(241,140,201,0.10) 0%, rgba(241,140,201,0.04) 20%, transparent 44%);
        filter: blur(150px);
        animation: pinkCloudMove 20s ease-in-out infinite alternate;
    }

    body::after {
        z-index: -1;
        background: radial-gradient(circle at 52% 50%, rgba(255, 215, 235, 0.46) 0%, rgba(255, 215, 235, 0.20) 18%, transparent 40%), radial-gradient(circle at 26% 30%, rgba(255, 180, 220, 0.22) 0%, rgba(255, 180, 220, 0.10) 18%, transparent 36%), radial-gradient(circle at 76% 70%, rgba(255, 185, 225, 0.22) 0%, rgba(255, 185, 225, 0.10) 18%, transparent 38%);
        filter: blur(150px);
        animation: pinkCloudMove2 28s ease-in-out infinite alternate;
    }

.home-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

/* 頂部 */
.topbar {
    height: 72px;
    background: rgba(255, 255, 255, 0.68);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 48px;
    box-sizing: border-box;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.logo {
    font-size: 34px;
    color: #7b4b63;
    font-weight: 500;
    letter-spacing: 2px;
}

.login-btn {
    border: 2px solid #000000;
    background: linear-gradient(135deg, #ffffff 0%, #f8edf4 100%);
    color: #6b5260;
    font-size: 16px;
    padding: 10px 20px;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(123, 75, 99, 0.10);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

    .login-btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 10px 22px rgba(123, 75, 99, 0.16);
        background: linear-gradient(135deg, #ffffff 0%, #f4e4ee 100%);
    }

/* 主區塊 */
.hero-section {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}

.empty-mode {
    min-height: calc(100vh - 72px);
}

.gallery-mode {
    min-height: calc(100vh - 72px);
    padding: 20px 0;
}

.center-box {
    text-align: center;
    padding: 20px;
}

.empty-text {
    color: #8a6f7d;
    font-size: 28px;
    margin: 0 0 22px 0;
}

.manage-btn {
    border: none;
    background: linear-gradient(135deg, #ff7eb6 0%, #f56cab 100%);
    color: #ffffff;
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 18px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 24px rgba(245, 108, 171, 0.28);
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

    .manage-btn:hover {
        background: linear-gradient(135deg, #ff6daa 0%, #ee5ca0 100%);
        box-shadow: 0 14px 30px rgba(245, 108, 171, 0.34);
    }

    .manage-btn:active {
        transform: scale(0.98);
    }

/* 照片牆 */
.photo-wall-section {
    width: 100%;
    overflow: hidden;
}

.centered-wall {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 18px;
}

.photo-row {
    width: 100%;
    overflow: hidden;
    position: relative;
}

.photo-track {
    display: flex;
    width: max-content;
    gap: 20px;
}

.row-left .photo-track {
    animation: scrollLeft 28s linear infinite;
}

.row-right .photo-track {
    animation: scrollRight 28s linear infinite;
}

.photo-row:hover .photo-track {
    animation-play-state: paused;
}

.photo-card {
    width: 260px;
    height: 160px;
    border-radius: 18px;
    overflow: hidden;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 10px 25px rgba(99, 54, 82, 0.12);
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease, outline 0.25s ease;
}

    .photo-card:hover {
        outline: 3px solid rgba(255, 255, 255, 0.96);
        transform: scale(1.03);
        box-shadow: 0 16px 36px rgba(99, 54, 82, 0.18);
    }

    .photo-card img,
    .preview-img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

    .photo-card.selected-for-delete {
        outline: 4px solid #ff3b57 !important;
        box-shadow: 0 0 0 4px rgba(255, 59, 87, 0.18), 0 16px 36px rgba(99, 54, 82, 0.18);
    }

        .photo-card.selected-for-delete:hover {
            outline: 4px solid #ff3b57 !important;
        }

.photo-row::before,
.photo-row::after {
    content: "";
    position: absolute;
    top: 0;
    width: 90px;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

.photo-row::before {
    left: 0;
    background: linear-gradient(to right, rgba(248, 217, 232, 0.98), rgba(248, 217, 232, 0));
}

.photo-row::after {
    right: 0;
    background: linear-gradient(to left, rgba(230, 231, 251, 0.98), rgba(230, 231, 251, 0));
}

/* 登入畫面 */
.hidden {
    display: none !important;
}

.login-view {
    min-height: calc(100vh - 72px);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 30px 20px;
    box-sizing: border-box;
}

.login-screen {
    width: 100%;
    max-width: 420px;
    min-height: 720px;
    border-radius: 28px;
    position: relative;
    overflow: hidden;
    background-image: url('/images/login-bg.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    box-shadow: 0 18px 40px rgba(60, 58, 90, 0.30);
}

.login-panel {
    position: absolute;
    inset: 0;
    color: #ffffff;
}

.moon {
    position: absolute;
    top: 26px;
    right: 26px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(255,255,255,0.88);
    box-shadow: 0 0 20px rgba(255,255,255,0.55);
}

.login-form {
    position: absolute;
    inset: 0;
}

/* 帳密與登入鍵置中 */
.form-center-group {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 78%;
    max-width: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.input-group {
    width: 100%;
    height: 42px;
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.94);
    border-radius: 999px;
    padding: 0 14px;
    box-sizing: border-box;
    margin-bottom: 14px;
    box-shadow: 0 8px 18px rgba(20, 40, 90, 0.10);
}

.input-icon {
    font-size: 14px;
    margin-right: 8px;
    opacity: 0.75;
}

.input-group input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    color: #4e5b73;
}

    .input-group input::placeholder {
        color: #9aa4b5;
    }

.login-submit {
    margin-top: 2px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, #ffffff 0%, #eef3ff 100%);
    color: #5870a9;
    font-weight: 700;
    padding: 10px 28px;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(20, 40, 90, 0.14);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

    .login-submit:hover {
        transform: translateY(-1px);
        box-shadow: 0 10px 22px rgba(20, 40, 90, 0.18);
    }

/* 底部資訊 */
.bottom-info {
    position: absolute;
    left: 50%;
    bottom: 42px;
    transform: translateX(-50%);
    width: 100%;
    text-align: center;
}

.welcome-title {
    font-size: 42px;
    font-weight: 800;
    letter-spacing: 3px;
    color: #ffffff;
    text-shadow: 0 4px 12px rgba(40, 55, 90, 0.28);
}

.welcome-subtitle {
    margin-top: 10px;
    font-size: 16px;
    color: rgba(255,255,255,0.92);
    text-shadow: 0 2px 8px rgba(40, 55, 90, 0.25);
}

.back-btn {
    margin-top: 22px;
    border: none;
    border-radius: 999px;
    padding: 10px 20px;
    font-size: 14px;
    cursor: pointer;
    background: rgba(255,255,255,0.95);
    color: #4d608d;
    box-shadow: 0 8px 18px rgba(20, 40, 90, 0.12);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

    .back-btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 10px 22px rgba(20, 40, 90, 0.18);
    }

/* 燈箱 */
.lightbox {
    display: none;
    position: fixed;
    z-index: 9999;
    inset: 0;
    background: rgba(27, 16, 24, 0.84);
    justify-content: center;
    align-items: center;
    padding: 30px;
    box-sizing: border-box;
}

    .lightbox.show {
        display: flex;
    }

.lightbox-content {
    max-width: 90vw;
    max-height: 88vh;
    border-radius: 16px;
    object-fit: contain;
    background: #ffffff;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.lightbox-close {
    position: absolute;
    top: 18px;
    right: 28px;
    font-size: 44px;
    color: #ffffff;
    cursor: pointer;
    user-select: none;
    line-height: 1;
}

@keyframes scrollLeft {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

@keyframes scrollRight {
    0% {
        transform: translateX(-50%);
    }

    100% {
        transform: translateX(0);
    }
}

@keyframes pinkCloudMove {
    0% {
        transform: translate3d(-2%, -2%, 0) scale(1);
    }

    50% {
        transform: translate3d(2%, 3%, 0) scale(1.10);
    }

    100% {
        transform: translate3d(-1%, 4%, 0) scale(1.05);
    }
}

@keyframes pinkCloudMove2 {
    0% {
        transform: translate3d(3%, -2%, 0) scale(1.04);
    }

    50% {
        transform: translate3d(-3%, 2%, 0) scale(1);
    }

    100% {
        transform: translate3d(2%, 4%, 0) scale(1.08);
    }
}

/* iPhone風格鎖屏 */
.lock-screen {
    position: fixed;
    inset: 0;
    background-image: url('/images/lock-bg.jpg');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #ffffff;
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.6s ease, opacity 0.6s ease;
}

    .lock-screen.hide {
        transform: translateY(-100%);
        opacity: 0;
        pointer-events: none;
    }

.lock-content {
    text-align: center;
}

.lock-title {
    font-size: 64px;
    font-weight: 800;
    color: #7b4b63;
    text-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

.lock-hint {
    font-size: 28px;
    font-weight: 700;
    color: #6a5563;
    margin-top: 40px;
    text-shadow: 0 2px 6px rgba(0,0,0,0.2);
    animation: lockHintMove 1.6s infinite;
}

@keyframes lockHintMove {
    0% {
        transform: translateY(0);
        opacity: 0.5;
    }

    50% {
        transform: translateY(-10px);
        opacity: 1;
    }

    100% {
        transform: translateY(0);
        opacity: 0.5;
    }
}

.logout-form {
    margin: 0;
}

.upload-panel {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    width: auto;
    margin: 0;
    pointer-events: auto;
}

.upload-btn {
    border: none;
    background: linear-gradient(135deg, #ffffff 0%, #f8edf4 100%);
    color: #6b5260;
    font-size: 18px;
    font-weight: 700;
    padding: 14px 28px;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(123, 75, 99, 0.14);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

    .upload-btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 14px 30px rgba(123, 75, 99, 0.18);
        background: linear-gradient(135deg, #ffffff 0%, #f4e4ee 100%);
    }

.delete-btn {
    border: none;
    background: linear-gradient(135deg, #fff0f2 0%, #ffd9df 100%);
    color: #a64657;
    font-size: 18px;
    font-weight: 700;
    padding: 14px 28px;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(166, 70, 87, 0.16);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

    .delete-btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 14px 30px rgba(166, 70, 87, 0.22);
        background: linear-gradient(135deg, #ffe7eb 0%, #ffc9d1 100%);
    }

    .delete-btn.delete-mode {
        background: linear-gradient(135deg, #ff5f77 0%, #e64561 100%);
        color: #ffffff;
        box-shadow: 0 10px 24px rgba(230, 69, 97, 0.26);
    }

#galleryView {
    position: relative;
}

@media (max-width: 768px) {
    .topbar {
        height: 64px;
        padding: 0 20px;
    }

    .logo {
        font-size: 26px;
    }

    .login-btn {
        font-size: 15px;
        padding: 9px 16px;
    }

    .photo-card {
        width: 180px;
        height: 120px;
        border-radius: 14px;
    }

    .photo-row::before,
    .photo-row::after {
        width: 40px;
    }

    .login-screen {
        min-height: 620px;
        max-width: 360px;
    }

    .form-center-group {
        top: 50%;
        width: 82%;
    }

    .welcome-title {
        font-size: 32px;
    }

    .welcome-subtitle {
        font-size: 14px;
    }

    .lightbox {
        padding: 16px;
    }

    .lightbox-close {
        top: 12px;
        right: 18px;
        font-size: 36px;
    }

    .upload-panel {
        gap: 10px;
        flex-wrap: wrap;
        width: calc(100% - 24px);
    }

    .upload-btn,
    .delete-btn {
        font-size: 15px;
        padding: 12px 20px;
    }
}
