/* THEMES: every colour below is a variable, so a theme just swaps them */
:root {
  --bg: #1a1a2e; --panel: #16213e; --input: #0f3460; --border: #2a2a5a; --hover: #1a2a50;
  --accent: #7c83fd; --accent-hover: #5c63e0; --accent-text: #c0c4ff; --accent-soft: #a5abff; --accent-dim: #2a3170;
  --on-accent: #fff; --own-line: rgba(255,255,255,.25); /* text and lines on top of the accent colour */
}
/* Dark: black and white, to match the capybara logo */
[data-theme=dark] {
  --bg: #000; --panel: #111; --input: #1d1d1d; --border: #2f2f2f; --hover: #191919;
  --accent: #e8e8e8; --accent-hover: #c8c8c8; --accent-text: #fff; --accent-soft: #d4d4d4; --accent-dim: #333;
  --on-accent: #000; --own-line: rgba(0,0,0,.25);
}
[data-theme=ocean] {
  --bg: #0b1d2a; --panel: #0f2a3d; --input: #123a54; --border: #1e4a66; --hover: #143650;
  --accent: #0e7490; --accent-hover: #155e75; --accent-text: #a5f3fc; --accent-soft: #67e8f9; --accent-dim: #134e5e;
}
[data-theme=lava] {
  --bg: #1c0f0f; --panel: #2a1414; --input: #3d1a1a; --border: #5a2525; --hover: #3a1c1c;
  --accent: #c2410c; --accent-hover: #9a3412; --accent-text: #fed7aa; --accent-soft: #fdba74; --accent-dim: #5a2a12;
}
[data-theme=matrix] {
  --bg: #050a05; --panel: #0a140a; --input: #0f1f0f; --border: #1a3a1a; --hover: #112611;
  --accent: #15803d; --accent-hover: #166534; --accent-text: #86efac; --accent-soft: #4ade80; --accent-dim: #14401f;
}
[data-theme=candy] {
  --bg: #24142b; --panel: #33193d; --input: #45204f; --border: #5e2d6b; --hover: #3d1d48;
  --accent: #db2777; --accent-hover: #be185d; --accent-text: #fbcfe8; --accent-soft: #f9a8d4; --accent-dim: #5b2149;
}
[data-theme=midnight] {
  --bg: #0d1117; --panel: #161b22; --input: #21262d; --border: #30363d; --hover: #1c2128;
  --accent: #2f81f7; --accent-hover: #1f6feb; --accent-text: #a5d6ff; --accent-soft: #79c0ff; --accent-dim: #1f3a5f;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg); color: #e0e0e0;
  height: 100dvh; display: flex; align-items: center; justify-content: center;
}
button { font-family: inherit; }

