/* ===== база ===== */
:root {
  --glass: rgba(255, 255, 255, 0.09);
  --line: rgba(255, 255, 255, 0.16);
  --blur: blur(16px) saturate(1.3);
  --barh: calc(60px + var(--tg-safe-area-inset-bottom, 0px));
}
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
.lg,
button {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
html,
body {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  background: #151230;
  color: #fff;
  font-family: -apple-system, system-ui, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
}
input,
button {
  font: inherit;
  color: #fff;
  border: 0;
  outline: 0;
}
button {
  cursor: pointer;
}
input {
  font-size: 16px;
  background: #1e2040;
  border: 1px solid #2e3160;
  border-radius: 999px;
  padding: 0 18px;
  height: 48px;
}
input:focus {
  border-color: #3390ec;
}
/* свой курсор: рисуется скриптом (раздел «свой курсор»), системный скрыт */
input:not([type="file"]) {
  caret-color: transparent;
}
.ccar {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 3;
  width: 2px;
  pointer-events: none;
  opacity: 0;
  will-change: transform, opacity;
}
.ccar.on {
  opacity: 1;
}
.ccar i {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  border-radius: 1px;
  opacity: 0;
  will-change: opacity;
}

/* ===== фон ===== */
#bgL {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    linear-gradient(to bottom, #0d0e1c 0%, #12132a 50%, #151230 100%) top/100% var(--bg-h, 900px) no-repeat,
    #141230;
}
#bgL i {
  --s: calc(var(--bgs, 500px) * 1.45);
  position: absolute;
  display: block;
  width: var(--s);
  height: var(--s);
  will-change: transform;
}
#bgL i:nth-child(1) {
  left: calc(var(--bgw, 400px) * 0.34 - var(--s) / 2);
  top: calc(var(--bg-h, 900px) * 0.11 - var(--s) / 2);
  background: radial-gradient(
    closest-side,
    rgba(175, 35, 95, 0.5),
    rgba(175, 35, 95, 0.4) 18%,
    rgba(175, 35, 95, 0.25) 38%,
    rgba(175, 35, 95, 0.12) 58%,
    rgba(175, 35, 95, 0.035) 80%,
    rgba(175, 35, 95, 0) 100%
  );
  animation: bgP 26s ease-in-out infinite alternate;
}
#bgL i:nth-child(2) {
  left: calc(var(--bgw, 400px) * 0.82 - var(--s) / 2);
  top: calc(var(--bg-h, 900px) * 0.3 - var(--s) / 2);
  background: radial-gradient(
    closest-side,
    rgba(80, 45, 150, 0.36),
    rgba(80, 45, 150, 0.288) 18%,
    rgba(80, 45, 150, 0.18) 38%,
    rgba(80, 45, 150, 0.086) 58%,
    rgba(80, 45, 150, 0.025) 80%,
    rgba(80, 45, 150, 0) 100%
  );
  animation: bgB 38s ease-in-out infinite alternate;
}
#bgL i:nth-child(3) {
  left: calc(var(--bgw, 400px) * 0.18 - var(--s) / 2);
  top: calc(var(--bg-h, 900px) * 0.5 - var(--s) / 2);
  background: radial-gradient(
    closest-side,
    rgba(30, 60, 150, 0.38),
    rgba(30, 60, 150, 0.304) 18%,
    rgba(30, 60, 150, 0.19) 38%,
    rgba(30, 60, 150, 0.091) 58%,
    rgba(30, 60, 150, 0.027) 80%,
    rgba(30, 60, 150, 0) 100%
  );
  animation: bgC 34s ease-in-out infinite alternate;
}
#bgL i:nth-child(4) {
  left: calc(var(--bgw, 400px) * 0.8 - var(--s) / 2);
  top: calc(var(--bg-h, 900px) * 0.72 - var(--s) / 2);
  background: radial-gradient(
    closest-side,
    rgba(40, 55, 140, 0.34),
    rgba(40, 55, 140, 0.272) 18%,
    rgba(40, 55, 140, 0.17) 38%,
    rgba(40, 55, 140, 0.082) 58%,
    rgba(40, 55, 140, 0.024) 80%,
    rgba(40, 55, 140, 0) 100%
  );
  animation: bgD 42s ease-in-out infinite alternate;
}
@keyframes bgP {
  from {
    transform: translate3d(calc(var(--bgw, 400px) * -0.22), calc(var(--bg-h, 900px) * -0.03), 0) scale(1);
  }
  to {
    transform: translate3d(calc(var(--bgw, 400px) * 0.4), calc(var(--bg-h, 900px) * 0.05), 0) scale(1.08);
  }
}
@keyframes bgB {
  from {
    transform: translate3d(calc(var(--bgw, 400px) * 0.25), calc(var(--bg-h, 900px) * -0.1), 0) scale(1.1);
  }
  to {
    transform: translate3d(calc(var(--bgw, 400px) * -0.4), calc(var(--bg-h, 900px) * 0.1), 0) scale(0.95);
  }
}
@keyframes bgC {
  from {
    transform: translate3d(calc(var(--bgw, 400px) * -0.2), calc(var(--bg-h, 900px) * 0.1), 0) scale(1);
  }
  to {
    transform: translate3d(calc(var(--bgw, 400px) * 0.4), calc(var(--bg-h, 900px) * -0.12), 0) scale(1.15);
  }
}
@keyframes bgD {
  from {
    transform: translate3d(calc(var(--bgw, 400px) * 0.2), calc(var(--bg-h, 900px) * 0.08), 0) scale(1.1);
  }
  to {
    transform: translate3d(calc(var(--bgw, 400px) * -0.4), calc(var(--bg-h, 900px) * -0.14), 0) scale(1);
  }
}
body.inRoom #bgL i,
body.inRoom header span {
  animation-play-state: paused !important;
}

