/* Lankagram — Sri Lanka mobile-first social UI */

:root {
  color-scheme: light;

  /* Brand accents (shared) */
  --lg-ocean: #0077a8;
  --lg-ocean-deep: #045a7e;
  --lg-lagoon: #0aa5c2;
  --lg-palm: #1b6b4a;
  --lg-coral: #e85d4c;
  --lg-gold: #d4a017;

  /* Semantic surfaces & text — light */
  --lg-bg: #eef5f8;
  --lg-bg-accent: #f7fafb;
  --lg-bg-elevated: #f4f7f9;
  --lg-surface: #ffffff;
  --lg-surface-2: #fbfdfe;
  --lg-surface-glass: rgba(255, 255, 255, 0.92);
  --lg-chrome: rgba(255, 255, 255, 0.88);
  --lg-chrome-strong: rgba(255, 255, 255, 0.96);
  --lg-text: #12171c;
  --lg-text-muted: #5a6570;
  --lg-text-inverse: #ffffff;
  --lg-border: #dde5ec;
  --lg-border-strong: #cfd8e0;
  --lg-overlay: rgba(8, 20, 28, 0.45);
  --lg-glow-lagoon: rgba(10, 165, 194, 0.12);
  --lg-glow-palm: rgba(27, 107, 74, 0.08);
  --lg-theme-meta: #0077a8;
  --lg-surface-selected: #f3fafc;
  --lg-surface-hover: #eaf0f4;
  --lg-surface-danger: #fff7f6;
  --lg-surface-danger-border: #f3d0cb;
  --lg-surface-danger-border-strong: #f0cfc9;
  --lg-surface-danger-icon: #ffe8e4;
  --lg-surface-muted: #e8f2f6;
  --lg-control-border: #b7c5d0;
  --lg-control-border-hover: #c5d5df;
  --lg-border-glass: rgba(221, 229, 236, 0.9);
  --lg-surface-pressed: rgba(4, 40, 60, 0.04);
  --lg-badge-neutral: rgba(0, 0, 0, 0.06);
  --lg-shadow-up: 0 -8px 24px rgba(4, 40, 60, 0.06);

  /* Legacy aliases → semantic (existing rules pick up themes) */
  --lg-ink: var(--lg-text);
  --lg-ink-soft: var(--lg-text-muted);
  --lg-mist: var(--lg-bg-elevated);
  --lg-line: var(--lg-border);
  --lg-white: var(--lg-surface);

  --lg-radius: 14px;
  /* Content row only — safe area is padding, not double-counted in height math for children */
  --lg-tab-content: 52px;
  --lg-tab-h: calc(var(--lg-tab-content) + env(safe-area-inset-bottom, 0px));
  --lg-top-h: 56px;
  --lg-tap: 44px;
  --lg-font: "Figtree", system-ui, sans-serif;
  --lg-display: "Syne", "Figtree", sans-serif;
  --lg-shadow: 0 10px 36px rgba(4, 60, 90, 0.07);
  --lg-shadow-strong: 0 12px 40px rgba(4, 40, 60, 0.16), 0 2px 8px rgba(4, 40, 60, 0.06);
  --lg-max: 540px;
  --lg-focus: 0 0 0 2px var(--lg-surface), 0 0 0 4px var(--lg-lagoon);
  --lg-space-1: 4px;
  --lg-space-2: 8px;
  --lg-space-3: 12px;
  --lg-space-4: 16px;
}

html[data-theme="dark"] {
  color-scheme: dark;

  --lg-ocean: #3db4e0;
  --lg-ocean-deep: #7ec8e8;
  --lg-lagoon: #2ec4d6;
  --lg-palm: #3d9b6e;
  --lg-coral: #f07167;
  --lg-gold: #e0b33f;

  --lg-bg: #0b1216;
  --lg-bg-accent: #0e161c;
  --lg-bg-elevated: #151e26;
  --lg-surface: #121a22;
  --lg-surface-2: #18222c;
  --lg-surface-glass: rgba(18, 26, 34, 0.96);
  --lg-chrome: rgba(18, 26, 34, 0.9);
  --lg-chrome-strong: rgba(18, 26, 34, 0.97);
  --lg-text: #f2f5f7;
  --lg-text-muted: #a8b3bd;
  --lg-text-inverse: #0b1216;
  --lg-border: #2a3540;
  --lg-border-strong: #3a4652;
  --lg-overlay: rgba(0, 0, 0, 0.62);
  --lg-glow-lagoon: rgba(46, 196, 214, 0.14);
  --lg-glow-palm: rgba(61, 155, 110, 0.1);
  --lg-theme-meta: #0b1216;
  --lg-surface-selected: #152530;
  --lg-surface-hover: #1e2830;
  --lg-surface-danger: #2a1816;
  --lg-surface-danger-border: #4a2824;
  --lg-surface-danger-border-strong: #5a3028;
  --lg-surface-danger-icon: #3a201c;
  --lg-surface-muted: #152028;
  --lg-control-border: #4a5660;
  --lg-control-border-hover: #5a6874;
  --lg-border-glass: rgba(42, 53, 64, 0.9);
  --lg-surface-pressed: rgba(255, 255, 255, 0.06);
  --lg-badge-neutral: rgba(255, 255, 255, 0.08);
  --lg-shadow-up: 0 -8px 24px rgba(0, 0, 0, 0.35);

  --lg-shadow: 0 10px 36px rgba(0, 0, 0, 0.45);
  --lg-shadow-strong: 0 12px 40px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
  --lg-focus: 0 0 0 2px var(--lg-surface), 0 0 0 4px var(--lg-lagoon);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  background: var(--lg-bg);
}

.lg-sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

body {
  margin: 0;
  font-family: var(--lg-font);
  color: var(--lg-text);
  background:
    radial-gradient(1200px 600px at 10% -10%, var(--lg-glow-lagoon), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, var(--lg-glow-palm), transparent 50%),
    linear-gradient(180deg, var(--lg-bg) 0%, var(--lg-bg-elevated) 40%, var(--lg-bg-accent) 100%);
  min-height: 100dvh;
  line-height: 1.45;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  cursor: pointer;
  border: 0;
  background: none;
  color: inherit;
}

.lg-app {
  max-width: var(--lg-max);
  margin: 0 auto;
  min-height: 100dvh;
  position: relative;
  /* Opaque shell — no backdrop-filter/filter/transform here: those create a
     containing block and break position:fixed chrome (tabbar, join bar). */
  background: var(--lg-surface-glass);
  box-shadow: var(--lg-shadow);
  color: var(--lg-text);
}

/* Top bar */
.lg-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--lg-top-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 0 14px;
  padding-top: env(safe-area-inset-top, 0);
  background: var(--lg-chrome);
  backdrop-filter: blur(20px) saturate(1.25);
  -webkit-backdrop-filter: blur(20px) saturate(1.25);
  border-bottom: 1px solid var(--lg-border);
}

.lg-brand {
  display: flex;
  align-items: center;
  gap: 9px;
}

.lg-brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: block;
  flex-shrink: 0;
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(0, 119, 168, 0.22);
}

.lg-brand-text {
  font-family: var(--lg-display);
  font-weight: 800;
  font-size: 1.32rem;
  letter-spacing: -0.03em;
  background: linear-gradient(120deg, var(--lg-ocean-deep), var(--lg-lagoon) 55%, var(--lg-palm));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

@keyframes lg-spin-slow {
  to {
    transform: rotate(360deg);
  }
}

@keyframes lg-brand-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.lg-topbar .lg-brand {
  animation: lg-brand-in 0.35s ease both;
}

.lg-topbar-actions {
  display: flex;
  gap: 4px;
}

.lg-icon-btn {
  position: relative;
  width: var(--lg-tap);
  height: var(--lg-tap);
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: var(--lg-ink);
  transition: background 0.2s, transform 0.15s, color 0.15s;
}

.lg-icon-btn:hover {
  background: var(--lg-mist);
  color: var(--lg-ocean);
}

.lg-icon-btn:active {
  transform: scale(0.92);
  background: var(--lg-line);
}

.lg-icon-btn.is-active {
  color: var(--lg-ocean-deep);
  background: rgba(0, 119, 168, 0.08);
}

.lg-icon {
  display: block;
  flex-shrink: 0;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lg-icon-sm {
  width: 18px;
  height: 18px;
}

.lg-tab-ico,
.lg-top-ico {
  position: relative;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
}

.lg-tab-ico .lg-icon,
.lg-top-ico .lg-icon {
  grid-area: 1 / 1;
}

.lg-tab-ico .lg-ico-fill,
.lg-top-ico .lg-ico-fill {
  opacity: 0;
  transform: scale(0.86);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.lg-tab-ico .lg-ico-outline,
.lg-top-ico .lg-ico-outline {
  opacity: 1;
  transition: opacity 0.18s ease;
}

.lg-tab-ico .lg-tab-badge {
  top: -4px;
  right: -10px;
  min-width: 15px;
  height: 15px;
  font-size: 9px;
  z-index: 1;
}

.lg-tab.is-active .lg-ico-fill,
.lg-icon-btn.is-active .lg-ico-fill {
  opacity: 1;
  transform: scale(1);
}

.lg-tab.is-active .lg-ico-outline,
.lg-icon-btn.is-active .lg-ico-outline {
  opacity: 0;
}

.lg-tab.is-active {
  color: var(--lg-ocean-deep);
}

.lg-settings-ico.is-danger {
  background: var(--lg-surface-danger-icon);
  color: var(--lg-coral);
}

.lg-action .lg-icon {
  transition: transform 0.15s ease;
}

.lg-action:active .lg-icon {
  transform: scale(0.88);
}

.lg-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 99px;
  background: var(--lg-coral);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

/* Main */
.lg-main {
  padding: 0 0 calc(var(--lg-tab-h) + 8px);
  min-height: calc(100dvh - var(--lg-top-h));
}

.lg-main-flush {
  padding-left: 0;
  padding-right: 0;
}

/* Tab bar — viewport-fixed chrome (must live outside transformed/filtered ancestors) */
.lg-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: min(100%, var(--lg-max));
  margin-inline: auto;
  height: var(--lg-tab-h);
  padding: 0 2px env(safe-area-inset-bottom, 0px);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: stretch;
  background: var(--lg-chrome-strong);
  backdrop-filter: blur(22px) saturate(1.2);
  -webkit-backdrop-filter: blur(22px) saturate(1.2);
  border-top: 1px solid var(--lg-border);
  z-index: 50;
  box-shadow: 0 -6px 24px rgba(4, 60, 90, 0.045);
  /* Keep above infinite-scroll content; never participate in document flow */
  pointer-events: auto;
}

.lg-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10px;
  font-weight: 650;
  line-height: 1.1;
  color: var(--lg-ink-soft);
  height: var(--lg-tab-content);
  min-height: var(--lg-tab-content);
  padding: 0;
  white-space: nowrap;
  transition: color 0.2s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.lg-tab:hover {
  color: var(--lg-ocean);
}

.lg-tab:active {
  transform: scale(0.92);
}

.lg-tab-create {
  margin-top: 0;
}

.lg-create-orb {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, var(--lg-lagoon), var(--lg-ocean-deep));
  box-shadow: 0 4px 12px rgba(0, 119, 168, 0.28);
  transition: transform 0.15s, box-shadow 0.15s;
}

.lg-tab-create:active .lg-create-orb {
  transform: scale(0.94);
}

.lg-tab-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--lg-ocean);
}

/* Avatars */
.lg-avatar-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(145deg, #c8e8f0, #9fd4c0);
  color: var(--lg-ocean-deep);
  font-weight: 700;
  font-size: 1rem;
}

.lg-avatar-fallback.sm {
  width: 36px;
  height: 36px;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.lg-avatar-fallback.lg {
  font-size: 2rem;
}

.lg-avatar-img.sm {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

/* Stories */
.lg-stories {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 14px 14px 10px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.lg-stories::-webkit-scrollbar {
  display: none;
}

.lg-story-chip {
  flex: 0 0 auto;
  width: 72px;
  text-align: center;
  font-size: 11px;
  color: var(--lg-ink-soft);
}

.lg-story-label {
  display: block;
  margin-top: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lg-story-ring {
  position: relative;
  display: block;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  padding: 3px;
  background: var(--lg-line);
  margin: 0 auto;
}

.lg-story-ring.has-story {
  background: linear-gradient(135deg, var(--lg-coral), var(--lg-gold), var(--lg-lagoon));
  animation: lg-ring-glow 2.4s ease-in-out infinite;
}

.lg-story-ring.seen {
  background: #b8c4ce;
}

.lg-story-ring.sm {
  width: 40px;
  height: 40px;
  padding: 2px;
}

.lg-story-ring.lg {
  width: 92px;
  height: 92px;
  padding: 3px;
}

.lg-story-ring img,
.lg-story-ring .lg-avatar-fallback {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--lg-white);
}

@keyframes lg-ring-glow {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.12);
  }
}

.lg-story-plus {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--lg-ocean);
  color: #fff;
  border: 2px solid #fff;
  display: grid;
  place-items: center;
}

.lg-story-plus .lg-icon {
  width: 12px;
  height: 12px;
}

/* Feed / posts */
.lg-post {
  background: var(--lg-white);
  border-block: 1px solid var(--lg-line);
  margin-bottom: 12px;
  animation: lg-rise 0.45s ease both;
}

@keyframes lg-rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.lg-post-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
}

.lg-post-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.lg-post-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}

.lg-post-meta strong {
  font-size: 0.93rem;
  letter-spacing: -0.01em;
}

.lg-loc {
  font-size: 0.75rem;
  color: var(--lg-ink-soft);
}

.lg-post-head time {
  font-size: 0.74rem;
  color: var(--lg-ink-soft);
}

.lg-post-media {
  position: relative;
  width: 100%;
  background: #0d1520;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

/* Instagram: frame matches photo aspect (clamped 4:5 … 1.91:1 via --lg-media-ar) */
.lg-post-media.has-ar {
  aspect-ratio: var(--lg-media-ar);
}

.lg-post-media.has-ar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* Legacy posts without stored dimensions — show full image (no square crop) */
.lg-post-media:not(.has-ar) img {
  width: 100%;
  height: auto;
  display: block;
}

/* Twitter-style text posts */
.lg-post-text {
  position: relative;
  padding: 4px 18px 20px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  background:
    linear-gradient(165deg, rgba(10, 165, 194, 0.07), transparent 60%),
    var(--lg-white);
}

.lg-post-text-body {
  margin: 0;
  font-family: var(--lg-display);
  font-size: clamp(1.18rem, 3.8vw, 1.5rem);
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.34;
  color: var(--lg-ink);
  white-space: pre-wrap;
  word-break: break-word;
}

.lg-post.is-text .lg-post-body {
  padding-top: 2px;
}

.lg-post-text .lg-heart-burst {
  color: var(--lg-coral);
  filter: drop-shadow(0 6px 16px rgba(232, 93, 76, 0.35));
}

.lg-heart-burst {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.4);
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.35));
}

.lg-heart-burst.is-pop {
  animation: lg-heart-pop 0.7s cubic-bezier(0.2, 0.9, 0.3, 1.3) forwards;
}

