[hidden] { display: none !important; }

:root {
  color-scheme: dark;
  --bg: #09090b;
  --surface: #19191c;
  --surface-raised: #222225;
  --surface-soft: #151517;
  --line: rgba(255,255,255,.08);
  --text: #f6f5f6;
  --muted: #a09da3;
  --accent: #de8c98;
  --accent-strong: #efa3ad;
  --accent-ink: #261619;
  --radius-card: 22px;
}
.profile-menu__notifications {
  margin: 12px 0 18px;
  padding: 14px;
  border-color: rgba(233, 133, 151, .13);
  border-radius: 17px;
  background: linear-gradient(145deg, rgba(42, 34, 42, .88), rgba(27, 24, 30, .92));
}
.profile-menu__notifications-trigger {
  position: absolute;
  z-index: 3;
  top: calc(env(safe-area-inset-top, 0px) + 18px);
  right: 2px;
  width: 42px;
  min-width: 42px;
  min-height: 42px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(233, 133, 151, .2);
  border-radius: 50%;
  color: var(--accent-strong);
  background: rgba(233, 133, 151, .08);
}
.profile-menu__notifications-trigger:hover:not(:disabled) {
  color: #ffe8ec;
  background: rgba(233, 133, 151, .16);
}
.profile-menu__notifications-trigger .notification-settings__icon {
  width: 20px;
  height: 20px;
}
.profile-menu__notifications h3 {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
}
.notification-settings__icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  fill: none;
  stroke: var(--accent-strong);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.profile-menu__notifications > button {
  min-height: 44px;
  border-radius: 12px;
}
.profile-menu__notifications .push-preview-option {
  line-height: 1.4;
}
body.community-dialog-open { overflow: hidden; }

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: var(--bg); }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(ellipse at 75% 10%, rgba(115,64,87,.12), transparent 35%),
    radial-gradient(ellipse at 15% 75%, rgba(74,54,102,.10), transparent 38%),
    var(--bg);
}
.profile-menu__install {
  width: 100%;
  margin: 22px 0 0;
  padding: 13px;
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(38, 33, 40, .78), rgba(22, 20, 24, .88));
}
.profile-menu__install h3 {
  margin: 0 0 4px;
  color: #fbf5f8;
  font-size: 14px;
}
.profile-menu__install > div > p { margin-bottom: 10px; }
.profile-menu__install > .pwa-install-button { min-height: 44px; }
body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  content: "";
  pointer-events: none;
  opacity: .12;
  background: url("assets/daf64.png") center / 520px auto repeat;
  mask-image: linear-gradient(135deg, #000, transparent 75%);
}

header {
  height: 76px;
  padding: 0 clamp(18px, 4vw, 54px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(17,17,19,.78);
  backdrop-filter: blur(18px);
}
header h1 {
  margin: 0;
  color: var(--text);
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -.055em;
}
header h1::first-letter { color: var(--accent); }

main {
  width: min(100%, 1440px);
  min-height: calc(100vh - 76px);
  margin-inline: auto;
  padding: 28px clamp(16px, 4vw, 52px) 44px;
}

#auth-section {
  width: min(100%, 440px);
  margin: clamp(36px, 10vh, 100px) auto;
  padding: clamp(24px, 5vw, 38px);
  border: 1px solid var(--line);
  border-radius: 26px;
  background: linear-gradient(145deg, rgba(37,36,40,.96), rgba(24,24,27,.98));
  box-shadow: 0 28px 90px rgba(0,0,0,.4), inset 0 1px rgba(255,255,255,.035);
}
#auth-section h2, .page-section > h2 {
  margin: 0 0 24px;
  font-size: clamp(22px, 4vw, 28px);
  line-height: 1.2;
  font-weight: 650;
  letter-spacing: -.035em;
}

form { min-width: 0; }
#auth-form, #profile-form, #post-form, #conversation-form, #server-form,
#channel-form, #message-form, #channel-message-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px 12px;
}
label {
  display: block;
  width: 100%;
  margin: 3px 0 -5px;
  color: #c7c4c9;
  font-size: 13px;
  font-weight: 550;
}
input, textarea {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 12px 15px;
  color: var(--text);
  font: inherit;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 15px;
  outline: none;
  background: #141416;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, textarea:focus {
  border-color: rgba(222,140,152,.65);
  background: #171619;
  box-shadow: 0 0 0 3px rgba(222,140,152,.10);
}
input[type="file"] { padding: 9px; color: var(--muted); }
input[type="file"]::file-selector-button {
  min-height: 30px;
  margin-right: 10px;
  padding: 0 12px;
  color: var(--text);
  border: 0;
  border-radius: 10px;
  background: #303034;
  cursor: pointer;
}
button {
  min-height: 44px;
  padding: 0 18px;
  color: #e7e4e8;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 15px;
  background: #2b2a2e;
  cursor: pointer;
  transition: transform .16s, color .16s, background .16s, border-color .16s, box-shadow .16s;
}
button:hover:not(:disabled) {
  color: #fff;
  border-color: rgba(222,140,152,.24);
  background: #373439;
}
button:active:not(:disabled) { transform: scale(.98); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button:disabled { opacity: .5; cursor: not-allowed; }
#auth-form button[type="submit"], #profile-form button[type="submit"],
#post-form button[type="submit"], #conversation-form button[type="submit"],
#server-form button[type="submit"], #channel-form button[type="submit"],
#message-form button[type="submit"], #channel-message-form button[type="submit"],
#resend-confirmation {
  color: var(--accent-ink);
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
  box-shadow: 0 7px 22px rgba(222,140,152,.16);
}
#auth-form button[type="submit"] { flex: 1 1 100%; margin-top: 8px; }
#auth-form #sign-up { flex: 1 1 100%; background: #302d32; }
#sign-out { color: #f2c9cf; background: rgba(222,140,152,.10); border-color: rgba(222,140,152,.16); }
#auth-status, #profile-status, #feed-status, #chat-status, #community-status {
  min-height: 1.5em;
  margin: 14px 0 0;
  color: #c8a9af;
  overflow-wrap: anywhere;
}

#app {
  min-height: calc(100vh - 148px);
  display: grid;
  grid-template-columns: 88px minmax(0,1fr);
  align-items: stretch;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(16,16,18,.68);
  box-shadow: 0 24px 80px rgba(0,0,0,.24);
}
#app > nav {
  min-height: 100%;
  padding: 22px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  border-right: 1px solid var(--line);
  background: rgba(31,30,33,.92);
}
#app > nav button {
  width: 70px;
  min-height: 68px;
  padding: 8px 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: #858188;
  font-size: 10px;
  font-weight: 600;
  border-color: transparent;
  border-radius: 17px;
  background: transparent;
}
#app > nav button::before { font-size: 21px; line-height: 1; }
#app > nav button[data-section="reels-section"]::before { content: "▷"; }
#app > nav .nav-icon { display: block; width: 25px; height: 25px; flex: 0 0 25px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
#app > nav [data-section="chats-section"] { position: relative; }
#app > nav .nav-unread {
  position: absolute;
  top: 3px;
  right: 3px;
  display: grid;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  place-items: center;
  border: 2px solid #1f1e21;
  border-radius: 999px;
  color: #271619;
  background: var(--accent);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}
#app > nav .nav-unread[hidden] { display: none; }
#reel-publish-open { color: #e5a0aa; }
#reel-publish-open .nav-icon { width: 22px; height: 22px; }
#reel-publish-open:hover:not(:disabled) { color: #ffd3d9; background: rgba(222,140,152,.1); }
#app:has(#reels-section:not([hidden])) > nav [data-section="reels-section"],
#app:has(#chats-section:not([hidden])) > nav [data-section="chats-section"],
#app:has(#calls-section:not([hidden])) > nav [data-section="calls-section"],
#app:has(#friends-section:not([hidden])) > nav [data-section="friends-section"] {
  color: var(--accent);
  background: rgba(222,140,152,.10);
}
#app > nav button.nav-coming-soon { color: #656268; cursor: not-allowed; }
.page-section {
  min-width: 0;
  width: min(100%, 980px);
  margin: 0 auto;
  padding: clamp(24px, 4vw, 48px);
  overflow: auto;
}
.page-section > h2 { padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.contacts-panel { width: min(100%, 620px); min-height: 70vh; margin: 0 auto 34px; padding: 18px clamp(14px, 3vw, 30px) 28px; border: 1px solid rgba(255,255,255,.045); border-radius: 22px; background: #202023; }
.contacts-search { display: flex; min-height: 48px; align-items: center; gap: 10px; padding: 0 16px; border: 1px solid rgba(222,140,152,.32); border-radius: 999px; color: #aaa7ac; background: #1b1b1e; }
.contacts-search > span { font-size: 23px; line-height: 1; }
.contacts-search input { width: 100%; min-width: 0; min-height: 42px; padding: 0; border: 0; color: var(--text); background: transparent; box-shadow: none; }
.contacts-search input:focus { border: 0; box-shadow: none; }
.contacts-panel > h3 { margin: 10px 0 18px; font-size: 20px; text-align: center; }
.contacts-list { display: grid; gap: 5px; }
.contact-row { display: flex; min-height: 66px; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 2px; }
.contact-identity { display: flex; flex: 1 1 auto; min-width: 0; align-items: center; gap: 12px; }
.contact-avatar { display: grid; width: 48px; height: 48px; flex: 0 0 48px; place-items: center; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; color: #f1b1bb; font-weight: 700; object-fit: cover; background: #343238; }
.contact-details { display: grid; min-width: 0; gap: 1px; }
.contact-details strong { overflow: hidden; color: #f2f1f2; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.contact-details small { color: #99969d; font-size: 12px; }
.contact-chat-button { display: flex; flex: 0 0 108px; width: 108px; height: 40px; min-width: 108px; min-height: 40px; align-items: center; justify-content: center; gap: 7px; padding: 0 10px; border: 0; border-radius: 999px; color: #e5a2ad; font-size: 12px; white-space: nowrap; background: #2a292d; }
.contact-chat-button:hover { color: #fff; background: #3a3036; }
.contact-chat-button svg { width: 19px; height: 19px; flex: 0 0 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.contacts-empty { margin: 20px 0; color: #99969d; text-align: center; }
#profile-form, #post-form, #conversation-form, #server-form, #channel-form {
  max-width: 680px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: linear-gradient(145deg, rgba(37,36,40,.82), rgba(24,24,27,.92));
}
#profile-form button, #post-form button, #conversation-form button,
#server-form button, #channel-form button { margin-top: 8px; }

#conversation-list, #server-list, #channel-list {
  max-width: 680px;
  margin: 18px 0;
  padding: 0;
  display: grid;
  gap: 8px;
  list-style: none;
}
#conversation-list li, #server-list li, #channel-list li { min-width: 0; }
#conversation-list button, #server-list button, #channel-list button {
  width: 100%;
  text-align: left;
  justify-content: flex-start;
  background: rgba(35,34,38,.9);
}
#chat-view, #server-view, #channel-view {
  max-width: 900px;
  margin-top: 20px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: rgba(27,26,29,.92);
}
#chat-title, #server-title, #channel-title { margin: 0 0 14px; font-size: 18px; }
#message-form, #channel-message-form {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
#message-form label, #channel-message-form label { display: none; }
#message-content, #channel-message-content { flex: 1 1 180px; }
#messages, #channel-messages, #posts {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}
.item {
  min-width: 0;
  padding: 15px 17px;
  overflow-wrap: anywhere;
  border: 1px solid rgba(255,255,255,.065);
  border-radius: 17px;
  background: #222124;
}
.item p { margin: 0 0 8px; }
.item p:first-child { color: #e8b4bc; font-size: 13px; font-weight: 650; }
.item small { color: #858188; font-size: 11px; }
.item img, .item video { display: block; max-width: 100%; max-height: min(60vh, 480px); margin-top: 12px; border-radius: 13px; }

@media (max-width: 720px) {
  header { height: 62px; padding-inline: 18px; }
  header h1 { font-size: 20px; }
  header #sign-out { min-height: 38px; padding-inline: 13px; }
  main { min-height: calc(100dvh - 62px); padding: 16px 12px calc(82px + env(safe-area-inset-bottom)); }
  #auth-section { margin: clamp(24px, 8vh, 70px) auto; padding: 25px 20px; border-radius: 22px; }
  #app {
    min-height: calc(100dvh - 160px - env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  #app > nav {
    position: fixed;
    z-index: 50;
    right: 0;
    bottom: 0;
    left: 0;
    min-height: calc(66px + env(safe-area-inset-bottom));
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    flex-direction: row;
    justify-content: space-around;
    gap: 3px;
    border-top: 1px solid rgba(255,255,255,.08);
    border-right: 0;
    background: rgba(27,26,29,.94);
    backdrop-filter: blur(18px);
  }
  #app > nav button { width: 25%; min-height: 54px; gap: 4px; font-size: 10px; }
  #app > nav button::before { font-size: 20px; }
  #app > nav .nav-icon { width: 23px; height: 23px; flex-basis: 23px; }
  .page-section { width: 100%; padding: 18px 4px 20px; overflow: visible; }
  .page-section > h2 { margin-bottom: 18px; padding: 4px 2px 16px; font-size: 23px; }
  #profile-form, #post-form, #conversation-form, #server-form, #channel-form,
  #chat-view, #server-view, #channel-view { padding: 17px; border-radius: 19px; }
  #conversation-list, #server-list, #channel-list { margin-top: 14px; }
  #message-form, #channel-message-form { gap: 8px; }
  #message-content, #channel-message-content { flex-basis: 100%; }
  #message-form button, #channel-message-form button { width: 100%; }
  .item { padding: 13px 14px; }
}

@media (max-width: 380px) {
  #app > nav button { font-size: 9px; }
  #app > nav button::before { font-size: 18px; }
  #profile-form, #post-form, #conversation-form, #server-form, #channel-form { padding: 14px; }
}

#auth-status.auth-status--error {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 13px;
  color: #ffc1c7;
  border: 1px solid rgba(255,116,132,.27);
  border-radius: 14px;
  background: rgba(142,48,62,.18);
  animation: auth-error-enter .42s cubic-bezier(.2,.85,.25,1.25) both;
}
#auth-status.auth-status--error::before {
  content: "!";
  width: 23px;
  height: 23px;
  flex: 0 0 23px;
  display: grid;
  place-items: center;
  color: #32181c;
  font-size: 14px;
  font-weight: 800;
  border-radius: 50%;
  background: #f29aa5;
}
@keyframes auth-error-enter {
  0% { opacity: 0; transform: translateY(7px) translateX(-7px); }
  55% { opacity: 1; transform: translateY(0) translateX(3px); }
  78% { transform: translateX(-2px); }
  100% { opacity: 1; transform: translateX(0); }
}
@media (prefers-reduced-motion: reduce) {
  #auth-status.auth-status--error { animation-duration: .01ms; }
}

/* Match the supplied messenger mockup: navigation rail, compact side panel, open canvas. */
@media (min-width: 721px) {
  main { max-width: none; padding: 16px 18px 22px; }
  #app {
    min-height: calc(100vh - 116px);
    grid-template-columns: 88px 360px minmax(0, 1fr);
    border: 1px solid rgba(255,255,255,.055);
    border-radius: 18px;
    background: #030304;
  }
  #app::after {
    grid-column: 3;
    grid-row: 1;
    min-width: 0;
    background-color: #030304;
    background-image:
      radial-gradient(circle at 14% 24%, rgba(80,35,116,.13), transparent 32%),
      radial-gradient(circle at 82% 74%, rgba(136,76,55,.08), transparent 38%),
      url("assets/daf64.png");
    background-size: auto, auto, 520px auto;
    background-blend-mode: screen, screen, soft-light;
  }
  #app > nav {
    grid-column: 1;
    grid-row: 1;
    min-height: 100%;
    padding: 16px 8px;
    gap: 23px;
    background: #212121;
    border-right: 0;
  }
  #app > nav::before { display: none; }
  #app > nav button {
    width: 70px;
    min-height: 56px;
    gap: 4px;
    color: #68676c;
    font-size: 10px;
    font-weight: 500;
  }
  #app > nav button::before { font-size: 22px; }
#app:has(#reels-section:not([hidden])) > nav [data-section="reels-section"],
  #app:has(#chats-section:not([hidden])) > nav [data-section="chats-section"],
  #app:has(#friends-section:not([hidden])) > nav [data-section="friends-section"] {
    color: var(--accent);
    background: transparent;
  }
  .page-section {
    grid-column: 2;
    grid-row: 1;
    width: 360px;
    max-width: 100%;
    min-height: 100%;
    margin: 0;
    padding: 18px 12px 26px;
    color: #f5f3f5;
    background: #212121;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-color: #48474b transparent;
  }
  .page-section > h2 {
    margin: 5px 0 16px;
    padding: 0 4px 13px;
    text-align: center;
    font-size: 19px;
    border: 0;
  }
  #profile-form, #post-form, #conversation-form, #server-form, #channel-form {
    padding: 14px;
    border-radius: 17px;
    background: #262629;
  }
  #chat-view, #server-view, #channel-view { padding: 14px; border-radius: 17px; }
  #conversation-list button, #server-list button, #channel-list button {
    min-height: 54px;
    border-radius: 14px;
  }
  .item { border-radius: 15px; }
}

