.custom-app {
  position: relative;
}

.delete-custom-app-btn {
  display: none;
  position: absolute;
  top: -8px;
  right: -8px;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 999px;
  background: rgba(255,0,60,0.9);
  color: white;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0,0,0,0.35);
}

body.delete-app-mode .custom-app .delete-custom-app-btn {
  display: grid;
  place-items: center;
}

body.delete-app-mode .custom-app {
  outline: 1px solid rgba(255,80,110,0.8);
  box-shadow: 0 0 20px rgba(255,80,110,0.25);
}

.edit-app-mode-btn.active {
  background: rgba(255,80,110,0.25);
  border-color: rgba(255,80,110,0.7);
}

.frame-wrap {
	height:100%;
}

:root {
            --glass-bg: rgba(255, 255, 255, 0.10);
            --glass-border: rgba(255, 255, 255, 0.25);
            --accent: #2ef2e9;
            --text-main: #ffffff;
            --text-muted: rgba(255, 255, 255, 0.7);
        }

        * {
            box-sizing: border-box;
        }

body {
    margin: 0;
    padding-bottom: 64px;
    font-family: 'Inter', system-ui, sans-serif;
    color: var(--text-main);

    /* Center content */
    display: flex;
    justify-content: center;  /* horizontal centering */
    align-items: center;      /* vertical centering */

    /* Deep starry cosmic background */
    background:
        radial-gradient(circle at 15% 20%, rgba(255, 255, 255, 0.08), transparent 35%),
        radial-gradient(circle at 75% 30%, rgba(255, 255, 255, 0.06), transparent 40%),
        radial-gradient(circle at top, #0b1a2a, #02040a 70%);
    background-size: cover;  /* 🔑 ensures it covers entire viewport */
    background-repeat: no-repeat;
    background-attachment: fixed; /* optional: stay fixed on scroll */

    overflow-x: hidden;
    min-height: 100vh; /* 🔑 use viewport height */
}

	/* Ensure the modal centers itself when in windowed mode */
#windowModal:not(.fullscreen-mode) {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Ensure it covers everything when in fullscreen mode */
#windowModal.fullscreen-mode {
    top: 0 !important;
    left: 0 !important;
    transform: none !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
}	
        /* ===== Cosmic Background ===== */
        .stars {
            position: fixed;
            inset: 0;
            pointer-events: none;
            z-index: 0;

            background-image:
                radial-gradient(1px 1px at 10% 20%, rgba(255, 255, 255, 0.9), transparent),
                radial-gradient(1px 1px at 30% 70%, rgba(255, 255, 255, 0.7), transparent),
                radial-gradient(1px 1px at 55% 40%, rgba(255, 255, 255, 0.8), transparent),
                radial-gradient(1px 1px at 80% 60%, rgba(255, 255, 255, 0.6), transparent),
                radial-gradient(1px 1px at 90% 25%, rgba(255, 255, 255, 0.75), transparent);

            opacity: 0.35;
            animation: driftStars 140s linear infinite;
        }

        @keyframes driftStars {
            from {
                background-position: 0 0;
            }

            to {
                background-position: 1600px 1600px;
            }
        }


        @keyframes drift {
            from {
                background-position: 0 0;
            }

            to {
                background-position: 1200px 1200px;
            }
        }

.logo-white {
  filter: brightness(0) invert(1) contrast(1.2);
}
 
.logo-gray {
  filter: grayscale(100%);
}


.logo {
  content: url('logo.png');
}

.logo:focus {
  transform: scale(2);
}

/* When viewport < 543px, replace with short logo */
@media (max-width: 542px) {
  .logo {
    content: url('logo-short.png');
  }
 .search-results-container {
    transform: translateX(-40%);
	}
}
  
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;

  height: 52px;
  padding: 0 1.6rem;

  display: flex;
  align-items: center;
  justify-content: space-between;

  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255,255,255,0.15);

  z-index: 8000;
}
function renderSearchResults(query = '') {
  if (!resultsEl) return;
  resultsEl.innerHTML = '';

  // Only show results if focused or there is a query
  if (!SEARCH_FOCUSED && !query) return;

  // 1. Show the Fullscreen Toggle at the top
  resultsEl.appendChild(renderFullscreenResult());

  // 2. Filter and show apps from registry
  Object.values(APP_REGISTRY).forEach(app => {
    if (!query || app.title.toLowerCase().includes(query.toLowerCase())) {
      const el = document.createElement('div');
      el.className = 'search-result';
      el.innerHTML = `<span>${app.icon}</span> ${app.title}`;
      el.onclick = () => {
        openApp(app.url, app.id, app.w, app.h);
        globalSearch.value = '';
        resultsEl.innerHTML = '';
      };
      resultsEl.appendChild(el);
    }
  });
}
.brand {
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand span {
  color: var(--accent);
}

.user {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.7);
}