/* ===== каркас и шапка ===== */
#app {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: var(--h, 100dvh);
  padding-top: var(--tg-safe-area-inset-top, 0px);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
header {
  height: max(var(--tg-content-safe-area-inset-top, 0px), 44px);
  padding-left: 10px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
}
.lg {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
header span {
  background: linear-gradient(120deg, #3390ec, #9b6bff, #3390ec);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: logoShine 3s linear infinite;
}
@keyframes logoShine {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 200% 50%;
  }
}
.pc {
  display: inline-block;
  width: 26px;
  height: 26px;
  margin-left: 1px;
  font-style: normal;
  font-size: 20px;
  line-height: 26px;
  text-align: center;
}
.pc svg,
.pc video,
.pc img {
  width: 100%;
  height: 100%;
  display: block;
}

/* ===== стартовый экран ===== */
#landing {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 4px 16px 6px;
}
#link,
#go {
  width: 100%;
  max-width: 420px;
}
#link {
  background: var(--glass);
  border-color: var(--line);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}
#link:focus {
  border-color: rgba(51, 144, 236, 0.8);
}
#go {
  position: relative;
  overflow: hidden;
  height: 48px;
  border-radius: 999px;
  background: #3390ec;
  font-weight: 600;
  font-size: 15px;
}
#go:disabled {
  background: var(--glass);
  color: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  cursor: default;
}
#go.busy:disabled {
  background: #3390ec;
  color: #fff;
  border-color: transparent;
}
#go.busy::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.28) 50%, transparent 70%);
  transform: translateX(-100%);
  animation: goSweep 1.1s linear infinite;
}
@keyframes goSweep {
  to {
    transform: translateX(100%);
  }
}
.gd i {
  font-style: normal;
  opacity: 0.2;
  animation: gdp 1.2s infinite ease-in-out;
}
.gd i:nth-child(2) {
  animation-delay: 0.2s;
}
.gd i:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes gdp {
  0%,
  60%,
  100% {
    opacity: 0.2;
  }
  30% {
    opacity: 1;
  }
}
#hint {
  max-width: 420px;
  text-align: center;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.72);
}
#landing:not(.sm) #go {
  animation: sbIn 0.42s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}
#landing:not(.sm) #hint {
  animation: sysIn 0.35s 0.08s ease backwards;
}
#landing.sm #go,
#landing.sm #hint {
  display: none;
}
#join {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: #12132a;
  text-align: center;
  padding: 24px;
}
#joinBtn {
  width: 260px;
  height: 52px;
  border-radius: 999px;
  background: #3390ec;
  font-size: 16px;
  font-weight: 600;
}

/* ===== комната ===== */
#room {
  display: none;
  position: relative;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}
#pw {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  flex-shrink: 0;
}
#player,
#player iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.welcome {
  align-self: center;
  max-width: min(300px, 86%);
  margin: 8px 0;
  text-align: center;
  font-size: 13px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.78);
  text-wrap: balance;
  animation: sysIn 0.3s ease backwards;
}
.welcome b {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
  color: #fff;
}
.welcome .enjoy {
  display: block;
  margin-top: 8px;
  font-size: 15px;
  font-weight: 700;
  background: linear-gradient(120deg, #3390ec, #9b6bff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

/* ===== чат ===== */
#chatWrap {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
#chat {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-x: none;
  padding: 10px 12px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overscroll-behavior: contain;
}
#chat::after {
  content: "";
  flex: 0 0 calc(var(--barh) - 3px + var(--ph, 0px));
}
.sys {
  align-self: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
}
.sys:not(.typingSys) {
  animation: sysIn 0.3s ease backwards;
}
@keyframes sysIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
#sdb {
  position: absolute;
  right: 12px;
  bottom: calc(var(--barh) + 8px + var(--ph, 0px));
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.09);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  backdrop-filter: blur(16px) saturate(1.3);
  border: 1px solid rgba(255, 255, 255, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition:
    opacity 0.2s,
    transform 0.2s;
  padding: 0;
}
#sdb.vis {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
#sdb svg {
  width: 22px;
  height: 22px;
}
.msgRow {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  touch-action: pan-y;
  margin-bottom: 3px;
}
.msgRow.own {
  justify-content: flex-end;
}
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}
.msgCol {
  display: flex;
  flex-direction: column;
  max-width: 75%;
}
.msgRow.own .msgCol {
  align-items: flex-end;
}
.msg {
  width: fit-content;
  max-width: 100%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 16px;
  word-break: break-word;
  background: #1c1c1e;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.msgRow.other .msg {
  border-bottom-left-radius: 4px;
  --pb: #2c2c2e;
}
.msgRow.own .msg {
  background: #3390ec;
  border-bottom-right-radius: 4px;
  --pb: #5aa9f0;
}
.msg b {
  display: block;
  font-size: 12px;
  margin-bottom: 2px;
}
.msg .txt {
  display: block;
}
.crown {
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-right: 4px;
  vertical-align: -2px;
  color: #fff;
}
.crown svg {
  width: 100%;
  height: 100%;
  display: block;
}
@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.msgRow.msgIn .msgCol,
.msgRow.msgIn .avatar {
  animation: msgIn 0.34s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
.msgRow.msgIn.own .msgCol {
  transform-origin: 100% 100%;
}
.msgRow.msgIn.other .msgCol {
  transform-origin: 0 100%;
}
@keyframes hl {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(51, 144, 236, 0);
  }
  30% {
    transform: scale(1.05);
    box-shadow: 0 0 0 6px rgba(51, 144, 236, 0.25);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(51, 144, 236, 0);
  }
}
.msg.hl {
  animation: hl 0.9s ease;
}
.replyQuote {
  border-left: 2px solid rgba(255, 255, 255, 0.35);
  padding: 2px 0 2px 8px;
  margin: 2px 0 6px;
  cursor: pointer;
}
.rqS {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.85;
}
.rqT {
  font-size: 12px;
  opacity: 0.65;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}