@keyframes lg-heart-pop {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  35% {
    opacity: 1;
    transform: scale(1.15);
  }
  100% {
    opacity: 0;
    transform: scale(1);
  }
}

.lg-post-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 8px 8px 0 6px;
}

.lg-action {
  width: var(--lg-tap);
  height: var(--lg-tap);
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--lg-ink);
  transition: transform 0.15s, background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.lg-action:hover {
  background: var(--lg-mist);
  color: var(--lg-ocean);
}

.lg-action:active {
  transform: scale(0.88);
}

.share-btn .lg-icon {
  /* Instagram paper-plane tilt */
  transform: translate(1px, -1px) rotate(8deg);
}

.share-btn.is-copied {
  color: var(--lg-palm);
}

.share-btn.is-pop {
  animation: lg-like-bounce 0.35s ease;
}

.like-btn .heart-fill {
  display: none;
  color: var(--lg-coral);
}

.like-btn.is-liked .heart-outline {
  display: none;
}

.like-btn.is-liked .heart-fill {
  display: block;
  animation: lg-like-bounce 0.35s ease;
}

@keyframes lg-like-bounce {
  0% {
    transform: scale(0.6);
  }
  60% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

.lg-post-body {
  padding: 6px 14px 12px;
}

.lg-likes {
  margin: 0 0 4px;
  font-size: 0.9rem;
}

.lg-caption {
  margin: 0;
  font-size: 0.92rem;
}

.lg-caption a {
  margin-right: 4px;
}

.lg-view-comments {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.85rem;
  color: var(--lg-ink-soft);
}

.lg-comment-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 12px;
  border-top: 1px solid var(--lg-line);
  background: var(--lg-chrome-strong);
}

.lg-comment-form-sticky {
  position: sticky;
  bottom: var(--lg-tab-h);
  z-index: 20;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--lg-shadow-up);
}

.lg-comment-post-btn:disabled {
  opacity: 0.35;
  pointer-events: none;
}

.lg-comment-input {
  flex: 1;
  border: 0 !important;
  background: transparent !important;
  padding: 8px 0 !important;
  box-shadow: none !important;
}

.lg-link-btn {
  color: var(--lg-ocean);
  font-weight: 700;
  font-size: 0.9rem;
  min-height: 40px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  border-radius: 10px;
  transition: background 0.15s, color 0.15s;
}

.lg-link-btn:hover {
  background: rgba(0, 119, 168, 0.08);
}

/* Buttons & forms */
.lg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--lg-tap);
  padding: 0 18px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.95rem;
  border: 0;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s, filter 0.15s;
}

.lg-btn:hover {
  filter: brightness(1.04);
}

.lg-btn:active {
  transform: scale(0.97);
}

.lg-btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--lg-lagoon), var(--lg-ocean-deep));
  box-shadow: 0 8px 20px rgba(0, 119, 168, 0.28);
}

.lg-btn-primary:hover {
  box-shadow: 0 10px 24px rgba(0, 119, 168, 0.34);
}

.lg-btn-ghost {
  background: var(--lg-mist);
  border: 1px solid var(--lg-line);
  color: var(--lg-ink);
}

.lg-btn-ghost:hover {
  background: var(--lg-surface-hover);
  border-color: var(--lg-border-strong);
}

.lg-btn-danger {
  color: #fff;
  background: var(--lg-coral);
}

.lg-btn-danger:hover {
  filter: brightness(1.05);
}

.lg-btn-block {
  width: 100%;
  margin-top: 10px;
}

.lg-btn:focus-visible,
.lg-icon-btn:focus-visible,
.lg-action:focus-visible,
.lg-tab:focus-visible,
.lg-back:focus-visible,
.lg-link-btn:focus-visible,
.lg-sheet-close:focus-visible,
.lg-chat-attach:focus-visible,
.lg-menu-panel a:focus-visible,
.lg-menu-panel button:focus-visible,
.lg-post-menu > .lg-icon-btn:focus-visible,
.lg-chat-menu > .lg-icon-btn:focus-visible,
.lg-comment-menu > .lg-icon-btn:focus-visible,
.lg-manage-menu > .lg-icon-btn:focus-visible,
.lg-feed-mode:focus-visible {
  outline: none;
  box-shadow: var(--lg-focus);
}

.lg-input,
.lg-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="image"]),
.lg-form textarea,
.lg-form select {
  width: 100%;
  border: 1px solid var(--lg-line);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--lg-white);
  font: inherit;
  color: var(--lg-ink);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.lg-input:focus,
.lg-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):not([type="submit"]):not([type="button"]):not([type="reset"]):focus,
.lg-form textarea:focus,
.lg-form select:focus {
  border-color: var(--lg-lagoon);
  box-shadow: 0 0 0 3px rgba(10, 165, 194, 0.18);
}

.lg-textarea {
  resize: vertical;
  min-height: 88px;
}

.lg-compose {
  padding: 10px 16px 28px;
}

.lg-compose-post .lg-compose-author {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0 4px;
}

.lg-compose-post .lg-compose-author img,
.lg-compose-post .lg-compose-author .lg-avatar-fallback {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.lg-compose-author-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.lg-compose-author-meta strong {
  font-size: 0.95rem;
  line-height: 1.2;
}

.lg-compose-author-meta span {
  color: var(--lg-ink-soft);
  font-size: 0.8rem;
}

.lg-compose-body {
  margin: 4px 0 8px;
}

.lg-compose-text {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 8px 0 !important;
  min-height: 120px !important;
  font-family: var(--lg-display) !important;
  font-size: 1.25rem !important;
  font-weight: 550 !important;
  letter-spacing: -0.02em !important;
  line-height: 1.4 !important;
  resize: none;
}

.lg-compose-text:focus {
  outline: none !important;
}

.lg-compose-photo.is-optional {
  min-height: 120px;
  margin: 8px 0 12px;
  border-style: dashed;
}

.lg-compose-photo.is-optional .lg-dropzone-inner {
  min-height: 110px;
  gap: 4px;
}

.lg-compose-photo.is-optional .lg-dropzone-inner strong {
  font-size: 0.92rem;
}

.lg-compose-photo.is-optional .lg-dropzone-inner span:not(.lg-drop-icon) {
  font-size: 0.78rem;
  color: var(--lg-ink-soft);
}

.lg-compose-meta {
  margin-bottom: 8px;
}

.lg-edit-text-preview {
  margin: 8px 16px 16px;
  padding: 14px 16px;
  border-radius: 14px;
  background:
    linear-gradient(160deg, rgba(10, 165, 194, 0.1), transparent 70%),
    var(--lg-mist);
  font-family: var(--lg-display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.35;
  white-space: pre-wrap;
}

.lg-manage-thumb.is-text {
  background:
    linear-gradient(160deg, rgba(10, 165, 194, 0.16), rgba(27, 107, 74, 0.1)),
    var(--lg-surface-muted);
  display: flex;
  align-items: flex-end;
  padding: 10px;
  aspect-ratio: 1;
  overflow: hidden;
}

.lg-settings-done:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.lg-compose h1,
.lg-page-title {
  font-family: var(--lg-display);
  font-size: 1.55rem;
  margin: 8px 0 6px;
  letter-spacing: -0.03em;
}

.lg-page-head {
  display: grid;
  grid-template-columns: var(--lg-tap) 1fr var(--lg-tap);
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  min-height: calc(var(--lg-tap) + 4px);
}

.lg-back {
  display: grid;
  place-items: center;
  width: var(--lg-tap);
  height: var(--lg-tap);
  border-radius: 12px;
  color: var(--lg-ocean-deep);
  transition: background 0.15s, color 0.15s;
}

.lg-back:hover {
  background: var(--lg-mist);
  color: var(--lg-ocean);
}

.lg-page-head.is-sticky {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--lg-chrome);
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  border-bottom: 1px solid var(--lg-border-glass);
}

.lg-page-head h1 {
  font-family: var(--lg-display);
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  margin: 0;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lg-page-head-spacer {
  width: var(--lg-tap);
  height: var(--lg-tap);
}

.lg-page-head-link {
  justify-self: end;
  padding-right: 4px;
  font-weight: 700;
}

.lg-page-lede {
  margin: 0 16px 12px;
  font-size: 0.88rem;
  color: var(--lg-ink-soft);
  line-height: 1.4;
}

.lg-dm-subnav {
  display: flex;
  justify-content: flex-end;
  padding: 0 16px 4px;
}

.lg-dm-footer {
  padding: 8px 16px 28px;
  border-top: 1px solid var(--lg-line);
  margin-top: 8px;
}

.lg-dm-footer-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 650;
  color: var(--lg-ocean);
  padding: 10px 0;
}

.lg-dm-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--lg-ocean);
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(0, 119, 168, 0.15);
}

.lg-dm-row.is-unread .lg-dm-top strong {
  font-weight: 750;
}

.lg-search-back {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.lg-lede {
  color: var(--lg-ink-soft);
  margin: 0 0 18px;
}

.lg-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lg-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--lg-ink-soft);
  margin-bottom: -6px;
}

.lg-dropzone {
  display: block;
  position: relative;
  border: 2px dashed #a9c4d2;
  border-radius: calc(var(--lg-radius) + 2px);
  min-height: 240px;
  background:
    linear-gradient(160deg, rgba(10, 165, 194, 0.09), rgba(27, 107, 74, 0.06)),
    var(--lg-white);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.lg-dropzone:hover,
.lg-dropzone:focus-within {
  border-color: var(--lg-lagoon);
  box-shadow: 0 0 0 3px rgba(10, 165, 194, 0.12);
}

.lg-dropzone-inner {
  min-height: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--lg-ink-soft);
  text-align: center;
  padding: 16px;
}

.lg-drop-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: rgba(0, 119, 168, 0.1);
  color: var(--lg-ocean);
  margin-bottom: 6px;
}

.lg-dropzone-inner img {
  width: 100%;
  height: auto;
  max-height: min(70vh, 560px);
  object-fit: contain;
  object-position: center;
  background: #0d1520;
  display: block;
}

.lg-file-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.lg-input-prefix {
  display: flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--lg-line);
  border-radius: 12px;
  padding-left: 12px;
  background: var(--lg-surface);
}

.lg-input-prefix input {
  border: 0 !important;
  box-shadow: none !important;
}

.lg-check-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 4px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--lg-ink);
  user-select: none;
}

.lg-check-inline .lg-checkbox,
.lg-check-inline input[type="checkbox"] {
  margin: 0;
  flex-shrink: 0;
}

.lg-check-inline-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  line-height: 1.3;
}

.lg-check-inline-label small {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--lg-ink-soft);
}

.lg-check-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 12px;
  margin-bottom: 4px;
  border-radius: 14px;
  background: var(--lg-surface);
  border: 1px solid var(--lg-line);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
}

.lg-check-row:has(input:checked) {
  border-color: var(--lg-ocean);
  background: var(--lg-surface-selected);
  box-shadow: inset 0 0 0 1px var(--lg-ocean);
}

.lg-check-row.has-error {
  border-color: var(--lg-coral);
}

.lg-form-errors {
  color: var(--lg-coral);
  font-size: 0.88rem;
}

/* Explore / grid */
.lg-search {
  margin: 12px 14px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  min-height: 46px;
  background: var(--lg-surface);
  border: 1px solid var(--lg-line);
  border-radius: 14px;
  box-shadow: 0 1px 0 rgba(4, 60, 90, 0.03);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.lg-search:focus-within {
  border-color: rgba(10, 165, 194, 0.55);
  box-shadow: 0 0 0 3px rgba(10, 165, 194, 0.14);
}

.lg-search input {
  border: 0 !important;
  box-shadow: none !important;
  padding-left: 0 !important;
  font-size: 0.95rem;
}

.lg-suggest {
  padding: 4px 0 14px;
}

.lg-suggest h2 {
  font-size: 0.92rem;
  letter-spacing: -0.01em;
  color: var(--lg-ink);
  margin: 0 16px 12px;
  font-weight: 700;
}

.lg-suggest-rail {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 2px 16px 6px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.lg-suggest-rail::-webkit-scrollbar {
  display: none;
}

.lg-suggest-card {
  flex: 0 0 148px;
  width: 148px;
  scroll-snap-align: start;
  background: var(--lg-surface);
  border: 1px solid var(--lg-line);
  border-radius: 16px;
  padding: 16px 12px 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  box-shadow: 0 1px 0 rgba(4, 60, 90, 0.03);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  color: inherit;
  text-decoration: none;
}

.lg-suggest-card:hover {
  border-color: rgba(0, 119, 168, 0.28);
  box-shadow: 0 8px 20px rgba(4, 60, 90, 0.06);
}

.lg-suggest-card:active {
  transform: scale(0.98);
}

.lg-suggest-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  gap: 6px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.lg-suggest-avatar {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 2px;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(10, 165, 194, 0.22), rgba(27, 107, 74, 0.16)),
    var(--lg-bg-elevated);
  box-shadow: 0 0 0 1px var(--lg-border);
}

.lg-suggest-avatar img,
.lg-suggest-avatar .lg-avatar-fallback {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  display: grid;
  place-items: center;
  margin: 0;
  flex-shrink: 0;
}

.lg-suggest-avatar .lg-avatar-fallback {
  font-size: 1.35rem;
  line-height: 1;
}

.lg-suggest-name {
  display: block;
  width: 100%;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.lg-suggest-meta {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-clamp: 2;
  overflow: hidden;
  width: 100%;
  min-height: 2.2em;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--lg-ink-soft);
  text-align: center;
}

.lg-suggest-follow,
.lg-suggest-card > .lg-btn-mini {
  width: 100%;
  margin-top: auto;
}

.lg-suggest-follow .lg-btn-mini,
.lg-suggest-card > .lg-btn-mini {
  width: 100%;
}

.lg-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
}

.lg-grid-item {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: #111;
  content-visibility: auto;
  contain-intrinsic-size: auto 120px;
}

.lg-grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.lg-grid-item:hover img,
.lg-grid-item:active img {
  transform: scale(1.04);
}

.lg-grid-item.is-text {
  background:
    linear-gradient(160deg, rgba(10, 165, 194, 0.16), rgba(27, 107, 74, 0.1)),
    var(--lg-surface-muted);
  display: flex;
  align-items: flex-end;
  padding: 10px;
}

.lg-grid-text {
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--lg-ink);
  font-family: var(--lg-display);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.3;
  width: 100%;
}

.lg-grid-item.is-text .lg-grid-overlay {
  background: rgba(8, 24, 32, 0.4);
}

.lg-grid-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(10, 30, 40, 0.45);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  opacity: 0;
  transition: opacity 0.2s;
}

.lg-grid-stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.lg-grid-stat .lg-icon {
  color: #fff;
}

.lg-grid-item:hover .lg-grid-overlay {
  opacity: 1;
}

/* Profile */
.lg-profile {
  padding: 0 16px 10px;
  background: var(--lg-chrome);
}

.lg-profile-nav {
  margin: 0 -16px 8px;
}

.lg-profile-hero {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-top: 10px;
}

.lg-profile-stats {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  text-align: center;
  gap: 4px;
}