.fullscreen {
	width:100%;
	height:100%;
}

.topbar-center {
  position: relative; /* Context for the absolute results container */
}


.search-result {
  padding: 12px 16px;
  color: white;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.search-result:hover {
  background: rgba(255, 255, 255, 0.1);
}

.fullscreen-toggle {
  background: rgba(0, 122, 255, 0.2);
  color: #007aff;
  font-weight: bold;
}
        /* ===== App Tiles ===== */
.app {
  /* HARD SIZE CONTROL */
  flex: 0 0 160px;      /* 🔒 fixed basis */
  width: 160px;
  aspect-ratio: 1 / 1;

  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 22px;
  backdrop-filter: blur(16px) saturate(140%);

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  padding: 1.2rem;
  text-align: center;
  cursor: pointer;

  transition: transform 0.25s ease, box-shadow 0.25s ease;
}



        .app:hover {
            transform: translateY(-6px);
            box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
        }

        .app-icon {
            font-size: 2.2rem;
            margin-bottom: 0.7rem;
        }

        .app-title {
            font-weight: 600;
            font-size: 0.95rem;
        }

        .app-sub {
            font-size: 0.75rem;
            color: var(--text-muted);
            margin-top: 0.3rem;
        }

        /* ===== Footer ===== */
        footer {
            text-align: center;
            padding: 2rem 1rem 3rem;
            font-size: 0.75rem;
            color: var(--text-muted);
        }

        /* ===== Mobile ===== */
        @media (max-width: 600px) {
            .desktop {
                padding: 1rem;
                gap: 1rem;
            }
        }

        .overlay {
            position: fixed;
            inset: 0;
            background: radial-gradient(circle at center,
                    rgba(20, 40, 60, 0.55),
                    rgba(0, 0, 0, 0.85));
            backdrop-filter: blur(8px);

            display: none;
            z-index: 10000;

            /* CRITICAL */
            pointer-events: auto;
        }

        #hut101Modal {
            display: none;
            /* controlled by JS */
            align-items: stretch;
            justify-content: stretch;
        }


        .hut101-title {
            font-size: 0.9rem;
            font-weight: 600;
            color: rgba(255, 255, 255, 0.85);
        }

/* Container to hold both buttons stacked vertically */
.window-controls {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%); /* Centers the stack vertically */
    display: flex;
    flex-direction: column; /* Stacks them one under another */
    gap: 8px; /* Space between the buttons */
    z-index: 11111;
}

/* Base style for both buttons based on your .hut101-close */
.window-btn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.15); /* Slightly darker default */
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

/* Specific styling for the Close button */
.window-btn.close, .window-btn.minimize {
    color: #ff4d4d; /* Red for close */
    background: rgba(255, 255, 255, 0.5); /* Your requested background */
}

.window-btn:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: scale(1.05);
}

.hut101-close:hover {
    /* NEW HOVER (stronger affordance) */
	color: red;
    background: rgb(181 71 71 / 22%);
    border-color: rgba(255, 255, 255, 0.35);
}


        /* Content area */
        .hut101-content {
            flex: 1;
            background: #000;
            overflow: hidden;
        }

        /* Auto-hide top bar */
        .hut101-bar {
            transition: opacity 0.25s ease;
        }

        .hut101-bar.hidden {
            opacity: 0;
            pointer-events: none;
            /* prevent accidental clicks while hidden */
        }


		/* Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(8px);

  display: none;
  align-items: center;
  justify-content: center;

  z-index: 10000;
}

/* Modal window */
.modal-window {
  background: rgba(15,20,30,0.9);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 18px;

  width: auto;
  max-width: 92vw;
  max-height: 90vh;

  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Top bar */
.modal-bar {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 0 14px;
  background: rgba(0,0,0,0.5);
  border-bottom: 1px solid rgba(255,255,255,0.15);
}

.modal-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
}

