:root {
    --bg: #0d0d1d;
    --fg: #ffffff;
    --card-bg: rgba(255, 255, 255, 0.05);
    --glass: rgba(255, 255, 255, 0.1);
    --glass-bg: rgba(255, 255, 255, 0.15);
    --glass-blur: 15px;
    --nav-height: 64px;

    --light-bg: #f4f4f4;
    --dark-bg: #121212;
    --light-text: #111;
    --dark-text: #f5f5f5;
}

body.light {
    --bg: #ffffff;
    --fg: #000000;
    --glass-bg: rgba(165, 165, 165, 0.15);
    --card-bg: rgba(0, 0, 0, 0.05);
    --glass: rgba(0, 0, 0, 0.1);
    background: var(--light-bg);
    color: var(--light-text);
}

/* === Retro Neon Mode === */
/* body.retro {
  background: #0d0d0d;
  color: #39ff14;
  font-family: 'Orbitron', sans-serif;
}

body.retro .wallpaper {
  box-shadow: 0 0 15px #39ff14;
  transition: box-shadow 0.3s;
}

body.retro .overlay {
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: none;
}

body.retro .tag {
  background: transparent;
  border: 1px solid #39ff14;
  color: #39ff14;
  text-shadow: 0 0 3px #39ff14;
  transition: all 0.3s;
}

body.retro .tag:hover {
  background: #39ff14;
  color: #000;
  box-shadow: 0 0 10px #39ff14;
}

body.retro .theme-toggle {
  text-shadow: 0 0 10px #f0f;
} */


* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--bg);
    color: var(--fg);
    font-family: 'Segoe UI', sans-serif;
    transition: background 0.4s, color 0.4s;
    min-height: 100vh;
    overflow-x: hidden;
    padding: 0rem;
    position: relative;
}

/* 
body.retro::before,
body.retro::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

body.retro::before {
  background-size: cover;
  background: radial-gradient(ellipse at center, rgba(255,255,255,0.05) 0%, rgba(0,0,0,0.8) 100%);
  mix-blend-mode: screen;
  filter: blur(2px);
  opacity: 0.06;
}

body.retro::after {
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(0, 255, 0, 0.05),
    rgba(0, 255, 0, 0.05) 1px,
    transparent 1px,
    transparent 3px
  );
  animation: scanlineMove 6s linear infinite;
  opacity: 0.3;
} */
/* 
body.retro {
  animation: crtFlicker 0.15s infinite;
  background-color: #050505;
  color: #39ff14;
}

@keyframes scanlineMove {
  0% { background-position: 0 0; }
  100% { background-position: 0 100%; }
}

@keyframes crtFlicker {
  0% { opacity: 0.9; }
  50% { opacity: 1; }
  100% { opacity: 0.8; }
} */

a {
    text-decoration: none;
    color: var(--fg);
    transition: all 0.17s ease-in-out;
}



.background {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.04), transparent);
    animation: floatBG 20s linear infinite;
}

@keyframes floatBG {
    0% {
        background-position: 0% 0%;
    }

    100% {
        background-position: 100% 100%;
    }
}


body.dark {
    background: var(--dark-bg);
    color: var(--dark-text);
}

.navbar {
    position: sticky;
    top: 0;
    width: 100%;
    height: var(--nav-height);
    backdrop-filter: blur(var(--glass-blur));
    background: var(--glass-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0px 0px 35px 35px;
}

.navbar a:hover {
    scale: 1.05;
    text-shadow:
        1px 1px 0 #000,
        2px 2px 0 #222,
        3px 3px 5px rgba(0, 0, 0, 0.7);
}

.navbar .logo,
.logophone {
    font-size: 1.5rem;
    font-weight: bold;
    color: inherit;
    user-select: none;
}

.logophone {
    display: none;
}

.navbar input[type="text"] {
    width: 60%;
    padding: 0.5rem 1rem;
    /* border: none; */
    border-radius: 20px;
    background: rgba(255, 255, 255, 1);
    backdrop-filter: blur(10px);
    color: #000;
    font-size: 1rem;
}

body.dark .navbar input[type="text"] {
    background: rgba(0, 0, 0, 0.25);
    color: #fff;
}

#theme-toggle {
    font-size: 1.25rem;
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    transition: transform 0.3s ease;
}

#theme-toggle:hover {
    transform: rotate(20deg) scale(1.2);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.globe-btn {
    margin-left: 0rem;
    background: transparent;
    /* border: 1px solid #0ff; */
    color: #0ff;
    padding: 1px 4px 4px 1px;
    font-size: 1.3rem;
    border-radius: 6px;
    font-family: 'Orbitron', sans-serif;
    text-decoration: none;
    transition: all 0.3s ease;
}