.lg-profile-stat {
  display: block;
  color: inherit;
  text-decoration: none;
  border-radius: 12px;
  padding: 6px 4px;
  transition: background 0.15s ease, transform 0.12s ease;
}

a.lg-profile-stat:active {
  background: var(--lg-surface-pressed);
  transform: scale(0.98);
}

.lg-profile-stat.is-locked {
  pointer-events: none;
}

.lg-profile-stats strong {
  display: block;
  font-size: 1.18rem;
  font-family: var(--lg-display);
  letter-spacing: -0.02em;
}

.lg-profile-stats span {
  font-size: 0.72rem;
  color: var(--lg-ink-soft);
  font-weight: 550;
}

button.lg-avatar-open {
  border: 0;
  padding: 0;
  cursor: zoom-in;
  background: transparent;
  font: inherit;
  color: inherit;
}

.lg-profile-avatar-wrap .lg-story-ring.lg {
  margin: 0;
}

.lg-profile-people-sub {
  margin: 0 16px 8px;
  color: var(--lg-ink-soft);
  font-size: 0.85rem;
}

.lg-pagination {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px 24px;
}

.lg-avatar-viewer[hidden] {
  display: none !important;
}

.lg-avatar-viewer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}

.lg-avatar-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 18, 0.88);
  backdrop-filter: blur(10px);
}

.lg-avatar-viewer-close {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 2;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.lg-avatar-viewer-figure {
  position: relative;
  z-index: 1;
  margin: 0;
  width: min(92vw, 420px);
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  animation: lg-avatar-pop 0.28s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.lg-avatar-viewer-figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@keyframes lg-avatar-pop {
  from {
    opacity: 0;
    transform: scale(0.86);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

body.lg-avatar-viewer-open {
  overflow: hidden;
}

.lg-profile-info {
  margin-top: 16px;
}

.lg-profile-info h1 {
  margin: 0;
  font-size: 1.18rem;
  font-family: var(--lg-display);
  letter-spacing: -0.02em;
}

.lg-handle {
  margin: 2px 0 8px;
  color: var(--lg-ink-soft);
  font-size: 0.9rem;
}

.lg-bio {
  margin: 0 0 6px;
  white-space: pre-wrap;
}

.lg-inline-icon {
  display: inline-flex;
  align-items: center;
  color: inherit;
  vertical-align: middle;
}

.lg-muted-icon {
  margin-right: 4px;
  color: var(--lg-ink-soft);
}

.lg-verified {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--lg-ocean);
  color: #fff;
  vertical-align: middle;
  margin-left: 4px;
}

.lg-verified .lg-icon {
  width: 12px;
  height: 12px;
}

.lg-lock {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  color: var(--lg-ink-soft);
  vertical-align: middle;
}

.lg-profile-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  align-items: stretch;
}

.lg-profile-actions .lg-btn,
.lg-inline-form {
  flex: 1 1 0;
  min-width: 0;
}

.lg-profile-actions .lg-btn {
  justify-content: center;
  text-align: center;
  white-space: nowrap;
  padding-inline: 10px;
  font-size: 0.875rem;
  font-weight: 700;
  min-height: 36px;
  height: 36px;
  border-radius: 11px;
}

.lg-profile-actions .lg-profile-more {
  flex: 0 0 36px;
  width: 36px;
  min-width: 36px;
  max-width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
}

.lg-profile-actions .lg-profile-settings {
  flex: 0 0 auto;
  position: relative;
  border: 1px solid var(--lg-line);
  background: var(--lg-surface);
}

.lg-profile-actions .lg-btn.is-disabled,
.lg-profile-actions a.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.lg-inline-form .lg-btn {
  width: 100%;
}

.profile-grid {
  margin-top: 12px;
  scroll-margin-top: calc(var(--lg-top-h, 56px) + 8px);
}

/* Notifications */
.lg-notif-live {
  position: relative;
  padding-bottom: 24px;
}

.lg-notif-avatars {
  display: grid;
  grid-template-columns: 1fr;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  position: relative;
}

.lg-notif-avatars .lg-notif-avatar,
.lg-notif-avatars .lg-avatar-fallback {
  width: 32px;
  height: 32px;
  border: 2px solid var(--lg-white);
  position: absolute;
}

.lg-notif-avatars .lg-notif-avatar:first-child,
.lg-notif-avatars .lg-avatar-fallback:first-child {
  top: 0;
  left: 0;
  z-index: 2;
}

.lg-notif-avatars .lg-notif-avatar:nth-child(2),
.lg-notif-avatars .lg-avatar-fallback:nth-child(2) {
  bottom: 0;
  right: 0;
  z-index: 1;
}

.lg-notif-thumb.is-text {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background:
    linear-gradient(160deg, rgba(10, 165, 194, 0.18), rgba(27, 107, 74, 0.12)),
    var(--lg-mist);
  color: var(--lg-ocean-deep);
  font-family: var(--lg-display);
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.lg-notif-earlier {
  padding: 8px 16px 28px;
}

.lg-notif-earlier[hidden] {
  display: none !important;
}

.lg-notif-refresh {
  position: sticky;
  top: calc(var(--lg-top-h) + 8px);
  z-index: 12;
  display: flex;
  justify-content: center;
  pointer-events: none;
  margin: 0 0 -8px;
  padding: 0 14px;
}

.lg-notif-refresh[hidden] {
  display: none !important;
}

.lg-notif-refresh-btn {
  pointer-events: auto;
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
  background: var(--lg-ocean);
  box-shadow: 0 8px 24px rgba(0, 119, 168, 0.35);
  cursor: pointer;
  animation: lg-notif-pill 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}

.lg-notif-refresh-btn:active {
  transform: scale(0.96);
}

@keyframes lg-notif-pill {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.92);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.lg-notif-section-title {
  margin: 0;
  padding: 14px 14px 6px;
  font-size: 0.92rem;
  font-weight: 800;
  font-family: var(--lg-display);
  color: var(--lg-ink);
}

.lg-notif-section + .lg-notif-section .lg-notif-section-title {
  padding-top: 18px;
}

.lg-notif-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.lg-notif-item {
  border-bottom: 1px solid var(--lg-line);
  transition: background 0.45s ease;
  content-visibility: auto;
  contain-intrinsic-size: auto 72px;
}

.lg-notif-item.is-unread {
  background: rgba(10, 165, 194, 0.07);
}

.lg-notif-item.is-unread.is-settling {
  background: transparent;
}

.lg-notif-item.is-enter {
  animation: lg-notif-in 0.32s cubic-bezier(0.2, 0.9, 0.3, 1) both;
}

@keyframes lg-notif-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
    background: rgba(10, 165, 194, 0.14);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.lg-notif-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  min-height: 68px;
  -webkit-tap-highlight-color: transparent;
}

.lg-notif-link:active {
  background: var(--lg-surface-pressed);
}

.lg-notif-avatar,
.lg-notif-link > .lg-avatar-fallback {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}

.lg-notif-text {
  flex: 1;
  min-width: 0;
}

.lg-notif-text p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.35;
}

.lg-notif-text time {
  display: inline-block;
  margin-top: 2px;
  font-size: 0.75rem;
  color: var(--lg-ink-soft);
  font-weight: 500;
}

.lg-notif-cta {
  display: inline-block;
  margin-left: 4px;
  color: var(--lg-ocean);
  font-weight: 800;
}

.lg-notif-thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  background: var(--lg-mist);
}

.lg-badge[hidden] {
  display: none !important;
}

.lg-badge.is-bump {
  animation: lg-badge-bump 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes lg-badge-bump {
  0% {
    transform: scale(0.6);
  }
  60% {
    transform: scale(1.18);
  }
  100% {
    transform: scale(1);
  }
}

/* Empty / pager */
.lg-empty {
  text-align: center;
  padding: 48px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lg-empty.full {
  grid-column: 1 / -1;
}

.lg-empty h2 {
  font-family: var(--lg-display);
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

.lg-empty p {
  color: var(--lg-ink-soft);
  max-width: 280px;
  margin: 0 0 16px;
  line-height: 1.45;
}

.lg-empty-visual {
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  border-radius: 18px;
  background:
    url("/static/images/icons/icon.4b04d022282d.svg") center / cover no-repeat;
  box-shadow: 0 10px 28px rgba(0, 119, 168, 0.2);
}

.lg-pager {
  display: flex;
  justify-content: center;
  padding: 16px;
}

.lg-muted {
  color: var(--lg-ink-soft);
}

.lg-danger-link {
  display: block;
  text-align: center;
  color: var(--lg-coral);
  padding: 16px;
  font-weight: 600;
}

.lg-delete-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 12px;
}

.lg-comments {
  padding: 12px 14px;
  border-top: 1px solid var(--lg-line);
}

.lg-load-earlier-comments {
  margin: 0 0 10px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--lg-muted);
}

.lg-comments h2 {
  font-size: 0.95rem;
  margin: 0 0 10px;
}

.lg-comment {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  padding: 12px 0;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(226, 232, 238, 0.6);
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

.lg-comment:last-of-type {
  border-bottom: 0;
}

.lg-comment-author {
  display: block;
}

.lg-comment-author img,
.lg-comment-author .lg-avatar-fallback {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.lg-comment-content {
  min-width: 0;
}

.lg-comment-row {
  display: flex;
  align-items: flex-start;
  gap: 4px;
}

.lg-comment-textcol {
  flex: 1;
  min-width: 0;
}

.lg-comment-aside {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 2px;
}

.lg-comment-text {
  margin: 0 0 4px;
  line-height: 1.4;
  -webkit-user-select: text;
  user-select: text;
}

.lg-comment-text a {
  margin-right: 4px;
}

.lg-comment-menu {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
}

.lg-comment-menu .js-comment-more {
  list-style: none;
  cursor: pointer;
  width: var(--lg-tap);
  height: var(--lg-tap);
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  background: none;
  border-radius: 12px;
  color: var(--lg-ink-soft);
  transition: background 0.15s, color 0.15s;
}

.lg-comment-menu .js-comment-more:hover,
.lg-comment-menu .js-comment-more[aria-expanded="true"] {
  background: var(--lg-mist);
  color: var(--lg-ocean);
}

.lg-menu-panel[hidden] {
  display: none !important;
}

.lg-menu-panel.is-open {
  display: flex !important;
}

.lg-comment-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 2px;
  position: relative;
  z-index: 1;
  overflow: visible;
}

.lg-comment time {
  color: var(--lg-ink-soft);
  font-size: 0.72rem;
  font-weight: 500;
}

.lg-comment-like-label,
.lg-comment-react-btn {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--lg-ink-soft);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.lg-comment-react-btn:active {
  opacity: 0.65;
}

.lg-comment-heart {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  margin-top: 0;
  display: grid;
  place-items: center;
  border: 0;
  background: none;
  color: var(--lg-ink-soft);
  cursor: pointer;
  border-radius: 50%;
  transition: color 0.12s, transform 0.12s;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  user-select: none;
}

.lg-comment-heart .lg-icon {
  width: 16px;
  height: 16px;
  grid-area: 1 / 1;
}

.lg-comment-heart .heart-fill {
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.12s, transform 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.3);
  color: var(--lg-coral);
}

.lg-comment-heart .heart-outline {
  opacity: 1;
  transition: opacity 0.1s;
}

.lg-comment-heart.is-liked {
  color: var(--lg-coral);
}

.lg-comment-heart.is-liked .heart-fill {
  opacity: 1;
  transform: scale(1);
}

.lg-comment-heart.is-liked .heart-outline {
  opacity: 0;
}

.lg-comment-heart:active {
  transform: scale(0.82);
}

.lg-comment-heart.is-pop .heart-fill {
  animation: lg-like-bounce 0.38s ease;
}

.lg-comment.is-enter {
  opacity: 0;
  transform: translateY(8px);
}

.lg-comment.is-enter.is-in {
  animation: lg-comment-in 0.28s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
}

@keyframes lg-comment-in {
  to {
    opacity: 1;
    transform: none;
  }
}

.lg-reaction-chip.is-pop {
  animation: lg-chip-pop 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes lg-chip-pop {
  0% {
    transform: scale(0.7);
  }
  60% {
    transform: scale(1.12);
  }
  100% {
    transform: scale(1);
  }
}

.lg-reaction-popover .lg-reaction-pick.is-flash {
  transform: scale(1.35);
  background: rgba(232, 93, 76, 0.14);
}

.lg-comments-list {
  display: flex;
  flex-direction: column;
}

.lg-post-detail .lg-comments {
  padding-bottom: 8px;
}

.lg-reactions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  min-height: 0;
}

.lg-reactions[hidden] {
  display: none !important;
}

.lg-reaction-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  padding: 2px 9px;
  border-radius: 99px;
  border: 1px solid var(--lg-line);
  background: var(--lg-surface);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--lg-ink);
  cursor: pointer;
  transition: transform 0.15s, background 0.15s, border-color 0.15s, box-shadow 0.15s;
  box-shadow: 0 1px 2px rgba(4, 40, 60, 0.04);
}

.lg-reaction-chip:hover {
  border-color: var(--lg-control-border-hover);
  background: var(--lg-mist);
}

.lg-reaction-chip:active {
  transform: scale(0.94);
}

.lg-reaction-chip.is-mine {
  border-color: rgba(232, 93, 76, 0.35);
  background: rgba(232, 93, 76, 0.08);
  color: var(--lg-ink);
}

.lg-reaction-glyph {
  font-size: 0.92rem;
  line-height: 1;
}

.lg-reaction-count {
  font-variant-numeric: tabular-nums;
}

.lg-reaction-add {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  border: 1px dashed var(--lg-control-border-hover);
  background: var(--lg-surface);
  color: var(--lg-ink-soft);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.12s;
  -webkit-tap-highlight-color: transparent;
}

.lg-reaction-add:hover,
.lg-reaction-add:focus-visible {
  border-color: var(--lg-ocean);
  color: var(--lg-ocean);
  background: rgba(0, 119, 168, 0.06);
  outline: none;
}

.lg-reaction-add:active {
  transform: scale(0.92);
}

.lg-reaction-add .lg-icon {
  width: 14px;
  height: 14px;
}

/* Floating Instagram-style emoji tray (body portal) */
.lg-reaction-popover {
  position: fixed;
  z-index: 90;
  display: flex;
  gap: 2px;
  padding: 6px 8px;
  background: var(--lg-chrome-strong);
  border: 1px solid var(--lg-border);
  border-radius: 999px;
  box-shadow: var(--lg-shadow-strong);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transform-origin: center bottom;
  animation: lg-react-pop 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.15) both;
  max-width: calc(100vw - 24px);
}

.lg-reaction-popover[hidden] {
  display: none !important;
}