/* Close button */
.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;

  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  color: #fff;
  font-size: 1.1rem;

  cursor: pointer;
}

/* Content */
.modal-content {
  padding: 1.2rem;
  overflow: auto;
  color: rgba(255,255,255,0.85);
  font-size: 0.9rem;
}
/* ===== Book Detail Layout ===== */
.book-detail {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.4rem;
}

/* Cover */
.book-cover {
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.25);
}

.book-cover {
  width: 180px;              /* HARD LIMIT */
  max-width: 180px;
  aspect-ratio: 2 / 3;

  border-radius: 14px;
  overflow: hidden;

  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.25);

  flex-shrink: 0;            /* CRITICAL */
}

.book-cover img {
  width: 100%;
  height: 100%;
  object-fit: contain;       /* NOT cover */
}

.book-meta {
  min-width: 0;  
	line-height: 2;
	/* CRITICAL for grid/flex wrapping */
}

.book-title,
.book-description,
.book-details {
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: normal;
}


.book-detail {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 1.4rem;
}

@media (max-width: 640px) {
  .book-detail {
    grid-template-columns: 1fr;
  }

  .book-cover {
    margin: 0 auto;
  }
}


/* Actions */
.book-actions {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

/* Online button */
.book-action-btn {
  padding: 0.55rem 1rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.85rem;

  background: linear-gradient(135deg, #2ef2e9, #1fb9c4);
  color: #041418;
  border: none;
  cursor: pointer;
}

/* Share icons */
.book-share {
  display: flex;
  gap: 0.5rem;
}

.book-share span {
  font-size: 0.85rem;
  opacity: 0.7;
  cursor: pointer;
}
/* ===== Expressive App Tiles ===== */
.app {
  position: relative;
  overflow: hidden;

  background:
    linear-gradient(
      180deg,
      rgba(255,255,255,0.14),
      rgba(255,255,255,0.06)
    );

  box-shadow:
    0 10px 30px rgba(0,0,0,0.35),
    inset 0 1px 0 rgba(255,255,255,0.25);

  transition:
    transform 0.35s ease,
    box-shadow 0.35s ease,
    background 0.35s ease;
}

/* subtle glow layer */
.app::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;

  background: radial-gradient(
    circle at top,
    rgba(46,242,233,0.25),
    transparent 55%
  );

  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

/* hover / focus */
.app:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow:
    0 28px 70px rgba(0,0,0,0.55),
    inset 0 1px 0 rgba(255,255,255,0.35);
}

.app:hover::before {
  opacity: 1;
}

/* press */
.app:active {
  transform: translateY(-3px) scale(0.99);
}
.app-icon {
  font-size: 2.4rem;
  margin-bottom: 0.8rem;

  filter: drop-shadow(0 6px 14px rgba(0,0,0,0.45));
  transition: transform 0.35s ease;
}

.app:hover .app-icon {
  transform: scale(1.12);
}
.app-title {
  font-weight: 600;
  letter-spacing: -0.01em;
}

.app-sub {
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  opacity: 0.8;
}
/* Knowledge */
.app:has(.app-icon:contains("🧠")),
.app:has(.app-icon:contains("📘")) {
  --accent-local: #7fd6ff;
}

/* Media */
.app:has(.app-icon:contains("🎥")),
.app:has(.app-icon:contains("📷")),
.app:has(.app-icon:contains("🎵")) {
  --accent-local: #ffb86b;
}

/* System / AI */
.app:has(.app-icon:contains("🤖")),
.app:has(.app-icon:contains("🧭")),
.app:has(.app-icon:contains("🪟")) {
  --accent-local: #9b8cff;
}

/* Places / Identity */
.app:has(.app-icon:contains("🏠")),
.app:has(.app-icon:contains("🎓")) {
  --accent-local: #7cffb2;
}

/* Apply accent */
.app::before {
  background: radial-gradient(
    circle at top,
    var(--accent-local, rgba(46,242,233,0.25)),
    transparent 60%
  );
}
#recentApps {
  display: flex;
  gap: 10px;
  padding: 8px;
  overflow-x: auto;
}