.globe-btn:hover {
    background: #0ff;
    color: black;
    box-shadow: 0 0 10px #0ff, 0 0 20px #0ff;
}


.actions button {
    margin-left: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 20px;
    background: var(--glass);
    color: var(--fg);
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.filters {
    margin: 1.5rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter {
    padding: 0.4rem 1rem;
    border-radius: 20px;
    border: none;
    background: var(--card-bg);
    color: var(--fg);
    cursor: pointer;
    transition: 0.3s ease;
}

.filter:hover {
    background: var(--glass);
}

.filter.active {
    background: var(--glass);
    font-weight: bold;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.rs-loader {
    display: none;
    font-size: 1.7rem;
    text-align: center;
    margin-top: 30dvh;
    letter-spacing: 0.1em;
    user-select: none;
}

/* Animate the R and S letters fading in/out with a slight delay */
.rs-loader .letter {
    opacity: 0;
    animation: fadeInOut 1.5s infinite;
    display: inline-block;
}

.rs-loader .letter.r {
    animation-delay: 0s;
}

.rs-loader .letter.s {
    animation-delay: 0.2s;
}

/* Animate the dots fading in/out with staggered delays */
.rs-loader .dot {
    opacity: 0;
    animation: fadeInOut 1s infinite;
    display: inline-block;
}

.rs-loader .dot:nth-child(3) {
    animation-delay: 0.4s;
    /* First dot after letters */
}

.rs-loader .dot:nth-child(4) {
    animation-delay: 0.5s;
    /* Second dot */
}

.rs-loader .dot:nth-child(5) {
    animation-delay: 0.7s;
    /* Third dot */
}

@keyframes fadeInOut {

    0%,
    100% {
        opacity: 0;
    }

    50% {
        opacity: 1;
    }
}


#no-results {
    display: none;
    margin-top: 30dvh;
    text-align: center;
}

.tag {
    position: relative;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.tag:hover {
    transform: scale(1.1) rotate(-2deg);
}

/* Tooltip style */
.tag::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: #222;
    color: #fff;
    padding: 4px 8px;
    font-size: 0.75rem;
    white-space: nowrap;
    border-radius: 4px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 10;
}

.tag:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-5px);
}


#grid {
    margin: 1rem;
}

.masonry-grid {
    column-count: 1;
    column-gap: 0.9rem;
}

@media (min-width: 600px) {
    .masonry-grid {
        column-count: 2;
    }
}

@media (min-width: 900px) {
    .masonry-grid {
        column-count: 3;
    }
}

@media (min-width: 1200px) {
    .masonry-grid {
        column-count: 4;
    }
}

.wallpaper {
    display: inline-block;
    margin-bottom: 1.05rem;
    width: 100%;
    border-radius: 20px;
    overflow: hidden;
    background: var(--card-bg);
    box-shadow: 0 15px 25px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    position: relative;
    opacity: 0;
    transform: scale(0.95);
    animation: fadeInZoom 0.5s ease forwards;
    perspective: 800px;
}

@keyframes fadeInZoom {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.wallpaper img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.4s ease, box-shadow 0.4s ease, filter 0.4s ease;
}

.wallpaper img:hover {
    transform: translateY(-8px) scale(1.04) rotateX(6deg) rotateY(-6deg);
    box-shadow: 0 25px 40px rgba(0, 0, 0, 0.3);
    filter: brightness(1.1) blur(0.3px) drop-shadow(0 0 10px rgba(255, 255, 255, 0.2));
}

/* 
.wallpaper:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 25px 40px rgba(0, 0, 0, 0.3);
}

.wallpaper::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.wallpaper:hover::after {
    opacity: 1;
}

.wallpaper::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(120deg,
            rgba(255, 255, 255, 0.05) 0%,
            rgba(255, 255, 255, 0.15) 50%,
            rgba(255, 255, 255, 0.05) 100%);
    transform: rotate(25deg);
    transition: all 0.7s ease;
    pointer-events: none;
}

.wallpaper:hover::before {
    top: 0;
    left: 100%;
} */

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(16px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.98);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.overlay-blur {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(0px);
}

.overlay.show {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
    /* animation: burstIn 0.6s cubic-bezier(0.33, 1, 0.68, 1); */
}

/* @keyframes burstIn {
  0% {
    transform: scale(0.7) rotateX(20deg);
    opacity: 0;
    filter: blur(10px);
  }
  60% {
    transform: scale(1.05) rotateX(-5deg);
    opacity: 1;
    filter: blur(2px);
  }
  100% {
    transform: scale(1) rotateX(0deg);
    filter: blur(0);
  }

} */


.overlay-content {
    position: relative;
    max-width: 100vw;
    max-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: slideIn 0.4s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

#particles-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 50;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
    filter: blur(0.8px);
}