@keyframes lg-react-pop {
  from {
    opacity: 0;
    transform: scale(0.72) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.lg-reaction-popover .lg-reaction-pick {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 1.45rem;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
  line-height: 1;
}

.lg-reaction-popover .lg-reaction-pick:hover,
.lg-reaction-popover .lg-reaction-pick:focus-visible {
  background: var(--lg-mist);
  transform: scale(1.18);
  outline: none;
}

.lg-reaction-popover .lg-reaction-pick.is-active {
  background: rgba(232, 93, 76, 0.12);
  transform: scale(1.1);
}

.lg-reaction-popover .lg-reaction-pick:active {
  transform: scale(1.28);
}

.lg-comment.is-reacting {
  background: rgba(10, 165, 194, 0.04);
  border-radius: 12px;
  margin-inline: -6px;
  padding-inline: 6px;
}

/* Toasts */
.lg-toasts {
  position: sticky;
  top: var(--lg-top-h);
  z-index: 45;
  padding: 8px 12px 0;
  display: grid;
  gap: 6px;
}

.lg-toast {
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--lg-ink);
  color: #fff;
  font-size: 0.88rem;
  animation: lg-rise 0.3s ease;
}

.lg-toast-success {
  background: var(--lg-palm);
}

.lg-toast-error {
  background: var(--lg-coral);
}

.lg-toast-info,
.lg-toast-warning {
  background: var(--lg-ocean-deep);
}

/* Landing */
.lg-landing-body {
  margin: 0;
  min-height: 100dvh;
  background: #041820;
  color: #fff;
}

.lg-landing {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: 1fr auto;
  position: relative;
  overflow: hidden;
}

.lg-landing-visual {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(10, 165, 194, 0.35), transparent 50%),
    radial-gradient(ellipse at 80% 60%, rgba(232, 93, 76, 0.25), transparent 45%),
    linear-gradient(165deg, #042430 0%, #0a3d4d 40%, #0d5240 100%);
}

.lg-landing-glow {
  position: absolute;
  width: 140%;
  height: 60%;
  left: -20%;
  bottom: -10%;
  background: radial-gradient(ellipse, rgba(255, 255, 255, 0.08), transparent 70%);
  animation: lg-drift 8s ease-in-out infinite alternate;
}

@keyframes lg-drift {
  from {
    transform: translateX(-4%);
  }
  to {
    transform: translateX(4%);
  }
}

.lg-landing-photo {
  position: absolute;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background-size: cover;
  background-position: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  animation: lg-float 6s ease-in-out infinite;
}

.lg-p1 {
  width: min(42vw, 180px);
  aspect-ratio: 3/4;
  top: 12%;
  left: 8%;
  background-image: linear-gradient(140deg, #1b6b4a, #0aa5c2);
  animation-delay: 0s;
}

.lg-p2 {
  width: min(48vw, 210px);
  aspect-ratio: 1;
  top: 28%;
  right: 6%;
  background-image: linear-gradient(160deg, #e85d4c, #d4a017);
  animation-delay: 0.8s;
}

.lg-p3 {
  width: min(36vw, 150px);
  aspect-ratio: 4/5;
  top: 52%;
  left: 28%;
  background-image: linear-gradient(200deg, #0077a8, #045a7e);
  animation-delay: 1.4s;
}

@keyframes lg-float {
  0%,
  100% {
    transform: translateY(0) rotate(-2deg);
  }
  50% {
    transform: translateY(-12px) rotate(2deg);
  }
}

.lg-landing-copy {
  position: relative;
  z-index: 2;
  margin-top: auto;
  padding: 28px 22px calc(28px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, transparent, rgba(4, 24, 32, 0.92) 28%);
}

.lg-brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
}

.lg-landing-copy .lg-brand-text {
  font-size: 2rem;
  color: #fff;
  background: none;
  -webkit-text-fill-color: #fff;
}

.lg-landing-copy h1 {
  font-family: var(--lg-display);
  font-size: clamp(2rem, 8vw, 2.8rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
  margin: 0 0 10px;
  max-width: 12ch;
}

.lg-landing-lede {
  margin: 0 0 22px;
  color: rgba(255, 255, 255, 0.78);
  max-width: 34ch;
  font-size: 1.05rem;
}

.lg-landing-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.lg-landing-cta .lg-btn-ghost {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.lg-landing-note {
  margin: 18px 0 0;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.55);
}

/* Story viewer */
.lg-story-body {
  margin: 0;
  background: #000;
  color: #fff;
  min-height: 100dvh;
}

.lg-story-viewer {
  position: relative;
  min-height: 100dvh;
  max-width: var(--lg-max);
  margin: 0 auto;
  overflow: hidden;
}

.lg-story-progress {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top, 0px));
  left: 10px;
  right: 10px;
  z-index: 5;
  display: flex;
  gap: 4px;
}

.lg-story-bar {
  flex: 1;
  height: 3px;
  background: rgba(255, 255, 255, 0.28);
  border-radius: 99px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

.lg-story-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: #fff;
}

.lg-story-bar.is-done i {
  width: 100%;
}

.lg-story-bar.is-active i {
  animation: lg-story-fill linear forwards;
}

@keyframes lg-story-fill {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

.lg-story-top {
  position: absolute;
  top: calc(20px + env(safe-area-inset-top, 0px));
  left: 12px;
  right: 8px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lg-story-author {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 0.92rem;
  font-weight: 650;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}

.lg-story-author img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(255, 255, 255, 0.85);
}

.lg-story-close {
  width: var(--lg-tap);
  height: var(--lg-tap);
  display: grid;
  place-items: center;
  color: #fff;
  border-radius: 12px;
  transition: background 0.15s;
}

.lg-story-close:hover {
  background: rgba(255, 255, 255, 0.14);
}

.lg-story-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.lg-story-slide.is-active {
  opacity: 1;
  pointer-events: auto;
}

.lg-story-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #111;
}

.lg-story-hit {
  position: absolute;
  top: 88px;
  bottom: 0;
  width: 40%;
  z-index: 4;
  background: transparent;
}

.lg-story-hit.left {
  left: 0;
}

.lg-story-hit.right {
  right: 0;
  width: 60%;
}

.lg-story-empty {
  min-height: 100dvh;
  display: grid;
  place-content: center;
  gap: 12px;
  text-align: center;
}

/* Auth pages reuse */
body.account,
.allauth,
.lg-auth {
  font-family: var(--lg-font);
}

.lg-btn-sm {
  min-height: 40px;
  padding: 0 14px;
  font-size: 0.85rem;
  border-radius: 10px;
}

.lg-btn-mini {
  min-height: 32px;
  padding: 0 12px;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 10px;
  width: 100%;
  margin-top: 0;
}

.lg-btn-compact {
  min-height: 40px;
  padding: 0 14px;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.lg-badge-pulse {
  animation: lg-badge-pulse 1.6s ease-in-out infinite;
}

@keyframes lg-badge-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.12);
  }
}

.lg-stories-sticky {
  position: sticky;
  top: var(--lg-top-h);
  z-index: 30;
  background: var(--lg-chrome);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  border-bottom: 1px solid var(--lg-border-glass);
  margin-bottom: 4px;
}

.lg-story-chip.is-hot .lg-story-label {
  color: var(--lg-coral);
  font-weight: 700;
}

.lg-feed-chip {
  display: flex;
  justify-content: center;
  padding: 8px 0 4px;
}

.lg-feed-chip span {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--lg-ocean);
  background: rgba(0, 119, 168, 0.08);
  padding: 6px 12px;
  border-radius: 99px;
}

.lg-suggest-feed {
  padding-top: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--lg-line);
  margin-bottom: 8px;
  background: linear-gradient(180deg, var(--lg-chrome), transparent);
}

.lg-suggest-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 16px 12px;
}

.lg-suggest-head h2 {
  font-size: 0.95rem;
  margin: 0;
  text-transform: none;
  letter-spacing: -0.01em;
  color: var(--lg-ink);
  font-weight: 750;
}

.lg-suggest-head a {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--lg-ocean);
}

.lg-suggest-card form,
.lg-suggest-follow {
  width: 100%;
  margin: 0;
}

.lg-post {
  --stagger: 0;
  animation: lg-rise 0.45s ease both;
  animation-delay: calc(var(--stagger) * 40ms);
}

.lg-post-media img {
  transition: transform 0.6s ease;
}

.lg-post-media:active img {
  transform: scale(1.02);
}

.lg-action-spacer {
  flex: 1;
}

.like-btn.is-pop .heart-fill {
  animation: lg-like-bounce 0.4s ease;
}

.lg-count-bump {
  display: inline-block;
  animation: lg-like-bounce 0.35s ease;
}

.save-btn.is-saved svg {
  fill: var(--lg-ink);
  stroke: var(--lg-ink);
}

.share-btn.is-copied {
  color: var(--lg-palm);
}

.lg-share-sheet-title {
  margin: 4px 16px 8px;
  font-family: var(--lg-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: center;
}

.lg-share-cancel {
  color: var(--lg-ink-soft);
  font-weight: 600;
}

.lg-dm-share-banner {
  margin: 0 14px 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0, 119, 168, 0.08);
  color: var(--lg-ocean-deep);
  font-size: 0.86rem;
  font-weight: 650;
  text-align: center;
}

/* Pull to refresh */
.lg-ptr {
  position: sticky;
  top: var(--lg-top-h);
  height: 0;
  z-index: 35;
  display: flex;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.lg-ptr.is-visible,
.lg-ptr.is-loading {
  opacity: 1;
  height: var(--pull, 48px);
}

.lg-ptr span {
  width: 28px;
  height: 28px;
  margin-top: 8px;
  border-radius: 50%;
  border: 2.5px solid var(--lg-line);
  border-top-color: var(--lg-ocean);
  animation: lg-spin-slow 0.7s linear infinite;
}

/* Infinite scroll */
.lg-infinite {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  justify-content: center;
  padding: 20px 0 calc(var(--lg-tab-h) + 20px);
  min-height: 72px;
  cursor: default;
}

.lg-infinite.is-error {
  cursor: pointer;
}

.lg-infinite-label {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--lg-ink-soft);
}

.lg-infinite.is-error .lg-infinite-label {
  color: var(--lg-coral);
}

.lg-spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2.5px solid var(--lg-line);
  border-top-color: var(--lg-lagoon);
  animation: lg-spin-slow 0.7s linear infinite;
}

.lg-feed-modes {
  display: flex;
  gap: 4px;
  padding: 6px 14px 0;
  position: sticky;
  top: var(--lg-top-h, 56px);
  z-index: 15;
  background: linear-gradient(180deg, rgba(244, 247, 249, 0.96) 65%, transparent);
}

.lg-feed-mode {
  flex: 1;
  text-align: center;
  padding: 11px 12px;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--lg-ink-soft);
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.lg-feed-mode.is-active {
  color: var(--lg-ocean-deep);
  border-bottom-color: var(--lg-ocean);
}

.lg-feed-end {
  text-align: center;
  padding: 28px 20px calc(var(--lg-tab-h) + 28px);
  color: var(--lg-ink-soft);
}

.lg-feed-end-mark {
  width: 48px;
  height: 4px;
  margin: 0 auto 14px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--lg-lagoon), var(--lg-ocean));
}

.lg-feed-end p {
  margin: 0 0 14px;
  font-weight: 600;
}

.lg-post {
  content-visibility: auto;
  contain-intrinsic-size: auto 520px;
}

.lg-post-enter {
  animation: lg-post-in 0.38s cubic-bezier(0.2, 0.9, 0.3, 1) both;
}

@keyframes lg-post-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.lg-skel-post {
  margin: 12px;
  height: 420px;
  border-radius: 16px;
  background: linear-gradient(90deg, var(--lg-mist) 25%, var(--lg-surface) 50%, var(--lg-mist) 75%);
  background-size: 200% 100%;
  animation: lg-skel 1.2s ease-in-out infinite;
}

@keyframes lg-skel {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* Guest join bar + auth sheet */
.lg-join-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--lg-tab-h) + 12px);
  width: min(calc(100% - 24px), calc(var(--lg-max) - 24px));
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(4, 40, 55, 0.94);
  color: #fff;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  z-index: 55;
  transition: transform 0.25s ease, opacity 0.25s;
}

.lg-join-bar.is-hidden {
  transform: translateY(120%);
  opacity: 0;
  pointer-events: none;
}

.lg-join-bar strong {
  display: block;
  font-size: 0.9rem;
}

.lg-join-bar span {
  font-size: 0.75rem;
  opacity: 0.75;
}

.lg-join-bar .lg-btn {
  flex-shrink: 0;
  min-height: 40px;
}