@media (max-width: 720px) {
  #app { position: static; }
  #app::after { display: none; }
  #app > nav::before { display: none; }
  #app > nav button {
    min-height: 54px;
    color: #68676c;
    border-radius: 14px;
    background: transparent;
  }
  #app:has(#profile-section:not([hidden])) > nav [data-section="profile-section"],
  #app:has(#feed-section:not([hidden])) > nav [data-section="feed-section"],
  #app:has(#chats-section:not([hidden])) > nav [data-section="chats-section"],
  #app:has(#communities-section:not([hidden])) > nav [data-section="communities-section"] {
    color: var(--accent);
    background: rgba(222,140,152,.07);
  }
  .page-section { background: transparent; }
  #profile-form, #post-form, #conversation-form, #server-form, #channel-form,
  #chat-view, #server-view, #channel-view {
    background: linear-gradient(145deg, #252427, #1b1b1e);
  }
}

/* Chat list panel inspired by the supplied phone mockup. */
#chats-section { display: flex; flex-direction: column; }
#chats-section > h2 { order: 0; }
#chats-section .conversation-search-row {
  order: 1;
  width: 100%;
  height: 42px;
  margin: 0 0 8px;
  padding: 0 13px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: #8d8a90;
  border: 1px solid rgba(255,255,255,.025);
  border-radius: 24px;
  background: #18181a;
}
.conversation-search-row > span { font-size: 24px; line-height: 1; transform: rotate(-15deg); }
.conversation-search-row input {
  min-height: 0;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: 14px;
}
.conversation-search-row input:focus { background: transparent; box-shadow: none; }
.conversation-search-row input::placeholder { color: #929096; opacity: 1; }
.chat-notice {
  order: 2;
  min-height: 48px;
  margin: 0 0 8px;
  padding: 7px 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-radius: 15px;
  background: #2a292c;
  font-size: 12px;
  line-height: 1.35;
}
.chat-notice strong { color: #fff; font-size: 13px; font-weight: 650; }
.chat-notice span { color: #aaa7ad; }
.conversation-filters {
  order: 3;
  min-height: 44px;
  margin: 0 0 3px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.conversation-filters::-webkit-scrollbar { display: none; }
.conversation-filters button {
  min-height: 34px;
  padding: 0 12px;
  flex: 0 0 auto;
  color: #87848b;
  font-size: 12px;
  font-weight: 500;
  border: 0;
  border-radius: 18px;
  background: transparent;
}
.conversation-filters button:hover { background: rgba(255,255,255,.045); }
.conversation-filters button.selected {
  color: #e7a0aa;
  background: rgba(222,140,152,.075);
}
.conversation-filters b {
  min-width: 17px;
  height: 17px;
  margin-left: 3px;
  padding: 0 4px;
  display: inline-grid;
  place-items: center;
  color: white;
  font-size: 10px;
  line-height: 1;
  border-radius: 10px;
  background: var(--accent);
}
#conversation-list {
  order: 4;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0 0 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  list-style: none;
}
#conversation-list .conversation-row { min-width: 0; }
#conversation-list .conversation-row[hidden] { display: none !important; }
#conversation-list button {
  width: 100%;
  min-height: 64px;
  padding: 7px 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #f3f1f3;
  text-align: left;
  border: 0;
  border-radius: 14px;
  background: transparent;
}
#conversation-list button:hover { background: rgba(255,255,255,.045); }
#conversation-list button::before {
  content: "";
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border: 2px solid rgba(222,140,152,.38);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #77717c, #514c55 55%, #302d33);
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.2);
}
#conversation-list .conversation-row[data-type="group"] button::before {
  background: radial-gradient(circle at 35% 30%, #806f84, #54465b 55%, #302933);
}
#conversation-list button:hover::before { border-color: rgba(222,140,152,.72); }
#conversation-list button { font-size: 14px; font-weight: 600; }
#conversation-list .conversation-row__title,
#conversation-list .conversation-row__preview {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#conversation-list .conversation-row__title { font-size: 14px; }
#conversation-list .conversation-row__preview {
  color: #aaa6ad;
  font-size: 12px;
  font-weight: 400;
}
#conversation-list .conversation-row button { position: relative; }
#conversation-list .conversation-row button > .conversation-row__title,
#conversation-list .conversation-row button > .conversation-row__preview { max-width: 100%; }
#conversation-list .conversation-row button:has(.conversation-row__title) { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; grid-template-rows: 1fr 1fr; column-gap: 10px; }
#conversation-list .conversation-row button:has(.conversation-row__title)::before { grid-column: 1; grid-row: 1 / 3; }
#conversation-list .conversation-row__title { grid-column: 2; grid-row: 1; align-self: end; }
#conversation-list .conversation-row__preview { grid-column: 2; grid-row: 2; align-self: start; }
#conversation-list .conversation-row__unread {
  grid-column: 3;
  grid-row: 1 / 3;
  align-self: center;
  min-width: 22px;
  padding: 3px 6px;
  border-radius: 999px;
  color: #261619;
  background: var(--accent);
  font-size: 11px;
  text-align: center;
}
#conversation-list .conversation-row__unread[hidden] { display: none; }
#conversation-empty { order: 5; margin: 8px 0 16px; color: #929096; text-align: center; font-size: 13px; }
#chat-status { order: 6; }
#chat-view { order: 8; width: 100%; }
#messages { max-height: min(58vh, 620px); min-height: 180px; overflow-y: auto; align-content: start; padding: 8px 4px 14px; scroll-behavior: smooth; }
#messages .message-item { display: grid; width: fit-content; max-width: min(82%, 560px); gap: 3px 16px; padding: 10px 13px 7px; border: 1px solid rgba(255,255,255,.07); border-radius: 16px; }
#messages .message-item.is-own { justify-self: end; border-color: rgba(222,140,152,.22); border-bottom-right-radius: 5px; background: linear-gradient(145deg, #49323a, #30262d); }
#messages .message-item.is-other { justify-self: start; border-bottom-left-radius: 5px; background: #252427; }
#messages .message-author { color: #efabb5; font-size: 11px; }
#messages .message-content { margin: 0; color: #f2f0f2; white-space: pre-wrap; overflow-wrap: anywhere; }
#messages .message-time { justify-self: end; color: #a8a2aa; font-size: 10px; }
#message-form { display: flex; align-items: center; gap: 10px; }
#message-form input { min-width: 0; flex: 1 1 auto; }
#message-form button { flex: 0 0 auto; }
@media (max-width: 720px) {
  #messages { max-height: 42dvh; min-height: 160px; }
  #messages .message-item { max-width: 90%; }
  #message-form { flex-wrap: nowrap; }
  #message-form button { width: auto; }
}

@media (min-width: 721px) {
  #chats-section > h2 { display: none; }
  #chats-section .conversation-search-row { flex: 0 0 42px; }
  #conversation-list { flex: 0 0 auto; }
}

@media (max-width: 720px) {
  main {
    width: 100%;
    height: calc(100dvh - 62px);
    min-height: 0;
    padding: 0;
  }
  #app {
    width: 100%;
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-columns: 62px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
    border: 0;
    border-radius: 0;
  }
  #app > nav {
    position: relative;
    inset: auto;
    grid-column: 1;
    grid-row: 1;
    width: 62px;
    height: 100%;
    min-height: 0;
    padding: 10px 3px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 18px;
    border-top: 0;
    border-right: 1px solid rgba(255,255,255,.055);
    background: #212121;
  }
  #app > nav::before { display: none; }
  #app > nav button {
    width: 56px;
    min-height: 52px;
    padding: 4px 1px;
    flex: 0 0 auto;
    gap: 3px;
    font-size: 9px;
  }
  #app > nav button::before { font-size: 20px; }
  .page-section {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    max-width: none;
    height: 100%;
    min-height: 0;
    margin: 0;
    padding: 12px 9px 18px;
    overflow-x: hidden;
    overflow-y: auto;
    border-radius: 0 16px 16px 0;
    background: #212121;
  }
  #chats-section > h2 { display: none; }
  #chats-section .conversation-search-row { flex: 0 0 42px; }
  .chat-notice { min-height: 54px; }
  .conversation-filters { min-height: 46px; }
  #conversation-list button { min-height: 69px; }
  #conversation-list button::before { width: 50px; height: 50px; flex-basis: 50px; }
}
[hidden] {
    display: none !important;
}

