[hidden] { display: none !important; }
/* ============ THEMES ============ */
:root, [data-theme="galaxy"] {
  --bg: #05030f;
  --side: rgba(12, 8, 30, 0.72);
  --panel: rgba(255, 255, 255, 0.06);
  --panel-2: rgba(255, 255, 255, 0.1);
  --border: rgba(255, 255, 255, 0.12);
  --text: #eef0ff;
  --muted: #a9aed0;
  --accent: #a66bff;
  --user-bg: linear-gradient(135deg, #4fd8ff, #a66bff 55%, #ff5fc8);
  --user-text: #fff;
  --code-bg: rgba(0, 0, 0, 0.45);
  --grad: linear-gradient(135deg, #4fd8ff, #a66bff 50%, #ff5fc8);
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
[data-theme="dark"] {
  --bg: #141417;
  --side: #1b1b1f;
  --panel: #232328;
  --panel-2: #2c2c32;
  --border: #33333a;
  --text: #ececf1;
  --muted: #9a9aa5;
  --accent: #a66bff;
  --user-bg: #2f2f37;
  --user-text: #ececf1;
  --code-bg: #0e0e10;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}
[data-theme="light"] {
  --bg: #f7f6fb;
  --side: #efedf6;
  --panel: #ffffff;
  --panel-2: #e9e6f3;
  --border: #dcd8ea;
  --text: #1b1830;
  --muted: #6b6787;
  --accent: #7b3fe4;
  --user-bg: #e6defa;
  --user-text: #1b1830;
  --code-bg: #1e1b2e;
  --shadow: 0 10px 40px rgba(40, 20, 90, 0.15);
}
:root { --font-scale: 1; --side-w: 280px; }

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Montserrat", "Segoe UI", system-ui, sans-serif;
  font-size: calc(15px * var(--font-scale));
  background: var(--bg); color: var(--text); overflow: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
a { color: inherit; text-decoration: none; }

/* galaxy background only in galaxy theme */
#stars { position: fixed; inset: 0; z-index: -1; }
[data-theme]:not([data-theme="galaxy"]) #stars { display: none; }
[data-theme="galaxy"] body::before {
  content: ""; position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(123, 63, 228, 0.35), transparent 50%),
    radial-gradient(ellipse at 85% 80%, rgba(255, 95, 200, 0.18), transparent 50%),
    radial-gradient(ellipse at 60% 40%, rgba(79, 216, 255, 0.12), transparent 60%);
}

/* ============ LAYOUT ============ */
.layout { display: flex; height: 100dvh; }
.sidebar {
  width: var(--side-w); flex-shrink: 0; display: flex; flex-direction: column; gap: 4px;
  background: var(--side); border-right: 1px solid var(--border); padding: 12px 10px;
  backdrop-filter: blur(14px);
}
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.side-top { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 10px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.1rem; }
.brand img { width: 32px; height: 32px; }

.side-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 10px; border-radius: 10px; color: var(--text);
}
.side-item:hover, .side-item.active { background: var(--panel-2); }
.side-item .ico { width: 20px; text-align: center; }
.side-item kbd { margin-left: auto; font-size: .68rem; color: var(--muted); font-family: inherit; }
.side-item.primary { font-weight: 700; }
.search { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 0 10px; margin: 4px 0 6px; }
.search .ico { color: var(--muted); }
.search input { flex: 1; background: none; border: none; outline: none; padding: 9px 0; }
.side-nav { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }

.side-section-title {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px 4px; font-weight: 700;
}
.chat-list { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.group-label { font-size: .75rem; color: var(--muted); padding: 12px 10px 4px; text-transform: uppercase; letter-spacing: .05em; }
.chat-row {
  display: flex; align-items: center; border-radius: 10px; padding: 0 4px 0 10px; position: relative;
}
.chat-row:hover, .chat-row.active { background: var(--panel-2); }
.chat-row .name { flex: 1; padding: 8px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.chat-row .more { opacity: 0; padding: 4px 8px; border-radius: 6px; color: var(--muted); }
.chat-row:hover .more, .chat-row.active .more { opacity: 1; }
.chat-row .more:hover { background: var(--panel); color: var(--text); }
.chat-row input { flex: 1; background: var(--panel); border: 1px solid var(--accent); border-radius: 6px; padding: 6px 8px; outline: none; margin: 2px 0; }
.empty-list { color: var(--muted); padding: 14px 10px; font-size: .9rem; }

.side-bottom { border-top: 1px solid var(--border); padding-top: 10px; }
.brain-pill { display: flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--muted); padding: 6px 10px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #f5b942; box-shadow: 0 0 8px currentColor; }
.dot.ready { background: #3ddc84; }
.dot.error { background: #ff5f5f; }

.icon-btn { padding: 6px 9px; border-radius: 8px; color: var(--muted); }
.icon-btn:hover { background: var(--panel-2); color: var(--text); }

/* ============ TOP BAR ============ */
.topbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; min-height: 56px; }
.chat-title { font-weight: 700; padding: 6px 10px; border-radius: 8px; cursor: text; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60%; }
.chat-title:hover { background: var(--panel); }
.chat-title input { background: var(--panel); border: 1px solid var(--accent); border-radius: 6px; padding: 4px 8px; outline: none; font-weight: 700; width: 100%; }
.top-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.project-chip { font-size: .8rem; background: var(--panel); border: 1px solid var(--border); padding: 4px 10px; border-radius: 99px; }
.progress-strip { height: 3px; background: var(--panel); }
.progress-strip > div { height: 100%; width: 0; background: var(--grad, var(--accent)); transition: width .3s; }

/* ============ MESSAGES ============ */
.messages { flex: 1; overflow-y: auto; padding: 10px 16px 30px; }
.thread { max-width: 780px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
.msg { display: flex; gap: 12px; }
.msg.user { justify-content: flex-end; }
.msg .avatar { width: 30px; height: 30px; flex-shrink: 0; margin-top: 2px; }
.bubble { line-height: 1.65; word-wrap: break-word; min-width: 0; }
.msg.user .bubble { background: var(--user-bg); color: var(--user-text); padding: 10px 16px; border-radius: 18px 18px 4px 18px; max-width: 80%; white-space: pre-wrap; }
.msg.bot .bubble { flex: 1; }
.msg.bot .content > * + * { margin-top: .7em; }
.content h1, .content h2, .content h3 { font-size: 1.1em; }
.content ul, .content ol { padding-left: 1.4em; }
.content a { color: var(--accent); text-decoration: underline; }
.content code { background: var(--panel-2); padding: 1px 6px; border-radius: 5px; font-family: Consolas, "Cascadia Code", monospace; font-size: .9em; }
.content pre { background: var(--code-bg); color: #e8e6f5; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.content pre .code-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 12px; font-size: .75rem; color: #a9aed0; background: rgba(255,255,255,.05); }
.content pre .code-head button { color: #a9aed0; font-size: .75rem; }
.content pre .code-head button:hover { color: #fff; }
.content pre code { display: block; background: none; padding: 12px 14px; overflow-x: auto; white-space: pre; }
.content blockquote { border-left: 3px solid var(--accent); padding-left: 12px; color: var(--muted); }
.typing-dots span { display: inline-block; width: 7px; height: 7px; margin-right: 4px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing-dots span:nth-child(2) { animation-delay: .2s; } .typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }

.msg-actions { display: flex; gap: 2px; margin-top: 6px; opacity: 0; transition: opacity .15s; }
.msg:hover .msg-actions, .msg:last-child .msg-actions { opacity: 1; }
.msg-actions button { font-size: .8rem; color: var(--muted); padding: 4px 8px; border-radius: 6px; }
.msg-actions button:hover { background: var(--panel-2); color: var(--text); }
.msg.user .msg-actions { justify-content: flex-end; }

/* empty state */
.hello { max-width: 720px; margin: 8vh auto 0; text-align: center; }
.hello img { width: 96px; filter: drop-shadow(0 0 25px rgba(166,107,255,.55)); }
.hello h1 { font-size: 1.9rem; margin: 14px 0 6px; }
.hello p { color: var(--muted); }
.chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-top: 28px; text-align: left; }
.chip { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 14px; color: var(--text); }
.chip:hover { background: var(--panel-2); }
.chip b { display: block; margin-bottom: 2px; }
.chip span { color: var(--muted); font-size: .88rem; }

/* composer */
.composer-wrap { padding: 0 16px calc(10px + env(safe-area-inset-bottom)); }
.composer {
  max-width: 780px; margin: 0 auto; display: flex; align-items: flex-end; gap: 8px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 22px; padding: 8px 8px 8px 16px;
  box-shadow: var(--shadow);
}
.composer:focus-within { border-color: var(--accent); }
.composer textarea { flex: 1; resize: none; background: none; border: none; outline: none; padding: 8px 0; max-height: 200px; line-height: 1.5; }
.composer-actions { display: flex; gap: 6px; align-items: center; }
.send { width: 38px; height: 38px; border-radius: 50%; background: var(--grad, var(--accent)); color: #fff; font-size: 1.1rem; font-weight: 800; }
[data-theme="dark"] .send, [data-theme="light"] .send { background: var(--accent); }
.send:disabled { opacity: .4; cursor: default; }
.send.stop { background: var(--text); color: var(--bg); font-size: .8rem; }
.disclaimer { text-align: center; font-size: .72rem; color: var(--muted); margin-top: 8px; }

/* ============ MODAL / MENU / TOAST ============ */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal-card { background: var(--side); backdrop-filter: blur(20px); border: 1px solid var(--border); border-radius: 18px; width: min(560px, 100%); max-height: 88dvh; display: flex; flex-direction: column; box-shadow: var(--shadow); }
[data-theme="dark"] .modal-card { background: #1e1e23; } [data-theme="light"] .modal-card { background: #fff; }
[data-theme="galaxy"] .modal-card { background: rgba(18, 12, 42, .95); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px 8px; }
.modal-body { padding: 8px 20px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; }
.field label { display: block; font-weight: 700; margin-bottom: 6px; }
.field small { display: block; color: var(--muted); margin-top: 4px; }
.field input[type=text], .field textarea, .field select {
  width: 100%; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; outline: none;
}
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field textarea:focus { border-color: var(--accent); }
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg button { flex: 1; min-width: 100px; padding: 12px; border-radius: 12px; background: var(--panel); border: 2px solid var(--border); }
.seg button.on { border-color: var(--accent); background: var(--panel-2); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.switch { width: 44px; height: 24px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--border); position: relative; flex-shrink: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: .2s; }
.switch.on { background: var(--accent); } .switch.on::after { left: 22px; background: #fff; }
.btn { padding: 10px 16px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--border); font-weight: 600; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: #fff; border-color: transparent; }
.btn.danger { color: #ff6b6b; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.hr { height: 1px; background: var(--border); }
.project-card { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--border); cursor: pointer; }
.project-card:hover { border-color: var(--accent); }
.project-card .emoji { font-size: 1.5rem; }
.project-card .info { flex: 1; min-width: 0; }
.project-card .info small { color: var(--muted); }

.menu { position: fixed; z-index: 60; background: var(--side); border: 1px solid var(--border); border-radius: 12px; padding: 6px; min-width: 190px; box-shadow: var(--shadow); backdrop-filter: blur(20px); }
[data-theme="galaxy"] .menu { background: rgba(18, 12, 42, .97); } [data-theme="light"] .menu { background: #fff; } [data-theme="dark"] .menu { background: #232328; }
.menu button { display: flex; gap: 10px; width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px; }
.menu button:hover { background: var(--panel-2); }
.menu button.danger { color: #ff6b6b; }
.menu .sub { font-size: .75rem; color: var(--muted); padding: 6px 10px 2px; }

.toast { position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 99px; font-weight: 600; z-index: 70; font-size: .9rem; }

/* ============ MOBILE ============ */
.only-mobile { display: none; }
.scrim { display: none; }
@media (max-width: 800px) {
  .only-mobile { display: inline-block; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; transform: translateX(-100%); transition: transform .25s; width: min(300px, 85vw); }
  [data-theme="galaxy"] .sidebar { background: rgba(10, 6, 26, .97); }
  .sidebar.open { transform: none; }
  .scrim.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 39; }
  .chat-row .more { opacity: 1; }
  .side-item kbd { display: none; }
  .msg .avatar { display: none; }
  .hello { margin-top: 4vh; }
}

/* ============ IMAGES ============ */
.attach-row { max-width: 780px; margin: 0 auto 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.attach-row .thumb { position: relative; width: 64px; height: 64px; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); }
.attach-row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.attach-row .thumb button { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; background: rgba(0,0,0,.7); color: #fff; font-size: .7rem; line-height: 20px; }
.composer .attach-btn { align-self: flex-end; margin-left: -8px; }
.composer-wrap.drag .composer { border-color: var(--accent); border-style: dashed; }
.msg-images { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; margin-bottom: 6px; }
.msg-images img { max-width: 220px; max-height: 220px; border-radius: 14px; border: 1px solid var(--border); cursor: zoom-in; object-fit: cover; }
.lightbox img { max-width: 100%; max-height: 75dvh; border-radius: 12px; display: block; margin: 0 auto; }

/* ============ VOICE ============ */
.icon-btn.recording { background: #e5484d; color: #fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(229,72,77,.6); } 50% { box-shadow: 0 0 0 8px rgba(229,72,77,0); } }
.voice { position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 24px;
  background: radial-gradient(ellipse at 50% 40%, #3a1d7a, #05030f 70%); color: #fff; text-align: center; }
[data-theme="light"] .voice { background: radial-gradient(ellipse at 50% 40%, #e3d6ff, #f7f6fb 70%); color: var(--text); }
[data-theme="light"] .voice-btns button:not(.end) { background: rgba(0,0,0,.06); border-color: rgba(0,0,0,.12); }
.voice-orb { --level: 0; width: 200px; height: 200px; border-radius: 50%; cursor: pointer; display: grid; place-items: center;
  transform: scale(calc(1 + var(--level) * .35)); transition: transform .08s linear;
  box-shadow: 0 0 calc(40px + var(--level) * 120px) rgba(166,107,255,.8), 0 0 0 6px rgba(255,255,255,.08); }
.voice-orb img { width: 100%; height: 100%; }
.voice.thinking .voice-orb { animation: spin 2.4s linear infinite; }
.voice.speaking .voice-orb { animation: breathe 1.4s ease-in-out infinite; }
@keyframes spin { to { rotate: 360deg; } }
@keyframes breathe { 50% { transform: scale(1.12); } }
.voice-state { font-size: 1.4rem; font-weight: 800; }
.voice-text { max-width: 620px; min-height: 3em; opacity: .8; line-height: 1.5; max-height: 30dvh; overflow-y: auto; }
.voice-btns { display: flex; gap: 12px; }
.voice-btns button { padding: 14px 24px; border-radius: 99px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); color: inherit; font-weight: 700; }
.voice-btns button.on { background: #e5484d; }
.voice-btns .end { background: #e5484d; border-color: transparent; color: #fff; }

/* ============ ACCOUNT ============ */
.account { margin-bottom: 6px; }
.account a.signin { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px; border-radius: 12px;
  background: var(--panel-2); border: 1px solid var(--border); font-weight: 700; }
.account a.signin:hover { border-color: var(--accent); }
.account .me { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 12px; cursor: pointer; width: 100%; text-align: left; }
.account .me:hover { background: var(--panel-2); }
.account .me img, .account .me .ph { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; }
.account .me .ph { display: grid; place-items: center; background: var(--accent); color: #fff; font-weight: 800; }
.account .me .who { min-width: 0; }
.account .me .who b, .account .me .who small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account .me .who small { color: var(--muted); font-size: .75rem; }
.mem-list { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; }
.mem-item { display: flex; gap: 8px; align-items: center; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; }
.mem-item span { flex: 1; line-height: 1.4; }
.mem-add { display: flex; gap: 8px; margin-top: 8px; }
.mem-add input { flex: 1; }

/* ============ TABLES & CHECKLISTS ============ */
.content .table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
.content table { border-collapse: collapse; width: 100%; font-size: .93em; }
.content th, .content td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.content th { background: var(--panel-2); font-weight: 700; }
.content tr:last-child td { border-bottom: none; }
.content tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--panel) 60%, transparent); }
.content ul.checklist { list-style: none; padding-left: 0; }
.content ul.checklist li { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0; }
.content ul.checklist .box { width: 20px; height: 20px; flex-shrink: 0; border-radius: 6px; border: 2px solid var(--accent); display: grid; place-items: center; font-size: .8rem; font-weight: 800; margin-top: 2px; }
.content ul.checklist li.done .box { background: var(--accent); color: #fff; }
.content ul.checklist li.done > span:last-child { text-decoration: line-through; color: var(--muted); }
.content hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }

.share-btn { font-size: .85rem; border: 1px solid var(--border); }

/* ============ PLANS ============ */
.upgrade-btn { display: block; text-align: center; padding: 10px; margin-bottom: 8px; border-radius: 12px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, #4fd8ff, #a66bff 50%, #ff5fc8); box-shadow: 0 0 24px rgba(166,107,255,.4); }
.plan-badge { font-size: .65rem; font-weight: 800; padding: 2px 7px; border-radius: 99px; vertical-align: middle; margin-left: 4px; background: var(--panel-2); color: var(--muted); }
.plan-badge.pro { background: #a66bff; color: #fff; }
.plan-badge.max { background: linear-gradient(135deg, #4fd8ff, #ff5fc8); color: #fff; }
.mini-plans { display: grid; gap: 10px; }
.mini-plan { padding: 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--border); }
.mini-plan.max { border-color: var(--accent); }
.mini-plan b { display: block; margin-bottom: 4px; }
.mini-plan span { color: var(--muted); font-size: .9rem; }

/* ============ OWNER ============ */
.owner-btn { opacity: .45; }
.owner-btn:hover, .owner-btn.on { opacity: 1; }
.owner-btn.on { background: linear-gradient(135deg, rgba(255,200,60,.25), rgba(255,95,200,.2)); }
.own-err { color: #ff6b6b; min-height: 1.2em; font-size: .9rem; }
.own-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.own-stat { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 12px; text-align: center; }
.own-stat b { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 1.5rem; }
.own-stat span { color: var(--muted); font-size: .78rem; }
.own-stat i.live { width: 9px; height: 9px; border-radius: 50%; background: #3ddc84; box-shadow: 0 0 10px #3ddc84; animation: blink 1.6s infinite; }
.own-list { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; }
.own-row { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; }
.own-row span { flex: 1; min-width: 0; }
.own-row b, .own-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.own-row small { color: var(--muted); font-size: .78rem; }
.own-note { color: var(--muted); font-size: .9rem; }
@media (max-width: 520px) { .own-grid { grid-template-columns: repeat(2, 1fr); } }

/* ============ THINKING & STEPS ============ */
.activity:empty { display: none; }
.activity { margin-bottom: 8px; display: flex; flex-direction: column; gap: 6px; }
.think { border: 1px solid var(--border); border-radius: 12px; background: var(--panel); overflow: hidden; }
.think summary { cursor: pointer; list-style: none; padding: 8px 12px; font-size: .88rem; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.think summary::after { content: "›"; margin-left: auto; transition: transform .2s; font-size: 1.1rem; }
.think[open] summary::after { transform: rotate(90deg); }
.think-text { padding: 0 12px 12px; font-size: .84rem; color: var(--muted); line-height: 1.55; max-height: 260px; overflow-y: auto; border-top: 1px solid var(--border); padding-top: 10px; }
.think-peek { font-size: .8rem; color: var(--muted); opacity: .75; padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; mask-image: linear-gradient(90deg, transparent, #000 15%); }
.shimmer { background: linear-gradient(90deg, var(--muted) 30%, var(--text) 50%, var(--muted) 70%); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 1.6s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.steps { display: flex; flex-direction: column; gap: 4px; }
.step { display: flex; align-items: center; gap: 8px; font-size: .84rem; color: var(--muted); padding: 2px 4px; }
.step.live { color: var(--text); }
.step.live::after { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--accent); border-top-color: transparent; animation: spin 0.8s linear infinite; }
.gen-images:empty { display: none; }
.gen-images { display: grid; gap: 10px; margin-top: 10px; max-width: 420px; }
.gen-img { margin: 0; border-radius: 16px; overflow: hidden; border: 1px solid var(--border); background: var(--panel); position: relative; }
.gen-img img { display: block; width: 100%; cursor: zoom-in; }
.gen-img figcaption { position: absolute; right: 8px; bottom: 8px; }
.gen-img figcaption button { background: rgba(0,0,0,.65); color: #fff; padding: 6px 10px; border-radius: 99px; font-size: .78rem; }
.gen-img.loading { aspect-ratio: 1; display: grid; place-items: center; }
.gen-img.loading span { position: relative; color: var(--muted); font-weight: 600; font-size: .9rem; }
.gen-shimmer { position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(166,107,255,.25) 50%, transparent 70%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }

/* Upgrade button in the top bar */
.top-upgrade { display: inline-flex; align-items: center; gap: 4px; padding: 7px 14px; border-radius: 999px; font-weight: 800; font-size: .88rem; color: #fff; white-space: nowrap;
  background: linear-gradient(135deg, #4fd8ff, #a66bff 50%, #ff5fc8); box-shadow: 0 0 18px rgba(166,107,255,.45); transition: transform .15s, box-shadow .15s; }
.top-upgrade:hover { transform: translateY(-1px); box-shadow: 0 0 28px rgba(166,107,255,.7); }
.top-upgrade[hidden] { display: none !important; }
@media (max-width: 520px) { .top-upgrade { padding: 6px 10px; font-size: .8rem; } }

/* rank chip */
.rank-chip { border: none; cursor: pointer; padding: 7px 13px; border-radius: 999px; font: inherit; font-weight: 800; font-size: .86rem; color: #fff; white-space: nowrap; }
.rank-chip.rank-pro { background: linear-gradient(135deg, #4fd8ff, #a66bff); box-shadow: 0 0 16px rgba(79,216,255,.4); }
.rank-chip.rank-max { background: linear-gradient(135deg, #a66bff, #ff5fc8); box-shadow: 0 0 18px rgba(255,95,200,.45); }
.rank-chip.rank-owner { background: linear-gradient(135deg, #ffd84f, #ff9f43 50%, #ff5fc8); color: #2a1300; box-shadow: 0 0 18px rgba(255,200,60,.5); }
.rank-chip[hidden] { display: none !important; }
h2.rank-pro { background: linear-gradient(135deg, #4fd8ff, #a66bff); -webkit-background-clip: text; background-clip: text; color: transparent; }
h2.rank-max { background: linear-gradient(135deg, #a66bff, #ff5fc8); -webkit-background-clip: text; background-clip: text; color: transparent; }
h2.rank-owner { background: linear-gradient(135deg, #ffd84f, #ff5fc8); -webkit-background-clip: text; background-clip: text; color: transparent; }
/* announcement bar */
.announce { display: flex; align-items: center; gap: 10px; margin: 0 16px 6px; padding: 10px 14px; border-radius: 14px; font-weight: 600;
  background: linear-gradient(135deg, rgba(79,216,255,.18), rgba(166,107,255,.22) 50%, rgba(255,95,200,.18)); border: 1px solid rgba(166,107,255,.5); box-shadow: 0 0 24px rgba(166,107,255,.25); }
.announce[hidden] { display: none !important; }
.announce #announceText { flex: 1; line-height: 1.4; word-break: break-word; }
.announce button { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1rem; }
.announce.pop { animation: annpop .6s ease; }
@keyframes annpop { 0% { transform: translateY(-14px) scale(.96); opacity: 0; } 60% { transform: translateY(2px) scale(1.01); opacity: 1; } 100% { transform: none; } }
.ann-icon { font-size: 1.2rem; }
/* gift popup */
.gift-pop { text-align: center; }
.gift-pop h2 { font-size: 1.9rem; margin: 6px 0; font-weight: 900; }
.gift-box { font-size: 4rem; animation: giftbounce 1s ease infinite; }
@keyframes giftbounce { 50% { transform: translateY(-8px) rotate(-6deg); } }
.gift-perks { list-style: none; display: grid; gap: 6px; margin: 14px auto; max-width: 280px; text-align: left; }
.gift-perks li::before { content: "✓ "; color: var(--accent); font-weight: 900; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 100; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { top: 105%; transform: translateX(40px) rotate(720deg); } }
/* owner: players */
.own-row .pnum { font-weight: 900; }
.own-row .tag { display: inline-block; font-size: .72rem; font-weight: 800; padding: 2px 8px; border-radius: 99px; margin-left: 6px; vertical-align: middle; }
.tag.pro { background: rgba(79,216,255,.2); color: #4fd8ff; } .tag.max { background: rgba(255,95,200,.2); color: #ff8fd8; } .tag.owner { background: rgba(255,200,60,.2); color: #ffd84f; }
.own-row .mini { padding: 6px 10px; font-size: .85rem; }
#annText { width: 100%; min-height: 64px; resize: vertical; }

/* 💬 talk to the owner */
.badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: #ff4d6d; color: #fff; font-size: .7rem; font-weight: 900; margin-left: auto; box-shadow: 0 0 10px rgba(255,77,109,.6); }
.badge[hidden] { display: none !important; }
.inbox-btn { position: relative; }
.inbox-btn .badge { position: absolute; top: -4px; right: -4px; margin: 0; }
.inbox-btn[hidden] { display: none !important; }
.main { position: relative; }
.talk-bubble { position: absolute; right: 18px; bottom: 118px; z-index: 5; display: flex; align-items: center; gap: 10px; border: 1px solid rgba(166,107,255,.6); cursor: pointer;
  padding: 10px 12px 10px 16px; border-radius: 18px 18px 4px 18px; font: inherit; font-size: .9rem; color: var(--text);
  background: linear-gradient(135deg, rgba(79,216,255,.22), rgba(166,107,255,.3) 50%, rgba(255,95,200,.22)); backdrop-filter: blur(10px); box-shadow: 0 0 24px rgba(166,107,255,.35); animation: bubblein .5s ease, bob2 3s ease-in-out 1s infinite; }
.talk-bubble[hidden] { display: none !important; }
.talk-bubble i { font-style: normal; color: var(--muted); padding: 2px 4px; }
@keyframes bubblein { from { transform: translateY(16px); opacity: 0; } }
@keyframes bob2 { 50% { transform: translateY(-4px); } }
@media (max-width: 700px) { .talk-bubble { right: 10px; bottom: 112px; font-size: .82rem; } }
.dm { display: flex; flex-direction: column; gap: 8px; max-height: 46vh; min-height: 160px; overflow-y: auto; padding: 10px; border-radius: 14px; background: rgba(0,0,0,.2); border: 1px solid var(--border); }
.dm .b { max-width: 82%; padding: 8px 12px; border-radius: 16px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.dm .b small { display: block; font-size: .68rem; opacity: .7; margin-top: 3px; }
.dm .me { align-self: flex-end; background: linear-gradient(135deg, #4fd8ff, #a66bff 55%, #ff5fc8); color: #fff; border-bottom-right-radius: 4px; }
.dm .them { align-self: flex-start; background: var(--panel); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.dm .who { font-size: .72rem; font-weight: 800; color: #ffd84f; margin-bottom: 2px; }
.dm-empty { margin: auto; text-align: center; color: var(--muted); font-size: .9rem; }
.dm-send { display: flex; gap: 8px; margin-top: 10px; }
.dm-send textarea { flex: 1; resize: none; min-height: 44px; max-height: 120px; }
.dm-thread { cursor: pointer; }
.dm-thread.unread b { color: #fff; }
.dm-thread .dot { width: 8px; height: 8px; border-radius: 50%; background: #3ddc84; display: inline-block; margin-right: 4px; }
.own-list .own-row { width: 100%; align-self: stretch; text-align: left; }
.dm-thread .badge { margin-left: 8px; flex: none; }
.dm-send textarea, #annText { background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 14px; padding: 10px 12px; font: inherit; outline: none; }
.dm-send textarea:focus, #annText:focus { border-color: var(--accent); }
.own-row.dm-thread { display: flex !important; flex-wrap: nowrap; justify-content: flex-start; }
.own-row.dm-thread > span:first-child { flex: 1 1 auto; text-align: left; }
.own-row.dm-thread > .badge { flex: 0 0 auto; min-width: 20px; }
.own-row.dm-thread b, .own-row.dm-thread small { text-align: left; }

/* nickname gate */
.nick-gate { position: fixed; inset: 0; z-index: 200; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; overflow-y: auto; padding: 16px; background: rgba(5,3,15,.82); backdrop-filter: blur(14px); }
.nick-gate[hidden] { display: none !important; }
.nick-card { width: 100%; max-width: 400px; min-width: 0; text-align: center; background: var(--side, #120a2a); border: 1px solid rgba(166,107,255,.5); border-radius: 24px; padding: 28px 24px 20px;
  box-shadow: 0 0 70px rgba(166,107,255,.35); display: flex; flex-direction: column; gap: 10px; animation: bubblein .4s ease; }
.nick-card img { width: 84px; height: 84px; margin: 0 auto; filter: drop-shadow(0 0 22px rgba(166,107,255,.7)); }
.nick-card h2 { font-size: 1.45rem; }
.nick-card p { color: var(--muted); }
.grad-text { background: linear-gradient(135deg, #4fd8ff, #a66bff 50%, #ff5fc8); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nick-card input { text-align: center; font: inherit; font-size: 1.15rem; font-weight: 700; padding: 13px; border-radius: 14px; outline: none;
  background: var(--panel); color: var(--text); border: 1px solid var(--border); }
.nick-card input:focus { border-color: var(--accent, #a66bff); box-shadow: 0 0 0 3px rgba(166,107,255,.25); }
.nick-card input.shake { animation: shake .35s; border-color: #ff4d6d; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.nick-err { color: #ff6b81 !important; min-height: 1.2em; font-size: .88rem; font-weight: 600; }
.nick-card .btn { padding: 13px; font-size: 1rem; }
.nick-card small { color: var(--muted); font-size: .76rem; line-height: 1.5; }

/* files + web search */
.file-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 240px; padding: 7px 10px; border-radius: 12px; font-size: .85rem; font-weight: 600;
  background: var(--panel); border: 1px solid var(--border); }
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip button { background: none; border: none; color: var(--muted); cursor: pointer; }
.attach-row .file-chip { align-self: center; }
.msg-files { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; margin-bottom: 6px; }
.search-btn.on { background: linear-gradient(135deg, rgba(79,216,255,.35), rgba(166,107,255,.35)); box-shadow: 0 0 14px rgba(79,216,255,.5); opacity: 1; }
.searching { color: var(--muted); animation: blink 1.4s infinite; }
.more-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.more-row[hidden] { display: none !important; }
.more-row button { padding: 6px 12px; border-radius: 99px; font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer; color: var(--text);
  background: var(--panel); border: 1px solid var(--border); transition: border-color .15s, transform .15s; }
.more-row button:hover { border-color: var(--accent); transform: translateY(-1px); }
/* phone-size fixes: roomier top bar + composer */
@media (max-width: 520px) {
  .topbar { gap: 6px; padding: 8px 10px; }
  .chat-title { flex: 1; min-width: 0; max-width: none; padding: 6px 4px; }
  .top-actions { gap: 4px; flex-shrink: 0; }
  .share-btn { padding: 6px 8px; white-space: nowrap; }
  .share-btn .lbl { display: none; }
  .top-upgrade { padding: 6px 10px; }
  .composer { gap: 4px; }
  .composer-actions { gap: 2px; }
  .composer .icon-btn { padding: 6px 6px; }
  .composer textarea { min-width: 0; }
}

/* computer helper */
.beta { font-size: .65rem; font-weight: 800; padding: 2px 6px; border-radius: 99px; background: rgba(166,107,255,.25); color: #cdb4ff; margin-left: auto; }
.folder-chip { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; padding: 8px 12px; border-radius: 14px; font-size: .88rem;
  background: linear-gradient(135deg, rgba(79,216,255,.14), rgba(166,107,255,.18)); border: 1px solid rgba(79,216,255,.4); }
.folder-chip[hidden] { display: none !important; }
.folder-chip span { color: var(--muted); flex: 1; }
.folder-chip button { background: none; border: none; color: var(--muted); cursor: pointer; }
.extras:empty { display: none; }
.extras { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.act-links { display: flex; flex-wrap: wrap; gap: 8px; }
.act-link { display: inline-flex; align-items: center; gap: 6px; padding: 10px 16px; border-radius: 99px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, #4fd8ff, #a66bff 50%, #ff5fc8); box-shadow: 0 0 18px rgba(166,107,255,.4); }
.timer-chip { align-self: flex-start; padding: 10px 16px; border-radius: 14px; background: var(--panel); border: 1px solid var(--border); font-size: 1rem; }
.timer-chip .tleft { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--accent); }
.timer-chip.done { border-color: #3ddc84; }
.plan-card { border-radius: 16px; padding: 14px 16px; background: var(--panel); border: 1px solid rgba(166,107,255,.5); }
.plan-card.done { border-color: rgba(61,220,132,.6); }
.plan-card.cancelled { opacity: .6; }
.plan-head { font-weight: 700; margin-bottom: 8px; }
.plan-card ul { list-style: none; display: grid; gap: 6px; margin-bottom: 10px; font-size: .9rem; max-height: 260px; overflow-y: auto; }
.plan-card li { padding: 6px 10px; border-radius: 10px; background: rgba(0,0,0,.2); word-break: break-word; }
.plan-card small { color: var(--muted); display: block; margin-top: 6px; }
.folder-chip { max-width: 780px; width: 100%; margin: 0 auto 8px; }

/* build a project */
.build-card { border-radius: 16px; padding: 14px 16px; background: var(--panel); border: 1px solid rgba(79,216,255,.45); }
.build-card .plan-head small { color: var(--muted); font-weight: 600; margin-left: 6px; }
.proj-files { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; }
.proj-file { font: inherit; font-size: .82rem; padding: 6px 10px; border-radius: 10px; cursor: pointer; color: var(--text); background: rgba(0,0,0,.25); border: 1px solid var(--border); }
.proj-file:hover { border-color: var(--accent); }
.build-card .btn-row { flex-wrap: wrap; }
.file-view { max-height: 60vh; overflow: auto; background: rgba(0,0,0,.35); border-radius: 12px; padding: 12px; font-size: .82rem; white-space: pre; }
.modal.wide .modal-card { width: min(1100px, 100%); }
.preview-wrap { border-radius: 14px; overflow: hidden; border: 1px solid var(--border); background: #fff; }
.preview-frame { display: block; width: 100%; height: min(68vh, 720px); border: 0; background: #fff; }
.build-idea { width: 100%; min-height: 110px; margin-top: 10px; resize: vertical; background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 14px; padding: 12px; font: inherit; outline: none; }
.build-idea:focus { border-color: var(--accent); }
.build-ideas { display: flex; flex-wrap: wrap; gap: 6px; }
.build-ideas button { font: inherit; font-size: .82rem; padding: 6px 12px; border-radius: 99px; cursor: pointer; color: var(--text); background: var(--panel); border: 1px solid var(--border); }
.build-ideas button:hover { border-color: var(--accent); }
.code-head button + button { margin-left: 6px; }
.writing { margin-top: 10px; padding: 10px 14px; border-radius: 12px; background: var(--panel); border: 1px dashed rgba(79,216,255,.5); color: var(--muted); animation: blink 1.4s infinite; }
.dm .who.mine { color: rgba(255,255,255,.85); text-align: right; }
.rank-chip.rank-owner { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }

/* coding friends */
.fr-row { display: flex; gap: 8px; }
.fr-row input { flex: 1; min-width: 0; background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; font: inherit; outline: none; }
.fr-row input:focus { border-color: var(--accent); }
.rm-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.rm-code { font: inherit; font-weight: 800; font-size: .85rem; padding: 4px 10px; border-radius: 99px; cursor: pointer; color: var(--text); background: rgba(79,216,255,.15); border: 1px solid rgba(79,216,255,.45); margin-left: 6px; }
.rm-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.rm-members { display: flex; flex-wrap: wrap; gap: 6px; }
.rm-mem { display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 99px; font-size: .82rem; background: var(--panel); border: 1px solid var(--border); color: var(--muted); }
.rm-mem.on { color: var(--text); border-color: rgba(61,220,132,.5); }
.rm-mem button { background: none; border: none; color: var(--muted); cursor: pointer; padding: 0 2px; }
.rm-mem .dot, .dm-thread .dot { width: 8px; height: 8px; border-radius: 50%; background: #3ddc84; display: inline-block; }
.rm-msgs { max-height: 50vh; min-height: 260px; }
.rm-sys { align-self: center; font-size: .78rem; color: var(--muted); padding: 2px 10px; }
.dm .b.pinged { box-shadow: 0 0 0 2px #ffd84f; }
.dm .at { color: #ffd84f; }
.dm .me .at { color: #fff; text-decoration: underline; }
.rm-ai { max-width: 92% !important; }
.rm-ai-body { line-height: 1.5; }
.rm-ai-body pre { max-height: 240px; overflow: auto; }
.rm-proj:empty { display: none; }
.rm-proj { margin-top: 8px; }
.rm-tips { display: flex; flex-wrap: wrap; gap: 6px; }
.rm-tips button { font: inherit; font-size: .8rem; padding: 6px 12px; border-radius: 99px; cursor: pointer; color: var(--text); background: var(--panel); border: 1px solid var(--border); }
.rm-tips .danger-txt { color: #ff6b81; margin-left: auto; }
.btn.danger { background: #e5484d; color: #fff; border-color: #e5484d; }
.call-bar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 120; display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 18px; border-radius: 99px;
  background: linear-gradient(135deg, rgba(61,220,132,.25), rgba(79,216,255,.25)); border: 1px solid rgba(61,220,132,.6); backdrop-filter: blur(14px); box-shadow: 0 10px 40px rgba(0,0,0,.5); font-size: .9rem; max-width: calc(100vw - 24px); }
.call-bar button { font: inherit; font-weight: 700; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--border); background: var(--panel); color: var(--text); cursor: pointer; }
.call-bar .leave { background: #e5484d; border-color: #e5484d; color: #fff; }
.rank-chip.rank-sup { background: linear-gradient(135deg, #ff5fc8, #ff8f6b); box-shadow: 0 0 16px rgba(255,95,200,.45); }

/* invites */
.inv-hero { text-align: center; }
.inv-gift { font-size: 3.4rem; animation: giftbounce 1.2s ease infinite; }
.inv-hero h2 { font-size: 1.5rem; margin: 6px 0 4px; }
.inv-bar { height: 14px; border-radius: 99px; background: var(--panel); border: 1px solid var(--border); overflow: hidden; }
.inv-bar > div { height: 100%; background: linear-gradient(90deg, #4fd8ff, #a66bff, #ff5fc8); border-radius: 99px; transition: width .6s; }
.inv-count { text-align: center; }
.call-bar[hidden] { display: none !important; }
@media (max-width: 560px) {
  .call-bar { top: 10px; bottom: auto; padding: 6px 6px 6px 12px; font-size: .8rem; gap: 6px; }
  .call-bar span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 42vw; }
  .call-bar button { padding: 5px 10px; }
  .rm-actions .btn { padding: 8px 12px; font-size: .85rem; }
  .rm-msgs { max-height: 42vh; min-height: 200px; }
}
.call-bar .hear { background: #3ddc84; border-color: #3ddc84; color: #04210f; animation: blink 1.2s infinite; }
.rank-chip.rank-admin { background: linear-gradient(135deg, #3ddc84, #4fd8ff); color: #04210f; box-shadow: 0 0 16px rgba(61,220,132,.45); }
.adm-wallet { text-align: center; padding: 14px; border-radius: 16px; background: linear-gradient(135deg, rgba(255,216,79,.15), rgba(255,159,67,.12)); border: 1px solid rgba(255,216,79,.45); }
.adm-coins { font-size: 2.6rem; font-weight: 900; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* 📋 review plans + 💖 donate */
.upgrade-btn.review, .top-upgrade.review { background: rgba(166,107,255,.14) !important; border: 1px solid rgba(166,107,255,.45); box-shadow: none; }
.donate-btn { display: block; text-align: center; padding: 8px; margin-bottom: 8px; border-radius: 12px; font-weight: 700; font-size: .86rem;
  color: #ffd6ea; background: rgba(255,92,170,.12); border: 1px solid rgba(255,92,170,.4); text-decoration: none; }
.donate-btn:hover { background: rgba(255,92,170,.22); }
.donate-btn[hidden] { display: none !important; }

/* 📱 iPhone fixes: no auto-zoom when typing (iOS zooms into inputs under 16px), notch-safe edges */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (hover: none) and (pointer: coarse) {
  input, textarea, select { font-size: max(16px, 1em) !important; }
}
.topbar { padding-top: max(10px, env(safe-area-inset-top)); padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
@media (max-width: 520px) { .topbar { padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); } }
.layout, .main { max-width: 100vw; overflow-x: hidden; }
@media (max-width: 380px) {
  .top-actions .icon-btn { padding: 5px 6px; }
  .rank-chip { padding: 5px 8px !important; font-size: .78rem !important; max-width: 108px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .top-upgrade { padding: 6px 9px !important; font-size: .78rem !important; }
}

/* 🤝 friends */
.fr-me { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: rgba(166,107,255,.12); border: 1px solid rgba(166,107,255,.35); }
.fr-me span { color: var(--muted); font-size: .85rem; }
.fr-me b { font-size: 1.25rem; letter-spacing: 3px; font-family: ui-monospace, monospace; margin-right: auto; }
.fr-person { display: flex; align-items: center; gap: 8px; }
.fr-person > span { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fr-person > span small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fr-person .btn { padding: 6px 10px; font-size: .85rem; flex: none; }
.fr-person .dot { width: 8px; height: 8px; border-radius: 50%; background: #3ddc84; display: inline-block; flex: none; }
.fr-list { max-height: 300px; }
.fr-more { display: flex; gap: 8px; justify-content: flex-end; }
.fr-notif { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(79,216,255,.1); border: 1px solid rgba(79,216,255,.35); }
.fr-notif span { flex: 1; font-size: .9rem; }
.notif-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(92px + env(safe-area-inset-bottom)); z-index: 150; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center;
  width: min(560px, calc(100vw - 24px)); padding: 10px 12px; border-radius: 16px; background: var(--side, #120a2a); border: 1px solid rgba(166,107,255,.55); box-shadow: 0 10px 40px rgba(0,0,0,.5), 0 0 30px rgba(166,107,255,.3); animation: bubblein .35s ease; }
.notif-bar span { flex: 1 1 220px; font-size: .9rem; }
.notif-bar .btn { padding: 7px 12px; font-size: .85rem; }

/* 🩺 call check */
.rm-diag { display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 12px; background: rgba(0,0,0,.25); border: 1px solid var(--border); font-size: .85rem; }
.dg-row { display: grid; grid-template-columns: 110px 1fr; gap: 2px 10px; align-items: center; }
.dg-row small, .dg-row .dg-why { grid-column: 1 / -1; color: var(--muted); }
.dg-row .dg-why { color: var(--text); }
.lvl { display: block; height: 8px; border-radius: 99px; background: rgba(255,255,255,.08); overflow: hidden; }
.lvl b { display: block; height: 100%; background: linear-gradient(90deg, #3ddc84, #ffd84f); transition: width .15s; }
.dg-mic { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.dg-mic label { font-weight: 700; white-space: nowrap; }
.dg-mic select { flex: 1; min-width: 0; padding: 6px 8px; border-radius: 8px; background: var(--panel); color: var(--text); border: 1px solid var(--border); }
#dgBody { display: flex; flex-direction: column; gap: 6px; }

/* 📞🎥 friend calls */
.dc { position: fixed; inset: 0; z-index: 400; background: radial-gradient(circle at 50% 30%, #2a1660, #05030f 70%); color: #fff; display: grid; place-items: center; }
.dc[hidden] { display: none; }
.dc-ring { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 20px; }
.dc-ring h2 { font-size: 1.8rem; } .dc-ring p { color: #cbbcff; }
.dc-ava { width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; font-size: 3.2rem; font-weight: 900; background: linear-gradient(135deg, #4fd8ff, #a66bff 55%, #ff5fc8); box-shadow: 0 0 60px rgba(166,107,255,.6); animation: dcpulse 1.6s ease-in-out infinite; }
@keyframes dcpulse { 50% { transform: scale(1.05); box-shadow: 0 0 90px rgba(166,107,255,.85); } }
.dc-live { position: absolute; inset: 0; }
#dcRemote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
.dc-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; pointer-events: none; }
.dc-center p { color: #cbbcff; }
#dcLocal { position: absolute; right: 14px; top: calc(14px + env(safe-area-inset-top)); width: min(28vw, 200px); aspect-ratio: 3/4; object-fit: cover; border-radius: 16px; border: 2px solid rgba(255,255,255,.35); background: #000; transform: scaleX(-1); box-shadow: 0 8px 30px rgba(0,0,0,.5); }
.dc-top { position: absolute; left: 16px; top: calc(16px + env(safe-area-inset-top)); display: flex; flex-direction: column; text-shadow: 0 2px 8px #000; }
.dc-top b { font-size: 1.3rem; } .dc-top span { color: #ddd; font-size: .9rem; }
.dc-btns { position: absolute; left: 0; right: 0; bottom: calc(26px + env(safe-area-inset-bottom)); display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; }
.dc-ring .dc-btns { position: static; margin-top: 26px; gap: 28px; }
.dc-b { width: 64px; height: 64px; border-radius: 50%; font-size: 1.5rem; background: rgba(255,255,255,.16); backdrop-filter: blur(10px); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1px solid rgba(255,255,255,.2); }
.dc-b small { font-size: .62rem; margin-top: 2px; opacity: .9; }
.dc-b.red { background: #e5484d; } .dc-b.green { background: #2fbf71; }
.dc-b.off { background: rgba(255,255,255,.85); color: #111; }
.dc-b[hidden] { display: none; }
.fr-ping { color: #ffd84f !important; font-weight: 700; }
.side-item.on .ico { filter: drop-shadow(0 0 6px #ffd84f); }
@keyframes shakeall { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-8px); } 40%, 60% { transform: translateX(8px); } }
.shake-all .layout, .shake-all .modal-card { animation: shakeall .6s; }

/* 🗑️ delete own messages */
.dm .b.me { position: relative; }
.msg-del { position: absolute; left: -34px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border-radius: 50%; background: var(--panel); border: 1px solid var(--border); font-size: .8rem; opacity: 0; pointer-events: none; transition: opacity .15s; }
.msg-del[data-armed] { width: auto; padding: 0 10px; border-radius: 99px; left: auto; right: calc(100% + 6px); white-space: nowrap; background: #e5484d; color: #fff; opacity: 1; }
.dm .b.me:hover .msg-del, .dm .b.me.sel .msg-del { opacity: 1; pointer-events: auto; }

/* ================= 🎨 PROFILES ================= */
/* avatar + frames */
.av { position: relative; display: inline-grid; place-items: center; flex: none; width: var(--s); height: var(--s); border-radius: 50%; background: linear-gradient(135deg, #4fd8ff, #a66bff 55%, #ff5fc8); color: #fff; font-weight: 900; font-size: calc(var(--s) * .42); }
.av img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.av b { line-height: 1; }
.av .st { position: absolute; right: -1px; bottom: -1px; width: calc(var(--s) * .3); height: calc(var(--s) * .3); min-width: 10px; min-height: 10px; border-radius: 50%; background: #80848e; border: 3px solid var(--side, #120a2a); z-index: 3; }
.av .st.on { background: #3ddc84; }
.av::before, .av::after { content: ""; position: absolute; pointer-events: none; z-index: 2; }
.fr-simple::before { inset: -3px; border-radius: 50%; border: 2px solid rgba(255,255,255,.8); }
.fr-glow::before { inset: -3px; border-radius: 50%; border: 2px solid #c6a0ff; box-shadow: 0 0 12px #a66bff, 0 0 24px rgba(166,107,255,.6); }
.fr-rainbow::before { inset: -4px; border-radius: 50%; padding: 3px; background: conic-gradient(#ff5f6d, #ffc371, #f9f871, #4fff9c, #4fd8ff, #a66bff, #ff5fc8, #ff5f6d); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; animation: spin 3s linear infinite; }
.fr-pulse::before { inset: -3px; border-radius: 50%; border: 2px solid #4fd8ff; animation: ringpulse 1.6s ease-out infinite; }
.fr-hearts::after { content: "💗"; font-size: calc(var(--s) * .32); right: -6%; top: -10%; animation: floaty 1.8s ease-in-out infinite; }
.fr-hearts::before { inset: -3px; border-radius: 50%; border: 2px solid #ff7fb5; }
.fr-fire::before { inset: -5px; border-radius: 50%; padding: 4px; background: conic-gradient(#ff3d00, #ffb300, #ff6d00, #ffd600, #ff3d00); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; box-shadow: 0 0 14px #ff6d00; animation: spin 1.2s linear infinite, flick .25s infinite alternate; }
.fr-orbit::before { inset: -4px; border-radius: 50%; border: 1px dashed rgba(255,255,255,.4); }
.fr-orbit::after { width: 8px; height: 8px; border-radius: 50%; background: #ffd84f; box-shadow: 0 0 8px #ffd84f; top: 50%; left: 50%; margin: -4px; animation: orbit 2.2s linear infinite; --r: calc(var(--s) / 2 + 4px); }
.fr-crown::after { content: "👑"; font-size: calc(var(--s) * .42); top: calc(var(--s) * -.36); left: 50%; transform: translateX(-50%) rotate(-12deg); filter: drop-shadow(0 2px 4px #000); animation: crownbob 2.4s ease-in-out infinite; }
.fr-crown::before { inset: -3px; border-radius: 50%; border: 2px solid #ffd84f; box-shadow: 0 0 10px rgba(255,216,79,.7); }
.fr-sparkle::after { content: "✨"; font-size: calc(var(--s) * .38); right: -12%; top: -12%; animation: twinkle 1.4s ease-in-out infinite; }
.fr-sparkle::before { inset: -3px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 14px #fff8; animation: twinkle 2s ease-in-out infinite; }
.fr-electric::before { inset: -4px; border-radius: 50%; border: 2px dashed #4fd8ff; box-shadow: 0 0 10px #4fd8ff; animation: spin 1.5s linear infinite, zap .18s steps(2) infinite; }
@keyframes spin { to { transform: rotate(1turn); } }
@keyframes ringpulse { 0% { transform: scale(1); opacity: 1; } 100% { transform: scale(1.35); opacity: 0; } }
@keyframes floaty { 50% { transform: translateY(-4px) scale(1.1); } }
@keyframes flick { to { opacity: .75; } }
@keyframes orbit { from { transform: rotate(0) translateX(var(--r)); } to { transform: rotate(1turn) translateX(var(--r)); } }
@keyframes crownbob { 50% { transform: translateX(-50%) rotate(8deg) translateY(-2px); } }
@keyframes twinkle { 50% { opacity: .35; transform: scale(.8); } }
@keyframes zap { 50% { opacity: .5; } }

/* name colors: ⭐ Pro = still colors, 💎 Max = moving colors */
.nm { font-weight: 800; }
.fx-violet { color: #c6a0ff; } .fx-sky { color: #6fd3ff; } .fx-mint { color: #5ef0b0; } .fx-rose { color: #ff8fc0; }
.fx-gold, .fx-candy, .fx-sunset, .fx-ocean, .fx-peach, .fx-lime, .fx-custom,
.fx-rainbow, .fx-aurora, .fx-galaxy, .fx-fire, .fx-ice, .fx-holo, .fx-toxic, .fx-lava, .fx-customAnim { -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; }
.fx-gold { background-image: linear-gradient(90deg, #ffe08a, #ffb347, #ffd76a); }
.fx-candy { background-image: linear-gradient(90deg, #ff9ad5, #ffd59a, #9ae8ff, #c6a0ff); }
.fx-sunset { background-image: linear-gradient(90deg, #ff6b6b, #ffb86b, #ffe36b); }
.fx-ocean { background-image: linear-gradient(90deg, #3ddcff, #3d7bff, #8a6bff); }
.fx-peach { background-image: linear-gradient(90deg, #ffb199, #ff7eb3); }
.fx-lime { background-image: linear-gradient(90deg, #d4ff4f, #4fff9c); }
.fx-custom { background-image: linear-gradient(90deg, var(--n1, #fff), var(--n2, #fff), var(--n3, #fff)); }
.fx-rainbow, .fx-aurora, .fx-galaxy, .fx-fire, .fx-ice, .fx-holo, .fx-toxic, .fx-lava, .fx-customAnim { background-size: 300% 100%; animation: flow 4s linear infinite; }
.fx-rainbow { background-image: linear-gradient(90deg, #ff5f6d, #ffc371, #f9f871, #4fff9c, #4fd8ff, #a66bff, #ff5fc8, #ff5f6d); }
.fx-aurora { background-image: linear-gradient(90deg, #4fff9c, #4fd8ff, #a66bff, #4fff9c); animation-duration: 6s; }
.fx-galaxy { background-image: linear-gradient(90deg, #a66bff, #4f6bff, #ff5fc8, #fff, #a66bff); filter: drop-shadow(0 0 4px rgba(166,107,255,.7)); }
.fx-fire { background-image: linear-gradient(90deg, #ff3d00, #ffb300, #ffd600, #ff6d00, #ff3d00); animation-duration: 1.6s; filter: drop-shadow(0 0 4px rgba(255,109,0,.6)); }
.fx-ice { background-image: linear-gradient(90deg, #bff4ff, #4fd8ff, #ffffff, #8ad8ff, #bff4ff); animation-duration: 3s; }
.fx-holo { background-image: linear-gradient(110deg, #ffb3f2, #b3fff0, #fff9b3, #b3c6ff, #ffb3f2); animation-duration: 3s; }
.fx-toxic { background-image: linear-gradient(90deg, #b8ff3d, #3dff8e, #e5ff3d, #b8ff3d); animation: flow 3s linear infinite, toxglow 1.4s ease-in-out infinite; }
.fx-lava { background-image: linear-gradient(90deg, #8b0000, #ff3d00, #ff9e00, #ff3d00, #8b0000); animation-duration: 3.5s; }
.fx-customAnim { background-image: linear-gradient(90deg, var(--n1, #fff), var(--n2, #fff), var(--n3, #fff), var(--n1, #fff)); }
.fx-neon { color: #fff; text-shadow: 0 0 4px #ff5fc8, 0 0 10px #ff5fc8, 0 0 18px #ff5fc8; animation: neonp 1.6s ease-in-out infinite; }
.fx-glitch { position: relative; color: #fff; animation: glitch 2.4s infinite; }
@keyframes flow { to { background-position: 300% 0; } }
@keyframes toxglow { 50% { filter: drop-shadow(0 0 6px #7dff3d); } }
@keyframes neonp { 50% { text-shadow: 0 0 2px #ff5fc8, 0 0 5px #ff5fc8; } }
@keyframes glitch { 0%, 86%, 100% { text-shadow: none; transform: none; } 88% { text-shadow: 2px 0 #ff2d55, -2px 0 #2de2ff; transform: translateX(1px); } 92% { text-shadow: -2px 0 #ff2d55, 2px 0 #2de2ff; transform: translateX(-1px); } 95% { text-shadow: 1px 1px #ff2d55, -1px -1px #2de2ff; } }
.ptag { display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px; border-radius: 6px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.15); font-size: .68rem; font-weight: 900; letter-spacing: .5px; vertical-align: middle; color: #fff; -webkit-text-fill-color: #fff; }

/* nameplates (moving backgrounds behind a row) */
.plate { position: relative; overflow: hidden; border-radius: 12px; }
.plate > * { position: relative; z-index: 1; }
.plate::before { content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.pl-none::before { background: var(--panel); }
.pl-midnight::before { background: linear-gradient(90deg, #0b1030, #1d1450); }
.pl-ocean::before { background: linear-gradient(90deg, #04233a, #0a4a6e); }
.pl-forest::before { background: linear-gradient(90deg, #0b2a17, #1d4a2a); }
.pl-wine::before { background: linear-gradient(90deg, #2a0b1a, #521433); }
.pl-aurora::before { background: linear-gradient(120deg, #0b3a3a, #2a1660, #0b4a2a, #3a1660); background-size: 300% 300%; animation: drift 8s ease-in-out infinite; }
.pl-sunset::before { background: linear-gradient(90deg, #3a0b2a, #8a2a2a, #b85a1a, #3a0b2a); background-size: 300% 100%; animation: drift 10s ease-in-out infinite; }
.pl-sakura::before { background: radial-gradient(circle at 20% 30%, #ffc4e1 0 2px, transparent 3px), radial-gradient(circle at 70% 60%, #ffd6ec 0 2px, transparent 3px), radial-gradient(circle at 45% 80%, #ffb3d9 0 1.5px, transparent 2.5px), linear-gradient(90deg, #4a1a3a, #6a2a50); background-size: 90px 60px, 120px 70px, 70px 50px, 100% 100%; animation: petals 6s linear infinite; }
.pl-cyber::before { background: repeating-linear-gradient(0deg, rgba(79,216,255,.08) 0 2px, transparent 2px 5px), linear-gradient(90deg, #08081a, #1a0b3a); box-shadow: inset 0 0 0 1px rgba(79,216,255,.5), inset 0 0 18px rgba(255,95,200,.25); animation: scan 3s linear infinite; }
.pl-candy::before { background: linear-gradient(100deg, #5a2a7a, #a64a9a, #6a3aa0, #c05aa0, #5a2a7a); background-size: 300% 100%; animation: drift 7s ease-in-out infinite; }
.pl-lava::before { background: radial-gradient(ellipse at 20% 120%, #ff5a1a 0, transparent 50%), radial-gradient(ellipse at 80% 120%, #ff9e00 0, transparent 45%), linear-gradient(#2a0800, #4a1000); background-size: 200% 200%; animation: drift 5s ease-in-out infinite; }
.pl-galaxy::before { background: radial-gradient(1px 1px at 10% 20%, #fff, transparent), radial-gradient(1px 1px at 30% 70%, #fff, transparent), radial-gradient(1.5px 1.5px at 60% 30%, #fff, transparent), radial-gradient(1px 1px at 80% 80%, #fff, transparent), radial-gradient(1px 1px at 90% 40%, #fff, transparent), radial-gradient(ellipse at 30% 50%, rgba(166,107,255,.55), transparent 60%), radial-gradient(ellipse at 80% 50%, rgba(255,95,200,.4), transparent 60%), #0a0620; background-size: 140px 60px, 140px 60px, 140px 60px, 140px 60px, 140px 60px, 100% 100%, 100% 100%; animation: stars 12s linear infinite, twinkle2 3s ease-in-out infinite; }
.pl-lightning::before { background: linear-gradient(100deg, #0a0a2a, #1a1a4a); animation: bolt 4s infinite; }
.pl-lightning::after { content: "⚡"; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 1.4rem; opacity: 0; animation: boltIcon 4s infinite; z-index: 0; }
.pl-matrix::before { background: repeating-linear-gradient(90deg, transparent 0 10px, rgba(0,255,90,.0) 10px 12px), repeating-linear-gradient(180deg, rgba(0,255,90,.35) 0 2px, transparent 2px 9px), #001a08; background-size: 100% 100%, 12px 60px; animation: rain 1.2s linear infinite; }
.pl-flames::before { background: radial-gradient(ellipse at 15% 110%, #ffd600 0, #ff6d00 18%, transparent 45%), radial-gradient(ellipse at 50% 115%, #ffb300 0, #ff3d00 20%, transparent 48%), radial-gradient(ellipse at 85% 110%, #ffd600 0, #ff6d00 18%, transparent 45%), #1a0500; background-size: 100% 160%; animation: burn .9s ease-in-out infinite alternate; }
.pl-city::before { background: linear-gradient(transparent 60%, rgba(255,95,200,.35) 60% 62%, transparent 62%), repeating-linear-gradient(90deg, #14082e 0 18px, #1d0b40 18px 30px, #0f0624 30px 44px), linear-gradient(#2a0b4a, #0a0420); background-size: 100% 100%, 88px 100%, 100% 100%; box-shadow: inset 0 -2px 12px rgba(79,216,255,.4); animation: cityScroll 8s linear infinite; }
.pl-wave::before { background: linear-gradient(90deg, #ff5f6d55, #ffc37155, #4fff9c55, #4fd8ff55, #a66bff55, #ff5fc855, #ff5f6d55), #120a2a; background-size: 200% 100%; animation: flow 5s linear infinite; }
.pl-snow::before { background: radial-gradient(circle at 10% 10%, #fff 0 1.5px, transparent 2px), radial-gradient(circle at 60% 40%, #fff 0 1px, transparent 1.5px), radial-gradient(circle at 35% 70%, #fff 0 1.5px, transparent 2px), linear-gradient(#0b2a4a, #1a3a6a); background-size: 60px 60px, 80px 80px, 50px 50px, 100% 100%; animation: snowfall 5s linear infinite; }
.pl-custom::before { background: var(--plate) center / cover no-repeat, #120a2a; }
@keyframes drift { 50% { background-position: 100% 50%; } }
@keyframes petals { to { background-position: 90px 60px, -120px 70px, 70px 50px, 0 0; } }
@keyframes scan { to { background-position: 0 50px, 0 0; } }
@keyframes stars { to { background-position: -140px 0, -140px 0, -140px 0, -140px 0, -140px 0, 0 0, 0 0; } }
@keyframes twinkle2 { 50% { filter: brightness(1.25); } }
@keyframes bolt { 0%, 88%, 100% { filter: none; } 90% { filter: brightness(3); } 92% { filter: none; } 94% { filter: brightness(2.2); } }
@keyframes boltIcon { 0%, 88%, 100% { opacity: 0; } 90%, 95% { opacity: 1; } }
@keyframes rain { to { background-position: 0 0, 0 60px; } }
@keyframes burn { to { background-position: 0 -20px; filter: brightness(1.15); } }
@keyframes cityScroll { to { background-position: 0 0, -88px 0, 0 0; } }
@keyframes snowfall { to { background-position: 30px 60px, -40px 80px, 20px 50px, 0 0; } }

/* Discord-style rows */
.fr2-row { margin-bottom: 4px; cursor: default; }
.fr2-row.dm-thread { cursor: pointer; }
.fr2-row.dm-thread:hover::before { filter: brightness(1.25); }
.fr2 { display: flex; align-items: center; gap: 12px; padding: 8px 10px; }
.fr2-av { cursor: pointer; display: inline-flex; }
.fr2-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fr2-txt b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 1rem; }
.fr2-txt small { color: rgba(255,255,255,.65); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .8rem; }
.fr2 .btn { padding: 6px 10px; font-size: .85rem; flex: none; }
.fr2-row.unread .fr2-txt small { color: #fff; font-weight: 700; }
.fr-list, #frReqs, #frSent, .fr-results { max-height: none !important; gap: 0 !important; }
.fr-mecard { margin-bottom: 8px; border-radius: 16px; }
.fc-who { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
/* profile popup */
.pf-card { border-radius: 18px; overflow: hidden; background: var(--panel); border: 1px solid var(--border); margin: -4px 0 0; }
.pf-banner { height: 120px; background-size: cover; background-position: center; position: relative; }
.pf-banner.plate, .pf-banner[class*="pl-"] { overflow: hidden; }
.pf-banner[class*="pl-"]::before { content: ""; position: absolute; inset: 0; }
.pf-head { margin: -50px 0 0 18px; position: relative; z-index: 2; }
.pf-head .av { box-shadow: 0 0 0 6px var(--panel); }
.pf-body { padding: 10px 18px 16px; display: flex; flex-direction: column; gap: 8px; }
.pf-body h2 { font-size: 1.4rem; }
.pf-bio { white-space: pre-wrap; }
.pf-small { display: flex; gap: 14px; }
.linkish { background: none; border: 0; color: var(--muted); font-size: .8rem; text-decoration: underline; cursor: pointer; padding: 0; }
/* editor */
.pe-preview { border-radius: 16px; }
.cz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.cz-grid.plates { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.cz { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 10px 6px; min-height: 74px; border-radius: 12px; background: var(--panel); border: 2px solid transparent; overflow: hidden; }
.cz.sel { border-color: var(--accent, #a66bff); box-shadow: 0 0 14px rgba(166,107,255,.45); }
.cz small { font-size: .7rem; color: var(--muted); text-align: center; }
.cz small em { font-style: normal; display: block; color: #ffd84f; }
.cz.locked { opacity: .55; }
.cz .lk { position: absolute; top: 4px; right: 6px; font-style: normal; font-size: .8rem; }
.cz-plate { display: block; width: 100%; height: 30px; border-radius: 8px; }
.cz .nm { font-size: .92rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pe-colors { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: .85rem; }
.pe-colors input { width: 40px; height: 32px; border: 0; background: none; padding: 0; cursor: pointer; }
.btn.locked { opacity: .55; }
.dc-ava img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.dc-ava { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .nm, .plate::before, .av::before, .av::after { animation: none !important; } }

#dcRemote.screen { object-fit: contain; }
#dcLocal.screen { transform: none; aspect-ratio: 16/9; width: min(36vw, 280px); object-fit: contain; }
.dc-b.on { background: #3d7bff; }

/* 👤 my picture top right */
.me-ava { display: inline-flex; align-items: center; padding: 2px; border-radius: 50%; background: none; border: 0; cursor: pointer; }
.me-ava[hidden] { display: none !important; }
.me-ava .av .st { border-color: #120a2a; }
.me-ava:hover .av { filter: brightness(1.15); }

/* 💬 Messages (Discord-style) */
.modal.full .modal-card { width: min(1180px, 96vw); height: min(820px, 92vh); max-height: 92vh; display: flex; flex-direction: column; }
.modal.full .modal-body { flex: 1; min-height: 0; padding: 0 0 0; overflow: hidden; }
.modal.full .modal-head { padding-bottom: 8px; }
.dmx { display: grid; grid-template-columns: 300px minmax(0, 1fr); height: 100%; min-height: 0; border-top: 1px solid var(--border); }
.dmx-list { display: flex; flex-direction: column; min-height: 0; background: rgba(0,0,0,.18); border-right: 1px solid var(--border); }
.dmx-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 6px; color: var(--muted); font-size: .8rem; text-transform: none; }
.dmx-head .icon-btn { font-size: 1.2rem; padding: 2px 8px; }
.dmx-friends { margin: 4px 8px 6px; padding: 9px 12px; border-radius: 10px; text-align: left; display: flex; align-items: center; gap: 8px; background: var(--panel); font-weight: 700; }
.dmx-items { flex: 1; overflow-y: auto; padding: 4px 6px 10px; display: flex; flex-direction: column; gap: 2px; }
.dmx-item { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 10px; cursor: pointer; }
.dmx-item:hover { background: rgba(255,255,255,.06); }
.dmx-item.act { background: rgba(166,107,255,.2); }
.dmx-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dmx-txt b { font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; color: rgba(255,255,255,.8); }
.dmx-item.unread .dmx-txt b, .dmx-item.act .dmx-txt b { color: #fff; }
.dmx-txt small { color: var(--muted); font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dmx-item.unread .dmx-txt small { color: #fff; font-weight: 700; }
.dmx-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: none; }
.dmx-side small { color: #3ddc84; font-size: .7rem; font-variant-numeric: tabular-nums; }
.dmx-side .badge { margin: 0; }
.av.grp { background: linear-gradient(135deg, #f5a623, #f8d64e); font-size: calc(var(--s) * .45); }
.dmx-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.dmx-top { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 1rem; }
.dmx-back { display: none; }
.dmx-pane { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.dmx-pane .rm-msgs, .dmx-pane #fcMsgs { flex: 1; max-height: none; min-height: 120px; }
.dmx-hello { margin: auto; text-align: center; line-height: 1.8; }
.ng-list { display: flex; flex-direction: column; gap: 4px; max-height: 50vh; overflow-y: auto; }
.ng-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; background: var(--panel); cursor: pointer; }
.ng-row input { width: 18px; height: 18px; accent-color: #a66bff; }
@media (max-width: 760px) {
  .modal.full { padding: 0 !important; place-items: stretch; }
  .modal.full .modal-card { width: 100% !important; max-width: 100% !important; height: 100dvh; max-height: 100dvh; border-radius: 0; margin: 0; }
  .dmx { grid-template-columns: minmax(0, 1fr); }
  .dmx-list { min-width: 0; border-right: 0; }
  .dmx-main { display: none; }
  .dmx.chat-open .dmx-list { display: none; }
  .dmx.chat-open .dmx-main { display: flex; }
  .dmx-back { display: inline-flex; }
}

/* ⌄ minimised call (floating window) */
.dc-min, .dc-expand { position: absolute; top: calc(14px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 3; width: 44px; height: 32px; border-radius: 99px; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.2); color: #fff; font-size: 1.3rem; line-height: 1; backdrop-filter: blur(8px); }
.dc-expand { display: none; }
.dc.mini { inset: calc(70px + env(safe-area-inset-top)) 16px auto auto; width: 240px; height: 170px; border-radius: 18px; overflow: hidden; box-shadow: 0 14px 40px rgba(0,0,0,.6), 0 0 0 1px rgba(166,107,255,.6); cursor: grab; touch-action: none; z-index: 400; }
.dc.mini .dc-min, .dc.mini #dcLocal, .dc.mini #dcFlip, .dc.mini #dcShare, .dc.mini #dcCam, .dc.mini #dcHear { display: none !important; }
.dc.mini .dc-expand { display: block; left: auto; right: 8px; top: 8px; transform: none; width: 32px; height: 28px; font-size: 1rem; }
.dc.mini .dc-top { left: 10px; top: 8px; } .dc.mini .dc-top b { font-size: .9rem; } .dc.mini .dc-top span { font-size: .75rem; }
.dc.mini .dc-btns { bottom: 8px; gap: 10px; }
.dc.mini .dc-b { width: 40px; height: 40px; font-size: 1rem; } .dc.mini .dc-b small { display: none; }
.dc.mini .dc-ava { width: 56px; height: 56px; font-size: 1.6rem; }
.dc.mini .dc-center p { display: none; }
.dc.mini .dc-center { padding-bottom: 30px; }
@media (max-width: 520px) { .dc.mini { width: 170px; height: 130px; right: 10px; } }
/* 🚩 AI report */
.rep-list { display: grid; gap: 6px; }
.rep-opt { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--border, #333); border-radius: 10px; cursor: pointer; }
.rm-rep { background: none; border: 0; color: inherit; opacity: .7; cursor: pointer; font-size: inherit; padding: 0; }
.rm-rep:hover { opacity: 1; text-decoration: underline; }
.rm-rep-box { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.rm-rep-box[hidden] { display: none; }
.rep-sel { flex: 1; min-width: 160px; }
.rep-note { width: 100%; margin-top: 10px; box-sizing: border-box; background: rgba(255,255,255,.06); color: inherit; border: 1px solid rgba(255,255,255,.15); border-radius: 10px; padding: 10px; font: inherit; resize: vertical; }
.rep-sel { background: rgba(255,255,255,.06); color: inherit; border: 1px solid rgba(255,255,255,.15); border-radius: 8px; padding: 6px; }
.rep-sel option { background: #1a1030; }
.rep-item { border: 1px solid rgba(255,255,255,.12); border-radius: 12px; padding: 10px; margin-top: 8px; background: rgba(255,255,255,.03); }
.rep-item.done { opacity: .65; }
.rep-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.rep-text { margin-top: 6px; font-size: .92em; white-space: normal; word-break: break-word; max-height: 160px; overflow: auto; }
.test-bar { position: fixed; left: 50%; bottom: 4px; transform: translateX(-50%); z-index: 9999; background: #f5b400; color: #1a1200; font-weight: 700; font-size: 12px; padding: 3px 12px; border-radius: 999px; pointer-events: none; box-shadow: 0 2px 10px rgba(0,0,0,.4); }