.lg-auth-sheet {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(8, 20, 28, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: grid;
  align-items: end;
  justify-items: center;
  padding: 0;
}

.lg-auth-sheet[hidden] {
  display: none !important;
}

body.lg-sheet-open {
  overflow: hidden;
  touch-action: none;
}

.lg-auth-sheet-card {
  width: min(100%, var(--lg-max));
  background: var(--lg-surface);
  color: var(--lg-text);
  border-radius: 16px 16px 0 0;
  padding: 12px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  position: relative;
  animation: lg-sheet-up 0.32s cubic-bezier(0.2, 0.9, 0.3, 1);
  text-align: center;
  box-shadow: var(--lg-shadow-strong);
}

.lg-auth-sheet-card::before {
  content: "";
  display: block;
  width: 36px;
  height: 4px;
  border-radius: 99px;
  background: var(--lg-border-strong);
  margin: 2px auto 14px;
}

@keyframes lg-sheet-up {
  from {
    transform: translateY(100%);
    opacity: 0.85;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.lg-sheet-close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: var(--lg-tap);
  height: var(--lg-tap);
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--lg-ink-soft);
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.lg-sheet-close:hover {
  background: var(--lg-mist);
  color: var(--lg-ink);
}

.lg-sheet-mark {
  margin: 8px auto 14px;
  width: 48px;
  height: 48px;
  border-radius: 14px;
}

.lg-auth-sheet-card h2 {
  font-family: var(--lg-display);
  margin: 0 0 6px;
}

.lg-auth-sheet-card p {
  color: var(--lg-ink-soft);
  margin: 0 0 16px;
}

.lg-story-nudge {
  position: fixed;
  top: calc(var(--lg-top-h) + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  z-index: 45;
  padding: 8px 14px;
  border-radius: 99px;
  background: var(--lg-ink);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
}

.lg-story-nudge.is-in {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

body.is-guest .lg-main {
  padding-bottom: calc(var(--lg-tab-h) + 88px);
}

/* ── Settings & account management ── */
.lg-settings,
.lg-settings-page,
.lg-manage,
.lg-allauth-manage {
  padding-bottom: 28px;
}

.lg-settings-identity {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px 16px 8px;
}

.lg-settings-back {
  margin-right: -4px;
}

.lg-settings-identity:not(:has(.lg-settings-back)) {
  grid-template-columns: auto 1fr;
}

.lg-settings-identity-copy h1,
.lg-settings-identity h1 {
  font-family: var(--lg-display);
  font-size: 1.45rem;
  letter-spacing: -0.03em;
  margin: 0 0 2px;
}

.lg-settings-done {
  min-width: var(--lg-tap);
  min-height: var(--lg-tap);
  padding: 0 8px;
  border: 0;
  background: none;
  color: var(--lg-ocean);
  font: inherit;
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
}

.lg-settings-done:hover {
  color: var(--lg-ocean-deep);
}

.lg-settings-status {
  margin: 0 16px 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(27, 107, 74, 0.12);
  color: var(--lg-palm);
  font-size: 0.82rem;
  font-weight: 700;
}

.lg-settings-status.is-error {
  background: rgba(232, 93, 76, 0.12);
  color: var(--lg-coral);
}

.lg-settings-logout {
  margin-top: 4px;
}

.lg-field {
  margin-bottom: 12px;
}

.lg-field.has-error .lg-input,
.lg-field.has-error .lg-input-prefix {
  border-color: var(--lg-coral);
}

.lg-field-error {
  margin: 6px 0 0;
  font-size: 0.78rem;
  color: var(--lg-coral);
  font-weight: 600;
}

.lg-avatar-edit-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.lg-link-btn.is-danger {
  color: var(--lg-coral);
}

.lg-choice-set {
  margin: 0 0 8px;
  padding: 0;
  border: 0;
}

.lg-choice-set legend {
  padding: 0;
  margin: 0 0 8px;
  width: 100%;
}

.lg-choice-row,
.lg-email-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 12px;
  margin-bottom: 4px;
  border-radius: 14px;
  background: var(--lg-surface);
  border: 1px solid var(--lg-line);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.lg-choice-row:hover,
.lg-email-row:hover {
  border-color: rgba(0, 119, 168, 0.35);
}

.lg-choice-row:has(input:checked),
.lg-email-row:has(input:checked),
.lg-email-row.is-primary:has(input:checked) {
  border-color: var(--lg-ocean);
  background: var(--lg-surface-selected);
  box-shadow: inset 0 0 0 1px var(--lg-ocean);
}

.lg-choice-row:has(input:focus-visible),
.lg-email-row:has(input:focus-visible),
.lg-check-row:has(input:focus-visible),
.lg-onboard-person:has(input:focus-visible) {
  outline: none;
  box-shadow: var(--lg-focus);
}

.lg-choice-row span,
.lg-choice-copy {
  flex: 1;
  min-width: 0;
  line-height: 1.35;
  padding-top: 1px;
}

/* Custom radio — used site-wide */
.lg-radio,
.lg-choice-input,
.lg-choice-row input[type="radio"],
.lg-email-row input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid var(--lg-control-border);
  background: var(--lg-surface);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.lg-radio::after,
.lg-choice-input::after,
.lg-choice-row input[type="radio"]::after,
.lg-email-row input[type="radio"]::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: transparent;
  transform: scale(0);
  transition: transform 0.15s ease, background 0.15s ease;
}

.lg-radio:checked,
.lg-choice-input:checked,
.lg-choice-row input[type="radio"]:checked,
.lg-email-row input[type="radio"]:checked {
  border-color: var(--lg-ocean);
  background: var(--lg-surface);
}

.lg-radio:checked::after,
.lg-choice-input:checked::after,
.lg-choice-row input[type="radio"]:checked::after,
.lg-email-row input[type="radio"]:checked::after {
  background: var(--lg-ocean);
  transform: scale(1);
}

.lg-radio:focus-visible,
.lg-choice-input:focus-visible,
.lg-choice-row input[type="radio"]:focus-visible,
.lg-email-row input[type="radio"]:focus-visible {
  outline: none;
  box-shadow: var(--lg-focus);
}

.lg-radio:disabled,
.lg-choice-input:disabled,
.lg-choice-row input[type="radio"]:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Custom checkbox */
.lg-checkbox,
.lg-check,
.lg-check-row input[type="checkbox"],
.lg-onboard-person input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  flex-shrink: 0;
  border-radius: 7px;
  border: 2px solid var(--lg-control-border);
  background: var(--lg-surface);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.lg-checkbox::after,
.lg-check::after,
.lg-check-row input[type="checkbox"]::after,
.lg-onboard-person input[type="checkbox"]::after {
  content: "";
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  margin-top: -1px;
  transition: transform 0.12s ease;
}

.lg-checkbox:checked,
.lg-check:checked,
.lg-check-row input[type="checkbox"]:checked,
.lg-onboard-person input[type="checkbox"]:checked {
  background: linear-gradient(135deg, var(--lg-lagoon), var(--lg-ocean));
  border-color: var(--lg-ocean);
}

.lg-checkbox:checked::after,
.lg-check:checked::after,
.lg-check-row input[type="checkbox"]:checked::after,
.lg-onboard-person input[type="checkbox"]:checked::after {
  transform: rotate(45deg) scale(1);
}

.lg-checkbox:focus-visible,
.lg-check:focus-visible,
.lg-check-row input[type="checkbox"]:focus-visible,
.lg-onboard-person input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: var(--lg-focus);
}

.lg-checkbox:disabled,
.lg-check:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

select.lg-input {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235a6570' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  padding-right: 42px;
  cursor: pointer;
}

html[data-theme="dark"] select.lg-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a8b3bd' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

select.lg-input:focus {
  outline: none;
  border-color: var(--lg-ocean);
  box-shadow: var(--lg-focus);
}

.lg-settings-sticky-actions {
  position: sticky;
  bottom: calc(var(--lg-tab-h) + 8px);
  padding: 12px 0 4px;
  margin-top: 8px;
  background: linear-gradient(180deg, transparent, var(--lg-mist) 28%);
  z-index: 5;
}

.lg-settings-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: var(--lg-mist);
  border: 2px solid var(--lg-surface);
  box-shadow: 0 0 0 1px var(--lg-line);
  transition: transform 0.2s ease;
}

.lg-settings-avatar:active {
  transform: scale(0.96);
}

.lg-settings-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lg-settings-handle {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: baseline;
  font-size: 0.88rem;
  color: var(--lg-ink-soft);
}

.lg-settings-handle strong {
  color: var(--lg-ink);
  font-weight: 700;
}

.lg-settings-nav {
  padding: 4px 12px 8px;
}

.lg-settings-group {
  margin: 18px 4px 8px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--lg-ink-soft);
}

.lg-settings-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px;
  margin-bottom: 4px;
  border-radius: 14px;
  background: var(--lg-surface);
  border: 1px solid var(--lg-border);
  color: inherit;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.lg-settings-row:hover {
  background: var(--lg-surface-2);
  border-color: var(--lg-border-strong);
}

.lg-settings-row:active {
  transform: scale(0.992);
}

.lg-settings-row-inset {
  margin: 8px 0;
}

.lg-settings-ico {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: var(--lg-bg-elevated);
  color: var(--lg-ocean);
}

.lg-settings-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lg-settings-copy strong {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.25;
}

.lg-settings-copy small {
  font-size: 0.78rem;
  color: var(--lg-ink-soft);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lg-settings-chev {
  color: var(--lg-ink-soft);
  opacity: 0.55;
  flex-shrink: 0;
}

.lg-settings-badge {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 99px;
  background: var(--lg-coral);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
}

.lg-settings-row.is-danger {
  background: var(--lg-surface-danger);
  border-color: var(--lg-surface-danger-border);
  margin-bottom: 10px;
}

.lg-settings-row.is-danger strong {
  color: var(--lg-coral);
}

.lg-settings-danger {
  padding: 20px 12px 8px;
}

.lg-settings-head {
  display: grid;
  grid-template-columns: var(--lg-tap) 1fr var(--lg-tap);
  align-items: center;
  gap: 4px;
  padding: 8px 10px 4px;
  min-height: var(--lg-tap);
}

.lg-settings-head h1 {
  font-family: var(--lg-display);
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  margin: 0;
  text-align: center;
}

.lg-settings-head-spacer {
  width: var(--lg-tap);
  height: var(--lg-tap);
}

.lg-settings-lede {
  margin: 0 16px 14px;
  font-size: 0.88rem;
  color: var(--lg-ink-soft);
  line-height: 1.4;
}

.lg-settings-form {
  padding: 0 16px 8px;
}

.lg-settings-form .lg-btn-block {
  margin-top: 8px;
}

.lg-settings-hint {
  margin: 4px 0 14px;
  font-size: 0.85rem;
  color: var(--lg-ink-soft);
}

.lg-settings-hint a {
  color: var(--lg-ocean);
  font-weight: 700;
}

.lg-field-hint {
  margin: 6px 0 0;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--lg-ink-soft);
  text-align: start;
}

.lg-field-hint-start {
  text-align: start;
}

.lg-field-hint-center {
  text-align: center;
}

.lg-field-hint-end {
  text-align: end;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.lg-avatar-placeholder-ico {
  display: grid;
  place-items: center;
  color: var(--lg-ocean-deep);
  opacity: 0.55;
  line-height: 0;
}

.lg-avatar-placeholder-ico svg {
  display: block;
}

.lg-report-preview {
  margin: 0 0 1rem;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--lg-surface-2, rgba(0, 0, 0, 0.04));
  font-size: 0.9rem;
  line-height: 1.4;
}

.lg-report-done-copy {
  margin: 0 14px 12px;
  font-size: 0.9rem;
  line-height: 1.45;
}

.lg-avatar-edit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 8px 0 20px;
  position: relative;
}

.lg-avatar-edit-preview {
  position: relative;
  width: 96px;
  height: 96px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--lg-mist);
  border: 3px solid var(--lg-surface);
  box-shadow: 0 0 0 1px var(--lg-line), var(--lg-shadow);
  cursor: pointer;
  overflow: visible;
}

.lg-avatar-edit-preview img,
.lg-avatar-edit-preview .lg-avatar-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  border-radius: 50%;
  clip-path: circle(50% at 50% 50%);
}

.lg-avatar-edit-preview img {
  object-fit: cover;
  display: block;
}

.lg-avatar-edit-preview .lg-avatar-fallback {
  display: grid;
  place-items: center;
  place-content: center;
  font-size: 2rem;
  line-height: 1;
  font-weight: 700;
  text-align: center;
}

.lg-avatar-edit-badge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  z-index: 2;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--lg-ocean);
  color: #fff;
  border: 2px solid var(--lg-surface);
  box-shadow: 0 2px 8px rgba(4, 60, 90, 0.25);
  pointer-events: none;
}

.lg-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 12px;
  margin-bottom: 4px;
  border-radius: 14px;
  background: var(--lg-surface);
  border: 1px solid var(--lg-line);
  cursor: pointer;
}

.lg-switch-row.is-stack {
  flex-direction: column;
  align-items: stretch;
  cursor: default;
  gap: 10px;
}

.lg-switch-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.lg-switch-copy strong {
  font-size: 0.94rem;
  font-weight: 700;
}

.lg-switch-copy small {
  font-size: 0.78rem;
  color: var(--lg-ink-soft);
  line-height: 1.35;
}

.lg-switch {
  flex-shrink: 0;
  display: grid;
  place-items: center;
}

.lg-switch-input {
  appearance: none;
  -webkit-appearance: none;
  width: 46px;
  height: 28px;
  margin: 0;
  border-radius: 99px;
  background: #c5ced6;
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.lg-switch-input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  transition: transform 0.2s ease;
}

.lg-switch-input:checked {
  background: linear-gradient(135deg, var(--lg-lagoon), var(--lg-ocean));
}

.lg-switch-input:checked::after {
  transform: translateX(18px);
}

.lg-switch-input:focus-visible {
  outline: none;
  box-shadow: var(--lg-focus);
}

.lg-switch-input:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.lg-switch-row:hover {
  border-color: rgba(0, 119, 168, 0.28);
}

.lg-switch-row:has(.lg-switch-input:focus-visible) {
  box-shadow: var(--lg-focus);
}

.lg-people-list {
  list-style: none;
  margin: 0;
  padding: 0 12px 16px;
}

.lg-people-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--lg-line);
}

.lg-people-row:last-child {
  border-bottom: 0;
}

.lg-people-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.lg-people-main img,
.lg-people-main .lg-avatar-fallback {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  margin: 0;
  font-size: 1rem;
  line-height: 1;
}

.lg-people-main strong {
  display: block;
  font-size: 0.92rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lg-people-main small {
  display: block;
  font-size: 0.78rem;
  color: var(--lg-ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lg-request-row {
  flex-wrap: nowrap;
}

.lg-request-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

@media (max-width: 380px) {
  .lg-request-row {
    flex-wrap: wrap;
  }

  .lg-request-actions {
    width: 100%;
    justify-content: flex-end;
    padding-left: 60px;
  }
}

.lg-danger-card {
  margin: 8px 16px 0;
  padding: 20px 18px;
  border-radius: 16px;
  background: var(--lg-surface-danger);
  border: 1px solid var(--lg-surface-danger-border-strong);
}

.lg-danger-card h2 {
  font-family: var(--lg-display);
  font-size: 1.2rem;
  margin: 0 0 8px;
  color: var(--lg-coral);
}

.lg-danger-card p {
  margin: 0 0 16px;
  color: var(--lg-ink-soft);
  font-size: 0.9rem;
  line-height: 1.45;
}

.lg-edit-thumb {
  display: block;
  width: calc(100% - 32px);
  max-width: 280px;
  margin: 8px auto 16px;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--lg-line);
}

.lg-allauth-body {
  padding: 0 16px 8px;
}

.lg-allauth-body h1,
.lg-allauth-body .card-title {
  font-family: var(--lg-display);
  font-size: 1.15rem;
  margin: 0 0 12px;
}

.lg-allauth-body form p {
  margin: 0 0 12px;
}

.lg-allauth-body form ul {
  margin: 0 0 12px;
  padding-left: 1.1rem;
  color: var(--lg-ink-soft);
  font-size: 0.85rem;
}

.lg-allauth-body .card,
.lg-allauth-body .card-body {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}

.lg-allauth-body .form-control,
.lg-allauth-body .lg-field input:not([type="checkbox"]):not([type="radio"]),
.lg-allauth-body input[type="email"],
.lg-allauth-body input[type="password"],
.lg-allauth-body input[type="text"] {
  width: 100%;
  border: 1px solid var(--lg-line);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  background: var(--lg-surface);
  color: var(--lg-ink);
  box-sizing: border-box;
}

.lg-allauth-body .lg-field input:not([type="checkbox"]):not([type="radio"]):focus {
  outline: none;
  border-color: var(--lg-ocean);
  box-shadow: 0 0 0 3px rgba(0, 119, 168, 0.15);
}

.lg-allauth-body label.lg-label,
.lg-allauth-body label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--lg-ink-soft);
  margin: 0 0 6px;
}

.lg-allauth-body .errorlist {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  color: var(--lg-coral);
  font-size: 0.78rem;
  font-weight: 600;
}

.lg-allauth-body button[type="submit"],
.lg-allauth-body input[type="submit"] {
  width: 100%;
  min-height: 46px;
  margin-top: 8px;
  border: 0;
  border-radius: 12px;
  font-weight: 700;
  font: inherit;
  color: #fff;
  background: linear-gradient(135deg, var(--lg-lagoon), var(--lg-ocean-deep));
  cursor: pointer;
}

.lg-allauth-body .lg-btn {
  margin-top: 0;
}

.lg-allauth-body a {
  color: var(--lg-ocean);
  font-weight: 600;
}

.lg-allauth-panel {
  margin-bottom: 18px;
  padding: 14px 14px 16px;
  border-radius: 14px;
  background: var(--lg-surface);
  border: 1px solid var(--lg-line);
}

.lg-allauth-panel h2 {
  font-family: var(--lg-display);
  font-size: 1.05rem;
  margin: 0 0 10px;
}

.lg-allauth-actions {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lg-email-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.lg-email-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.lg-email-copy strong {
  font-size: 0.92rem;
  word-break: break-word;
}

.lg-email-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.lg-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--lg-badge-neutral);
  color: var(--lg-ink-soft);
}