/* GadLink Reels */
#reels-section { position: relative; }
#reels-section > h2 { display: none; }
.reels-toolbar { display: grid; grid-template-columns: max-content 1fr minmax(180px, 260px); align-items: center; gap: 24px; width: min(100%, 1000px); min-height: 66px; margin: 0 auto 8px; padding: 10px 18px; border: 1px solid rgba(255,255,255,.045); border-radius: 22px; background: #202023; }
.reels-toolbar__brand { display: flex; align-items: center; gap: 9px; white-space: nowrap; }
.reels-toolbar__brand > span { display: grid; width: 26px; height: 26px; place-items: center; border-radius: 7px; color: #171518; font-size: 18px; background: #f3eff1; }
.reels-toolbar__brand svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.reels-toolbar h2 { margin: 0; font-size: 20px; }
.reels-tabs { display: flex; justify-content: center; gap: 10px; }
.reels-tabs button { min-height: 38px; padding: 0 16px; color: #aaa7ac; border: 0; border-radius: 999px; background: transparent; }
.reels-tabs button.is-selected { color: #f1b1bb; background: rgba(222,140,152,.12); }
.reels-tabs button:disabled { opacity: .55; cursor: not-allowed; }
.reels-search { display: flex; width: 100%; min-width: 0; align-items: center; gap: 10px; padding: 0 20px; border: 1px solid rgba(255,255,255,.04); border-radius: 999px; color: #939096; background: #171719; }
.reels-search > span { display: grid; width: 20px; height: 20px; flex: 0 0 20px; place-items: center; font-size: 21px; line-height: 1; }
.reels-search input { width: 100%; min-width: 0; min-height: 38px; padding: 0; border: 0; border-radius: 0; color: var(--text); font-size: 12px; background: transparent; box-shadow: none; }
.reels-search input:focus { border: 0; box-shadow: none; }
#reels-status { min-height: 1.2em; max-width: 780px; margin: 2px auto 8px; color: #c8a9af; font-size: 10px; opacity: .42; text-align: center; transition: opacity .18s; }
#reels-status.is-error { color: #ff9aab; opacity: 1; }
.reels-player-layout { position: relative; display: grid; place-items: center; width: min(100%, 1200px); height: min(74dvh, 800px); min-height: 0; margin: 0 auto; }
.reels-scroll-controls { position: absolute; z-index: 5; top: 50%; left: 12px; display: grid; gap: 14px; justify-items: center; transform: translateY(-50%); }
.reels-scroll-controls button { display: grid; width: 52px; min-width: 52px; min-height: 52px; place-items: center; padding: 0; border: 1px solid rgba(255,255,255,.16); border-radius: 50%; color: #f3dfe4; font-size: 26px; line-height: 1; background: linear-gradient(145deg, rgba(42,40,45,.96), rgba(22,21,24,.96)); box-shadow: 0 5px 18px rgba(0,0,0,.32), inset 0 1px rgba(255,255,255,.08); backdrop-filter: blur(8px); transition: color .18s, border-color .18s, background .18s, box-shadow .18s, transform .18s; }
.reels-scroll-controls button:hover { color: #fff; border-color: rgba(239,163,173,.58); background: linear-gradient(145deg, #49313a, #272329); box-shadow: 0 8px 22px rgba(0,0,0,.4), 0 0 0 3px rgba(233,133,151,.1); transform: scale(1.06); }
.reels-feed {
  position: relative;
  display: flex;
  align-items: center;
  container-type: inline-size;
  width: 100%;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  margin: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  scroll-snap-type: y mandatory;
  border: 0;
  border-radius: 0;
  background: #000;
  box-shadow: none;
}
.reels-feed::-webkit-scrollbar { display: none; }
.reel-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(98px, 1fr) auto minmax(98px, 1fr);
  width: 100%;
  height: 100%;
  max-width: 100%;
  flex: 0 0 auto;
  align-items: center;
  margin: 0;
  overflow: visible;
  isolation: isolate;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  background: transparent;
}
.reel-stage { position: relative; grid-column: 2; width: auto; height: 100%; max-width: calc(100vw - 300px); aspect-ratio: var(--reel-aspect, 9 / 16); overflow: hidden; border-radius: 0; background: transparent; }
.reel-video, .reel-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: transparent; }
.reel-video { cursor: pointer; }
.reel-image { user-select: none; }
.reel-stage::after { display: none; }
.reel-duration { position: absolute; z-index: 2; top: 14px; right: 13px; padding: 4px 8px; border-radius: 999px; color: #fff; font-size: 11px; font-weight: 650; background: rgba(0,0,0,.52); backdrop-filter: blur(8px); }
.reel-caption { position: absolute; z-index: 3; right: 10px; bottom: 24px; left: 10px; max-height: 32%; overflow: hidden; color: #fff; text-shadow: 0 1px 5px #000; pointer-events: none; }
.reel-caption__title { display: block; font-size: 14px; line-height: 1.3; }
.reel-caption__description, .reel-caption__hashtags { margin: 3px 0 0; font-size: 12px; line-height: 1.35; overflow-wrap: anywhere; }
.reel-caption__hashtags { color: #f1b1bb; }
.reel-carousel { position: absolute; z-index: 4; inset: 0 8px; display: flex; align-items: center; justify-content: space-between; pointer-events: none; }
.reel-carousel[hidden] { display: none; }
.reel-carousel button { width: 34px; min-width: 34px; min-height: 34px; padding: 0; border: 0; border-radius: 50%; color: #fff; font-size: 24px; line-height: 1; background: #111a; pointer-events: auto; }
.reel-carousel__counter { position: absolute; top: 12px; left: 50%; padding: 3px 8px; border-radius: 999px; color: #fff; font-size: 11px; background: #111b; transform: translateX(-50%); }
.reel-actions { position: relative; z-index: 3; grid-column: 3; display: flex; width: 76px; height: 100%; flex-direction: column; align-items: center; justify-content: center; gap: clamp(10px, 1.8vh, 16px); margin-left: 22px; padding: 12px 0; background: transparent; }
.reel-action { display: grid; width: 100%; height: 64px; min-width: 0; min-height: 0; flex: 0 0 64px; grid-template-rows: 42px 16px; justify-items: center; align-content: start; gap: 4px; padding: 0; color: #f5f5f5; border: 0; background: transparent; text-shadow: 0 1px 4px #000; }
.reel-action > span { display: grid; width: 42px; height: 42px; place-items: center; border: 0; border-radius: 50%; color: #e8e8e8; background: #222; transition: transform .18s, color .18s, background .18s; }
.reel-action svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.reel-action .sound-wave { display: none; }
.reel-action.is-active .sound-wave { display: block; }
.reel-action.is-active .sound-muted { display: none; }
.reel-action:hover:not(:disabled) > span { transform: scale(1.06); background: #303030; }
.reel-action small { display: block; width: 100%; height: 16px; overflow: hidden; color: #f3f3f3; font-size: 10px; line-height: 16px; text-align: center; white-space: nowrap; text-overflow: ellipsis; }

.reel-action[data-action="like"].is-active > span {
  color: #ff315f;
  background: rgba(255,49,95,.14);
  box-shadow: 0 0 22px rgba(255,49,95,.3);
}

.reel-action[data-action="like"].is-active svg {
  fill: currentColor;
  stroke: currentColor;
}

.reel-action[data-action="delete"] > span {
  color: #ff9aab;
}

.reel-action[data-action="delete"]:hover:not(:disabled) > span {
  color: #fff;
  background: #71323e;
}

.reel-action[data-action="like"].is-pulsing > span { animation: reel-button-heart .38s ease-out; }
@keyframes reel-button-heart { 32% { color: #ff315f; transform: scale(1.3) rotate(-8deg); } 60% { transform: scale(.9) rotate(5deg); } 82% { transform: scale(1.08); } }
.reel-action[data-action="repost"].is-active > span { color: #9fe0c1; background: rgba(93,190,143,.16); }
.reel-action[data-action="repost"].is-reposting > span svg { animation: reel-repost-spin .62s cubic-bezier(.2,.8,.25,1); }
@keyframes reel-repost-spin { 45% { transform: rotate(180deg) scale(1.18); } 100% { transform: rotate(360deg) scale(1); } }
.reel-action--delete > span { color: #f09aa7; background: rgba(221,75,98,.12); }
.reel-action--delete:hover:not(:disabled) > span { background: rgba(221,75,98,.25); }
.reel-action:disabled { opacity: .42; cursor: not-allowed; }
.reel-progress { position: absolute; z-index: 4; right: 10px; bottom: 5px; left: 10px; width: calc(100% - 20px); height: 13px; min-height: 13px; padding: 0; border: 0; border-radius: 0; accent-color: var(--accent-strong); background: transparent; cursor: pointer; }
.reel-heart-burst { position: absolute; z-index: 4; top: 50%; left: 50%; color: #ff5b83; font-size: 96px; opacity: 0; pointer-events: none; transform: translate(-50%,-50%) scale(.35); }
.reel-heart-burst { color: #ff315f; -webkit-text-stroke: 1px rgba(255,255,255,.35); filter: drop-shadow(0 5px 18px rgba(255,28,83,.7)); }
.reel-heart-burst.is-animating { animation: reel-heart-pop .72s ease-out; }
@keyframes reel-heart-pop { 15% { opacity: 1; transform: translate(-50%,-50%) scale(1.16); } 65% { opacity: 1; transform: translate(-50%,-56%) scale(1); } 100% { opacity: 0; transform: translate(-50%,-82%) scale(.8); } }
@media (prefers-reduced-motion: reduce) {
  .reel-action[data-action="like"].is-pulsing > span,
  .reel-action[data-action="repost"].is-reposting > span svg,
  .reel-heart-burst.is-animating { animation-duration: .01ms !important; }
}
.reel-play-indicator { position: absolute; z-index: 3; top: 50%; left: 50%; display: grid; width: 58px; height: 58px; place-items: center; border: 1px solid #ffffff4d; border-radius: 50%; color: white; font-size: 22px; opacity: 0; background: #161419b8; pointer-events: none; transform: translate(-50%,-50%); }
.reel-play-indicator.is-visible { opacity: 1; }
.reel-card.is-buffering .reel-play-indicator { opacity: .65; animation: reel-loading-pulse .8s infinite alternate; }
@keyframes reel-loading-pulse { to { opacity: .25; } }
.reels-comments { position: fixed; z-index: 20; top: 50%; right: max(20px, calc((100vw - 1060px) / 2)); display: flex; width: min(360px, calc(100vw - 28px)); height: min(560px, 72vh); flex-direction: column; padding: 16px; border: 1px solid rgba(222,140,152,.22); border-radius: 20px; background: rgba(24,23,26,.98); box-shadow: 0 22px 80px #000a; transform: translateY(-50%); }
.reels-comments__header { display: flex; align-items: center; justify-content: space-between; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.reels-comments__header button { min-width: 36px; min-height: 36px; padding: 0; font-size: 22px; }
.reels-comments__list { flex: 1; overflow-y: auto; padding: 10px 2px; }
.reel-comment { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 8px; padding: 9px 0; margin: 0; border-bottom: 1px solid #ffffff10; overflow-wrap: anywhere; }
.reel-comment strong { grid-column: 1; grid-row: 1; color: var(--accent-strong); font-size: 12px; }
.reel-comment span { grid-column: 1 / -1; grid-row: 2; font-size: 13px; }
.reel-comment-delete { grid-column: 2; grid-row: 1; min-height: 28px; padding: 2px 8px; color: #e8a0aa; font-size: 11px; border-radius: 9px; background: rgba(222,140,152,.08); }
.reel-comment-error { grid-column: 1 / -1; color: #ff9aab; font-size: 11px; overflow-wrap: anywhere; }
.reels-comments__form { display: flex; gap: 8px; padding-top: 10px; }
.reels-comments__form input { min-width: 0; min-height: 42px; }
.reels-comments__form button { flex: none; min-height: 42px; padding-inline: 12px; }
@media (max-width: 720px) {
  #reels-section.page-section { display: flex; flex-direction: column; padding: 10px 0 14px; }
  .reels-toolbar { grid-template-columns: max-content minmax(0, 1fr); gap: 8px; width: calc(100% - 16px); min-height: 0; margin-bottom: 5px; padding: 9px 8px; border-radius: 16px; }
  .reels-toolbar__brand { gap: 4px; }
  .reels-toolbar__brand > span { width: 20px; height: 20px; }
  .reels-toolbar__brand svg { width: 15px; height: 15px; }
  .reels-toolbar h2 { font-size: 15px; }
  .reels-tabs { justify-content: flex-end; gap: 2px; }
  .reels-tabs button { min-height: 30px; padding: 0 6px; font-size: 10px; white-space: nowrap; }
  .reels-search { grid-column: 1 / -1; min-height: 36px; }
  .reels-search input { min-height: 34px; }
  #reels-status { width: calc(100% - 24px); flex: 0 0 auto; margin: 5px auto 8px; }
  .reels-player-layout { display: block; width: 100%; height: 0; min-height: 0; flex: 1 1 auto; margin: 0; }
  .reels-feed { width: 100%; height: 100%; min-height: 0; align-items: center; border: 0; border-radius: 0; background: #000; box-shadow: none; }
  .reel-card { position: relative; display: grid; width: 100%; height: 100%; max-width: 100%; min-height: 0; place-items: center; background: transparent; }
  .reel-stage { width: auto; height: 100%; max-width: 100%; max-height: 100%; border-radius: 0; }
  .reel-actions { position: absolute; top: 50%; right: max(8px, env(safe-area-inset-right)); width: 64px; height: auto; gap: clamp(8px, 1.5vh, 12px); margin: 0; padding: 8px 0; transform: translateY(-50%); }
  .reel-action { width: 64px; height: 58px; flex-basis: 58px; grid-template-rows: 40px 14px; gap: 3px; }
  .reel-action > span { width: 40px; height: 40px; background: rgba(24,24,24,.78); box-shadow: 0 2px 10px #0005; }
  .reel-action svg { width: 23px; height: 23px; }
  .reel-action small { height: 14px; line-height: 14px; font-size: 9px; }
  .reels-comments { top: auto; right: 10px; bottom: calc(12px + env(safe-area-inset-bottom)); left: 10px; width: auto; height: min(58vh, 500px); transform: none; }
}
@media (max-width: 420px) {
  .reel-actions { right: max(6px, env(safe-area-inset-right)); width: 58px; }
  .reel-action { width: 58px; }
}

/* Use the available screen width while Reels is open, then center the full player group. */
body:has(#reels-section:not([hidden])) main { width: 100%; max-width: none; }
#app:has(#reels-section:not([hidden])) { display: grid; grid-template-columns: 88px minmax(0, 1fr); width: 100%; max-width: none; }
#app:has(#reels-section:not([hidden])) #reels-section.page-section { grid-column: 2; width: 100%; max-width: none; margin: 0; justify-self: stretch; }
#reels-section .reels-toolbar, #reels-section .reels-player-layout { width: min(100%, 1200px); }
#reels-section .reel-actions { width: 76px; flex-basis: 76px; visibility: visible; opacity: 1; }
@media (max-width: 720px) {
  #app:has(#reels-section:not([hidden])) { grid-template-columns: 62px minmax(0, 1fr); }
  #reels-section.page-section { width: 100%; max-width: none; }
  #app:has(#reels-section:not([hidden])) #reels-section.page-section { grid-column: 2; }
  #reels-section .reel-actions { width: 64px; flex-basis: auto; margin-left: 0; }
}

@media (min-width: 721px) and (max-width: 900px) {
  #reels-section .reel-actions { width: 66px; gap: 10px; margin-left: 14px; }
  .reel-action { height: 58px; flex-basis: 58px; grid-template-rows: 38px 16px; }
  .reel-action > span { width: 38px; height: 38px; }
  .reel-action svg { width: 22px; height: 22px; }
  .reel-action small { font-size: 9px; }
  .reel-stage { width: min(432px, calc(100vw - 380px)); height: auto; }
}

header {
  position: relative;
  z-index: 81;
  height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  backdrop-filter: none;
}
main {
  min-height: 100vh;
  padding-top: 24px;
}
#app { position: relative; min-height: calc(100vh - 68px); }
#app > nav { position: relative; padding-top: 58px; }
#app > nav #menu-toggle {
  position: absolute;
  z-index: 82;
  top: 4px;
  left: 8px;
  width: 48px;
  min-width: 48px;
  height: 48px;
  min-height: 48px;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid rgba(239,163,173,.15);
  border-radius: 15px;
  color: #f3e9ee;
  background: linear-gradient(145deg, rgba(47,39,47,.96), rgba(31,28,34,.96));
  box-shadow: 0 6px 18px rgba(0,0,0,.2), inset 0 1px rgba(255,255,255,.06);
  transition: color .18s, border-color .18s, background .18s, box-shadow .18s, transform .18s;
}
#app > nav #menu-toggle:hover:not(:disabled) {
  color: #fff;
  border-color: rgba(239,163,173,.45);
  background: linear-gradient(145deg, #49313a, #2b252d);
  box-shadow: 0 8px 22px rgba(0,0,0,.28), 0 0 0 3px rgba(233,133,151,.08);
}
#app > nav #menu-toggle.is-open {
  position: fixed;
  top: 12px;
  left: 12px;
  width: 48px;
  min-width: 48px;
  height: 48px;
  min-height: 48px;
}
#app > nav #menu-toggle span {
  width: 22px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transition: transform .2s ease, opacity .16s ease;
}
#menu-toggle.is-open span:first-child { transform: translateY(7px) rotate(45deg); }
#menu-toggle.is-open span:nth-child(2) { opacity: 0; }
#menu-toggle.is-open span:last-child { transform: translateY(-7px) rotate(-45deg); }
.menu-close-icon { display: none; }
#menu-toggle.is-open > span { display: none; }
#menu-toggle.is-open .menu-close-icon {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: #f2edf0;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.profile-menu {
  position: fixed;
  z-index: 90;
  inset: 0;
  display: grid;
  grid-template-columns: min(340px, calc(100vw - 48px)) 1fr;
  visibility: hidden;
  opacity: 0;
  transition: opacity .2s ease, visibility .2s;
}
.profile-menu[hidden] { display: none !important; }
.profile-menu.is-open { visibility: visible; opacity: 1; }
.profile-menu__backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: rgba(0,0,0,.58);
  cursor: default;
}
.profile-menu__backdrop:hover:not(:disabled) {
  color: inherit;
  border-color: transparent;
  background: rgba(0,0,0,.58);
  box-shadow: none;
}
.profile-menu__panel {
  position: relative;
  z-index: 1;
  grid-column: 1;
  width: min(340px, calc(100vw - 48px));
  height: 100%;
  padding: 78px 20px 24px;
  overflow-x: hidden;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: linear-gradient(160deg, #242226, #151517 70%);
  box-shadow: 18px 0 60px rgba(0,0,0,.32);
  transform: translateX(-100%);
  transition: transform .24s cubic-bezier(.2,.8,.2,1);
}
.profile-menu.is-open .profile-menu__panel { transform: translateX(0); }
.profile-menu__account {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 0 4px 22px;
  border-bottom: 1px solid var(--line);
}
.profile-menu__avatar {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border: 1px solid rgba(222,140,152,.24);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f0b0bb, #a55f70 68%, #51313b);
  box-shadow: 0 5px 18px rgba(222,140,152,.15);
}
.profile-menu__avatar-picker {
  position: relative;
  display: grid;
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(222,140,152,.3);
  border-radius: 50%;
  background: linear-gradient(135deg, #f0b0bb, #784552);
  cursor: pointer;
}
.profile-menu__avatar-picker .profile-menu__avatar {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: cover;
}
.profile-menu__avatar-placeholder {
  color: #2a171c;
  font-size: 25px;
  font-weight: 400;
  line-height: 1;
}
.profile-menu__avatar-edit {
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: 0;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border: 1px solid #252226;
  border-radius: 50%;
  color: #29171b;
  font-size: 11px;
  line-height: 1;
  background: var(--accent-strong);
}
.profile-menu__avatar-picker:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 3px; }
.profile-menu__identity { display: grid; min-width: 0; gap: 3px; }
.profile-menu__identity strong,
.profile-menu__identity span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-menu__identity strong { font-size: 15px; }
.profile-menu__identity span { color: var(--muted); font-size: 12px; }
.profile-menu__panel h2 {
  margin: 23px 4px 12px;
  color: #aaa7ad;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.profile-menu__form {
  display: grid;
  gap: 8px;
}
.profile-menu__form label { margin: 0; }
.profile-menu__form input {
  min-height: 42px;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13px;
}
.profile-menu__form button {
  width: 100%;
  min-height: 42px;
  margin-top: 2px;
  color: var(--accent-ink);
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
}
.profile-menu__form h3 {
  margin: 13px 0 2px;
  font-size: 14px;
  font-weight: 650;
}
.profile-menu__status {
  min-height: 1.4em;
  margin: 6px 0 2px;
  color: #c8a9af;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.notification-settings {
  margin-top: 20px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 16px;
  background: rgba(255,255,255,.025);
}
.notification-settings h3 { margin: 0 0 6px; font-size: 14px; }
.notification-settings > p:first-of-type { margin: 0 0 10px; color: var(--muted); font-size: 12px; }
.notification-settings > button {
  width: 100%;
  min-height: 42px;
  margin-top: 8px;
  border-color: transparent;
  color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
  font-size: 13px;
}
.notification-settings > button:disabled { opacity: .58; cursor: not-allowed; }
.pwa-install-card {
  width: min(100%, 440px);
  margin: 0 auto 22px;
  padding: 16px;
  border: 1px solid rgba(222,140,152,.18);
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(48,34,40,.92), rgba(27,25,29,.96));
  box-shadow: 0 16px 42px rgba(0,0,0,.2), inset 0 1px rgba(255,255,255,.035);
}
.pwa-install-card h2 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 700;
}
.pwa-install-card > div > p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
}
.pwa-install-card > .pwa-install-button {
  width: 100%;
  position: relative;
  min-height: 48px;
  border-color: rgba(239,163,173,.38);
  color: #fff7f8;
  background: linear-gradient(120deg, #a94e65, #d77f91 58%, #b86679);
  box-shadow: 0 8px 22px rgba(190,91,114,.2), inset 0 1px rgba(255,255,255,.16);
  font-size: 14px;
  font-weight: 700;
}
.pwa-install-card > .pwa-install-button:hover:not(:disabled) {
  background: linear-gradient(120deg, #b85b72, #e28b9d 58%, #c97386);
  box-shadow: 0 10px 26px rgba(190,91,114,.3), inset 0 1px rgba(255,255,255,.2);
}
.pwa-install-status {
  min-height: 0;
  margin: 6px 0 0;
  color: #c8a9af;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.pwa-install-status:empty { display: none; }
.pwa-install-guide {
  margin: 8px 0 0;
  padding: 11px 13px;
  border: 1px solid rgba(222,140,152,.16);
  border-radius: 12px;
  color: #d3cbd1;
  background: rgba(222,140,152,.06);
  font-size: 12px;
}
.push-delivery-status {
  position: fixed;
  z-index: 1000;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  left: max(12px, env(safe-area-inset-left));
  width: fit-content;
  max-width: 560px;
  margin: 0 auto;
  padding: 12px 16px;
  border: 1px solid rgba(255, 143, 143, .38);
  border-radius: 14px;
  color: #ffe4e4;
  background: #48282dcc;
  box-shadow: 0 12px 35px #0007;
  font-size: 13px;
  text-align: center;
  overflow-wrap: anywhere;
}
.push-delivery-status[hidden] { display: none; }
.push-preview-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 10px;
  color: #c8c3c9;
  font-size: 12px;
}
.push-preview-option input { width: 16px; min-height: 16px; flex: 0 0 16px; margin: 1px 0 0; accent-color: var(--accent); }
.profile-menu__action { margin-top: 12px; }
.profile-menu__action {
  width: 100%;
  min-height: 54px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-color: rgba(255,255,255,.04);
  border-radius: 15px;
  background: rgba(255,255,255,.035);
  text-align: left;
}
.profile-menu__action span:first-child { color: var(--accent); font-size: 18px; }
.profile-menu__action span:nth-child(2) { flex: 1; }
.profile-menu__action span:last-child { color: #827e85; font-size: 22px; }
.profile-menu__sign-out {
  width: 100%;
  margin-top: 12px;
  color: #f2c9cf;
  border-color: rgba(222,140,152,.13);
  background: rgba(222,140,152,.08);
}
.add-contact-button {
  position: absolute;
  z-index: 5;
  left: calc(88px + min(360px, calc(100% - 88px)) - 64px);
  bottom: 16px;
  width: 48px;
  height: 48px;
  min-height: 48px;
  padding: 0;
  display: none;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #281a1d;
  background: #e98597;
  box-shadow: 0 5px 18px rgba(222,120,137,.3);
  transition: transform .18s ease, box-shadow .18s ease;
}
#app:has(#chats-section:not([hidden])) > .add-contact-button,
#app:has(#friends-section:not([hidden])) > .add-contact-button { display: grid; }
.add-contact-button:hover:not(:disabled) {
  color: #211417;
  background: #f094a4;
  box-shadow: 0 8px 22px rgba(222,120,137,.4);
  transform: translateY(-2px);
}
.add-contact-button svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.create-menu {
  position: absolute;
  z-index: 20;
  left: calc(88px + min(360px, calc(100% - 88px)) - 224px);
  bottom: 76px;
  width: 208px;
  padding: 7px;
  display: none;
  gap: 3px;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 16px;
  background: #252427;
  box-shadow: 0 14px 40px rgba(0,0,0,.42);
}
#app:has(#chats-section:not([hidden])) > .create-menu:not([hidden]),
#app:has(#friends-section:not([hidden])) > .create-menu:not([hidden]) { display: grid; }
.create-menu button {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #f2eff2;
  text-align: left;
  border: 0;
  border-radius: 10px;
  background: transparent;
}
.create-menu button:hover,
.create-menu button:focus-visible { background: rgba(222,140,152,.12); }
.create-menu button span { width: 22px; color: var(--accent); text-align: center; font-size: 17px; }
.create-group-dialog #conversation-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.create-group-dialog #conversation-form label { margin: 0; }
.create-group-dialog #conversation-form button { width: 100%; margin-top: 4px; }
#group-create-status { min-height: 1.5em; margin: 12px 0 0; color: #c8a9af; font-size: 13px; overflow-wrap: anywhere; }
.friend-add-dialog {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  visibility: hidden;
  opacity: 0;
  transition: opacity .18s ease, visibility .18s;
}
.friend-add-dialog.is-open { visibility: visible; opacity: 1; }
.friend-add-dialog__backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: rgba(0,0,0,.66);
  cursor: default;
}
.friend-add-dialog__backdrop:hover:not(:disabled) {
  color: inherit;
  border-color: transparent;
  background: rgba(0,0,0,.66);
  box-shadow: none;
}
.friend-add-dialog__panel {
  position: relative;
  width: min(460px, 100%);
  max-height: min(80dvh, 650px);
  padding: 22px;
  overflow-y: auto;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 22px;
  background: linear-gradient(145deg, #252427, #171719);
  box-shadow: 0 24px 90px rgba(0,0,0,.5);
  transform: translateY(10px) scale(.98);
  transition: transform .2s ease;
}
.friend-add-dialog.is-open .friend-add-dialog__panel { transform: translateY(0) scale(1); }
.friend-add-dialog__heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.friend-add-dialog__heading h2 { margin: 0; font-size: 20px; }
.friend-add-dialog__heading button { width: 38px; min-height: 38px; padding: 0; font-size: 24px; }
.friend-add-dialog__hint { margin: 8px 0 16px; color: var(--muted); font-size: 13px; }
#friend-search-form { display: flex; align-items: center; gap: 8px; }
#friend-search-form input { flex: 1 1 auto; }
#friend-search-form button { flex: 0 0 auto; color: var(--accent-ink); border-color: transparent; background: linear-gradient(135deg, var(--accent-strong), var(--accent)); }
#friend-status { min-height: 1.5em; margin: 12px 0 0; color: #c8a9af; font-size: 13px; overflow-wrap: anywhere; }
#friend-search-results { display: grid; gap: 8px; }
.reel-publish-dialog {
  position: fixed;
  z-index: 110;
  inset: 0;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  visibility: hidden;
  opacity: 0;
  transition: opacity .18s ease, visibility .18s;
}
.reel-publish-dialog.is-open { visibility: visible; opacity: 1; }
.reel-publish-dialog__backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: rgba(0,0,0,.72);
  cursor: default;
}
.reel-publish-dialog__backdrop:hover:not(:disabled) {
  color: inherit;
  border-color: transparent;
  background: rgba(0,0,0,.72);
  box-shadow: none;
}
.reel-publish-dialog__panel {
  position: relative;
  display: flex;
  width: min(960px, 100%);
  max-height: min(92dvh, 850px);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 22px;
  background: #1b1a1d;
  box-shadow: 0 24px 90px rgba(0,0,0,.55);
  transform: translateY(10px) scale(.98);
  transition: transform .2s ease;
}
.reel-publish-dialog.is-open .reel-publish-dialog__panel { transform: translateY(0) scale(1); }
.reel-publish-dialog__heading { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 26px; border-bottom: 1px solid rgba(255,255,255,.075); }
.reel-publish-dialog__heading h2 { margin: 0; font-size: 21px; }
.reel-publish-dialog__heading p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.reel-publish-dialog__heading button { width: 38px; min-height: 38px; padding: 0; font-size: 24px; }
#reel-publish-form { display: grid; min-height: 0; flex: 1 1 auto; grid-template-rows: minmax(0, 1fr) auto; }
.reel-publish-dialog__body { display: grid; min-height: 0; grid-template-columns: minmax(0, 1.65fr) minmax(260px, .95fr); gap: 28px; padding: 18px 26px 14px; overflow-y: auto; }
.reel-publish-dialog__section-heading { margin-bottom: 12px; }
.reel-publish-dialog__section-heading h3,
.reel-publish-dialog__details h3 { margin: 0 0 3px; color: #f3edf1; font-size: 14px; font-weight: 700; }
.reel-publish-dialog__section-heading p { margin: 0; color: var(--muted); font-size: 11px; }
.reel-publish-dialog__media { min-width: 0; }
.reel-publish-dialog__details { display: grid; min-width: 0; align-content: start; gap: 6px; padding-left: 26px; border-left: 1px solid rgba(255,255,255,.08); }
.reel-publish-dialog__details h3 { margin-bottom: 6px; }
.reel-publish-dialog__details label { margin: 0; font-size: 11px; font-weight: 600; line-height: 1.4; }
.reel-publish-dialog__details input { min-height: 42px; padding: 9px 12px; border-radius: 12px; font-size: 12px; }
#reel-publish-form textarea { min-height: 96px; padding: 10px 12px; border-radius: 12px; font-size: 12px; resize: vertical; }
.reel-publish-files {
  position: relative;
  display: flex;
  min-height: 250px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 24px;
  margin: 0;
  overflow: hidden;
  border: 1px dashed rgba(239,163,173,.58);
  border-radius: 16px;
  background: rgba(15,14,17,.72);
  text-align: center;
  cursor: pointer;
  transition: border-color .18s, background .18s, box-shadow .18s;
}
.reel-publish-files:hover,
.reel-publish-files.is-dragging { border-color: #f3a5b2; background: rgba(233,133,151,.08); box-shadow: inset 0 0 0 1px rgba(243,165,178,.16); }
.reel-publish-files:focus-within { outline: 2px solid var(--accent-strong); outline-offset: -3px; }
.reel-publish-files > svg { width: 54px; height: 54px; padding: 13px; border-radius: 16px; color: #f3a5b2; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; background: #30272e; }
.reel-publish-files > strong { color: #f3edf1; font-size: 14px; }
.reel-publish-files > span:not(.reel-publish-files__button) { color: var(--muted); font-size: 11px; }
.reel-publish-files__button { margin-top: 6px; padding: 8px 20px; border-radius: 10px; color: #32171e; background: linear-gradient(135deg, #f1a0af, #df778d); font-size: 12px; font-weight: 700; }
.reel-publish-files input { position: absolute; width: 1px; height: 1px; min-height: 1px; padding: 0; overflow: hidden; opacity: 0; }
.reel-publish-files__status { margin: 7px 0 0; color: var(--muted); font-size: 11px; }
.reel-publish-file-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); max-height: 180px; gap: 8px; padding: 0; margin: 10px 0 0; overflow: auto; color: var(--muted); font-size: 11px; list-style: none; }
.reel-publish-file-list li { position: relative; display: grid; min-width: 0; gap: 5px; padding: 6px; border: 1px solid rgba(255,255,255,.08); border-radius: 11px; background: rgba(255,255,255,.035); }
.reel-publish-file-list img,
.reel-publish-file-list__icon { display: grid; width: 100%; aspect-ratio: 1; place-items: center; overflow: hidden; border-radius: 7px; color: #f3a5b2; background: #29252b; object-fit: cover; }
.reel-publish-file-remove { position: absolute; top: 10px; right: 10px; display: grid; width: 28px; min-width: 28px; height: 28px; min-height: 28px; place-items: center; padding: 0; border: 1px solid rgba(255,255,255,.2); border-radius: 50%; color: #fff; background: rgba(24,22,26,.88); box-shadow: 0 2px 8px #0008; }
.reel-publish-file-remove:hover:not(:disabled) { color: #fff; border-color: rgba(255,154,171,.6); background: #71323e; }
.reel-publish-file-remove svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.reel-publish-file-list__name { overflow: hidden; color: #d7d0d7; text-overflow: ellipsis; white-space: nowrap; }
.reel-publish-file-list__meta { color: var(--muted); font-size: 10px; }
.reel-publish-dialog__media-hint,
.reel-publish-dialog__hashtags-hint { margin: 0; color: var(--muted); font-size: 10px; }
.reel-publish-dialog__media-hint { margin-top: 5px; }
.reel-publish-profile-preview { display: flex; min-width: 0; align-items: center; gap: 11px; margin-top: 8px; padding: 10px; border: 1px solid rgba(255,255,255,.08); border-radius: 12px; background: rgba(15,14,17,.55); }
.reel-publish-profile-preview > span { display: grid; width: 46px; height: 46px; flex: 0 0 46px; place-items: center; border-radius: 10px; color: #f3a5b2; background: #30272e; font-size: 22px; }
.reel-publish-profile-preview > div { display: grid; min-width: 0; gap: 2px; }
.reel-publish-profile-preview strong { color: #eee7ed; font-size: 11px; }
.reel-publish-profile-preview small { color: var(--muted); font-size: 10px; }
.reel-publish-dialog__footer { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 10px 16px; padding: 12px 26px 16px; border-top: 1px solid rgba(255,255,255,.075); }
.reel-publish-dialog__footer > span { color: var(--muted); font-size: 11px; }
#reel-publish-status { grid-column: 1 / -1; min-height: 0; margin: 0; color: #c8a9af; font-size: 12px; overflow-wrap: anywhere; }
#reel-publish-status:empty { display: none; }
#reel-publish-status.is-error { color: #ff9aab; }
#reel-publish-submit { min-width: 170px; min-height: 44px; color: var(--accent-ink); border-color: transparent; background: linear-gradient(135deg, var(--accent-strong), var(--accent)); }
@media (max-width: 720px) {
  main { height: 100dvh; min-height: 0; padding: 0; }
  #app { height: 100%; min-height: 0; }
  #app > nav { padding-top: 68px; }
  .add-contact-button {
    left: auto;
    right: 14px;
    bottom: 16px;
  }
  .create-menu {
    left: auto;
    right: 14px;
    bottom: 74px;
  }
}
@media (max-width: 720px) {
  #app:has(#reels-section:not([hidden])) {
    grid-template-columns: 50px minmax(0, 1fr);
    height: 100%;
    min-height: 0;
  }
  #app:has(#reels-section:not([hidden])) > nav {
    width: 50px;
    padding: 54px 2px 8px;
    gap: 12px;
  }
  #app:has(#reels-section:not([hidden])) > nav button {
    width: 46px;
    min-height: 48px;
    font-size: 8px;
  }
  #reels-section.page-section {
    display: flex;
    min-width: 0;
    min-height: 0;
    flex-direction: column;
    padding: 6px 0 0;
    overflow: hidden;
  }
  #reels-section .reels-toolbar {
    grid-template-columns: minmax(0, 1fr) max-content;
    gap: 4px 6px;
    width: calc(100% - 10px);
    min-width: 0;
    flex: 0 0 auto;
    margin: 0 auto 4px;
    padding: 7px;
    border-radius: 14px;
  }
  #reels-section .reels-toolbar__brand { min-width: 0; gap: 5px; }
  #reels-section .reels-toolbar h2 { font-size: 15px; }
  #reels-section .reels-tabs { min-width: 0; gap: 0; }
  #reels-section .reels-tabs button {
    min-width: 0;
    min-height: 30px;
    padding: 0 7px;
    font-size: 10px;
  }
  #reels-section .reels-search {
    grid-column: 1 / -1;
    min-height: 34px;
    padding-inline: 20px;
  }
  #reels-section .reels-search input { min-height: 32px; }
  #reels-status {
    width: calc(100% - 12px);
    max-height: 2.4em;
    flex: 0 0 auto;
    margin: 2px auto 4px;
    overflow: auto;
  }
  #reels-section .reels-player-layout {
    display: block;
    width: 100%;
    height: auto;
    min-height: 0;
    flex: 1 1 0;
    margin: 0;
  }
  #reels-section .reels-scroll-controls { display: none; }
  #reels-section .reels-feed { width: 100%; height: 100%; }
  #reels-section .reel-card {
    grid-template-columns: minmax(0, 1fr) 58px;
    grid-template-rows: minmax(0, 1fr);
    min-width: 0;
    overflow: hidden;
  }
  #reels-section .reel-stage {
    grid-column: 1;
    grid-row: 1;
    max-width: 100%;
    max-height: 100%;
    justify-self: center;
    touch-action: pan-y;
  }
  #reels-section .reel-actions {
    position: relative;
    top: auto;
    right: auto;
    grid-column: 2;
    grid-row: 1;
    width: 58px;
    height: 100%;
    gap: clamp(3px, .7dvh, 7px);
    margin: 0;
    padding: 4px 0;
    overflow: hidden;
    transform: none;
  }
  #reels-section .reel-action {
    width: 58px;
    height: clamp(40px, 7dvh, 52px);
    flex-basis: clamp(40px, 7dvh, 52px);
    grid-template-rows: clamp(30px, 5.5dvh, 38px) 12px;
    gap: 2px;
  }
  #reels-section .reel-action > span {
    width: clamp(30px, 5.5dvh, 38px);
    height: clamp(30px, 5.5dvh, 38px);
  }
  #reels-section .reel-action svg { width: 20px; height: 20px; }
  #reels-section .reel-action small { height: 12px; font-size: 8px; line-height: 12px; }
  #reels-section .reel-progress { right: 6px; left: 6px; width: calc(100% - 12px); }
  .reel-publish-dialog { padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); }
  .reel-publish-dialog__panel { max-height: min(92dvh, 760px); border-radius: 18px; }
}
.voice-call-icon-button {
  display: inline-grid;
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px;
  flex: 0 0 42px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(222,140,152,.28);
  border-radius: 50%;
  color: #f0adb7;
  background: #2a2529;
}
.voice-call-icon-button:hover { color: #fff; background: #493039; }
.voice-call-icon-button svg,
.call-history__callback svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chat-view__header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.chat-view__header h3 { min-width: 0; overflow-wrap: anywhere; }
.voice-call-dialog {
  position: fixed;
  z-index: 120;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0,0,0,.76);
  backdrop-filter: blur(12px);
}
.voice-call-dialog__panel {
  display: flex;
  width: min(420px, 100%);
  max-height: min(90dvh, 700px);
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: clamp(24px, 6vw, 42px);
  overflow: auto;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 28px;
  background: linear-gradient(155deg, #29262b, #171719 72%);
  box-shadow: 0 30px 100px rgba(0,0,0,.55);
  text-align: center;
}
.voice-call-avatar,
.voice-call-avatar-placeholder {
  width: 112px;
  height: 112px;
  flex: 0 0 112px;
  border: 2px solid rgba(240,173,183,.55);
  border-radius: 50%;
  object-fit: cover;
  background: radial-gradient(circle at 35% 25%, #f0adb7, #89505d 72%);
  box-shadow: 0 8px 34px rgba(222,140,152,.2);
}
.voice-call-avatar-placeholder { display: grid; place-items: center; color: #28171b; font-size: 40px; font-weight: 700; }
.voice-call-dialog__panel h2 { max-width: 100%; margin: 4px 0 0; overflow-wrap: anywhere; font-size: clamp(22px, 5vw, 28px); }
#voice-call-status { min-height: 1.5em; margin: 0; color: #c9c2c8; overflow-wrap: anywhere; }
#voice-call-timer { color: #f0adb7; font-variant-numeric: tabular-nums; font-size: 20px; }
#voice-call-remote-audio { width: 1px; height: 1px; opacity: 0; }
.voice-call-actions { display: flex; width: 100%; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; margin-top: 12px; }
.voice-call-actions[hidden] { display: none; }
.voice-call-actions button { min-height: 46px; }
.voice-call-accept { color: #fff; border-color: transparent; background: #398866; }
.voice-call-accept:hover { background: #46a079; }
.voice-call-end { color: #fff; border-color: transparent; background: #a94253; }
.voice-call-end:hover { background: #c75264; }
#voice-call-mute[aria-pressed="true"] { border-color: rgba(240,173,183,.5); color: #fff; background: #50333c; }
.voice-call-volume { display: grid; min-width: 100px; gap: 2px; color: var(--muted); font-size: 12px; }
.voice-call-volume input { width: 100%; min-height: 22px; accent-color: var(--accent); }
.call-history { display: grid; gap: 8px; }
.call-history-toolbar { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; }
.call-history-filters { display: flex; min-width: 0; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.call-history-filters::-webkit-scrollbar { display: none; }
.call-history-filters button { min-height: 36px; flex: 0 0 auto; padding: 0 12px; border-color: transparent; border-radius: 999px; color: var(--muted); background: transparent; font-size: 12px; }
.call-history-filters button[aria-pressed="true"] { color: #ffe8ec; border-color: rgba(233,133,151,.22); background: rgba(233,133,151,.12); }
.call-history-clear { min-height: 36px; flex: 0 0 auto; padding: 0 12px; color: #e9a1ad; border-color: rgba(233,133,151,.16); border-radius: 11px; background: rgba(233,133,151,.055); font-size: 12px; }
.call-history-clear:hover:not(:disabled) { background: rgba(233,133,151,.13); }
.call-history-empty { padding: 24px; color: var(--muted); text-align: center; }
.call-history__row { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; background: rgba(30,29,32,.8); }
.call-history__details { display: grid; min-width: 0; gap: 2px; }
.call-history__details strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-history__details span,
.call-history__details time { color: var(--muted); font-size: 13px; }
.call-history__row--missed .call-history__details span { color: #efa3ad; }
.call-history__callback { display: grid; width: 40px; min-width: 40px; min-height: 40px; place-items: center; padding: 0; border-radius: 50%; color: #f0adb7; background: #30272c; }
.call-history__callback:hover { color: #fff; background: #493039; }
@media (min-width: 721px) {
  #app:has(#calls-section:not([hidden]))::after { display: none; }
  #calls-section:not([hidden]) {
    grid-column: 2;
    grid-row: 1;
    width: 360px;
    max-width: 100%;
    min-height: 100%;
    padding: 18px 12px 26px;
    overflow-y: auto;
    background: linear-gradient(180deg, rgba(31,29,34,.98), rgba(22,20,24,.98));
  }
  #calls-section > h2 { margin-bottom: 14px; font-size: 20px; text-align: center; }
  #calls-status { margin: 0 0 12px; font-size: 12px; }
  .call-history-toolbar { align-items: stretch; flex-direction: column; gap: 8px; margin-bottom: 12px; }
  .call-history-filters { width: 100%; gap: 2px; }
  .call-history-filters button { min-height: 32px; padding-inline: 9px; font-size: 11px; }
  .call-history-clear { align-self: flex-end; min-height: 32px; }
  .call-history { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .call-history__row { gap: 8px; padding: 12px; background: linear-gradient(145deg, rgba(39,35,41,.94), rgba(28,26,31,.96)); }
  .call-history__details strong { font-size: 13px; }
  .call-history__details span, .call-history__details time { font-size: 11px; }
  .call-history__callback { width: 36px; min-width: 36px; min-height: 36px; }
}
@media (max-width: 460px) {
  .call-history-toolbar { align-items: flex-start; flex-direction: column; gap: 8px; }
  .call-history-filters { width: 100%; }
  .call-history-clear { align-self: flex-end; }
}
@media (prefers-reduced-motion: reduce) {
  #menu-toggle span,
  .profile-menu,
  .profile-menu__panel,
  .friend-add-dialog,
  .friend-add-dialog__panel,
  .add-contact-button,
  .reel-publish-dialog,
  .reel-publish-dialog__panel,
  .voice-call-dialog__panel { transition-duration: .01ms; }
}

/* Responsive server and channel workspace */
:root {
  --community-accent: #de8c98;
  --community-accent-soft: rgba(222,140,152,.14);
}
#app:has(#communities-section:not([hidden]))::after { display: none; }
#app:has(#communities-section:not([hidden])) > nav [data-section="communities-section"] {
  color: var(--community-accent);
  background: var(--community-accent-soft);
}
#app:has(#calls-section:not([hidden])) > nav [data-section="calls-section"] {
  color: var(--community-accent);
  background: var(--community-accent-soft);
}
.settings-nav-icon, .settings-nav-label { display: none; }
.calls-section { min-height: 100%; }
.calls-empty {
  display: flex;
  min-height: min(62vh, 500px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  border: 1px solid rgba(255,255,255,.055);
  border-radius: 20px;
  background: #1c1c1f;
}
.calls-empty > span { display: grid; width: 70px; height: 70px; place-items: center; margin-bottom: 15px; border-radius: 50%; color: var(--community-accent); background: #28292e; font-size: 30px; }
.calls-empty h3 { margin: 0 0 6px; font-size: 17px; }
.calls-empty p { max-width: 320px; margin: 0; color: #9999a1; font-size: 12px; }
#communities-section {
  min-width: 0;
  color: #f3f4f6;
  background: #141416;
}
.communities-header {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 16px;
}
.communities-header .eyebrow {
  margin: 0 0 3px;
  color: #85858d;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .13em;
}
.communities-header h2 { margin: 0; font-size: 21px; font-weight: 700; }
.community-add-button {
  width: 42px;
  min-height: 42px;
  padding: 0;
  color: #fff;
  border: 0;
  border-radius: 13px;
  background: var(--community-accent);
  font-size: 26px;
  font-weight: 400;
  line-height: 1;
}
.community-add-button:hover:not(:disabled), .community-panel-heading > button:hover:not(:disabled) {
  border-color: transparent;
  background: #efa3ad;
}
#community-status {
  min-height: 0;
  margin: 0 0 8px;
  color: #e6b4bc;
  font-size: 12px;
}
#community-status:empty { display: none; }
.community-layout {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(190px, 250px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.community-layout:has(.community-empty--no-servers:not([hidden])) { grid-template-columns: minmax(0, 1fr); }
.community-layout:has(.community-empty--no-servers:not([hidden])) .community-server-panel { display: none; }
#communities-section:has(.community-empty--no-servers:not([hidden])) .community-add-button { display: none; }
.community-server-panel, .community-detail {
  min-width: 0;
  padding: 17px;
  border: 1px solid rgba(255,255,255,.055);
  border-radius: 19px;
  background: #1c1c1f;
}
.community-panel-heading, .community-channel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.community-panel-heading { margin: 0 0 10px; }
.community-panel-heading h3, .community-channel-heading h4 { margin: 0; color: #dbdce0; font-size: 13px; font-weight: 700; }
.community-panel-heading > button {
  width: 30px;
  min-height: 30px;
  padding: 0;
  color: var(--community-accent);
  border: 0;
  border-radius: 9px;
  background: var(--community-accent-soft);
  font-size: 21px;
}
#server-list, #channel-list {
  display: grid;
  max-width: none;
  gap: 5px;
  padding: 0;
  margin: 0;
  list-style: none;
}
.server-list-button, .channel-list-button {
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 58px;
  align-items: center;
  justify-content: flex-start !important;
  gap: 10px;
  padding: 7px 8px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 13px;
  background: transparent !important;
}
.server-list-button:hover:not(:disabled), .channel-list-button:hover:not(:disabled) {
  border-color: rgba(255,255,255,.045);
  background: #26262a !important;
}
.server-list-button[aria-current="true"] {
  border-color: rgba(222,140,152,.28);
  background: rgba(222,140,152,.12) !important;
}
.server-list-avatar, .channel-list-icon {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  place-items: center;
  overflow: hidden;
  border-radius: 13px;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  background: linear-gradient(145deg, #efa3ad, #b85b78);
  background-position: center;
  background-size: cover;
}
.server-list-avatar img { width: 100%; height: 100%; object-fit: cover; }
.server-list-copy, .channel-list-copy, .server-detail-copy { display: grid; min-width: 0; gap: 2px; }
.server-list-copy strong, .channel-list-copy strong {
  overflow: hidden;
  color: #eeedf0;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.server-list-copy small, .channel-list-copy small {
  overflow: hidden;
  color: #8d8c93;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.server-list-arrow { margin-left: auto; color: #75747c; font-size: 22px; line-height: 1; }
.community-empty {
  display: flex;
  min-height: 440px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px;
  text-align: center;
  border: 1px solid rgba(255,255,255,.055);
  border-radius: 20px;
  background: #1c1c1f;
}
.community-empty[hidden] { display: none !important; }
.community-empty:not(.community-empty--no-servers) {
  min-height: 160px;
  padding: 18px;
  border: 0;
  background: transparent;
}
.community-empty:not(.community-empty--no-servers) .community-empty__icon { display: none; }
.community-empty__icon {
  display: grid;
  width: 76px;
  height: 76px;
  place-items: center;
  margin-bottom: 15px;
  border-radius: 50%;
  color: var(--community-accent);
  background: #28292e;
}
.community-empty__icon svg { width: 38px; height: 38px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.community-empty h3 { margin: 0 0 6px; font-size: 17px; }
.community-empty p { max-width: 340px; margin: 0 0 17px; color: #9999a1; font-size: 12px; line-height: 1.5; }
.community-empty > button:not(.community-empty__link), .primary-button, .community-submit {
  min-height: 44px;
  padding: 0 18px;
  color: white;
  border: 0;
  border-radius: 12px;
  background: var(--community-accent);
  box-shadow: 0 7px 22px rgba(222,140,152,.2);
}
.community-empty > button:not(.community-empty__link):hover, .primary-button:hover:not(:disabled), .community-submit:hover:not(:disabled) { background: #efa3ad; }
.community-empty__link {
  min-height: 40px;
  margin-top: 5px;
  color: #efa3ad;
  border: 0;
  background: transparent;
}
.community-detail { min-height: 300px; }
#communities-section #server-view { max-width: none; margin: 0; padding: 17px; }
.server-detail-heading { display: flex; min-width: 0; align-items: center; gap: 13px; padding: 2px 0 16px; }
.server-avatar {
  display: grid;
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  place-items: center;
  overflow: hidden;
  border-radius: 17px;
  color: white;
  font-size: 23px;
  font-weight: 750;
  background: linear-gradient(145deg, #efa3ad, #b85b78);
}
.server-avatar img { width: 100%; height: 100%; object-fit: cover; }
.server-detail-copy { flex: 1 1 auto; }
.server-detail-copy h3 { overflow: hidden; margin: 0; font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
.server-detail-copy p { margin: 0; color: #a1a0a7; font-size: 12px; overflow-wrap: anywhere; }
.server-detail-copy > span { color: #7f7e86; font-size: 10px; }
.server-detail-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.server-detail-actions button { min-height: 37px; padding-inline: 12px; font-size: 11px; }
#server-invite { color: #f0c2c9; background: #292a2f; }
.community-channel-heading { padding: 12px 0 8px; border-top: 1px solid rgba(255,255,255,.06); }
.channel-list-button { min-height: 50px; }
.channel-list-icon { width: 34px; height: 34px; flex-basis: 34px; border-radius: 11px; color: #a9a8b0; background: #2a2a2e; }
.channel-list-icon--announcement { color: #e2bd78; background: rgba(226,189,120,.12); }
.channel-list-icon--voice { color: #79b99d; background: rgba(121,185,157,.12); }
.channel-empty { margin: 10px 0; color: #93929a; font-size: 12px; }
.channel-category { min-width: 0; list-style: none; }
.channel-category > h5 { margin: 10px 5px 3px; color: #77767e; font-size: 9px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.channel-category-list { display: grid; gap: 3px; padding: 0; margin: 0; list-style: none; }
.community-back {
  min-height: 35px;
  margin: -4px 0 10px -8px;
  padding: 0 8px;
  color: #efa3ad;
  border: 0;
  background: transparent;
}
.community-back:first-letter { font-size: 23px; }
.channel-detail { min-width: 0; padding-top: 13px; border-top: 1px solid rgba(255,255,255,.06); }
#communities-section #channel-view { max-width: none; margin: 14px 0 0; padding: 13px 0 0; border: 0; border-top: 1px solid rgba(255,255,255,.06); border-radius: 0; background: transparent; }
.channel-detail h3 { margin: 0 0 3px; font-size: 17px; }
.channel-description { margin: 0; color: #929198; font-size: 11px; }
#channel-messages { max-height: min(45vh, 500px); min-height: 140px; overflow-y: auto; align-content: start; }
#channel-message-form { display: flex; align-items: center; flex-wrap: nowrap; gap: 8px; margin-top: 12px; }
#channel-message-form input { flex: 1 1 auto; }
#channel-message-form button { flex: 0 0 auto; }
.voice-room {
  display: grid;
  gap: 14px;
  max-width: 720px;
  margin: 18px auto 0;
  padding: 20px;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(48,39,45,.94), rgba(31,30,34,.98));
  box-shadow: 0 16px 38px rgba(0,0,0,.18);
}
.voice-room[hidden] { display: none !important; }
.voice-room__heading { display: flex; align-items: center; gap: 12px; }
.voice-room__heading > div { display: grid; gap: 3px; }
.voice-room__heading strong { color: #f6f3f5; font-size: 16px; }
.voice-room__heading small { color: #aaa4ad; font-size: 12px; }
.voice-room__live { width: 11px; height: 11px; border-radius: 50%; background: #72d39a; box-shadow: 0 0 0 5px rgba(114,211,154,.12); }
.voice-room__status { margin: 0; color: #aaa4ad; font-size: 13px; line-height: 1.5; }
.voice-room__status.is-error { color: #ff9eac; }
.voice-room__participants { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; }
.voice-room__participant { display: flex; min-width: 0; align-items: center; gap: 10px; padding: 9px 11px; border: 1px solid rgba(255,255,255,.06); border-radius: 13px; background: rgba(255,255,255,.035); transition: border-color .18s ease, background .18s ease, box-shadow .18s ease; }
.voice-room__participant.is-speaking { border-color: rgba(105,219,150,.8); background: rgba(70,155,105,.12); box-shadow: 0 0 0 2px rgba(105,219,150,.11); }
.voice-room__avatar { display: grid; width: 38px; height: 38px; flex: 0 0 38px; place-items: center; overflow: hidden; border-radius: 50%; color: #f1c4cd; background: #49333c; font-weight: 700; }
.voice-room__avatar img { width: 100%; height: 100%; object-fit: cover; }
.voice-room__participant strong { overflow: hidden; flex: 1 1 auto; color: #f2eff1; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.voice-room__member-state { display: grid; width: 28px; height: 28px; flex: 0 0 28px; place-items: center; color: #78d39a; }
.voice-room__member-state.is-muted { color: #f19ba8; }
.voice-room__member-state svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.voice-room__empty { grid-column: 1 / -1; margin: 0; padding: 12px 0; color: #89858d; font-size: 13px; }
.voice-room__controls { display: flex; flex-wrap: wrap; gap: 9px; }
.voice-room__controls button { min-height: 40px; padding: 0 15px; border: 1px solid rgba(255,255,255,.1); border-radius: 12px; color: #eee9ed; background: rgba(255,255,255,.06); transition: background .15s ease, border-color .15s ease, transform .15s ease; }
.voice-room__controls button:hover:not(:disabled) { border-color: rgba(239,163,173,.4); background: rgba(239,163,173,.1); transform: translateY(-1px); }
.voice-room__controls button:disabled { cursor: not-allowed; opacity: .55; }
.voice-room__controls .voice-room__join { border-color: rgba(114,211,154,.4); color: #baf0ce; background: rgba(65,151,100,.16); }
.voice-room__controls .voice-room__leave { border-color: rgba(239,131,151,.35); color: #ffb4bf; }
.voice-room__audio { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.voice-room__controls button:focus-visible { outline: 2px solid #efa3ad; outline-offset: 2px; }
@media (max-width: 600px) {
  .voice-room { margin-top: 14px; padding: 15px; border-radius: 16px; }
  .voice-room__participants { grid-template-columns: 1fr; }
  .voice-room__controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .voice-room__controls button { min-height: 44px; padding: 0 8px; font-size: 12px; }
}
.channel-readonly-note { margin: 10px 0 0; color: #aaa9b0; font-size: 11px; }
.community-add-menu {
  position: fixed;
  z-index: 120;
  top: 92px;
  right: max(24px, calc((100vw - 1360px) / 2 + 24px));
  width: min(280px, calc(100vw - 28px));
  padding: 6px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 15px;
  background: #26262a;
  box-shadow: 0 18px 50px rgba(0,0,0,.4);
}
.community-add-menu[hidden] { display: none !important; }
.community-add-menu button { display: flex; width: 100%; align-items: center; justify-content: flex-start; gap: 11px; border: 0; background: transparent; }
.community-add-menu button > span { color: #e6a1ac; font-size: 16px; }

.community-dialog {
  position: fixed;
  z-index: 150;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}
.community-dialog.is-open { opacity: 1; pointer-events: auto; }
.community-dialog__backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(5px);
}
button.community-dialog__backdrop:hover:not(:disabled),
button.community-dialog__backdrop:active:not(:disabled) {
  color: inherit;
  border-color: transparent;
  background: rgba(0,0,0,.72);
  box-shadow: none;
  transform: none;
}
.community-dialog__panel {
  position: relative;
  z-index: 1;
  width: min(100%, 470px);
  max-height: min(92dvh, 820px);
  padding: 18px 20px 20px;
  overflow-y: auto;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 22px;
  background: #202023;
  box-shadow: 0 26px 90px rgba(0,0,0,.5);
  transform: translateY(10px) scale(.99);
  transition: transform .18s ease;
}
.community-dialog.is-open .community-dialog__panel { transform: translateY(0) scale(1); }
.community-dialog__panel--compact { width: min(100%, 430px); }
.community-dialog__heading { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin: 0 0 8px; }
.community-dialog__heading h2 { margin: 0; font-size: 15px; font-weight: 700; text-align: center; }
.community-dialog__cancel, .community-dialog__close {
  min-height: 34px;
  padding: 0 5px;
  color: #efa3ad;
  border: 0;
  background: transparent;
  font-size: 12px;
}
.community-dialog__close { justify-self: end; width: 34px; padding: 0; color: #aaa9b0; font-size: 24px; }
.community-dialog__hint, .community-dialog__context { margin: 0 0 15px; color: #9998a0; font-size: 12px; }
.community-dialog__context { font-size: 11px; }
.community-dialog__context strong { margin-left: 4px; color: #d6d5db; }
#server-form, #channel-form, #server-join-form {
  max-width: none;
  display: grid;
  align-items: stretch;
  gap: 12px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.server-photo-picker { display: grid; justify-items: center; gap: 5px; margin: 0 0 2px; color: #efa3ad; font-size: 11px; cursor: pointer; }
.server-photo-preview {
  display: grid;
  width: 66px;
  height: 66px;
  place-items: center;
  overflow: hidden;
  border: 1px dashed rgba(255,255,255,.22);
  border-radius: 50%;
  color: #90919a;
  background: #2b2c31;
  font-size: 25px;
}
.server-photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.server-photo-picker input { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; opacity: 0; pointer-events: none; }
.community-field { display: grid; min-width: 0; gap: 5px; }
.community-field > label, .community-choice-field legend, #server-join-form > label {
  width: auto;
  margin: 0;
  color: #b7b6bd;
  font-size: 10px;
  font-weight: 650;
}
.community-field > label span, .community-choice-field legend span { color: #77767e; font-weight: 400; }
.community-input-wrap { position: relative; display: flex; align-items: center; }
.community-input-wrap input { min-height: 42px; padding: 0 46px 0 12px; border-radius: 10px; background: #2a2a2e; font-size: 12px; }
.community-input-wrap input:focus, .community-field textarea:focus, .community-field select:focus, #server-join-form input:focus { border-color: var(--community-accent); box-shadow: 0 0 0 3px rgba(222,140,152,.14); }
.community-counter { position: absolute; right: 10px; color: #92919a; font-size: 9px; pointer-events: none; }
.community-choice-field { min-width: 0; padding: 0; margin: 0; border: 0; }
.community-choice-field legend { margin-bottom: 6px; }
.server-type-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
.server-type-grid label { position: relative; width: auto; min-height: 34px; margin: 0; cursor: pointer; }
.server-type-grid input, .channel-type-option > input { position: absolute; width: 1px; height: 1px; min-height: 0; opacity: 0; }
.server-type-grid label > span {
  display: grid;
  min-height: 34px;
  place-items: center;
  padding: 4px 7px;
  color: #d6d5da;
  border: 1px solid rgba(255,255,255,.055);
  border-radius: 9px;
  background: #2a2a2e;
  font-size: 10px;
  transition: border-color .16s, color .16s, background .16s;
}
.server-type-grid input:checked + span { color: #f0c2c9; border-color: var(--community-accent); background: rgba(222,140,152,.14); }
.server-type-grid input:focus-visible + span, .channel-type-option > input:focus-visible + .channel-type-icon { outline: 2px solid #efa3ad; outline-offset: 2px; }
.community-switch {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 11px;
  margin: 0;
  border: 1px solid rgba(255,255,255,.035);
  border-radius: 11px;
  background: #2a2a2e;
  cursor: pointer;
}
.community-switch > span:first-child { display: grid; gap: 1px; }
.community-switch strong { color: #dedde2; font-size: 10px; font-weight: 600; }
.community-switch small { color: #88878f; font-size: 9px; font-weight: 400; }
.community-switch > input { position: absolute; right: 10px; width: 1px; height: 1px; min-height: 0; opacity: 0; }
.community-switch__track { position: relative; width: 38px; height: 22px; flex: 0 0 38px; border-radius: 20px; background: #55545b; transition: background .18s; }
.community-switch__track::after { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; content: ""; border-radius: 50%; background: #fff; transition: transform .18s; }
.community-switch > input:checked + .community-switch__track { background: var(--community-accent); }
.community-switch > input:checked + .community-switch__track::after { transform: translateX(16px); }
.community-switch > input:focus-visible + .community-switch__track { outline: 2px solid #efa3ad; outline-offset: 2px; }
.community-field textarea { min-height: 68px; padding: 10px 12px; border-radius: 10px; background: #2a2a2e; font-size: 12px; }
.community-field select, #channel-new-category { width: 100%; min-height: 42px; padding: 0 12px; color: #e1e0e5; border: 1px solid rgba(255,255,255,.07); border-radius: 10px; outline: none; background: #2a2a2e; font: inherit; font-size: 11px; }
#channel-new-category { margin-top: 3px; }
.channel-type-list { display: grid; gap: 5px; }
.channel-type-option {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 47px;
  align-items: center;
  gap: 9px;
  padding: 5px 9px;
  margin: 0;
  border: 1px solid rgba(255,255,255,.05);
  border-radius: 10px;
  background: #2a2a2e;
  cursor: pointer;
}
.channel-type-option:has(input:checked) { border-color: rgba(222,140,152,.46); background: rgba(222,140,152,.1); }
.channel-type-icon { display: grid; width: 28px; height: 28px; flex: 0 0 28px; place-items: center; border-radius: 50%; color: #f0c2c9; background: rgba(222,140,152,.16); font-size: 16px; font-weight: 700; }
.channel-type-copy { display: grid; min-width: 0; gap: 0; }
.channel-type-copy strong { color: #e1e0e5; font-size: 10px; font-weight: 600; }
.channel-type-copy small { color: #85848c; font-size: 9px; font-weight: 400; }
.channel-type-radio { width: 14px; height: 14px; flex: 0 0 14px; margin-left: auto; border: 1px solid #77767e; border-radius: 50%; }
.channel-type-option:has(input:checked) .channel-type-radio { border: 4px solid var(--community-accent); background: #fff; }
.channel-name-prefix { position: absolute; left: 11px; z-index: 1; color: #9a99a1; font-size: 14px; pointer-events: none; }
.community-input-wrap:has(.channel-name-prefix) input { padding-left: 29px; }
.community-field-error { color: #ff7785; font-size: 10px; line-height: 1.4; }
.community-input-wrap:has(input[aria-invalid="true"]) input { border-color: #e34f61; box-shadow: 0 0 0 2px rgba(227,79,97,.11); }
.community-form-status { min-height: 0; margin: 0; color: #f1a3aa; font-size: 10px; line-height: 1.45; overflow-wrap: anywhere; }
.community-form-status:empty { display: none; }
.community-submit { width: 100%; min-height: 44px; margin-top: 1px; font-size: 12px; }
#server-join-form { gap: 8px; }
#server-join-form input { min-height: 44px; padding: 0 12px; border-radius: 10px; background: #2a2a2e; font-size: 12px; }

@media (min-width: 721px) {
  #communities-section {
    grid-column: 2 / 4;
    grid-row: 1;
    width: auto;
    max-width: none;
    padding: 24px clamp(20px, 3vw, 44px);
    overflow-y: auto;
  }
  #communities-section > .communities-header,
  #communities-section > #community-status,
  #communities-section > .community-layout { width: min(100%, 1160px); margin-right: auto; margin-left: auto; }
  .community-layout { grid-template-columns: minmax(220px, 290px) minmax(0, 1fr); gap: 18px; }
  .community-server-panel, .community-detail { padding: clamp(17px, 2vw, 26px); }
  .community-empty { min-height: min(66vh, 600px); }
  #community-status:empty { display: none; }
  .channel-detail { margin-top: 16px; }
}
@media (max-width: 720px) {
  main { height: 100dvh; min-height: 0; padding: 0; }
  .profile-menu { z-index: 120; }
  .profile-menu__panel {
    padding: max(78px, calc(env(safe-area-inset-top) + 32px)) 20px max(24px, env(safe-area-inset-bottom));
  }
  #app {
    position: relative;
    width: 100%;
    height: 100dvh;
    min-height: 0;
    display: block;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: #111113;
  }
  #app > nav {
    position: fixed;
    z-index: 100;
    inset: auto 0 0;
    width: 100%;
    height: calc(62px + env(safe-area-inset-bottom));
    min-height: 0;
    padding: 4px 5px calc(4px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-around;
    gap: 1px;
    border-top: 1px solid rgba(255,255,255,.075);
    border-right: 0;
    background: rgba(27,27,30,.97);
    backdrop-filter: blur(18px);
  }
  #app > nav #menu-toggle {
    position: static;
    inset: auto;
    width: auto;
    min-width: 0;
    height: auto;
    min-height: 48px;
    flex: 1 1 0;
    padding: 3px 1px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    color: #85848c;
    border: 0;
    border-radius: 10px;
    background: transparent;
  }
  #app > nav #menu-toggle.is-open { position: static; inset: auto; width: auto; min-width: 0; height: auto; min-height: 48px; }
  #app > nav #menu-toggle > span { display: none; }
  #app > nav #menu-toggle .settings-nav-icon { display: block; width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  #app > nav #menu-toggle .settings-nav-label { display: block; color: inherit; font-size: 8px; line-height: 1; }
  #app > nav #menu-toggle.is-open, #app > nav #menu-toggle:hover:not(:disabled) { color: var(--community-accent); background: var(--community-accent-soft); }
  #app > nav [data-section="friends-section"] { order: 1; }
  #app > nav [data-section="calls-section"] { order: 2; }
  #app > nav [data-section="chats-section"] { order: 3; }
  #app > nav [data-section="reels-section"] { order: 4; }
  #app > nav [data-section="communities-section"] { order: 5; }
  #app > nav #menu-toggle { order: 6; }
  #app > nav button {
    width: auto;
    min-width: 0;
    min-height: 48px;
    flex: 1 1 0;
    gap: 3px;
    padding: 3px 1px;
    color: #85848c;
    font-size: 8px;
    border-radius: 10px;
  }
  #app > nav .nav-icon { width: 21px; height: 21px; flex-basis: 21px; }
  #app > nav button[data-section="reels-section"] { display: flex; }
  #app > nav #reel-publish-open {
    display: flex;
    order: 5;
    color: #f0a3b2;
  }
  #app > nav [data-section="communities-section"] { order: 6; }
  #app > nav #menu-toggle { order: 7; }
  #app > nav #reel-publish-open .nav-icon { width: 22px; height: 22px; }
  #app > nav #reel-publish-open > span { font-size: 7px; }
  #app > nav .nav-coming-soon { display: flex; }
  #app > nav button[data-section="profile-section"] { display: none; }
  .add-contact-button { bottom: calc(72px + env(safe-area-inset-bottom)); }
  .create-menu { bottom: calc(128px + env(safe-area-inset-bottom)); }
  #app:has(#communities-section:not([hidden])) > nav [data-section="communities-section"],
  #app:has(#calls-section:not([hidden])) > nav [data-section="calls-section"],
  #app:has(#profile-section:not([hidden])) > nav [data-section="profile-section"] { color: var(--community-accent); background: var(--community-accent-soft); }
  .page-section { display: none; width: 100%; height: 100%; min-height: 0; max-width: none; margin: 0; padding: 14px 14px calc(76px + env(safe-area-inset-bottom)); overflow-x: hidden; overflow-y: auto; }
  .page-section:not([hidden]) { display: block; }
  #communities-section.page-section {
    display: block;
    padding: max(12px, env(safe-area-inset-top)) 12px calc(74px + env(safe-area-inset-bottom));
    background: #111113;
  }
  .communities-header { min-height: 50px; margin: 0 2px 12px; }
  .communities-header .eyebrow { font-size: 8px; }
  .communities-header h2 { font-size: 19px; }
  .community-add-button { width: 38px; min-height: 38px; }
  .community-layout { display: block; }
  .community-layout:has(.community-empty--no-servers:not([hidden])) .community-server-panel { display: none; }
  .community-layout:has(.community-empty--no-servers:not([hidden])) .community-empty { display: flex; }
  .community-server-panel, .community-detail { padding: 14px; border-radius: 16px; }
  .community-panel-heading { margin-bottom: 7px; }
  .server-list-button { min-height: 62px; }
  .server-list-avatar { width: 42px; height: 42px; flex-basis: 42px; }
  .server-list-copy strong { font-size: 13px; }
  .server-list-copy small { font-size: 10px; }
  .community-empty { min-height: min(55dvh, 460px); padding: 22px 18px; border: 0; background: transparent; }
  .community-empty:not(.community-empty--no-servers) { min-height: 110px; padding: 14px 8px; }
  .community-empty h3 { font-size: 16px; }
  .community-empty p { font-size: 11px; }
  .community-detail { display: block; margin-top: 10px; }
  #communities-section #server-view { padding: 14px; }
  #communities-section #channel-view { margin-top: 10px; padding-top: 10px; }
  #communities-section.is-detail-open .community-server-panel,
  #communities-section.is-detail-open .community-empty { display: none; }
  #communities-section.is-detail-open .community-detail[hidden] { display: none; }
  #communities-section.is-detail-open .community-detail:not([hidden]) { display: block; }
  #communities-section.is-detail-open .server-detail-heading { align-items: flex-start; flex-wrap: wrap; }
  #communities-section.is-detail-open .server-detail-actions { width: 100%; justify-content: stretch; }
  #communities-section.is-detail-open .server-detail-actions button { flex: 1 1 auto; }
  #communities-section.is-channel-open .server-detail-heading,
  #communities-section.is-channel-open .community-channel-heading,
  #communities-section.is-channel-open #channel-list,
  #communities-section.is-channel-open #channel-empty { display: none; }
  #communities-section.is-channel-open #channel-view:not([hidden]) { display: block; min-height: 55dvh; }
  #channel-messages { max-height: 38dvh; }
  .community-dialog {
    z-index: 180;
    align-items: center;
    padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }
  .community-dialog__panel, .community-dialog__panel--compact {
    width: min(100%, 470px);
    max-height: min(94dvh, 850px);
    padding: 14px 17px max(16px, env(safe-area-inset-bottom));
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 21px;
    background: #202023;
    transform: translateY(10px) scale(.99);
  }
  .community-dialog.is-open .community-dialog__panel { transform: translateY(0) scale(1); }
  .community-add-menu { top: auto; right: 12px; bottom: calc(70px + env(safe-area-inset-bottom)); }
  .community-dialog__heading { position: sticky; top: -14px; z-index: 2; padding: 4px 0 9px; background: #202023; }
  #server-form, #channel-form { gap: 10px; }
}
@media (max-width: 360px) {
  #app > nav button { font-size: 7px; }
  #app > nav .nav-icon { width: 19px; height: 19px; flex-basis: 19px; }
  .community-dialog__panel { padding-right: 13px; padding-left: 13px; }
  .server-type-grid label > span { font-size: 9px; }
}

#friends-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}
#friends-section > h2,
#friends-section > .contacts-panel,
#friends-section > .friends-subsection {
  width: min(100%, 860px);
  flex: 0 0 auto;
}
#friends-section > h2 { margin: 0; text-align: left; }
#friends-section > .contacts-panel {
  min-height: 0;
  margin: 0 auto;
  display: grid;
  gap: 16px;
}
#friends-section .contacts-search {
  width: 100%;
  min-width: 0;
  min-height: 54px;
  margin: 0;
}
#friends-section .contacts-search input {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  min-height: 42px;
  margin: 0;
}
#friends-section .contacts-panel > h3 {
  margin: 0;
  text-align: center;
}
#friends-section .contacts-list {
  display: grid;
  gap: 8px;
  min-width: 0;
}
#friends-section .contact-row {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 16px;
  background: rgba(255,255,255,.025);
}
#friends-section .friends-subsection {
  display: grid;
  gap: 12px;
  min-width: 0;
}
#friends-section .friends-subsection > h3 {
  margin: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
#friends-section .friends-subsection > div {
  display: grid;
  min-width: 0;
  gap: 12px;
}
#friends-section .friends-subsection .friend-item { margin: 0; }
#friends-section .friends-subsection .friend-empty { margin: 0; }
#friends-section #friends-list .friend-item {
  min-height: 128px;
  padding: 22px 28px;
  border: 1px solid #353b56;
  border-radius: 22px;
  background: #1b2033;
  color: #f3f5ff;
}
#friends-section #friends-list .friend-person { flex: 1 1 auto; gap: 28px; }
#friends-section #friends-list .friend-avatar {
  width: 80px;
  height: 80px;
  flex-basis: 80px;
  color: #f3f5ff;
  font-size: 26px;
}
#friends-section #friends-list .friend-username {
  font-size: 20px;
  font-weight: 600;
}
#friends-section #friends-list .friend-actions { flex: 0 0 auto; }
#friends-section #friends-list .friend-actions button:first-child { display: none; }
#friends-section #friends-list .friend-actions .friend-remove-button {
  min-height: 48px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid rgba(232, 78, 111, .55);
  border-radius: 14px;
  color: #f47e98;
  background: rgba(93, 25, 43, .52);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}
#friends-section #friends-list .friend-remove-button:hover:not(:disabled) {
  border-color: rgba(245, 100, 133, .78);
  color: #ff9aaf;
  background: rgba(116, 31, 53, .7);
}
#friends-section #friends-list .friend-remove-button svg {
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  fill: currentColor;
}
#friends-section > #friends-list .friend-empty { color: #adb5cd; }

@media (min-width: 721px) {
  #friends-section {
    grid-column: 2 / 4;
    grid-row: 1;
    width: auto;
    max-width: none;
    min-height: 100%;
    padding: clamp(24px, 4vw, 48px);
    overflow-y: auto;
  }
}
@media (max-width: 520px) {
  #friends-section { gap: 20px; }
  #friends-section > .contacts-panel { padding: 16px; }
  #friends-section .contacts-search { min-height: 48px; }
  #friends-section .contacts-panel > h3 { font-size: 18px; }
  #friends-section .contact-row { gap: 8px; padding: 9px; }
  #friends-section .contact-identity { gap: 9px; }
  #friends-section .contact-avatar { width: 42px; height: 42px; flex-basis: 42px; }
  #friends-section .contact-chat-button { flex-basis: 96px; width: 96px; min-width: 96px; padding-inline: 7px; }
  #friends-section .friends-subsection { gap: 10px; }
  #friends-section .friends-subsection > h3 { padding-bottom: 8px; }
  #friends-section #friends-list .friend-item {
    min-height: 0;
    padding: 16px;
    border-radius: 18px;
  }
  #friends-section #friends-list .friend-person { gap: 14px; }
  #friends-section #friends-list .friend-avatar {
    width: 56px;
    height: 56px;
    flex-basis: 56px;
  }
  #friends-section #friends-list .friend-username { font-size: 16px; }
  #friends-section #friends-list .friend-actions {
    width: 100%;
    justify-content: flex-end;
  }
  #friends-section #friends-list .friend-actions .friend-remove-button {
    min-height: 42px;
    padding: 0 13px;
    font-size: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .community-dialog, .community-dialog__panel, .community-switch__track, .community-switch__track::after { transition-duration: .01ms; }
}

@media (min-width: 721px) {
  #app:has(#chats-section:not([hidden]))::after { display: none; }
  #chats-section {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    grid-template-rows: auto auto auto 54px 42px minmax(0, 1fr) 0;
    gap: 0 24px;
    grid-column: 2 / 4;
    grid-row: 1;
    width: auto;
    max-width: none;
    height: 100%;
    min-height: 0;
    margin: 0;
    padding: 22px clamp(18px, 3vw, 42px);
    overflow: hidden;
    background: transparent;
  }
  #chats-section > h2 { display: none; }
  #chats-section > .chat-background-settings { grid-column: 1; grid-row: 1; margin: 0 0 10px; }
  #chats-section .conversation-search-row { grid-column: 1; grid-row: 2; }
  #chats-section .chat-notice { grid-column: 1; grid-row: 3; }
  #chats-section .conversation-filters { grid-column: 1; grid-row: 4; }
  #chats-section #chat-status { grid-column: 1; grid-row: 5; }
  #chats-section #conversation-list { grid-column: 1; grid-row: 6; min-height: 0; overflow-y: auto; }
  #chats-section #conversation-empty { grid-column: 1; grid-row: 6; align-self: start; }
  #chat-view:not([hidden]) {
    display: grid;
    grid-column: 2;
    grid-row: 1 / -1;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: 100%;
    max-width: none;
    height: 100%;
    min-height: 0;
    margin: 0;
    padding: clamp(18px, 2.5vw, 32px);
    overflow: hidden;
  }
  #chat-title { margin-bottom: 8px; }
  #messages { min-height: 0; max-height: none; }
  #message-form { align-self: end; }
}

/* Shared GadLink dark-plum and rose design language across every section. */
:root {
  --bg: #0c0b0e;
  --surface: #19171b;
  --surface-raised: #242126;
  --surface-soft: #131115;
  --line: rgba(235, 218, 232, .09);
  --text: #f6f1f5;
  --muted: #a39ba5;
  --accent: #e98597;
  --accent-strong: #f3a5b2;
  --accent-ink: #32171e;
  --community-accent: var(--accent);
  --community-accent-soft: rgba(233, 133, 151, .14);
  --radius-card: 20px;
}

html,
body {
  background-color: var(--bg);
}

body {
  background:
    radial-gradient(ellipse at 75% 4%, rgba(111, 53, 78, .14), transparent 34%),
    radial-gradient(ellipse at 14% 78%, rgba(69, 43, 82, .10), transparent 38%),
    var(--bg);
}

body::before { opacity: .055; }

header {
  border-color: rgba(235, 218, 232, .07);
  background: rgba(18, 16, 20, .84);
}

main { color: var(--text); }

#auth-section,
.pwa-install-card {
  border-color: rgba(230, 160, 177, .13);
  background: linear-gradient(145deg, rgba(38, 33, 40, .97), rgba(22, 20, 24, .98));
  box-shadow: 0 28px 90px rgba(0, 0, 0, .38), inset 0 1px rgba(255, 255, 255, .035);
}

#auth-section h2,
.page-section > h2,
.profile-menu__panel h2,
.community-dialog__heading h2,
.friend-add-dialog__heading h2,
.reel-publish-dialog__heading h2 {
  color: #fbf5f8;
}

label { color: #c9c0ca; }

input,
textarea,
select {
  color: var(--text);
  border-color: rgba(235, 218, 232, .085);
  background-color: #151217;
}

input:hover:not(:focus),
textarea:hover:not(:focus),
select:hover:not(:focus) {
  border-color: rgba(233, 133, 151, .2);
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(243, 165, 178, .62);
  background-color: #19151a;
  box-shadow: 0 0 0 3px rgba(233, 133, 151, .12);
}

button {
  border-color: rgba(235, 218, 232, .075);
  border-radius: 13px;
  color: #eee7ed;
  background: linear-gradient(180deg, #2c282e, #252126);
}

button:hover:not(:disabled) {
  border-color: rgba(233, 133, 151, .25);
  background: linear-gradient(180deg, #373039, #2b252c);
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline-color: var(--accent-strong);
}

#auth-form button[type="submit"],
#profile-form button[type="submit"],
#post-form button[type="submit"],
#conversation-form button[type="submit"],
#server-form button[type="submit"],
#channel-form button[type="submit"],
#message-form button[type="submit"],
#channel-message-form button[type="submit"],
#resend-confirmation,
.profile-menu__form button,
.community-submit,
.primary-button,
#friend-search-form button,
#reel-publish-submit {
  color: var(--accent-ink);
  border-color: rgba(255, 226, 232, .18);
  background: linear-gradient(135deg, #f1a0af, #df778d);
  box-shadow: 0 6px 18px rgba(201, 88, 115, .16), inset 0 1px rgba(255, 255, 255, .2);
}

#auth-form button[type="submit"]:hover,
#profile-form button[type="submit"]:hover,
#post-form button[type="submit"]:hover,
#conversation-form button[type="submit"]:hover,
#server-form button[type="submit"]:hover,
#channel-form button[type="submit"]:hover,
#message-form button[type="submit"]:hover,
#channel-message-form button[type="submit"]:hover,
.profile-menu__form button:hover,
.community-submit:hover:not(:disabled),
.primary-button:hover:not(:disabled),
#friend-search-form button:hover,
#reel-publish-submit:hover {
  color: #29141a;
  background: linear-gradient(135deg, #f6afbc, #e98ba0);
  box-shadow: 0 8px 22px rgba(201, 88, 115, .24), inset 0 1px rgba(255, 255, 255, .25);
}

#sign-up,
#sign-out,
.profile-menu__sign-out {
  border-color: rgba(233, 133, 151, .14);
  color: #f2c4cd;
  background: rgba(233, 133, 151, .075);
}

#app {
  border-color: rgba(235, 218, 232, .075);
  background-color: rgba(15, 13, 17, .92);
  box-shadow: 0 28px 90px rgba(0, 0, 0, .3);
}

#app > nav {
  background-color: #211e23;
  border-color: rgba(235, 218, 232, .06);
}

#app > nav button {
  border-radius: 15px;
  transition: color .18s ease, background .18s ease, border-color .18s ease, transform .18s ease;
}

#app > nav button:hover:not(:disabled) {
  color: #f2c6cf;
  border-color: rgba(233, 133, 151, .12);
  background: rgba(233, 133, 151, .07);
}

#app:has(#reels-section:not([hidden])) > nav [data-section="reels-section"],
#app:has(#chats-section:not([hidden])) > nav [data-section="chats-section"],
#app:has(#calls-section:not([hidden])) > nav [data-section="calls-section"],
#app:has(#friends-section:not([hidden])) > nav [data-section="friends-section"],
#app:has(#communities-section:not([hidden])) > nav [data-section="communities-section"] {
  color: var(--accent-strong);
  background: rgba(233, 133, 151, .11);
}

.page-section {
  color: var(--text);
  scrollbar-color: #51434f transparent;
}

.contacts-panel,
#chat-view,
#server-view,
#channel-view,
.community-server-panel,
.community-detail,
.calls-empty,
.profile-menu__panel,
.friend-add-dialog__panel,
.reel-publish-dialog__panel,
.community-dialog__panel {
  border-color: rgba(235, 218, 232, .08);
  background-color: #1d1a20;
  box-shadow: 0 18px 55px rgba(0, 0, 0, .22), inset 0 1px rgba(255, 255, 255, .018);
}

#conversation-list button:hover,
#server-list button:hover,
#channel-list button:hover,
.server-list-button:hover:not(:disabled),
.channel-list-button:hover:not(:disabled) {
  background-color: rgba(233, 133, 151, .075) !important;
}

#conversation-list .conversation-row button[aria-current="true"],
#conversation-list .conversation-row button.is-active,
.server-list-button[aria-current="true"] {
  border-color: rgba(233, 133, 151, .2);
  background: rgba(233, 133, 151, .10) !important;
}

.conversation-filters button.selected,
.reels-tabs button.is-selected {
  color: #f4adba;
  background: rgba(233, 133, 151, .13);
}

.notification-settings,
.chat-notice,
.community-empty:not(.community-empty--no-servers) {
  border-color: rgba(235, 218, 232, .065);
  background-color: #262229;
}

.chat-background-settings {
  margin-top: 9px;
  overflow: hidden;
  border: 1px solid rgba(235, 218, 232, .075);
  border-radius: 14px;
  background: rgba(16, 14, 18, .38);
}

.chat-background-settings summary {
  min-height: 42px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #eee7ed;
  font-size: 13px;
}
.community-panel-heading .community-add-button {
  width: 30px;
  min-height: 30px;
  color: #f0adb7;
  background: rgba(222,140,152,.14);
  font-size: 21px;
}
.community-add-menu {
  top: 0;
  right: auto;
  left: 0;
}
#community-add-menu[hidden] { display: none !important; }

.profile-avatar-preview {
  display: grid;
  width: 100%;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
  color: #f1e8eb;
  font-size: 14px;
  font-weight: 650;
}
.profile-avatar-preview > img,
.profile-avatar-preview > #profile-avatar-preview-placeholder {
  grid-column: 1;
  grid-row: 1;
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(240,173,183,.55);
  border-radius: 50%;
  color: #28171b;
  background: linear-gradient(145deg, #f3b4be, #975467);
  box-shadow: 0 8px 26px rgba(222,140,152,.2);
}
.profile-avatar-preview > img { object-fit: cover; }
.profile-avatar-preview > span:last-child { grid-column: 2; grid-row: 1; }
#profile-section { background-image: radial-gradient(ellipse at 52% 12%, rgba(166,91,117,.13), transparent 50%); }
#profile-form {
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 24px;
  background: linear-gradient(150deg, rgba(42,38,43,.96), rgba(24,23,26,.98));
  box-shadow: 0 22px 65px rgba(0,0,0,.22), inset 0 1px rgba(255,255,255,.035);
}
#profile-form input[type="file"] { border-color: rgba(222,140,152,.17); background: rgba(13,13,16,.68); }
#profile-form input[type="url"] { flex: 1 1 100%; }
#profile-status { width: min(100%, 600px); }

.chat-settings-link {
  order: 2;
  width: 100%;
  min-height: 38px;
  margin: 0 0 8px;
  padding: 0 12px;
  color: #e8b3bc;
  border: 1px solid rgba(222,140,152,.16);
  border-radius: 12px;
  background: rgba(222,140,152,.07);
  font-size: 12px;
  text-align: left;
}
.chat-background-settings {
  order: 3;
  margin: 0 0 8px;
  padding: 0;
  border: 1px solid rgba(239,163,173,.16);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(41,34,42,.92), rgba(27,25,30,.96));
  box-shadow: 0 8px 22px rgba(0,0,0,.14), inset 0 1px rgba(255,255,255,.035);
}
.chat-background-settings summary {
  width: 100%;
  min-height: 56px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #eee7ed;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: color .18s, background .18s, border-radius .18s;
}
.chat-background-settings summary::-webkit-details-marker { display: none; }
.chat-background-settings summary::after { content: "+"; display: grid; width: 36px; height: 36px; flex: 0 0 36px; place-items: center; border: 1px solid rgba(239,163,173,.32); border-radius: 12px; color: #ffd4dc; font-size: 24px; font-weight: 400; line-height: 1; background: rgba(233,133,151,.12); transition: color .18s, border-color .18s, background .18s, transform .18s; }
.chat-background-settings summary:hover { color: #fff; background: rgba(233,133,151,.07); }
.chat-background-settings summary:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: -3px; }
.chat-background-settings[open] summary { color: #ffe8ec; }
.chat-background-settings[open] summary { border-bottom: 1px solid rgba(239,163,173,.12); }
.chat-background-settings[open] summary::after { content: "−"; border-color: rgba(239,163,173,.42); background: rgba(233,133,151,.2); transform: rotate(180deg); }
.chat-background-gradients { min-width: 0; padding: 11px 12px 0; margin: 0; border: 0; }
.chat-background-gradients legend,
.chat-background-image > label {
  width: auto;
  margin: 0 0 8px;
  color: #c9c0ca;
  font-size: 12px;
  font-weight: 600;
}
.chat-background-options { display: flex; flex-wrap: wrap; gap: 10px; }
.chat-background-option {
  width: 42px;
  min-width: 42px;
  height: 36px;
  min-height: 36px;
  padding: 3px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 11px;
  background: transparent;
}
.chat-background-option:hover:not(:disabled) { background: rgba(255,255,255,.045); }
.chat-background-option[aria-pressed="true"] {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 2px rgba(233, 133, 151, .18);
}
.chat-background-option > span { display: block; width: 100%; height: 100%; border-radius: 7px; }
.chat-background-option[data-chat-bg-gradient="rose"] > span { background: linear-gradient(145deg, #392631 0%, #211b29 58%, #171a24 100%); }
.chat-background-option[data-chat-bg-gradient="violet"] > span { background: linear-gradient(145deg, #302448 0%, #242039 58%, #171a27 100%); }
.chat-background-option[data-chat-bg-gradient="ocean"] > span { background: linear-gradient(145deg, #183543 0%, #1c2837 58%, #171c27 100%); }
.chat-background-option[data-chat-bg-gradient="forest"] > span { background: linear-gradient(145deg, #203b32 0%, #222f31 58%, #191d27 100%); }
.chat-background-apply {
  width: 100%;
  min-height: 44px;
  margin-top: 9px;
  color: var(--accent-strong);
  border-color: rgba(233, 133, 151, .18);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(233,133,151,.13), rgba(233,133,151,.06));
  font-size: 13px;
  font-weight: 650;
}
.chat-background-apply:hover:not(:disabled) { color: #ffe8ec; background: rgba(233, 133, 151, .14); }
.chat-background-image {
  margin: 12px 12px 0;
  padding-top: 12px;
  border-top: 1px solid rgba(235, 218, 232, .075);
}
.chat-background-image > label { display: block; }
.chat-background-image input[type="file"] {
  min-height: 38px;
  padding: 5px;
  border-radius: 10px;
  font-size: 11px;
}
.chat-background-image input[type="file"]::file-selector-button {
  min-height: 27px;
  border-radius: 8px;
  background: #302a33;
}
.chat-background-file-name {
  margin: 6px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-background-reset {
  width: calc(100% - 24px);
  min-height: 34px;
  margin: 10px 12px 4px;
  color: #c9aeb8;
  border-color: transparent;
  background: transparent;
  font-size: 11px;
}
.chat-background-reset:hover:not(:disabled) { background: rgba(255,255,255,.045); }
.chat-background-status {
  min-height: 0;
  margin: 3px 12px 10px;
  color: #d3b5bf;
  font-size: 11px;
  overflow-wrap: anywhere;
}
.chat-background-status:empty { display: none; }

.reels-toolbar {
  border-color: rgba(235, 218, 232, .07);
  background: rgba(30, 27, 32, .94);
  box-shadow: 0 10px 32px rgba(0, 0, 0, .16);
}

.reels-search,
.conversation-search-row,
.contacts-search {
  border-color: rgba(235, 218, 232, .08);
  background: #17141a;
}

.reels-search:focus-within,
.conversation-search-row:focus-within,
.contacts-search:focus-within {
  border-color: rgba(233, 133, 151, .42);
  box-shadow: 0 0 0 3px rgba(233, 133, 151, .08);
}

#messages .message-item.is-own {
  border-color: rgba(233, 133, 151, .2);
  background: linear-gradient(145deg, #49313a, #30252e);
}

#messages .message-item.is-other,
.item {
  border-color: rgba(235, 218, 232, .07);
  background-color: #252128;
}

.call-history__row,
.profile-menu__action {
  border-color: rgba(235, 218, 232, .075);
  background: rgba(36, 32, 39, .82);
}

.community-add-button,
.community-empty > button:not(.community-empty__link),
.add-contact-button {
  color: #32171e;
  background: linear-gradient(135deg, #f0a0af, #df778d);
  box-shadow: 0 7px 22px rgba(201, 88, 115, .2);
}

.community-add-button:hover:not(:disabled),
.community-empty > button:not(.community-empty__link):hover,
.add-contact-button:hover:not(:disabled) {
  color: #29141a;
  background: linear-gradient(135deg, #f6afbc, #e98ba0);
}

.server-list-button[aria-current="true"],
.community-switch input:checked + .community-switch__track {
  border-color: rgba(233, 133, 151, .25);
  background-color: rgba(233, 133, 151, .12);
}

.community-field input,
.community-field textarea,
.community-field select,
.community-input-wrap input,
#server-join-form input {
  border-color: rgba(235, 218, 232, .085);
  border-radius: 12px;
  background: #17141a;
}

.friend-add-dialog__backdrop,
.reel-publish-dialog__backdrop,
.community-dialog__backdrop {
  background: rgba(7, 6, 9, .76);
  backdrop-filter: blur(7px);
}

#push-delivery-status {
  border-color: rgba(239, 133, 151, .32);
  background: rgba(57, 31, 40, .96);
  box-shadow: 0 16px 42px rgba(0, 0, 0, .4);
}

::selection {
  color: #30171d;
  background: #ee9cac;
}

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

@media (max-width: 720px) {
  #app:has(#reels-section:not([hidden])) {
    display: grid;
    grid-template-columns: 50px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    height: 100dvh;
    min-height: 0;
  }

  #app:has(#reels-section:not([hidden])) > nav {
    position: relative;
    inset: auto;
    grid-column: 1;
    grid-row: 1;
    width: 50px;
    height: 100%;
    min-height: 0;
    padding: 54px 2px 8px;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    overflow-y: auto;
  }

  #app:has(#reels-section:not([hidden])) > nav button {
    width: 46px;
    min-width: 46px;
    min-height: 48px;
    flex: 0 0 48px;
  }

  #app:has(#reels-section:not([hidden])) > nav #menu-toggle {
    width: 46px;
    min-width: 46px;
    flex: 0 0 48px;
  }

  #app:has(#reels-section:not([hidden])) #reels-section.page-section {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    height: 100%;
    min-height: 0;
  }
}

@media (min-width: 721px) {
  html,
  body {
    width: 100%;
    height: 100%;
    overflow: hidden;
  }

  main {
    width: 100%;
    height: 100dvh;
    min-height: 0;
    padding: 24px 18px 18px;
    overflow: hidden;
  }

  #app {
    height: 100%;
    min-height: 0;
  }

  #app > nav,
  .page-section {
    min-height: 0;
  }

  .page-section {
    height: 100%;
    max-height: 100%;
    overscroll-behavior: contain;
  }

  #auth-section {
    max-height: calc(100dvh - 48px);
    overflow-y: auto;
  }
}
#chat-background-status { min-height: 0; margin: 0; color: #e9a1ad; font-size: 11px; overflow-wrap: anywhere; }
#chat-background-status:empty { display: none; }
.chat-notice { order: 4; }
.conversation-filters { order: 5; }
#chat-status { order: 6; }
#conversation-list { order: 7; }
#conversation-empty { order: 7; }

#conversation-list button::before { display: none; }
#conversation-list .conversation-row button:has(.conversation-avatar) { grid-template-columns: 48px minmax(0, 1fr) auto; }
.conversation-avatar {
  position: relative;
  grid-column: 1;
  grid-row: 1 / 3;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 2px solid rgba(222,140,152,.38);
  border-radius: 50%;
  color: #f8e9ec;
  background: radial-gradient(circle at 35% 30%, #77717c, #514c55 55%, #302d33);
  font-size: 17px;
  font-weight: 700;
}
.conversation-avatar img,
.message-avatar img,
.chat-peer-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.conversation-row button:hover .conversation-avatar { border-color: rgba(222,140,152,.72); }
.chat-view__header { justify-content: flex-start; }
.chat-view__header h3 { flex: 1 1 auto; margin: 0 0 8px; }
.chat-peer-avatar {
  position: relative;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 2px solid rgba(222,140,152,.44);
  border-radius: 50%;
  color: #f8e9ec;
  background: linear-gradient(145deg, #6b5262, #352b38);
  font-size: 15px;
  font-weight: 700;
}
.message-item { display: flex !important; align-items: flex-end; gap: 8px !important; padding: 0 !important; border: 0 !important; background: transparent !important; }
.message-item.is-own { flex-direction: row-reverse; }
#messages .message-item,
#messages .message-item.is-own,
#messages .message-item.is-other { border: 0; background: transparent; padding: 0; }
.message-bubble { display: grid; min-width: 72px; max-width: min(100%, 540px); gap: 3px 16px; padding: 10px 13px 7px; border: 1px solid rgba(255,255,255,.07); border-radius: 16px; background: #252427; }
.message-item.is-own .message-bubble { border-color: rgba(222,140,152,.22); border-bottom-right-radius: 5px; background: linear-gradient(145deg, #49323a, #30262d); }
.message-item.is-other .message-bubble { border-bottom-left-radius: 5px; }
.message-avatar {
  position: relative;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(222,140,152,.4);
  border-radius: 50%;
  color: #f8e9ec;
  background: linear-gradient(145deg, #6b5262, #352b38);
  font-size: 11px;
  font-weight: 700;
}

#chat-view {
  background-color: #171a24;
  background-image: linear-gradient(145deg, #392631 0%, #211b29 58%, #171a24 100%);
  background-position: center;
  background-size: cover;
}
#chat-view[data-background="dusk"] {
  background-image: radial-gradient(ellipse at 15% 15%, rgba(117,87,162,.37), transparent 46%), linear-gradient(145deg, #26243d, #11151e 78%);
}
#chat-view[data-background="ocean"] {
  background-image: radial-gradient(ellipse at 15% 15%, rgba(56,140,160,.34), transparent 48%), linear-gradient(145deg, #1d333e, #11161c 78%);
}
#chat-view[data-background="forest"] {
  background-image: radial-gradient(ellipse at 15% 15%, rgba(76,137,101,.3), transparent 48%), linear-gradient(145deg, #23352e, #121816 78%);
}
#chat-view[data-background="custom"] {
  background-image: linear-gradient(rgba(15,14,18,.60), rgba(15,14,18,.72)), var(--chat-custom-background);
}

.push-settings-dialog {
  position: fixed;
  z-index: 220;
  inset: 0;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
  isolation: isolate;
}
.push-settings-dialog[hidden] { display: none !important; }
.push-settings-dialog.is-open { opacity: 1; pointer-events: auto; }
#push-settings-dialog > .push-settings-dialog__panel {
  position: relative;
  z-index: 1;
  width: min(440px, calc(100vw - 32px));
  min-width: 0;
  max-width: 100%;
  height: auto;
  max-height: min(88dvh, 640px);
  flex: 0 1 auto;
  margin: 0;
  padding: clamp(22px, 5vw, 32px);
  overflow: auto;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 24px;
  background:
    radial-gradient(ellipse at 95% 0, rgba(222,140,152,.18), transparent 48%),
    linear-gradient(150deg, #29262c, #171619 78%);
  box-shadow: 0 30px 90px rgba(0,0,0,.48), inset 0 1px rgba(255,255,255,.05);
  transform: translateY(14px) scale(.96);
  opacity: 0;
  transition: transform .24s cubic-bezier(.2,.8,.2,1), opacity .2s ease;
}
#push-settings-dialog.is-open > .push-settings-dialog__panel {
  transform: translateY(0) scale(1);
  opacity: 1;
}
.push-settings-dialog__backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: rgba(5,5,8,.3);
  backdrop-filter: blur(3px);
}
.push-settings-dialog__backdrop:hover:not(:disabled),
.push-settings-dialog__backdrop:active:not(:disabled) { background: rgba(5,5,8,.3); box-shadow: none; transform: none; }
#push-settings-dialog .push-settings-dialog__panel h3 { margin: 0 32px 10px 0; font-size: 22px; }
#push-settings-dialog .push-settings-dialog__panel > p:first-of-type { margin-bottom: 18px; line-height: 1.6; }
#push-settings-dialog .push-settings-dialog__panel > #push-toggle { min-height: 50px; border-radius: 15px; font-size: 14px; }
#push-settings-dialog .push-settings-dialog__panel > .push-settings-dialog__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  min-height: 38px;
  padding: 0;
  margin: 0;
  color: #e7e4e8;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 50%;
  background: #2b2a2e;
  font-size: 23px;
}
#push-settings-dialog .push-settings-dialog__panel > .push-settings-dialog__later {
  width: 100%;
  margin-top: 8px;
  color: #c6bdc4 !important;
  border-color: transparent !important;
  background: transparent !important;
}
body.push-settings-open { overflow: hidden; }

@media (min-width: 721px) {
  #profile-section {
    display: flex;
    grid-column: 2 / 4;
    grid-row: 1;
    width: auto;
    max-width: none;
    min-height: 100%;
    flex-direction: column;
    align-items: center;
    padding: clamp(28px, 5vh, 56px) clamp(20px, 4vw, 56px);
    overflow-y: auto;
  }
  #profile-section > h2 { width: min(100%, 600px); text-align: center; }
  #profile-form { width: min(100%, 600px); padding: clamp(22px, 4vw, 38px); }
  #chat-view { position: relative; border: 1px solid rgba(255,255,255,.08); }
}
#chats-section {
  background-color: #17171a;
  background-image:
    radial-gradient(ellipse at 12% 8%, rgba(128,74,108,.14), transparent 34%),
    radial-gradient(ellipse at 90% 92%, rgba(72,70,119,.11), transparent 40%);
}
@media (max-width: 720px) {
  #app > nav #menu-toggle .menu-close-icon { display: none !important; }
  .chat-settings-link { min-height: 34px; }
  .chat-background-settings { padding-inline: 0; }
  #profile-section { align-items: stretch; padding-bottom: 90px; }
  #profile-form { padding: 18px; }
  #messages .message-item { max-width: 94%; }
  #push-settings-dialog > .push-settings-dialog__panel { border-radius: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .push-settings-dialog,
  #push-settings-dialog > .push-settings-dialog__panel { transition-duration: .01ms; }
}

.reels-search > span svg {
  display: block;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.reels-search input {
  height: 38px;
  line-height: 38px;
}

.reels-comments__header button,
.reel-publish-dialog__heading button,
.community-dialog__close,
.push-settings-dialog__close,
#friend-add-close,
#create-group-close {
  display: inline-grid;
  place-items: center;
  line-height: 0;
}

.reels-comments__header button svg,
.reel-publish-dialog__heading button svg,
.community-dialog__close svg,
.push-settings-dialog__close svg,
#friend-add-close svg,
#create-group-close svg {
  display: block;
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 720px) {
  .reels-search input {
    height: 34px;
    line-height: 34px;
  }
}

html,
body {
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

main {
  width: 100%;
  height: 100dvh;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

#app {
  height: 100%;
  min-height: 0;
  overscroll-behavior: none;
}

.page-section {
  min-height: 0;
  max-height: 100%;
  overscroll-behavior: contain;
}

#auth-section {
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

@media (min-width: 721px) {
  main {
    max-width: none;
    padding: 24px 18px 18px;
  }

  #app {
    height: 100%;
  }

  .page-section {
    height: 100%;
    overflow-y: auto;
  }
}

@media (max-width: 720px) {
  main {
    padding: 0;
  }

  #app {
    width: 100%;
    height: 100%;
    min-height: 0;
  }

  .page-section {
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }
}

@media (max-width: 720px) {
  .reel-publish-dialog {
    padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  }
  .reel-publish-dialog__panel {
    width: 100%;
    max-height: 100%;
    border-radius: 18px;
  }
  .reel-publish-dialog__heading { padding: 14px 16px; }
  .reel-publish-dialog__heading h2 { font-size: 18px; }
  .reel-publish-dialog__body {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    padding: 14px 16px;
  }
  .reel-publish-dialog__details {
    padding: 18px 0 0;
    border-top: 1px solid rgba(255,255,255,.08);
    border-left: 0;
  }
  .reel-publish-files { min-height: 190px; }
  .reel-publish-dialog__footer {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 10px 16px max(12px, env(safe-area-inset-bottom));
    background: #1b1a1d;
  }
  .reel-publish-dialog__footer > span { max-width: 150px; font-size: 10px; }
  #reel-publish-submit { min-width: 138px; }
}

@media (max-width: 380px) {
  #app > nav #reel-publish-open > span { font-size: 6px; }
  .reel-publish-dialog__footer { grid-template-columns: 1fr; }
  .reel-publish-dialog__footer > span { max-width: none; }
  #reel-publish-submit { width: 100%; }
}

.reel-more-button { position: absolute; z-index: 6; top: 12px; left: 12px; display: grid; width: 42px; height: 42px; min-height: 42px; place-items: center; padding: 0 0 8px; border: 1px solid rgba(255,255,255,.2); border-radius: 50%; color: #fff; font-size: 27px; line-height: 1; background: rgba(22,21,24,.76); box-shadow: 0 4px 16px #0005; backdrop-filter: blur(10px); transition: transform .16s, background .16s, border-color .16s; }
.reel-more-button:hover { transform: scale(1.06); border-color: rgba(239,163,173,.55); background: rgba(63,43,52,.92); }
.reel-more-menu { position: absolute; z-index: 7; top: 60px; left: 12px; display: grid; min-width: 190px; gap: 4px; padding: 7px; border: 1px solid rgba(255,255,255,.12); border-radius: 15px; background: rgba(31,29,34,.96); box-shadow: 0 14px 36px #0008; backdrop-filter: blur(14px); animation: reel-menu-in .16s ease both; }
.reel-more-menu[hidden] { display: none !important; }
.reel-more-menu button { display: flex; min-height: 42px; align-items: center; gap: 10px; padding: 0 11px; border: 0; border-radius: 10px; color: #f3edf1; font-size: 13px; text-align: left; background: transparent; }
.reel-more-menu button:hover { background: rgba(255,255,255,.08); }
.reel-more-menu button[data-reel-menu-action="delete"] { color: #ff9eac; }
.reel-more-menu button[data-reel-menu-action="delete"]:hover { background: rgba(194,64,84,.18); }
.reel-more-menu svg { width: 19px; height: 19px; flex: 0 0 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@keyframes reel-menu-in { from { opacity: 0; transform: translateY(-5px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.reel-card.is-removing { pointer-events: none; opacity: 0; filter: blur(3px); transform: scale(.96); transition: opacity .22s ease, transform .22s ease, filter .22s ease; }
.reel-toast { position: fixed; z-index: 180; right: max(18px, env(safe-area-inset-right)); bottom: max(20px, env(safe-area-inset-bottom)); max-width: min(420px, calc(100vw - 36px)); padding: 13px 18px; border: 1px solid rgba(124,211,154,.28); border-radius: 14px; color: #e9fff0; background: linear-gradient(145deg, rgba(34,77,57,.96), rgba(25,44,35,.96)); box-shadow: 0 12px 34px #0008; opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.reel-toast.is-visible { opacity: 1; transform: translateY(0); }
.reel-toast.is-error { border-color: rgba(255,154,171,.36); color: #ffe7eb; background: linear-gradient(145deg, rgba(92,39,51,.97), rgba(45,28,34,.97)); }
.reel-delete-dialog { position: fixed; z-index: 190; inset: 0; display: grid; place-items: center; padding: 18px; visibility: hidden; opacity: 0; transition: opacity .2s ease, visibility .2s ease; }
.reel-delete-dialog.is-open { visibility: visible; opacity: 1; }
.reel-delete-dialog__backdrop { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 0; background: rgba(0,0,0,.74); backdrop-filter: blur(9px); }
.reel-delete-dialog__panel { position: relative; display: grid; width: min(420px, 100%); gap: 12px; padding: 28px; border: 1px solid rgba(255,255,255,.1); border-radius: 24px; color: #f5eff2; background: radial-gradient(circle at 50% 0, rgba(157,76,96,.18), transparent 55%), linear-gradient(155deg,#29262b,#171719 72%); box-shadow: 0 28px 90px #0009; text-align: center; transform: translateY(14px) scale(.97); transition: transform .22s cubic-bezier(.2,.8,.2,1); }
.reel-delete-dialog.is-open .reel-delete-dialog__panel { transform: translateY(0) scale(1); }
.reel-delete-dialog__icon { display: grid; width: 58px; height: 58px; place-items: center; margin: 0 auto; border: 1px solid rgba(255,145,161,.24); border-radius: 19px; color: #ff9eac; background: rgba(194,64,84,.13); }
.reel-delete-dialog__icon svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.reel-delete-dialog__panel h2 { margin: 0; font-size: 21px; }
.reel-delete-dialog__panel p { margin: 0; color: #bdb5bc; font-size: 13px; line-height: 1.5; }
.reel-delete-dialog__panel .reel-delete-dialog__title { color: #f0b4be; font-weight: 650; overflow-wrap: anywhere; }
.reel-delete-dialog__title[hidden] { display: none !important; }
.reel-delete-dialog__actions { display: flex; justify-content: center; gap: 10px; margin-top: 6px; }
.reel-delete-dialog__actions button { display: flex; min-height: 44px; align-items: center; justify-content: center; gap: 8px; padding: 0 15px; border-radius: 12px; }
.reel-delete-dialog__cancel { color: #ddd5db; background: #333036; }
.reel-delete-dialog__confirm { color: #fff; border-color: transparent; background: linear-gradient(145deg,#b84e61,#8f3045); box-shadow: 0 5px 16px rgba(169,66,83,.28); }
.reel-delete-dialog__confirm:hover { background: linear-gradient(145deg,#d05c70,#a83c53); }
.reel-delete-dialog__confirm svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 520px) {
  .reel-delete-dialog { padding: 12px; }
  .reel-delete-dialog__panel { gap: 10px; padding: 22px 17px; border-radius: 20px; }
  .reel-delete-dialog__actions { flex-direction: column-reverse; }
  .reel-delete-dialog__actions button { width: 100%; }
  .reel-toast { right: 10px; bottom: max(12px, env(safe-area-inset-bottom)); left: 10px; max-width: none; text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  .reel-card.is-removing, .reel-more-menu, .reel-delete-dialog, .reel-delete-dialog__panel, .reel-toast { animation: none !important; transition-duration: .01ms !important; }
}
