.section-shell {
    --app-bg-overlay: linear-gradient(180deg, #fde8f2 0%, #eee2ff 46%, #dbe2ff 100%);
}

.section-main {
    flex: 1;
    padding: 26px;
    display: grid;
    gap: 16px;
    grid-template-rows: auto 1fr;
}

.section-title {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    color: #6f2d87;
    text-shadow: 0 2px 0 rgba(255, 255, 255, 0.8);
}

.section-card {
    background: rgba(255, 255, 255, 0.55);
    border: 2px solid rgba(255, 255, 255, 0.75);
    border-radius: 16px;
    box-shadow: 0 14px 28px rgba(42, 55, 123, 0.2);
    backdrop-filter: blur(5px);
    padding: 18px;
}

.placeholder-list {
    list-style: none;
    display: grid;
    gap: 10px;
    color: #32438a;
}

.placeholder-list li {
    background: linear-gradient(120deg, rgba(241, 118, 172, 0.2), rgba(157, 101, 233, 0.2));
    border-radius: 10px;
    padding: 10px 12px;
}

/* Gallery Main & Layout */
.section-main.gallery-main {
    flex: 1;
    padding: 16px 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
    min-height: 0;
}

.gallery-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 14px;
    height: 100%;
    min-height: 0;
    position: relative;
    background: rgba(255, 255, 255, 0.62);
    border: 2px solid rgba(255, 255, 255, 0.85);
    border-radius: 18px;
    box-shadow: 0 16px 32px rgba(42, 55, 123, 0.18);
}

.collage-table {
    position: relative;
    flex: 1;
    width: 100%;
    height: 100%;
    min-height: 480px;
    border-radius: 14px;
    background: radial-gradient(circle at 50% 35%, rgba(255, 245, 235, 0.5), rgba(210, 165, 130, 0.28) 60%, rgba(160, 110, 80, 0.35)),
                linear-gradient(140deg, rgba(220, 175, 135, 0.25), rgba(160, 115, 85, 0.3));
    border: 2px dashed rgba(255, 255, 255, 0.7);
    overflow: hidden;
    isolation: isolate;
    touch-action: none;
    user-select: none;
}

.collage-photo {
    position: absolute;
    width: clamp(140px, 16vw, 210px);
    aspect-ratio: 4/5;
    border-radius: 10px;
    border: 8px solid #fcfcff;
    background-color: #f8f8ff; 
    background-image: linear-gradient(120deg, rgba(255, 255, 255, 0.4), rgba(230, 225, 255, 0.3));
    background-size: cover;
    background-position: center;
    box-shadow: 0 12px 24px rgba(55, 41, 89, 0.26);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 10px;
    font-size: 0.9rem;
    font-weight: 700;
    color: #5a4f90;
    user-select: none;
    cursor: grab;
    touch-action: none;
    --rot: 0deg;
    animation: tileFloat 4.5s ease-in-out infinite;
    transition: box-shadow 180ms ease, transform 180ms ease;
}

.collage-photo:hover {
    box-shadow: 0 16px 32px rgba(55, 41, 89, 0.34);
    transform: translateY(-4px) scale(1.025) rotate(var(--rot));
    z-index: 25;
}

.collage-photo.is-dragging {
    cursor: grabbing !important;
    box-shadow: 0 28px 50px rgba(35, 20, 65, 0.45);
    transform: scale(1.07) rotate(var(--rot)) !important;
    animation: none !important;
    transition: transform 0.05s ease, box-shadow 0.15s ease;
    z-index: 1000 !important;
}

.p1 { left: 6%; top: 10%; --rot: -7deg; z-index: 2; }
.p2 { left: 23%; top: 8%; --rot: 6deg; z-index: 3; }
.p3 { left: 41%; top: 16%; --rot: -4deg; z-index: 4; }
.p4 { left: 59%; top: 9%; --rot: 9deg; z-index: 3; }
.p5 { left: 16%; top: 52%; --rot: 5deg; z-index: 5; }
.p6 { left: 42%; top: 50%; --rot: -8deg; z-index: 2; }
.p7 { left: 68%; top: 46%; --rot: 4deg; z-index: 4; }

.collage-photo:nth-child(2n) { animation-delay: 0.6s; }
.collage-photo:nth-child(3n) { animation-delay: 1.2s; }

