/* FriendChat — v4 "Dark Premium" (Discord-inspired, neon accents)
   Same class hooks as v1–v3.2 (app.js untouched) + light theme + extras (fx-*) */
:root {
  --bg: #0B0D12;
  --bg-2: #1B1E26;
  --accent: #F97316;
  --accent-2: #EC4899;
  --lavender: #8B7CFF;
  --pink: #FF5CA8;
  --cyan: #FBBF24;
  --mint: #34D399;
  --yellow: #FEE75C;
  --text: #F2F3F5;
  --text-dim: #9BA1AB;
  --card: #12141B;
  --card-solid: #15171F;
  --card-border: rgba(255, 255, 255, 0.07);
  --glass: rgba(18, 20, 27, 0.86);
  --bubble: #23252E;
  --backdrop: rgba(3, 4, 7, 0.72);
  --on-gradient: #FFFFFF;
  --radius-lg: 20px;
  --radius-md: 12px;
  --shadow-glow: 0 8px 32px rgba(249, 115, 22, 0.30);
  --shadow-card: 0 20px 50px rgba(0, 0, 0, 0.55);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="light"] {
  --bg: #EDEEF2;
  --bg-2: #FFFFFF;
  --text: #17181C;
  --text-dim: #5C6067;
  --card: #FFFFFF;
  --card-solid: #FFFFFF;
  --card-border: rgba(20, 22, 30, 0.10);
  --glass: rgba(255, 255, 255, 0.88);
  --bubble: #E7E8ED;
  --backdrop: rgba(30, 32, 40, 0.38);
  --shadow-glow: 0 8px 28px rgba(249, 115, 22, 0.22);
  --shadow-card: 0 18px 44px rgba(30, 32, 60, 0.14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(90% 60% at 85% -10%, rgba(236, 72, 153, 0.14) 0%, transparent 55%),
    radial-gradient(120% 120% at 15% -10%, #141728 0%, var(--bg) 58%);
  color: var(--text);
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  overflow-x: hidden;
  position: relative;
  transition: background 0.35s, color 0.35s;
}
[data-theme="light"] body {
  background:
    radial-gradient(90% 60% at 85% -10%, rgba(236, 72, 153, 0.12) 0%, transparent 55%),
    radial-gradient(120% 120% at 15% -10%, #FFFFFF 0%, var(--bg) 60%);
}

h1, h2, .chat-title, .brand h1 { font-family: "Plus Jakarta Sans", system-ui, sans-serif; }
.brand h2 { font-family: "Plus Jakarta Sans", system-ui, sans-serif; font-size: 32px; margin: 0; font-weight: 800; letter-spacing: -0.5px; }

::selection { background: var(--accent); color: #FFFFFF; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---------- Ambient background blobs ---------- */
.blob-bg { position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
.floater {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.22;
  animation: drift 18s ease-in-out infinite;
}
[data-theme="light"] .floater { opacity: 0.16; }
.f1 { width: 340px; height: 340px; background: var(--accent); top: -80px; left: -80px; animation-delay: 0s; }
.f2 { width: 260px; height: 260px; background: var(--accent-2); bottom: -60px; right: -40px; animation-delay: 3s; }
.f3 { width: 200px; height: 200px; background: var(--cyan); top: 40%; right: 15%; animation-delay: 6s; }
.f4 { width: 180px; height: 180px; background: var(--pink); bottom: 20%; left: 10%; animation-delay: 9s; }

@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -30px) scale(1.08); }
  66% { transform: translate(-20px, 20px) scale(0.95); }
}

/* ---------- Screens ---------- */
.screen {
  position: relative; z-index: 1;
  min-height: 100vh;
  display: none;
  flex-direction: column;
  align-items: center;
  padding: 32px 20px 100px;
  opacity: 0;
}
.screen.active {
  display: flex;
  animation: screenIn 0.5s var(--ease) forwards;
}
@keyframes screenIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Card / gate ---------- */
.card {
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 36px 32px;
  max-width: 440px;
  width: 100%;
}
.gate-card { margin-top: 6vh; }
.brand { display: flex; align-items: center; gap: 12px; justify-content: center; }
.brand-blob {
  font-size: 40px; animation: bob 3s ease-in-out infinite; display: inline-flex;
  width: 68px; height: 68px; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 20px;
  box-shadow: 0 10px 30px rgba(249, 115, 22, 0.45);
}
.brand-blob img { width: 36px; height: 36px; display: block; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-8px) rotate(3deg); } }
.brand h1 {
  font-size: 34px; margin: 0; font-weight: 800; letter-spacing: -0.5px;
  background: linear-gradient(90deg, #A5B4FF, var(--cyan));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
[data-theme="light"] .brand h1 {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.tagline { text-align: center; color: var(--text-dim); margin: 10px 0 24px; font-size: 15px; }

.rules-list { list-style: none; padding: 0; margin: 0 0 24px; display: flex; flex-direction: column; gap: 10px; }
.rules-list li {
  background: var(--bg-2);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 14px;
  color: var(--text-dim);
}

.check-row { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; font-size: 14px; cursor: pointer; color: var(--text); }
.check-row input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--accent); flex-shrink: 0; }

.error-text { color: #FF7A9E; font-size: 13px; text-align: center; min-height: 18px; margin: 10px 0 0; }
[data-theme="light"] .error-text { color: #D92B4F; }

.field-label { display: block; font-size: 13px; color: var(--text-dim); margin: 4px 0 6px; }
.text-input {
  width: 100%; border-radius: var(--radius-md); border: 1px solid var(--card-border);
  background: var(--bg-2); color: var(--text); padding: 13px 16px; font-size: 15px;
  font-family: inherit; outline: none; transition: border-color 0.2s, box-shadow 0.2s; margin-bottom: 16px;
}
.text-input:focus { border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.28); }
.text-input::placeholder { color: var(--text-dim); opacity: 0.75; }

/* ---------- Buttons ---------- */
.btn {
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s;
}
.btn:active { transform: scale(0.96); }
.btn-primary {
  width: 100%;
  padding: 15px;
  font-size: 16px;
  margin-top: 8px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--on-gradient);
  box-shadow: 0 8px 26px rgba(249, 115, 22, 0.45);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 34px rgba(236, 72, 153, 0.55); }
.btn-primary:disabled { opacity: 0.7; cursor: default; transform: none; }
.header-spacer { width: 70px; }
.btn-accent {
  background: linear-gradient(135deg, var(--accent-2), var(--pink));
  color: var(--on-gradient);
  box-shadow: 0 6px 24px rgba(255, 92, 168, 0.32);
}
.btn-accent:hover { transform: translateY(-2px); }
.btn-large { padding: 16px 28px; font-size: 17px; }
.btn-ghost {
  background: var(--bg-2); color: var(--text); padding: 10px 16px; font-size: 14px;
  border: 1px solid var(--card-border);
}
.btn-ghost:hover { border-color: var(--accent-2); }
.btn-send {
  width: 46px; height: 46px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #FFFFFF; font-size: 18px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  box-shadow: 0 6px 22px rgba(249, 115, 22, 0.5);
}
.btn-send:hover { transform: translateY(-1px) scale(1.04); }
.hidden { display: none !important; }

/* ---------- Lobby ---------- */
.lobby-header { width: 100%; max-width: 640px; display: flex; justify-content: flex-end; margin-bottom: 20px; }
.identity-badge {
  display: flex; align-items: center; gap: 10px;
  background: var(--glass); border: 1px solid var(--card-border);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-radius: 999px; padding: 8px 16px 8px 8px;
  box-shadow: var(--shadow-card);
}
.avatar-slot svg, .msg-avatar svg { width: 40px; height: 40px; display: block; }
.avatar-slot { animation: pulse 4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
.me-label { font-size: 11px; color: var(--text-dim); }
.me-name { font-weight: 700; font-size: 14px; }

.lobby-hero { text-align: center; max-width: 560px; margin-bottom: 28px; }
.lobby-hero h2 { font-size: 28px; margin: 0 0 18px; }

.room-list { width: 100%; max-width: 640px; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.room-card {
  background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius-md);
  padding: 20px; text-align: left; cursor: pointer; color: var(--text);
  display: flex; align-items: center; gap: 14px;
  opacity: 0; animation: cardIn 0.45s var(--ease) forwards;
  animation-delay: var(--delay, 0ms);
  transition: transform 0.25s var(--ease), border-color 0.25s, box-shadow 0.25s;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(10px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
.room-card:hover { transform: translateY(-3px); border-color: var(--accent-2); box-shadow: var(--shadow-glow); }
.room-emoji { font-size: 28px; }
.room-name { font-weight: 700; flex: 1; }
.room-go { font-size: 12px; color: var(--text-dim); }

/* ---------- Chat ---------- */
#screen-chat { height: 100dvh; min-height: 100dvh; padding: 14px 16px 12px; }
.chat-header {
  width: 100%; max-width: 640px; display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px; position: sticky; top: 8px; z-index: 5;
  background: var(--glass); border: 1px solid var(--card-border); border-radius: 999px;
  padding: 8px 12px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-card);
}
.chat-header-title { flex: 1; text-align: center; min-width: 0; }
.chat-title { font-size: 18px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 8px; }
.chat-title.with-avatar svg { width: 30px; height: 30px; }
.chat-subtitle { font-size: 12px; color: var(--text-dim); transition: color 0.2s; }
.chat-subtitle.flash { color: var(--yellow); }
[data-theme="light"] .chat-subtitle.flash { color: #B8860B; }

.message-list {
  width: 100%; max-width: 640px; flex: 1;
  display: flex; flex-direction: column; gap: 10px;
  min-height: 0; overflow-y: auto;
  padding: 10px 4px 16px;
  scroll-behavior: smooth;
}
.msg-row { display: flex; align-items: flex-end; gap: 8px; animation: msgIn 0.3s var(--ease); }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.msg-row.mine { justify-content: flex-end; }
.msg-avatar svg { width: 32px; height: 32px; }
.msg-bubble {
  background: var(--bubble); border: 1px solid var(--card-border);
  border-radius: 16px 16px 16px 4px;
  padding: 10px 14px; max-width: 72%; position: relative;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.msg-row.mine .msg-bubble {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #FFFFFF; border: none; border-radius: 16px 16px 4px 16px;
  box-shadow: 0 6px 18px rgba(249, 115, 22, 0.35);
}
.msg-sender { font-size: 11px; font-weight: 700; color: var(--mint); margin-bottom: 2px; }
[data-theme="light"] .msg-sender { color: #0E9F6E; }
.msg-text { font-size: 14.5px; line-height: 1.45; word-break: break-word; white-space: pre-wrap; }
.report-btn {
  position: absolute; top: -8px; right: -8px; width: 22px; height: 22px;
  border-radius: 50%; border: none; background: var(--bg-2); color: var(--text-dim);
  font-size: 11px; cursor: pointer; opacity: 0; transition: opacity 0.2s;
  display: flex; align-items: center; justify-content: center;
}
.msg-bubble:hover .report-btn { opacity: 1; }
.report-btn:hover { color: var(--pink); }

.typing-indicator {
  width: 100%; max-width: 640px; font-size: 12.5px; color: var(--text-dim);
  padding: 2px 6px 8px; min-height: 18px; font-style: italic;
}

.message-form {
  width: 100%; max-width: 640px; display: flex; gap: 8px; align-items: center;
  position: sticky; bottom: 10px; z-index: 5;
  background: var(--glass); border: 1px solid var(--card-border); border-radius: 999px;
  padding: 6px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-card);
}
.message-form input {
  flex: 1; border-radius: 999px; border: 1px solid transparent;
  background: transparent; color: var(--text); padding: 12px 14px; font-size: 14.5px;
  font-family: inherit; outline: none; transition: border-color 0.2s; min-width: 0;
}
.message-form input:focus { border-color: var(--accent-2); }
.message-form input:disabled { opacity: 0.5; }
.message-form input::placeholder { color: var(--text-dim); opacity: 0.8; }

/* blob avatar shared styling */
.blob-avatar { display: block; }
.blob-shape { animation: wobble 5s ease-in-out infinite; transform-origin: center; }
@keyframes wobble { 0%, 100% { transform: scale(1) rotate(0deg); } 50% { transform: scale(1.04) rotate(2deg); } }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: #2B2E38; border-radius: 999px; }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(20, 22, 30, 0.25); }

@media (max-width: 480px) {
  .card { padding: 26px 20px; }
  .lobby-header { justify-content: center; }
  .msg-bubble { max-width: 82%; }
}

/* ---------- Field helpers ---------- */
.field-optional { font-weight: 400; color: var(--text-dim); font-size: 11px; }
select.text-input { appearance: none; cursor: pointer; }

/* ---------- Identity badge as button ---------- */
button.identity-badge { font-family: inherit; cursor: pointer; text-align: left; }
button.identity-badge:hover { border-color: var(--accent-2); }

/* ---------- Lobby tabs ---------- */
.lobby-tabs {
  display: flex; gap: 8px; width: 100%; max-width: 640px; margin-bottom: 18px;
  flex-wrap: wrap; justify-content: center;
}
.lobby-tab {
  border: 1px solid var(--card-border); background: var(--bg-2); color: var(--text-dim);
  border-radius: 999px; padding: 9px 16px; font-size: 13px; font-weight: 700;
  font-family: inherit; cursor: pointer; transition: all 0.2s var(--ease);
}
.lobby-tab:hover { color: var(--text); border-color: var(--accent-2); }
.lobby-tab.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #FFFFFF; border-color: transparent;
  box-shadow: 0 6px 22px rgba(249, 115, 22, 0.45);
}
.lobby-tab-panel { display: none; width: 100%; max-width: 640px; flex-direction: column; align-items: center; }
.lobby-tab-panel.active { display: flex; }

.lobby-actions { width: 100%; display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.inline-form { display: flex; gap: 8px; }
.inline-input { margin-bottom: 0 !important; flex: 1; }
.empty-hint { color: var(--text-dim); font-size: 13px; text-align: center; margin: 8px 0; }

.my-code-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.code-chip {
  font-family: "Plus Jakarta Sans", monospace; font-weight: 700; font-size: 13px;
  background: var(--bg-2); color: var(--cyan); border: 1px dashed var(--card-border);
  border-radius: 999px; padding: 8px 14px; cursor: pointer; letter-spacing: 0.5px;
}
[data-theme="light"] .code-chip { color: #0E7490; }
.code-chip:hover { border-color: var(--cyan); }
.code-chip.copied { color: var(--yellow); border-color: var(--yellow); }
[data-theme="light"] .code-chip.copied { color: #B8860B; border-color: #B8860B; }

/* ---------- Modals ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 20; background: var(--backdrop);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.modal-card { max-width: 380px; max-height: 88vh; overflow-y: auto; -webkit-overflow-scrolling: touch; position: relative; }
.modal-close-x {
  position: absolute; top: 12px; right: 12px; background: transparent; border: none;
  color: var(--text-dim); font-size: 20px; line-height: 1; cursor: pointer; padding: 6px 8px;
  border-radius: 8px;
}
.modal-close-x:hover { background: var(--bg-2); }
.modal-title { margin: 0 0 18px; font-size: 20px; text-align: center; }
.modal-btn-row { display: flex; gap: 10px; margin-top: 6px; }
.modal-btn-row .btn { flex: 1; }
.profile-avatar-preview { margin: 0 auto 18px; }
.profile-avatar-preview svg { width: 72px; height: 72px; }

.avatar-picker {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin: 0 0 10px;
}
.avatar-picker-option {
  background: var(--card-solid); border: 2px solid var(--card-border); border-radius: 12px;
  padding: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: border-color 0.15s, transform 0.15s;
}
.avatar-picker-option svg { width: 36px; height: 36px; display: block; }
.avatar-picker-option:hover { transform: scale(1.05); }
.avatar-picker-option.selected { border-color: var(--accent, #EC4899); }

/* ---------- Context menu ---------- */
.context-menu {
  position: fixed; z-index: 30; background: var(--card-solid); border: 1px solid var(--card-border);
  border-radius: 12px; box-shadow: var(--shadow-card); padding: 6px; min-width: 180px;
  display: flex; flex-direction: column; overflow: hidden;
}
.context-item {
  border: none; background: transparent; color: var(--text); font-family: inherit;
  font-size: 14px; text-align: left; padding: 10px 12px; border-radius: 8px; cursor: pointer;
}
.context-item:hover { background: var(--bg-2); }
.context-item.danger:hover { background: rgba(255, 92, 168, 0.14); color: var(--pink); }

/* ---------- Message bubble additions ---------- */
.msg-bubble { cursor: default; user-select: none; -webkit-user-select: none; }
.msg-bubble.deleted { opacity: 0.55; font-style: italic; }
.msg-meta-row { display: flex; align-items: center; gap: 6px; }
.gender-tag {
  font-size: 10px; color: var(--text-dim); background: var(--bg-2);
  border-radius: 6px; padding: 1px 6px; text-transform: uppercase; letter-spacing: 0.3px;
}
.msg-row.mine .gender-tag { background: rgba(255, 255, 255, 0.22); color: rgba(255, 255, 255, 0.85); }

/* ---------- Group / DM cards reuse room-card ---------- */
.room-card.dm-card .room-emoji { font-size: 22px; }
.room-card .room-sub { font-size: 11px; color: var(--text-dim); display: block; }

@media (max-width: 480px) {
  .lobby-tab { padding: 8px 12px; font-size: 12px; }
}

/* ---------- Icons (Iconify images replacing emoji) ---------- */
.icon { display: inline-block; vertical-align: -3px; }
.rules-list li { display: flex; align-items: center; gap: 8px; }
.lobby-tab { display: inline-flex; align-items: center; gap: 6px; }
.lobby-tab.active .icon { filter: brightness(0) invert(1); }
.btn-full { width: 100%; margin-top: 10px; }

/* ---------- Sender name as clickable profile link ---------- */
.msg-sender-btn {
  background: none; border: none; padding: 0; font: inherit; cursor: pointer;
  color: var(--mint); font-size: 11px; font-weight: 700;
}
[data-theme="light"] .msg-sender-btn { color: #0E9F6E; }
.msg-sender-btn:hover { text-decoration: underline; }

/* ---------- Requests / blocked lists ---------- */
.requests-list, .blocked-list { display: flex; flex-direction: column; gap: 8px; max-height: 220px; overflow-y: auto; }
.list-row {
  display: flex; align-items: center; gap: 10px; background: var(--bg-2);
  border: 1px solid var(--card-border);
  border-radius: 12px; padding: 8px 10px;
}
.list-row .avatar-slot svg { width: 30px; height: 30px; }
.list-row-name { flex: 1; font-size: 13px; font-weight: 600; }
.list-row .btn { padding: 6px 10px; font-size: 12px; }

.view-profile-meta { display: flex; gap: 6px; justify-content: center; margin-bottom: 18px; flex-wrap: wrap; }

/* ---------- Unread indicators ---------- */
.unread-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--pink); margin-left: 6px; box-shadow: 0 0 0 3px rgba(255, 92, 168, 0.25), 0 0 10px rgba(255, 92, 168, 0.8);
  vertical-align: middle;
}

/* ---------- Group avatars ---------- */
.group-avatar-icon { border-radius: 6px; object-fit: cover; }

/* ---------- Chat title as a clickable "manage group" trigger ---------- */
.chat-title-clickable {
  cursor: pointer; background: transparent; border: none; color: inherit;
  font: inherit; padding: 4px 8px; border-radius: 999px; transition: background 0.2s;
}
.chat-title-clickable:hover { background: var(--card-solid); }

/* ---------- Group settings modal ---------- */
.group-avatar-row { display: flex; align-items: center; gap: 14px; justify-content: center; margin-bottom: 14px; }
.group-avatar-row .avatar-slot img { width: 72px; height: 72px; display: block; }
.group-avatar-picker-option img { display: block; border-radius: 10px; }
.member-list { max-height: 260px; margin-bottom: 6px; }
.member-row .list-row-name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.role-tag {
  display: inline-flex; align-items: center; gap: 3px; font-size: 10px; font-weight: 700;
  border-radius: 999px; padding: 2px 7px; text-transform: uppercase; letter-spacing: 0.3px;
}
.owner-tag { background: var(--yellow); color: #171205; }
.admin-tag { background: var(--mint); color: #06130D; }
.member-more-btn { padding: 4px 10px; font-size: 16px; line-height: 1; }
.danger-btn { color: var(--pink); border-color: rgba(255, 92, 168, 0.4); }
.danger-btn:hover { background: rgba(255, 92, 168, 0.12); }

/* ---------- Legal links (v4) ---------- */
.legal-links { text-align: center; margin-top: 18px; font-size: 12.5px; color: var(--text-dim); }
.legal-links a { color: var(--text-dim); text-decoration: none; border-bottom: 1px dotted var(--text-dim); }
.legal-links a:hover { color: var(--cyan); border-color: var(--cyan); }
.legal-links-row { display: flex; gap: 10px; margin-top: 14px; }
.legal-links-row .btn { flex: 1; }

/* ================= EXTRAS (v2 features) ================= */
.fx-theme-btn {
  position: fixed; top: 14px; right: 14px; z-index: 60;
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--card-border); background: var(--glass);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font-size: 19px; cursor: pointer; color: var(--text);
  box-shadow: var(--shadow-card);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s var(--ease);
}
.fx-theme-btn:hover { transform: scale(1.08) rotate(8deg); }

.fx-icon-btn {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  border: 1px solid transparent; background: transparent; color: var(--text);
  font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, transform 0.15s;
}
.fx-icon-btn:hover { background: var(--bg-2); }
.fx-icon-btn:active { transform: scale(0.92); }

.fx-search-bar {
  width: 100%; max-width: 640px; display: flex; align-items: center; gap: 8px;
  background: var(--glass); border: 1px solid var(--card-border); border-radius: 999px;
  padding: 6px 8px 6px 16px; margin-bottom: 10px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.fx-search-bar input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text); font-family: inherit; font-size: 14px; min-width: 0;
}
.fx-search-bar input::placeholder { color: var(--text-dim); }
.fx-search-count { font-size: 12px; color: var(--text-dim); white-space: nowrap; }
.fx-search-close {
  width: 30px; height: 30px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--bg-2); color: var(--text); font-size: 13px; flex-shrink: 0;
}
.msg-row.fx-hidden { display: none !important; }

.fx-scroll-btn {
  position: fixed; right: 18px; bottom: 92px; z-index: 55;
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--card-border); background: var(--glass);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  color: var(--text); font-size: 18px; cursor: pointer;
  box-shadow: var(--shadow-card);
  display: flex; align-items: center; justify-content: center;
  animation: msgIn 0.25s var(--ease);
}
.fx-scroll-btn:hover { border-color: var(--accent-2); }

.fx-counter {
  position: absolute; right: 66px; bottom: -17px;
  font-size: 11px; color: var(--text-dim); pointer-events: none;
}
.fx-counter.fx-near-limit { color: var(--pink); font-weight: 700; }

/* ---------- Random tab (v3) ---------- */
.random-box { width: 100%; text-align: center; padding: 10px 4px 4px; }
.random-globe { font-size: 46px; animation: msgIn 0.5s var(--ease); }
.random-title { font-size: 22px; font-weight: 800; margin: 8px 0 6px; }
.random-text { color: var(--text-dim); font-size: 14px; line-height: 1.55; margin: 0 0 14px; }
.random-text strong { color: var(--text); }
.random-country-row { font-size: 14px; margin: 0 0 12px; }
.random-box .field-label { text-align: left; }
.random-box select.text-input { margin-bottom: 14px; }
.random-status { min-height: 20px; font-size: 13.5px; color: var(--mint); margin: 12px 0 4px; font-weight: 600; }
[data-theme="light"] .random-status { color: #0E9F6E; }
.random-note { font-size: 12px; color: var(--text-dim); margin-top: 10px; }

/* Random globe icon pulse (v3.1, replaces emoji) */
.random-globe img { animation: fxPulse 2.2s ease-in-out infinite; }
@keyframes fxPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.10); } }

/* ---------- Connections (v3.2) ---------- */
.conn-pills { display: flex; gap: 8px; margin-bottom: 12px; }
.conn-pill {
  flex: 1; border: 1px solid var(--card-border); background: var(--bg-2);
  color: var(--text-dim); border-radius: 999px; padding: 9px 12px;
  font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer;
  transition: all 0.2s var(--ease);
}
.conn-pill strong { color: var(--text); font-size: 15px; margin-right: 2px; }
.conn-pill.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #FFFFFF; border-color: transparent;
  box-shadow: 0 6px 20px rgba(249, 115, 22, 0.4);
}
.conn-pill.active strong { color: #FFFFFF; }
#connections-section .list-row .btn { padding: 6px 10px; font-size: 12px; margin: 0; }

/* ---------- DM list remove (v3.2) ---------- */
.room-card { position: relative; }
.fx-dm-remove {
  position: absolute; top: 6px; right: 8px; z-index: 2;
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; line-height: 1; color: var(--text-dim);
  background: transparent; cursor: pointer; transition: all 0.15s;
}
.fx-dm-remove:hover { background: rgba(255, 92, 168, 0.18); color: var(--pink); }

/* ---------- Swipe reply + quotes (v4) ---------- */
.msg-row { touch-action: pan-y; will-change: transform; }
.msg-quote {
  background: rgba(0, 0, 0, 0.16); border-left: 3px solid var(--cyan);
  border-radius: 8px; padding: 6px 9px; margin-bottom: 7px; max-width: 100%;
}
[data-theme="light"] .msg-quote { background: rgba(20, 22, 30, 0.06); }
[data-theme="light"] .msg-row:not(.mine) .msg-quote { background: rgba(20, 22, 30, 0.06); }
.msg-row:not(.mine) .msg-quote { background: var(--bg-2); border-left-color: var(--accent-2); }
.msg-quote-name { font-size: 11px; font-weight: 800; color: var(--cyan); margin-bottom: 1px; }
.msg-row:not(.mine) .msg-quote-name { color: var(--accent-2); }
[data-theme="light"] .msg-row:not(.mine) .msg-quote-name { color: var(--accent); }
.msg-quote-text {
  font-size: 12px; line-height: 1.35; opacity: 0.85; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.fx-reply-bar {
  width: 100%; max-width: 640px; display: flex; align-items: center; gap: 10px;
  background: var(--glass); border: 1px solid var(--card-border);
  border-left: 3px solid var(--cyan); border-radius: 14px;
  padding: 8px 10px 8px 14px; margin-bottom: 8px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  animation: msgIn 0.25s var(--ease);
}
.fx-reply-main { flex: 1; min-width: 0; }
.fx-reply-name { font-size: 12px; font-weight: 800; color: var(--cyan); }
.fx-reply-text {
  font-size: 12.5px; color: var(--text-dim); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.fx-reply-cancel {
  width: 30px; height: 30px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--bg-2); color: var(--text); font-size: 13px; flex-shrink: 0;
}

/* ---------- Random skip/next bar (v4.1) ---------- */
.fx-random-bar {
  width: 100%; max-width: 640px; display: flex; align-items: center; gap: 10px;
  justify-content: space-between;
  background: var(--glass); border: 1px solid var(--card-border);
  border-left: 3px solid var(--accent-2); border-radius: 14px;
  padding: 7px 8px 7px 14px; margin-bottom: 8px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  animation: msgIn 0.25s var(--ease);
}
.fx-random-label { font-size: 12.5px; font-weight: 700; color: var(--text-dim); display: inline-flex; align-items: center; gap: 6px; }
.fx-random-actions { display: inline-flex; gap: 8px; align-items: center; }
.fx-next-btn { width: auto; margin: 0; padding: 9px 16px; font-size: 13.5px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; }
.fx-random-bar .btn-ghost { padding: 8px 14px; font-size: 13px; }

/* ---------- Chat header compact fix (v4.2, from owner's phone screenshots) ---------- */
.chat-header {
  border-radius: 22px;
  padding: 6px 8px;
  gap: 6px;
  background: var(--card-solid);
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
.chat-header .btn-ghost { padding: 8px 12px; font-size: 13px; }
.chat-header .fx-icon-btn { width: 38px; height: 38px; }
.chat-header-title { overflow: hidden; }
.chat-title { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.chat-title.with-avatar { display: flex; }
.chat-subtitle {
  font-size: 11.5px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-width: 100%;
}
/* Theme toggle: home screens only (owner's call) — hidden inside chats */
body:has(#screen-chat.active) .fx-theme-btn { display: none !important; }

/* ---------- Photos in personal chats + Instagram-style profile (v4.5) ---------- */
.msg-photo {
  width: 100%; max-width: 250px; border-radius: 14px; display: block;
  margin: 2px 0 6px; cursor: zoom-in; background: var(--bg-2);
}
.fx-img-btn { flex: none; }
.fx-uploading { opacity: 0.55; pointer-events: none; animation: fxPulse 1s ease-in-out infinite; }
@keyframes fxPulse { 50% { opacity: 0.3; } }
.fx-lightbox {
  position: fixed; inset: 0; z-index: 200; background: rgba(5, 6, 10, 0.92);
  display: flex; align-items: center; justify-content: center; cursor: zoom-out;
}
.fx-lightbox img { max-width: 96vw; max-height: 92vh; border-radius: 12px; }

/* Instagram-style profile (own + view) */
.profile-ig .ig-username { text-align: left; font-size: 17px; margin-bottom: 10px; }
.ig-head { display: flex; align-items: center; gap: 20px; margin: 4px 0 14px; }
.ig-avatar {
  width: 84px; height: 84px; flex: none; border-radius: 50%; padding: 3px;
  background: conic-gradient(from 210deg, #F97316, #EC4899, #FBBF24, #F97316);
}
.ig-avatar svg, .ig-avatar img {
  width: 100%; height: 100%; border-radius: 50%; display: block;
  border: 3px solid var(--card-solid); box-sizing: border-box;
}
#view-profile-avatar.ig-avatar { margin: 4px auto 10px; }
.ig-stats { flex: 1; display: flex; justify-content: space-around; }
.ig-stat {
  background: none; border: none; border-bottom: 2px solid transparent;
  cursor: pointer; display: flex; flex-direction: column; align-items: center;
  gap: 1px; padding: 6px 12px 8px; color: var(--text-dim); font: inherit;
}
.ig-stat strong { font-size: 18px; font-weight: 800; color: var(--text); line-height: 1.15; }
.ig-stat span { font-size: 12.5px; }
.ig-stat.active { border-bottom-color: #EC4899; }
.profile-ig #view-profile-name { text-align: center; }
.profile-ig .view-profile-meta { justify-content: center; text-align: center; }
.profile-ig #view-profile-counts { font-weight: 700; color: var(--text); font-size: 13.5px; }

/* =====================================================================
   v5 APP SHELL (owner: "pura UI redesign") — modern social-app layout:
   top app bar with wordmark, chat-list rows instead of cards, and a
   fixed bottom navigation bar (Instagram/WhatsApp pattern). Works in
   both themes (variable-driven). Lobby structure/IDs untouched.
   ===================================================================== */
#screen-lobby { padding-top: 14px; }
.lobby-header {
  justify-content: space-between; align-items: center;
  max-width: 680px; margin-bottom: 10px; padding: 2px 2px 10px;
  border-bottom: 1px solid var(--card-border);
}
.app-wordmark {
  font-family: "Plus Jakarta Sans", sans-serif; font-weight: 800;
  font-size: 21px; letter-spacing: -0.02em;
  background: linear-gradient(92deg, #F97316, #EC4899 55%, #FBBF24);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.identity-badge { background: transparent; border-color: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; padding: 4px; }
.identity-badge .me-label { display: none; }
.identity-badge .me-name { display: none; }
.identity-badge .avatar-slot { width: 38px; height: 38px; }
.lobby-hero { display: none; }

.lobby-tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: flex; justify-content: space-around; align-items: stretch;
  background: var(--card-solid); border-top: 1px solid var(--card-border);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 30px rgba(2, 4, 10, 0.28);
  max-width: none; margin: 0; border-radius: 0;
}
.lobby-tab {
  flex: 1; flex-direction: column; gap: 3px; justify-content: center;
  font-size: 11px; font-weight: 600; padding: 7px 4px; border-radius: 14px;
  color: var(--text-dim); background: transparent;
}
.lobby-tab .icon { width: 21px; height: 21px; }
.lobby-tab.active { background: var(--bg-2); color: var(--text); box-shadow: none; }
.lobby-tab.active .icon { filter: brightness(1.5) saturate(1.3); }

.lobby-tab-panel, .lobby-actions { max-width: 680px; }
.room-list { grid-template-columns: 1fr; gap: 0; max-width: 680px; }
.room-card {
  background: transparent; border: none; border-bottom: 1px solid var(--card-border);
  border-radius: 0; box-shadow: none; padding: 13px 6px; gap: 13px;
  align-items: center; text-align: left; animation: none;
}
.room-card:hover { transform: none; background: var(--bg-2); box-shadow: none; border-color: var(--card-border); }
.room-emoji {
  width: 48px; height: 48px; flex: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #F97316, #EC4899);
  box-shadow: 0 4px 14px rgba(249, 115, 22, 0.35);
}
.room-name { flex: 1; font-size: 15.5px; font-weight: 600; min-width: 0; }
.room-card .room-sub { font-size: 12px; margin-top: 2px; }
.room-go { font-size: 0; flex: none; }
.room-go::after { content: "\203A"; font-size: 22px; color: var(--text-dim); font-weight: 400; }

/* Theme toggle sits above the bottom nav on the lobby; gate keeps top-right */
body:has(#screen-lobby.active) .fx-theme-btn { top: auto; bottom: 92px; right: 14px; }

/* Gate: bigger gradient brand mark */
.gate-card .brand-blob {
  width: 76px; height: 76px; border-radius: 24px;
  background: linear-gradient(135deg, #F97316, #EC4899 60%, #FBBF24);
  box-shadow: 0 14px 34px rgba(249, 115, 22, 0.45);
}

/* ---------- v6: slim random bar, real bottom nav, profile menu ---------- */
.modal-backdrop { z-index: 80; }
.fx-random-bar {
  display: flex; align-items: center; flex-wrap: nowrap;
  padding: 6px 10px; gap: 8px; border-radius: 14px;
}
.fx-random-label { font-size: 12.5px; white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; }
.fx-random-actions { display: inline-flex; gap: 6px; margin-left: auto; align-items: center; }
.fx-random-bar .btn { padding: 7px 13px; font-size: 13px; white-space: nowrap; border-radius: 999px; margin: 0; }
.lobby-tabs {
  background: var(--card-solid);
  border-top: 1px solid var(--card-border);
  box-shadow: 0 -10px 28px rgba(2, 4, 10, 0.30);
}
.lobby-tab { border: none !important; box-shadow: none !important; background: transparent; }
.lobby-tab.active { background: linear-gradient(135deg, #F97316, #EC4899); color: #FFFFFF; }
.lobby-tab.active .icon { filter: brightness(0) invert(1); }
.profile-ig { position: relative; }
.modal-menu-btn {
  position: absolute; top: 10px; right: 50px; width: 36px; height: 36px;
  border-radius: 50%; border: 1px solid var(--card-border);
  background: var(--bg-2); color: var(--text);
  font-size: 19px; line-height: 1; cursor: pointer; z-index: 3;
}
.ig-menu {
  position: absolute; top: 52px; right: 12px; z-index: 5; min-width: 215px;
  background: var(--card-solid); border: 1px solid var(--card-border);
  border-radius: 14px; box-shadow: var(--shadow-card);
  padding: 6px; display: flex; flex-direction: column; gap: 2px;
}
.ig-menu .btn, .ig-menu a.btn {
  width: 100%; text-align: left; border: none; background: transparent;
  box-shadow: none; padding: 10px 12px; border-radius: 9px; margin: 0;
}
.ig-menu .legal-links-row { display: flex; flex-direction: column; gap: 2px; margin: 0; }

/* ---------- v7: gate page — typographic hero, managed sizes + colours ---------- */
.gate-card { padding: 28px 22px 22px; max-width: 400px; }
.gate-card .brand { flex-direction: column; align-items: center; text-align: center; gap: 0; margin-bottom: 2px; }
.brand-eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: 4px;
  text-transform: uppercase; color: var(--text-dim);
}
.gate-card .brand h1 {
  font-size: 44px; font-weight: 800; letter-spacing: -1px; line-height: 1.05;
  margin: 2px 0 0;
  background: linear-gradient(92deg, #F97316 5%, #EC4899 55%, #FBBF24 105%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.gate-card .tagline { text-align: center; font-size: 14.5px; margin: 8px 0 16px; }
.gate-card .rules-list { gap: 8px; margin: 0 0 16px; }
.gate-card .rules-list li { padding: 10px 12px; font-size: 13.5px; border-radius: 12px; gap: 9px; align-items: center; }
.gate-card .field-label { font-size: 13.5px; margin: 12px 0 6px; }
.gate-card .text-input { padding: 12px 14px; font-size: 15px; border-radius: 12px; }
.gate-card .check-row { margin-top: 12px; font-size: 13.5px; }
.gate-card .btn-primary { padding: 13px; font-size: 15.5px; margin-top: 14px; border-radius: 14px; }
.gate-card .legal-links { font-size: 12px; margin-top: 12px; text-align: center; }
[data-theme="light"] .blob-bg { opacity: 0.55; }

/* ---------- v8: lobby redesign + instant-paint solid rows ---------- */
.lobby-hero { padding: 18px 20px 4px; text-align: left; }
.hero-eyebrow {
  font-size: 10.5px; font-weight: 700; letter-spacing: 3px;
  text-transform: uppercase; color: #F97316;
}
.lobby-hero h2 { font-size: 25px; font-weight: 800; letter-spacing: -0.4px; margin: 3px 0 2px; }
.hero-sub { font-size: 13.5px; color: var(--text-dim); margin: 0; }
.panel-heading {
  font-size: 12px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
  color: var(--text-dim); margin: 14px 20px 8px;
}
.room-list { gap: 8px; padding: 0 14px; }
.room-card {
  background: var(--card-solid);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: 0 4px 14px rgba(10, 6, 18, 0.10);
  width: 100%;
}

/* ---------- v9: visibility fixes, tighter header-footer spacing, cursive brand ---------- */
.room-card { opacity: 1 !important; animation: none !important; }
.lobby-hero { display: block; }
#screen-lobby { padding-top: 8px; }
.lobby-hero { padding-top: 10px; margin-bottom: 6px; }
.app-wordmark, .gate-card .brand h1 {
  font-family: "Pacifico", "Segoe Script", "Brush Script MT", cursive;
  font-weight: 400; letter-spacing: 0.5px;
}
.gate-card .brand h1 { font-size: 42px; padding-bottom: 6px; }

/* ---------- v10: lobby as a fixed app shell (no page drag/scroll) ---------- */
html, body { overscroll-behavior: none; }
#screen-lobby.active {
  height: 100vh; height: 100dvh; max-height: 100dvh; overflow: hidden;
  padding-bottom: 78px;
}
#screen-lobby .app-bar, #screen-lobby .lobby-hero { flex: none; }
#screen-lobby .lobby-tab-panel {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; width: 100%;
  -webkit-overflow-scrolling: touch; padding-bottom: 10px;
}

/* ---------- v12: compact gate + returning mode + edge-attached header/footer ---------- */
.gate-card { max-width: 380px; padding: 24px 20px 18px; }
.gate-card .brand h1 { font-size: 38px; }
.gate-card .tagline { font-size: 13.5px; margin: 6px 0 12px; }
.gate-card .rules-list li { padding: 8px 11px; font-size: 12.5px; border-radius: 10px; }
.gate-card .text-input { padding: 11px 13px; }
.gate-wb { text-align: center; font-size: 15px; color: var(--text); margin: 10px 0 4px; }
.gate-wb-dots span {
  display: inline-block; width: 5px; height: 5px; margin-left: 4px; border-radius: 50%;
  background: #F97316; animation: fxWbDot 1.2s ease-in-out infinite;
}
.gate-wb-dots span:nth-child(2) { animation-delay: 0.15s; }
.gate-wb-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes fxWbDot { 0%, 100% { opacity: 0.25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }
#screen-gate.returning .rules-list,
#screen-gate.returning .field-label,
#screen-gate.returning .text-input,
#screen-gate.returning .check-row,
#screen-gate.returning #agree-btn,
#screen-gate.returning #gate-error,
#screen-gate.returning .legal-links,
#screen-gate.returning .tagline { display: none; }
#screen-gate.returning .gate-card { padding-bottom: 26px; }
#screen-lobby { padding-left: 0; padding-right: 0; padding-top: 0; }
#screen-lobby.active { padding-bottom: 66px; }
.lobby-header {
  max-width: none; width: 100%;
  background: var(--card-solid);
  border-bottom: 1px solid var(--card-border);
  padding: 10px 16px; margin-bottom: 0;
  align-items: center;
}
#screen-lobby .lobby-actions { padding: 0 14px; }
#screen-lobby .random-box { margin: 0 14px; width: auto; }

/* ---------- v13: theme button docked into the footer band, sticky panel headings ---------- */
body:has(#screen-lobby.active) .fx-theme-btn { top: auto; bottom: 12px; right: 10px; z-index: 61; }
.lobby-tabs { padding-right: 58px; }
.panel-heading {
  position: sticky; top: 0; z-index: 2;
  background: var(--bg);
  margin-top: 0; padding-top: 12px; padding-bottom: 6px;
}

/* ---------- v14: header fixed to the top edge (like the footer), headings unstuck ---------- */
.lobby-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 70;
  box-shadow: 0 6px 20px rgba(2, 4, 10, 0.18);
}
#screen-lobby { padding-top: 60px; }
.panel-heading { position: static; background: transparent; margin-top: 14px; padding-top: 0; padding-bottom: 0; }

/* ---------- v15: header band removed; profile + theme live in the footer bar ---------- */
.lobby-header { display: none !important; }
#screen-lobby { padding-top: 14px; }
.lobby-tabs { padding-right: 6px; align-items: center; }
.lobby-tabs .fx-theme-btn { position: static !important; flex: none; width: 42px; height: 42px; margin: 0 2px; }
.lobby-tabs .identity-badge {
  flex: none; margin-left: 2px; padding: 3px;
  background: transparent; border: none; box-shadow: none;
  width: auto; max-width: none;
}
.lobby-tabs .identity-badge .me-label,
.lobby-tabs .identity-badge .me-name { display: none; }
.lobby-tabs .identity-badge .avatar-slot { width: 40px; height: 40px; }

/* ---------- v16: app locked to the screen (no page drag/scroll), PUBLIC ROOMS bigger + up ---------- */
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
#screen-gate.active { height: 100vh; height: 100dvh; overflow-y: auto; }
#screen-lobby { padding-top: 10px; }
.panel-heading {
  font-size: 18px; font-weight: 800; letter-spacing: 1.5px;
  color: var(--text); text-transform: uppercase;
  margin: 2px 20px 10px;
}
.room-card { padding-top: 12px; padding-bottom: 12px; }

/* ---------- v17: footer bar lives at body level — pinned to the screen, lobby-only ---------- */
#screen-lobby { box-sizing: border-box; }
body > .lobby-tabs { display: none; }
body:has(#screen-lobby.active) > .lobby-tabs { display: flex; }

/* ---------- v18: footer items uniform — same box, icon size, label size ---------- */
.lobby-tabs { align-items: stretch; gap: 2px; padding: 6px; }
.lobby-tab {
  flex: 1 1 0; min-height: 52px; padding: 5px 2px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  white-space: nowrap; font-size: 10px; line-height: 1.1; letter-spacing: 0;
  border-radius: 14px;
}
.lobby-tab .icon { width: 22px; height: 22px; }
.lobby-tabs .identity-badge {
  flex: 0 0 52px; min-height: 52px; margin: 0; padding: 5px 2px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border-radius: 14px;
}
.lobby-tabs .identity-badge .avatar-slot { width: 24px; height: 24px; }
.lobby-tabs .fx-theme-btn {
  flex: 0 0 52px; width: auto; height: auto; min-height: 52px; margin: 0; padding: 5px 2px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border-radius: 14px;
}
.fx-nav-label { font-size: 10px; line-height: 1.1; color: var(--muted); white-space: nowrap; }

/* ---------- v19: footer uniformity, take two (body-level, beats legacy tab/button rules) ---------- */
body > .lobby-tabs { align-items: center; }
body > .lobby-tabs .lobby-tab { flex: 1 1 0 !important; }
body > .lobby-tabs .fx-theme-btn {
  width: auto !important; height: auto !important; min-height: 52px;
  border: none !important; background: transparent !important; box-shadow: none !important;
  border-radius: 14px; padding: 5px 2px;
}
body > .lobby-tabs .identity-badge { min-height: 52px; }

/* ---------- v20: theme button to the top-right corner; footer profile = plain user icon ---------- */
body:has(#screen-lobby.active) .fx-theme-btn { top: 10px; right: 12px; bottom: auto; }
.lobby-tabs .identity-badge .avatar-slot {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FB923C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E") center / 22px 22px no-repeat;
}
.lobby-tabs .identity-badge .avatar-slot > * { display: none !important; }

/* ---------- v21: pin the footer avatar slot to 24px (an ID rule was keeping it ~44px, clipping the Profile label) ---------- */
body > .lobby-tabs #me-avatar { width: 24px !important; height: 24px !important; }

/* ---------- v22: profile head, Instagram layout ---------- */
#profile-modal .ig-username { text-align: left; font-size: 19px; font-weight: 800; margin-bottom: 12px; }
#profile-modal .ig-head { display: flex; align-items: center; gap: 20px; margin-bottom: 6px; }
#profile-modal .ig-avatar { width: 84px; height: 84px; flex: none; }
#profile-modal .ig-stats { flex: 1; display: flex; justify-content: space-around; }
#profile-modal .ig-stat { background: transparent; border: none; box-shadow: none; padding: 4px 2px; }
#profile-modal .ig-stat strong { font-size: 17px; line-height: 1.15; }
#profile-modal .ig-stat span { font-size: 12px; color: var(--muted); }
#profile-modal .ig-stat.active strong, #profile-modal .ig-stat.active span { color: var(--text); }
.fx-ig-actions { display: flex; gap: 8px; margin: 10px 0 14px; }
.fx-ig-actions .btn { flex: 1; margin: 0; }

/* ---------- v23: INSTAGRAM reskin — flat black/white, IG blue, no sunset ---------- */
:root {
  --bg: #000000; --bg-2: #0A0A0A;
  /* FX26 (v43): --text was never re-declared in this dark reskin block, so
     plain copy inherited the browser default (near-black) on the dark
     background. Pin the text pair explicitly for dark mode. */
  --text: #F5F5F5; --text-dim: #A8A8A8;
  --accent: #833AB4; --accent-2: #3797F0;
  --cyan: #0095F6; --pink: #3797F0; --lavender: #833AB4; --yellow: #0095F6; --mint: #A8A8A8;
  --card: #0A0A0A; --card-solid: #161616; --card-border: #262626;
  --text-dim: #A8A8A8; --bubble: #262626; --glass: rgba(10, 10, 10, 0.92);
  --shadow-glow: none; --shadow-card: none;
}
[data-theme="light"] {
  --bg: #FFFFFF; --bg-2: #FAFAFA;
  --card: #FFFFFF; --card-solid: #FFFFFF; --card-border: #DBDBDB;
  --text-dim: #737373; --bubble: #EFEFEF;
  --shadow-glow: none; --shadow-card: none;
}
body { background: var(--bg) !important; }
.btn-primary { background: #0095F6 !important; box-shadow: none !important; }
.room-list { gap: 0 !important; }
.room-card {
  background: transparent !important; border: none !important;
  border-bottom: 1px solid var(--card-border) !important;
  border-radius: 0 !important; box-shadow: none !important;
}
.room-emoji { background: #262626 !important; box-shadow: none !important; }
[data-theme="light"] .room-emoji { background: #EFEFEF !important; }
[data-theme="light"] .room-emoji .icon { filter: brightness(0); }
.msg-row.mine .msg-bubble { box-shadow: none !important; }
.lobby-tab { opacity: 0.55; }
.lobby-tab.active { opacity: 1; background: transparent !important; box-shadow: none !important; }
.lobby-tab .icon { filter: grayscale(1) brightness(1.8); }
[data-theme="light"] .lobby-tab .icon { filter: grayscale(1) brightness(0.3); }
body > .lobby-tabs #me-avatar { filter: grayscale(1) brightness(1.8); }
[data-theme="light"] body > .lobby-tabs #me-avatar { filter: grayscale(1) brightness(0.3); }
.gate-card h1, .app-wordmark {
  background: none !important;
  -webkit-text-fill-color: var(--text) !important;
  color: var(--text) !important;
}
.modal-card, .card { box-shadow: none !important; }

/* ---------- v24: profile is a full PAGE, exactly like Instagram ---------- */
#profile-modal { padding: 0 !important; background: var(--bg) !important; }
#profile-modal .modal-card.profile-ig {
  width: 100% !important; max-width: 100% !important;
  height: 100vh; height: 100dvh; max-height: none !important;
  margin: 0 !important; border: none !important; border-radius: 0 !important;
  display: flex; flex-direction: column; overflow-y: auto;
  padding: 14px 16px 28px;
}
body:has(#profile-modal:not(.hidden)) .fx-theme-btn { display: none !important; }
.profile-ig .ig-username { order: 0; padding-right: 76px; }
.profile-ig .ig-head { order: 1; }
.profile-ig .my-code-row { order: 2; justify-content: flex-start; gap: 10px; margin: 8px 0 2px; }
.profile-ig .fx-ig-actions { order: 3; }
.profile-ig .fx-ig-actions .fx-add-btn { flex: 0 0 46px; display: flex; align-items: center; justify-content: center; }
.profile-ig #connections-section { order: 4; }
.profile-ig #requests-section { order: 5; }
.profile-ig #avatar-picker { order: 6; }
.profile-ig #avatar-shuffle-btn { order: 7; }
.profile-ig label[for="profile-name"] { order: 8; }
.profile-ig #profile-name { order: 9; }
.profile-ig label[for="profile-gender"] { order: 10; }
.profile-ig #profile-gender { order: 11; }
.profile-ig .check-row { order: 12; }
.profile-ig > #open-blocked-btn { order: 13; }
.profile-ig .legal-links-row { order: 14; }
.profile-ig .modal-btn-row { order: 15; }
#profile-modal .profile-ig:not(.editing) #avatar-picker,
#profile-modal .profile-ig:not(.editing) #avatar-shuffle-btn,
#profile-modal .profile-ig:not(.editing) label[for="profile-name"],
#profile-modal .profile-ig:not(.editing) #profile-name,
#profile-modal .profile-ig:not(.editing) label[for="profile-gender"],
#profile-modal .profile-ig:not(.editing) #profile-gender,
#profile-modal .profile-ig:not(.editing) .check-row,
#profile-modal .profile-ig:not(.editing) > #open-blocked-btn,
#profile-modal .profile-ig:not(.editing) .modal-btn-row { display: none !important; }
.profile-ig .requests-list > * { border-bottom: 1px solid var(--card-border); }

/* ---------- v25: Followers/Following live on their own page (Instagram-style) ---------- */
.profile-ig #connections-section, .profile-ig #requests-section { display: none !important; }
#fx-conn-page {
  position: fixed; inset: 0; z-index: 90; background: var(--bg); color: var(--text);
  display: none; flex-direction: column; overflow-y: auto;
  padding: 10px 16px 30px;
}
#fx-conn-page.open { display: flex; }
#fx-conn-page #requests-section { display: block !important; }
.fx-conn-top { display: flex; align-items: center; gap: 14px; padding: 4px 0 10px; }
.fx-conn-back { background: transparent; border: none; color: var(--text); padding: 6px; margin-left: -6px; display: flex; }
.fx-conn-name { font-size: 17px; font-weight: 800; }
.fx-conn-tabs { display: flex; border-bottom: 1px solid var(--card-border); }
.fx-conn-tab {
  flex: 1; background: transparent; border: none; color: var(--text-dim);
  font-size: 14px; padding: 10px 4px; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.fx-conn-tab strong { color: inherit; }
.fx-conn-tab.active { color: var(--text); border-bottom-color: var(--text); font-weight: 700; }
.fx-conn-search { padding: 12px 0 4px; }
.fx-conn-search-input { width: 100%; border-radius: 10px; }
.fx-conn-body .requests-list > * { border-bottom: 1px solid var(--card-border); padding-top: 10px; padding-bottom: 10px; }

/* ---------- v27: other profiles are full pages too ---------- */
#view-profile-modal { padding: 0 !important; background: var(--bg) !important; z-index: 95; }
#view-profile-modal .modal-card.profile-ig {
  width: 100% !important; max-width: 100% !important;
  height: 100vh; height: 100dvh; max-height: none !important;
  margin: 0 !important; border: none !important; border-radius: 0 !important;
  display: flex; flex-direction: row; flex-wrap: wrap; align-content: flex-start;
  overflow-y: auto; padding: 14px 16px 28px; position: relative;
}
#view-profile-modal .modal-title { order: 0; flex: 1 1 100%; text-align: left; font-size: 19px; font-weight: 800; padding-right: 52px; margin-bottom: 12px; }
#view-profile-avatar { order: 1; flex: 0 0 auto; }
#view-profile-modal .view-profile-meta { order: 2; flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 8px; padding-left: 18px; }
#view-profile-counts { display: flex !important; gap: 34px; background: transparent !important; border: none !important; padding: 0 !important; }
#view-profile-counts .vp-stat { display: flex; flex-direction: column; align-items: center; line-height: 1.25; text-transform: none; letter-spacing: 0; }
#view-profile-counts .vp-stat strong { font-size: 17px; font-weight: 800; color: var(--text); }
#view-profile-counts .vp-stat span { font-size: 12px; color: var(--text-dim); font-weight: 400; }
#view-profile-modal .modal-btn-row { order: 3; flex: 1 1 100%; margin-top: 14px; }
#view-profile-follow-btn { order: 0; }
#view-profile-message-btn { order: 1; }
#view-profile-close-btn {
  position: absolute; top: 8px; right: 10px; width: 38px !important; height: 38px;
  margin: 0 !important; padding: 0 !important; background: transparent !important;
  border: none !important; font-size: 17px; color: var(--text);
  display: flex; align-items: center; justify-content: center;
}
body:has(#view-profile-modal:not(.hidden)) .fx-theme-btn { display: none !important; }

/* ---------- v28: follow gate bar in DMs ---------- */
#fx-follow-gate {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 0 12px 8px; padding: 10px 12px;
  background: var(--card-solid); border: 1px solid var(--card-border); border-radius: 12px;
  font-size: 13px; color: var(--text-dim);
}
#fx-follow-gate.hidden { display: none !important; }
#fx-follow-gate .fx-gate-btn { flex: 0 0 auto; padding: 7px 14px; }
/* FX26 (v43): .btn-primary is width:100% by default — inside the gate bar
   that crushed the text into a sliver. Content-width in the gate only. */
#fx-follow-gate .fx-gate-btn { width: auto !important; margin-top: 0 !important; white-space: nowrap; }
#fx-follow-gate .fx-gate-text { flex: 1 1 auto; min-width: 0; }
#message-input:disabled { opacity: .55; }

/* ---------- v29: their followers/following page ---------- */
#fx-people-page {
  position: fixed; inset: 0; z-index: 96; background: var(--bg); color: var(--text);
  display: none; flex-direction: column; overflow-y: auto;
  padding: 10px 16px 30px;
}
#fx-people-page.open { display: flex; }
#fx-people-page .fx-conn-body .list-row { border-bottom: 1px solid var(--card-border); padding-top: 10px; padding-bottom: 10px; }
#view-profile-counts .vp-stat { cursor: pointer; }

/* ---------- v31: profile pages get an explicit themed surface ---------- */
#profile-modal .modal-card.profile-ig,
#view-profile-modal .modal-card.profile-ig { background: var(--card-solid) !important; color: var(--text) !important; }
/* requests belong on the profile page (v31), not hidden with connections */
#profile-modal .profile-ig #requests-section { display: block !important; }
/* ---------- v31: random bar must never run off a narrow screen ---------- */
.fx-random-bar { flex-wrap: wrap !important; row-gap: 6px; max-width: 100%; box-sizing: border-box; }
.fx-random-actions { flex-wrap: wrap; margin-left: auto; }
.fx-random-label { font-size: 12px; }
.fx-random-bar .btn { padding: 6px 11px; font-size: 12.5px; }

/* FX18 (v32): connection pill + list name truncation */
#fx-offline-pill { position: fixed; top: calc(8px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 300; background: #B91C1C; color: #fff; font-size: 12px; font-weight: 600; padding: 6px 14px; border-radius: 999px; box-shadow: 0 4px 14px rgba(0,0,0,.35); pointer-events: none; }
.list-row-name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* FX19 (v33): request-row layout (avatar fixed, name visible, compact buttons) + sending hint */
#requests-list .list-row { flex-wrap: nowrap; }
#requests-list .avatar-slot { width: 36px; height: 36px; flex: none; }
#requests-list .avatar-slot svg, #requests-list .avatar-slot img { width: 36px; height: 36px; display: block; }
#requests-list .list-row-name { flex: 1 1 auto; min-width: 40px; color: var(--text); }
#requests-list .btn { flex: none; }
#fx-sending { font-size: 11px; color: var(--text-dim); padding: 2px 14px 0; }

/* FX20 (v34): request-row buttons must not inherit the full-width form style */
#requests-list .btn { flex: none; width: auto; margin-top: 0; }
#requests-list .accept-btn { padding: 7px 16px; font-size: 13px; }
#requests-list .decline-btn { padding: 7px 12px; font-size: 13px; }
#view-profile-modal .view-profile-meta { flex: 1 1 100%; justify-content: flex-start; }
#view-profile-modal .view-profile-meta > * { flex: 0 0 auto; }

/* FX28 (v45): profile pages — force readable text in BOTH profile modals.
   Elements inside the profile that never named a colour inherited the
   browser default (black), invisible on the dark surface. Pin the modal
   text to the theme text colour; name/title/stats are explicit white in
   dark mode; light mode keeps dark text via the same variables. */
#profile-modal .modal-card.profile-ig,
#view-profile-modal .modal-card.profile-ig { color: var(--text) !important; }
#profile-modal .modal-card.profile-ig :is(.modal-title, .ig-username, .field-label, .check-row, .empty-hint, .list-row-name, .ig-stat span, .vp-stat span),
#view-profile-modal .modal-card.profile-ig :is(.modal-title, .ig-username, .field-label, .check-row, .empty-hint, .list-row-name, .ig-stat span, .vp-stat span) { color: var(--text) !important; }
#profile-modal .modal-card.profile-ig :is(.ig-stat strong, .vp-stat strong),
#view-profile-modal .modal-card.profile-ig :is(.ig-stat strong, .vp-stat strong) { color: var(--text) !important; }
#profile-modal .text-input, #view-profile-modal .text-input { color: var(--text) !important; }
#profile-modal .text-input::placeholder, #view-profile-modal .text-input::placeholder { color: var(--text-dim) !important; }

/* FX29 (v46): Aryan (14 Nov 2026 22:56): the lobby backdrop in LIGHT mode
   must not stay dark. Root cause: the decorative .blob-bg has no light
   override — in the IG-reskin dark :root the accent variables are purple/
   blue (#833AB4/#3797F0), and the blurred floaters + the body's hard dark
   radial tint at the top compose into a dark-blue field even when the
   light variables are active underneath. In light mode: hide the blob
   layer entirely and give the body a clean light backdrop. */
[data-theme="light"] .blob-bg { display: none !important; }
[data-theme="light"] body {
  background:
    radial-gradient(90% 60% at 85% -10%, rgba(131, 58, 180, 0.07) 0%, transparent 55%),
    radial-gradient(120% 120% at 15% -10%, #FFFFFF 0%, var(--bg) 60%) !important;
}

/* FX30 (v47): Aryan (14 Nov 2026 22:59): the lobby font renders coarse /
   pixelated on his phone — the display font arrives from Google Fonts
   and on his link it swaps/falls back jagged, worst on the 800-weight
   headings. Pin the app text to the phone's built-in system fonts:
   always present, no download race, smooth rendering on Redmi-class
   screens. (Pacifico brand wordmark untouched.) */
body, h1, h2, .chat-title, .brand h1, .brand h2, .panel-heading,
button, input, select, textarea { font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif !important; }

/* FX31 (v48): light mode must flip the TEXT too. The reskin light block
   never re-declares --text, and FX28/v45 pinned profile text to var(--text)
   (= #F5F5F5 in the dark cascade) — so backgrounds went white while text
   stayed near-white. One decisive light palette at the end of the cascade:
   every text-bearing variable becomes dark-on-light values. */
[data-theme="light"] {
  --text: #17181C !important;
  --text-dim: #5C6067 !important;
  --muted: #5C6067 !important;
  --bg: #FFFFFF !important;
  --bg-2: #FAFAFA !important;
  --card: #FFFFFF !important;
  --card-solid: #FFFFFF !important;
  --card-border: #DBDBDB !important;
  --bubble: #EFEFEF !important;
  --glass: rgba(255, 255, 255, 0.92) !important;
}
[data-theme="light"] body { color: var(--text) !important; }


/* FX32 (v49): pixelated display font for the panel headings — Aryan's
   design pick ("pixelated font style use karo", 14 Nov 2026 23:00 IST).
   Body stays on the system font for readability; headings go pixel. */
.panel-heading { font-family: "Silkscreen", monospace !important; letter-spacing: 1px; }

/* FX33 (v50): two light-theme/row leftovers from the v49 check — the
   ACTIVE footer tab's label rendered white (invisible on the white bar),
   and the room rows' trailing text inherited the surface colour. Pin the
   active footer label to the theme text colour; room rows keep just the
   chevron (the "Join" word was a leftover span — hide it for a clean row). */
[data-theme="light"] body > .lobby-tabs .lobby-tab.active,
[data-theme="light"] body > .lobby-tabs .lobby-tab.active .fx-nav-label { color: var(--text) !important; }
.room-card .room-go { color: var(--text-dim) !important; }

/* FX34 (v51): restore the cursive brand wordmark. v47's system-font pin
   listed h1 — the gate title is an h1 — and silently flattened the
   Pacifico cursive (Aryan, 23:03 IST: "ye cursive wala kyu hta diya").
   The brand selectors come last with !important; body copy keeps the
   system font, headings keep the pixel font. */
.app-wordmark, .gate-card .brand h1 { font-family: "Pacifico", "Segoe Script", "Brush Script MT", cursive !important; }

/* FX35 (v52): footer colours made decisive in BOTH themes (Aryan, 23:08
   IST, screenshot: in dark mode the inactive tab labels render dark grey
   on the near-black bar — "text colour" circled on Profile). The tab
   labels were var(--muted), which is undefined, over a 0.55 tab opacity.
   Pin: inactive tabs get --text-dim at full label opacity; the ACTIVE
   tab's label gets the full --text. Light variants come from the FX31
   palette, so both themes stay readable. */
body > .lobby-tabs .lobby-tab { opacity: 1 !important; }
body > .lobby-tabs .lobby-tab .fx-nav-label { color: var(--text-dim) !important; opacity: 1 !important; }
body > .lobby-tabs .lobby-tab.active .fx-nav-label { color: var(--text) !important; }
body > .lobby-tabs .identity-badge .fx-nav-label { color: var(--text-dim) !important; opacity: 1 !important; }


/* FX36 (v54): search-facing about section on the gate — real copy for
   visitors and crawlers (international / stranger / no-abuse chat). */
.fx-seo { max-width: 640px; margin: 4px auto 28px; padding: 0 20px; color: var(--text-dim); font-size: 14px; line-height: 1.65; }
.fx-seo h2 { color: var(--text); font-size: 18px; line-height: 1.35; margin: 20px 0 8px; }
.fx-seo p { margin: 0 0 10px; }
.fx-seo ul { margin: 6px 0 0; padding-left: 18px; }
.fx-seo li { margin: 3px 0; }