.typingDots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.typingDots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8e8e93;
  opacity: 0.3;
  animation: tp 1.2s infinite ease-in-out;
  display: inline-block;
}
.typingDots span:nth-child(2) {
  animation-delay: 0.2s;
}
.typingDots span:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes tp {
  0%,
  60%,
  100% {
    opacity: 0.3;
    transform: none;
  }
  30% {
    opacity: 1;
    transform: translateY(-3px);
  }
}
.typingBubble {
  display: flex;
  align-items: center;
  padding: 10px 14px !important;
}
.typingSys {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.msg.squish {
  animation: rxSquish 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: center bottom;
}

/* фото и видео в чате */
.mediaBox {
  width: min(260px, 62vw);
  min-height: 120px;
  margin: 0;
}
.mediaBox img,
.mediaBox video {
  display: block;
  width: 100%;
  height: auto;
  max-height: 340px;
  object-fit: cover;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
}
.msg.mm {
  padding: 4px;
}
.msg.mm.bare {
  background: none !important;
  padding: 0;
}
.msg.mm .cap {
  padding: 6px 9px 3px;
  font-size: 16px;
  word-break: break-word;
}

.rxBox {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  margin-top: 5px;
}
.rxBox:empty {
  display: none;
}
.rxPill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 8px 0 7px;
  border-radius: 999px;
  background: var(--pb, #2c2c2e);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.rxPill.pop {
  animation: rxPop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.rxPill.mine {
  --pb: #3390ec;
}
.msgRow.own .rxPill.mine {
  --pb: #2672c4;
}
.rxE {
  font-size: 15px;
}
.rxN {
  font-size: 13px;
  font-weight: 600;
}
.rxAv {
  display: inline-flex;
  align-items: center;
}
.rxAv .avatar {
  width: 18px;
  height: 18px;
  font-size: 9px;
  box-shadow: 0 0 0 1.5px var(--pb, #2c2c2e);
}
.rxAv .avatar + .avatar {
  margin-left: -6px;
}
.rxPicker {
  position: fixed;
  z-index: 150;
  display: flex;
  gap: 2px;
  padding: 6px 8px;
  border-radius: 999px;
  background: rgba(28, 28, 30, 0.97);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
  animation: rxPickIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.rxPicker.out {
  animation: rxPickOut 0.16s ease forwards;
  pointer-events: none;
}
.rxPicker button {
  background: none;
  font-size: 25px;
  line-height: 1;
  padding: 4px;
  animation: rxBtnIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}
@keyframes rxPop {
  0% {
    transform: scale(0.4);
    opacity: 0;
  }
  60% {
    transform: scale(1.15);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}
@keyframes rxSquish {
  0% {
    transform: scale(1);
  }
  35% {
    transform: scale(1.06, 0.86);
  }
  65% {
    transform: scale(0.97, 1.04);
  }
  100% {
    transform: scale(1);
  }
}
@keyframes rxPickIn {
  0% {
    transform: scale(0.4);
    opacity: 0;
  }
  60% {
    transform: scale(1.08);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}
@keyframes rxPickOut {
  to {
    transform: scale(0.85);
    opacity: 0;
  }
}
@keyframes rxBtnIn {
  0% {
    transform: scale(0) translateY(6px);
    opacity: 0;
  }
  100% {
    transform: none;
    opacity: 1;
  }
}

/* ===== строка ввода ===== */
#bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 10px calc(8px + var(--tg-safe-area-inset-bottom, 0px));
  pointer-events: none;
}
#bar > * {
  pointer-events: auto;
}
#bar button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  padding: 0;
  flex-shrink: 0;
  box-shadow: none !important;
  transition: none !important;
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
}
#bar #inv {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}
#bar #send {
  background: rgba(51, 144, 236, 0.9);
  border-color: rgba(255, 255, 255, 0.2);
}
#bar #send.idle {
  background: var(--glass);
  color: rgba(255, 255, 255, 0.5);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}
#txtw {
  position: relative;
  z-index: 0;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid transparent;
  border-radius: 22px;
}
#txtw::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: -1px;
  right: -1px;
  bottom: -1px;
  top: calc(-1px - var(--ph, 0px));
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  pointer-events: none;
}
#txtw:focus-within::before {
  border-color: rgba(51, 144, 236, 0.8);
}
#txt {
  flex: 0 0 auto;
  width: 100%;
  height: 42px;
  padding-left: 44px;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