.lg-badge.is-success {
  background: rgba(27, 107, 74, 0.12);
  color: var(--lg-palm);
}

.lg-badge.is-warn {
  background: rgba(212, 160, 23, 0.16);
  color: #9a6b00;
}

.lg-badge.is-primary {
  background: rgba(0, 119, 168, 0.12);
  color: var(--lg-ocean);
}

.lg-badge.is-danger {
  background: rgba(232, 93, 76, 0.12);
  color: var(--lg-coral);
}

.lg-email-actions {
  margin-top: 4px;
  margin-bottom: 20px;
}

.lg-btn.is-danger-text,
.lg-allauth-body .lg-btn.is-danger-text {
  color: var(--lg-coral);
  background: var(--lg-surface-danger);
}

.lg-allauth-table-wrap {
  overflow-x: auto;
  margin: 8px 0 16px;
  border: 1px solid var(--lg-line);
  border-radius: 14px;
  background: var(--lg-surface);
}

.lg-allauth-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.lg-allauth-table th,
.lg-allauth-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--lg-line);
}

.lg-allauth-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--lg-ink-soft);
}

.lg-allauth-table tr:last-child td {
  border-bottom: 0;
}

body.lg-settings-route .lg-tabbar,
body.lg-settings-route .lg-topbar {
  display: none;
}

body.lg-settings-route .lg-main {
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
  padding-top: env(safe-area-inset-top);
}

body.lg-settings-route .lg-settings-sticky-actions {
  bottom: max(8px, env(safe-area-inset-bottom));
}

.lg-settings-hint-block {
  margin: 4px 0 12px;
}

.lg-email-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  align-items: center;
  padding: 4px 4px 8px;
  margin-bottom: 8px;
}

.lg-email-toolbar .lg-link-btn {
  min-height: 40px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--lg-ocean);
  cursor: pointer;
}

.lg-email-toolbar .lg-link-btn.is-danger {
  color: var(--lg-coral);
}

.lg-email-toolbar .lg-link-btn:active {
  opacity: 0.7;
}

.lg-settings-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 12px;
  padding: 0 12px;
}

.lg-settings-list a {
  display: flex;
  align-items: center;
  padding: 14px 12px;
  border-radius: 14px;
  font-weight: 600;
  background: var(--lg-surface);
  border: 1px solid var(--lg-line);
}

.lg-settings-list a.is-danger {
  color: var(--lg-coral);
  margin-top: 12px;
  background: var(--lg-surface-danger);
}

/* Onboarding */
body.lg-onboard-page .lg-tabbar,
body.lg-onboard-page .lg-topbar {
  display: none;
}

.lg-onboard {
  min-height: 100dvh;
  padding: 24px 18px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.lg-onboard-progress {
  height: 4px;
  background: var(--lg-line);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 28px;
}

.lg-onboard-progress i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--lg-lagoon), var(--lg-ocean));
  border-radius: 99px;
  transition: width 0.35s ease;
}

.lg-onboard-hero,
.lg-onboard-card {
  max-width: 420px;
  margin: 0 auto;
  width: 100%;
}

.lg-onboard-hero {
  text-align: center;
  padding-top: 10vh;
}

.lg-onboard-hero h1,
.lg-onboard-card h1 {
  font-family: var(--lg-display);
  letter-spacing: -0.03em;
  margin: 14px 0 10px;
}

.lg-onboard-hero .lg-sheet-mark {
  margin-bottom: 8px;
}

.lg-onboard-hero > p {
  color: var(--lg-ink-soft);
  max-width: 300px;
  margin: 0 auto 20px;
  line-height: 1.45;
}

.lg-step-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--lg-ocean);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 4px;
}

.lg-onboard-people {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 50vh;
  overflow-y: auto;
}

.lg-onboard-person {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--lg-surface);
  border: 1px solid var(--lg-line);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.lg-onboard-person:hover {
  border-color: rgba(0, 119, 168, 0.35);
}

.lg-onboard-person:has(input:checked) {
  border-color: var(--lg-ocean);
  background: var(--lg-surface-selected);
  box-shadow: inset 0 0 0 1px var(--lg-ocean);
}

.lg-onboard-person img,
.lg-onboard-person .lg-avatar-fallback {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  margin: 0;
  font-size: 1rem;
  line-height: 1;
}

.lg-onboard-person strong {
  display: block;
  font-size: 0.92rem;
}

.lg-onboard-person small {
  color: var(--lg-ink-soft);
  font-size: 0.75rem;
}

.lg-onboard-card-head {
  margin-bottom: 8px;
  text-align: center;
}

.lg-onboard-card-head h1 {
  margin: 6px 0 8px;
}

.lg-onboard-card-head .lg-lede {
  margin: 0 auto;
  max-width: 28ch;
}

.lg-onboard-card-head .lg-step-label {
  margin-bottom: 0;
}

.lg-onboard-profile-form {
  gap: 18px;
  margin-top: 8px;
}

.lg-onboard-profile-form .lg-field {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lg-onboard-profile-form .lg-label {
  margin: 0;
  color: var(--lg-ink);
  font-size: 0.82rem;
  letter-spacing: 0.01em;
}

.lg-onboard-profile-form .lg-field-hint {
  margin: 0;
  padding-inline: 2px;
}

.lg-onboard-profile-form .lg-field-hint-end {
  padding-inline: 2px;
}

.lg-onboard-profile-form .lg-field-error {
  margin: 0;
}

.lg-onboard-avatar {
  margin: 2px 0 2px;
  gap: 12px;
}

.lg-onboard-avatar .lg-avatar-edit-preview {
  width: 112px;
  height: 112px;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.lg-onboard-avatar .lg-avatar-edit-preview:hover {
  box-shadow: 0 0 0 1px var(--lg-ocean), var(--lg-shadow);
}

.lg-onboard-avatar .lg-avatar-edit-preview:focus-within {
  outline: 2px solid var(--lg-ocean);
  outline-offset: 3px;
}

.lg-onboard-avatar .lg-avatar-edit-preview .lg-avatar-fallback {
  font-size: 2.5rem;
  letter-spacing: -0.03em;
  font-weight: 700;
}

.lg-onboard-avatar .lg-avatar-edit-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
  width: 100%;
}

.lg-onboard-photo-btn {
  margin: 0;
  min-height: 36px;
  padding: 0 16px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  width: auto;
}

.lg-onboard-avatar .lg-field-hint {
  margin: 0;
  text-align: center;
  max-width: 220px;
  line-height: 1.3;
}

.lg-onboard-actions {
  margin-top: 10px;
  padding-top: 6px;
}

.lg-onboard .lg-form {
  margin-top: 8px;
}

.lg-onboard .lg-btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.lg-onboard .lg-switch-row {
  margin-top: 4px;
}

.lg-onboard .lg-input-prefix {
  min-height: 48px;
}

.lg-onboard .lg-input-prefix span {
  color: var(--lg-ink-soft);
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1;
}

.lg-onboard .lg-input,
.lg-onboard .lg-input-prefix input {
  min-height: 48px;
  font-size: 1rem;
}

.lg-onboard .lg-textarea {
  min-height: 72px;
  resize: vertical;
}

/* Manage content */
.lg-manage-head {
  display: grid;
  grid-template-columns: var(--lg-tap) 1fr var(--lg-tap);
  align-items: center;
  gap: 4px;
  padding: 8px 10px 4px;
}

.lg-manage-head h1 {
  font-family: var(--lg-display);
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  margin: 0;
  text-align: center;
}

.lg-manage-tabs {
  display: flex;
  gap: 4px;
  padding: 4px 14px 14px;
  border-bottom: 1px solid var(--lg-line);
  margin-bottom: 2px;
}

.lg-manage-tabs a {
  flex: 1;
  text-align: center;
  padding: 10px 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--lg-ink-soft);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}

.lg-manage-tabs a.is-active {
  color: var(--lg-ink);
  border-bottom-color: var(--lg-ocean);
}

.lg-manage-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 2px 0 24px;
}

.lg-manage-card {
  position: relative;
  background: var(--lg-mist);
  overflow: hidden;
  aspect-ratio: 1;
}

.lg-manage-thumb {
  display: block;
  width: 100%;
  height: 100%;
}

.lg-manage-thumb img,
.lg-manage-card > img {
  aspect-ratio: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lg-manage-menu {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
}

.lg-manage-menu > summary {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  backdrop-filter: blur(6px);
}

.lg-manage-menu > summary:hover {
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
}

.lg-manage-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 8px 0 0;
  font-size: 0.8rem;
  font-weight: 700;
}

.lg-manage-card-actions a,
.lg-manage-card-actions button {
  color: var(--lg-ocean);
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.lg-manage-card-actions .is-danger,
.lg-manage-card-actions button.is-danger,
a.is-danger {
  color: var(--lg-coral);
}

.lg-manage-card .lg-muted {
  padding: 6px 10px 10px;
  margin: 0;
  font-size: 0.72rem;
}

.lg-manage-list {
  list-style: none;
  margin: 0;
  padding: 0 12px 24px;
}

.lg-manage-comment {
  display: flex;
  gap: 12px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--lg-line);
}

.lg-manage-comment img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 10px;
  background: var(--lg-mist);
}

.lg-manage-comment p {
  margin: 0 0 4px;
  font-size: 0.92rem;
  line-height: 1.35;
  word-break: break-word;
}

.lg-manage-comment time {
  display: block;
  font-size: 0.72rem;
  color: var(--lg-ink-soft);
  margin-bottom: 6px;
}

.lg-manage-list > .lg-empty,
.lg-people-list > .lg-empty,
.lg-manage-grid > .lg-empty {
  grid-column: 1 / -1;
  padding: 48px 20px;
  text-align: center;
  border: 0;
}

/* Context menus — absolute by default; JS flips to fixed + clamps in viewport */
.lg-post-menu,
.lg-chat-menu,
.lg-comment-menu,
.lg-manage-menu {
  position: relative;
}

.lg-comments,
.lg-comments-list,
.lg-comment,
.lg-comment-content,
.lg-comment-textcol,
.lg-comment-meta {
  overflow: visible;
}

.lg-post-menu > .lg-icon-btn,
.lg-chat-menu > .lg-icon-btn,
.lg-comment-menu > .lg-icon-btn,
.lg-manage-menu > .lg-icon-btn {
  width: var(--lg-tap);
  height: var(--lg-tap);
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--lg-ink-soft);
  transition: background 0.15s, color 0.15s;
}

.lg-post-menu > .lg-icon-btn:hover,
.lg-chat-menu > .lg-icon-btn:hover,
.lg-comment-menu > .lg-icon-btn:hover,
.lg-manage-menu > .lg-icon-btn:hover {
  background: var(--lg-mist);
  color: var(--lg-ocean);
}

.lg-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 40;
  min-width: 168px;
  max-width: min(240px, calc(100vw - 24px));
  background: var(--lg-surface);
  border: 1px solid var(--lg-border);
  border-radius: 12px;
  box-shadow: var(--lg-shadow-strong);
  padding: 6px;
  display: flex;
  flex-direction: column;
  color: var(--lg-text);
}

.lg-menu-panel.is-fixed {
  position: fixed;
  right: auto;
  top: auto;
  z-index: 120;
}

.lg-menu-panel a,
.lg-menu-panel button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 0;
  background: none;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  color: var(--lg-ink);
  min-height: 44px;
}

.lg-menu-panel a:hover,
.lg-menu-panel button:hover {
  background: var(--lg-mist);
}

.lg-menu-panel .is-danger {
  color: var(--lg-coral);
}

.lg-chat-head {
  grid-template-columns: 40px 1fr auto;
}

.lg-safety-menu {
  display: none;
}

.lg-legal {
  padding: 0 16px 24px;
}

.lg-legal h2 {
  font-family: var(--lg-display);
  font-size: 1.1rem;
  margin: 18px 0 6px;
}

.lg-legal p {
  color: var(--lg-ink-soft);
  line-height: 1.55;
}

/* Tighter, denser feed chrome */
.lg-feed-page .lg-post {
  border: 0;
  margin-bottom: 14px;
  border-radius: 0;
  overflow: hidden;
}

.lg-feed-page .lg-post-head {
  padding: 12px 14px;
}

.lg-feed-page .lg-post-actions {
  padding: 6px 6px 0 8px;
}

.lg-topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Desktop polish */
@media (min-width: 640px) {
  .lg-app {
    border-inline: 1px solid var(--lg-line);
  }

  .lg-post {
    border-radius: 0;
  }

  .lg-auth-sheet-card,
  .lg-sheet-panel {
    border-radius: 16px 16px 0 0;
    margin-bottom: 0;
  }
}

/* ========== Direct Messages ========== */
.lg-dm-inbox-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px 0;
}

.lg-dm-inbox-head h1 {
  font-family: var(--lg-display);
  font-size: 1.45rem;
  margin: 0;
  letter-spacing: -0.03em;
}

.lg-dm-inbox-head .lg-back {
  font-size: 1.4rem;
  width: 40px;
  line-height: 40px;
}

.lg-dm-search {
  margin-top: 10px;
}

.lg-dm-hint {
  margin: 14px 16px 6px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--lg-ink-soft);
}

.lg-dm-inbox {
  padding-bottom: 8px;
}

.lg-dm-inbox .lg-dm-search {
  margin: 10px 14px 4px;
}

.lg-dm-list {
  list-style: none;
  margin: 0;
  padding: 4px 0 12px;
}

.lg-dm-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  transition: background 0.15s;
  border-radius: 14px;
  margin: 0 6px;
}

.lg-dm-row:active,
.lg-dm-row:hover {
  background: rgba(0, 119, 168, 0.055);
}

.lg-dm-row.is-unread .lg-dm-preview {
  color: var(--lg-ink);
  font-weight: 600;
}

.lg-dm-row.is-unread .lg-dm-top strong {
  font-weight: 750;
}

.lg-dm-avatar {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background:
    linear-gradient(145deg, rgba(10, 165, 194, 0.22), rgba(27, 107, 74, 0.16)),
    var(--lg-bg-elevated);
  box-shadow: 0 0 0 1px var(--lg-border);
}

.lg-dm-avatar img,
.lg-dm-avatar .lg-avatar-fallback {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 0;
  font-size: 1.15rem;
  line-height: 1;
}

.lg-dm-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.lg-dm-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.lg-dm-top strong {
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lg-dm-top time {
  font-size: 0.72rem;
  color: var(--lg-ink-soft);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.lg-dm-preview {
  font-size: 0.86rem;
  color: var(--lg-ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}

.lg-dm-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--lg-ocean);
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(0, 119, 168, 0.15);
}

.lg-dm-footer {
  padding: 8px 16px 28px;
  border-top: 1px solid var(--lg-line);
  margin-top: 8px;
}

.lg-dm-details {
  padding-bottom: 40px;
}


.lg-dm-details-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 20px 16px 24px;
  text-align: center;
}

.lg-dm-details-hero img,
.lg-dm-details-hero .lg-avatar-fallback {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 4px;
}