.recent-icon {
  font-size: 18px;
  line-height: 1;
  color: #fff;
  display: block;
  text-align: center;
}



@keyframes pulse {
  0%,100% { opacity: 0.2; }
  50% { opacity: 0.6; }
}
.desktop {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;

  max-width: 1000px;
  margin: 50px auto;
}

.sigma-footer {
  position: relative;
  margin-top: 2rem;
  padding: 1rem 1.6rem;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;

  font-size: 0.75rem;
  color: rgba(255,255,255,0.6);

  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(14px);
  border-top: 1px solid rgba(255,255,255,0.15);
}

.footer-center {
  text-align: center;
  flex: 1;
  opacity: 0.75;
}

.footer-left,
.footer-right {
  white-space: nowrap;
}

.footer-right span {
  margin-right: 0.35rem;
  opacity: 0.7;
}

.footer-link {
  background: none;
  border: none;
  padding: 0;

  color: var(--accent, #2ef2e9);
  font-weight: 600;
  font-size: 0.75rem;

  cursor: pointer;
}

.footer-link:hover {
  text-decoration: underline;
}
.sigma-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;

  height: 48px;
  padding: 0 1.6rem;

  display: flex;
  align-items: center;
  justify-content: space-between;

  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(14px);
  border-top: 1px solid rgba(255,255,255,0.15);

  z-index: 9000;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
/* FLAG-DRIVEN footer visibility */
body.hide-recents .sigma-footer {
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
}


.recent-apps {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.recent-app {
  width: 32px;
  height: 32px;
  border-radius: 10px;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 1.1rem;
  cursor: pointer;

  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.25);
  backdrop-filter: blur(10px);

  transition: transform 0.2s ease, background 0.2s ease;
}

.recent-app:hover {
  transform: translateY(-2px);
  background: rgba(255,255,255,0.18);
}

.footer-meta {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.55);
}

.footer-link {
  cursor: pointer;
  color: var(--accent);
}
#windowModal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.85);
  border-radius: 16px;
  z-index: 9000;
}
#windowModal iframe {
  width: 100%;
  height: 100%;
  border: none;  pointer-events: auto;
  position: relative;
  z-index: 10;
}

#fullscreenModal {
  position: fixed;
  inset: 0;
  z-index: 10000;
}
#fullscreenModal iframe {
  width: 100dvw;
  height: 100dvh;
  border: none;
}
.iframe-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.iframe-modal .frame-wrap {
  width: 100%;
  height: 100%;
}

.iframe-close {
  position: absolute;
  right: 20px;
  z-index: 10001;

  width: 38px;
  height: 38px;
  border-radius: 12px;

  /* Core visibility */
  background: rgba(20, 20, 20, 0.22);
  backdrop-filter: blur(8px) saturate(140%);
  -webkit-backdrop-filter: blur(8px) saturate(140%);

  /* Hard edge contrast */
  border: 1px solid rgba(255, 255, 255, 0.55);
  outline: 1px solid rgba(0, 0, 0, 0.6);
  outline-offset: -1px;

  /* Text */
  color: #ffffff;
  font-size: 1.2rem;
  font-weight: 600;

  /* Depth */
  box-shadow:
    0 6px 18px rgba(0,0,0,0.55),
    inset 0 1px 0 rgba(255,255,255,0.25);

  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: center;

  transition:
    background 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.15s ease;
}

.iframe-close:hover {
  background: rgba(40, 40, 40, 0.8);
  box-shadow:
    0 10px 28px rgba(0,0,0,0.75),
    inset 0 1px 0 rgba(255,255,255,0.35);
  transform: scale(1.05);
}

.iframe-close:active {
  transform: scale(0.96);
}
#iframeModal .iframe-close {
  transition: opacity 0.25s ease;
}
.iframe-close {
  transition: opacity 0.25s ease;
}

.iframe-close.hidden {
  opacity: 0;
  pointer-events: none;
}
/* Ensure the window modal handles its children correctly */
#windowModal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.9);
  border-radius: 18px;
  z-index: 9000;
  box-shadow: 0 40px 120px rgba(0,0,0,0.8);
  overflow: hidden; /* Keeps the interaction layer contained */
}