#clip {
  position: absolute;
  z-index: 2;
  left: 3px;
  bottom: 3px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.72);
  cursor: pointer;
}
#clip:active {
  color: #fff;
}
#clip svg {
  pointer-events: none;
}
#fi {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  font-size: 0;
  pointer-events: none;
}
#plates {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  display: flex;
  flex-direction: column;
}
#replyBar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px 6px 14px;
}
#replyBar > div {
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;
  border-left: 2px solid #3390ec;
  padding-left: 8px;
}
#replyBar b {
  font-size: 12px;
  color: #3390ec;
}
#replyBar span {
  font-size: 13px;
  color: #c7c7cc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}
#attach {
  position: relative;
  overflow: hidden;
  display: none;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 6px 10px;
}
#attach .th {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.08);
}
#attach .th img,
#attach .th video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
#attach .inf {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}
#attach .inf b {
  font-size: 15px;
  line-height: 1.2;
  color: #fff;
}
#attach .inf span {
  font-size: 12px;
  color: #c7c7cc;
}
#attach .inf span:empty {
  display: none;
}
#attach .pb {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  transition: opacity 0.3s;
}
#attach .pb div {
  height: 100%;
  width: 0;
  background: #3390ec;
  transition: width 0.2s;
}
#bar #rbx,
#bar #atx {
  width: 28px;
  height: 28px;
  margin-right: -6px;
  border: 0;
  border-radius: 0;
  background: none;
  color: #8e8e93;
  font-size: 18px;
  line-height: 1;
  padding: 0;
}

/* ===== меню комнаты: матовое стекло, как остальной интерфейс ===== */
#epbar {
  display: none;
  position: absolute;
  top: 8px;
  left: 10px;
  right: 10px;
  z-index: 61;
  height: 38px;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  transition: height 0.3s cubic-bezier(0.3, 0.9, 0.3, 1);
  animation: tbBar 0.3s cubic-bezier(0.3, 1.4, 0.5, 1) backwards;
}
#epbar.two {
  height: 84px;
  flex-wrap: wrap;
  align-content: flex-start;
}
#epbar.two.mg {
  height: 38px;
}
#epbar.closing {
  animation: tbBarOut 0.18s ease forwards;
}
@keyframes tbBar {
  from {
    transform: translateY(-14px);
  }
  to {
    transform: none;
  }
}
@keyframes tbBarOut {
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}
#epbar button {
  display: none;
  flex: 1;
  min-width: 0;
  height: 38px;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}
#epbar button:not(#epclose) {
  transition: opacity 0.3s ease 0.08s;
}
#epbar button:active {
  background: rgba(255, 255, 255, 0.18);
}
#epbar button svg {
  flex-shrink: 0;
}
#epbar button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
#epbar #epb1 {
  flex: 0 0 auto;
  padding: 0 12px 0 10px;
  gap: 6px;
}
#epbar #epb1 span {
  overflow: visible;
  text-overflow: clip;
}
#epbar #epb2 {
  flex: 1 1 0;
  padding: 0 12px 0 10px;
  gap: 6px;
}
#epbar #epb3 {
  flex: 0 0 auto;
  width: 38px;
  padding: 0;
  justify-content: center;
  gap: 0;
  order: 2;
}
#epbar #epb4 {
  order: 1;
}
#epbar.two #epb3 {
  order: 1;
}
#epbar.two #epb4 {
  order: 2;
  flex: 1 1 100%;
}
#epbar #epb3.on {
  background: rgba(52, 199, 89, 0.26);
  border-color: rgba(52, 199, 89, 0.55);
}
#epbar #epb3.off {
  background: rgba(255, 59, 48, 0.26);
  border-color: rgba(255, 59, 48, 0.55);
}
#epbar.mg button:not(#epclose) {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s;
}
#epbar #epclose {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: auto;
  height: auto;
  flex: none;
  padding: 0;
  justify-content: center;
  border-radius: 19px;
  background: rgba(51, 144, 236, 0.6);
  border-color: rgba(130, 190, 255, 0.75);
  will-change: clip-path;
}
#epbar.two #epclose {
  bottom: auto;
  height: 38px;
}

/* ===== панель «Другое видео», серии, озвучка ===== */
#epsheet {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
}
#eppanel {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 150px;
  max-height: 50vh;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 12px;
  border-radius: 22px;
  background: linear-gradient(rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.1)), rgba(8, 8, 12, 0.38);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(40px) saturate(1.2);
  backdrop-filter: blur(40px) saturate(1.2);
  pointer-events: auto;
  animation: epIn 0.16s ease;
}
@keyframes epIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
#eppanel.big {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#eppanel.big #epgrid {
  flex: 1;
  min-height: 0;
}
#eppanel.big #epgrid.qp {
  overflow: hidden;
}
#epgrid.aud {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}
#epgrid.aud button {
  padding: 12px 14px;
  border-radius: 14px;
  text-align: left;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