.lg-dm-details-hero strong {
  font-family: var(--lg-display);
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.lg-dm-details-hero span {
  color: var(--lg-ink-soft);
  font-size: 0.9rem;
}

.lg-settings-row-form {
  margin: 0;
}

.lg-settings-row-form .lg-settings-row {
  width: 100%;
  border: 0;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
  color: inherit;
}

/* Chat thread — immersive */
body.lg-chat-mode .lg-topbar,
body.lg-chat-mode .lg-tabbar,
body.lg-chat-mode .lg-toasts {
  display: none;
}

body.lg-chat-mode .lg-main-chat {
  padding: 0;
  min-height: 100dvh;
}

.lg-chat {
  --lg-kb: 0px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100dvh;
  max-width: var(--lg-max);
  margin: 0 auto;
  position: relative;
  padding-bottom: var(--lg-kb);
  transition: padding-bottom 0.12s ease;
  background:
    radial-gradient(900px 420px at 100% -10%, rgba(10, 165, 194, 0.1), transparent 55%),
    radial-gradient(700px 360px at 0% 100%, rgba(27, 107, 74, 0.06), transparent 50%),
    linear-gradient(180deg, var(--lg-bg) 0%, var(--lg-bg-accent) 55%, var(--lg-bg-elevated) 100%);
}

.lg-chat-head {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 10px;
  background: var(--lg-chrome);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border-bottom: 1px solid var(--lg-border-glass);
  z-index: 5;
}

.lg-chat-peer {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  border-radius: 12px;
  padding: 2px 6px 2px 2px;
  margin-inline: -2px;
  transition: background 0.15s;
}

.lg-chat-peer:hover {
  background: rgba(0, 119, 168, 0.06);
}

.lg-chat-peer img,
.lg-chat-peer .lg-avatar-fallback {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px var(--lg-border-glass);
}

.lg-chat-peer-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.lg-chat-peer strong {
  display: block;
  font-size: 0.97rem;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lg-chat-peer small,
#chat-peer-status {
  color: var(--lg-ink-soft);
  font-size: 0.72rem;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.15s;
}

#chat-peer-status.is-live,
#chat-peer-status.is-typing {
  color: var(--lg-palm);
  font-weight: 650;
}

.lg-chat-scroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 12px 12px 10px;
  display: flex;
  flex-direction: column;
  scroll-padding-bottom: 12px;
}

.lg-chat-messages {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
}

.lg-chat-privacy {
  align-self: center;
  max-width: 300px;
  margin: 6px 0 18px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--lg-chrome);
  color: var(--lg-ink-soft);
  font-size: 0.72rem;
  font-weight: 550;
  text-align: center;
  line-height: 1.4;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 6px;
}

.lg-chat-privacy-ico {
  flex-shrink: 0;
  margin-top: 1px;
  opacity: 0.75;
  color: var(--lg-ocean);
}

.lg-chat-day {
  align-self: center;
  margin: 12px 0 10px;
  padding: 5px 12px;
  border-radius: 99px;
  background: var(--lg-chrome);
  color: var(--lg-ink-soft);
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  box-shadow: 0 1px 0 rgba(4, 60, 90, 0.04);
}

.lg-chat-empty {
  text-align: center;
  padding: 48px 24px 28px;
  color: var(--lg-ink-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: auto 0;
}

.lg-chat-empty img,
.lg-chat-empty .lg-avatar-fallback {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 6px;
  box-shadow: 0 8px 28px rgba(4, 60, 90, 0.12);
}

.lg-chat-empty h2 {
  margin: 0;
  color: var(--lg-ink);
  font-family: var(--lg-display);
  font-size: 1.28rem;
  letter-spacing: -0.02em;
}

.lg-chat-empty p {
  margin: 0;
  font-size: 0.88rem;
}

.lg-chat-empty-hint {
  max-width: 28ch;
  line-height: 1.4;
  margin-bottom: 4px !important;
}

.lg-bubble-row {
  display: flex;
  margin: 1px 0;
  max-width: 100%;
}

.lg-bubble-row.is-enter {
  animation: lg-bubble-in 0.22s ease-out;
}

@keyframes lg-bubble-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lg-bubble-row.is-enter {
    animation: none;
  }
}

.lg-bubble-row.is-group-start {
  margin-top: 10px;
}

.lg-bubble-row.is-mine {
  justify-content: flex-end;
}

.lg-bubble-row.is-theirs {
  justify-content: flex-start;
}

.lg-bubble {
  max-width: min(78%, 340px);
  padding: 10px 13px 7px;
  border-radius: 18px;
  position: relative;
  word-break: break-word;
}

.lg-bubble.is-media-only {
  padding: 4px;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

.lg-bubble-row.is-mine .lg-bubble {
  background: linear-gradient(145deg, #12b3d0, var(--lg-ocean-deep));
  color: #fff;
  border-bottom-right-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 119, 168, 0.2);
}

.lg-bubble-row.is-mine.is-group-end .lg-bubble {
  border-bottom-right-radius: 18px;
}

.lg-bubble-row.is-mine:not(.is-group-end) .lg-bubble {
  border-bottom-right-radius: 6px;
}

.lg-bubble-row.is-theirs .lg-bubble {
  background: var(--lg-surface);
  border: 1px solid var(--lg-border-glass);
  color: var(--lg-ink);
  border-bottom-left-radius: 6px;
  box-shadow: 0 1px 2px rgba(4, 60, 90, 0.04);
}

.lg-bubble-row.is-theirs.is-group-end .lg-bubble {
  border-bottom-left-radius: 18px;
}

.lg-bubble p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.38;
}

.lg-bubble-link {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}

.lg-bubble-row.is-mine .lg-bubble-link {
  color: #fff;
}

.lg-bubble time {
  display: block;
  margin-top: 4px;
  font-size: 0.65rem;
  opacity: 0.72;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.lg-bubble-row.is-theirs .lg-bubble time {
  color: var(--lg-ink-soft);
  opacity: 1;
}

.lg-bubble-row:not(.is-group-end) .lg-bubble time {
  display: none;
}

.lg-bubble-media {
  display: block;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
  border-radius: 14px;
  overflow: hidden;
  max-width: 240px;
}

.lg-bubble-img {
  display: block;
  max-width: 240px;
  width: 100%;
  border-radius: 14px;
  margin: 0;
}

.lg-bubble:not(.is-media-only) .lg-bubble-media {
  margin: 0 0 6px;
}

.lg-bubble.is-media-only time {
  margin: 4px 6px 2px;
  color: var(--lg-ink-soft);
  opacity: 1;
  text-shadow: none;
}

.lg-bubble-row.is-mine .lg-bubble.is-media-only time {
  color: var(--lg-ink-soft);
  text-align: right;
}

.lg-bubble-row.is-pending {
  opacity: 0.7;
}

.lg-bubble-row.is-pending .lg-bubble {
  filter: saturate(0.85);
}

.lg-bubble-row.is-failed .lg-bubble {
  outline: 1.5px solid var(--lg-coral);
  outline-offset: 1px;
}

.lg-bubble-row.is-failed {
  cursor: pointer;
}

.lg-bubble-row.is-failed::after {
  content: "!";
  align-self: flex-end;
  margin: 0 4px 8px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--lg-coral);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.lg-chat-seen {
  align-self: flex-end;
  margin: 2px 8px 10px;
  font-size: 0.7rem;
  font-weight: 650;
  color: var(--lg-ink-soft);
  letter-spacing: 0.01em;
}

.lg-chat-seen.is-live {
  animation: lg-seen-in 0.25s ease-out;
}

@keyframes lg-seen-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lg-chat-seen.is-live {
    animation: none;
  }
}

.lg-deleted {
  font-style: italic;
  opacity: 0.8;
  font-size: 0.88rem !important;
}

.lg-typing {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 10px 14px;
  margin: 6px 0 0 2px;
  width: fit-content;
  background: var(--lg-surface);
  border: 1px solid var(--lg-line);
  border-radius: 18px;
  box-shadow: 0 1px 2px rgba(4, 60, 90, 0.04);
}

.lg-typing[hidden] {
  display: none !important;
}

.lg-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lg-ink-soft);
  animation: lg-typing 1.2s infinite ease-in-out;
}

.lg-typing-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.lg-typing-dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes lg-typing {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.lg-chat-jump {
  position: absolute;
  left: 50%;
  bottom: calc(76px + env(safe-area-inset-bottom, 0px) + var(--lg-kb));
  transform: translateX(-50%);
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 99px;
  border: 1px solid var(--lg-line);
  background: var(--lg-chrome-strong);
  color: var(--lg-ocean);
  font-size: 0.8rem;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(4, 60, 90, 0.14);
  cursor: pointer;
}

.lg-chat-jump[hidden] {
  display: none !important;
}

.lg-chat-jump .lg-icon {
  transform: rotate(90deg);
}

.lg-chat-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--lg-chrome);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--lg-border-glass);
  z-index: 5;
}

.lg-chat-attach {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: var(--lg-ocean);
  flex-shrink: 0;
  cursor: pointer;
  transition: background 0.15s, transform 0.12s;
}

.lg-chat-attach:hover {
  background: var(--lg-mist);
}

.lg-chat-attach:active {
  transform: scale(0.96);
}

.lg-composer-field {
  flex: 1;
  min-width: 0;
  background: var(--lg-mist);
  border-radius: 22px;
  border: 1px solid var(--lg-line);
  padding: 9px 14px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.lg-composer-field:focus-within {
  border-color: rgba(10, 165, 194, 0.5);
  box-shadow: 0 0 0 3px rgba(10, 165, 194, 0.12);
  background: var(--lg-surface);
}

.lg-composer-field textarea {
  width: 100%;
  border: 0;
  background: transparent;
  resize: none;
  outline: none;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.35;
  max-height: 120px;
  color: var(--lg-ink);
}

.lg-attach-preview {
  position: relative;
  margin-top: 8px;
  width: fit-content;
}

.lg-attach-preview img {
  max-height: 96px;
  border-radius: 12px;
  display: block;
  box-shadow: 0 2px 10px rgba(4, 60, 90, 0.12);
}

.lg-attach-clear {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 0;
  background: var(--lg-ink);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}

.lg-chat-send {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 0;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: var(--lg-line);
  color: var(--lg-ink-soft);
  transition: background 0.15s, color 0.15s, transform 0.12s, box-shadow 0.15s;
  padding: 0;
}

.lg-chat-send-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.lg-chat-send.is-ready {
  background: linear-gradient(145deg, var(--lg-lagoon), var(--lg-ocean));
  color: #fff;
  box-shadow: 0 6px 16px rgba(0, 119, 168, 0.28);
}

.lg-chat-send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.lg-chat-send:not(:disabled):active {
  transform: scale(0.94);
}

.lg-chat-lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(8, 16, 24, 0.92);
  display: grid;
  place-items: center;
  padding: 24px;
}

.lg-chat-lightbox[hidden] {
  display: none !important;
}

.lg-chat-lightbox img {
  max-width: min(100%, 720px);
  max-height: min(86dvh, 900px);
  object-fit: contain;
  border-radius: 8px;
}

.lg-chat-lightbox-close {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: 12px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  display: grid;
  place-items: center;
}

body.lg-chat-lightbox-open {
  overflow: hidden;
}

.lg-sheet[hidden] {
  display: none !important;
}

.lg-sheet {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  align-items: end;
  justify-items: center;
}

.lg-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 30, 45, 0.45);
}

.lg-sheet-panel {
  position: relative;
  width: min(100%, var(--lg-max));
  margin: 0;
  background: var(--lg-surface);
  color: var(--lg-text);
  border-radius: 16px 16px 0 0;
  overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: var(--lg-shadow-strong);
  animation: lg-sheet-up 0.22s ease;
}

.lg-sheet-panel::before {
  content: "";
  display: block;
  width: 36px;
  height: 4px;
  border-radius: 99px;
  background: var(--lg-border-strong);
  margin: 10px auto 4px;
}

.lg-sheet-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px;
  border: 0;
  border-bottom: 1px solid var(--lg-line);
  background: var(--lg-surface);
  font: inherit;
  font-size: 1rem;
  font-weight: 650;
  cursor: pointer;
  text-align: center;
  min-height: 52px;
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.lg-sheet-action .lg-icon {
  color: var(--lg-ink-soft);
  flex-shrink: 0;
}

.lg-sheet-action:active {
  background: var(--lg-mist);
}

.lg-sheet-action:last-child {
  border-bottom: 0;
}

.lg-sheet-action.is-danger {
  color: var(--lg-coral);
}

/* ——— Image editor (Instagram-style crop / filters) ——— */
body.lg-ie-open {
  overflow: hidden;
}

body.lg-ie-open .lg-tabbar,
body.lg-ie-open .lg-topbar {
  visibility: hidden;
}

.lg-dropzone-hit {
  display: block;
  cursor: pointer;
  min-height: 220px;
}

.lg-dropzone.is-dragover {
  border-color: var(--lg-ocean);
  box-shadow: inset 0 0 0 1px var(--lg-ocean);
}

.lg-dropzone.has-image {
  border-style: solid;
  border-color: var(--lg-line);
  position: relative;
}

.lg-dropzone.has-image .lg-dropzone-hit {
  pointer-events: none;
}

.lg-dropzone.has-image .lg-dropzone-inner {
  padding: 0;
  min-height: 0;
  background: #0d1520;
}

.lg-ie-preview-img {
  width: 100%;
  height: auto;
  max-height: min(70vh, 560px);
  object-fit: contain;
  object-position: center;
  display: block;
  background: #0d1520;
}

.lg-ie-preview-img.is-circle {
  border-radius: 50%;
  max-width: 240px;
  max-height: 240px;
  min-height: 240px;
  margin: 20px auto;
}

.lg-ie-preview-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 10px;
  background: linear-gradient(transparent, rgba(8, 20, 28, 0.55));
  z-index: 2;
}

.lg-ie-preview-bar .lg-btn {
  background: rgba(255, 255, 255, 0.94);
  color: var(--lg-ink);
  border: 0;
  min-height: 34px;
  padding: 0 14px;
  font-size: 0.82rem;
}

.lg-ie {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: #0b1216;
  color: #fff;
  display: flex;
  flex-direction: column;
}

.lg-ie[hidden] {
  display: none !important;
}