@keyframes tileFloat {
    0%, 100% { transform: translateY(0) rotate(var(--rot)); }
    50% { transform: translateY(-4px) rotate(var(--rot)); }
}

.photos-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.photos-head-left {
    display: flex;
    align-items: baseline;
    gap: 16px;
    flex-wrap: wrap;
}

.gallery-hint {
    font-size: 0.92rem;
    color: #5d4f82;
    background: rgba(255, 255, 255, 0.7);
    padding: 6px 14px;
    border-radius: 999px;
    box-shadow: 0 2px 8px rgba(90, 70, 130, 0.1);
}

.photos-head-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.gallery-tool-btn {
    border: none;
    color: #4b3d75;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.95);
    border-radius: 999px;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(82, 63, 145, 0.15);
    transition: transform 0.2s ease, background 0.2s ease;
}

.gallery-tool-btn:hover {
    background: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(82, 63, 145, 0.22);
}

.photos-back-btn {
    text-decoration: none;
    color: #fff;
    background: linear-gradient(120deg, #f176ac, #9d65e9);
    border-radius: 999px;
    padding: 9px 18px;
    font-size: 0.92rem;
    font-weight: 700;
    box-shadow: 0 6px 14px rgba(82, 63, 145, 0.22);
    transition: transform 0.2s ease;
}

.photos-back-btn:hover {
    transform: translateY(-2px);
}

.photo-tile {
    cursor: grab;
    background-color: #fff;
    background-position: center !important;
    background-size: cover !important;
    background-repeat: no-repeat !important;
    border: 8px solid #f8f8ff;
    overflow: hidden;
}

.photo-tile span {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 6px;
    padding: 4px 10px;
    font-weight: 700;
}

.photo-overlay {
    position: absolute;
    inset: 0;
    background: rgba(25, 14, 38, 0.65);
    backdrop-filter: blur(5px);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 26px;
}

.photo-overlay[hidden] {
    display: none !important;
}

#picked-photo-host {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.picked-photo {
    position: absolute !important;
    pointer-events: auto;
    width: min(380px, 75vw);
    aspect-ratio: 4/5;
    border-radius: 12px;
    border: 10px solid #ffffff;
    box-shadow: 0 28px 60px rgba(0, 0, 0, 0.45);
    overflow: visible;
    z-index: 100;
    animation: none;
    opacity: 0;
    cursor: grab;
    touch-action: none;
    transform: rotate(var(--rot, 0deg)) scale(0.85);
    transition: transform 260ms cubic-bezier(0.2, 0.8, 0.3, 1.2), opacity 220ms ease;
}

.picked-photo.is-dragging {
    cursor: grabbing !important;
    transition: none !important;
}

.picked-photo.is-open {
    opacity: 1;
    transform: rotate(var(--rot, 0deg)) scale(1.2);
}

.picked-photo.is-closing {
    opacity: 0;
    transform: rotate(var(--rot, 0deg)) scale(0.9);
}

.picked-photo-close {
    position: absolute;
    right: -14px;
    top: -14px;
    border: 0;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(120deg, #f176ac, #9d65e9);
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 110;
    transition: transform 0.2s ease;
}

.picked-photo-close:hover {
    transform: scale(1.1);
}

/* Diary */
.diary-card {
    position: relative;
    overflow: hidden;
}

#flowers-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

#flowers-layer .corner-flower {
    position: absolute;
    width: 24px;
    height: 24px;
    opacity: 0.72;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.14));
}

.diary-view {
    position: relative;
    z-index: 1;
}

.diary-view[hidden] {
    display: none !important;
}

.diary-view.is-popping {
    animation: popIn 260ms ease-out;
}

.diary-view.is-closing {
    animation: popOut 200ms ease-in forwards;
}

.diary-list-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 10px;
}

.diary-helper {
    color: #43568f;
    font-size: 0.94rem;
}

.corner-add-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    z-index: 2;
    background: linear-gradient(120deg, #ff5ea8, #ff7fc8 45%, #b96dff);
    box-shadow: 0 8px 18px rgba(242, 79, 156, 0.28);
}