#epgrid.aud button.on2 {
  background: rgba(51, 144, 236, 0.45);
  border-color: rgba(130, 190, 255, 0.7);
  font-weight: 700;
}
#epgrid.aud button.on2::after {
  content: "\2713";
  float: right;
  margin-left: 10px;
}
#epgrid.wh {
  display: block;
}
.wheels {
  position: relative;
  display: flex;
  gap: 8px;
  height: 200px;
}
.wcol {
  flex: 1;
  min-width: 0;
}
.wheel {
  height: 200px;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  padding: 80px 0;
  scrollbar-width: none;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 28%, #000 72%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 28%, #000 72%, transparent);
}
.wheel::-webkit-scrollbar {
  display: none;
}
.wi {
  height: 40px;
  line-height: 40px;
  text-align: center;
  font-size: 20px;
  font-weight: 600;
  scroll-snap-align: center;
  cursor: pointer;
  white-space: nowrap;
  will-change: transform, opacity;
}
.wband {
  position: absolute;
  left: 0;
  right: 0;
  top: 80px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.14);
  pointer-events: none;
}
#epgrid .wgo {
  display: block;
  width: 100%;
  height: 44px;
  margin-top: 12px;
  border-radius: 999px;
  background: rgba(51, 144, 236, 0.85);
  border: 1px solid rgba(130, 190, 255, 0.7);
  font-weight: 600;
  font-size: 15px;
}
#epgrid.qp {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#epgrid.qp input {
  width: 100%;
  background: var(--glass);
  border: 1px solid var(--line);
}
#epgrid.qp input:focus {
  border-color: rgba(51, 144, 236, 0.8);
}
#epgrid.qp .lrow,
#epgrid.qp .sbox {
  max-width: none;
}
#epgrid.qp.sm .qrow {
  display: none;
}
#epgrid .qrow {
  display: flex;
  gap: 8px;
}
#epgrid .qb {
  flex: 1 1 0;
  min-width: 0;
  height: 46px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid var(--line);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}
#epgrid.qp .qnow {
  background: rgba(51, 144, 236, 0.85);
  border-color: rgba(130, 190, 255, 0.7);
  font-weight: 700;
}
#epgrid.qp .qadd {
  background: var(--glass);
}
#epgrid .qb:disabled {
  opacity: 0.45;
  cursor: default;
}
#epgrid.qp .qb:active:not(:disabled) {
  background: rgba(255, 255, 255, 0.18);
}
#epgrid .sres {
  margin-right: -10px;
  padding-right: 10px;
}

/* ===== поиск (стартовый экран и панель) ===== */
.lrow {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 420px;
  align-items: center;
  flex-shrink: 0;
}
.lw {
  position: relative;
  flex: 1;
  min-width: 0;
}
.lw input {
  width: 100%;
  max-width: none;
  padding-left: 46px;
}
.lrow #link {
  max-width: none;
}
.lic {
  position: absolute;
  left: 15px;
  top: 13px;
  width: 22px;
  height: 22px;
  display: flex;
  color: rgba(255, 255, 255, 0.72);
  pointer-events: none;
}
.mbtn {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}
.mbtn:active {
  background: rgba(255, 255, 255, 0.18);
}
.mbtn .mi {
  display: flex;
  width: 22px;
  height: 22px;
  color: #fff;
}
.sbox {
  display: none;
  width: 100%;
  max-width: 420px;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  gap: 10px;
}
.sm > .sbox {
  display: flex;
}
.srcs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  flex-shrink: 0;
}
.srcs button {
  height: 40px;
  min-width: 0;
  padding: 0 2px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--glass);
  border: 1px solid var(--line);
  animation: sbIn 0.42s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}
.srcs button.on {
  background: rgba(51, 144, 236, 0.55);
  border-color: rgba(130, 190, 255, 0.75);
}
@keyframes sbIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.85);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.sres {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overscroll-behavior: contain;
  margin-right: -14px;
  padding-right: 14px;
  padding-bottom: calc(8px + var(--tg-safe-area-inset-bottom, 0px));
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
}
.sres::-webkit-scrollbar {
  width: 4px;
}
.sres::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.28);
  border-radius: 4px;
}
.sres.busy {
  pointer-events: none;
}
.snote {
  align-self: center;
  margin-top: 18px;
  max-width: 300px;
  text-align: center;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.72);
}
.sr {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  flex-shrink: 0;
  padding: 8px;
  border-radius: 14px;
  text-align: left;
  font-size: inherit;
  background: var(--glass);
  border: 1px solid rgba(255, 255, 255, 0.12);
  animation: sysIn 0.3s ease backwards;
}
.sr:active {
  background: rgba(255, 255, 255, 0.18);
}
.sr.pick {
  border-color: rgba(51, 144, 236, 0.8);
  background: rgba(51, 144, 236, 0.28);
}
.sth {
  position: relative;
  border-radius: 9px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}