.lg-ie-chrome {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

.lg-ie-top {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  min-height: 52px;
}

.lg-ie-icon-btn {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.lg-ie-tabs {
  display: flex;
  justify-content: center;
  gap: 4px;
}

.lg-ie-tab {
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.lg-ie-tab.is-active {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.lg-ie-done {
  border: 0;
  background: transparent;
  color: var(--lg-lagoon, #0aa5c2);
  font: inherit;
  font-weight: 800;
  font-size: 0.95rem;
  padding: 10px 12px;
  cursor: pointer;
}

.lg-ie-done:disabled {
  opacity: 0.5;
  cursor: wait;
}

.lg-ie-stage {
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 8px 12px;
  touch-action: none;
  user-select: none;
}

.lg-ie-frame {
  position: relative;
  overflow: hidden;
  background: #000;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18);
  max-width: 100%;
  max-height: 100%;
}

.lg-ie-frame.is-circle {
  border-radius: 50%;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.35),
    0 0 0 999px rgba(0, 0, 0, 0.45);
}

.lg-ie-frame.is-dragging .lg-ie-grid {
  opacity: 1;
}

.lg-ie-layer {
  position: absolute;
  left: 50%;
  top: 50%;
  transform-origin: center center;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.lg-ie-frame.is-dragging .lg-ie-layer {
  will-change: transform, filter;
}

.lg-ie-layer img {
  display: block;
  max-width: none;
  pointer-events: none;
  -webkit-user-drag: none;
  /* Filters live on .lg-ie-layer — keep img clean for GPU stability on mobile */
  transform: translateZ(0);
}

.lg-ie-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  background:
    linear-gradient(to right, transparent 32.9%, rgba(255, 255, 255, 0.35) 33%, rgba(255, 255, 255, 0.35) 33.4%, transparent 33.5%),
    linear-gradient(to right, transparent 66.2%, rgba(255, 255, 255, 0.35) 66.3%, rgba(255, 255, 255, 0.35) 66.7%, transparent 66.8%),
    linear-gradient(to bottom, transparent 32.9%, rgba(255, 255, 255, 0.35) 33%, rgba(255, 255, 255, 0.35) 33.4%, transparent 33.5%),
    linear-gradient(to bottom, transparent 66.2%, rgba(255, 255, 255, 0.35) 66.3%, rgba(255, 255, 255, 0.35) 66.7%, transparent 66.8%);
}

.lg-ie-tools {
  padding: 10px 14px 16px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.35));
}

.lg-ie-aspects {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 10px;
  scrollbar-width: none;
}

.lg-ie-aspects::-webkit-scrollbar {
  display: none;
}

.lg-ie-aspect {
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.lg-ie-aspect.is-active {
  background: #fff;
  color: #0b1216;
  border-color: #fff;
}

.lg-ie-slider,
.lg-ie-zoom {
  display: grid;
  grid-template-columns: minmax(4.5rem, auto) 1fr;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.lg-ie-slider-label,
.lg-ie-zoom-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  min-width: 0;
}

.lg-ie-slider-val {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.72);
}

.lg-ie-slider.is-active .lg-ie-slider-val {
  color: var(--lg-lagoon, #0aa5c2);
}

.lg-ie-slider input[type="range"],
.lg-ie-zoom input[type="range"] {
  width: 100%;
  accent-color: var(--lg-lagoon, #0aa5c2);
}

.lg-ie-actions {
  display: flex;
  justify-content: space-around;
  gap: 8px;
}

.lg-ie-tool {
  border: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border-radius: 12px;
  cursor: pointer;
  opacity: 0.9;
}

.lg-ie-tool:active {
  background: rgba(255, 255, 255, 0.08);
}

.lg-ie-filters {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px 8px;
  scrollbar-width: none;
}

.lg-ie-filters::-webkit-scrollbar {
  display: none;
}

.lg-ie-filter {
  flex: 0 0 auto;
  width: 76px;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 650;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 0;
}

.lg-ie-filter.is-active {
  color: #fff;
}

.lg-ie-filter-swatch {
  width: 68px;
  height: 68px;
  border-radius: 12px;
  border: 2px solid transparent;
  background: linear-gradient(145deg, #3aa0c8, #1b6b4a 45%, #e85d4c);
}

.lg-ie-filter.is-active .lg-ie-filter-swatch {
  border-color: #fff;
}

.lg-ie-filter[data-filter="vivid"] .lg-ie-filter-swatch {
  filter: saturate(1.4) contrast(1.08);
  -webkit-filter: saturate(1.4) contrast(1.08);
}
.lg-ie-filter[data-filter="bright"] .lg-ie-filter-swatch {
  filter: brightness(1.14) saturate(1.05);
  -webkit-filter: brightness(1.14) saturate(1.05);
}
.lg-ie-filter[data-filter="contrast"] .lg-ie-filter-swatch {
  filter: contrast(1.28) saturate(1.05);
  -webkit-filter: contrast(1.28) saturate(1.05);
}
.lg-ie-filter[data-filter="warm"] .lg-ie-filter-swatch {
  filter: sepia(0.28) saturate(1.2) brightness(1.04);
  -webkit-filter: sepia(0.28) saturate(1.2) brightness(1.04);
}
.lg-ie-filter[data-filter="cool"] .lg-ie-filter-swatch {
  filter: hue-rotate(190deg) saturate(0.95) brightness(1.04);
  -webkit-filter: hue-rotate(190deg) saturate(0.95) brightness(1.04);
}
.lg-ie-filter[data-filter="fade"] .lg-ie-filter-swatch {
  filter: contrast(0.88) brightness(1.1) saturate(0.8);
  -webkit-filter: contrast(0.88) brightness(1.1) saturate(0.8);
}
.lg-ie-filter[data-filter="mono"] .lg-ie-filter-swatch {
  filter: grayscale(1) contrast(1.1);
  -webkit-filter: grayscale(1) contrast(1.1);
}

.lg-ie-loading {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-content: center;
  gap: 12px;
  background: rgba(11, 18, 22, 0.72);
  text-align: center;
  pointer-events: none;
}

.lg-ie-loading[hidden] {
  display: none !important;
}

.lg-ie-loading p {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 650;
  color: rgba(255, 255, 255, 0.88);
}

.lg-ie-spinner {
  width: 36px;
  height: 36px;
  margin: 0 auto;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  animation: lg-ie-spin 0.7s linear infinite;
}

@keyframes lg-ie-spin {
  to {
    transform: rotate(360deg);
  }
}

.lg-ie-status {
  min-height: 0;
  padding: 0 16px;
  font-size: 0.82rem;
  font-weight: 650;
  color: #ffb4a8;
  text-align: center;
}

.lg-ie-status:empty {
  display: none;
}

.lg-ie-inline-error {
  margin: 8px 0 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(232, 93, 76, 0.12);
  color: var(--lg-coral);
  font-size: 0.82rem;
  font-weight: 650;
}

.lg-ie-avatar-bar {
  position: static;
  background: transparent;
  padding: 8px 0 0;
  justify-content: flex-start;
}

.lg-ie-layer {
  will-change: auto;
}

.lg-ie.is-loading .lg-ie-frame {
  opacity: 0.35;
}

@media (prefers-reduced-motion: reduce) {
  .lg-ie-spinner {
    animation: none;
    border-top-color: rgba(255, 255, 255, 0.55);
  }

  .lg-ie-frame .lg-ie-grid,
  .lg-ie-layer {
    transition: none !important;
  }
}

@media (min-width: 720px) {
  .lg-ie {
    background: rgba(8, 14, 18, 0.92);
    backdrop-filter: blur(8px);
  }

  .lg-ie-chrome {
    background: #0b1216;
    border-radius: 16px;
    margin: 24px auto;
    height: calc(100% - 48px);
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  }
}

/* Auth entrance (login / signup) */
.lg-auth-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 18px calc(28px + env(safe-area-inset-bottom));
  animation: lg-brand-in 0.4s ease both;
}

.lg-auth-card {
  width: min(100%, 400px);
  background: var(--lg-surface-glass);
  border: 1px solid var(--lg-line);
  border-radius: 20px;
  padding: 26px 22px 30px;
  box-shadow: var(--lg-shadow);
}

.lg-auth-card h1 {
  font-family: var(--lg-display);
  font-size: 1.45rem;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}

.lg-auth-card p,
.lg-auth-card li {
  color: var(--lg-ink-soft);
  font-size: 0.92rem;
}

.lg-auth-card label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--lg-ink-soft);
  margin-top: 10px;
}

.lg-auth-card .lg-field {
  margin-bottom: 4px;
}

.lg-auth-card .lg-field .lg-label {
  margin-top: 10px;
}

.lg-auth-card .lg-check-inline {
  display: flex !important;
  align-items: center;
  gap: 10px;
  margin: 14px 0 2px;
  padding: 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--lg-ink);
  cursor: pointer;
  background: none;
  border: 0;
}

.lg-auth-card .lg-check-inline-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.3;
}

.lg-auth-card .lg-check-inline-label small {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--lg-ink-soft);
}

.lg-auth-card .lg-checkbox {
  width: 20px;
  height: 20px;
  margin: 0;
  flex-shrink: 0;
}

.lg-auth-card input[type="email"],
.lg-auth-card input[type="password"],
.lg-auth-card input[type="text"],
.lg-auth-card .lg-input {
  width: 100%;
  border: 1px solid var(--lg-line);
  border-radius: 12px;
  padding: 12px 14px;
  margin-top: 6px;
  font: inherit;
  background: var(--lg-surface);
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.lg-auth-card input[type="email"]:focus,
.lg-auth-card input[type="password"]:focus,
.lg-auth-card input[type="text"]:focus,
.lg-auth-card .lg-input:focus {
  outline: none;
  border-color: var(--lg-lagoon);
  box-shadow: 0 0 0 3px rgba(10, 165, 194, 0.16);
}

.lg-auth-card input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin: 0;
}

.lg-auth-card button,
.lg-auth-card input[type="submit"] {
  width: 100%;
  min-height: 48px;
  margin-top: 16px;
  border: 0;
  border-radius: 12px;
  font-weight: 700;
  font: inherit;
  color: #fff;
  background: linear-gradient(135deg, var(--lg-lagoon), var(--lg-ocean-deep));
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 119, 168, 0.22);
  transition: transform 0.15s, box-shadow 0.15s;
}

.lg-auth-card button:hover,
.lg-auth-card input[type="submit"]:hover {
  box-shadow: 0 8px 22px rgba(0, 119, 168, 0.28);
}

.lg-auth-card button:active,
.lg-auth-card input[type="submit"]:active {
  transform: scale(0.985);
}

.lg-auth-card a {
  color: var(--lg-ocean);
  font-weight: 600;
}

.lg-auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  text-decoration: none;
}

.lg-auth-brand .lg-brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
}

.lg-auth-brand .lg-brand-text {
  font-size: 1.45rem;
}

.lg-auth-footer {
  margin-top: 18px;
  text-align: center;
  font-size: 0.9rem;
}

.lg-auth-toast {
  position: relative;
  margin-bottom: 12px;
}

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

  .lg-topbar .lg-brand,
  .lg-auth-shell,
  .lg-post {
    animation: none !important;
  }

  .lg-story-ring.has-story {
    animation: none !important;
  }

  .lg-badge-pulse {
    animation: none !important;
  }
}

/* --- Photo person tags --- */
.lg-post-media {
  position: relative;
}

.lg-photo-tags {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.lg-post-media.is-tags-on .lg-photo-tags {
  pointer-events: auto;
}

.lg-photo-tag {
  position: absolute;
  transform: translate(-50%, -120%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  color: #fff;
  pointer-events: auto;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45));
}

.lg-photo-tag-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(10, 165, 194, 0.9);
}

.lg-photo-tag-label {
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(8, 18, 24, 0.82);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lg-photo-tag-hint {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(8, 18, 24, 0.72);
  color: #fff;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(6px);
}

.lg-post-media.is-tags-on .lg-photo-tag-hint {
  background: rgba(10, 165, 194, 0.92);
}

.lg-photo-tagger {
  margin: 8px 0 4px;
}

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

.lg-photo-tagger-hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--lg-ink-soft);
}

.lg-photo-tagger-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lg-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--lg-line);
  background: var(--lg-mist);
  border-radius: 999px;
  padding: 6px 10px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.lg-compose-tag-pin,
.lg-edit-photo .lg-compose-tag-pin {
  position: absolute;
  transform: translate(-50%, -110%);
  z-index: 5;
  border: 0;
  background: rgba(8, 18, 24, 0.86);
  color: #fff;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 5px 8px;
  border-radius: 8px;
  cursor: pointer;
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lg-compose-tag-pin.is-pending {
  background: var(--lg-lagoon, #0aa5c2);
  pointer-events: none;
}

.lg-compose-tag-pin::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(10, 165, 194, 0.95);
}

.lg-edit-photo {
  position: relative;
  margin-bottom: 12px;
  border-radius: 12px;
  overflow: hidden;
  background: #0d1520;
}

.lg-edit-photo .lg-edit-thumb {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
}

.lg-tag-sheet .lg-tag-search {
  padding: 0 14px 10px;
}

.lg-tag-results {
  max-height: min(50vh, 360px);
  overflow: auto;
  padding: 0 8px 16px;
}

.lg-tag-result {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  padding: 10px 8px;
  border-radius: 12px;
  cursor: pointer;
}

.lg-tag-result:hover,
.lg-tag-result:focus-visible {
  background: var(--lg-mist);
}

.lg-tag-result img,
.lg-tag-result .lg-avatar-fallback {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
}

.lg-tag-result strong {
  display: block;
}

.lg-tag-result small {
  color: var(--lg-ink-soft);
}

.lg-tag-empty {
  margin: 12px 8px;
  color: var(--lg-ink-soft);
  font-size: 0.9rem;
}

/* ——— Appearance / theme picker ——— */
.lg-theme-options {
  display: grid;
  gap: 10px;
  margin: 8px 0 20px;
}

.lg-theme-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 14px;
  border-radius: 14px;
  border: 1px solid var(--lg-border);
  background: var(--lg-surface);
  color: var(--lg-text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.lg-theme-option:hover {
  background: var(--lg-surface-2);
  border-color: var(--lg-border-strong);
}

.lg-theme-option.is-active {
  border-color: var(--lg-lagoon);
  box-shadow: 0 0 0 3px rgba(10, 165, 194, 0.2);
}

.lg-theme-swatch {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  flex-shrink: 0;
  border: 1px solid var(--lg-border);
  background:
    linear-gradient(135deg, var(--lg-bg) 50%, var(--lg-surface) 50%);
  position: relative;
  overflow: hidden;
}

.lg-theme-swatch[data-swatch="light"] {
  background: linear-gradient(135deg, #eef5f8 45%, #ffffff 45%);
}

.lg-theme-swatch[data-swatch="dark"] {
  background: linear-gradient(135deg, #0b1216 45%, #121a22 45%);
}

.lg-theme-swatch[data-swatch="system"] {
  background: linear-gradient(90deg, #eef5f8 50%, #0b1216 50%);
}

.lg-theme-option-copy {
  flex: 1;
  min-width: 0;
}

.lg-theme-option-copy strong {
  display: block;
  font-size: 0.95rem;
}

.lg-theme-option-copy small {
  display: block;
  margin-top: 2px;
  color: var(--lg-text-muted);
  font-size: 0.8rem;
}

.lg-theme-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--lg-border-strong);
  flex-shrink: 0;
}

.lg-theme-option.is-active .lg-theme-check {
  border-color: var(--lg-lagoon);
  background: var(--lg-lagoon);
  box-shadow: inset 0 0 0 4px var(--lg-surface);
}

html[data-theme="dark"] .lg-tabbar {
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] .lg-icon-btn.is-active {
  background: rgba(46, 196, 214, 0.14);
}

html[data-theme="dark"] .lg-create-orb {
  color: #fff;
}

html[data-theme="dark"] .lg-brand-text {
  background: linear-gradient(120deg, var(--lg-ocean-deep), var(--lg-lagoon) 55%, var(--lg-palm));
  -webkit-background-clip: text;
  background-clip: text;
}