/* Shared Shield Logic */
.iframe-interaction, 
.hut101-interaction-layer {
  position: absolute; /* Changed from fixed to absolute */
  inset: 0;           /* Perfectly fills the parent window */
  z-index: 15;        /* Above the iframe, below the close button */
  background: transparent;
  pointer-events: none; 
  display: block !important;
}

/* Active Shield: Blocks the iframe to catch mouse moves when UI is hidden */
.iframe-interaction.active, 
.hut101-interaction-layer.active {
  pointer-events: auto !important;
}

/* Ensure buttons are on the very top */
.iframe-close, 
.hut101-close, 
.hut101-bar {
  z-index: 20 !important;
  pointer-events: auto !important;
  transition: opacity 0.4s ease;
}

.hidden {
  opacity: 0 !important;
  pointer-events: none !important;
}
/* This layer sits between the iframe and the buttons */
.hut101-interaction-layer {
  position: absolute;
  inset: 0;
  z-index: 15;
  background: transparent;
  pointer-events: none; /* Hollow by default: clicks pass through */
}

/* This blocks clicks ONLY when the UI is hidden to catch "wake up" movement */
.hut101-interaction-layer.active {
  pointer-events: auto !important;
}
	.recent-icon img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  display: block;
}
	#genericModal {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;

  background: #000;
  z-index: 9000;

  display: none;
}

#modalContent {
  width: 100%;
  height: 100%;
}
.sigma-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;

  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 8px 12px;
  background: rgba(15,17,21,0.95);
  backdrop-filter: blur(8px);
  z-index: 8000;
}

.recent-wrap {
  display: flex;
  align-items: center;
  overflow: hidden;
}

.footer-actions {
  display: flex;
  align-items: center;
}

.notif-btn {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  margin-right: 10px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  padding-right: 20px;
}

.notif-btn:hover {
  background: rgba(255,255,255,0.2);
}

.fixed-app {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  margin-left: 10px;

  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;

  font-size: 16px;
  cursor: pointer;
	align-content: center;
}

.notif-btn:hover {
  background: rgba(255,255,255,0.2);
}
.notif-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  color: #ff5a5a;
  font-size: 14px;
  line-height: 1;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;

  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  background: rgba(15,17,21,0.95);
  backdrop-filter: blur(8px);
  z-index: 8500;
}

/* left / center / right zones */
.topbar-left {
  display: flex;
  justify-content: flex-start;
  align-items: center;
}
/* Mobile override */
@media (max-width: 543px) {
  .topbar-left {
    margin-left: -10px;
  }
}
.topbar-center {
  display: flex;
  justify-content: center;
}

.topbar-right {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}
#user{
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 7px;
  font-weight: 600;
  font-size: 15px;
  color: #fff;
  cursor: pointer;

  /* Frosted glass effect */
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.25);

  /* Shadow for contrast */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);

  transition: transform 0.2s ease, background 0.2s ease;
}

#user:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

#user:active {
  transform: scale(0.95);
}
.topbar-center {
    position: relative; /* Essential: keeps the results anchored to the search bar */
    display: flex;
    justify-content: center;
    width: fit-content; /* Helps align container to the input's actual space */
    margin: 0 auto;
}

#globalSearch {
    max-width: 100%;
    width: 50vw;
    margin: auto 10px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    font-size: 14px;
    outline: none;
    box-sizing: border-box; /* Includes padding in the 50vw calculation */
}

.search-results-container {
	display:none;
    position: fixed;       /* Stays in place even if you scroll */
    top: 60px;            /* Set this to the height of your topbar (e.g., 60px) */
    
    /* Center it horizontally */
    left: 50%;
    transform: translateX(-50%);
    
    /* Matches the exact width logic of your #globalSearch input */
    width: 50vw;
    max-width: 100%;
    
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0 0 12px 12px;
    
    max-height: 80dvh;
    overflow-y: auto;
    z-index: 10001;        /* Higher than the topbar */
    box-sizing: border-box;
}

#globalSearch::placeholder {
  color: rgba(255,255,255,0.6);
}

#globalSearch:focus {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.4);
}