.sr:not(.pst) .sth {
  flex: 0 0 132px;
  width: 132px;
  height: auto;
  aspect-ratio: 16/9;
}
.sr.pst .sth {
  flex: 0 0 64px;
  width: 64px;
  height: 96px;
}
.sth img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.sth b {
  position: absolute;
  right: 3px;
  bottom: 3px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.7);
}
.sti {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 0 2px 2px;
}
.sti span:first-child {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sti span + span {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.65);
}
.sti span:empty {
  display: none;
}
.smeta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.65);
}
.smeta i {
  font-style: normal;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.smeta svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* ===== Android, окно с клавиатурой, широкие экраны ===== */
html.android {
  --barh: calc(var(--abot, 22px) + 62px);
}
html.android #app {
  height: var(--hv, var(--h, 100dvh)) !important;
  transform: none !important;
  margin-top: var(--vvt, 0px);
}
html.android #bar {
  padding-bottom: var(--abot, 22px);
}
html.android.kb {
  --barh: 60px;
}
html.android.kb #bar {
  padding-bottom: 8px !important;
}
html.qin #app {
  height: var(--hfix) !important;
  transform: none !important;
}
html.android.qin #app {
  margin-top: 0 !important;
}
@media (min-width: 800px) {
  #room[style*="flex"] {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 380px;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
  }
  #room[style*="flex"] #pw {
    grid-column: 1;
    grid-row: 1/3;
    aspect-ratio: auto;
    height: 100%;
    align-self: stretch;
  }
  #room[style*="flex"] #chatWrap {
    grid-column: 2;
    grid-row: 2;
    min-height: 0;
  }
  #room[style*="flex"] #bar {
    left: auto;
    width: 380px;
    right: 0;
  }
  #landing {
    padding-top: 40px;
  }
}

/* пока едет клавиатура, отключаем тяжёлые эффекты */
html.kbAnim #bgL i {
  animation-play-state: paused !important;
}

.msgRow.pend .msg {
  opacity: 0.7;
}
.msgRow.pfail .msg {
  opacity: 0.4;
}

.msg.mm .replyQuote {
  margin: 6px 9px 8px 9px;
}
#clip.nudge {
  animation: clipNudge 0.45s ease;
}
@keyframes clipNudge {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.4);
    color: #fff;
  }
  100% {
    transform: scale(1);
  }
}

/* отдача кнопки отправки */
#send.kick {
  animation: sendBtn 0.3s ease;
}
@keyframes sendBtn {
  0% {
    transform: none;
  }
  40% {
    transform: scale(0.9);
  }
  100% {
    transform: none;
  }
}

/* самолётик: оптическое центрирование (сдвиг подбирается переменными --sx, --sy) и вылет при отправке */
#send {
  overflow: hidden;
}
#send svg {
  translate: var(--sx, 2px) var(--sy, 0px);
}
/* подсветка скрепки вместо текстовой подсказки */

/* скрепка просто пульсирует */
#clip.pulse svg {
  animation: clipPulse 0.5s ease-in-out 2;
}
@keyframes clipPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.35);
  }
}

/* подсказка у скрепки: матовое стекло, показывается один раз */
.clipTip {
  position: absolute;
  z-index: 4;
  left: 0;
  bottom: calc(100% + var(--ph, 0px) + 14px);
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: var(--glass);
  background-clip: padding-box;
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
  transform-origin: 21px calc(100% + 8px);
  animation: tipIn 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.clipTip::before {
  content: "";
  position: absolute;
  inset: -1px;
  border: 1px solid var(--line);
  border-radius: 14px;
  pointer-events: none;
  -webkit-mask:
    linear-gradient(#000 0 0),
    linear-gradient(#000 0 0) 14px calc(100% + 2px) / 14px 5px no-repeat;
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#000 0 0),
    linear-gradient(#000 0 0) 14px calc(100% + 2px) / 14px 5px no-repeat;
  mask-composite: exclude;
  -webkit-mask-origin: border-box;
  mask-origin: border-box;
}
.clipTip::after {
  content: "";
  position: absolute;
  left: 14px;
  bottom: -6px;
  width: 12px;
  height: 12px;
  box-sizing: border-box;
  border: solid var(--line);
  border-width: 0 1px 1px 0;
  background: var(--glass);
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
  transform: rotate(45deg);
}
.clipTip.out {
  animation: tipOut 0.2s ease forwards;
}
@keyframes tipIn {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.85);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes tipOut {
  to {
    opacity: 0;
    transform: translateY(4px) scale(0.9);
  }
}

/* ===== десктоп: стартовый экран и поиск ===== */
@media (min-width: 800px) {
  #landing {
    padding: 28px 40px 12px;
  }
  #landing:not(.sm) {
    justify-content: center;
    padding-bottom: 12vh;
  }
  #landing .lrow {
    max-width: 680px;
  }
  #landing #link {
    height: 52px;
    font-size: 17px;
  }
  #landing:not(.sm) #go {
    max-width: 680px;
    height: 52px;
    font-size: 16px;
  }
  #landing .mbtn {
    width: 52px;
    height: 52px;
  }
  #landing .lic {
    top: 15px;
  }
  #landing #hint {
    max-width: 560px;
    font-size: 14px;
    line-height: 1.5;
  }
  #landing .sbox {
    max-width: 1240px;
    gap: 16px;
  }
  #landing .srcs {
    width: 100%;
    max-width: 520px;
    align-self: center;
  }
  #landing .sres {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    grid-auto-rows: min-content;
    align-content: start;
    gap: 18px 16px;
  }
  #landing .sres.pg {
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  }
  #landing .snote {
    grid-column: 1/-1;
    justify-self: center;
  }
  #landing .sr {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px;
  }
  #landing .sr:not(.pst) .sth {
    flex: none;
    width: 100%;
  }
  #landing .sr.pst .sth {
    flex: none;
    width: 100%;
    height: auto;
    aspect-ratio: 2/3;
  }
  #landing .sti {
    padding: 0 2px 4px;
  }
  #landing .sti span:first-child {
    font-size: 15px;
  }
  #landing .smeta {
    font-size: 13px;
  }
}
@media (min-width: 800px) and (hover: hover) {
  #landing .sr:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.22);
  }
  #landing .srcs button:hover:not(.on),
  #landing .mbtn:hover {
    background: rgba(255, 255, 255, 0.16);
  }
}