/* Show particles when Live Preview is active */
.live-active #particles-layer {
    opacity: 1;
}

#preview-img {
    max-width: 95vw;
    max-height: 90vh;
    width: auto;
    height: auto;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease;
    object-fit: contain;
}

#preview-img:hover {
    transform: scale(1.03);
}

#close-preview {
    position: absolute;
    top: -20px;
    /* right: -10px; */
    font-size: 2rem;
    color: white;
    background-color: rgba(0, 0, 0, 0.3);
    z-index: 5;
    cursor: pointer;
    border-radius: 50px;
    transition: transform 0.3s ease;
}

#close-preview:hover {
    transform: scale(1.3) rotate(90deg);
    color: #000;
    background-color: white;
}

#scape-name {
    color: white;
    position: absolute;
    right: 11px;
    bottom: 7px;
    opacity: 0.7;
    text-shadow:
        1px 1px 0 #000,
        2px 2px 0 #222,
        3px 3px 5px rgba(0, 0, 0, 0.7);
}

.overlay-content:hover #scape-name {
    opacity: 1;
}

#try-screen {
    text-decoration: none;
    color: white;
    position: absolute;
    bottom: 16px;
    left: 23px;
    font-size: 0.9rem;
    text-shadow:
        1px 1px 0 #000,
        2px 2px 0 #222,
        3px 3px 5px rgba(0, 0, 0, 0.7);
}

#try-screen:hover {
    cursor: pointer;
    text-shadow:
        0 0 5px #00ffff,
        0 0 10px #00ffff,
        0 0 20px #00ffff,
        0 0 40px #0ff,
        0 0 80px #0ff;
}

.live-toggle {
    position: absolute;
    bottom: 80px;
    left: 20px;
    color: #0ff;
    font-family: 'Orbitron', sans-serif;
    font-size: 14px;
}

#make-live-btn {
    position: absolute;
    bottom: 30px;
    left: 20px;
    background: #111;
    color: #0ff;
    border: 1px solid #0ff;
    padding: 6px 12px;
    border-radius: 4px;
    font-family: 'Orbitron', sans-serif;
    cursor: pointer;
    z-index: 1;
}

/* Animated wallpaper container */
#preview-img.ambient-animate {
    animation: driftMotion 5s ease-in-out infinite alternate;
    filter: blur(0.2px) brightness(1.05) contrast(1.1) saturate(1.05) drop-shadow(0 0 2px rgb(255, 255, 255));
}

@keyframes driftMotion {
    0% {
        transform: scale(1) translate(0px, 0px);
    }

    100% {
        transform: scale(1.05) translate(-5px, 5px);
    }
}


#color-palette-btn {
    color: white;
    position: absolute;
    right: 25px;
    bottom: 16px;
    text-shadow:
        1px 1px 0 #000,
        2px 2px 0 #222,
        3px 3px 5px rgba(0, 0, 0, 0.7);
}

#color-palette-btn:hover {
    cursor: pointer;
    text-shadow:
        0 0 5px #00ffff,
        0 0 10px #00ffff,
        0 0 20px #00ffff,
        0 0 40px #0ff,
        0 0 80px #0ff;
}

#fullscreen-hint {
    font-family: monospace;
    opacity: 0.7;
    user-select: none;
    display: none;
    font-size: 0.8rem
}

@keyframes zoomInBeforeFullscreen {
    0% {
        transform: scale(1);
        filter: brightness(1);
    }

    100% {
        transform: scale(1.05);
        filter: brightness(1.1);
    }
}

.zoom-animate {
    animation: zoomInBeforeFullscreen 0.4s forwards;
}


/* HOVER TILTING PARALLEX EFFECT */
.tilt-container {
    perspective: 1000px;
    transition: transform 0.2s ease;
    transform-style: preserve-3d;
}


.surprise-btn {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: linear-gradient(135deg, #ffffff, #ffffff);
    color: white;
    border: none;
    padding: 12px 20px;
    font-size: 1rem;
    border-radius: 15px !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    z-index: 2;
    transition: transform 0.2s ease;
}

.surprise-btn:hover {
    transform: scale(1.07);
}

@media (max-width: 570px) {

    .navbar {
        padding: 0 0.3rem 0 0.8rem;
    }

    .navbar input[type="text"] {
        width: 50%;
    }
}

@media (max-width: 430px) {

    .navbar {
        padding: 0 0.3rem 0 1.2rem;
    }

    .navbar .logo {
        display: none;
    }

    .navbar .logophone {
        display: block;
    }

    .navbar input[type="text"] {
        width: 60%;
    }

    #color-palette-btn {
        right: 11px;
        bottom: 8px;
    }

    #try-screen {
        right: 11px;
        bottom: 8px;
    }
}