/* Night_Hub theme 🌙 — change the colors here to make it yours */
:root {
  --bg0: #090c18;   /* darkest */
  --bg1: #0f1326;
  --bg2: #161b33;
  --bg3: #1f2547;
  --bg4: #2a3160;   /* lightest panel */
  --text: #e8eaf6;
  --muted: #9299bf;
  --accent: #8b7cff;   /* purple */
  --accent2: #ff7ad9;  /* pink */
  --green: #3ddc84;
  --red: #ff5c7a;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: var(--bg0); color: var(--text); font-size: 15px; overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
input, textarea { font: inherit; }
a { color: #7cc4ff; }
[hidden] { display: none !important; }
.screen { position: fixed; inset: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.row { display: flex; gap: 8px; align-items: center; }
.row.end { justify-content: flex-end; margin-top: 8px; }
.spacer { flex: 1; }

/* ---------- login screen ---------- */
#auth { display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at top, #1b2150 0%, var(--bg0) 60%); }
.stars { position: absolute; inset: 0; animation: twinkle 4s ease-in-out infinite alternate; background-image:
  radial-gradient(1.5px 1.5px at 20% 30%, #fff8, transparent), radial-gradient(1px 1px at 70% 20%, #fff6, transparent),
  radial-gradient(1.5px 1.5px at 40% 80%, #fff7, transparent), radial-gradient(1px 1px at 85% 65%, #fff5, transparent),
  radial-gradient(1px 1px at 10% 70%, #fff6, transparent), radial-gradient(1.5px 1.5px at 55% 50%, #fff5, transparent),
  radial-gradient(1px 1px at 92% 10%, #fff7, transparent), radial-gradient(1px 1px at 30% 10%, #fff5, transparent),
  radial-gradient(1.5px 1.5px at 65% 90%, #fff6, transparent), radial-gradient(1px 1px at 5% 15%, #fff5, transparent); }
@keyframes twinkle { from { opacity: .4; } to { opacity: 1; } }
.card { position: relative; background: var(--bg2); padding: 32px; border-radius: 16px; width: 360px; max-width: 92vw; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 20px 60px #0008; }
.logo { font-size: 30px; font-weight: 800; text-align: center; background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.card input { background: var(--bg0); border: 1px solid var(--bg4); color: var(--text); padding: 12px; border-radius: 8px; outline: none; width: 100%; }
.card input:focus { border-color: var(--accent); }
.btn { padding: 10px 16px; border-radius: 8px; background: var(--bg4); font-weight: 600; transition: filter .15s; }
.btn:hover { filter: brightness(1.15); }
.btn.primary { background: linear-gradient(90deg, var(--accent), #6e5cf5); }
.btn.danger { background: var(--red); color: #fff; }
.btn.small { padding: 6px 10px; font-size: 13px; }
.error { color: var(--red); font-size: 13px; min-height: 16px; }

/* ---------- app layout ---------- */
#app { display: grid; grid-template-columns: 72px 240px 1fr auto; grid-template-rows: 100%; }

/* server bar (left column) */
#serverBar { background: var(--bg0); display: flex; flex-direction: column; align-items: center; padding: 12px 0; gap: 8px; overflow-y: auto; }
#serverList { display: flex; flex-direction: column; gap: 8px; }
.server-icon { width: 48px; height: 48px; border-radius: 24px; background: var(--bg2); font-size: 22px; display: flex; align-items: center; justify-content: center; transition: border-radius .2s, background .2s; position: relative; }
.server-icon:hover, .server-icon.active { border-radius: 14px; background: var(--accent); }
.server-icon.add { color: var(--green); font-size: 24px; }
.server-icon.add:hover { background: var(--green); color: #000; }
.server-icon.unread::before { content: ''; position: absolute; left: -12px; top: 18px; width: 6px; height: 12px; border-radius: 3px; background: #fff; }
.sep { width: 32px; height: 2px; background: var(--bg3); border-radius: 1px; }

/* channel sidebar */
#sidebar { background: var(--bg1); display: flex; flex-direction: column; min-width: 0; }
#sidebarHeader { height: 48px; display: flex; align-items: center; justify-content: space-between; padding: 0 8px 0 4px; box-shadow: 0 1px 0 #0006; }
#sidebarTitle { font-weight: 700; padding: 6px 8px; border-radius: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; text-align: left; }
#sidebarTitle:hover { background: var(--bg3); }
.hdr-actions { display: flex; gap: 2px; flex: none; }
.icon-btn { width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: 16px; color: var(--muted); flex: none; }
.icon-btn:hover { background: var(--bg3); color: var(--text); }
.icon-btn.active { color: var(--accent2); }
#channelList { flex: 1; min-height: 0; overflow-y: auto; padding: 8px; }
.section { display: flex; justify-content: space-between; align-items: center; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 12px 4px 4px; font-weight: 700; }
.section .mini { color: var(--muted); font-size: 18px; line-height: 1; padding: 0 4px; }
.section .mini:hover { color: var(--text); }
.chan { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; color: var(--muted); cursor: pointer; position: relative; }
.chan:hover { background: var(--bg2); color: var(--text); }
.chan.active { background: var(--bg3); color: var(--text); }
.chan.unread { color: var(--text); font-weight: 600; }
.chan.unread::before { content: ''; position: absolute; left: -8px; top: 10px; width: 4px; height: 12px; border-radius: 2px; background: #fff; }
.chan .uname { font-weight: 600; }
.hash { color: var(--muted); font-weight: 700; width: 18px; text-align: center; flex: none; }
.voice-user { display: flex; align-items: center; gap: 6px; padding: 3px 8px 3px 34px; font-size: 13px; color: var(--muted); }
.hint { font-size: 13px; color: var(--muted); padding: 6px 8px; line-height: 1.4; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #5a6080; flex: none; }
.dot.on { background: var(--green); }
#voicePanel { padding: 10px 12px; background: var(--bg2); border-top: 1px solid var(--bg3); }
.voice-title { color: var(--green); font-weight: 700; font-size: 13px; }
.voice-name { font-size: 12px; color: var(--muted); margin: 2px 0 8px; }
#userPanel { display: flex; align-items: center; gap: 8px; padding: 8px; background: var(--bg0); }
.me { flex: 1; min-width: 0; }
.me .name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me .status { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 20px; flex: none; }
.avatar.sm { width: 28px; height: 28px; font-size: 15px; }
.avatar.xs { width: 20px; height: 20px; font-size: 11px; }
.avatar.big { width: 56px; height: 56px; font-size: 30px; background: var(--bg4); }
.avatar.picker:hover { outline: 2px solid var(--accent); }
.uname { font-weight: 700; }

/* chat */
#chat { display: flex; flex-direction: column; background: var(--bg2); min-width: 0; }
#chatHeader { height: 48px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; font-weight: 700; box-shadow: 0 1px 0 #0006; flex: none; }
#chatTitle { display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; flex: 1; white-space: nowrap; }
#messages { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 0 8px; }
.empty { padding: 40px 20px; color: var(--muted); text-align: center; line-height: 1.5; }
.msg { display: flex; gap: 14px; padding: 2px 16px; position: relative; margin-top: 14px; }
.msg.grouped { margin-top: 0; }
.msg:hover { background: #0002; }
.msg > .avatar { margin-top: 2px; }
.ts-mini { width: 36px; flex: none; font-size: 10px; color: var(--muted); text-align: center; opacity: 0; padding-top: 5px; }
.msg:hover .ts-mini { opacity: 1; }
.body { flex: 1; min-width: 0; }
.meta { display: flex; align-items: baseline; gap: 8px; }
.ts { font-size: 11px; color: var(--muted); }
.content { overflow-wrap: anywhere; line-height: 1.4; }
.content code { background: var(--bg0); padding: 1px 5px; border-radius: 4px; font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.jumbo { font-size: 40px; line-height: 1.2; }
.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.reaction { background: var(--bg3); border: 1px solid transparent; border-radius: 8px; padding: 2px 8px; font-size: 13px; }
.reaction:hover { border-color: var(--muted); }
.reaction.mine { border-color: var(--accent); background: #8b7cff33; }
.actions { position: absolute; right: 16px; top: -12px; display: none; gap: 2px; background: var(--bg3); border-radius: 6px; padding: 2px; box-shadow: 0 2px 6px #0006; }
.msg:hover .actions { display: flex; }
.act { padding: 2px 6px; border-radius: 4px; font-size: 14px; }
.act:hover { background: var(--bg4); }
#typing { height: 20px; font-size: 12px; color: var(--muted); padding: 0 16px; flex: none; }
#composer { display: flex; align-items: flex-end; gap: 4px; margin: 0 16px 16px; background: var(--bg3); border-radius: 10px; padding: 4px 8px; flex: none; }
#msgInput { flex: 1; background: none; border: none; outline: none; color: var(--text); padding: 10px 6px; min-width: 0; resize: none; max-height: 160px; line-height: 1.4; }
#composer .icon-btn { margin-bottom: 4px; }

/* members list */
#members { width: 220px; background: var(--bg1); overflow-y: auto; padding: 8px; }
.member { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px; cursor: pointer; min-width: 0; }
.member:hover { background: var(--bg2); }
.member > div { min-width: 0; overflow: hidden; }
.member .status { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member.off { opacity: .45; }

/* emoji picker */
#emojiPicker { position: fixed; width: 320px; height: 360px; background: var(--bg1); border: 1px solid var(--bg3); border-radius: 12px; box-shadow: 0 12px 40px #000a; display: flex; flex-direction: column; z-index: 50; padding: 8px; }
#emojiSearch { background: var(--bg0); border: 1px solid var(--bg4); border-radius: 6px; color: var(--text); padding: 8px; outline: none; }
#emojiTabs { display: flex; gap: 2px; margin: 6px 0; }
.etab { flex: 1; padding: 4px 0; border-radius: 6px; font-size: 18px; opacity: .55; }
.etab.active, .etab:hover { background: var(--bg3); opacity: 1; }
#emojiGrid { flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; align-content: start; }
.e { font-size: 22px; padding: 4px 0; border-radius: 6px; line-height: 1.2; }
.e:hover { background: var(--bg3); transform: scale(1.2); }

/* pop-up windows */
#modal { position: fixed; inset: 0; background: #000a; display: flex; align-items: center; justify-content: center; z-index: 40; }
.modal-card { background: var(--bg2); padding: 24px; border-radius: 14px; width: 440px; max-width: 92vw; max-height: 90vh; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.modal-card h2 { margin: 0; }
.modal-card p { margin: 0; line-height: 1.4; }
.modal-card input:not([type=checkbox]):not([type=color]) { background: var(--bg0); border: 1px solid var(--bg4); color: var(--text); padding: 10px; border-radius: 8px; outline: none; flex: 1; min-width: 0; width: 100%; }
.modal-card input:focus { border-color: var(--accent); }
.modal-card input[type=color] { width: 44px; height: 32px; border: none; background: none; padding: 0; cursor: pointer; }
.modal-card label { font-size: 13px; color: var(--muted); }
.switch { display: flex; align-items: center; gap: 8px; color: var(--text) !important; font-size: 15px !important; cursor: pointer; }
.switch input { width: 18px; height: 18px; accent-color: var(--accent); }
.code { font-family: ui-monospace, Menlo, monospace; font-size: 28px; letter-spacing: 4px; background: var(--bg0); padding: 12px; border-radius: 8px; text-align: center; user-select: all; }
.seg { display: flex; gap: 4px; }
.seg button { flex: 1; padding: 8px; border-radius: 8px; background: var(--bg3); }
.seg button.sel { background: var(--accent); }
.preview { padding: 10px; background: var(--bg0); border-radius: 8px; }

/* toasts */
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 60; pointer-events: none; }
.toast { background: var(--bg4); padding: 10px 16px; border-radius: 8px; box-shadow: 0 6px 20px #0008; opacity: 0; transform: translateY(10px); transition: .25s; }
.toast.show { opacity: 1; transform: none; }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 4px; }

/* phones & small windows: show EITHER the channel list OR the chat, with a back button */
#backBtn { display: none; font-size: 22px; }
@media (max-width: 700px) {
  #app { grid-template-columns: 60px 1fr; }
  #chat, #members { display: none; }
  body.show-chat #app { grid-template-columns: 1fr; }
  body.show-chat #serverBar, body.show-chat #sidebar { display: none; }
  body.show-chat #chat { display: flex; }
  #backBtn { display: inline-flex; }
  #chatHeader { padding: 0 8px; }
  .server-icon { width: 44px; height: 44px; font-size: 20px; }
  #emojiPicker { width: 92vw; left: 4vw !important; }
  .msg { gap: 10px; padding: 2px 10px; }
  #composer { margin: 0 8px 8px; }
}

/* friends */
.add-friend-btn { width: 100%; margin: 8px 0 4px; padding: 8px; }
.req-actions { margin-left: auto; display: flex; gap: 2px; flex: none; }
.req-actions .mini { width: 26px; height: 26px; border-radius: 6px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.req-actions .mini:hover { background: var(--bg3); }
.mini.ok { color: var(--green); }
.mini.no { color: var(--red); }
.hover-only { opacity: 0; }
.chan:hover .hover-only { opacity: 1; }

/* personal calls */
#callBtn.active { background: var(--red); color: #fff; }
#callBtn.active:hover { filter: brightness(1.15); }
.btn.success { background: var(--green); color: #05130b; }
.call-card { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 8px 0; }
.call-card .avatar.big { width: 80px; height: 80px; font-size: 42px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 #3ddc8466; } 50% { box-shadow: 0 0 0 14px #3ddc8400; } }

/* Friends page */
.fpage { padding: 8px 20px 20px; max-width: 720px; }
.fpage h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 20px 0 8px; }
.fcard { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--bg1); margin-bottom: 6px; }
.fcard:hover { background: var(--bg3); }
.finfo { flex: 1; min-width: 0; }
.finfo .on { color: var(--green); }
.factions { display: flex; gap: 6px; flex: none; flex-wrap: wrap; justify-content: flex-end; }
.modal-card select { flex: 1; min-width: 0; background: var(--bg0); border: 1px solid var(--bg4); color: var(--text); padding: 9px; border-radius: 8px; outline: none; font: inherit; }

/* ---------- iMessage-style bubbles (DMs) ---------- */
.msg.bubble { margin-top: 8px; padding: 1px 16px; }
.msg.bubble.grouped { margin-top: 2px; }
.msg.bubble:hover { background: none; }
.msg.bubble .body { flex: 0 1 auto; max-width: min(70%, 520px); }
.msg.bubble .content { display: inline-block; padding: 8px 14px; border-radius: 18px; background: var(--bg3); text-align: left; }
.msg.bubble.theirs .content { border-bottom-left-radius: 6px; }
.msg.bubble.mine { justify-content: flex-end; }
.msg.bubble.mine .body { text-align: right; }
.msg.bubble.mine .content { background: linear-gradient(135deg, var(--accent), #6e5cf5); color: #fff; border-bottom-right-radius: 6px; }
.msg.bubble.mine .content a { color: #dff; }
.msg.bubble.mine .content code { background: #0004; }
.msg.bubble .content:has(.jumbo) { background: none; padding: 0; }
.msg.bubble .reactions { margin-top: 2px; }
.msg.bubble.mine .reactions { justify-content: flex-end; }
.bmeta { display: none; font-size: 10px; color: var(--muted); padding: 2px 6px 0; }
.msg.bubble:hover .bmeta { display: block; }
.msg.bubble.mine .actions { right: auto; left: 16px; }
.msg.bubble .actions { top: -6px; }

/* new messages spring into place — mine from the right, theirs from the left */
@keyframes popMine   { from { opacity: 0; transform: translate(48px, 26px) scale(.8); } 65% { opacity: 1; transform: translate(-3px, -2px) scale(1.03); } to { opacity: 1; transform: none; } }
@keyframes popTheirs { from { opacity: 0; transform: translate(-48px, 26px) scale(.8); } 65% { opacity: 1; transform: translate(3px, -2px) scale(1.03); } to { opacity: 1; transform: none; } }
.msg.pop { animation: popTheirs .42s cubic-bezier(.22, 1, .36, 1) both; transform-origin: bottom left; }
.msg.pop.mine { animation-name: popMine; transform-origin: bottom right; }
@media (prefers-reduced-motion: reduce) { .msg.pop { animation: none; } }
.chan .cname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mlist { max-height: 40vh; overflow-y: auto; }
.mrow { cursor: pointer; }
.mrow .req-actions .mini { font-size: 14px; }

/* ---------- call stage: camera + screen share tiles ---------- */
.row.wrap { flex-wrap: wrap; }
#stage { flex: none; background: var(--bg0); padding: 8px 12px; display: flex; flex-direction: column; gap: 8px; max-height: 55%; box-shadow: 0 1px 0 #0006; }
#stageGrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; overflow-y: auto; }
#stageGrid.many { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.tile { position: relative; aspect-ratio: 16 / 9; background: var(--bg1); border-radius: 12px; overflow: hidden; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.tile video { width: 100%; height: 100%; object-fit: cover; }
.tile.mirror video { transform: scaleX(-1); }
.tile.screen video { object-fit: contain; background: #000; }
.tile.av .avatar.big { width: 64px; height: 64px; font-size: 34px; }
.tile.focus { grid-column: 1 / -1; aspect-ratio: auto; height: min(45vh, 420px); }
.tile.focus video { object-fit: contain; background: #000; }
.tlabel { position: absolute; left: 8px; bottom: 8px; font-size: 12px; font-weight: 600; background: #000a; padding: 3px 8px; border-radius: 6px; pointer-events: none; }
.stage-bar { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.stage-bar .btn.active, #voicePanel .btn.active { background: var(--green); color: #05130b; }
@media (max-width: 700px) { #stage { max-height: 50%; padding: 6px 8px; } #stageGrid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); } }
.modal-card h2.row { gap: 12px; }
.modal-card h2 .avatar.big { background: var(--bg4); }

/* picture icons + drag-and-drop zone */
.sicon { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.server-icon { padding: 0; }
.avatar.big .sicon, .avatar .sicon { border-radius: 50%; }
.dropzone { border: 2px dashed var(--bg4); border-radius: 10px; padding: 14px; text-align: center; color: var(--muted); font-size: 13px; cursor: pointer; transition: .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: #8b7cff1a; color: var(--text); }

/* unread number badges */
.av-wrap { position: relative; display: inline-flex; flex: none; }
.nbadge { position: absolute; top: -5px; right: -7px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--bg1); pointer-events: none; }
.nbadge.inline { position: static; box-shadow: none; margin-left: 6px; }
.server-icon .nbadge { top: -4px; right: -6px; box-shadow: 0 0 0 2px var(--bg0); }
.server-icon.unread::before { display: none; }   /* the number replaces the little white pip */
.fcard .av-wrap .nbadge { box-shadow: 0 0 0 2px var(--bg2); }
#userSearch { width: 100%; background: var(--bg0); border: 1px solid var(--bg4); color: var(--text); padding: 12px 14px; border-radius: 10px; outline: none; margin-top: 8px; font-size: 15px; }
#userSearch:focus { border-color: var(--accent); }

/* notifications */
.nlist { max-height: 55vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.notif { padding: 10px 12px; border-radius: 8px; background: var(--bg1); cursor: pointer; display: flex; gap: 10px; align-items: baseline; }
.notif:hover { background: var(--bg3); }
.notif.unread { background: var(--bg3); border-left: 3px solid var(--accent); }
.notif .ntext { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.notif .ts { flex: none; font-size: 11px; color: var(--muted); }
.notif { align-items: center; }
.notif .nfrom { font-size: 14px; margin-bottom: 1px; }
#nSearch { background: var(--bg0); border: 1px solid var(--bg4); color: var(--text); padding: 9px 12px; border-radius: 8px; outline: none; }
#nSearch:focus { border-color: var(--accent); }

/* ---------- Home dashboard ---------- */
.home { padding: 12px 24px 24px; max-width: 900px; }
.home h1 { font-size: 26px; margin: 8px 0 4px; }
.home h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 22px 0 8px; }
.quick { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.ptile { background: var(--bg1); border-radius: 12px; padding: 14px 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; cursor: pointer; transition: .15s; }
.ptile:hover { background: var(--bg3); transform: translateY(-2px); }
.ptile .avatar { width: 52px; height: 52px; font-size: 28px; }
.ptile .pname { font-weight: 700; }
.ptile .pstatus { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rrow { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--bg1); margin-bottom: 4px; cursor: pointer; }
.rrow:hover { background: var(--bg3); }
.rrow.unread { border-left: 3px solid var(--accent); }
.rinfo { flex: 1; min-width: 0; }
.rprev { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rrow .ts { flex: none; font-size: 11px; color: var(--muted); }
.link { color: var(--accent); cursor: pointer; text-decoration: underline; }
@media (max-width: 700px) { .home { padding: 8px 12px 20px; } .home h1 { font-size: 22px; } }

/* Home extras */
#messages .home { position: relative; }
.stars-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
#messages .home > *:not(.stars-fx) { position: relative; z-index: 1; }


/* profile page */
.avatar.xl { width: 96px; height: 96px; font-size: 52px; }
.prof-top { display: flex; align-items: center; gap: 16px; }
.ptabs { display: flex; gap: 6px; flex-wrap: wrap; }
.ptab { background: var(--bg1); border-radius: 10px; padding: 10px; }
.avrow { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.avrow label { width: 52px; flex: none; }
.avopts { display: flex; gap: 4px; flex-wrap: wrap; }
.avopt { padding: 4px 8px; border-radius: 8px; background: var(--bg3); font-size: 12px; border: 2px solid transparent; }
.avopt.sel { border-color: var(--accent); }
.swatch { display: block; width: 18px; height: 18px; border-radius: 50%; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 500px) { .grid2 { grid-template-columns: 1fr; } }
/* admin panel */
.tiles.stats .ptile { cursor: default; }
.tiles.stats .ptile:hover { transform: none; background: var(--bg1); }
.big { font-size: 28px; font-weight: 800; }
.rrow.susp { opacity: .55; }
.admsrv { background: var(--bg1); border-radius: 10px; padding: 10px; margin-bottom: 8px; }
.admchans { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.admsgs { display: flex; flex-direction: column; gap: 6px; }
.admsg { display: flex; gap: 10px; align-items: flex-start; padding: 8px; border-radius: 8px; background: var(--bg1); }
.admsg:hover .hover-only { opacity: 1; }
.admsg .ts { font-size: 11px; color: var(--muted); margin-left: 6px; }
.admchan { display: inline-flex; align-items: center; gap: 2px; background: var(--bg2); border-radius: 8px; padding: 2px; }
.gpage input:not([type=color]):not([type=checkbox]) { background: var(--bg0); border: 1px solid var(--bg4); color: var(--text); padding: 10px 12px; border-radius: 8px; outline: none; flex: 1; min-width: 0; }
.gpage input:focus { border-color: var(--accent); }
.admin-top { width: auto; padding: 0 10px; gap: 6px; font-size: 13px; font-weight: 700; background: linear-gradient(90deg, var(--accent), var(--accent2)); color: #fff; }
.admin-top:hover { filter: brightness(1.15); color: #fff; }
.admin-top.active { outline: 2px solid #fff8; }

/* keep emoji icons dead-centre in their circles (emoji glyphs sit low in a normal line box) */
.server-icon, .icon-btn { line-height: 1; padding: 0; }
.server-icon > .nbadge { line-height: 18px; }

/* 3D avatar builder */
.modal-card.wide { width: 760px; }
.av3d-wrap { display: flex; gap: 12px; align-items: flex-start; }
.av3d-view { width: 260px; height: 330px; flex: none; background: radial-gradient(circle at 50% 30%, #2a3160, var(--bg0)); border-radius: 12px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.av3d-view canvas { display: block; }
.av3d-view.card3d { width: 200px; height: 240px; margin: 0 auto; }
.av3d-opts { flex: 1; min-width: 0; max-height: 330px; overflow-y: auto; padding-right: 4px; }
.avrow label { width: 84px; font-size: 12px; }
.avopt.sw { padding: 3px; }
.avcustom { display: inline-flex; align-items: center; gap: 2px; font-size: 14px; cursor: pointer; width: auto; }
.avcustom input[type=color] { width: 22px; height: 22px; padding: 0; border: none; background: none; cursor: pointer; }
@media (max-width: 700px) { .av3d-wrap { flex-direction: column; align-items: center; } .av3d-opts { max-height: none; width: 100%; } }
.avsec { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--accent2); margin: 10px 0 4px; font-weight: 800; }
.avsec:first-child { margin-top: 0; }
.av3d-view { width: 280px; height: 380px; }
.av3d-opts { max-height: 380px; }
.modal-card.wide { width: 820px; }


/* ---------- landing page ---------- */
#landing { overflow-y: auto; overflow-x: hidden; background: radial-gradient(ellipse at top, #1b2150 0%, var(--bg0) 55%); scroll-behavior: smooth; }
#landing .stars { position: fixed; }
.orb { position: fixed; border-radius: 50%; filter: blur(80px); opacity: .35; pointer-events: none; animation: drift 18s ease-in-out infinite alternate; }
.orb1 { width: 420px; height: 420px; background: #8b7cff; top: -120px; left: -120px; }
.orb2 { width: 360px; height: 360px; background: #ff7ad9; top: 40%; right: -140px; animation-delay: -6s; }
.orb3 { width: 300px; height: 300px; background: #3ddc84; bottom: -120px; left: 30%; animation-delay: -12s; opacity: .2; }
@keyframes drift { from { transform: translate(0, 0) scale(1); } to { transform: translate(60px, 40px) scale(1.15); } }
.land-nav { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 28px; max-width: 1180px; margin: 0 auto; backdrop-filter: blur(12px); }
.land-logo { font-size: 22px; font-weight: 800; background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.land-links { display: flex; gap: 18px; }
.land-links a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; }
.land-links a:hover { color: var(--text); }
.land-nav nav:last-child { display: flex; gap: 8px; }
.land-hero { position: relative; display: grid; grid-template-columns: 1.1fr 1fr; gap: 30px; align-items: center; padding: 50px 28px 20px; max-width: 1180px; margin: 0 auto; }
.pill-tag { display: inline-block; background: #8b7cff22; border: 1px solid #8b7cff55; color: #c7c0ff; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; margin-bottom: 18px; }
.land-hero h1 { font-size: clamp(38px, 5.4vw, 66px); line-height: 1.02; margin: 0 0 18px; letter-spacing: -1.5px; }
.grad { background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.land-hero p { font-size: 18px; color: var(--muted); max-width: 520px; margin: 0 0 26px; line-height: 1.55; }
.land-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.btn.big { padding: 14px 26px; font-size: 17px; border-radius: 12px; }
.btn.primary.big { box-shadow: 0 10px 30px #8b7cff55; }
.hero-stats { display: flex; gap: 28px; margin-top: 30px; }
.hero-stats div { display: flex; flex-direction: column; } .hero-stats b { font-size: 22px; } .hero-stats span { color: var(--muted); font-size: 13px; }
.hero-visual { position: relative; min-height: 460px; }
.land-chat { position: absolute; left: 0; top: 30px; width: min(360px, 90%); background: var(--bg2); border-radius: 16px; padding: 14px; box-shadow: 0 30px 80px #0009; transform: rotate(-2deg); z-index: 2; }
.lc-head { font-size: 12px; color: var(--muted); font-weight: 700; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.land-msg { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; }
.land-msg.pop { animation: popTheirs .45s cubic-bezier(.22, 1, .36, 1) both; }
.land-av, .lc-av { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 18px; flex: none; }
.lc-typing { display: flex; gap: 4px; padding: 8px 6px 2px; } .lc-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1s infinite; } .lc-typing span:nth-child(2) { animation-delay: .2s; } .lc-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.land-call { position: absolute; right: 0; top: 0; display: flex; align-items: center; gap: 10px; background: var(--bg3); border-radius: 14px; padding: 10px 12px; box-shadow: 0 20px 50px #000a; z-index: 3; opacity: 0; transform: translateY(-20px) scale(.9); transition: .4s cubic-bezier(.22, 1, .36, 1); }
.land-call.show { opacity: 1; transform: none; }
.lc-btns { display: flex; gap: 6px; margin-left: 6px; } .lc-btns span { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; } .lc-no { background: var(--red); } .lc-yes { background: var(--green); animation: pulse 1.2s infinite; }
.hero-avatar { position: absolute; right: 10px; bottom: 0; width: 240px; height: 300px; z-index: 1; }
.hero-avatar canvas { filter: drop-shadow(0 20px 30px #0008); }
.marquee { overflow: hidden; border-top: 1px solid #ffffff10; border-bottom: 1px solid #ffffff10; margin: 30px 0 0; padding: 12px 0; background: #ffffff05; position: relative; }
.marquee-track { display: flex; gap: 40px; width: max-content; animation: marquee 30s linear infinite; font-weight: 700; color: var(--muted); white-space: nowrap; }
@keyframes marquee { to { transform: translateX(-50%); } }
.land-section { position: relative; max-width: 1100px; margin: 0 auto; padding: 70px 28px 10px; text-align: center; }
.land-section h2 { font-size: clamp(28px, 4vw, 44px); margin: 0 0 8px; letter-spacing: -1px; }
.land-section .sub { color: var(--muted); font-size: 17px; margin: 0 0 28px; }
.land-features { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; text-align: left; }
.feat { background: #ffffff08; border: 1px solid #ffffff12; border-radius: 16px; padding: 22px; transition: transform .2s, border-color .2s, box-shadow .2s; }
.feat:hover { transform: translateY(-4px); border-color: #8b7cff88; box-shadow: 0 20px 50px #8b7cff22; }
.feat-emoji { font-size: 34px; } .feat h3 { margin: 10px 0 6px; } .feat p { margin: 0; color: var(--muted); line-height: 1.5; font-size: 14px; }
.feat code { background: var(--bg0); padding: 1px 5px; border-radius: 4px; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; text-align: left; margin-top: 24px; }
.step { background: #ffffff08; border-radius: 16px; padding: 22px; position: relative; }
.step-n { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.step h3 { margin: 0 0 6px; } .step p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.avatar-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.avatar-card { height: 300px; background: radial-gradient(circle at 50% 30%, #2a3160, var(--bg0)); border-radius: 16px; overflow: hidden; }
.parents .feat { border-color: #3ddc8433; }
.land-final { position: relative; text-align: center; padding: 90px 28px 40px; }
.land-final h2 { font-size: clamp(30px, 5vw, 50px); margin: 0 0 8px; } .land-final .sub { color: var(--muted); font-size: 17px; margin-bottom: 24px; }
.land-final .land-cta { justify-content: center; }
.land-foot { position: relative; text-align: center; color: var(--muted); font-size: 13px; padding: 20px 20px 40px; }
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s, transform .6s; }
.reveal.in { opacity: 1; transform: none; }
@media (max-width: 900px) { .land-hero { grid-template-columns: 1fr; text-align: center; padding-top: 30px; } .land-hero p { margin: 0 auto 22px; } .land-cta { justify-content: center; } .hero-stats { justify-content: center; } .land-links { display: none; } .hero-visual { min-height: 420px; } .land-chat { left: 50%; transform: translateX(-50%) rotate(-2deg); } .hero-avatar { display: none; } .land-call { right: 8px; } }

/* creator card + contact */
.creator { position: relative; display: flex; align-items: center; gap: 18px; max-width: 520px; margin: 30px auto 0; padding: 18px 22px; background: #ffffff08; border: 1px solid #ffffff12; border-radius: 18px; text-align: left; }
.creator-photo { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; flex: none; box-shadow: 0 0 0 3px var(--accent), 0 10px 30px #0008; background: var(--bg3); }
.creator-photo.emoji { display: flex; align-items: center; justify-content: center; font-size: 40px; }
.creator-kicker { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 700; }
.creator-name { font-size: 24px; font-weight: 800; background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.creator-meta { color: var(--muted); font-size: 14px; }
.land-foot a { color: #b3a9ff; }
.support-line { text-align: center; }
.dots { display: flex; gap: 6px; justify-content: center; }
.dots span { width: 26px; height: 5px; border-radius: 3px; background: var(--bg4); transition: background .2s; }
.dots span.on { background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.astep { display: flex; flex-direction: column; gap: 12px; }
.card .astep input { width: 100%; }
.cred { display: flex; align-items: center; gap: 10px; background: var(--bg0); border-radius: 8px; padding: 10px 12px; }
.cred span { width: 70px; flex: none; } .cred b { flex: 1; font-size: 16px; letter-spacing: .5px; }
.strikes { background: #ff98003a; color: #ffb74d; border-radius: 6px; padding: 1px 7px; font-weight: 700; cursor: help; }
.strikes.hot { background: #ff5c7a3a; color: #ff8a9b; }
.susp-tag { background: #ff5c7a2a; color: #ff8a9b; border-radius: 6px; padding: 1px 7px; font-weight: 700; margin-left: 4px; }
.version-line { text-align: right; margin: -4px 0 0; opacity: .8; }

/* ============================================================
   🎃 HALLOWEEN THEME — switched on by the admin (body[data-theme=halloween])
   Everything below only applies when the theme is on, so turning it
   off in November puts the normal purple night theme straight back.
   ============================================================ */
body[data-theme="halloween"] {
  --bg0: #0b0710;   /* midnight pumpkin patch */
  --bg1: #150d1c;
  --bg2: #1d1226;
  --bg3: #2a1836;
  --bg4: #3b2149;
  --text: #ffeede;
  --muted: #b09ac0;
  --accent: #ff7518;    /* pumpkin orange */
  --accent2: #9b5de5;   /* witch purple */
  --green: #7ee787;     /* slime */
  --red: #ff4d4d;
}
/* spooky glow behind everything */
body[data-theme="halloween"] #app, body[data-theme="halloween"] #landing, body[data-theme="halloween"] #auth {
  background-image: radial-gradient(ellipse at 20% -10%, #ff751822 0%, transparent 55%), radial-gradient(ellipse at 85% 110%, #9b5de533 0%, transparent 50%);
}
body[data-theme="halloween"] #landing { background-color: #0b0710; }
/* bats, ghosts and cobwebs drifting behind the app */
#decor { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
#decor .fly { position: absolute; top: var(--y); left: -8vw; font-size: var(--size); opacity: .5; animation: flyacross var(--d) linear infinite; animation-delay: var(--delay); filter: drop-shadow(0 0 6px #ff751855); }
@keyframes flyacross { 0% { transform: translate(-10vw, 0) rotate(-6deg); } 25% { transform: translate(25vw, -5vh) rotate(6deg); } 50% { transform: translate(55vw, 4vh) rotate(-5deg); } 75% { transform: translate(85vw, -3vh) rotate(5deg); } 100% { transform: translate(115vw, 0) rotate(0); } }
#decor .web { position: fixed; top: -6px; font-size: 76px; opacity: .22; }
#decor .web-l { left: -6px; } #decor .web-r { right: -6px; transform: scaleX(-1); }
@media (max-width: 700px) { #decor .web { font-size: 48px; } }
/* app chrome gets a pumpkin glow */
body[data-theme="halloween"] #serverBar { box-shadow: inset -1px 0 0 #ff751833; }
body[data-theme="halloween"] .server-icon:hover, body[data-theme="halloween"] .server-icon.active { background: var(--accent); box-shadow: 0 0 18px #ff751899; }
body[data-theme="halloween"] .btn.primary { background: linear-gradient(90deg, #ff7518, #ff4d00); box-shadow: 0 6px 20px #ff751844; }
body[data-theme="halloween"] .logo, body[data-theme="halloween"] .land-logo, body[data-theme="halloween"] .grad, body[data-theme="halloween"] .creator-name { background: linear-gradient(90deg, #ff7518, #ffd166, #9b5de5); -webkit-background-clip: text; background-clip: text; }
body[data-theme="halloween"] .msg.bubble.mine .content { background: linear-gradient(135deg, #ff7518, #e0561a); color: #1a0c04; }
body[data-theme="halloween"] #composer { box-shadow: inset 0 0 0 1px #ff751833; }
body[data-theme="halloween"] .pill-tag { background: #ff751822; border-color: #ff751866; color: #ffc89a; }
body[data-theme="halloween"] .feat:hover { border-color: #ff7518aa; box-shadow: 0 20px 50px #ff751822; }
body[data-theme="halloween"] .orb1 { background: #ff7518; } body[data-theme="halloween"] .orb2 { background: #9b5de5; } body[data-theme="halloween"] .orb3 { background: #7ee787; }
body[data-theme="halloween"] .toast { box-shadow: 0 6px 20px #000a, 0 0 0 1px #ff751833; }
body[data-theme="halloween"] .nbadge { background: #ff7518; color: #1a0c04; }
body[data-theme="halloween"] .avatar, body[data-theme="halloween"] .ptile .avatar { box-shadow: 0 0 10px #ff751833; }
/* a flickering jack-o'-lantern next to the app title */
body[data-theme="halloween"] #sidebarTitle::after { content: ' 🎃'; animation: flicker 2.6s infinite; }
@keyframes flicker { 0%, 100% { opacity: 1; } 45% { opacity: .55; } 50% { opacity: .95; } 72% { opacity: .4; } }
