/* ==========================================================================
   Sonion Chat 3.1.6: motion and smoothness
   Only transform and opacity are animated (the graphics card handles those: smooth 60 fps, also on Chromebooks).
   "Reduce motion" (Settings → Appearance, or the system setting) turns all of it off through the rules in app.css.
   ========================================================================== */
:root { --ease-out: cubic-bezier(.16, 1, .3, 1); --ease-spring: cubic-bezier(.34, 1.4, .64, 1); }

/* ---------- smoother scrolling and less work for the browser ---------- */
.scroller, .side-body, .members, .set-main, .modal-body, .pk-body { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.scroller { scroll-behavior: auto; }
/* long lists off screen are skipped until you scroll to them */
.members .mem:nth-child(n + 40), .friends .friend:nth-child(n + 30) { content-visibility: auto; contain-intrinsic-size: auto 44px; }
img, video { -webkit-user-drag: none; }

/* ---------- status dot becomes a typing bubble (keeps the status color) ---------- */
.av .st.is-typing { width: calc(var(--s) * .62 + 8px); min-width: 26px; border-radius: 99px; right: calc(var(--s) * -.22); display: flex; align-items: center; justify-content: center; gap: 2px; transition: width .2s var(--ease-out); }
.av .st.is-typing::after { display: none; }
.av .st.is-typing b { width: 3.5px; height: 3.5px; border-radius: 50%; background: var(--panel); animation: ty-b 1.1s infinite ease-in-out; }
.av .st.is-typing b:nth-child(2) { animation-delay: .15s; } .av .st.is-typing b:nth-child(3) { animation-delay: .3s; }
.av .st.st-offline.is-typing, .av .st.st-invisible.is-typing { background: var(--off) !important; }
@keyframes ty-b { 0%, 60%, 100% { transform: translateY(0); opacity: .55; } 30% { transform: translateY(-2.5px); opacity: 1; } }
.av .st.st-pop { animation: st-pop .38s var(--ease-spring); }
@keyframes st-pop { 0% { transform: scale(.4); } 70% { transform: scale(1.18); } 100% { transform: scale(1); } }

/* DM list: "typing…" replaces the line under the name */
.dm-row .dm-text { display: grid; min-width: 0; }
.dm-row .dm-typing { display: none; color: var(--accent-text, var(--ok)); font-weight: 600; align-items: center; gap: 2px; }
.dm-row.is-typing .dm-typing { display: inline-flex; }
.dm-row.is-typing .dm-text > small:not(.dm-typing) { display: none; }
.dm-typing i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; animation: ty-b 1.1s infinite ease-in-out; }
.dm-typing i:nth-child(2) { animation-delay: .15s; } .dm-typing i:nth-child(3) { animation-delay: .3s; margin-right: 3px; }
/* channel list: three dots next to a channel someone is typing in */
.ch-typing { display: inline-flex; gap: 2px; align-items: center; padding: 3px 5px; border-radius: 99px; background: var(--panel-3, rgba(255,255,255,.08)); }
.ch-typing b { width: 3.5px; height: 3.5px; border-radius: 50%; background: var(--ink-2); animation: ty-b 1.1s infinite ease-in-out; }
.ch-typing b:nth-child(2) { animation-delay: .15s; } .ch-typing b:nth-child(3) { animation-delay: .3s; }

/* ---------- loading: shimmering placeholders instead of a spinner ---------- */
.skel-msgs { display: grid; gap: 18px; padding: 16px 16px 24px; align-content: end; min-height: 100%; }
.skel-msg { display: grid; grid-template-columns: 40px 1fr; gap: 16px; padding-left: 16px; animation: skel-in .4s var(--ease-out) backwards; animation-delay: var(--d, 0ms); }
.skel-msg span { display: grid; gap: 8px; }
.skel-av, .skel-l { display: block; background: linear-gradient(90deg, var(--panel-2) 0%, var(--panel-3, var(--hover)) 40%, var(--panel-2) 80%); background-size: 300% 100%; animation: shimmer 1.4s infinite linear; }
.skel-av { width: 40px; height: 40px; border-radius: 50%; }
.skel-l { height: 12px; border-radius: 6px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -200% 0; } }
@keyframes skel-in { from { opacity: 0; transform: translateY(10px); } }
/* any spinner only shows up after a moment, so quick loads don't flash it */
.spin { animation: spin .8s linear infinite, spin-in .3s .2s backwards; }
@keyframes spin-in { from { opacity: 0; } }

/* ---------- menus, popovers, dialogs, toasts ---------- */
.menu { animation: menu-in .16s var(--ease-out); transform-origin: top left; }
@keyframes menu-in { from { opacity: 0; transform: scale(.94) translateY(-4px); } }
.menu .menu-item { transition: background .12s, padding-left .15s var(--ease-out); }
.menu .menu-item:hover:not(:disabled) { padding-left: 14px; }
.popover { animation: pop-in .2s var(--ease-out); }
@keyframes pop-in { from { opacity: 0; transform: scale(.95) translateY(6px); } }
.modal { animation: modal-in .32s var(--ease-spring); }
@keyframes modal-in { from { opacity: 0; transform: scale(.9) translateY(14px); } }
.modal-back { animation: fade .22s ease; }
.modal-back.out { opacity: 0; transition: opacity .16s; }
.modal-back.out .modal { transform: scale(.95) translateY(8px); transition: transform .16s ease-in; }
.toast { animation: toast-in .42s var(--ease-spring); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-18px) scale(.9); } }
.toast.out { opacity: 0; transform: translateY(-10px) scale(.95); transition: opacity .25s, transform .25s; }
@media (max-width: 760px) { @keyframes toast-in { from { opacity: 0; transform: translateY(18px) scale(.9); } } }

