/* Locket Gallery — Our Little Universe */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800;900&family=Playfair+Display:ital,wght@0,600;0,700;1,600&display=swap');

:root {
    --ink: #30213e;
    --muted: #756782;
    --midnight: #201735;
    --violet: #765bd0;
    --lilac: #b9a6f6;
    --pink: #ff91b4;
    --blush: #ffd1df;
    --peach: #ffc59d;
    --cream: #fff9f2;
    --mint: #a8e4db;
    --glass: rgba(255, 255, 255, 0.64);
    --glass-strong: rgba(255, 255, 255, 0.84);
    --line: rgba(255, 255, 255, 0.82);
    --shadow: 0 20px 55px rgba(46, 29, 82, 0.18);
    --shadow-lift: 0 28px 68px rgba(44, 25, 84, 0.3);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--midnight); }

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    color: var(--ink);
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 16px;
    line-height: 1.5;
    background:
        radial-gradient(circle at 12% 12%, rgba(255, 215, 230, .92) 0 5%, transparent 28%),
        radial-gradient(circle at 88% 8%, rgba(183, 212, 255, .74) 0 4%, transparent 27%),
        radial-gradient(circle at 88% 91%, rgba(255, 195, 151, .7) 0 5%, transparent 28%),
        radial-gradient(circle at 16% 90%, rgba(167, 232, 217, .66) 0 4%, transparent 25%),
        linear-gradient(145deg, #e8dcff 0%, #fff0f5 47%, #ffead9 100%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

body::before,
body::after {
    position: fixed;
    z-index: 0;
    display: block;
    pointer-events: none;
    content: '';
}

body::before {
    inset: 0;
    opacity: .58;
    background-image: radial-gradient(rgba(255, 255, 255, .95) 1px, transparent 1.5px);
    background-size: 33px 33px;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .65), transparent 78%);
}

body::after {
    width: 30rem;
    height: 30rem;
    right: -13rem;
    top: 14vh;
    border-radius: 50%;
    filter: blur(1px);
    background: radial-gradient(circle, rgba(255, 255, 255, .9), rgba(255, 181, 210, .4) 34%, transparent 70%);
    animation: moonDrift 15s ease-in-out infinite alternate;
}

@keyframes moonDrift {
    to { transform: translate(-3rem, 2rem) scale(1.08); }
}

button,
input,
select,
textarea { font: inherit; }

button { border: 0; cursor: pointer; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(118, 91, 208, .42);
    outline-offset: 3px;
}

.space-dust,
.space-orbit,
.space-orbit::after {
    position: fixed;
    z-index: 0;
    pointer-events: none;
}