/* hide topbar in fullscreen mode */
body.hide-recents .topbar {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}
.user {
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.scroll-invisible {
  overflow: auto;
height:100%;
  /* Firefox */
  scrollbar-width: none;

  /* Edge / IE legacy */
  -ms-overflow-style: none;
}

.scroll-invisible::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

/* Global scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(20, 20, 20, 0.5);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.add-app-btn {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 14px;
  background: rgba(255,255,255,0.10);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(16px);
  box-shadow: 0 10px 35px rgba(0,0,0,0.35);
}

.add-app-btn:hover {
  background: rgba(255,255,255,0.18);
}

.add-app-modal {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(18px);
  padding: 18px;
}

.add-app-card {
  width: min(420px, 100%);
  border-radius: 22px;
  background: rgba(18,20,30,0.92);
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: 0 35px 100px rgba(0,0,0,0.65);
  padding: 18px;
  color: white;
}

.add-app-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.add-app-title {
  font-size: 20px;
  font-weight: 700;
}

.add-app-subtitle {
  font-size: 13px;
  color: rgba(255,255,255,0.58);
  margin-top: 3px;
}

.add-app-close {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 12px;
  background: rgba(255,255,255,0.10);
  color: white;
  cursor: pointer;
}

.add-app-label {
  display: block;
  font-size: 13px;
  color: rgba(255,255,255,0.72);
  margin-bottom: 12px;
}

.add-app-label input {
  width: 100%;
  margin-top: 6px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 14px;
  background: rgba(255,255,255,0.08);
  color: white;
  padding: 12px 13px;
  outline: none;
}

.add-app-label input:focus {
  border-color: rgba(124,156,255,0.75);
  box-shadow: 0 0 0 3px rgba(124,156,255,0.16);
}

.add-app-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.add-app-check {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  color: rgba(255,255,255,0.78);
  margin: 4px 0 16px;
}

.add-app-submit {
  width: 100%;
  border: none;
  border-radius: 15px;
  padding: 13px;
  background: linear-gradient(135deg, #7c9cff, #9a7cff);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

.add-app-error {
  margin-top: 10px;
  min-height: 18px;
  color: #ff8a8a;
  font-size: 13px;
}

.delete-app-mode-btn {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 14px;
  background: rgba(255,255,255,0.10);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(16px);
  box-shadow: 0 10px 35px rgba(0,0,0,0.35);
  margin-right: 8px;
}

.delete-app-mode-btn:hover,
.delete-app-mode-btn.active {
  background: rgba(255,70,90,0.28);
  border-color: rgba(255,90,110,0.55);
}

.app {
  position: relative;
}

.custom-app-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 999px;
  background: rgba(255,55,75,0.95);
  color: white;
  font-size: 15px;
  font-weight: 800;
  line-height: 24px;
  text-align: center;
  cursor: pointer;
  z-index: 50;
  box-shadow: 0 8px 25px rgba(0,0,0,0.45);
}

.custom-app-delete:hover {
  background: rgba(255,20,45,1);
}

body.delete-app-mode .custom-added-app {
  outline: 1px solid rgba(255,80,100,0.45);
  box-shadow: 0 0 0 4px rgba(255,80,100,0.10);
}

.custom-app-edit {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 999px;
  background: rgba(80,130,255,0.92);
  color: white;
  cursor: pointer;
  z-index: 50;
  box-shadow: 0 8px 25px rgba(0,0,0,0.45);

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  padding: 0;
}

.edit-app-mode-btn {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 14px;
  background: rgba(255,255,255,0.10);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(16px);
  box-shadow: 0 10px 35px rgba(0,0,0,0.35);

  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin-left:5px;
}

.edit-app-mode-btn:hover,
.edit-app-mode-btn.active {
  background: rgba(80,130,255,0.28);
  border-color: rgba(80,130,255,0.65);
}

.custom-app-edit,
.custom-app-delete {
  position: absolute;
  top: 8px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.92);
  cursor: pointer;
  z-index: 50;
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.35);

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 13px;
  line-height: 1;
  padding: 0;
}

.custom-app-edit {
  left: 8px;
}

.custom-app-delete {
  right: 8px;
}

.custom-app-edit:hover {
  background: rgba(80,130,255,0.28);
  border-color: rgba(80,130,255,0.55);
}

.custom-app-delete:hover {
  background: rgba(255,70,90,0.28);
  border-color: rgba(255,90,110,0.55);
}
.profile-fixed-app {
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-fixed-icon {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
  font-size: 17px;
  line-height: 1;
}

.corner-profile-app {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
  backdrop-filter: blur(16px);
  box-shadow: 0 10px 35px rgba(0,0,0,0.35);
  cursor: pointer;
}

.corner-profile-app:hover {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.22);
}

.corner-profile-icon {
  display: block;
  opacity: 0.92;
}

.corner-profile-app {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;

  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
  backdrop-filter: blur(16px);
  box-shadow: 0 10px 35px rgba(0,0,0,0.35);
  cursor: pointer;
}

.corner-profile-app:hover {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.22);
}

.corner-profile-icon {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.corner-profile-icon svg {
  display: block;
}

.corner-profile-photo {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  object-fit: cover;
  display: block;
  border: 1px solid rgba(255,255,255,0.25);
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
}

.profile-mini-card {
  position: fixed;
  left: 18px;
  bottom: 76px;
  width: 245px;
  z-index: 12000;
  padding: 14px;
  border-radius: 18px;
  background: rgba(18,20,30,0.92);
  border: 1px solid rgba(255,255,255,0.14);
  backdrop-filter: blur(18px);
  box-shadow: 0 24px 70px rgba(0,0,0,0.55);
  color: white;
}

.profile-mini-head {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 12px;
}

.profile-mini-photo {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,0.25);
}

.profile-mini-name {
  font-size: 15px;
  font-weight: 700;
}

.profile-mini-username {
  font-size: 13px;
  color: rgba(255,255,255,0.58);
  margin-top: 2px;
}

.profile-mini-btn {
  width: 100%;
  border: none;
  border-radius: 13px;
  padding: 10px;
  margin-top: 8px;
  background: rgba(255,255,255,0.12);
  color: white;
  cursor: pointer;
}

.profile-mini-btn:hover {
  background: rgba(255,255,255,0.18);
}

.profile-mini-btn.secondary {
  background: rgba(255,255,255,0.07);
}

.corner-profile-app {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;

  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
  backdrop-filter: blur(16px);
  box-shadow: 0 10px 35px rgba(0,0,0,0.35);
  cursor: pointer;
}

.corner-profile-app:hover {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.22);
}

.corner-profile-icon {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.corner-profile-icon svg {
  display: block;
}

.corner-profile-photo {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  object-fit: cover;
  display: block;
  border: 1px solid rgba(255,255,255,0.25);
}

.profile-mini-card {
  position: fixed;
  left: 18px;
  bottom: 76px;
  width: 245px;
  z-index: 12000;
  padding: 14px;
  border-radius: 18px;
  background: rgba(18,20,30,0.92);
  border: 1px solid rgba(255,255,255,0.14);
  backdrop-filter: blur(18px);
  box-shadow: 0 24px 70px rgba(0,0,0,0.55);
  color: white;
}

.profile-mini-head {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 12px;
}

.profile-mini-photo {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,0.25);
}

.profile-mini-name {
  font-size: 15px;
  font-weight: 700;
}

.profile-mini-username {
  font-size: 13px;
  color: rgba(255,255,255,0.58);
  margin-top: 2px;
}

.profile-mini-btn {
  width: 100%;
  border: none;
  border-radius: 13px;
  padding: 10px;
  margin-top: 8px;
  background: rgba(255,255,255,0.12);
  color: white;
  cursor: pointer;
}

.profile-mini-btn:hover {
  background: rgba(255,255,255,0.18);
}

.edit-app-mode-btn {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 12px;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.75);
  cursor: pointer;
  transition: 
    background 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.edit-app-mode-btn.active {
  background: rgba(255, 193, 7, 0.22);
  color: #ffd54f;
  border-color: rgba(255, 213, 79, 0.75);
  box-shadow:
    0 0 0 2px rgba(255, 213, 79, 0.18),
    0 0 18px rgba(255, 213, 79, 0.45);
  transform: scale(1.06);
}

body.delete-app-mode .edit-app-mode-btn {
  animation: editPulse 1.4s ease-in-out infinite;
}

@keyframes editPulse {
  0%, 100% {
    box-shadow:
      0 0 0 2px rgba(255, 213, 79, 0.16),
      0 0 14px rgba(255, 213, 79, 0.35);
  }

  50% {
    box-shadow:
      0 0 0 4px rgba(255, 213, 79, 0.22),
      0 0 24px rgba(255, 213, 79, 0.65);
  }
}