/* chat media: pictures, GIFs, players, viewer */
.xatts { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-top: 6px; max-width: 100%; }
.xib {
  display: inline-grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 8px; border: 0;
  background: transparent; color: var(--ink-3); cursor: pointer; transition: background .15s, color .15s;
}
.xib:hover { background: var(--panel-3); color: var(--ink); }
.xib svg { width: 17px; height: 17px; }
.xib--light { color: #fff; }
.xib--light:hover { background: rgba(255, 255, 255, .16); color: #fff; }

.xpic { position: relative; max-width: 100%; border-radius: var(--r); overflow: hidden; cursor: zoom-in; background: var(--panel-2); }
.xpic:not([style]) { width: 280px; aspect-ratio: 3 / 2; }
.xpic img { display: block; width: 100%; height: 100%; object-fit: cover; }
.xpic.is-broken img { visibility: hidden; }
.xalbum { position: relative; width: min(400px, 100%); border-radius: var(--r); overflow: hidden; }
.xalbum__tile { position: absolute; padding: 0; border: 0; background: var(--panel-2); cursor: zoom-in; overflow: hidden; }
.xalbum__tile img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.xalbum__tile:hover img { transform: scale(1.03); }

.xgif { position: relative; display: block; max-width: 100%; border-radius: var(--r); overflow: hidden; background: var(--panel-2); cursor: zoom-in; padding: 0; border: 0; }
.xgif:not([style]):not(.xgif--pick) { width: 240px; aspect-ratio: 16 / 10; }
.xgif img { display: block; width: 100%; height: 100%; object-fit: cover; }
.xgif__tag { position: absolute; left: 8px; top: 8px; font-size: 10px; font-weight: 800; padding: 2px 5px; border-radius: 4px; background: rgba(0, 0, 0, .6); color: #fff; letter-spacing: .5px; pointer-events: none; }

.xfile {
  position: relative; display: flex; align-items: center; gap: 10px; width: min(340px, 100%); padding: 10px 12px; overflow: hidden;
  border-radius: var(--r-md); background: var(--panel-2); border: 1px solid var(--line-2);
}
.xfile__icon { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent); }
.xfile__info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.xfile__info b { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xfile__info span { font-size: 11.5px; color: var(--ink-4); }
.xfile.is-expired { opacity: .7; }
.xfile.is-expired .xfile__icon { background: var(--panel-3); color: var(--ink-4); }

.xup { position: absolute; inset: 0; pointer-events: none; }
.xup__label { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, .45); color: #fff; font-size: 12px; font-weight: 600; }
.xfile .xup__label, .xa .xup__label { display: none; }
.xup__bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(0, 0, 0, .35); }
.xup__bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.xup.is-failed .xup__bar i { background: var(--bad); width: 100% !important; }
.xup.is-failed .xup__label { background: rgba(120, 20, 20, .55); }

/* video */
.xv-slot { max-width: 100%; }
.xv {
  position: relative; max-width: 100%; border-radius: var(--r-md); overflow: hidden; background: #000; color: #fff;
  user-select: none; outline: none; container-type: inline-size;
}
.xv:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.xv video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.xv__big {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 64px; height: 64px; border-radius: 50%; border: 0;
  background: rgba(0, 0, 0, .55); color: #fff; cursor: pointer; display: grid; place-items: center; backdrop-filter: blur(6px); transition: transform .15s, background .15s;
}
.xv__big:hover { transform: translate(-50%, -50%) scale(1.08); background: var(--accent); }
.xv__big svg { width: 26px; height: 26px; margin-left: 3px; }
.xv.is-playing .xv__big { display: none; }
.xv__top {
  position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 8px; padding: 8px 8px 24px 12px;
  background: linear-gradient(rgba(0, 0, 0, .65), transparent); font-size: 12.5px; transition: opacity .2s;
}
.xv__top b { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xv__top span { opacity: .75; flex: none; }
.xv__bar { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 8px 6px; background: linear-gradient(transparent, rgba(0, 0, 0, .75)); transition: opacity .2s; }
.xv:not(.is-started) .xv__bar { opacity: 0; pointer-events: none; }
.xv.is-playing:not(:hover):not(:focus-within) .xv__bar, .xv.is-playing:not(:hover):not(:focus-within) .xv__top { opacity: 0; }
.xv.is-broken::after { content: "This video can't be played here. Download it instead."; position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; text-align: center; font-size: 13px; background: rgba(0, 0, 0, .7); pointer-events: none; }
.xseek { position: relative; height: 14px; cursor: pointer; display: flex; align-items: center; touch-action: none; }
.xseek i, .xseek u, .xseek s { position: absolute; left: 0; height: 4px; border-radius: 2px; transition: height .1s; }
.xseek i { right: 0; background: rgba(255, 255, 255, .25); }
.xseek u { background: rgba(255, 255, 255, .35); }
.xseek s { background: var(--accent); }
.xseek s::after { content: ""; position: absolute; right: -6px; top: 50%; width: 12px; height: 12px; margin-top: -6px; border-radius: 50%; background: #fff; transform: scale(0); transition: transform .12s; }
.xseek:hover s::after { transform: scale(1); }
.xseek:hover i, .xseek:hover s, .xseek:hover u { height: 6px; }
.xv__row { display: flex; align-items: center; gap: 2px; margin-top: 2px; font-size: 12px; min-width: 0; }
.xv__row > * { flex: none; }
.xv__time { font-variant-numeric: tabular-nums; margin: 0 6px; white-space: nowrap; }
.xv__sp { flex: 1 1 0; min-width: 0; }
@container (max-width: 380px) { .xv__vol, .xv .xrate { display: none; } }
@container (max-width: 300px) { .xv__time { margin: 0 2px; font-size: 11px; } }
@container (max-width: 260px) { .xv__pip { display: none; } }
@container (max-width: 210px) { .xv__time { display: none; } }
.xv__vol { width: 70px; accent-color: #fff; }
.xrate {
  height: 24px; padding: 0 7px; border-radius: 6px; border: 1px solid var(--line-3); background: none; color: var(--ink-3);
  font-size: 11px; font-weight: 700; cursor: pointer; flex: none; font-variant-numeric: tabular-nums;
}
.xrate:hover { color: var(--ink); border-color: var(--ink-4); }
.xrate--light { border-color: rgba(255, 255, 255, .35); color: #fff; }
.xrate--light:hover { color: #fff; border-color: #fff; }
.xfull { position: fixed; left: 0; top: 0; width: 0; height: 0; overflow: visible; }
.xv:fullscreen { width: 100% !important; height: 100%; aspect-ratio: auto !important; border-radius: 0; }
.xpark { position: fixed; left: -9999px; top: 0; width: 1px; height: 1px; overflow: hidden; }
@media (max-width: 560px) { .xv__vol { display: none; } }

/* audio */
.xa {
  position: relative; width: min(420px, 100%); border-radius: var(--r-lg); background: var(--panel-2); border: 1px solid var(--line-2);
  padding: 12px; display: grid; grid-template-columns: 56px 1fr; gap: 10px 12px; align-items: center; overflow: hidden;
}
.xa__cov {
  position: relative; width: 56px; height: 56px; border-radius: var(--r); display: grid; place-items: center; overflow: hidden;
  background: linear-gradient(135deg, #d0577b, #8b7cf6) center / cover; color: #fff;
}
.xa__cov.has-art { background-color: var(--panel-3); }
.xa--voice .xa__cov { border-radius: 50%; background: linear-gradient(135deg, #2aa6a0, #5b8def); }
.xa__cov svg { width: 24px; height: 24px; }
.xa__eq { position: absolute; inset: auto 0 6px; display: none; justify-content: center; gap: 2px; height: 16px; align-items: flex-end; }
.xa__eq i { width: 3px; background: #fff; border-radius: 2px; animation: xeq .8s ease-in-out infinite; }
.xa__eq i:nth-child(2) { animation-delay: .2s; }
.xa__eq i:nth-child(3) { animation-delay: .4s; }
.xa__eq i:nth-child(4) { animation-delay: .1s; }
.xa.is-playing .xa__eq { display: flex; }
.xa.is-playing .xa__cov:not(.has-art) svg { display: none; }
.xa.is-playing .xa__cov.has-art::before { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, .35); }
@keyframes xeq { 0%, 100% { height: 4px; } 50% { height: 16px; } }
.xa__top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.xa__name { flex: 1; min-width: 0; line-height: 1.25; }
.xa__name b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xa__name small { display: block; font-size: 12px; color: var(--ink-4); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xa__pp { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; cursor: pointer; display: grid; place-items: center; flex: none; transition: transform .12s, background .15s; }
.xa__pp:hover { background: var(--accent-hover); transform: scale(1.05); }
.xa__pp svg { width: 16px; height: 16px; }
.xa__wave { grid-column: 1 / -1; display: flex; align-items: center; gap: 2px; height: 34px; cursor: pointer; touch-action: none; outline: none; }
.xa__wave i { flex: 1; border-radius: 2px; background: var(--line-3); min-height: 3px; transition: background .1s; }
.xa__wave i.on { background: var(--accent); }
.xa__wave:hover i:not(.on) { background: var(--ink-5); }
.xa__time { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 11.5px; color: var(--ink-4); margin-top: -6px; font-variant-numeric: tabular-nums; }
.xa__volbox { display: inline-flex; align-items: center; gap: 2px; margin: -6px auto -6px 0; }
.xa__mute { width: 28px; height: 28px; }
.xa__mute svg { width: 16px; height: 16px; }
.xa__vol { width: 90px; accent-color: var(--accent); }

/* now playing pill */
.xnow {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; max-width: min(320px, 40vw); padding: 0 4px 0 10px; border-radius: 15px; flex: none;
  background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 600; cursor: pointer; animation: xrise .2s;
}
.xnow__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.xnow__btn { width: 22px; height: 22px; border-radius: 50%; border: 0; background: none; color: inherit; cursor: pointer; display: grid; place-items: center; flex: none; }
.xnow__btn:hover { background: var(--accent); color: #fff; }
.xnow__btn svg { width: 12px; height: 12px; }
@keyframes xrise { from { opacity: 0; transform: translateY(6px); } }
.msg.xflash { animation: xflash 1.4s; }
@keyframes xflash { 0%, 40% { background: rgba(227, 179, 65, .18); } }

/* viewer */
.xviewer { position: fixed; inset: 0; z-index: 90; background: rgba(0, 0, 0, .92); display: grid; grid-template-rows: 56px 1fr 84px; color: #fff; animation: fade .15s; }
.xviewer__head { display: flex; align-items: center; gap: 6px; padding: 0 12px 0 18px; min-width: 0; }
.xviewer__head b { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xviewer__stage { position: relative; display: grid; place-items: center; overflow: hidden; min-height: 0; padding: 0 70px; }
.xviewer__img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; cursor: zoom-in; transition: transform .15s; user-select: none; }
.xviewer__img.is-zoomed { cursor: zoom-out; }
.xviewer__nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, .12); color: #fff; cursor: pointer; display: grid; place-items: center;
}
.xviewer__nav:hover { background: rgba(255, 255, 255, .24); }
.xviewer__nav--prev { left: 16px; }
.xviewer__nav--next { right: 16px; }
.xviewer__strip { display: flex; justify-content: center; align-items: center; gap: 8px; overflow-x: auto; padding: 0 12px; }
.xviewer__thumb { width: 70px; height: 48px; flex: none; padding: 0; border-radius: 6px; border: 2px solid transparent; background: #111; opacity: .45; cursor: pointer; overflow: hidden; }
.xviewer__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.xviewer__thumb.is-on { opacity: 1; border-color: #fff; }
@media (max-width: 820px) {
  .xviewer__stage { padding: 0; }
  .xviewer__nav { width: 40px; height: 40px; background: rgba(0, 0, 0, .45); }
  .xviewer__nav--prev { left: 6px; }
  .xviewer__nav--next { right: 6px; }
}

/* expressions in messages */
.xemo { display: inline-block; width: 22px; height: 22px; object-fit: contain; vertical-align: -5px; margin: 0 1px; }
.xjumbo { font-size: 40px; line-height: 1.2; }
.xemo--big, .xjumbo .xemo { width: 44px; height: 44px; vertical-align: -8px; }
.xsticker { display: block; width: 160px; height: 160px; object-fit: contain; margin-top: 2px; }
.xsticker-miss { font-size: 12.5px; font-style: italic; color: var(--ink-4); }

/* expression picker */
.xp {
  position: fixed; z-index: 85; width: 420px; height: 440px; max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px);
  border-radius: 16px; background: var(--panel); border: 1px solid var(--line-2); box-shadow: var(--shadow);
  display: flex; flex-direction: column; overflow: hidden; animation: pop .12s;
}
.xp--react { height: 400px; }
.xp--sheet { left: 0 !important; right: 0; top: auto !important; bottom: 0; width: 100%; max-width: none; height: min(70dvh, 520px); border-radius: 18px 18px 0 0; animation: sheet-up .2s; padding-bottom: env(safe-area-inset-bottom); }
.xp__tabs { display: flex; gap: 4px; padding: 10px 10px 0; flex: none; }
.xp__tabs button { height: 30px; padding: 0 12px; border-radius: 8px; border: 0; background: none; color: var(--ink-3); font-weight: 600; font-size: 13px; cursor: pointer; }
.xp__tabs button:hover { color: var(--ink); background: var(--panel-2); }
.xp__tabs button.is-on { background: var(--accent-soft); color: var(--accent); }
.xp__search { margin: 10px; height: 34px; flex: none; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel-2); padding: 0 10px; outline: none; color: var(--ink); }
.xp__search:focus { border-color: var(--accent); }
.xp__body { flex: 1; overflow-y: auto; padding: 0 10px 10px; min-height: 0; }
.xp__lbl { font-size: 11px; font-weight: 700; color: var(--ink-4); padding: 8px 2px 6px; text-transform: uppercase; letter-spacing: .4px; display: flex; align-items: center; gap: 6px; }
.xp__eg { display: grid; grid-template-columns: repeat(9, 1fr); gap: 2px; }
.xp__eg button { height: 40px; border: 0; background: none; border-radius: 8px; font-size: 22px; cursor: pointer; display: grid; place-items: center; padding: 0; font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", var(--font); }
.xp__eg button:hover { background: var(--panel-3); }
.xp__eg .xemo { width: 28px; height: 28px; margin: 0; vertical-align: 0; }
.xp__gg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.xp__gg .xgif { width: 100%; height: 110px; cursor: pointer; }
.xp__gg .xgif:hover { outline: 2px solid var(--accent); outline-offset: -2px; }
.xp__sg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.xp__sg button { aspect-ratio: 1; border: 0; padding: 6px; background: var(--panel-2); border-radius: 12px; cursor: pointer; display: grid; place-items: center; transition: transform .12s, background .12s; }
.xp__sg button:hover { background: var(--panel-3); transform: scale(1.04); }
.xp__sg img { width: 100%; height: 100%; object-fit: contain; }
.xp__foot { flex: none; display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 12px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-3); }
.xp__foot b { font-weight: 600; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xp__big { font-size: 24px; line-height: 1; }
.xp__foot .xemo { width: 26px; height: 26px; vertical-align: 0; }
.xp__note { font-size: 11.5px; color: var(--ink-4); padding: 8px 2px 4px; }
.xp__empty { padding: 30px 20px; text-align: center; color: var(--ink-4); font-size: 13px; }
.xp__loading { display: grid; place-items: center; padding: 24px; }
@media (max-width: 820px) { .xp__eg { grid-template-columns: repeat(8, 1fr); } }

/* composer: buttons, tray, drop zone */
.composer__box .xc-btn { width: 34px; height: 34px; color: var(--ink-3); }
.composer__box .xc-btn:disabled { opacity: .4; cursor: default; }
.composer__box > .xc-btn:first-child { margin-left: -6px; }
.xc-gif { font-size: 10.5px; font-weight: 800; letter-spacing: .3px; }
.xc-gif::before { content: ""; position: absolute; inset: 7px 4px; border: 1.5px solid currentColor; border-radius: 5px; }
.xtray { display: flex; gap: 8px; padding: 10px 2px; overflow-x: auto; align-items: flex-end; flex-wrap: nowrap; }
.xtray__rules { flex: none; align-self: center; font-size: 11.5px; color: var(--ink-4); padding: 0 6px; white-space: nowrap; }
.xtcard { position: relative; width: 140px; flex: none; border-radius: var(--r); background: var(--panel-2); border: 1px solid var(--line-2); overflow: hidden; animation: xrise .18s; }
.xtcard__th { height: 84px; background: var(--accent-soft) center / cover no-repeat; display: grid; place-items: center; color: var(--accent); }
.xtcard__th svg { width: 30px; height: 30px; }
.xtcard__name { width: 100%; border: 0; background: none; padding: 6px 8px 0; font-size: 12px; font-weight: 600; outline: none; color: var(--ink); text-overflow: ellipsis; }
.xtcard__name:focus { color: var(--accent); }
.xtcard__detail { display: block; padding: 0 8px 8px; font-size: 11px; color: var(--ink-4); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xtcard.is-bad { border-color: var(--bad); }
.xtcard.is-bad .xtcard__detail { color: var(--bad); white-space: normal; }
.xtcard__prog { position: absolute; left: 0; right: 0; top: 81px; height: 3px; background: rgba(0, 0, 0, .3); }
.xtcard__prog i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.xtcard__x { position: absolute; top: 5px; right: 5px; width: 24px; height: 24px; border-radius: 7px; border: 0; background: rgba(0, 0, 0, .6); color: #fff; cursor: pointer; display: grid; place-items: center; }
.xtcard__x svg { width: 14px; height: 14px; }
.xtcard__x:hover { background: var(--bad); }
.xdrop-host { position: relative; }
.xdrop { position: absolute; inset: 0; z-index: 8; background: rgba(12, 13, 18, .75); backdrop-filter: blur(3px); display: grid; place-items: center; animation: fade .15s; pointer-events: none; }
.xdrop__card { padding: 30px 46px; max-width: calc(100% - 32px); border-radius: var(--r-xl); border: 2px dashed var(--accent); background: var(--panel); text-align: center; }
.xdrop__card svg { width: 40px; height: 40px; color: var(--accent); }
.xdrop__card b { display: block; font-size: 16px; margin-top: 8px; }
.xdrop__card span { font-size: 12.5px; color: var(--ink-4); }
.xdrop__card.is-locked { border-color: var(--bad); }
.xdrop__card.is-locked svg { color: var(--bad); }
@media (max-width: 820px) {
  .composer__box .xc-btn { width: 36px; height: 36px; }
  .composer__box .xc-gif, .composer__box .xc-btn[aria-label="Stickers"] { display: none; }
}