.space-dust {
    inset: 0;
    overflow: hidden;
    background:
        radial-gradient(circle at 10% 31%, #fff 0 2px, transparent 3px),
        radial-gradient(circle at 25% 76%, #fff6f9 0 2px, transparent 3px),
        radial-gradient(circle at 76% 24%, #fff 0 2px, transparent 3px),
        radial-gradient(circle at 62% 72%, #fff 0 1.5px, transparent 3px),
        radial-gradient(circle at 44% 13%, #fff 0 1.5px, transparent 3px);
    opacity: .82;
    animation: twinkle 5s ease-in-out infinite alternate;
}

.space-orbit {
    width: min(75vw, 58rem);
    height: min(75vw, 58rem);
    left: -27rem;
    bottom: -40rem;
    border: 1px solid rgba(255, 255, 255, .5);
    border-radius: 50%;
    transform: rotate(-24deg);
}

.space-orbit::after {
    width: 2.25rem;
    height: 2.25rem;
    top: 7%;
    right: 16%;
    border-radius: 50%;
    content: '✦';
    color: #fff;
    font-size: 1.25rem;
    line-height: 2.25rem;
    text-align: center;
    background: linear-gradient(135deg, #ff9bbd, #b798ff);
    box-shadow: 0 8px 20px rgba(103, 67, 168, .28);
    animation: orbitSparkle 12s linear infinite;
}

@keyframes twinkle { to { opacity: .42; transform: scale(1.03); } }
@keyframes orbitSparkle { to { transform: rotate(360deg) translateX(1rem) rotate(-360deg); } }

/* Welcome */
.welcome-popup {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(47, 28, 79, .35);
    backdrop-filter: blur(14px);
}

.welcome-popup.fade-out { animation: fadeOut .5s ease forwards; }

.welcome-content {
    position: relative;
    width: min(100%, 27rem);
    overflow: hidden;
    padding: 3.1rem 2rem 2.5rem;
    text-align: center;
    border: 1px solid var(--line);
    border-radius: 2.25rem;
    background: linear-gradient(145deg, rgba(255, 255, 255, .95), rgba(255, 238, 247, .83));
    box-shadow: 0 32px 90px rgba(38, 18, 72, .38), inset 0 1px 0 #fff;
    animation: popIn .6s cubic-bezier(.2, 1.4, .4, 1) both;
}

.welcome-content::before,
.welcome-content::after {
    position: absolute;
    color: rgba(182, 141, 237, .28);
    font-size: 6rem;
    content: '✦';
}

.welcome-content::before { top: -1.8rem; left: -1.4rem; }
.welcome-content::after { right: -1.5rem; bottom: -2.4rem; color: rgba(255, 145, 180, .25); }

.welcome-icon {
    position: relative;
    z-index: 1;
    display: grid;
    width: 5.25rem;
    height: 5.25rem;
    margin: 0 auto 1rem;
    place-items: center;
    border-radius: 1.7rem;
    font-size: 2.35rem;
    background: linear-gradient(145deg, #ffd4e1, #c9b8ff);
    box-shadow: 0 13px 0 #bca8ec, 0 20px 35px rgba(93, 59, 153, .25);
    transform: rotate(-7deg);
}

.welcome-title,
.welcome-message,
.welcome-hearts { position: relative; z-index: 1; }
.welcome-title { margin: 0; color: var(--ink); font-size: 1.65rem; font-weight: 900; }
.welcome-message { margin: .45rem 0 1.2rem; color: var(--muted); font-weight: 700; }
.welcome-hearts { display: flex; justify-content: center; gap: .65rem; font-size: 1.35rem; }
.welcome-hearts span { animation: heartBob 1.8s ease-in-out infinite; }
.welcome-hearts span:nth-child(2) { animation-delay: .22s; }
.welcome-hearts span:nth-child(3) { animation-delay: .44s; }

@keyframes popIn { from { opacity: 0; transform: translateY(1.6rem) rotateX(-15deg) scale(.86); } }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes heartBob { 50% { transform: translateY(-.35rem) rotate(8deg); } }

/* Lock screen */
.password-screen {
    position: relative;
    z-index: 1;
    display: grid;
    min-height: 100vh;
    padding: 1.5rem;
    overflow: hidden;
    place-items: center;
}

.password-screen::before,
.password-screen::after {
    position: absolute;
    z-index: -1;
    border-radius: 50%;
    content: '';
    filter: blur(2px);
}

.password-screen::before {
    width: 18rem;
    height: 18rem;
    top: 7%;
    left: 7%;
    background: linear-gradient(135deg, rgba(255, 161, 194, .8), rgba(255, 255, 255, .15));
    animation: floatOrb 9s ease-in-out infinite alternate;
}

.password-screen::after {
    width: 13rem;
    height: 13rem;
    right: 10%;
    bottom: 8%;
    background: linear-gradient(135deg, rgba(128, 105, 214, .7), rgba(255, 255, 255, .2));
    animation: floatOrb 10s 1s ease-in-out infinite alternate-reverse;
}

.password-container {
    width: min(100%, 28rem);
    padding: clamp(2rem, 7vw, 3.75rem);
    text-align: center;
    border: 1px solid rgba(255, 255, 255, .86);
    border-radius: 2.5rem;
    background: linear-gradient(155deg, rgba(255, 255, 255, .76), rgba(255, 246, 250, .53));
    box-shadow: var(--shadow-lift), inset 0 1px 0 #fff;
    backdrop-filter: blur(22px);
    transform-style: preserve-3d;
    animation: entrance .7s cubic-bezier(.2, .85, .3, 1.2) both;
}

.password-icon {
    display: grid;
    width: 5.8rem;
    height: 5.8rem;
    margin: 0 auto 1.6rem;
    place-items: center;
    border: .4rem solid rgba(255, 255, 255, .7);
    border-radius: 2rem;
    font-size: 2.8rem;
    background: conic-gradient(from 210deg, var(--pink), #c9b7ff, var(--mint), var(--pink));
    box-shadow: 0 14px 0 rgba(112, 79, 170, .28), 0 25px 40px rgba(89, 60, 145, .26);
    transform: translateZ(2.5rem) rotate(-8deg);
    animation: iconFloat 4s ease-in-out infinite;
}

.password-container h2 {
    margin: 0;
    color: var(--ink);
    font-family: 'Playfair Display', Georgia, serif;
    font-size: clamp(1.9rem, 7vw, 2.55rem);
    line-height: 1.12;
}

.password-container p { margin: .9rem 0 1.7rem; color: var(--muted); font-weight: 800; }

.password-input-group { position: relative; }
.password-input-group::before {
    position: absolute;
    z-index: 1;
    top: 50%;
    left: 1.1rem;
    color: var(--violet);
    font-size: 1rem;
    content: '✦';
    transform: translateY(-50%);
}

.password-input,
#qualitySelect,
#authorInput,
#messageInput {
    width: 100%;
    border: 1px solid rgba(123, 91, 185, .16) !important;
    color: var(--ink) !important;
    background: rgba(255, 255, 255, .74) !important;
    box-shadow: inset 0 1px 4px rgba(80, 47, 134, .07);
}

.password-input {
    height: 3.85rem;
    padding: 0 1.15rem 0 2.65rem;
    border-radius: 1.2rem;
    font-weight: 800;
}

.password-input::placeholder { color: #aa9db5; }

.password-btn {
    position: relative;
    width: 100%;
    min-height: 3.6rem;
    margin-top: 1rem;
    overflow: hidden;
    border-radius: 1.2rem;
    color: #fff;
    font-weight: 900;
    letter-spacing: .02em;
    background: linear-gradient(135deg, #765bd0, #a86ee5 54%, #e67fae);
    box-shadow: 0 8px 0 #6044ac, 0 16px 27px rgba(98, 61, 165, .28);
    transition: transform .2s ease, box-shadow .2s ease;
}

.password-btn:hover { transform: translateY(-3px); box-shadow: 0 11px 0 #6044ac, 0 20px 31px rgba(98, 61, 165, .32); }
.password-btn:active { transform: translateY(5px); box-shadow: 0 3px 0 #6044ac; }
.error-message { display: none; color: #d9547d !important; font-size: .9rem; }

@keyframes entrance { from { opacity: 0; transform: translateY(2rem) rotateX(-10deg) scale(.94); } }
@keyframes iconFloat { 50% { transform: translateZ(2.5rem) translateY(-.5rem) rotate(3deg); } }
@keyframes floatOrb { to { transform: translate(2.4rem, 1.6rem) scale(1.1); } }

/* App shell */
.app-container {
    position: relative;
    z-index: 1;
    display: none;
    width: min(100% - 2.5rem, 84rem);
    margin: 0 auto;
    padding: 1.35rem 0 4rem;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.45rem;
    padding: 1rem 1.15rem 1rem 1.35rem;
    border: 1px solid var(--line);
    border-radius: 1.55rem;
    background: rgba(255, 255, 255, .57);
    box-shadow: 0 14px 40px rgba(53, 35, 95, .14), inset 0 1px 0 #fff;
    backdrop-filter: blur(18px);
}

.app-title { display: flex; min-width: 0; align-items: center; gap: .8rem; }
.app-title .icon {
    display: grid;
    flex: 0 0 auto;
    width: 2.85rem;
    height: 2.85rem;
    place-items: center;
    border-radius: 1rem;
    font-size: 1.45rem;
    background: linear-gradient(145deg, #fbd3e3, #c8bdff);
    box-shadow: 0 5px 0 rgba(103, 77, 161, .23);
    transform: rotate(-7deg);
}

.app-title h1 {
    overflow: hidden;
    margin: 0;
    color: var(--ink);
    font-family: 'Playfair Display', Georgia, serif;
    font-size: clamp(1.3rem, 3vw, 1.7rem);
    line-height: 1.1;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.header-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-height: 2.7rem;
    padding: .6rem .82rem;
    border: 1px solid rgba(117, 91, 172, .12);
    border-radius: .9rem;
    color: #504065;
    font-size: .86rem;
    font-weight: 900;
    white-space: nowrap;
    background: rgba(255, 255, 255, .75);
    box-shadow: 0 4px 0 rgba(105, 79, 151, .13), 0 7px 15px rgba(70, 44, 112, .09);
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}

.btn:hover { transform: translateY(-3px); box-shadow: 0 7px 0 rgba(105, 79, 151, .13), 0 12px 20px rgba(70, 44, 112, .14); }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(105, 79, 151, .13); }
.btn-camera { color: #fff; background: linear-gradient(135deg, #765bd0, #ae75df); }
.btn-video { color: #8c4d75; background: linear-gradient(135deg, #ffd1df, #ffc6e8); }
.btn-upload { color: #357977; background: linear-gradient(135deg, #c4f1e6, #abdcdf); }
.btn-reload { color: #5d5d95; background: linear-gradient(135deg, #ddd8ff, #c7c4ed); }
.btn-logout { min-width: 2.7rem; color: #a94c6f; background: linear-gradient(135deg, #ffe1e8, #ffd1da); }

/* Upload portal */
.upload-section {
    display: none;
    margin: 0 0 1.5rem;
    padding: .85rem;
    border: 1px solid var(--line);
    border-radius: 1.7rem;
    background: rgba(255, 255, 255, .48);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.upload-section.active { display: block; animation: reveal .35s ease both; }

.upload-area {
    display: grid;
    min-height: 11rem;
    padding: 1.6rem;
    cursor: pointer;
    text-align: center;
    place-items: center;
    border: 2px dashed rgba(133, 98, 203, .38);
    border-radius: 1.15rem;
    background: linear-gradient(135deg, rgba(255, 225, 237, .7), rgba(218, 211, 255, .65));
    transition: transform .25s ease, border-color .25s ease, background .25s ease;
}

.upload-area:hover,
.upload-area.dragover { border-color: var(--pink); background: linear-gradient(135deg, rgba(255, 211, 229, .9), rgba(204, 192, 255, .86)); transform: scale(1.012); }
.upload-icon { color: var(--violet); font-size: 2.6rem; filter: drop-shadow(0 8px 9px rgba(103, 73, 169, .22)); }
.upload-text p { margin: .25rem 0 0; color: #645273; font-weight: 700; }
.upload-text strong { color: #45305f; font-weight: 900; }
#fileInput { display: none; }

@keyframes reveal { from { opacity: 0; transform: translateY(-.75rem) scale(.985); } }

/* A small constellation between controls and memories */
.memory-banner {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1rem 0 1.55rem;
    padding: 1.1rem 1.35rem;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .72);
    border-radius: 1.35rem;
    background: linear-gradient(105deg, rgba(255, 233, 243, .73), rgba(225, 220, 255, .65), rgba(206, 244, 237, .64));
    box-shadow: 0 13px 30px rgba(59, 35, 99, .1), inset 0 1px 0 #fff;
    backdrop-filter: blur(16px);
}

.memory-banner::after {
    position: absolute;
    top: -4.5rem;
    right: 8%;
    width: 10rem;
    height: 10rem;
    border: 1px solid rgba(255, 255, 255, .45);
    border-radius: 50%;
    content: '';
    transform: rotateX(62deg) rotate(20deg);
}

.memory-banner-star,
.memory-banner-heart {
    position: relative;
    z-index: 1;
    display: grid;
    flex: 0 0 auto;
    width: 2.55rem;
    height: 2.55rem;
    place-items: center;
    border-radius: 1rem;
    color: #fff;
    font-size: 1.2rem;
    background: linear-gradient(135deg, #a48ae7, #ff9cba);
    box-shadow: 0 5px 0 rgba(102, 73, 159, .17);
    transform: rotate(-9deg);
}

.memory-banner-heart {
    width: auto;
    height: auto;
    margin-left: auto;
    color: #e976a0;
    font-size: 2.25rem;
    background: none;
    box-shadow: none;
    transform: rotate(10deg);
}

.memory-banner div { position: relative; z-index: 1; }
.memory-banner-kicker { margin: 0 0 .15rem; color: #906fbb; font-size: .65rem; font-weight: 900; letter-spacing: .13em; }
.memory-banner h2 { margin: 0; color: #49365e; font-family: 'Playfair Display', Georgia, serif; font-size: clamp(1.1rem, 2.5vw, 1.35rem); line-height: 1.25; }

/* Gallery */
.gallery {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(.9rem, 2vw, 1.55rem);
    perspective: 1200px;
}

.photo-card {
    position: relative;
    min-height: 18rem;
    overflow: hidden;
    isolation: isolate;
    border: 5px solid rgba(255, 255, 255, .72);
    border-radius: 1.7rem;
    background: #e5d8ef;
    cursor: pointer;
    box-shadow: 0 12px 0 rgba(78, 52, 124, .15), 0 21px 38px rgba(59, 35, 99, .2);
    transform: rotateX(2deg) rotateY(-1deg) translateZ(0);
    transform-style: preserve-3d;
    transition: transform .38s cubic-bezier(.2, .8, .3, 1), box-shadow .38s ease;
    animation: cardLand .6s cubic-bezier(.2, .9, .3, 1) both;
}

.photo-card:nth-child(2n) { transform: rotateX(2deg) rotateY(1deg) translateY(.6rem); animation-delay: .06s; }
.photo-card:nth-child(3n) { transform: rotateX(-1deg) rotateY(-2deg) translateY(-.2rem); animation-delay: .12s; }
.photo-card:hover { z-index: 2; box-shadow: 0 19px 0 rgba(78, 52, 124, .15), 0 34px 55px rgba(59, 35, 99, .3); transform: rotateX(6deg) rotateY(-5deg) translateY(-.7rem) translateZ(1.8rem); }
.photo-card:nth-child(2n):hover { transform: rotateX(5deg) rotateY(5deg) translateY(-.7rem) translateZ(1.8rem); }

.photo-card::before {
    position: absolute;
    z-index: 4;
    top: .7rem;
    right: .7rem;
    display: grid;
    width: 2rem;
    height: 2rem;
    pointer-events: none;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    font-size: .75rem;
    content: '✦';
    background: linear-gradient(135deg, #ff9ab8, #a98bed);
    box-shadow: 0 3px 0 rgba(103, 77, 161, .25);
}

.photo-card img,
.photo-card video {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .55s ease, filter .4s ease;
}

.photo-card:hover img,
.photo-card:hover video { transform: scale(1.08); filter: saturate(1.08) contrast(1.03); }

.video-play-icon { border: 3px solid rgba(255, 255, 255, .8) !important; background: linear-gradient(135deg, #ff8eb1, #a983e9) !important; }

.photo-overlay {
    position: absolute;
    z-index: 3;
    inset: 0;
    display: flex;
    align-items: end;
    padding: .8rem;
    opacity: 0;
    background: linear-gradient(180deg, transparent 26%, rgba(38, 23, 66, .06) 44%, rgba(38, 23, 66, .88) 100%);
    transition: opacity .35s ease;
}

.photo-card:hover .photo-overlay,
.photo-card:focus-within .photo-overlay { opacity: 1; }

.photo-info {
    width: 100%;
    padding: .9rem;
    border: 1px solid rgba(255, 255, 255, .42);
    border-radius: 1rem;
    color: #fff;
    background: rgba(43, 26, 72, .5);
    box-shadow: 0 8px 22px rgba(10, 5, 24, .22);
    backdrop-filter: blur(10px);
    transform: translateY(.4rem);
    transition: transform .35s ease;
}

.photo-card:hover .photo-info { transform: translateY(0); }
.photo-message { margin-bottom: .4rem; font-size: .93rem; font-weight: 900; line-height: 1.3; }
.photo-author { font-size: .8rem; font-weight: 800; }
.photo-date { margin-top: .15rem; color: rgba(255, 255, 255, .78); font-size: .7rem; font-weight: 700; }
.photo-stats { display: none !important; }
.photo-actions { display: flex; gap: .4rem; margin-top: .65rem; }
.photo-actions button {
    display: grid;
    width: 2.05rem;
    height: 2.05rem;
    padding: 0;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .32);
    border-radius: .68rem;
    color: #fff;
    background: rgba(255, 255, 255, .16);
    transition: transform .18s ease, background .18s ease;
}
.photo-actions button:hover { transform: translateY(-2px) scale(1.06); background: rgba(255, 255, 255, .3); }
.photo-actions .btn-delete { margin-left: auto; background: rgba(226, 91, 124, .68); }
.photo-actions .btn-like { background: rgba(240, 105, 153, .72); }
.photo-badge { background: linear-gradient(135deg, #ff83aa, #a87be3) !important; }

@keyframes cardLand { from { opacity: 0; transform: translateY(1.5rem) rotateX(-12deg) scale(.95); } }

.empty-state {
    display: none;
    width: min(100%, 38rem);
    margin: 2.5rem auto 0;
    padding: 3.5rem 1.5rem;
    text-align: center;
    border: 1px solid var(--line);
    border-radius: 2rem;
    background: rgba(255, 255, 255, .55);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}
.empty-state-icon { width: 4rem; height: 4rem; margin: 0 auto 1rem; color: var(--violet); font-size: 1.75rem; line-height: 4rem; border-radius: 1.4rem; background: linear-gradient(145deg, #ffe0ec, #d3c6ff); box-shadow: 0 7px 0 rgba(104, 75, 165, .2); }
.empty-state h3 { margin: 0; color: var(--ink); font-size: 1.4rem; font-weight: 900; }
.empty-state p { margin: .4rem 0 0; color: var(--muted); font-weight: 700; }

/* Pagination */
.pagination-controls { display: flex; align-items: center; justify-content: center; gap: .8rem; margin: 1.8rem 0 0; }
.btn-pagination { min-height: 2.7rem; padding: .55rem .9rem; border: 1px solid rgba(255, 255, 255, .8); border-radius: .9rem; color: #5d4978; font-weight: 900; background: rgba(255, 255, 255, .65); box-shadow: 0 5px 0 rgba(102, 73, 159, .14); }
.btn-pagination:not(:disabled):hover { transform: translateY(-2px); }
.btn-pagination:disabled { cursor: not-allowed; opacity: .42; }
.pagination-info { min-width: 6.7rem; color: #5b496d; font-size: .87rem; font-weight: 900; text-align: center; }

/* Modal universe */
.modal {
    position: fixed;
    z-index: 900;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: rgba(30, 18, 53, .62);
    backdrop-filter: blur(13px);
}
.modal.active { display: flex; animation: modalReveal .25s ease; }
.modal-content {
    position: relative;
    width: min(100%, 50rem);
    max-height: calc(100vh - 2.5rem);
    overflow: auto;
    padding: .55rem !important;
    border: 1px solid rgba(255, 255, 255, .86) !important;
    border-radius: 1.85rem !important;
    background: linear-gradient(150deg, rgba(255, 255, 255, .93), rgba(252, 236, 249, .88)) !important;
    box-shadow: 0 30px 90px rgba(20, 8, 43, .45), inset 0 1px 0 #fff;
    animation: modalPop .32s cubic-bezier(.2, 1.1, .35, 1) both;
}
.modal-content img,
.modal-content > video { display: block; width: 100%; max-height: min(78vh, 45rem); object-fit: contain; border-radius: 1.35rem; background: #322143; }
.modal-close {
    position: absolute;
    z-index: 5;
    top: .8rem;
    right: .8rem;
    display: grid;
    width: 2.45rem;
    height: 2.45rem;
    padding: 0;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .72);
    border-radius: .85rem;
    color: #fff;
    font-size: 1.1rem;
    background: rgba(59, 38, 86, .64);
    box-shadow: 0 4px 12px rgba(29, 12, 56, .24);
}
.modal-close:hover { background: #7050b8; transform: rotate(8deg) scale(1.06); }

#cameraModal .modal-content,
#videoCameraModal .modal-content,
#messageModal .modal-content { width: min(100%, 34rem); padding: 2rem !important; }
#cameraModal video,
#videoCameraModal video { width: 100%; border-radius: 1.2rem !important; box-shadow: 0 8px 28px rgba(46, 24, 80, .17); }
#videoCameraModal h3,
#messageModal h3 { color: var(--ink) !important; font-family: 'Playfair Display', Georgia, serif; font-size: 1.55rem; -webkit-text-fill-color: initial !important; }
#recordingStatus { color: #d45679 !important; }
#qualitySelect,
#authorInput { min-height: 3rem; border-radius: .9rem !important; }
#messageInput { min-height: 7rem !important; padding: .9rem !important; border-radius: .9rem !important; resize: vertical; }
#messageModal label { color: #625174 !important; }
.btn-submit-photo { width: 100%; }

@keyframes modalReveal { from { opacity: 0; } }
@keyframes modalPop { from { opacity: 0; transform: translateY(1rem) scale(.95) rotateX(-8deg); } }

/* Responsive */
@media (max-width: 900px) {
    .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .app-header { align-items: flex-start; }
}

@media (max-width: 650px) {
    .app-container { width: min(100% - 1.25rem, 84rem); padding-top: .65rem; }
    .app-header { gap: .85rem; padding: .9rem; border-radius: 1.25rem; }
    .app-title .icon { width: 2.45rem; height: 2.45rem; font-size: 1.2rem; }
    .header-actions { width: 100%; justify-content: space-between; }
    .header-actions .btn { flex: 1 1 calc(20% - .35rem); min-width: 2.35rem; padding: .55rem .4rem; }
    .header-actions .btn span { display: none; }
    .gallery { grid-template-columns: 1fr; gap: 1.15rem; }
    .photo-card { min-height: min(112vw, 27rem); }
    .memory-banner { padding: 1rem; gap: .75rem; }
    .memory-banner-star { width: 2.2rem; height: 2.2rem; }
    .memory-banner-heart { font-size: 1.8rem; }
    .photo-overlay { opacity: 1; background: linear-gradient(180deg, transparent 36%, rgba(38, 23, 66, .82) 100%); }
    .photo-info { padding: .78rem; transform: none; }
    .pagination-controls { gap: .45rem; }
    .btn-pagination { padding: .55rem .65rem; font-size: .78rem; }
    .pagination-info { min-width: 5.75rem; font-size: .78rem; }
    .password-container { border-radius: 2rem; }
    #cameraModal .modal-content,
    #videoCameraModal .modal-content,
    #messageModal .modal-content { padding: 1.45rem !important; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Social-feed layout — familiar vertical rhythm, still part of our soft 3D universe. */
.app-container {
    width: min(100% - 2rem, 42rem);
    padding-top: .85rem;
}

.app-header {
    position: sticky;
    z-index: 20;
    top: .8rem;
    min-height: 4.1rem;
    margin-bottom: .9rem;
    padding: .68rem .85rem .68rem 1rem;
    border-radius: 1.25rem;
    background: rgba(255, 252, 254, .82);
    box-shadow: 0 10px 28px rgba(56, 37, 97, .13), inset 0 1px 0 #fff;
}

.app-title { gap: .55rem; }
.app-title .icon { width: 2.45rem; height: 2.45rem; border-radius: .85rem; font-size: 1.2rem; }
.app-title h1 { font-size: 1.38rem; }
.header-actions { flex-wrap: nowrap; gap: .35rem; }
.header-actions .btn {
    width: 2.45rem;
    min-width: 2.45rem;
    height: 2.45rem;
    min-height: 2.45rem;
    padding: 0;
    border-radius: .8rem;
    box-shadow: none;
}
.header-actions .btn span { display: none; }
.header-actions .btn:hover { transform: translateY(-2px) rotate(-2deg); }

.stories-section {
    margin: 0 0 1rem;
    padding: 1rem 0 .9rem;
    overflow: hidden;
    border-bottom: 1px solid rgba(123, 95, 169, .13);
}
.stories-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 .15rem .7rem; color: #5a486f; font-size: .78rem; font-weight: 900; letter-spacing: .04em; }
.stories-sparkle { color: #d16d9a; font-size: 1rem; }
.stories-row { display: flex; gap: .9rem; overflow-x: auto; padding: .15rem .18rem .4rem; scrollbar-width: none; }
.stories-row::-webkit-scrollbar { display: none; }
.story-item {
    display: grid;
    flex: 0 0 3.85rem;
    gap: .35rem;
    padding: 0;
    color: #655370;
    font-size: .68rem;
    font-weight: 900;
    text-align: center;
    background: transparent;
}
.story-orb {
    position: relative;
    display: grid;
    width: 3.75rem;
    height: 3.75rem;
    place-items: center;
    border: 2px solid rgba(255, 255, 255, .86);
    border-radius: 50%;
    color: #fff;
    font-size: 1.15rem;
    background: linear-gradient(145deg, #c9b5ff, #ff96b8);
    box-shadow: 0 5px 0 rgba(106, 76, 164, .17), 0 9px 15px rgba(77, 48, 121, .15);
    transition: transform .2s ease, box-shadow .2s ease;
}
.story-add .story-orb { background: linear-gradient(145deg, #9a80e0, #6850bc); }
.story-camera { background: linear-gradient(145deg, #ffb6cb, #f37da6); }
.story-video { background: linear-gradient(145deg, #9ddfd7, #52aea9); }
.story-refresh { background: linear-gradient(145deg, #b8c8ff, #8b91db); }
.story-item:hover .story-orb { transform: translateY(-3px) rotate(-5deg); box-shadow: 0 8px 0 rgba(106, 76, 164, .17), 0 13px 18px rgba(77, 48, 121, .18); }

.upload-section { margin: 0 0 1rem; border-radius: 1.2rem; }
.upload-area { min-height: 8.5rem; border-radius: .95rem; }
.upload-icon { font-size: 2rem; }

.feed-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 .85rem;
    padding: .35rem .25rem;
}
.feed-heading p { margin: 0 0 .12rem; color: #9d7ab6; font-size: .63rem; font-weight: 900; letter-spacing: .13em; }
.feed-heading h2 { margin: 0; color: #49365e; font-family: 'Playfair Display', Georgia, serif; font-size: 1.28rem; line-height: 1.23; }
.feed-heading > span { display: grid; width: 2.2rem; height: 2.2rem; place-items: center; border-radius: .75rem; color: #d36e98; font-size: 1.45rem; background: rgba(255, 255, 255, .48); box-shadow: 0 4px 0 rgba(108, 78, 165, .1); transform: rotate(10deg); }

.gallery { display: block; perspective: none; }
.gallery .photo-card,
.gallery .photo-card:nth-child(2n),
.gallery .photo-card:nth-child(3n) {
    width: 100%;
    min-height: 0;
    margin: 0 0 1rem;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .78);
    border-radius: 1.25rem;
    background: rgba(255, 253, 255, .87);
    box-shadow: 0 10px 28px rgba(54, 35, 93, .13), inset 0 1px 0 #fff;
    transform: none;
    animation: postEnter .45s ease both;
}
.gallery .photo-card::before { display: none; }
.gallery .photo-card:hover,
.gallery .photo-card:nth-child(2n):hover { box-shadow: 0 15px 35px rgba(54, 35, 93, .18), inset 0 1px 0 #fff; transform: translateY(-2px); }

.post-header {
    display: flex;
    align-items: center;
    gap: .7rem;
    min-height: 4.1rem;
    padding: .7rem .85rem;
    background: rgba(255, 255, 255, .52);
}
.post-avatar {
    display: grid;
    width: 2.45rem;
    height: 2.45rem;
    flex: 0 0 auto;
    place-items: center;
    border: 2px solid #fff;
    border-radius: 50%;
    color: #fff;
    font-size: .93rem;
    font-weight: 900;
    background: linear-gradient(145deg, #ff94b6, #9a7be3 58%, #80cfc7);
    box-shadow: 0 4px 0 rgba(104, 75, 165, .15);
}
.post-identity { display: grid; min-width: 0; gap: .05rem; }
.post-identity strong { overflow: hidden; color: #4a375d; font-size: .88rem; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.post-identity span { overflow: hidden; color: #998ba5; font-size: .68rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.post-more { margin-left: auto; color: #806d8e; font-size: .8rem; letter-spacing: .12em; }

.post-media {
    position: relative;
    width: 100%;
    overflow: hidden;
    aspect-ratio: 4 / 5;
    background: linear-gradient(145deg, #e7def0, #d5c9e5);
}
.post-media img,
.post-media video {
    position: absolute !important;
    inset: 0 !important;
    z-index: 1 !important;
    display: block;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    transform: none !important;
    filter: none !important;
}
.photo-card:hover .post-media img,
.photo-card:hover .post-media video { transform: scale(1.015) !important; }
.post-media .video-play-icon { z-index: 4 !important; border: 3px solid rgba(255, 255, 255, .86) !important; box-shadow: 0 6px 0 rgba(97, 65, 151, .23), 0 12px 24px rgba(35, 20, 59, .22) !important; }

.gallery .photo-overlay {
    position: static;
    display: block;
    padding: 0;
    opacity: 1;
    background: none;
}
.gallery .photo-info {
    width: auto;
    padding: .7rem .85rem 1rem;
    border: 0;
    border-radius: 0;
    color: #514060;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    transform: none;
}
.photo-card:hover .photo-info { transform: none; }
.gallery .photo-actions { display: flex; align-items: center; gap: .7rem; margin: 0 0 .66rem; }
.gallery .photo-actions button {
    display: grid;
    width: 2.15rem;
    height: 2.15rem;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: .7rem;
    color: #624d74;
    font-size: 1.05rem;
    background: transparent;
    box-shadow: none;
}
.gallery .photo-actions button:hover { color: #df6c9a; background: #fff0f5; transform: scale(1.12); }
.gallery .photo-actions .btn-like { color: #e36f9c; }
.gallery .photo-actions .btn-delete { margin-left: auto; color: #aa7991; }
.gallery .photo-actions .btn-delete:hover { color: #cb5579; background: #fff0f4; }
.gallery .photo-stats { display: block !important; margin: 0 0 .42rem; color: #5d4a6c; font-size: .8rem; font-weight: 900; }
.gallery .photo-likes { display: inline-flex; align-items: center; gap: .35rem; }
.gallery .photo-likes i { color: #e6709c; }
.gallery .photo-badge { display: inline-flex; align-items: center; gap: .35rem; margin: 0 0 .42rem; padding: .26rem .5rem; border-radius: .5rem; color: #865470; font-size: .67rem; font-weight: 900; background: #ffebf2 !important; }
.gallery .photo-message { margin: 0 0 .3rem; color: #584466; font-size: .87rem; font-weight: 700; line-height: 1.43; }
.gallery .photo-message strong { margin-right: .25rem; color: #41304e; font-weight: 900; }
.gallery .photo-date { margin: 0; color: #a697af; font-size: .67rem; font-weight: 800; }

.empty-state { margin-top: 1rem; border-radius: 1.3rem; }
.pagination-controls { margin-top: 1.15rem; }
@keyframes postEnter { from { opacity: 0; transform: translateY(.8rem); } }

@media (max-width: 650px) {
    .app-container { width: min(100% - 1rem, 42rem); padding-top: .45rem; }
    .app-header { top: .4rem; border-radius: 1rem; }
    .app-title h1 { font-size: 1.18rem; }
    .header-actions { gap: .22rem; }
    .header-actions .btn { width: 2.1rem; min-width: 2.1rem; height: 2.1rem; min-height: 2.1rem; font-size: .8rem; }
    .story-item { flex-basis: 3.6rem; }
    .story-orb { width: 3.45rem; height: 3.45rem; }
    .feed-heading h2 { font-size: 1.16rem; }
    .gallery .photo-card { margin-bottom: .8rem; border-radius: 1.05rem; }
    .post-header { min-height: 3.8rem; padding: .62rem .72rem; }
    .gallery .photo-info { padding: .65rem .75rem .85rem; }
    .post-media { aspect-ratio: 1 / 1.08; }
}
