/*
 * Platform primer: force HTML [hidden] closed.
 *
 * UA stylesheet is only `display: none` (no !important). Any author rule on the
 * same element — e.g. `.chip { display: inline-flex }` — wins and paints empty
 * bordered shells / dots. Whack-a-mole per component is the symptom; this is the
 * structural fix. Overlay race patterns that deliberately show while still
 * [hidden] (e.g. `.is-open[hidden]`) keep working via higher specificity +
 * !important on those overlays.
 */
[hidden] {
  display: none !important;
}

html {
  background-color: var(--uc-page-surface, var(--uc-primary-dark, #8b0000));
}

body {
      background-color: var(--uc-page-surface, var(--uc-primary-dark));
      background-image: linear-gradient(to right, var(--uc-primary-darker) 1px, transparent 1px),
        linear-gradient(to bottom, var(--uc-primary-darker) 1px, transparent 1px);
      background-size: 20px 20px;
      font-family: "Roboto", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
        "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
      color: var(--uc-text);
      transition: opacity 120ms ease, filter 120ms ease, background-color 140ms ease, background-image 140ms ease;
    }

/* Emoji/sticker glyphs — never rely on Roboto symbol faces (missing colour glyphs). */
.uc-emoji,
.uc-chat-sticker-glyph,
.uc-chat-sticker-tile-glyph,
.uc-chat-reaction-emoji,
.uc-profile-mood-emoji {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif;
}

body.uc-after-hours {
      background-color: var(--uc-page-surface, var(--uc-chrome));
      background-image: linear-gradient(to right, var(--uc-accent-wash) 1px, transparent 1px),
        linear-gradient(to bottom, var(--uc-accent-wash) 1px, transparent 1px);
      background-size: 20px 20px;
    }

html[data-uc-after-hours="1"] body {
      background-color: var(--uc-page-surface, var(--uc-chrome));
      background-image: linear-gradient(to right, var(--uc-accent-wash) 1px, transparent 1px),
        linear-gradient(to bottom, var(--uc-accent-wash) 1px, transparent 1px);
      background-size: 20px 20px;
    }

html.uc-transitioning body {
      background-color: var(--uc-transition-surface, var(--uc-chrome));
      background-image: linear-gradient(to right, rgba(255, 215, 0, 0.08) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 215, 0, 0.08) 1px, transparent 1px);
    }

body.uc-route-leaving {
      opacity: 0.84;
      filter: saturate(0.95);
    }

body.uc-route-enter {
      opacity: 0.92;
    }

body.uc-route-enter.uc-route-enter-active {
      opacity: 1;
      transition: opacity 140ms ease;
    }

.uc-shell-dock {
      position: fixed;
      right: 14px;
      bottom: 14px;
      z-index: 50;
  width: min(320px, calc(100vw - 16px));
      background: rgba(20, 20, 26, 0.92);
      border: 1px solid var(--uc-veil-soft);
      border-radius: 12px;
      box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
      padding: 8px 10px;
      color: var(--uc-text-on-primary);
      font-size: 11px;
      backdrop-filter: blur(4px);
    }

.uc-shell-dock-row {
      display: flex;
      align-items: center;
      gap: 8px;
      min-height: 28px;
    }

.uc-shell-dock-row + .uc-shell-dock-row {
      margin-top: 6px;
    }

.uc-shell-dock-btn {
      border: 1px solid var(--uc-veil-soft);
      background: var(--uc-primary);
      color: var(--uc-text-on-primary);
      border-radius: 999px;
      padding: 4px 10px;
      font-size: 10px;
      font-weight: 800;
      text-transform: uppercase;
      cursor: pointer;
      white-space: nowrap;
    }

.uc-shell-dock-btn-chat {
      background: var(--uc-chrome);
    }

.uc-shell-dock-btn-min {
  background: var(--uc-chrome);
  padding: 4px 9px;
  line-height: 1;
}

.uc-shell-track,
.uc-shell-chat-room {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      color: var(--uc-gold);
      font-weight: 700;
      flex: 1;
      min-width: 0;
    }

.uc-shell-unread {
      background: var(--uc-chrome);
      border: 1px solid var(--uc-veil-strong);
      border-radius: 999px;
      padding: 3px 8px;
      color: #fca5a5;
      font-weight: 800;
      white-space: nowrap;
    }

.uc-shell-dock.is-minimized {
  display: none;
}

.uc-shell-dock-launcher {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 51;
  display: none;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--uc-veil-soft);
  background: rgba(20, 20, 26, 0.92);
  color: var(--uc-text-on-primary);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
}