/* ---------- lists and sidebars: small movements on hover ---------- */
.ch, .dm-row, .mem, .nav-item, .friend { transition: background .14s, color .14s, transform .18s var(--ease-out); }
.ch:active, .dm-row:active, .mem:active, .nav-item:active { transform: scale(.98); }
.mem:hover .av, .friend:hover .av { transform: scale(1.06); }
.mem .av, .friend .av, .dm-row .av { transition: transform .2s var(--ease-spring); }
.rail-btn .srv-icon, .rail-btn img { transition: border-radius .22s var(--ease-out), transform .22s var(--ease-spring), background .15s; }
.rail-btn:hover .srv-icon, .rail-btn:hover > .av, .rail-btn:hover > img { transform: translateY(-1px) scale(1.04); }
.rail-btn .pill { transition: height .25s var(--ease-spring); }
/* badges pop from JS (app.js setHTML) only when the number really changes; as CSS they replayed on every redraw */
@keyframes badge-pop { 0% { transform: scale(0); } 70% { transform: scale(1.25); } 100% { transform: scale(1); } }
.unread-pip { transition: height .22s var(--ease-spring); }
.btn { transition: background .15s, color .15s, box-shadow .2s, transform .15s var(--ease-out); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 6px 18px -8px var(--accent, #5865f2); transform: translateY(-1px); }
.icon-btn { transition: background .14s, color .14s, transform .18s var(--ease-spring); }
.icon-btn:active { transform: scale(.92); }
input[type=checkbox][role=switch] { transition: background .2s; }
input[type=checkbox][role=switch]::before { transition: transform .25s var(--ease-spring) !important; }
.set-tab { transition: background .14s, color .14s, padding-left .18s var(--ease-out); }
.set-tab:hover:not(.active) { padding-left: 14px; }
.tab { transition: background .14s, color .14s; }

/* ---------- chat ---------- */
.msg { transition: background .12s; }
@keyframes tools-in { from { opacity: 0; transform: translateY(4px) scale(.96); } }
.react { transition: transform .18s var(--ease-spring), background .14s, border-color .14s; }
.react:hover { transform: translateY(-1px) scale(1.05); }
@keyframes react-pop { 0% { transform: scale(.6); } 60% { transform: scale(1.2); } 100% { transform: scale(1); } }
.reply-bar, .files-bar, .edit-box { animation: slide-up .22s var(--ease-out); }
@keyframes slide-up { from { opacity: 0; transform: translateY(8px); } }
.jump-present:not([hidden]) { animation: slide-up .25s var(--ease-spring); }
.composer textarea { transition: height .12s ease-out; }

.msg.revealed { animation: fade .3s; }

/* voice message recording bar */
.rec-bar { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; padding: 8px 10px 8px 14px; border-radius: 14px; background: var(--danger-soft, rgba(220, 50, 70, .14)); border: 1px solid color-mix(in srgb, var(--red) 40%, transparent); animation: slide-up .25s var(--ease-spring); }
.rec-bar b { color: var(--red-hi, var(--red)); }
.rec-bar .rec-t { font-variant-numeric: tabular-nums; color: var(--ink-2); min-width: 38px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); animation: rec-blink 1s infinite; }
@keyframes rec-blink { 50% { opacity: .3; transform: scale(.8); } }
.rec-wave { flex: 1; height: 6px; border-radius: 99px; background: linear-gradient(90deg, var(--red) calc(var(--lvl, 0) * 100%), var(--panel-3, rgba(255,255,255,.1)) 0); transition: background .1s; }

/* ---------- fun effects layer (confetti, hearts) ---------- */
#fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 2500; overflow: hidden; }
.fx-conf { position: absolute; width: 8px; height: 12px; border-radius: 2px; will-change: transform, opacity; }
.fx-float { position: absolute; line-height: 1; will-change: transform, opacity; filter: drop-shadow(0 2px 4px rgba(0,0,0,.25)); }

/* ---------- Settings → Appearance: message animation preview ---------- */
.msg-anim { flex-wrap: wrap; }
.manim-demo { min-height: 56px; margin: 4px 0 14px; padding: 10px 12px; border-radius: 14px; background: var(--panel-2); overflow: hidden; }
.manim-msg { display: flex; align-items: center; gap: 12px; }
.manim-msg > span:last-child { display: grid; }
.manim-msg small { color: var(--ink-2); }
.manim-av { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--accent, #5865f2), var(--lantern, #ff7a4f)); flex: none; }

/* ---------- connection bar: a small pill that slides down (was a hard strip) ---------- */
body.offline .shell::before { content: 'Reconnecting…' !important; left: 50% !important; right: auto !important; top: 10px !important; transform: translateX(-50%); padding: 5px 14px 5px 30px !important; border-radius: 99px; box-shadow: 0 6px 20px rgba(0,0,0,.3); animation: conn-in .4s var(--ease-spring);
  background: var(--idle) radial-gradient(circle at 15px 50%, rgba(0,0,0,.55) 0 3.5px, transparent 4px) no-repeat !important; }
@keyframes conn-in { from { opacity: 0; transform: translate(-50%, -24px) scale(.9); } }

/* ---------- pages in the app (Discover, Shop, Inbox, Learn, Admin) ---------- */
.disc-list .disc, .shop-item, .learn-card, .inbox-item, .adm-card, .badge-card { animation: card-in .4s var(--ease-out) backwards; }
.disc-list .disc:nth-child(2), .shop-item:nth-child(2), .learn-card:nth-child(2), .inbox-item:nth-child(2) { animation-delay: .04s; }
.disc-list .disc:nth-child(3), .shop-item:nth-child(3), .learn-card:nth-child(3), .inbox-item:nth-child(3) { animation-delay: .08s; }
.disc-list .disc:nth-child(4), .shop-item:nth-child(4), .learn-card:nth-child(4), .inbox-item:nth-child(4) { animation-delay: .12s; }
.disc-list .disc:nth-child(5), .shop-item:nth-child(5), .learn-card:nth-child(5), .inbox-item:nth-child(5) { animation-delay: .16s; }
.disc-list .disc:nth-child(n + 6), .shop-item:nth-child(n + 6), .learn-card:nth-child(n + 6), .inbox-item:nth-child(n + 6) { animation-delay: .2s; }
@keyframes card-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.disc-list .disc:hover { transform: translateY(-4px); }
.adm-tabs button, .tb-btn { transition: background .14s, color .14s, transform .18s var(--ease-spring); }
.tb-btn:hover { transform: translateY(-1px); }

/* ---------- voice ---------- */
.tile { transition: transform .25s var(--ease-out), box-shadow .2s; }
.tile.speaking { transition: box-shadow .12s; }
.vp-top b .ic { transition: transform .3s; }

/* ---------- "Blocky" badge pop-ups (Settings → Appearance → Looks) ---------- */
#blocky-toasts { position: fixed; top: 12px; right: 12px; z-index: 3200; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; pointer-events: none; }
.blocky { pointer-events: auto; cursor: pointer; display: flex; align-items: center; gap: 12px; width: 320px; max-width: calc(100vw - 24px); padding: 10px 14px 10px 10px;
  background: #212121; border: 3px solid #555; outline: 3px solid #0b0b0b; border-radius: 6px; box-shadow: inset 0 0 0 2px #2c2c2c, 0 8px 24px rgba(0,0,0,.5);
  font-family: 'Pixelify Sans', 'Courier New', monospace; image-rendering: pixelated; }
.blocky .bk-ic { width: 44px; height: 44px; flex: none; display: grid; place-items: center; }
.blocky .bk-ic img { width: 44px; height: 44px; filter: drop-shadow(2px 2px 0 rgba(0,0,0,.6)); }
.blocky .bk-tx { display: grid; min-width: 0; line-height: 1.15; }
.blocky b { color: #ffff55; font-weight: 700; font-size: 1.12rem; text-shadow: 2px 2px 0 #3f3f15; letter-spacing: .02em; }
.blocky .bk-tx > span { color: #fff; font-size: 1.05rem; font-weight: 500; text-shadow: 2px 2px 0 #3f3f3f; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.blocky small { color: #aaa; font-size: .85rem; }
.blocky.gold b { color: #ff55ff; text-shadow: 2px 2px 0 #3f153f; }
@media (max-width: 560px) { #blocky-toasts { top: max(8px, env(safe-area-inset-top)); right: 8px; } .blocky { width: 280px; } }

/* "Animations are off" question (main.js), shown once when they're off */
.motion-ask { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 3000; display: flex; align-items: center; gap: 12px; width: min(620px, calc(100vw - 24px)); padding: 12px 14px; border-radius: 16px; background: var(--panel); color: var(--ink); border: 1px solid var(--line); box-shadow: 0 16px 40px rgba(0,0,0,.45); }
.motion-ask > span { font-size: 1.6rem; }
.motion-ask > div { flex: 1; display: grid; min-width: 0; } .motion-ask small { color: var(--ink-2); }
@media (max-width: 560px) { .motion-ask { flex-wrap: wrap; bottom: calc(80px + env(safe-area-inset-bottom)); } .motion-ask > div { flex-basis: calc(100% - 50px); } }

/* ---------- GIFs (gifs.js) ---------- */
.gif-btn b { font: 800 .62rem/1 inherit; letter-spacing: .04em; padding: 3px 4px; border: 2px solid currentColor; border-radius: 5px; }
.gif-btn:hover b, .gif-btn[aria-expanded="true"] b { color: var(--accent-text, var(--ink)); }
.gifp { width: min(440px, calc(100vw - 16px)); padding: 0 !important; overflow: hidden !important; }
.gp { display: flex; flex-direction: column; height: min(460px, 62vh); }
.gp-top { display: flex; align-items: center; gap: 8px; margin: 10px 10px 6px; padding: 0 6px 0 10px; border-radius: 10px; background: var(--panel-2); }
.gp-top > .ic { width: 16px; height: 16px; opacity: .6; flex: none; }
.gp-q { flex: 1; min-width: 0; height: 38px; border: 0 !important; background: transparent !important; color: var(--ink); font: inherit; outline: none; padding: 0 !important; box-shadow: none !important; }
.gp-clear { width: 26px; height: 26px; }
.gp-tabs { display: flex; gap: 4px; padding: 0 10px 6px; }
.gp-tabs button { padding: 5px 10px; border-radius: 99px; font-weight: 600; font-size: .82rem; color: var(--ink-2); }
.gp-tabs button.on { background: var(--active); color: var(--ink); }
.gp-tabs small { color: var(--ink-3); }
.gp-chips { display: flex; gap: 6px; overflow-x: auto; padding: 0 10px 8px; scrollbar-width: none; flex: none; }
.gp-chips::-webkit-scrollbar { display: none; }
.gp-chips button { flex: none; padding: 4px 10px; border-radius: 99px; background: var(--panel-2); font-size: .8rem; color: var(--ink-2); transition: background .14s, color .14s; }
.gp-chips button:hover { background: var(--accent); color: #fff; }
.gp-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 0 10px 10px; overscroll-behavior: contain; }
.gp-grid { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: 6px; align-items: start; }
.gp-col { display: grid; gap: 6px; }
.gp-it { position: relative; border-radius: 10px; overflow: hidden; background: var(--panel-2); }
.gp-pick { display: block; width: 100%; height: 100%; padding: 0; }
.gp-pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gp-pick:hover img { filter: brightness(1.08); }
.gp-it:hover { outline: 2px solid var(--accent-text, var(--accent)); outline-offset: -2px; }
.gp-star, .gif-fav { position: absolute; top: 5px; right: 5px; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: rgba(0,0,0,.55); color: #fff; font-size: .95rem; line-height: 1; opacity: 0; transition: opacity .15s, transform .2s var(--ease-spring), color .15s; }
.gp-it:hover .gp-star, .gp-star.on, .gif-msg:hover .gif-fav { opacity: 1; }
.gp-star.on, .gif-fav.on { color: #ffd34d; }
.gp-star:hover, .gif-fav:hover { transform: scale(1.12); }
.gp-empty { grid-column: 1 / -1; text-align: center; padding: 40px 10px; }
.gp-skel { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.gp-skel i { height: 92px; border-radius: 10px; background: linear-gradient(90deg, var(--panel-2) 0%, var(--panel-3, var(--hover)) 40%, var(--panel-2) 80%); background-size: 300% 100%; animation: shimmer 1.4s infinite linear; }
.gp-skel i:nth-child(3n + 2) { height: 120px; }
.gp-more { text-align: center; margin: 8px 0 0; }
.gp-by { margin: 0; padding: 6px 10px; border-top: 1px solid var(--line); font-size: .7rem; color: var(--ink-3); text-align: center; flex: none; }
.gp-by b { color: var(--ink-2); letter-spacing: .04em; }
.gp-off { height: auto; padding: 22px; text-align: center; display: grid; gap: 6px; justify-items: center; }
.gp-off .gp-big { margin: 0; font-weight: 800; font-size: 1.6rem; padding: 4px 10px; border: 3px solid var(--ink-3); border-radius: 10px; color: var(--ink-3); }
.gp-off code { font-size: .75rem; }
/* a GIF in the chat */
.gif-msg { position: relative; display: inline-block; margin-top: 4px; max-width: min(360px, 100%); border-radius: 12px; overflow: hidden; background: var(--panel-2); line-height: 0; }
.gif-msg video, .gif-msg img { display: block; max-width: 100%; max-height: 300px; width: auto; height: auto; min-width: 80px; min-height: 60px; object-fit: contain; }
.gif-tag { position: absolute; left: 6px; bottom: 6px; padding: 2px 5px; border-radius: 5px; background: rgba(0,0,0,.55); color: #fff; font: 800 .6rem/1.3 inherit; letter-spacing: .05em; opacity: 0; transition: opacity .15s; pointer-events: none; }
.gif-msg:hover .gif-tag { opacity: 1; }
@media (hover: none) { .gif-fav { opacity: .85; } }

/* ---------- group chats: settings (3.1.7) ---------- */
.h-group { display: inline-flex; align-items: center; gap: 8px; padding: 3px 8px 3px 4px; margin-left: -4px; border-radius: 8px; color: inherit; min-width: 0; }
.h-group:hover { background: var(--hover); }
.h-group > .ic:last-child { width: 14px; height: 14px; opacity: 0; transition: opacity .15s; }
.h-group:hover > .ic:last-child { opacity: .7; }
.h-group .h-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grp-top { display: flex; align-items: flex-end; gap: 14px; }
.grp-ic { position: relative; width: 72px; height: 72px; flex: none; border-radius: 50%; overflow: hidden; cursor: pointer; background: var(--panel-2); display: grid; place-items: center; }
.grp-ic-img, .grp-ic-img img { width: 100%; height: 100%; display: grid; place-items: center; object-fit: cover; }
.grp-ic-img .ic { width: 30px; height: 30px; opacity: .6; }
.grp-ic i { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.45); opacity: 0; transition: opacity .15s; color: #fff; }
.grp-ic:hover i, .grp-ic.busy i { opacity: 1; }
.grp-ic.busy i .ic { animation: spin .8s linear infinite; }
.grp-noicon { margin: 6px 0 0 4px; }
.grp-people { display: grid; gap: 2px; max-height: 300px; overflow-y: auto; }
.grp-people .pick { cursor: default; }

/* Settings → Privacy & safety: "Your data" */
.priv-facts { display: grid; gap: 8px; margin: 6px 0 12px; }
.priv-facts p { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--panel-2); font-size: .9rem; color: var(--ink-2); }
.priv-facts p .ic { width: 18px; height: 18px; flex: none; margin-top: 2px; color: var(--accent-text, var(--ok)); }
.priv-facts b { color: var(--ink); }

/* ---------- status replies (statusreply.js, 4.0) ---------- */
[data-status-of] { cursor: pointer; border-radius: 6px; transition: background .14s, color .14s; }
[data-status-of]:hover { color: var(--ink); background: var(--hover); }
.sr-card { position: fixed; z-index: 2600; width: 300px; max-width: calc(100vw - 16px); padding: 12px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 18px 44px rgba(0,0,0,.45); animation: pop-in .18s var(--ease-out); }
.sr-card.sr-out { opacity: 0; transform: scale(.96); transition: opacity .14s, transform .14s; }
.sr-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.sr-text { margin: 0 0 10px; padding: 10px 12px; border-radius: 12px; background: var(--panel-2); color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 180px; overflow-y: auto; }
.sr-emo img, .sr-emo .emoji { width: 20px; height: 20px; vertical-align: -4px; margin-right: 4px; }
.sr-react { display: flex; gap: 4px; margin-bottom: 8px; }
.sr-react button { flex: 1; height: 34px; border-radius: 10px; background: var(--panel-2); display: grid; place-items: center; transition: transform .18s var(--ease-spring), background .14s; }
.sr-react button:hover { transform: scale(1.12); background: var(--panel-3, var(--hover)); }
.sr-react img, .sr-react .emoji { width: 20px; height: 20px; }
.sr-reply { display: flex; gap: 6px; }
.sr-reply input { flex: 1; min-width: 0; height: 36px; padding: 0 12px; border-radius: 10px; }
.sr-reply button { width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: #fff; font-size: .9rem; }
/* in the chat: "Replied to Noor's status" */
.status-ref { display: grid; gap: 2px; margin: 2px 0 4px; padding-left: 10px; border-left: 3px solid var(--line); }
.status-ref small { display: flex; align-items: center; gap: 5px; font-style: italic; }
.status-ref small .ic { width: 13px; height: 13px; }
.status-ref b { cursor: pointer; font-style: normal; }
.sr-q { color: var(--ink-2); overflow-wrap: anywhere; }
.sr-q img, .sr-q .emoji { width: 18px; height: 18px; vertical-align: -3px; }

/* ---------- colour chooser (4.0): ready-made colours + your own ---------- */
.cpick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cpick .swatch { width: 26px; height: 26px; border-radius: 8px; border: 2px solid transparent; box-shadow: inset 0 0 0 1px rgba(0,0,0,.2); transition: transform .15s var(--ease-spring); }
.cpick .swatch:hover { transform: scale(1.12); }
.cpick .swatch.on { border-color: var(--ink); transform: scale(1.08); }
.cp-own { position: relative; width: 26px; height: 26px; border-radius: 8px; cursor: pointer; background: conic-gradient(#ff4d4d, #ffb84d, #f2f24d, #4dff88, #4dd2ff, #6d4dff, #ff4dd2, #ff4d4d); border: 2px solid transparent; display: grid; place-items: center; }
.cp-own.on { border-color: var(--ink); }
.cp-own input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; padding: 0; border: 0; }
.cp-own span { width: 14px; height: 14px; border-radius: 4px; box-shadow: 0 0 0 2px var(--panel); }
.cp-own span[style=""], .cp-own span:not([style]) { display: none; }
.cp-hex { width: 84px; height: 30px; padding: 0 8px !important; font-family: var(--mono); font-size: .82rem; text-transform: lowercase; }
/* the other "own colour" pickers in the app: a clear rainbow button instead of a tiny grey box */
.row-actions > input[type=color], .accent-row > input[type=color] { width: 30px; height: 30px; padding: 0; border: 2px solid var(--line); border-radius: 9px; cursor: pointer; background: conic-gradient(#ff4d4d, #ffb84d, #f2f24d, #4dff88, #4dd2ff, #6d4dff, #ff4dd2, #ff4d4d); }
.row-actions > input[type=color]::-webkit-color-swatch-wrapper, .accent-row > input[type=color]::-webkit-color-swatch-wrapper { padding: 6px; }
.row-actions > input[type=color]::-webkit-color-swatch, .accent-row > input[type=color]::-webkit-color-swatch { border: 0; border-radius: 4px; }

/* 4.0 shop bundles */
.shop-bundle { display: grid; grid-template-columns: repeat(2, 40px); grid-auto-rows: 40px; gap: 4px; position: relative; padding: 6px; border-radius: 16px; background: linear-gradient(135deg, var(--accent-soft), transparent); box-shadow: inset 0 0 0 1px var(--line); }
.shop-bundle.n2 { grid-template-columns: repeat(2, 40px); grid-auto-rows: 52px; }
.shop-bundle.n3 i:first-child { grid-row: span 2; }
.shop-bundle i { display: grid; place-items: center; overflow: hidden; border-radius: 10px; background: var(--panel-3); }
.shop-bundle i .shop-theme { width: 38px; height: 30px; border-radius: 7px; }
.shop-bundle i .shop-snd { width: 32px; height: 32px; } .shop-bundle i .shop-snd .ic { width: 16px; height: 16px; }
.shop-bundle em { position: absolute; right: -6px; bottom: -6px; font-style: normal; font-size: .7rem; font-weight: 800; padding: 1px 6px; border-radius: 99px; background: var(--accent); color: var(--on-accent, #fff); }
.shop-in { color: var(--ink-3); font-size: .78rem; } .shop-in b { color: var(--accent-text); }
.shop-blist { margin: 0 0 10px; padding-left: 18px; display: flex; flex-direction: column; gap: 2px; }
.mk-bundle { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; margin: 8px 0 4px; }
.mk-bi { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--r-m); background: var(--panel-2); border: 2px solid transparent; cursor: pointer; min-width: 0; }
.mk-bi.on { border-color: var(--accent); }
.mk-bi input { position: absolute; opacity: 0; pointer-events: none; }
.mk-bi .shop-art { height: 40px; width: 40px; flex: none; overflow: hidden; }
.mk-bi .shop-art .shop-theme { width: 40px; height: 28px; } .mk-bi .shop-art .shop-snd { width: 34px; height: 34px; }
.mk-bi b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .88rem; }
.mk-bsum { display: block; margin-bottom: 8px; }
.adm-shop .shop-bundle { transform: scale(.7); }

/* 4.0 channel flair */
.ch-emo { flex: none; font-size: 1rem; line-height: 1; margin-right: -2px; }
.ch-emo img.emoji { width: 18px; height: 18px; vertical-align: -3px; }
.ch-name.fl { color: var(--c1); }
.ch-name.fl.grad { background: linear-gradient(90deg, var(--c1), var(--c2), var(--c1)); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; }
.ch:not(.active):not(.unread) .ch-name.fl { opacity: .92; }
.ch-name.fl-shimmer { background: linear-gradient(90deg, var(--c1, var(--ink-2)) 0 35%, #fff 50%, var(--c2, var(--c1, var(--ink-2))) 65% 100%); background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; animation: fl-shimmer 3.2s linear infinite; }
.ch-name.fl-glow { text-shadow: 0 0 6px color-mix(in srgb, var(--c1, var(--accent)) 70%, transparent); animation: fl-glow 2.6s ease-in-out infinite; }
.ch-name.fl-wave.wgrad { background: none; -webkit-text-fill-color: currentColor; color: var(--c1); }
.ch-name.fl-wave.wgrad span { background-image: linear-gradient(90deg, var(--c1), var(--c2)); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; }
.ch-name.fl-wave span { display: inline-block; animation: fl-wave 2.4s ease-in-out infinite; animation-delay: calc(var(--i) * 70ms); }
@keyframes fl-shimmer { from { background-position: 125% 0; } to { background-position: -125% 0; } }
@keyframes fl-glow { 50% { text-shadow: 0 0 12px color-mix(in srgb, var(--c1, var(--accent)) 90%, transparent); } }
@keyframes fl-wave { 0%, 60%, 100% { transform: none; } 20% { transform: translateY(-2px); } 40% { transform: translateY(1px); } }
html.reduce-motion .ch-name.fl-shimmer, html.reduce-motion .ch-name.fl-glow, html.reduce-motion .ch-name.fl-wave span { animation: none; }
.fx-ripple { position: absolute; border-radius: 8px; box-shadow: 0 0 0 2px var(--rc, var(--accent)), 0 0 18px var(--rc, var(--accent)); will-change: transform, opacity; }
.fx-spark { position: absolute; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: var(--sc, #ffd166); box-shadow: 0 0 6px var(--sc, #ffd166); will-change: transform, opacity; }
/* the flair editor */
.flair-prev { display: flex; align-items: center; justify-content: center; padding: 18px; margin: 4px 0 14px; border-radius: var(--r-l); background: var(--side, var(--panel-2)); }
.flair-prev .ch { width: 230px; cursor: pointer; }
.flair-row { display: flex; gap: 8px; flex-wrap: wrap; }
.flair-row button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.flair-emos { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.flair-emos button { width: 34px; height: 34px; border-radius: 9px; border: 2px solid transparent; background: var(--panel-2); font-size: 1.1rem; cursor: pointer; }
.flair-emos button.on { border-color: var(--accent); }
.flair-emos input { width: 70px; }
/* 7 shop tabs: tighter on wide screens so they all fit; scrolls (with no bar) on phones */
.shop-tabs { scrollbar-width: none; } .shop-tabs::-webkit-scrollbar { display: none; }
@media (min-width: 700px) { .shop-tabs button { padding: 8px 9px; gap: 5px; } }
/* 4.0 try the chat effects */
.fx-try { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; margin: 4px 0 10px; border-radius: var(--r-l); background: var(--panel-2); }
.fx-try-msg .md { display: inline-block; padding: 4px 0; font-weight: 600; transform-origin: left top; }
.fx-try-b { display: flex; flex-wrap: wrap; gap: 4px; }
.fx-try-b button { width: 34px; height: 34px; border-radius: 9px; border: 0; background: var(--panel-3); font-size: 1.1rem; cursor: pointer; transition: transform .12s; }
.fx-try-b button:hover { transform: scale(1.15) rotate(-6deg); }

/* 4.0 speed: decorations that move forever take a break while Sonion Chat isn't the window you're using */
html.lx-still .ch-name.fl-shimmer, html.lx-still .ch-name.fl-glow, html.lx-still .ch-name.fl-wave span,
html.lx-still #away-night .an-stars, html.lx-still .skel-av, html.lx-still .skel-l, html.lx-still .gp-skel i { animation-play-state: paused; }

/* 4.0 Server Achievements */
.ach-img { border-radius: 14px; object-fit: cover; flex: none; background: var(--panel-3); }
.ach-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.ach-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-l); background: var(--panel-2); }
.ach-row.locked .ach-img { filter: grayscale(.85) brightness(.75); }
.ach-i { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ach-i > b { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ach-i > span { color: var(--ink-2); font-size: .9rem; }
.ach-b { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.ach-got { display: inline-flex; align-items: center; gap: 3px; font-size: .72rem; font-weight: 700; padding: 1px 8px 1px 5px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-text); }
.ach-got .ic { width: 12px; height: 12px; }
.ach-bar { display: block; height: 6px; max-width: 280px; border-radius: 99px; background: var(--panel-3); overflow: hidden; margin-top: 4px; }
.ach-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #ffd166); }
.ach-empty { display: flex; align-items: center; gap: 16px; padding: 18px; border-radius: var(--r-l); border: 2px dashed var(--line); }
.ach-edit { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; margin: 6px 0 4px; }
.ach-pic { display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; padding: 10px; border-radius: var(--r-l); background: var(--panel-2); border: 2px dashed var(--line); transition: border-color .15s; }
.ach-pic:hover { border-color: var(--accent); }
.ach-pic > span { display: inline-flex; align-items: center; gap: 5px; font-size: .82rem; color: var(--ink-2); }
.ach-f { flex: 1; min-width: 220px; }
.ach-rules { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; }
.ach-rule { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 10px 12px; border-radius: var(--r-m); background: var(--panel-2); border: 2px solid transparent; color: var(--ink); cursor: pointer; font: inherit; }
.ach-rule small { color: var(--ink-3); font-size: .76rem; }
.ach-rule.on { border-color: var(--accent); background: var(--accent-soft); }
.ach-goal input { max-width: 160px; }
.ach-prev { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.badge-earned.ach em { font-style: normal; font-size: .8rem; color: var(--ink-2); max-width: 300px; }
.badge-earned.ach img { border-radius: 10px; }
.badge-earned.static { position: static; transform: none; align-self: flex-start; }
.badge-earned.static img { animation: none; }
.ach-give h4, .ach-view h4 { margin: 14px 0 6px; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
.ag-q { width: 100%; }
.ag-list { display: flex; flex-direction: column; gap: 2px; max-height: 240px; overflow: auto; margin-top: 6px; }
.ag-row { display: flex; align-items: center; gap: 10px; padding: 5px 6px; border-radius: var(--r-m); }
.ag-row:hover { background: var(--hover); } .ag-row > span { flex: 1; }
.ach-modal header h2 { display: flex; align-items: center; gap: 8px; }
.ach-modal header h2 .ach-img { width: 28px !important; height: 28px !important; border-radius: 8px; }
.ach-show { display: flex; align-items: center; gap: 8px; } .ach-show small { color: var(--ink-3); }
.ach-mine-box .ach-list { margin-top: 4px; } .ach-mine-box .ach-row { cursor: pointer; }
.pc-ach-row { display: flex; gap: 6px; flex-wrap: wrap; }
.pc-ach { display: inline-grid; place-items: center; border-radius: 10px; transition: transform .15s; }
.pc-ach .ach-img { border-radius: 9px; }
.pc-ach:hover { transform: translateY(-2px) scale(1.08); }
.pc-ach.more { width: 30px; height: 30px; background: var(--panel-3); font-size: .75rem; font-weight: 700; color: var(--ink-2); }

/* 4.1 Lite mode (Settings → Appearance → Performance): what costs CPU, GPU and memory, off */
html.lite *, html.lite *::before, html.lite *::after { animation-duration: 0s !important; animation-iteration-count: 1 !important; transition: none !important; }
html.lite #lx-bg::before { animation: none !important; }
html.lite .shell > .side, html.lite .shell > .main, html.lite .shell > .members, html.lite .czp-side, html.lite .czp-main,
html.lite .modal-back, html.lite .upd-screen, html.lite .raid-anim, html.lite .dp-tool { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
html.lite .shell > .side, html.lite .shell > .main, html.lite .shell > .members { background: var(--panel) !important; }
html.lite #fx-layer { display: none; }
html.lite .gif-msg::after { content: '▶'; position: absolute; left: 8px; top: 8px; font-size: .7rem; padding: 2px 6px; border-radius: 99px; background: rgba(0,0,0,.55); color: #fff; pointer-events: none; }
html.lite .gif-msg:hover::after { display: none; }
.perf-banner { position: fixed; z-index: 3000; left: 50%; bottom: 22px; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; max-width: min(640px, calc(100vw - 32px)); padding: 10px 12px 10px 16px; border-radius: 14px; background: var(--panel-3); color: var(--ink); box-shadow: 0 10px 40px rgba(0,0,0,.35); border: 1px solid var(--line); font-size: .9rem; }
.perf-banner span { flex: 1; }

/* 4.1 maintenance screen (everyone except staff) */
#maintenance { position: fixed; inset: 0; z-index: 9000; overflow: hidden; display: grid; place-items: center; color: #eef6f4; text-align: center;
  background: radial-gradient(ellipse at 70% 0%, #3a3f8f 0%, transparent 55%), radial-gradient(ellipse at 20% 10%, #24467a 0%, transparent 50%), linear-gradient(180deg, #121c45 0%, #1b2f5e 45%, #22416a 70%, #0e2233 100%); }
#maintenance .mt-sky { position: absolute; inset: 0; }
#maintenance .mt-sky i { position: absolute; width: var(--s); height: var(--s); border-radius: 50%; background: #fff; opacity: .7; animation: mt-tw var(--d) ease-in-out infinite alternate; }
@keyframes mt-tw { to { opacity: .15; } }
#maintenance .mt-moon { position: absolute; left: 12%; top: 10%; width: min(22vw, 190px); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 34% 34%, #fbfbf5 0%, #e3e6ee 45%, #b8bfd2 100%); box-shadow: 0 0 80px 20px rgba(210, 220, 255, .25), inset -18px -14px 0 rgba(90, 100, 140, .18); }
#maintenance .mt-moon::before, #maintenance .mt-moon::after { content: ''; position: absolute; border-radius: 50%; background: rgba(120, 130, 165, .22); }
#maintenance .mt-moon::before { width: 22%; height: 22%; left: 52%; top: 30%; } #maintenance .mt-moon::after { width: 14%; height: 14%; left: 30%; top: 58%; }
#maintenance .mt-land { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 48vh; }
#maintenance .mt-beam { transform-origin: 720px 168px; animation: mt-beam 7s ease-in-out infinite alternate; }
@keyframes mt-beam { from { transform: rotate(-9deg); } to { transform: rotate(5deg); } }
#maintenance .mt-lamp { animation: mt-lamp 2.4s ease-in-out infinite alternate; } @keyframes mt-lamp { to { opacity: .6; } }
#maintenance .mt-waves { animation: mt-wave 5s ease-in-out infinite alternate; } @keyframes mt-wave { to { transform: translateX(26px); } }
#maintenance .mt-text { position: relative; z-index: 1; padding: 0 20px; margin-top: -14vh; max-width: 760px; }
#maintenance .mt-logo { width: 64px; height: 64px; border-radius: 18px; box-shadow: 0 10px 30px rgba(0,0,0,.35); margin-bottom: 18px; }
#maintenance h1 { font-size: clamp(1.6rem, 4.4vw, 2.9rem); line-height: 1.15; margin: 0 0 6px; font-weight: 600; text-shadow: 0 4px 24px rgba(0,0,0,.35); }
#maintenance .mt-sub { font-size: clamp(1.2rem, 3vw, 2rem); margin: 0 0 18px; opacity: .92; font-weight: 500; }
#maintenance .mt-msg { margin: 0 auto 10px; max-width: 560px; padding: 10px 16px; border-radius: 14px; background: rgba(8, 20, 40, .45); backdrop-filter: blur(6px); }
#maintenance .mt-back { margin: 0; opacity: .75; font-size: .95rem; }
#maintenance .mt-staff { position: absolute; right: 16px; bottom: 14px; z-index: 2; border: 0; background: rgba(255,255,255,.08); color: #cfe3df; padding: 6px 12px; border-radius: 99px; cursor: pointer; font: inherit; font-size: .8rem; }
#maintenance .mt-staff:hover { background: rgba(255,255,255,.16); }
html.reduce-motion #maintenance *, html.lite #maintenance * { animation: none !important; }
html.in-maintenance body > *:not(#maintenance):not(#toasts) { visibility: hidden; }
.mt-banner { position: fixed; z-index: 2900; top: 8px; left: 50%; transform: translateX(-50%); padding: 7px 14px; border-radius: 99px; background: #e3a85a; color: #1d1405; font-size: .85rem; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.mt-banner a { color: inherit; font-weight: 700; }
/* 4.1 profile: first 5 connections, then a button */
.pc-conn-more { display: contents; }
.pc-conn-more[hidden] { display: none; }
.pc-conn-all { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; margin-top: 6px; padding: 8px; border: 1px dashed var(--line); border-radius: var(--r-m); background: none; color: var(--ink-2); font: inherit; font-size: .85rem; cursor: pointer; }
.pc-conn-all:hover { background: var(--hover); color: var(--ink); }
.pc-conn-all .ic { width: 14px; height: 14px; transform: rotate(90deg); transition: transform .15s; } .pc-conn-all.open .ic { transform: rotate(-90deg); }
/* 4.1 pinned DMs */
.dm-row .dm-pin { display: inline-grid; place-items: center; color: var(--ink-3); margin-left: auto; }
.dm-row .dm-pin .ic { width: 13px; height: 13px; transform: rotate(35deg); }
.dm-row.pinned + .dm-row:not(.pinned) { margin-top: 6px; position: relative; }
.dm-row.pinned + .dm-row:not(.pinned)::before { content: ''; position: absolute; left: 10px; right: 10px; top: -4px; border-top: 1px solid var(--line); }
/* 4.1 Settings → About → What's using memory (desktop app) */
.mem-box { margin-top: 18px; padding: 14px; border-radius: var(--r-l); background: var(--panel-2); }
.mem-box h3 { margin: 0 0 4px; }
.mem-total { margin: 10px 0 6px; }
.mem-row { display: grid; grid-template-columns: minmax(150px, 1.5fr) 1.6fr 64px minmax(70px, 120px); align-items: center; gap: 10px; padding: 4px 0; font-size: .88rem; }
.mem-row i { height: 8px; border-radius: 99px; background: linear-gradient(90deg, var(--accent) var(--w), var(--panel-3) var(--w)); }
.mem-row b { text-align: right; } .mem-row small { color: var(--ink-3); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mem-sub { margin: 16px 0 4px; font-size: .95rem; }
.mem-facts { line-height: 1.7; color: var(--ink-2); margin: 4px 0 0; }
@media (max-width: 560px) { .mem-row { grid-template-columns: 1fr 64px; } .mem-row i, .mem-row small { display: none; } }

/* ---------- 5.0 ---------- */
.tag.head { background: linear-gradient(135deg, #5865f2, #fdce89 50%, #fe643a); color: #fff; text-shadow: 0 1px 2px rgba(40, 20, 10, .55); }

/* ---------- 5.0 random events (js/events.js) ---------- */
.lx-event { position: fixed; inset: 0; z-index: 900; pointer-events: none; overflow: hidden; animation: ev-in .6s ease both; }
.lx-event.ending { animation: ev-out .8s ease both; }
@keyframes ev-in { from { opacity: 0; } } @keyframes ev-out { to { opacity: 0; } }
html.in-event #toasts { top: 70px; }
.ev-banner { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 1050; display: flex; align-items: center; gap: 10px; max-width: min(94vw, 720px);
  padding: 8px 8px 8px 14px; border-radius: 99px; background: rgba(12, 20, 24, .88); color: #fff; box-shadow: 0 10px 30px rgba(0,0,0,.35), inset 0 0 0 1px rgba(255,255,255,.12); font-size: .88rem; animation: ev-drop .45s cubic-bezier(.3,1.4,.5,1) both; }
.ev-banner.out { opacity: 0; transform: translate(-50%, -20px); transition: .25s; }
@keyframes ev-drop { from { opacity: 0; transform: translate(-50%, -30px); } }
.ev-emo { font-size: 1.3rem; }
.ev-txt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-pts { font-weight: 800; color: #ffd166; white-space: nowrap; } .ev-pts small { opacity: .6; font-weight: 600; }
.ev-time { font-variant-numeric: tabular-nums; opacity: .75; }
.ev-x { width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: #fff; cursor: pointer; flex: none; }
.ev-x:hover { background: rgba(255,255,255,.22); }
@media (max-width: 640px) { .ev-txt { white-space: normal; font-size: .8rem; line-height: 1.25; } .ev-banner { border-radius: 18px; } }
.ev-c { position: absolute; pointer-events: auto; border: 0; padding: 0; background: none; cursor: pointer; touch-action: manipulation; }
.ev-plus { position: fixed; z-index: 1060; pointer-events: none; font: 800 1.1rem var(--font, sans-serif); color: #ffd166; text-shadow: 0 2px 6px rgba(0,0,0,.5); transform: translate(-50%, -50%); animation: ev-plus .9s ease-out forwards; }
@keyframes ev-plus { to { transform: translate(-50%, -260%); opacity: 0; } }
/* blackout: dark everywhere except a circle of light around your mouse; the lights flicker on the way out */
.lx-event.ev-blackout { background: radial-gradient(circle at var(--x, 50%) var(--y, 50%), transparent 0, transparent 110px, rgba(0, 0, 0, .55) 170px, rgba(2, 3, 6, .955) 260px); animation: ev-flick 1.2s steps(1) both; }
.lx-event.ev-blackout.ending { animation: ev-flick-out .9s steps(1) both; }
@keyframes ev-flick { 0% { opacity: 0; } 10% { opacity: 1; } 18% { opacity: .2; } 26% { opacity: 1; } 34% { opacity: .5; } 42%, 100% { opacity: 1; } }
@keyframes ev-flick-out { 0% { opacity: 1; } 15% { opacity: .2; } 30% { opacity: .9; } 45% { opacity: .1; } 60% { opacity: .7; } 80%, 100% { opacity: 0; } }
.lx-event.ev-blackout.calm { background: rgba(0, 0, 0, .28); animation: ev-in .6s both; }
/* blood moon */
.lx-event.ev-blood_moon { background: radial-gradient(1400px 900px at 85% -10%, rgba(180, 20, 30, .32), transparent 60%), rgba(110, 0, 10, .16); }
.lx-event.ev-blood_moon.calm { background: none; }
.ev-moon { position: absolute; right: 7%; top: 9%; width: 130px; height: 130px; border-radius: 50%; background: radial-gradient(circle at 38% 35%, #ff9a7a, #d1342a 45%, #6b0d12 100%); box-shadow: 0 0 60px 20px rgba(220, 40, 30, .45); animation: ev-rise 3s cubic-bezier(.2,.8,.3,1) both; }
.calm .ev-moon { width: 60px; height: 60px; top: 70px; right: 20px; box-shadow: none; }
@keyframes ev-rise { from { transform: translateY(120px) scale(.8); opacity: 0; } }
.ev-shard { width: 26px; height: 26px; animation: ev-fall var(--life) linear forwards; }
.ev-shard i { display: block; width: 100%; height: 100%; background: linear-gradient(135deg, #ffb3a1, #e0342b 60%, #7a0f15); clip-path: polygon(50% 0, 100% 40%, 70% 100%, 30% 100%, 0 40%); filter: drop-shadow(0 0 6px rgba(255, 80, 60, .9)); animation: ev-spin 2.4s linear infinite; }
@keyframes ev-fall { to { transform: translateY(calc(100vh + 60px)); } }
@keyframes ev-spin { to { transform: rotate(360deg); } }
/* balloons */
.ev-balloon { animation: ev-float var(--life) linear forwards; filter: drop-shadow(0 6px 10px rgba(0,0,0,.25)); }
.ev-balloon svg { display: block; animation: ev-sway 2.6s ease-in-out infinite alternate; }
.ev-balloon.gold svg { filter: drop-shadow(0 0 10px #ffd166); }
@keyframes ev-float { to { transform: translate(var(--sway, 0), calc(-100vh - 120px)); } }
@keyframes ev-sway { from { transform: rotate(-6deg) translateX(-6px); } to { transform: rotate(6deg) translateX(6px); } }
.ev-c.popped { animation: none !important; pointer-events: none; }
.ev-c.popped > * { animation: ev-pop .3s ease-out forwards !important; }
@keyframes ev-pop { to { transform: scale(1.6); opacity: 0; } }
/* fog: thin banks that roll in low along the bottom and the sides (text stays readable; before it was a thick white
   blanket over everything, with the edge of a blob visible as a line) */
.lx-event.ev-fog { background: linear-gradient(0deg, rgba(200, 214, 218, .22), rgba(200, 214, 218, 0) 45%); }
.lx-event.ev-fog i { position: absolute; width: 90vw; height: 70vh; background: radial-gradient(closest-side, rgba(215, 226, 230, .26), rgba(215, 226, 230, .12) 55%, rgba(215, 226, 230, 0)); animation: ev-drift 34s ease-in-out infinite alternate; will-change: transform; }
.lx-event.ev-fog i:nth-child(1) { left: -45vw; bottom: -30vh; } .lx-event.ev-fog i:nth-child(2) { right: -50vw; bottom: -25vh; animation-duration: 41s; animation-delay: -10s; }
.lx-event.ev-fog i:nth-child(3) { left: -10vw; bottom: -45vh; animation-duration: 29s; animation-delay: -5s; } .lx-event.ev-fog i:nth-child(4) { right: -55vw; top: -35vh; animation-duration: 45s; }
.lx-event.ev-fog.calm { background: none; } .lx-event.ev-fog.calm i { background: radial-gradient(closest-side, rgba(215, 226, 230, .1), rgba(215, 226, 230, 0)); }
@keyframes ev-drift { to { transform: translate(14vw, -4vh) scale(1.12); } }
/* low gravity: the newest messages and the reactions float gently */
html.evt-low_gravity:not(.evt-calm) .msgs > .msg:nth-last-child(-n+24) { animation: ev-lowg 3.2s ease-in-out infinite alternate; }
html.evt-low_gravity:not(.evt-calm) .msgs > .msg:nth-last-child(odd) { animation-duration: 2.7s; animation-delay: -1.3s; }
html.evt-low_gravity:not(.evt-calm) .msgs > .msg:nth-last-child(3n) { animation-duration: 3.8s; animation-delay: -.6s; }
@keyframes ev-lowg { from { transform: translateY(2px) rotate(-.25deg); } to { transform: translateY(-5px) rotate(.25deg); } }
/* meteors */
.ev-meteor { width: 34px; height: 34px; animation: ev-streak var(--life) cubic-bezier(.3,.2,.7,1) forwards; }
.ev-meteor i { position: absolute; inset: 8px; border-radius: 50%; background: radial-gradient(circle, #fff, #ffd166 40%, #fe643a 75%); box-shadow: 0 0 14px 4px rgba(255, 140, 60, .8); }
.ev-meteor i::after { content: ''; position: absolute; right: 50%; top: 50%; width: 120px; height: 4px; margin-top: -2px; transform-origin: right center; transform: rotate(-35deg); background: linear-gradient(90deg, transparent, rgba(255, 190, 100, .9)); border-radius: 4px; }
@keyframes ev-streak { from { transform: translate(0, 0); opacity: 0; } 10% { opacity: 1; } to { transform: translate(-60vw, 45vw); opacity: .9; } }
/* disco */
.ev-ball { position: absolute; left: 50%; top: -10px; width: 80px; height: 80px; margin-left: -40px; border-radius: 50%; background: repeating-conic-gradient(#ddd 0 10deg, #8a8f9a 10deg 20deg), #ccc; box-shadow: 0 0 40px rgba(255,255,255,.4); animation: ev-drop2 1s cubic-bezier(.3,1.4,.5,1) both, ev-spin 6s linear infinite; }
@keyframes ev-drop2 { from { transform: translateY(-120px); } }
.ev-lights { position: absolute; inset: -50%; background: conic-gradient(from 0deg, rgba(255, 60, 120, .16), rgba(80, 120, 255, .16), rgba(60, 220, 160, .16), rgba(255, 210, 80, .16), rgba(255, 60, 120, .16)); animation: ev-spin 9s linear infinite; mix-blend-mode: screen; }
.lx-event.ev-disco.calm .ev-lights { display: none; }
.lx-event.ev-disco.calm .ev-ball { width: 44px; height: 44px; margin-left: -22px; top: 60px; }
@media (prefers-reduced-motion: reduce) { .ev-shard i, .ev-balloon svg, .ev-ball, .ev-lights, .lx-event.ev-fog i { animation-duration: 0s !important; } }
.ev-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; margin: 8px 0 14px; }
.ev-type { display: grid; gap: 4px; padding: 12px; border-radius: var(--r-m); background: var(--panel-2); }

/* ---------- 5.0 easter eggs (js/eggs.js) ---------- */
.egg-remix { position: fixed; inset: 0; z-index: 1080; pointer-events: none; }
.egg-hint { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); pointer-events: auto; cursor: pointer; padding: 6px 14px; border-radius: 99px; background: rgba(0,0,0,.7); color: #fff; font-size: .8rem; }
.egg-err { position: absolute; width: 340px; border-radius: 12px; overflow: hidden; background: #f4f6f7; color: #1b2427; box-shadow: 0 18px 40px rgba(0,0,0,.35), 0 0 0 1px rgba(0,0,0,.12); font-size: .85rem; }
.egg-err.wob { animation: ee-wob .21s ease-in-out infinite alternate; }
@keyframes ee-wob { from { transform: skewX(-2deg) scale(1.01); } to { transform: skewX(2deg) scale(.99); } }
.ee-bar { display: flex; align-items: center; gap: 8px; padding: 7px 10px; background: linear-gradient(135deg, #5865f2, #fdce89 50%, #fe643a); color: #fff; text-shadow: 0 1px 2px rgba(40, 20, 10, .55); }
.ee-bar img { width: 16px; height: 16px; border-radius: 4px; } .ee-bar b { font-size: .8rem; } .ee-bar span { margin-left: auto; opacity: .85; }
.ee-body { display: flex; gap: 12px; padding: 14px 14px 6px; } .ee-body p { margin: 2px 0 0; color: #4b5a5e; }
.ee-ic { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #f0aa6a; color: #fff; font-weight: 900; font-size: 1.2rem; }
.ee-btns { display: flex; justify-content: flex-end; gap: 8px; padding: 8px 14px 12px; }
.ee-btns button { min-width: 74px; height: 28px; border-radius: 7px; border: 1px solid #c9d2d4; background: #fff; font: inherit; font-size: .8rem; }
.ee-btns button:first-child { border-color: #5865f2; box-shadow: inset 0 0 0 1px #5865f2; }
.egg-onion { position: fixed; left: 0; bottom: 6px; z-index: 1070; width: 64px; height: 64px; padding: 0; border: 0; background: none; cursor: pointer; }
.egg-onion img { width: 100%; height: 100%; animation: egg-hop .5s ease-in-out infinite alternate; }
.egg-onion.found img { animation: egg-spin .8s ease; }
@keyframes egg-hop { from { transform: translateY(0) rotate(-4deg); } to { transform: translateY(-8px) rotate(4deg); } }
@keyframes egg-spin { to { transform: rotate(360deg) scale(1.3); } }
/* blackout light bulbs: under the darkness (z-index 899 < 900), tiny and grey until your flashlight finds one */
.ev-bulbs { position: fixed; inset: 0; z-index: 899; pointer-events: none; }
.ev-bulb { position: absolute; width: 15px; height: 15px; padding: 1px; border: 0; background: none; color: rgba(150, 160, 160, .55); cursor: pointer; pointer-events: auto; line-height: 0; }
.ev-bulb.lit { color: #ffd84d; filter: drop-shadow(0 0 6px #ffd84d) drop-shadow(0 0 14px #ffb300); transform: scale(1.8) !important; transition: transform .25s cubic-bezier(.3,1.6,.5,1), color .1s; z-index: 1; }
html.evt-blackout .ev-bulbs .ev-bulb.lit { position: absolute; }

/* disco notes */
.ev-note { font: 700 30px/1 var(--font, sans-serif); animation: ev-float var(--life) linear forwards; text-shadow: 0 0 10px currentColor; }
.ev-note span { display: block; animation: ev-sway 1.6s ease-in-out infinite alternate; text-shadow: 0 0 12px currentColor, 0 2px 4px rgba(0,0,0,.4); }

/* shop: events */
.shop-ev-intro { margin: 0 0 14px; }
.shop-ev { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.shop-ev-card { display: grid; gap: 8px; padding: 14px; border-radius: var(--r-l); background: var(--panel-2); position: relative; overflow: hidden; }
.shop-ev-card::before { content: ''; position: absolute; inset: 0 0 auto; height: 3px; background: linear-gradient(90deg, #5865f2, #fdce89 50%, #fe643a); }
.shop-ev-card h4 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 1rem; } .shop-ev-card h4 span { font-size: 1.4rem; }
.shop-ev-card p { margin: 0; font-size: .84rem; color: var(--ink-2); }
.shop-ev-bar { height: 10px; border-radius: 99px; background: var(--panel-3); overflow: hidden; } .shop-ev-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #5865f2, #46c46a 60%, #ff8a4c); transition: width .4s; }
.shop-ev-n { display: flex; justify-content: space-between; font-size: .8rem; color: var(--ink-3); } .shop-ev-n b { color: var(--ink); }
.shop-ev-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.shop-ev-tag { justify-self: start; font-size: .68rem; font-weight: 800; padding: 2px 7px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-text); }
.shop-ev-tag.fun { background: rgba(240, 170, 106, .16); color: #f0aa6a; }

/* ---------- 5.0.1 the "Closed" wall (js/maintenance.js; the website: public/closed.html) ---------- */
#maintenance.wall { background: #10131a; display: grid; place-items: center; padding: 120px 16px 60px; overflow-y: auto; }
.mtw-sky { position: absolute; inset: 0 0 52% 0; background: linear-gradient(180deg, #1a1d55 0%, #3d48c2 32%, #c98f78 74%, #f06a3e 100%); }
.mtw-stars { position: absolute; inset: 0 0 60% 0; pointer-events: none; }
.mtw-stars i { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #fff; opacity: .7; animation: mtw-tw var(--d) ease-in-out infinite alternate; }
@keyframes mtw-tw { to { opacity: .15; } }
.mtw-wall { position: absolute; inset: 48% 0 0 0; background-color: #1d2027; background-size: 120px 60px; box-shadow: inset 0 40px 60px -30px rgba(0,0,0,.6);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='60'%3E%3Cg fill='%233b3f4a'%3E%3Crect x='2' y='2' width='56' height='26' rx='2'/%3E%3Crect x='62' y='2' width='56' height='26' rx='2'/%3E%3Crect x='-28' y='32' width='56' height='26' rx='2'/%3E%3Crect x='32' y='32' width='56' height='26' rx='2'/%3E%3Crect x='92' y='32' width='56' height='26' rx='2'/%3E%3C/g%3E%3Cg fill='%23ffffff' opacity='.05'%3E%3Crect x='2' y='2' width='56' height='4' rx='2'/%3E%3Crect x='62' y='2' width='56' height='4' rx='2'/%3E%3Crect x='32' y='32' width='56' height='4' rx='2'/%3E%3C/g%3E%3C/svg%3E"); }
.mtw-wall::before { content: ''; position: absolute; inset: -14px 0 auto 0; height: 18px; background: linear-gradient(#5a5f6c, #43474f); box-shadow: 0 4px 0 rgba(0,0,0,.35); }
.mtw-wall::after { content: ''; position: absolute; inset: 0; background: radial-gradient(900px 500px at 50% 0%, rgba(255, 170, 110, .18), transparent 70%), linear-gradient(180deg, transparent 50%, rgba(0,0,0,.45)); }
.mtw-onion { position: absolute; left: calc(50% + min(34vw, 300px)); top: calc(48% - 70px); width: 74px; transform: rotate(-4deg); }
.mtw-onion img { width: 100%; display: block; }
.mtw-onion span { position: absolute; left: 62px; top: -6px; font-weight: 700; color: #cfd8ff; opacity: 0; animation: mtw-zz 3.6s ease-in-out infinite; }
.mtw-onion span:nth-of-type(2) { animation-delay: 1.2s; left: 72px; } .mtw-onion span:nth-of-type(3) { animation-delay: 2.4s; left: 80px; }
@keyframes mtw-zz { 0% { opacity: 0; transform: translate(0,0) scale(.6); } 30% { opacity: .9; } 100% { opacity: 0; transform: translate(18px,-40px) scale(1.2); } }
@media (max-width: 720px) { .mtw-onion { left: auto; right: 12px; width: 56px; top: calc(48% - 54px); } }
.mtw-hang { position: relative; width: min(640px, 100%); transform-origin: 50% -90px; animation: mtw-sway 6s ease-in-out infinite alternate; }
@keyframes mtw-sway { from { transform: rotate(-1.2deg); } to { transform: rotate(1.2deg); } }
.mtw-hang::before, .mtw-hang::after { content: ''; position: absolute; top: -92px; width: 3px; height: 96px; background: linear-gradient(#9aa0aa, #6c717c); }
.mtw-hang::before { left: 22%; transform: rotate(8deg); transform-origin: bottom; } .mtw-hang::after { right: 22%; transform: rotate(-8deg); transform-origin: bottom; }
.mtw-nail { position: absolute; top: -100px; left: 50%; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #e8e8e8, #7d828c); }
.mtw-sign { position: relative; border-radius: 22px; padding: 30px 30px 26px; text-align: center; color: #1b2427; background: linear-gradient(180deg, #fbf7ef, #efe6d6); box-shadow: 0 30px 60px rgba(0,0,0,.45), 0 0 0 6px #6b4a2b, 0 0 0 9px #4b321c; }
.mtw-sign::before { content: ''; position: absolute; inset: 0 0 auto; height: 6px; border-radius: 22px 22px 0 0; background: linear-gradient(90deg, #5865f2, #fdce89 50%, #fe643a); }
.mtw-tag { display: inline-flex; align-items: center; gap: 8px; padding: 5px 14px; border-radius: 99px; background: #1b2427; color: #fff; font-weight: 800; letter-spacing: .14em; font-size: .78rem; text-transform: uppercase; }
.mtw-tag img { width: 20px; height: 20px; border-radius: 6px; }
.mtw-sign h1 { margin: 16px 0 6px; font-size: clamp(1.6rem, 5vw, 2.4rem); line-height: 1.12; letter-spacing: -.02em; color: #1b2427; }
.mtw-until, .mtw-msg { margin: 0; color: #3d4b4f; } .mtw-until { font-size: 1.1rem; } .mtw-until b { color: #1b2427; }
.mtw-msg { margin: 14px auto 0; max-width: 34em; white-space: pre-line; }
.mtw-count { display: flex; justify-content: center; gap: 10px; margin: 22px 0 6px; }
.mtw-count div { min-width: 74px; padding: 10px 6px 8px; border-radius: 14px; background: #1b2427; color: #fff; }
.mtw-count b { display: block; font-size: 1.9rem; line-height: 1; font-variant-numeric: tabular-nums; }
.mtw-count small { display: block; margin-top: 4px; font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: #a9bab5; }
@media (max-width: 420px) { .mtw-count { gap: 6px; } .mtw-count div { min-width: 0; flex: 1; } .mtw-count b { font-size: 1.5rem; } .mtw-sign { padding: 26px 18px 22px; } }
.mtw-thanks { margin: 14px 0 0; font-weight: 600; color: #1b2427; }
#maintenance.wall .mt-staff { z-index: 1; }
html.reduce-motion .mtw-hang, html.reduce-motion .mtw-stars i, html.reduce-motion .mtw-onion span { animation: none; }
#maintenance.wall .mtw-sign h1 { text-shadow: none; font-size: clamp(1.6rem, 5vw, 2.4rem); line-height: 1.12; margin: 16px 0 6px; color: #1b2427; font-weight: 700; }