.diary-btn {
    border: 0;
    border-radius: 10px;
    background: linear-gradient(125deg, #f176ac, #9d65e9);
    color: #fff;
    font-weight: 700;
    padding: 9px 13px;
    cursor: pointer;
}

.add-entry-form {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    padding: 10px;
}

.add-entry-form input,
.add-entry-form textarea {
    border: 1px solid rgba(143, 99, 190, 0.35);
    border-radius: 8px;
    padding: 8px 10px;
    resize: vertical;
    font: inherit;
    color: #34457f;
}

.entries-list {
    list-style: none;
    display: grid;
    gap: 10px;
    margin-top: 56px;
    padding-right: 118px;
}

.entry-item {
    background: linear-gradient(120deg, rgba(255, 255, 255, 0.75), rgba(245, 235, 255, 0.72));
    border-radius: 12px;
    padding: 12px 16px;
    color: #32438a;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.85);
    box-shadow: 0 4px 10px rgba(80, 50, 120, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.entry-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(80, 50, 120, 0.15);
    background: #ffffff;
}

.entry-info {
    flex: 1;
    min-width: 0;
}

.entry-item strong {
    display: block;
    margin-bottom: 4px;
    font-size: 1rem;
    color: #4b3d75;
}

.entry-item small {
    opacity: 0.82;
    color: #6c5d95;
    font-size: 0.85rem;
}

.entry-delete-btn {
    background: transparent;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 8px;
    opacity: 0.6;
    transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.entry-delete-btn:hover {
    opacity: 1;
    background: rgba(241, 118, 172, 0.2);
    transform: scale(1.15);
}

.diary-detail-view {
    position: absolute;
    inset: 22px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-radius: 18px;
    overflow: hidden;
    border: 6px solid #ff87bf;
    box-shadow: 0 14px 30px rgba(99, 37, 88, 0.3);
    background: linear-gradient(180deg, rgba(255, 230, 242, 0.97), rgba(255, 215, 236, 0.96));
}

.add-entry-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(520px, calc(100% - 44px));
    transform: translate(-50%, -50%);
    border-radius: 18px;
    overflow: hidden;
    border: 6px solid #ff87bf;
    box-shadow: 0 14px 30px rgba(99, 37, 88, 0.3);
    background: linear-gradient(180deg, rgba(255, 230, 242, 0.97), rgba(255, 215, 236, 0.96));
}

#diary-list-view.is-dimmed {
    opacity: 0.35;
    filter: blur(1.5px);
    pointer-events: none;
}

.window-strip {
    background: linear-gradient(90deg, #ff5ea8 0%, #f176ac 45%, #9d65e9 100%);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 7px 12px;
    font-size: 0.9rem;
    font-weight: 700;
}

.window-close {
    margin-left: auto;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
}

.diary-paper {
    background: linear-gradient(180deg, #ffdce9 0%, #ffe9f5 100%);
    padding: 16px;
    color: #5f3e71;
    border-top: 2px solid rgba(241, 118, 172, 0.45);
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.diary-paper h2 {
    margin-bottom: 12px;
    color: #454868;
}

.detail-back-btn {
    margin-bottom: 12px;
    padding: 7px 12px;
    font-size: 0.86rem;
}

.popup-form {
    margin: 0;
    border-radius: 0;
    border: 0;
    padding: 14px;
    background: linear-gradient(180deg, #ffdce9 0%, #ffe9f5 100%);
}

.detail-body p {
    margin-bottom: 12px;
    line-height: 1.32;
}

.camera-photo-row {
    display: flex;
    gap: 12px;
    margin: 8px 0 12px;
    flex-wrap: wrap;
}

.camera-photo {
    width: min(140px, 42%);
    background: #fff;
    border: 1px solid #d5d6e2;
    border-radius: 6px;
    box-shadow: 0 7px 14px rgba(55, 48, 79, 0.22);
    padding: 6px 6px 10px;
    transform: rotate(var(--tilt, 0deg));
}

.camera-photo img {
    width: 100%;
    height: 92px;
    object-fit: cover;
    border-radius: 4px;
    display: block;
}

.camera-photo span {
    display: block;
    margin-top: 6px;
    text-align: center;
    font-size: 0.73rem;
    color: #5f5f6b;
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes popOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(8px) scale(0.97);
    }
}