.uc-shell-dock.is-minimized + .uc-shell-dock-launcher {
  display: inline-flex;
}

@media (max-width: 900px) {
      .uc-shell-dock {
        right: 8px;
    width: min(320px, calc(100vw - 16px));
        bottom: 8px;
      }

  .uc-shell-dock-launcher {
    right: 8px;
    bottom: 8px;
  }
    }

/* ── Large screen scaling ────────────────────────── */
@media (min-width: 1440px) {
  html { font-size: 17px; }
}
@media (min-width: 1920px) {
  html { font-size: 19px; }
}
@media (min-width: 2560px) {
  html { font-size: 22px; }
}
@media (min-width: 3840px) {
  html { font-size: 26px; }
}

/* Extend Tailwind .container for large / ultra-wide monitors */
@media (min-width: 1920px) {
  .container { max-width: 1800px; }
}
@media (min-width: 2560px) {
  .container { max-width: 2000px; }
}
@media (min-width: 3840px) {
  .container { max-width: 2200px; }
}

/* ─── FOUC guard + page transitions ──────────────────────────────────────── */
/* body stays visibility:hidden (set inline in <head>) until JS adds .uc-ready  */

html.uc-transitioning {
  overflow: hidden;
}

html.uc-transitioning body {
  filter: saturate(0.98);
}

/* Keep the page alive during swaps, but make the motion feel gentle. */
@keyframes uc-leave-fade {
  from { opacity: 1; }
  to { opacity: 0.98; }
}

@keyframes uc-page-reveal {
  from { opacity: 0.985; }
  to { opacity: 1; }
}

#uc-slide-layer {
  will-change: opacity;
  backface-visibility: hidden;
  min-height: 100svh;
  background: transparent;
}

#uc-slide-layer.uc-leaving-fade {
  animation: uc-leave-fade 120ms ease-out both;
}

#uc-slide-layer.uc-entering-fade {
  animation: uc-page-reveal 140ms ease-out both;
}

html::before {
  content: "";
  position: fixed;
  left: 0;
  top: 0;
  z-index: 9998;
  width: 100vw;
  height: 3px;
  pointer-events: none;
  opacity: 0;
  background:
    linear-gradient(90deg,
      rgba(252, 211, 77, 0) 0%,
      var(--uc-accent-wash) 14%,
      rgba(252, 211, 77, 0.88) 48%,
      rgba(177, 34, 34, 0.92) 62%,
      rgba(252, 211, 77, 0.12) 84%,
      rgba(252, 211, 77, 0) 100%);
  background-size: 220% 100%;
  box-shadow: 0 0 0 1px var(--uc-shadow-ink-strong);
  transition: opacity 120ms ease;
}

html[data-uc-loading="1"]::before,
html.uc-transitioning::before {
  opacity: 1;
  animation: uc-topbar-flow 900ms linear infinite;
}

html.uc-ready::before,
html[data-uc-loading="0"]::before {
  opacity: 0;
  animation: none;
}