/* просмотры, лайки и дата: всегда одна строка, чуть мельче; при нехватке места дата обрезается многоточием */
.smeta {
  flex-wrap: nowrap;
  gap: 0 9px;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
}
.smeta i {
  flex: none;
  gap: 3px;
}
.smeta i:last-child {
  flex: 0 1 auto;
  min-width: 0;
}
.smeta i span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.smeta svg {
  width: 12px;
  height: 12px;
}
.smore {
  align-self: center;
  flex-shrink: 0;
  height: 44px;
  margin: 6px 0 10px;
  padding: 0 24px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  font-size: 14px;
  font-weight: 600;
}
.smore:active:not(:disabled) {
  background: rgba(255, 255, 255, 0.18);
}
.smore:disabled {
  opacity: 0.6;
  cursor: default;
}
@media (min-width: 800px) {
  #landing .smeta {
    font-size: 12px;
  }
  #landing .sres {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
  #landing .smore {
    grid-column: 1/-1;
    justify-self: center;
  }
}

/* ===== правки интерфейса ===== */
/* без обводок: остаётся только синяя у поля при вводе */
:root {
  --line: transparent;
}
button {
  border-color: transparent !important;
}
/* кнопки источников: то же стекло и тот же синий, что у остального интерфейса */
.srcs button {
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  animation: sbIn 0.42s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}
.srcs button.on {
  background: rgba(51, 144, 236, 0.85);
}
/* панель в руме почти прозрачная; вложенное размытие выключено, чтобы кнопки не темнели */
#eppanel {
  background: rgba(255, 255, 255, 0.04);
  border-color: transparent;
}
#eppanel .mbtn,
#eppanel .srcs button,
#eppanel .smore,
#eppanel .qb,
#eppanel input {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
/* подсказка у скрепки без контура */
.clipTip {
  border: 0;
}
.clipTip::before {
  display: none;
}
.clipTip::after {
  border: 0;
}
/* чат и кнопка плюс */
.msgRow {
  contain: layout style;
}
#inv.kick {
  animation: sendBtn 0.3s ease;
}

/* нижняя безопасная зона: берём большую из зоны Telegram и системной */
:root {
  --barh: calc(60px + max(var(--tg-safe-area-inset-bottom, 0px), env(safe-area-inset-bottom, 0px)));
}
#bar {
  padding-bottom: calc(8px + max(var(--tg-safe-area-inset-bottom, 0px), env(safe-area-inset-bottom, 0px)));
}

.srcs button {
  animation: none;
}

/* лента поиска */
.sr {
  contain: layout style;
}

/* стекло над чатом: меньший радиус, чтобы не размазывать сообщения и не тормозить прокрутку (число 6 можно менять) */
#bar #inv,
#bar #send.idle,
#txtw::before,
#epbar button,
#sdb {
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

/* выбор реакции: матовое стекло */
.rxPicker {
  background: rgba(255, 255, 255, 0.13);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: none;
}

/* ===== матовость строго внутри кнопок ===== */
#bar::before {
  display: none;
}
#bar #inv,
#bar #send.idle,
#txtw::before,
#epbar button,
#sdb {
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

/* ===== два человека в комнате: аватарку собеседника не показываем ===== */
#chat.duo .msgRow.other > .avatar {
  display: none;
}
#chat.duo .rxAv .avatar:not(.meav) {
  display: none;
}

/* ===== стекло: блюр считается по области шире кнопки, а показывается строго по её форме (clip-path, без швов) (--gh: сколько пикселей снаружи учитывается, --gt: заливка кнопок) ===== */
:root {
  --gh: 12px;
  --gt: rgba(255, 255, 255, 0.09);
}
#inv,
#send {
  --gr: 22px;
}
#sdb {
  --gr: 23px;
}
#txtw {
  --gr: 22px;
}
#epbar button {
  --gr: 19px;
}
#bar #inv,
#bar #send,
#bar #send.idle,
#epbar button:not(#epclose),
#sdb,
#txtw::before {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
#bar #inv,
#bar #send.idle,
#epbar button:not(#epclose),
#sdb {
  isolation: isolate;
  background: transparent;
}
#bar #inv,
#bar #send.idle,
#epbar button:not(#epclose) {
  position: relative;
}
#bar #send.idle {
  overflow: visible;
}
#bar #inv::before,
#bar #send.idle::before,
#epbar button:not(#epclose)::before,
#sdb::before,
#txtw::after {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
  inset: calc(-1px - var(--gh));
  background: var(--gt);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  -webkit-clip-path: inset(var(--gh) round var(--gr));
  clip-path: inset(var(--gh) round var(--gr));
}
#txtw::after {
  z-index: -2;
  background: none;
  left: calc(-1px - var(--gh));
  right: calc(-1px - var(--gh));
  bottom: calc(-1px - var(--gh));
  top: calc(-1px - var(--ph, 0px) - var(--gh));
}
#epbar button:not(#epclose):active::before {
  background: rgba(255, 255, 255, 0.18);
}