/* START PAGE: words and the log in box on the left, a little moving chat on the right */
#signup-screen {
  display: none; position: fixed; inset: 0; overflow-y: auto; background: var(--bg);
  grid-template-columns: 1fr 1fr; grid-auto-rows: minmax(100%, auto); gap: 40px; padding: 28px 6vw;
}
.auth-left { display: flex; flex-direction: column; min-height: 100%; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-size: 1.5rem; font-weight: 700; color: var(--accent-text); }
.auth-brand img { width: 44px; height: 44px; border-radius: 50%; box-shadow: 0 0 0 2px var(--border); }
.auth-main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px 0; }
.auth-title { font-family: Georgia, 'DejaVu Serif', serif; font-weight: 400; font-size: clamp(2.2rem, 4.4vw, 3.8rem); color: #fff; text-align: center; letter-spacing: -.01em; }
.auth-sub { color: #bbb; font-size: 1.15rem; margin: 10px 0 30px; text-align: center; font-family: Georgia, 'DejaVu Serif', serif; }
.auth-card {
  width: min(420px, 100%); background: var(--panel); border: 1px solid var(--border);
  border-radius: 20px; padding: 28px;
}
.auth-card h2 { font-size: 1.15rem; color: var(--accent-text); margin-bottom: 4px; }
#auth-intro { color: #888; font-size: .88rem; line-height: 1.5; margin-bottom: 18px; }
.auth-or { display: flex; align-items: center; gap: 12px; color: #777; font-size: .75rem; margin: 14px 0; }
.auth-or::before, .auth-or::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.btn.auth-alt { width: 100%; padding: 12px; background: var(--input); color: var(--accent-text); border: 1px solid var(--border); }
.btn.auth-alt:hover { background: var(--hover); border-color: var(--accent); }
.status.info { color: var(--accent-text); }

.auth-right { display: flex; align-items: center; }
#auth-demo {
  width: 100%; height: min(86vh, 760px); border-radius: 22px; overflow: hidden; position: relative;
  background: radial-gradient(circle at 25% 15%, #3b3b6b 0, transparent 45%),
              radial-gradient(circle at 80% 90%, #2d5a4a 0, transparent 50%), #15152a;
  display: flex; flex-direction: column;
}
.demo-head {
  display: flex; align-items: center; gap: 10px; padding: 16px 20px; color: #ddd; font-weight: 600;
  background: rgba(0, 0, 0, .25); border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.demo-head img { width: 32px; height: 32px; border-radius: 50%; }
#demo-messages { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 12px; padding: 20px; overflow: hidden; }
#demo-messages.fade { opacity: 0; transition: opacity .6s; }
.demo-msg { display: flex; align-items: flex-end; gap: 8px; animation: demo-pop .35s ease-out; }
.demo-msg.own { flex-direction: row-reverse; }
.demo-msg .avatar { width: 34px; height: 34px; }
.demo-bubble {
  max-width: 70%; padding: 10px 14px; border-radius: 16px 16px 16px 4px; background: rgba(255, 255, 255, .12);
  color: #eee; font-size: 1rem; line-height: 1.35;
}
.demo-msg.own .demo-bubble { border-radius: 16px 16px 4px 16px; background: #e8e8e8; color: #111; }
.demo-name { display: block; font-size: .72rem; color: #aaa; margin-bottom: 2px; }
.demo-msg .pack-sticker { width: 130px; height: 130px; }
.demo-typing { color: #aaa; font-size: .85rem; padding-left: 44px; }
.demo-typing .dot { animation: blink 1.2s infinite; }
.demo-typing .dot:nth-child(2) { animation-delay: .2s; }
.demo-typing .dot:nth-child(3) { animation-delay: .4s; }
@keyframes demo-pop { from { opacity: 0; transform: translateY(14px) scale(.96); } }
/* Phones: just the log in side */
@media (max-width: 820px) {
  #signup-screen { grid-template-columns: 1fr; padding: 20px 16px; }
  .auth-right { display: none; }
}

.field { margin-bottom: 16px; }
.field label, .side-label {
  display: block; font-size: .75rem; color: #aaa; margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: .05em;
}
input[type=text], input[type=password] {
  width: 100%; padding: 12px 14px;
  background: var(--input); border: 1px solid var(--border);
  border-radius: 8px; color: #fff; font-size: 1rem;
  outline: none; transition: border-color .2s;
}
input[type=text]:focus, input[type=password]:focus { border-color: var(--accent); }

.btn {
  padding: 10px 14px; background: var(--accent); color: var(--on-accent);
  border: none; border-radius: 8px; font-size: .9rem; font-weight: 600;
  cursor: pointer; transition: background .2s;
}
.btn:hover { background: var(--accent-hover); }
.btn:disabled { background: #444; cursor: default; }
.btn.ghost { background: transparent; border: 1px solid #555; color: #aaa; font-weight: 500; }
.btn.ghost:hover { border-color: #e05c5c; color: #e05c5c; }
.btn.ghost.safe:hover { border-color: var(--accent); color: var(--accent-text); }
.btn.small { padding: 5px 10px; font-size: .78rem; border-radius: 6px; }
#signup-btn { width: 100%; padding: 13px; font-size: 1rem; margin-top: 8px; }
.link {
  background: none; border: none; color: var(--accent); font-weight: 600;
  font-size: inherit; cursor: pointer; padding: 0;
}
.link:hover { text-decoration: underline; }

.status { font-size: .82rem; margin-top: 8px; min-height: 1.2em; line-height: 1.4; }
.profile-card > .status:empty, .settings-page > .status:empty, .panel .status:empty { display: none; }
.status.error { color: #ff8080; }
.status.ok    { color: #7ee2a8; }

/* APP LAYOUT: friends on the left, chat on the right */
#app {
  display: none; width: 100vw; height: 100dvh;
  grid-template-columns: 290px 1fr;
}

#sidebar {
  background: var(--panel); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; min-height: 0;
}
.me { padding: 14px 18px; border-bottom: 1px solid var(--border); }
.me-title { font-weight: 700; font-size: 1.2rem; color: var(--accent); margin-bottom: 10px; }
#me-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px; margin: 0 -8px; width: calc(100% + 16px);
  background: transparent; border: none; border-radius: 8px;
  color: var(--accent-text); text-align: left; cursor: pointer;
}
#me-btn:hover, #me-btn.active { background: var(--input); }
.me-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-hint { font-size: .75rem; color: #888; }

#add-form { padding: 14px 18px; border-bottom: 1px solid var(--border); }
.row { display: flex; gap: 8px; }
.row input[type=text] { padding: 9px 12px; font-size: .9rem; }

.side-scroll { flex: 1; overflow-y: auto; padding: 14px 10px; min-height: 0; }
.side-scroll::-webkit-scrollbar { width: 4px; }
.side-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.side-label { padding: 0 8px; margin: 4px 0 8px; }
#add-form .side-label { padding: 0; margin-top: 0; }
.empty { color: #555; font-size: .85rem; padding: 6px 8px 14px; line-height: 1.4; }

.request {
  background: var(--input); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; margin-bottom: 8px;
}
.request-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.request-name { font-weight: 600; color: var(--accent-text); word-break: break-all; }
.request-what { font-size: .78rem; color: #888; margin: 2px 0 8px; }
.countdown { font-size: .8rem; font-variant-numeric: tabular-nums; color: #7ee2a8; flex-shrink: 0; }
.countdown.soon { color: #ff8080; }
.request .row { gap: 6px; }
#requests { margin-bottom: 10px; }

.friend {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px; border: none; border-radius: 8px; background: transparent;
  color: #ccc; font-size: .95rem; text-align: left; cursor: pointer;
}
.friend:hover  { background: var(--hover); }
.friend.active { background: var(--input); color: #fff; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem; color: #fff; object-fit: cover;
}
.avatar.big { width: 120px; height: 120px; font-size: 3rem; }
.request-top .avatar { width: 24px; height: 24px; font-size: .7rem; }
.request-who { display: flex; align-items: center; gap: 8px; min-width: 0; }

/* PROFILE */
#profile { display: none; flex: 1; flex-direction: column; min-height: 0; }
.profile-body { flex: 1; overflow-y: auto; padding: 32px 24px; }
.profile-body::-webkit-scrollbar { width: 5px; }
.profile-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* PICTURE CROPPER (pops up over everything) */
#crop-modal {
  display: none; position: fixed; inset: 0; z-index: 10;
  background: rgba(0, 0, 0, .7); align-items: center; justify-content: center; padding: 16px;
}
.crop-box {
  background: var(--panel); border-radius: 16px; padding: 24px;
  width: min(380px, 100%); box-shadow: 0 8px 32px rgba(0,0,0,.5);
}
.crop-box h3 { color: var(--accent-text); margin-bottom: 4px; }
.crop-box p  { color: #888; font-size: .85rem; margin-bottom: 14px; }
#crop-canvas {
  display: block; width: 100%; max-width: 320px; aspect-ratio: 1; margin: 0 auto;
  border-radius: 8px; cursor: grab; touch-action: none; outline: none;
}
#crop-canvas:active { cursor: grabbing; }
.zoom-row { display: flex; align-items: center; gap: 10px; margin: 16px 0 20px; color: #888; }
.zoom-row input { flex: 1; accent-color: var(--accent); height: 24px; cursor: pointer; }
.zoom-btn {
  width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; border: 1px solid #555;
  background: var(--input); color: var(--accent-text); font-size: 1.3rem; font-weight: 700; cursor: pointer;
}
.zoom-btn:hover { border-color: var(--accent); }
.crop-box .row { justify-content: flex-end; }
.profile-card {
  max-width: 420px; margin: 0 auto;
  display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center;
}
/* SETTINGS: a list of sections on the left, only the picked one on the right (like Discord) */
.profile-body.settings { display: flex; gap: 28px; align-items: flex-start; }
#settings-nav {
  position: sticky; top: 0; flex-shrink: 0; width: 180px;
  display: flex; flex-direction: column; gap: 2px;
}
.settings-tab {
  padding: 9px 12px; border: none; border-radius: 8px; background: transparent; color: #aaa;
  font-size: .92rem; text-align: left; cursor: pointer;
}
.settings-tab:hover { background: var(--hover); color: #ddd; }
.settings-tab.active { background: var(--input); color: var(--accent-text); font-weight: 600; }
.settings .profile-card { flex: 1; max-width: 560px; margin: 0; }
.settings-page { display: none; width: 100%; flex-direction: column; align-items: center; gap: 14px; }
.settings-page.active { display: flex; }
.settings-page > .panel:first-child { margin-top: 0; }
@media (max-width: 820px) {
  /* Small screens: the sections become a row of tabs along the top */
  .profile-body.settings { flex-direction: column; gap: 16px; padding: 12px 16px 24px; }
  #settings-nav {
    width: 100%; flex-direction: row; overflow-x: auto; background: var(--bg); z-index: 1;
    padding-bottom: 6px; scrollbar-width: none;
  }
  .settings-tab { white-space: nowrap; flex-shrink: 0; }
  .settings .profile-card { width: 100%; }
}
.profile-name { font-size: 1.4rem; font-weight: 700; color: var(--accent-text); word-break: break-all; }
#avatar-file { display: none; }
.panel {
  width: 100%; margin-top: 14px; padding: 18px;
  border: 1px solid var(--border); border-radius: 12px; text-align: left;
}
.panel h3 { color: var(--accent-text); font-size: 1rem; margin-bottom: 6px; }
.panel p  { color: #999; font-size: .85rem; line-height: 1.45; margin-bottom: 12px; }
.panel input { margin-bottom: 8px; }
.panel.danger { border-color: #5a2a2a; margin-top: 28px; }
.panel.danger h3 { color: #ff8080; }
.logout-row { display: flex; align-items: center; gap: 12px; }
.logout-row p { margin: 0; }
.btn.red { background: #c0392b; }
.btn.red:hover { background: #a93226; }
#delete-confirm { display: none; margin-top: 12px; }
#delete-confirm input { margin-bottom: 8px; }
.friend-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friend-typing { font-size: .75rem; color: var(--accent-soft); font-style: italic; flex-shrink: 0; }
#update-banner {
  display: none; position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 20;
  background: var(--accent); color: var(--on-accent); border: none; border-radius: 20px; padding: 10px 18px;
  font-weight: 600; font-size: .9rem; cursor: pointer; box-shadow: 0 4px 16px rgba(0,0,0,.4);
}

/* CHAT */
#chat { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
#chat-empty {
  flex: 1; display: flex; align-items: center; justify-content: center;
  color: #555; padding: 20px; text-align: center; line-height: 1.5;
}
#chat-open { display: none; flex: 1; flex-direction: column; min-height: 0; }

header {
  background: var(--panel); padding: 12px 16px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--border);
}
.chat-name { font-weight: 700; font-size: 1.1rem; color: var(--accent); flex: 1; min-width: 0;
             overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back-btn { display: none; }

#messages {
  flex: 1; overflow-y: auto; padding: 16px 20px;
  display: flex; flex-direction: column; gap: 10px; background: var(--bg);
}
#messages::-webkit-scrollbar { width: 5px; }
#messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.msg { display: flex; flex-direction: column; max-width: 75%; }
.msg.own    { align-self: flex-end;   align-items: flex-end; }
.msg.other  { align-self: flex-start; }
.msg.sending { opacity: .6; }
.msg.failed .bubble { background: #a33; }

.msg-meta { font-size: .72rem; color: #666; margin-bottom: 3px; }
.msg.own .msg-meta { color: var(--accent); opacity: .75; }

.bubble {
  padding: 10px 14px; border-radius: 16px;
  font-size: .92rem; line-height: 1.45; word-break: break-word;
}
.msg.own   .bubble { background: var(--accent); color: var(--on-accent); border-bottom-right-radius: 4px; }
.msg.other .bubble { background: var(--panel); color: #ddd; border-bottom-left-radius: 4px; }

footer {
  background: var(--panel); padding: 14px 16px;
  border-top: 1px solid var(--border); display: flex; gap: 10px;
}
/* The message box shows bold, italic... just like the friend will see it */
#msg-input {
  flex: 1; min-width: 0; max-height: 120px; overflow-y: auto; padding: 11px 14px;
  background: var(--input); border: 1px solid var(--border); border-radius: 24px;
  color: #fff; font-size: .95rem; line-height: 1.35; outline: none; cursor: text;
  white-space: pre-wrap; word-break: break-word; transition: border-color .2s;
}
#msg-input:focus { border-color: var(--accent); }
#msg-input:empty::before { content: attr(data-placeholder); color: #777; pointer-events: none; }
#send-btn {
  background: var(--accent); color: var(--on-accent); border: none; border-radius: 50%;
  width: 44px; height: 44px; flex-shrink: 0; cursor: pointer;
  font-size: 1.2rem; display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
#send-btn:hover { background: var(--accent-hover); }

/* SIDEBAR EXTRAS */
.me-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.me-top .me-title { margin-bottom: 0; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 8px; border: none; background: transparent;
  color: #888; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--input); color: var(--accent-text); }
.icon-btn svg { width: 20px; height: 20px; }
.side-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 8px; padding-right: 4px; }
.side-head .side-label { margin: 0; }
.avatar.group { border-radius: 50%; }
/* "New group": a round Discord-style upload circle with the name underneath */
.new-group-top { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 4px 0 14px; }
.pic-upload {
  position: relative; width: 84px; height: 84px; border-radius: 50%; padding: 0;
  border: 2px dashed #888; background: none; color: #bbb; cursor: pointer;
}
.pic-upload:hover { border-color: var(--accent); color: var(--accent-text); }
.pic-upload.has-pic { border: none; }
.pic-upload img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.pic-upload-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: .62rem; font-weight: 700; letter-spacing: .05em;
}
.pic-upload-empty svg { width: 24px; height: 24px; }
.pic-upload-plus {
  position: absolute; top: -2px; right: -2px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: var(--on-accent); font-weight: 700; line-height: 24px; font-size: 1.1rem;
}
.link-btn { background: none; border: none; color: #888; font-size: .78rem; cursor: pointer; text-decoration: underline; }
.link-btn:hover { color: var(--accent-text); }
.field-label {
  display: block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: #aaa; margin-bottom: 6px;
}
#invites-wrap:has(#group-invites:empty) { display: none; }
.pick.invited { opacity: .55; cursor: default; }
/* Click the group picture in the chat header to change it */
.group-pic-btn {
  position: relative; display: inline-flex; padding: 0; border: none; border-radius: 50%;
  background: none; cursor: pointer;
}
.group-pic-btn svg {
  position: absolute; inset: 0; margin: auto; width: 18px; height: 18px; color: #fff;
  opacity: 0; transition: opacity .15s;
}
.group-pic-btn::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: rgba(0, 0, 0, .55); opacity: 0; transition: opacity .15s;
}
.group-pic-btn svg { z-index: 1; }
.group-pic-btn:hover::after, .group-pic-btn:hover svg, .group-pic-btn.drop::after, .group-pic-btn.drop svg { opacity: 1; }
#group-pic-status { margin: 0; padding: 6px 16px; background: var(--panel); }
#group-pic-status:empty { display: none; }
#groups { margin-bottom: 10px; }

/* CHAT HEADER, ADD PEOPLE, TYPING */
.chat-title { flex: 1; min-width: 0; }
.chat-sub { font-size: .75rem; color: #888; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#add-people {
  display: none; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--border); font-size: .85rem; color: #888;
}
.picks { display: flex; flex-wrap: wrap; gap: 8px; }
.pick {
  display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px;
  background: var(--input); border: 1px solid var(--border); border-radius: 20px;
  color: #ccc; font-size: .85rem; cursor: pointer;
}
.pick:hover { border-color: var(--accent); }
.pick.selected { border-color: var(--accent); background: var(--accent-dim); color: #fff; }
.pick .avatar { width: 24px; height: 24px; font-size: .7rem; }
#typing { height: 26px; padding: 4px 20px 0; font-size: .88rem; font-weight: 600; color: var(--accent-soft); background: var(--bg); }
#typing .dot { animation: blink 1.2s infinite; }
#typing .dot:nth-child(2) { animation-delay: .2s; }
#typing .dot:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }

/* MESSAGES: notices, names in groups, reactions */
.msg.system { align-self: center; max-width: 100%; }
.msg.system .bubble { background: transparent; color: #777; font-size: .8rem; font-style: italic; padding: 2px 0; }
.msg-meta { display: flex; align-items: center; gap: 5px; }
.msg-meta .avatar { width: 18px; height: 18px; font-size: .55rem; }
.msg-line { display: flex; align-items: center; gap: 6px; max-width: 100%; }
.msg.own .msg-line { flex-direction: row-reverse; }
.react-btn {
  opacity: 0; width: 30px; height: 30px; flex-shrink: 0; border-radius: 50%;
  border: none; background: none; color: #888; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.msg:hover .react-btn, .react-btn:focus-visible { opacity: 1; }
.react-btn:hover { background: var(--panel); color: var(--accent-text); }
.react-btn svg { width: 20px; height: 20px; }
@media (hover: none) { .react-btn { opacity: .6; } }
.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.reactions:empty { display: none; }
.rx {
  display: flex; align-items: center; gap: 4px; padding: 2px 8px 2px 5px;
  border-radius: 12px; background: var(--panel); border: 1px solid var(--border);
  color: #ccc; font-size: .78rem; cursor: pointer;
}
.rx:hover { border-color: var(--accent); }
.rx.mine { border-color: var(--accent); background: var(--accent-dim); color: #fff; }
.rx svg { width: 16px; height: 16px; }
#rx-picker {
  display: none; position: fixed; z-index: 5; gap: 2px; padding: 4px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 24px;
  box-shadow: 0 4px 16px rgba(0,0,0,.5);
}
#rx-picker button {
  width: 38px; height: 38px; border: none; border-radius: 50%; background: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: transform .1s;
}
#rx-picker button:hover { background: var(--input); transform: scale(1.2); }
#rx-picker svg { width: 26px; height: 26px; }

#new-group { display: none; flex: 1; flex-direction: column; min-height: 0; }

/* PHONES: show the friends list, or the chat, not both */
@media (max-width: 720px) {
  #app { grid-template-columns: 1fr; }
  #app.chatting #sidebar { display: none; }
  #app:not(.chatting) #chat { display: none; }
  .back-btn { display: inline-block; }
}

/* ONLINE DOTS AND STATUS */
.avatar-wrap { position: relative; display: inline-flex; flex-shrink: 0; }
.online-dot {
  position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px;
  border-radius: 50%; background: #22c55e; border: 2px solid var(--panel);
}
.friend-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.friend-text .friend-name { flex: none; }
.friend-status { font-size: .74rem; color: #888; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* MESSAGE TOOLS (hover), REPLIES, DELETED, PINS, SEEN */
.tools {
  display: flex; gap: 2px; opacity: 0; flex-shrink: 0;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 2px;
}
.msg:hover .tools, .tools:focus-within { opacity: 1; }
@media (hover: none) { .tools { opacity: .7; } }
.tool {
  width: 28px; height: 28px; border: none; border-radius: 6px; background: none;
  color: #999; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.tool:hover { background: var(--input); color: var(--accent-text); }
.tool svg { width: 18px; height: 18px; }
.quote {
  display: block; max-width: 100%; margin-bottom: 4px; padding: 4px 10px;
  border: none; border-left: 3px solid var(--accent); border-radius: 4px;
  background: var(--panel); color: #aaa; font-size: .78rem; text-align: left; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.quote b { color: var(--accent-text); }
.msg.deleted .bubble { background: transparent !important; border: 1px dashed var(--border); color: #777 !important; font-style: italic; }
.pinned-mark { display: inline-flex; color: var(--accent-soft); }
.pinned-mark svg { width: 13px; height: 13px; }
.seen-label { font-size: .7rem; color: #888; margin-top: 3px; }
.msg.flash .bubble { animation: flash 1.2s; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px var(--accent-soft); } 100% { box-shadow: none; } }

#pins { display: none; position: relative; background: var(--panel); border-bottom: 1px solid var(--border); }
#pins-bar {
  display: flex; align-items: center; gap: 6px; width: 100%; padding: 8px 16px;
  border: none; background: none; color: #bbb; font-size: .82rem; text-align: left; cursor: pointer;
}
#pins-bar svg { width: 15px; height: 15px; color: var(--accent-soft); flex-shrink: 0; }
#pins-bar b { color: var(--accent-text); flex-shrink: 0; }
#pins-bar > span:not(.pins-more) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.pins-more { color: #888; font-size: .75rem; flex-shrink: 0; }
#pins-list {
  display: none; position: absolute; left: 0; right: 0; top: 100%; z-index: 4;
  background: var(--panel); border-bottom: 1px solid var(--border); max-height: 240px; overflow-y: auto;
  box-shadow: 0 8px 16px rgba(0,0,0,.4);
}
.pin-item {
  display: block; width: 100%; padding: 8px 16px; border: none; border-top: 1px solid var(--border);
  background: none; color: #ccc; font-size: .82rem; text-align: left; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pin-item:hover { background: var(--hover); }
.pin-item b { color: var(--accent-text); }

/* COMPOSE BAR (replying / editing), SENDING NOTE, FOOTER BUTTONS */
#compose-bar {
  display: none; align-items: center; gap: 10px; padding: 8px 16px;
  background: var(--panel); border-top: 1px solid var(--border); border-left: 3px solid var(--accent);
}
.compose-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: .8rem; color: #aaa; }
.compose-text b { color: var(--accent-text); }
.compose-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#sending-note { display: none; padding: 4px 20px; font-size: .78rem; color: var(--accent-soft); background: var(--bg); }
footer { align-items: center; gap: 6px; }
footer .icon-btn { flex-shrink: 0; }
#mic-btn {
  width: 44px; height: 44px; flex-shrink: 0; border: none; border-radius: 50%;
  background: var(--input); color: var(--accent-text); cursor: pointer; touch-action: none;
  display: flex; align-items: center; justify-content: center;
}
#mic-btn:hover { background: var(--accent); color: var(--on-accent); }
#mic-btn:active { background: #dc2626; color: #fff; }
#mic-btn svg { width: 22px; height: 22px; }
#recording {
  display: none; flex: 1; align-items: center; gap: 8px; padding: 0 14px; height: 44px;
  border-radius: 24px; background: #3b0d0d; color: #fca5a5; font-size: .85rem;
}
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #ef4444; animation: blink 1s infinite; }

/* PICTURES, STICKERS, VOICE */
.pic { max-width: min(320px, 60vw); max-height: 320px; border-radius: 12px; cursor: zoom-in; display: block; background: var(--panel); }
.sticker { width: 140px; height: 140px; display: block; }
.bubble.voice { display: flex; align-items: center; gap: 8px; padding: 6px 10px; }
.bubble.voice audio { height: 36px; max-width: 230px; color-scheme: dark; }
.voice-length { font-size: .75rem; opacity: .8; }

/* POLLS */
.bubble.poll { min-width: 240px; display: flex; flex-direction: column; gap: 6px; }
.poll-question { font-weight: 700; margin-bottom: 2px; }
.poll-option {
  position: relative; display: flex; justify-content: space-between; gap: 10px; overflow: hidden;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--input); color: #eee; font-size: .88rem; text-align: left; cursor: pointer;
}
.msg.own .poll-option { background: rgba(0,0,0,.18); border-color: var(--own-line); color: var(--on-accent); }
.poll-option.mine { border-color: currentColor; font-weight: 600; }
.poll-fill { position: absolute; inset: 0 auto 0 0; background: rgba(255,255,255,.18); transition: width .3s; }
.poll-label, .poll-count { position: relative; }
.poll-total { font-size: .74rem; opacity: .75; }

/* POP-UPS: picture viewer, sticker pad, poll maker */
.modal {
  display: none; position: fixed; inset: 0; z-index: 10; padding: 16px;
  background: rgba(0, 0, 0, .75); align-items: center; justify-content: center;
}
#lightbox { cursor: zoom-out; }
#lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }
.modal-box {
  background: var(--panel); border-radius: 16px; padding: 22px; width: min(400px, 100%);
  max-height: 100%; overflow-y: auto; box-shadow: 0 8px 32px rgba(0,0,0,.5);
  display: flex; flex-direction: column; gap: 10px;
}
.modal-box h3 { color: var(--accent-text); }
.modal-box h4 { color: #aaa; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; margin-top: 6px; }
#poll-options { display: flex; flex-direction: column; gap: 8px; }
#poll-add { align-self: flex-start; }
.pad-actions { justify-content: flex-end; }
#pad {
  width: 100%; max-width: 280px; aspect-ratio: 1; align-self: center; touch-action: none; cursor: crosshair;
  border-radius: 12px; border: 1px solid var(--border);
  background: repeating-conic-gradient(#2a2a2a 0% 25%, #3a3a3a 0% 50%) 0 0 / 20px 20px; /* see-through = checks */
}
.pad-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border); cursor: pointer; }
.swatch.selected { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }
#pad-sizes { display: flex; gap: 4px; }
.size { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: var(--input); color: #ccc; cursor: pointer; }
.size.selected, .icon-btn.selected { background: var(--accent); color: var(--on-accent); }
#saved-stickers { display: flex; flex-wrap: wrap; gap: 8px; }
.saved-sticker { position: relative; }
.saved-sticker img { width: 64px; height: 64px; border-radius: 8px; background: var(--input); cursor: pointer; display: block; }
.saved-sticker img:hover { outline: 2px solid var(--accent); }
.saved-remove {
  position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%;
  border: none; background: #444; color: #fff; cursor: pointer; display: none; padding: 3px;
}
.saved-sticker:hover .saved-remove { display: block; }
.saved-remove svg { width: 100%; height: 100%; }

/* THEMES PICKER */
.theme-pick {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px;
  border: 1px solid var(--border); border-radius: 20px; background: var(--input); color: #ccc; cursor: pointer; font-size: .85rem;
}
.theme-pick.selected { border-color: var(--accent); color: #fff; box-shadow: 0 0 0 1px var(--accent); }
.theme-chip { width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(255,255,255,.3); }

/* LOGO */
.logo { width: 1.4em; height: 1.4em; vertical-align: -0.3em; margin-right: 4px; }
.logo-big { display: block; width: 140px; height: 140px; margin: 0 auto 14px; border-radius: 50%; box-shadow: 0 0 0 3px var(--border); }
.me-title { display: flex; align-items: center; gap: 10px; }
.me-title .logo { width: 48px; height: 48px; margin: 0; border-radius: 50%; box-shadow: 0 0 0 2px var(--border); }
.msg.own .poll-fill { background: var(--own-line); }

/* UNREAD NUMBERS, @MENTIONS, DAY LINES, BLOCKED LIST, MASCOT */
.unread {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; flex-shrink: 0;
  background: #ef4444; color: #fff; font-size: .72rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.unread.mention { background: #f59e0b; color: #000; }
.mention { border-radius: 4px; padding: 0 3px; background: var(--accent-dim); color: var(--accent-text); font-weight: 600; }
.mention.me { background: #f59e0b; color: #000; }
.msg.own .mention { background: rgba(0,0,0,.18); color: inherit; }
.msg.mentions-me .bubble { box-shadow: 0 0 0 2px #f59e0b; }
#mention-list {
  display: none; flex-direction: column; gap: 2px; padding: 6px;
  margin: 0 16px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 -4px 16px rgba(0,0,0,.4);
}
.mention-option {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: none; border-radius: 6px;
  background: none; color: #ddd; font-size: .9rem; cursor: pointer; text-align: left;
}
.mention-option .avatar { width: 24px; height: 24px; font-size: .7rem; }
.mention-option:hover, .mention-option.selected { background: var(--input); }
.mention-real { color: #888; font-size: .78rem; }
.day-divider {
  display: flex; align-items: center; gap: 10px; margin: 6px 0;
  color: #888; font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
}
.day-divider::before, .day-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
#blocked-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.blocked-row { display: flex; align-items: center; justify-content: space-between; color: #ccc; }
#block-form input { padding: 9px 12px; font-size: .9rem; margin: 0; }
#mascot.awake { animation: wake .6s ease; }
@keyframes wake {
  0% { transform: scale(1) rotate(0); }
  30% { transform: scale(1.25) rotate(-8deg); }
  60% { transform: scale(1.1) rotate(6deg); }
  100% { transform: scale(1) rotate(0); }
}

/* PROFILE CARDS, FORWARDING, NOTIFICATION BUTTON */
.me-buttons { display: flex; gap: 2px; }
.clickable { cursor: pointer; }
.clickable:hover { filter: brightness(1.15); outline: 2px solid var(--accent-soft); outline-offset: 1px; border-radius: 50%; }
.card-box { align-items: center; text-align: center; gap: 6px; padding-top: 28px; }
#card-real { color: #888; font-size: .85rem; }
#card-real:empty, #card-status:empty, #card-since:empty { display: none; }
#card-status { color: var(--accent-text); font-style: italic; }
#card-seen { color: #aaa; font-size: .85rem; }
#card-seen.card-online { color: #22c55e; font-weight: 600; }
#card-since { color: #888; font-size: .8rem; }
.card-box .pad-actions { margin-top: 12px; align-self: stretch; justify-content: center; }
#forward-list { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow-y: auto; }
.fwd-label { display: inline-flex; align-items: center; gap: 3px; font-style: italic; }
.fwd-label svg { width: 12px; height: 12px; }

/* TEXT FORMATTING: **bold** *italic* __underline__ ~~strike~~ */
.bubble b { font-weight: 700; }
.bubble i { font-style: italic; }

/* MESSAGE EFFECTS */
#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 30; }
#app.shake { animation: shake .6s; }
@keyframes shake {
  0%, 100% { transform: translate(0, 0); }
  10%, 50%, 90% { transform: translate(-10px, 4px) rotate(-.6deg); }
  30%, 70% { transform: translate(10px, -4px) rotate(.6deg); }
}
.bubble.fx-big { font-size: 2.1rem; font-weight: 800; line-height: 1.15; }
/* the rainbow is the text itself: the background only shows through the letters */
.bubble.fx-rainbow {
  font-weight: 800; font-size: 1.15rem;
  background: linear-gradient(90deg, #ef4444, #f97316, #facc15, #22c55e, #06b6d4, #3b82f6, #a855f7, #ef4444) 0 0 / 200% 100% !important;
  -webkit-background-clip: text !important; background-clip: text !important;
  color: transparent !important; animation: rainbow 3s linear infinite;
}
@keyframes rainbow { to { background-position: -200% 0; } }
.fx-replay {
  display: inline-flex; align-items: center; gap: 3px; border: none; background: none; padding: 0;
  color: var(--accent-soft); font-size: inherit; font-style: italic; cursor: pointer;
}
.fx-replay:hover { text-decoration: underline; }
.fx-replay svg { width: 12px; height: 12px; }
.suggest-about { color: #888; font-size: .78rem; margin-left: auto; padding-left: 12px; }

/* CHANNELS (tabs along the top of a group) */
#channels {
  display: none; gap: 4px; padding: 6px 12px; overflow-x: auto;
  background: var(--panel); border-bottom: 1px solid var(--border);
}
#channels::-webkit-scrollbar { height: 3px; }
#channels::-webkit-scrollbar-thumb { background: var(--border); }
.channel {
  display: flex; align-items: center; gap: 4px; flex-shrink: 0;
  padding: 5px 10px; border: none; border-radius: 6px; background: none;
  color: #999; font-size: .85rem; font-weight: 600; cursor: pointer;
}
.channel:hover { background: var(--hover); color: #ddd; }
.channel.active { background: var(--input); color: var(--accent-text); }
.channel .hash { color: #666; font-weight: 400; }
.channel .unread { min-width: 18px; height: 18px; font-size: .68rem; }
.channel-x { display: inline-flex; width: 16px; height: 16px; margin-left: 2px; border-radius: 4px; color: #888; }
.channel-x:hover { background: #a33; color: #fff; }
.channel-x svg, .channel-add svg { width: 100%; height: 100%; }
.channel-add { width: 28px; height: 28px; padding: 6px; flex-shrink: 0; border: 1px dashed var(--border); border-radius: 6px; background: none; color: #888; cursor: pointer; }
.channel-add:hover { border-color: var(--accent); color: var(--accent-text); }

/* STREAKS */
.streak { display: inline-flex; align-items: center; gap: 2px; flex-shrink: 0; font-size: .8rem; font-weight: 700; color: #fb923c; }
.streak svg { width: 15px; height: 15px; }
.streak.risk { color: #fbbf24; }
.chat-sub .streak { vertical-align: -2px; margin-left: 2px; }
#card-streak { display: flex; justify-content: center; }
#card-streak:empty { display: none; }
#card-streak .streak { font-size: .9rem; }

/* BADGES */
.badge-icon { width: 40px; height: 40px; flex-shrink: 0; }
.badge-icon svg { width: 100%; height: 100%; display: block; }
.badge-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 8px; }
.badge-row .badge-icon { width: 34px; height: 34px; }
.badge-row .empty { padding: 0; }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.badge {
  display: flex; align-items: center; gap: 10px; padding: 8px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--input);
}
.badge.locked { background: transparent; }
.badge.locked .badge-icon { filter: grayscale(1); opacity: .35; }
.badge-name { font-weight: 700; font-size: .85rem; color: var(--accent-text); }
.badge.locked .badge-name { color: #888; }
.badge-how { font-size: .74rem; color: #888; line-height: 1.3; }
.badge-bar { height: 4px; margin-top: 4px; border-radius: 2px; background: var(--border); overflow: hidden; }
.badge-bar span { display: block; height: 100%; background: var(--accent); }

/* PROFILE BANNERS */
.banner { width: 100%; height: 140px; border-radius: 12px; background-size: cover; background-position: center; }
#profile-avatar .avatar.big { margin-top: -70px; box-shadow: 0 0 0 5px var(--bg); }
.card-box { overflow-x: hidden; }
#card-banner { margin: -28px -22px 0; width: calc(100% + 44px); height: 120px; border-radius: 16px 16px 0 0; flex-shrink: 0; }
#card-avatar .avatar.big { margin-top: -62px; box-shadow: 0 0 0 5px var(--panel); }
#banner-colours .swatch.auto { background: linear-gradient(135deg, #555 50%, #222 50%); }

/* CHAT WALLPAPERS */
#messages { background-color: var(--bg); }
.wallpaper-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.wallpaper-pick {
  height: 72px; border-radius: 10px; border: 2px solid var(--border); cursor: pointer;
  color: #eee; font-size: .78rem; font-weight: 600; display: flex; align-items: flex-end; padding: 6px;
  text-shadow: 0 1px 3px #000;
}
.wallpaper-pick:hover { border-color: var(--accent-soft); }
.wallpaper-pick.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.modal-hint { color: #888; font-size: .85rem; }

/* FORMAT BAR: pops up over words you select in the message box */
#format-bar {
  display: none; position: fixed; z-index: 6; gap: 2px; padding: 4px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.5);
}
#format-bar button {
  width: 34px; height: 32px; border: none; border-radius: 6px; background: none;
  color: #ccc; font-size: 1rem; font-family: Georgia, serif; cursor: pointer;
}
#format-bar button:hover { background: var(--input); color: #fff; }
#format-bar button.on { background: var(--accent-dim); color: var(--accent-text); }

/* STICKER AND GIF PICKERS (pop up above the message box, like Discord) */
#chat-open { position: relative; }
.picker {
  display: none; flex-direction: column; position: absolute; right: 16px; bottom: 76px; z-index: 5;
  width: min(420px, calc(100% - 32px)); height: min(400px, 60vh);
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.6); overflow: hidden;
}
.picker-tabs { display: flex; gap: 4px; padding: 8px; border-bottom: 1px solid var(--border); overflow-x: auto; flex-shrink: 0; }
.picker-tab {
  padding: 6px 12px; border: none; border-radius: 6px; background: none; flex-shrink: 0;
  color: #999; font-size: .85rem; font-weight: 600; cursor: pointer;
}
.picker-tab:hover { background: var(--hover); color: #ddd; }
.picker-tab.active { background: var(--input); color: var(--accent-text); }
.picker-grid {
  flex: 1; overflow-y: auto; padding: 10px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 6px; align-content: start;
}
.picker-grid::-webkit-scrollbar { width: 5px; }
.picker-grid::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.picker-item {
  aspect-ratio: 1; border: none; border-radius: 10px; background: none; cursor: pointer; padding: 4px;
  display: flex; align-items: center; justify-content: center; color: #aaa; font-size: .75rem; position: relative;
}
.picker-item:hover { background: var(--hover); }
.picker-item img { max-width: 100%; max-height: 100%; }
.picker-item.add { border: 2px dashed var(--border); flex-direction: column; gap: 4px; }
.picker-item.add svg { width: 26px; height: 26px; }
.picker-item.add:hover { border-color: var(--accent); color: var(--accent-text); }
.picker-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.picker-head b { color: var(--accent-text); }
.picker-note { padding: 8px 12px; color: #888; font-size: .75rem; line-height: 1.4; border-top: 1px solid var(--border); flex-shrink: 0; }
.picker-grid.gifs { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.picker-grid.gifs .picker-item { aspect-ratio: 4 / 3; background: var(--input); }
.picker-grid.gifs .picker-item img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; }
.picker-empty { grid-column: 1 / -1; color: #777; font-size: .85rem; text-align: center; padding: 30px 10px; line-height: 1.5; }
.gif-btn { font-size: .7rem !important; font-weight: 800; letter-spacing: .02em; border: 1.5px solid currentColor !important; width: 30px !important; height: 22px !important; border-radius: 5px !important; margin: 0 2px; }
.gif-tag { position: absolute; left: 6px; bottom: 6px; padding: 1px 5px; border-radius: 4px; background: rgba(0,0,0,.65); color: #fff; font-size: .65rem; font-weight: 800; }
.pic-wrap { position: relative; display: inline-block; }

/* PACK STICKERS: drawn by code, they move a little */
.pack-sticker { position: relative; width: 150px; height: 150px; flex-shrink: 0; }
.pack-sticker.small { width: 100%; height: 100%; }
.pack-sticker .whole > img, .pack-sticker .whole > svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
/* moving parts spin and grow around their own middle (only those: other parts are placed exactly) */
.pack-sticker svg .anim, .pet svg .anim { transform-box: fill-box; transform-origin: center; }
.pack-sticker .whole { transform-origin: 50% 80%; }
/* in chat they keep moving (like Discord); in the picker only when you point at one */
.msg .pack-sticker .anim { animation-iteration-count: infinite; }
.picker .pack-sticker .anim { animation-play-state: paused; }
.picker .picker-item:hover .pack-sticker .anim { animation-play-state: running; animation-iteration-count: infinite; }
.a-bounce { animation: st-bounce 1s ease-in-out; }
.a-wiggle { animation: st-wiggle .8s ease-in-out; }
.a-float { animation: st-float 1.6s ease-in-out; }
.a-pulse { animation: st-pulse 1s ease-in-out; }
.a-shake { animation: st-shake .5s linear; }
.a-drip { animation: st-drip 1.2s ease-in; }
.a-spin { animation: st-spin 2s linear; }
.a-pop { animation: st-pop 1.2s cubic-bezier(.3, 1.6, .5, 1); }
.a-bob { animation: st-bob 2.4s ease-in-out infinite; }
/* the capybara crew's moves */
.a-sneak { animation: st-sneak 2.4s ease-in-out; }
.a-hover { animation: st-hover 2.6s ease-in-out; }
.a-sway { animation: st-sway 2.4s ease-in-out; }
.a-nod { animation: st-nod .9s ease-in-out; }
.a-breathe { animation: st-breathe 3s ease-in-out; }
.a-proud { animation: st-proud 2.4s ease-in-out; }
.a-blink { animation: st-blink 1.6s linear; }
.a-flutter { animation: st-flutter .7s ease-in-out; }
.a-stir { animation: st-stir 1.2s ease-in-out; }
.a-swish { animation: st-swish 1.8s ease-in-out; }
.a-wave { animation: st-wave 1.6s ease-in-out; }
.a-twinkle { animation: st-twinkle 1.2s ease-in-out; }
.a-flap { animation: st-flap .8s ease-in-out; }
.a-tip { animation: st-tip 2.4s ease-in-out; }
.a-hop { animation: st-hop 1.4s ease-in-out; }
.a-search { animation: st-search 2.6s ease-in-out; }
.a-jiggle { animation: st-jiggle .3s linear; }
.a-hammer { animation: st-hammer 1s ease-in; }
@keyframes st-sneak { 0%, 100% { transform: translateX(0); } 30% { transform: translateX(-4%); } 70% { transform: translateX(4%); } }
@keyframes st-hover { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5%); } }
@keyframes st-sway { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-4deg); } 75% { transform: rotate(4deg); } }
@keyframes st-nod { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(3%) rotate(-2deg); } }
@keyframes st-breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.03, 1.06); } }
@keyframes st-proud { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes st-blink { 0%, 55%, 100% { opacity: 1; } 65%, 90% { opacity: .15; } }
@keyframes st-flutter { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(14deg); } 50% { transform: rotate(-6deg); } 75% { transform: rotate(10deg); } }
@keyframes st-stir { 0%, 100% { transform: rotate(-18deg); } 50% { transform: rotate(18deg); } }
@keyframes st-swish { 0%, 55%, 100% { transform: rotate(0); } 18% { transform: rotate(-32deg); } 36% { transform: rotate(22deg); } }
@keyframes st-wave { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-22deg); } 60% { transform: rotate(12deg); } }
@keyframes st-twinkle { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.6); opacity: .55; } }
@keyframes st-flap { 0%, 100% { transform: skewY(0) scaleX(1); } 50% { transform: skewY(9deg) scaleX(.82); } }
@keyframes st-tip { 0%, 50%, 100% { transform: rotate(0) translateY(0); } 18%, 34% { transform: rotate(-14deg) translateY(-14px); } }
@keyframes st-hop { 0%, 55%, 100% { transform: translateY(0); } 28% { transform: translateY(-22px); } }
@keyframes st-search { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(-26px, -22px); } 50% { transform: translate(-6px, -44px); } 75% { transform: translate(18px, -16px); } }
@keyframes st-jiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-5deg); } 75% { transform: rotate(5deg); } }
@keyframes st-hammer { 0%, 45%, 100% { transform: rotate(0); } 20% { transform: rotate(-42deg); } 30% { transform: rotate(8deg); } }
@keyframes st-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6%); } }
@keyframes st-bounce { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-8%); } 60% { transform: translateY(0); } 75% { transform: translateY(-3%); } }
@keyframes st-wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
@keyframes st-float { 0% { transform: translateY(8%); opacity: .2; } 50% { opacity: 1; } 100% { transform: translateY(-14%); opacity: .2; } }
@keyframes st-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.15); } }
@keyframes st-shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-3%); } 40%, 80% { transform: translateX(3%); } }
@keyframes st-drip { 0% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(60%); opacity: 0; } }
@keyframes st-spin { to { transform: rotate(360deg); } }
@keyframes st-pop { 0% { transform: scale(.7); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }

/* SEARCH */
#search-btn svg, #board-btn svg { width: 20px; height: 20px; }
#search-panel { display: none; flex-direction: column; gap: 8px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--border); max-height: 50%; }
#search-panel input { padding: 9px 12px; font-size: .9rem; }
#search-results { overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.search-hit {
  display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 8px 10px; border: none; border-radius: 8px;
  background: none; color: #ccc; text-align: left; cursor: pointer; font-size: .85rem;
}
.search-hit:hover { background: var(--hover); }
.search-where { font-size: .74rem; color: #888; }
.search-where b { color: var(--accent-text); }
.search-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-text mark { background: #f59e0b; color: #000; border-radius: 3px; padding: 0 2px; }
.search-none { color: #777; font-size: .85rem; padding: 8px 4px; }

/* DRAW TOGETHER */
.board-box { width: min(980px, 100%); }
.board-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
#board-who { color: var(--accent-soft); font-size: .85rem; font-weight: 600; }
#board {
  width: 100%; aspect-ratio: 1000 / 625; background: #fff; border-radius: 10px;
  touch-action: none; cursor: crosshair; display: block;
}
#board-colours .swatch { width: 24px; height: 24px; }
#board-sizes { gap: 4px; }

/* CAPYBARA PET */
.pet-wrap { position: relative; display: inline-flex; flex-shrink: 0; }
.pet-wrap > svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.pet { position: relative; width: 100%; height: 100%; }
.pet > img, .pet > svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.pet-stage { display: flex; justify-content: center; padding: 6px 0 2px; }
#pet-big { width: 210px; height: 210px; animation: breathe 3s ease-in-out infinite; transform-origin: 50% 85%; }
@keyframes breathe { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(1.03); } }
#pet-level { text-align: center; font-weight: 800; color: var(--accent-text); font-size: 1.1rem; }
.pet-bar { height: 8px; margin: 8px 0 4px; }
#pet-xp { text-align: center; color: #888; font-size: .8rem; }
.pet-hats-title { color: #aaa; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; margin: 16px 0 8px; }
.pet-hats { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 6px; }
.pet-hat {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--input); color: #ccc; font-size: .72rem; cursor: pointer;
}
.pet-hat .pet { width: 56px; height: 56px; }
.pet-hat:hover { border-color: var(--accent-soft); }
.pet-hat.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.pet-hat.locked { opacity: .45; cursor: default; }
.pet-hat.locked:hover { border-color: var(--border); }
#card-pet { display: flex; align-items: center; justify-content: center; gap: 8px; color: #aaa; font-size: .85rem; }
#card-pet:empty { display: none; }
#card-pet .pet { width: 52px; height: 52px; }
#card-pet b { color: var(--accent-text); }
#mascot-wrap { width: 48px; height: 48px; }
#mascot-wrap .logo { width: 48px; height: 48px; }

/* TOAST: a little message that pops up and goes away */
#toast {
  position: fixed; left: 50%; bottom: 100px; z-index: 31; transform: translate(-50%, 20px); opacity: 0;
  padding: 12px 20px; border-radius: 24px; background: var(--accent); color: var(--on-accent);
  font-weight: 700; box-shadow: 0 6px 20px rgba(0,0,0,.5); transition: opacity .3s, transform .3s; pointer-events: none;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* NAME STYLES: fun fonts and colours for your name (the fonts live in /fonts so everyone sees them) */
@font-face { font-family: 'name-fancy'; src: url('fonts/fancy.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'name-pixel'; src: url('fonts/pixel.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'name-bubble'; src: url('fonts/bubble.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'name-comic'; src: url('fonts/comic.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'name-handwritten'; src: url('fonts/handwritten.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'name-spooky'; src: url('fonts/spooky.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'name-medieval'; src: url('fonts/medieval.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'name-retro'; src: url('fonts/retro.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'name-round'; src: url('fonts/round.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'name-groovy'; src: url('fonts/groovy.woff2') format('woff2'); font-display: swap; }
.nf-fancy { font-family: 'name-fancy', cursive; font-size: 1.15em; font-weight: 400; }
.nf-pixel { font-family: 'name-pixel', monospace; font-weight: 400; }
.nf-bubble { font-family: 'name-bubble', sans-serif; font-weight: 400; }
.nf-comic { font-family: 'name-comic', sans-serif; font-weight: 400; letter-spacing: .03em; font-size: 1.1em; }
.nf-handwritten { font-family: 'name-handwritten', cursive; font-size: 1.2em; font-weight: 400; }
.nf-spooky { font-family: 'name-spooky', sans-serif; font-weight: 400; letter-spacing: .02em; }
.nf-medieval { font-family: 'name-medieval', serif; font-weight: 400; font-size: 1.1em; }
.nf-retro { font-family: 'name-retro', sans-serif; font-weight: 400; }
.nf-round { font-family: 'name-round', sans-serif; font-weight: 400; }
.nf-groovy { font-family: 'name-groovy', cursive; font-weight: 400; }
/* Colour mixes: the gradient shows through the letters */
[class*=" nc-"], [class^="nc-"] { -webkit-background-clip: text; background-clip: text; color: transparent !important; }
.nc-sunset  { background-image: linear-gradient(90deg, #ff6b6b, #fbbf24); }
.nc-ocean   { background-image: linear-gradient(90deg, #22d3ee, #3b82f6); }
.nc-candy   { background-image: linear-gradient(90deg, #f472b6, #a78bfa); }
.nc-lava    { background-image: linear-gradient(90deg, #ef4444, #f97316, #facc15); }
.nc-mint    { background-image: linear-gradient(90deg, #34d399, #a3e635); }
.nc-galaxy  { background-image: linear-gradient(90deg, #6366f1, #c084fc, #f0abfc); }
.nc-gold    { background-image: linear-gradient(90deg, #b45309, #fde68a, #d97706); }
.nc-rainbow {
  background-image: linear-gradient(90deg, #ef4444, #f97316, #facc15, #22c55e, #3b82f6, #a855f7, #ef4444);
  background-size: 200% 100%; animation: name-rainbow 3s linear infinite;
}
@keyframes name-rainbow { to { background-position: -200% 0; } }

/* The Name style box in settings */
.name-preview { font-size: 1.8rem; font-weight: 700; text-align: center; padding: 14px 8px; margin-bottom: 12px;
  background: var(--bg); border-radius: 10px; word-break: break-all; color: #fff; }
.name-fonts { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; margin-bottom: 14px; }
.name-font {
  padding: 8px 6px; border: 1px solid var(--border); border-radius: 8px; background: var(--input);
  color: #ddd; cursor: pointer; font-size: 1rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.name-font small { display: block; font-family: -apple-system, 'Segoe UI', sans-serif; font-size: .68rem; color: #888; margin-top: 2px; }
.name-font.selected, .swatch.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.name-colours { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.name-colours .mix { border-radius: 50%; }
.name-colours input[type=color] { width: 30px; height: 30px; padding: 0; border: 2px dashed #888; border-radius: 50%; background: none; cursor: pointer; overflow: hidden; }
.name-colours input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.name-colours input[type=color]::-webkit-color-swatch { border: none; border-radius: 50%; }