html::after {
  content: "";
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 9999;
  width: 54px;
  height: 54px;
  transform: translate(-50%, -50%) scale(0.96);
  opacity: 0;
  pointer-events: none;
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 50%, rgba(9, 11, 15, 0.98) 0 40%, transparent 42%),
    conic-gradient(from 0deg,
      rgba(252, 211, 77, 0.06) 0deg,
      var(--uc-gold) 82deg,
      var(--uc-primary) 168deg,
      var(--uc-accent-wash) 252deg,
      rgba(252, 211, 77, 0.06) 360deg);
  box-shadow:
    0 0 0 1px rgba(252, 211, 77, 0.28),
    0 0 0 5px var(--uc-scrim),
    0 0 18px rgba(252, 211, 77, 0.18),
    0 10px 20px var(--uc-shadow-ink-strong);
  transition: opacity 120ms ease, transform 120ms ease;
  animation: uc-loader-spin 900ms linear infinite;
  -webkit-mask: radial-gradient(circle, transparent 55%, #000 56%);
  mask: radial-gradient(circle, transparent 55%, #000 56%);
}

html[data-uc-loading="1"]::after,
html.uc-transitioning::after {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

html.uc-ready::after,
html[data-uc-loading="0"]::after {
  opacity: 0;
}

@keyframes uc-loader-spin {
  from { transform: translate(-50%, -50%) scale(1) rotate(0deg); }
  to { transform: translate(-50%, -50%) scale(1) rotate(360deg); }
}

@keyframes uc-topbar-flow {
  from { background-position: 0% 0; }
  to { background-position: 220% 0; }
}

/*
 * Platform viewport dialogs — true center on every screen size.
 *
 * Nested dialogs under page shells (#page-profile, #uc-slide-layer, trippy
 * cards) get clipped or fixed-containing-block mis-centering. Prefer hosting
 * these nodes on document.body (ucHostPlatformOverlays). These rules force
 * viewport geometry + midpoint centering regardless of prior sheet styles.
 */
:root {
  --uc-overlay-pad-top: max(16px, env(safe-area-inset-top, 0px));
  --uc-overlay-pad-x: max(16px, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
  --uc-overlay-pad-bottom: max(16px, env(safe-area-inset-bottom, 0px));
  --uc-overlay-card-max: min(
    88dvh,
    calc(100dvh - var(--uc-overlay-pad-top) - var(--uc-overlay-pad-bottom) - 8px)
  );
}

/* Visible shells only — keeps .hidden / closed defaults intact */
.uc-scroll-modal-overlay:not(.hidden),
.uc-album-upload-modal:not(.hidden),
.uc-album-lightbox:not(.hidden),
.uc-album-modal:not(.hidden),
.uc-circles-create-overlay:not(.hidden),
.uc-residency-gate-overlay:not(.hidden),
.uc-experts-board-overlay:not(.hidden),
.uc-experts-apply-overlay:not(.hidden),
.uc-expert-vote-overlay:not(.hidden),
.uc-linkup-gate:not(.hidden):not([hidden]),
.uc-share-overlay.is-open,
.uc-porch-edit-overlay.is-open,
.uc-invite-overlay.is-open,
.uc-room-share-overlay.is-open,
.uc-pulse-overlay.is-open,
.uc-help-overlay.is-open,
.uc-safety-overlay.is-open,
#uc-profile-peek.uc-profile-peek.is-open,
#uc-track-peek.uc-track-peek.is-open {
  position: fixed !important;
  inset: 0 !important;
  left: 0 !important;
  right: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-height: 100dvh !important;
  margin: 0 !important;
  display: flex !important;
  align-items: center !important;
  align-items: safe center;
  justify-content: center !important;
  padding: var(--uc-overlay-pad-top) var(--uc-overlay-pad-x) var(--uc-overlay-pad-bottom) !important;
  box-sizing: border-box !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  transform: none !important;
}

/* Cards: keep midpoint when content is short or taller than the viewport */
.uc-scroll-modal-card,
.uc-album-upload-card,
.uc-album-lightbox-card,
.uc-album-modal-card,
.uc-circles-create-card,
.uc-residency-gate-card,
.uc-experts-board-card,
.uc-experts-apply-card,
.uc-expert-vote-card,
.uc-share-overlay__card,
.uc-porch-edit-panel,
.uc-invite-overlay__card,
.uc-room-share-overlay__card,
.uc-pulse-overlay__card,
.uc-help-overlay__panel,
.uc-safety-overlay__panel,
.uc-profile-peek__panel,
.uc-track-peek__panel,
.uc-linkup-gate-panel {
  margin: auto !important;
  flex-shrink: 0;
  max-height: var(--uc-overlay-card-max);
  box-sizing: border-box;
}

/* Scrollable overlays — phones, tablets, desktops */
.uc-scroll-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--uc-overlay-pad-top) var(--uc-overlay-pad-x) var(--uc-overlay-pad-bottom);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(8px);
  box-sizing: border-box;
}

.uc-scroll-modal-overlay.hidden {
  display: none !important;
}

.uc-scroll-modal-card {
  width: 100%;
  max-width: 32rem;
  max-height: var(--uc-overlay-card-max);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  margin: auto;
  flex-shrink: 0;
  border-radius: 1rem;
  background: var(--uc-surface);
}

body.uc-scroll-modal-open {
  overflow: hidden;
}