/* кнопка «вниз»: без анимации прозрачности (иначе размытие под ней не работает, пока она проявляется), появляется масштабом */
#sdb {
  opacity: 1;
  visibility: hidden;
  transform: translateY(10px) scale(0.6);
  transition:
    transform 0.18s cubic-bezier(0.4, 0, 1, 1),
    visibility 0s 0.18s;
}
#sdb.vis {
  visibility: visible;
  transform: none;
  transition:
    transform 0.26s cubic-bezier(0.34, 1.56, 0.64, 1),
    visibility 0s;
}
.sdbN {
  display: none;
  position: absolute;
  top: -6px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: #3390ec;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  pointer-events: none;
}
.sdbN.on {
  display: block;
  animation: rxPop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* iOS раздувал текст после поворота экрана */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* автовоспроизведение: цвет рисуется поверх размытия, а не под ним */
#epbar #epb3.on,
#epbar #epb3.off {
  background: transparent;
}
#epbar #epb3.on::before {
  background: rgba(52, 199, 89, 0.26);
}
#epbar #epb3.off::before {
  background: rgba(255, 59, 48, 0.26);
}

/* меню: кнопки не проявляются через прозрачность (она отключает размытие), а появляются сразу */
#epbar button:not(#epclose) {
  transition: none;
  opacity: 1;
  visibility: visible;
}
#epbar.mg button:not(#epclose) {
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.16s,
    visibility 0s 0.16s;
}

/* подсказка у скрепки: единая фигура с хвостиком */
.clipTip {
  padding: 9px 14px 15px;
  border-radius: 0;
  bottom: calc(100% + var(--ph, 0px) + 8px);
  transform-origin: 21px calc(100% + 2px);
  -webkit-clip-path: polygon(
    0px 14px,
    0.48px 10.38px,
    1.88px 7px,
    4.1px 4.1px,
    7px 1.88px,
    10.38px 0.48px,
    14px 0px,
    calc(100% - 14px) 0px,
    calc(100% - 10.38px) 0.48px,
    calc(100% - 7px) 1.88px,
    calc(100% - 4.1px) 4.1px,
    calc(100% - 1.88px) 7px,
    calc(100% - 0.48px) 10.38px,
    calc(100% - 0px) 14px,
    calc(100% - 0px) calc(100% - 20px),
    calc(100% - 0.48px) calc(100% - 16.38px),
    calc(100% - 1.88px) calc(100% - 13px),
    calc(100% - 4.1px) calc(100% - 10.1px),
    calc(100% - 7px) calc(100% - 7.88px),
    calc(100% - 10.38px) calc(100% - 6.48px),
    calc(100% - 14px) calc(100% - 6px),
    28px calc(100% - 6px),
    21px 100%,
    14px calc(100% - 6px),
    14px calc(100% - 6px),
    10.38px calc(100% - 6.48px),
    7px calc(100% - 7.88px),
    4.1px calc(100% - 10.1px),
    1.88px calc(100% - 13px),
    0.48px calc(100% - 16.38px),
    0px calc(100% - 20px)
  );
  clip-path: polygon(
    0px 14px,
    0.48px 10.38px,
    1.88px 7px,
    4.1px 4.1px,
    7px 1.88px,
    10.38px 0.48px,
    14px 0px,
    calc(100% - 14px) 0px,
    calc(100% - 10.38px) 0.48px,
    calc(100% - 7px) 1.88px,
    calc(100% - 4.1px) 4.1px,
    calc(100% - 1.88px) 7px,
    calc(100% - 0.48px) 10.38px,
    calc(100% - 0px) 14px,
    calc(100% - 0px) calc(100% - 20px),
    calc(100% - 0.48px) calc(100% - 16.38px),
    calc(100% - 1.88px) calc(100% - 13px),
    calc(100% - 4.1px) calc(100% - 10.1px),
    calc(100% - 7px) calc(100% - 7.88px),
    calc(100% - 10.38px) calc(100% - 6.48px),
    calc(100% - 14px) calc(100% - 6px),
    28px calc(100% - 6px),
    21px 100%,
    14px calc(100% - 6px),
    14px calc(100% - 6px),
    10.38px calc(100% - 6.48px),
    7px calc(100% - 7.88px),
    4.1px calc(100% - 10.1px),
    1.88px calc(100% - 13px),
    0.48px calc(100% - 16.38px),
    0px calc(100% - 20px)
  );
}
.clipTip::before,
.clipTip::after {
  display: none;
}

.avatar.lnk {
  cursor: pointer;
}
/* ===== иконки в кнопках источников поиска ===== */
.srcs button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.srcs button svg {
  width: 18px;
  height: 18px;
  flex: none;
  fill: currentColor;
}
.srcs button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.srcs button[data-s="yt"] svg {
  width: 22px;
  height: 22px;
}
.srcs button[data-s="cl"] svg {
  width: 16px;
  height: 16px;
}
