/* ===== ROOT ===== */
:root {
  --bg: #0b1020;
  --bg-soft: #121830;
  --panel: rgba(20, 27, 52, 0.92);
  --panel-2: rgba(255, 255, 255, 0.04);
  --line: rgba(255, 255, 255, 0.08);
  --text: #eef2ff;
  --muted: #9da8c7;
  --primary: #7c5cff;
  --primary-2: #29c4ff;
  --success: #1ecb8b;
  --danger: #ff5f7a;
  --warning: #ffb547;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --header-h: 64px;
  --bottom-nav-h: 48px;
  --max-width: 1280px;
}

body[data-theme="light"] {
  --bg: #f5f7ff;
  --bg-soft: #e9eefc;
  --panel: rgba(255, 255, 255, 0.94);
  --panel-2: rgba(12, 20, 40, 0.04);
  --line: rgba(12, 20, 40, 0.08);
  --text: #16203a;
  --muted: #5e6a8d;
  --primary: #6d52ff;
  --primary-2: #1da8ff;
  --success: #12996a;
  --danger: #e54666;
  --warning: #d98a12;
  --shadow: 0 16px 36px rgba(25, 40, 80, 0.12);
}


/* ===== RESET ===== */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(124, 92, 255, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(41, 196, 255, 0.14), transparent 24%),
    linear-gradient(180deg, var(--bg) 0%, #0a0f1f 100%);
  transition: background 0.25s ease, color 0.25s ease;
}

body[data-theme="light"] {
  background:
    radial-gradient(circle at top left, rgba(124, 92, 255, 0.1), transparent 28%),
    radial-gradient(circle at top right, rgba(41, 196, 255, 0.08), transparent 24%),
    linear-gradient(180deg, #f8faff 0%, #edf2ff 100%);
}

img,
svg {
  max-width: 100%;
  display: block;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: var(--radius-md);
  padding: 13px 14px;
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

textarea {
  resize: vertical;
  min-height: 110px;
}

.hidden {
  display: none !important;
}


/* ===== GLOBAL LAYOUT ===== */
.top-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  backdrop-filter: blur(16px);
  background: rgba(9, 14, 28, 0.74);
  border-bottom: 1px solid var(--line);
}

body[data-theme="light"] .top-header {
  background: rgba(255, 255, 255, 0.74);
}

.header-left,
.header-right,
.brand,
.brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 10px 24px rgba(87, 107, 255, 0.28);
}

.brand-text {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.app-main {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 12px 12px calc(var(--bottom-nav-h) + 12px);
}

.page {
  display: none;
}

.active-page {
  display: block;
}

.card,
.hero-card,
.entry-card,
.benefit-card,
.mini-link-card,
.action-card,
.modal-card {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.card,
.hero-card,
.entry-card,
.benefit-card,
.action-card,
.modal-card {
  border-radius: var(--radius-xl);
}

.page-header {
  margin-bottom: 18px;
}

.eyebrow,
.entry-badge,
.status-pill,
.online-pill,
.room-tag,
.joined-pill,
.join-pill,
.mini-note,
.interest-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  line-height: 1;
}

.eyebrow {
  padding: 8px 12px;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--line);
  margin-bottom: 12px;
  font-size: 0.82rem;
  font-weight: 700;
}

.page-title,
.hero-title {
  margin: 0 0 10px;
  line-height: 1.08;
}

.hero-title {
  font-size: clamp(2rem, 8vw, 3.4rem);
}

.page-title,
.section-title,
.card-title {
  font-size: clamp(1.15rem, 4.8vw, 1.8rem);
}

.page-subtext,
.hero-text,
.section-text,
.muted-text,
.info-note,
.verified-note,
small {
  color: var(--muted);
}

.page-subtext,
.hero-text,
.section-text,
.info-note,
.verified-note,
.feature-list li,
.simple-list li,
.contact-card p,
.content-card p {
  line-height: 1.65;
}

.section-head {
  margin-bottom: 14px;
}


/* ===== BUTTONS ===== */
.primary-btn,
.secondary-btn,
.text-btn,
.social-btn,
.small-btn,
.tool-btn,
.send-btn,
.call-btn,
.bottom-nav-link,
.drawer-link,
.mini-link-card,
.action-card {
  transition: 0.22s ease;
}

.primary-btn,
.secondary-btn,
.text-btn,
.social-btn,
.small-btn,
.send-btn,
.call-btn {
  min-height: 46px;
  padding: 12px 16px;
  border-radius: 14px;
  font-weight: 700;
}

.primary-btn {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
}

.primary-btn:hover {
  transform: translateY(-1px);
}

.secondary-btn,
.social-btn,
.small-btn,
.call-btn,
.tool-btn,
.text-btn {
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.danger-btn {
  background: rgba(255, 95, 122, 0.12);
  color: #ffd7df;
  border: 1px solid rgba(255, 95, 122, 0.25);
}

body[data-theme="light"] .danger-btn {
  color: #b42040;
}

.full-btn {
  width: 100%;
}

.grow-btn {
  flex: 1 1 0;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.text-btn {
  min-height: 40px;
  padding: 10px 14px;
}

.btn-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}


/* ===== SIDE DRAWER ===== */
.side-drawer {
  position: fixed;
  top: 0;
  left: -290px;
  z-index: 120;
  width: 280px;
  height: 100vh;
  padding: 16px;
  background: var(--bg-soft);
  border-right: 1px solid var(--line);
  transition: left 0.25s ease;
}

.side-drawer.open {
  left: 0;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.drawer-nav {
  display: grid;
  gap: 8px;
}

.drawer-link {
  text-align: left;
  padding: 13px 14px;
  border-radius: 14px;
  color: var(--muted);
  background: transparent;
}

.drawer-link.active,
.drawer-link:hover {
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(4, 8, 18, 0.48);
  opacity: 0;
  pointer-events: none;
  transition: 0.22s ease;
}

.drawer-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}


/* ===== HOME PAGE ===== */
.hero-section {
  margin-bottom: 18px;
}

.hero-card {
  padding: 24px 18px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.entry-cards-section,
.benefit-grid,
.home-links-section,
.dashboard-actions,
.auth-layout,
.profile-layout {
  display: grid;
  gap: 16px;
}

.entry-card,
.benefit-card,
.auth-card,
.side-info-card,
.welcome-card,
.updates-card,
.room-search-card,
.room-filter-card,
.room-list-card,
.active-room-card,
.room-empty-state,
.random-control-card,
.profile-card,
.settings-card,
.content-card,
.contact-card {
  padding: 18px;
}

.entry-badge,
.verified-badge {
  margin-bottom: 10px;
  padding: 8px 12px;
  font-size: 0.78rem;
  font-weight: 800;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--muted);
}

.verified-badge {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border: 0;
}

.feature-list,
.simple-list {
  margin: 0;
  padding-left: 18px;
}

.compact-list {
  margin-bottom: 16px;
}

.feature-list li,
.simple-list li {
  margin-bottom: 8px;
}

.benefit-card h3,
.entry-card h2 {
  margin-top: 0;
}

.mini-link-card {
  width: 100%;
  text-align: left;
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
}

.mini-link-card span {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
}

.mini-link-card small {
  display: block;
}


/* ===== LOGIN PAGE ===== */
.social-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.divider {
  position: relative;
  text-align: center;
  margin: 16px 0;
}

.divider::before {
  content: "";
  position: absolute;
  inset: 50% 0 auto;
  height: 1px;
  background: var(--line);
}

.divider span {
  position: relative;
  z-index: 1;
  padding: 0 12px;
  color: var(--muted);
  background: var(--panel);
}

.form-block {
  margin-bottom: 14px;
}

.form-block label,
.small-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--panel-2);
  overflow: hidden;
  margin-bottom: 12px;
}

.input-prefix {
  padding: 0 14px;
  color: var(--muted);
}

.input-row input {
  border: 0;
  background: transparent;
}


/* ===== DASHBOARD ===== */
.welcome-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.status-pill {
  padding: 8px 12px;
  font-size: 0.8rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--success), var(--primary));
}

.dashboard-actions {
  grid-template-columns: 1fr 1fr;
  margin: 16px 0;
}

.action-card {
  min-height: 120px;
  padding: 18px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
}

.action-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1rem;
}

.action-card span {
  color: var(--muted);
}


/* ===== ROOMS PAGE ===== */
.rooms-layout {
  display: grid;
  gap: 16px;
}

.room-sidebar,
.room-chat-panel {
  display: grid;
  gap: 16px;
}

.filter-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.filter-scroll::-webkit-scrollbar {
  height: 5px;
}

.filter-scroll::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 999px;
}

.filter-chip {
  white-space: nowrap;
  min-height: 38px;
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--muted);
  border: 1px solid var(--line);
  background: var(--panel-2);
  font-weight: 700;
}

.filter-chip.active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
}

.room-list-head,
.room-item-top,
.room-item-bottom,
.room-chat-top,
.room-chat-actions,
.message-meta,
.random-chat-top,
.random-top-actions,
.safe-mode-row,
.toggle-row,
.modal-head,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.room-list {
  display: grid;
  gap: 10px;
}

.room-item {
  text-align: left;
  padding: 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--panel-2);
}

.room-item.active-room {
  border-color: rgba(124, 92, 255, 0.4);
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.18), rgba(41, 196, 255, 0.12));
}

.online-pill,
.room-tag,
.joined-pill,
.join-pill,
.mini-note {
  padding: 7px 10px;
  font-size: 0.75rem;
  font-weight: 800;
}

.online-pill,
.room-tag,
.mini-note {
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.joined-pill {
  color: #fff;
  background: linear-gradient(135deg, var(--success), var(--primary));
}

.join-pill {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
}

.mobile-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mobile-chat-title {
  flex: 1;
  min-width: 0;
}

.mobile-chat-title strong,
.mobile-chat-title small {
  display: block;
}

.empty-state-box {
  text-align: center;
  padding: 20px 8px;
}

.room-chat-top {
  align-items: flex-start;
  margin-bottom: 12px;
}

.room-chat-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.room-more-menu-wrap {
  position: relative;
  margin-left: auto;
}

.room-more-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
}

.room-more-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 170px;
  padding: 8px;
  display: grid;
  gap: 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  z-index: 30;
}

.room-more-action {
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.room-more-action:hover {
  background: rgba(255, 255, 255, 0.06);
}

body[data-theme="light"] .room-more-action:hover {
  background: rgba(12, 20, 40, 0.06);
}

.pinned-info-bar {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  line-height: 1.6;
}

.chat-messages {
  display: grid;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
  margin-bottom: 12px;
}

.message-row {
  display: flex;
}

.incoming-row {
  justify-content: flex-start;
}

.outgoing-row {
  justify-content: flex-end;
}

.message-bubble {
  max-width: 82%;
  padding: 11px 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(10px);
}

.incoming-bubble {
  background: rgba(255, 255, 255, 0.035);
  border-top-left-radius: 8px;
}

.outgoing-bubble {
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.22), rgba(41, 196, 255, 0.18));
  border-top-right-radius: 8px;
}

.message-meta {
  justify-content: flex-start;
  gap: 8px;
  margin-bottom: 5px;
  font-size: 0.74rem;
  color: var(--muted);
  opacity: 0.9;
}

.message-bubble p {
  margin: 0;
  line-height: 1.5;
}

.typing-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  color: var(--muted);
}

.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--muted);
  opacity: 0.7;
}

.message-composer {
  padding-top: 10px;
  background: transparent;
}

.composer-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.composer-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
  overflow: visible;
}

.composer-options {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  opacity: 0.8;
}

.composer-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 4px 2px 0;
  overflow: visible;
}

.tool-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  transition: 0.2s ease;
}

.tool-btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.08);
}

.attachment-menu-wrap {
  position: relative;
}

.attachment-menu {
  position: absolute;
  right: 0;
  left: auto;
  bottom: calc(100% + 8px);
  min-width: 160px;
  padding: 8px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  display: none;
  z-index: 40;
}

.attachment-menu-wrap:hover .attachment-menu {
  display: grid;
  gap: 6px;
}

.attach-option {
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.composer-input-row input {
  flex: 1;
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0 12px;
  min-height: 40px;
}

.send-btn {
  min-height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  white-space: nowrap;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 8px 20px rgba(87, 107, 255, 0.22);
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
  opacity: 0.7;
}

.checkbox-row input {
  width: auto;
}


/* ===== RANDOM CHAT PAGE ===== */
.interest-tags {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 14px 0;
}

.interest-tag {
  padding: 8px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.random-action-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.random-top-actions,
.call-action-row {
  flex-wrap: nowrap;
}

.call-action-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.call-btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}


/* ===== PROFILE PAGE ===== */
.profile-avatar {
  width: 80px;
  height: 80px;
  margin: 0 auto 14px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 1.4rem;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
}

.profile-card {
  text-align: center;
}

.settings-block + .settings-block {
  margin-top: 20px;
}

.toggle-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.toggle-row:last-child {
  border-bottom: 0;
}

.toggle-row small {
  display: block;
  margin-top: 4px;
}

.switch {
  position: relative;
  width: 52px;
  height: 30px;
  display: inline-block;
}

.switch input {
  display: none;
}

.slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid var(--line);
}

.slider::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #fff;
  transition: 0.22s ease;
}

.switch input:checked + .slider {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
}

.switch input:checked + .slider::after {
  transform: translateX(22px);
}


/* ===== CONTENT PAGES ===== */
.content-card,
.contact-card {
  line-height: 1.7;
}


/* ===== MODALS ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(5, 8, 18, 0.6);
}

.modal-card {
  width: min(100%, 520px);
  padding: 18px;
}

.modal-head {
  margin-bottom: 12px;
}

.modal-head h2 {
  margin: 0;
}

.modal-body {
  margin-bottom: 14px;
}

.modal-actions {
  flex-wrap: wrap;
}


/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  height: var(--bottom-nav-h);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  padding: 4px 8px calc(4px + env(safe-area-inset-bottom));
  background: rgba(9, 14, 28, 0.92);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

body[data-theme="light"] .bottom-nav {
  background: rgba(255, 255, 255, 0.92);
}

.bottom-nav-link {
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--muted);
  min-height: 38px;
}

.bottom-nav-link.active {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
}


/* ===== UTILITIES ===== */
.mobile-only {
  display: inline-grid;
}

.mobile-back-btn {
  display: none;
  margin-right: 8px;
  font-size: 18px;
  background: none;
  border: none;
  cursor: pointer;
}


/* ===== AUTH ===== */
.auth-subtext {
  margin-top: -4px;
  margin-bottom: 14px;
}

.auth-status {
  display: none;
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  line-height: 1.5;
}

.auth-status.show {
  display: block;
}

.auth-status.success {
  border-color: rgba(30, 203, 139, 0.25);
  background: rgba(30, 203, 139, 0.12);
}

.auth-status.error {
  border-color: rgba(255, 95, 122, 0.28);
  background: rgba(255, 95, 122, 0.1);
}

.recaptcha-box {
  margin-top: 12px;
  min-height: 78px;
}


/* ===== RANDOM CHAT — FULLSCREEN SHELL ===== */
#randomChatPage {
  height: calc(100vh - var(--header-h) - var(--bottom-nav-h));
  min-height: calc(100vh - var(--header-h) - var(--bottom-nav-h));
  overflow: hidden;
}

#randomChatPage.active-page {
  display: flex;
  flex-direction: column;
}

.random-chat-shell {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 10px 12px 8px;
  box-sizing: border-box;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.random-chat-top {
  flex: 0 0 auto;
  align-items: flex-start;
  margin-bottom: 8px;
}

.random-top-actions {
  flex-wrap: nowrap;
}

#randomChatPage .chat-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  margin-bottom: 8px;
  padding-right: 4px;
}

#randomChatPage .message-composer {
  flex: 0 0 auto;
  padding-top: 6px;
}

#randomChatPage .chat-compact-controls {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

#randomChatPage .compact-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}

#randomChatPage .compact-left input {
  flex: 1 1 auto;
  min-width: 0;
}

#randomChatPage .safe-pill {
  white-space: nowrap;
}

#randomChatPage .compact-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

#randomChatPage .call-btn {
  white-space: nowrap;
}


/* ===== ROOMS PAGE — FULL LAYOUT SYSTEM ===== */
body.rooms-page-active {
  overflow: hidden !important;
}

body.rooms-page-active .app-main {
  width: 100% !important;
  max-width: none !important;
  height: calc(100vh - var(--header-h) - var(--bottom-nav-h)) !important;
  min-height: 0 !important;
  padding: 8px 14px 0 !important;
  overflow: hidden !important;
}

#roomsPage.active-page {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

#roomsPage.rooms-page-shell {
  min-height: 0 !important;
}

/* Room header */
#roomsPage .compact-room-header {
  display: grid !important;
  grid-template-columns: 250px minmax(0, 1fr) !important;
  align-items: center !important;
  gap: 10px !important;
  min-height: 46px !important;
  margin: 0 0 8px 0 !important;
  padding: 0 0 8px 0 !important;
  border-bottom: 1px solid var(--line) !important;
  flex: 0 0 auto !important;
}

#roomsPage .compact-room-header-left,
#roomsPage .compact-room-header-right {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  min-width: 0 !important;
}

#roomsPage .compact-room-header-right {
  justify-content: space-between !important;
  width: 100% !important;
}

#roomsPage .room-header-pill {
  margin: 0 !important;
}

/* Room title strip */
#roomsPage .top-strip-room-title {
  flex: 1 1 auto !important;
  min-width: 0 !important;
}

#roomsPage .top-strip-room-title .room-chat-title-main {
  min-width: 0 !important;
}

#roomsPage .top-strip-room-title h2 {
  margin: 0 !important;
  font-size: 1.9rem !important;
  line-height: 1 !important;
}

#roomsPage .top-strip-room-title p {
  margin: 4px 0 0 0 !important;
  line-height: 1.2 !important;
  white-space: nowrap !important;
}

#roomsPage .top-strip-room-title .card-title {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  margin: 0 !important;
}

#roomsPage .top-strip-room-title .muted-text {
  margin: 0 !important;
}

/* Room actions */
#roomsPage .top-strip-room-actions {
  display: none !important;
  flex: 0 0 auto !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 8px !important;
  flex-wrap: nowrap !important;
  margin-left: auto !important;
}

#roomsPage .top-strip-room-actions .small-btn,
#roomsPage .top-strip-room-actions .danger-btn {
  min-height: 36px !important;
  padding: 7px 12px !important;
  border-radius: 12px !important;
  font-size: 0.9rem !important;
}

#roomsPage .top-strip-room-actions .room-more-menu-wrap {
  position: relative !important;
  margin-left: 0 !important;
}

#roomsPage .inside-room-actions {
  position: static !important;
  top: auto !important;
  right: auto !important;
  margin: 0 !important;
}

#roomsPage .mobile-chat-header {
  display: none !important;
}

/* Layout grid */
#roomsPage .clean-rooms-layout,
#roomsPage .rooms-layout {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  display: grid !important;
  grid-template-columns: 270px minmax(0, 1fr) !important;
  gap: 12px !important;
  overflow: hidden !important;
  align-items: stretch !important;
}

#roomsPage .clean-room-sidebar,
#roomsPage .room-sidebar {
  min-height: 0 !important;
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  overflow: hidden !important;
  border-right: 1px solid var(--line) !important;
  padding: 0 12px 0 0 !important;
  background: transparent !important;
}

#roomsPage .clean-room-chat-panel,
#roomsPage .room-chat-panel {
  min-height: 0 !important;
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  background: transparent !important;
}

/* Room cards — flat / borderless in context */
#roomsPage .room-search-card,
#roomsPage .room-filter-card,
#roomsPage .room-list-card,
#roomsPage .active-room-card,
#roomsPage .room-empty-state,
#roomsPage .mobile-chat-header {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  backdrop-filter: none !important;
  padding: 0 !important;
}

#roomsPage .clean-room-search  { margin-bottom: 10px !important; }
#roomsPage .clean-room-filters { margin-bottom: 10px !important; }

#roomsPage .clean-room-list-head,
#roomsPage .room-list-head,
#roomsPage .mini-note,
#roomsPage .room-tag {
  display: none !important;
}

#roomsPage .room-list-card {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

#roomsPage .room-list {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  display: grid !important;
  gap: 8px !important;
  padding-right: 4px !important;
}

#roomsPage .filter-scroll {
  gap: 8px !important;
  padding-bottom: 2px !important;
}

#roomsPage .filter-chip {
  min-height: 34px !important;
  padding: 8px 12px !important;
  font-size: 0.9rem !important;
}

#roomsPage .room-item {
  padding: 10px 12px !important;
  border-radius: 16px !important;
}

#roomsPage .compact-room-item-top {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: center !important;
  gap: 8px !important;
}

#roomsPage .room-item-meta-inline {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
}

#roomsPage .online-pill,
#roomsPage .joined-pill,
#roomsPage .join-pill {
  min-height: 26px !important;
  padding: 5px 9px !important;
  font-size: 0.72rem !important;
}

#roomsPage .online-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  margin-right: 6px;
}

/* Active room card */
#roomsPage #activeRoomCard,
#roomsPage .clean-active-room-card,
#roomsPage .active-room-card {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  width: 100% !important;
}

#roomsPage .pinned-info-bar {
  margin: 0 0 8px 0 !important;
  padding: 10px 12px !important;
  border-radius: 12px !important;
  line-height: 1.4 !important;
  font-size: 0.95rem !important;
  flex: 0 0 auto !important;
}

/* Chat messages */
#roomsPage .chat-messages {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  margin: 0 0 6px 0 !important;
  padding: 6px 4px 2px 0 !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-end !important;
  gap: 8px !important;
}

#roomsPage .message-bubble {
  max-width: 78% !important;
  padding: 10px 12px !important;
  border-radius: 14px !important;
}

#roomsPage .message-meta {
  margin-bottom: 4px !important;
  font-size: 0.74rem !important;
}

#roomsPage .message-bubble p {
  margin: 0 !important;
  line-height: 1.45 !important;
  font-size: 0.96rem !important;
}

#roomsPage .typing-strip {
  flex: 0 0 auto !important;
  margin: 0 0 6px 0 !important;
  min-height: 16px !important;
  font-size: 0.84rem !important;
  gap: 5px !important;
}

/* Message composer */
#roomsPage .message-composer,
#roomsPage .compact-message-composer {
  flex: 0 0 auto !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
  padding: 6px 0 0 0 !important;
  margin: 0 !important;
  border-top: 1px solid var(--line) !important;
  background: transparent !important;
}

#roomsPage .composer-input-row,
#roomsPage .compact-composer-input-row {
  display: flex !important;
  align-items: center !important;
  width: 100% !important;
  gap: 8px !important;
  margin: 0 !important;
}

#roomsPage .composer-input-row input,
#roomsPage .compact-composer-input-row input {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  height: 38px !important;
  min-height: 38px !important;
  padding: 0 12px !important;
  border-radius: 12px !important;
  margin: 0 !important;
}

#roomsPage .composer-input-row .send-btn,
#roomsPage .compact-composer-input-row .send-btn,
#roomsPage .send-btn {
  flex: 0 0 auto !important;
  min-width: 84px !important;
  height: 38px !important;
  min-height: 38px !important;
  padding: 0 14px !important;
  border-radius: 12px !important;
  margin: 0 !important;
  align-self: center !important;
}

#roomsPage .composer-bottom-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
  min-height: 28px !important;
  margin-top: 6px !important;
}

#roomsPage .composer-tools,
#roomsPage .compact-composer-tools {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  margin-left: auto !important;
}

#roomsPage .composer-options,
#roomsPage .compact-composer-options {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  margin: 0 !important;
}

#roomsPage .tool-btn {
  width: 30px !important;
  height: 30px !important;
  min-width: 30px !important;
  min-height: 30px !important;
  border-radius: 9px !important;
  padding: 0 !important;
}

#roomsPage .checkbox-row {
  gap: 6px !important;
  font-size: 0.82rem !important;
  margin: 0 !important;
}

/* header visibility — selection vs chat mode */
body:not(.chat-active) #roomsPage .compact-room-header-right {
  display: none !important;
}

body.chat-active #roomsPage .compact-room-header-right {
  display: flex !important;
}

body.chat-active #roomsPage .top-strip-room-actions {
  display: flex !important;
}


/* ===== RESPONSIVE — MOBILE (<= 767px) ===== */
@media (max-width: 767px) {
  .random-chat-top {
    flex-direction: column;
    align-items: stretch;
  }

  .random-top-actions {
    width: 100%;
  }

  .random-top-actions .small-btn {
    flex: 1 1 0;
  }

  #randomChatPage .chat-compact-controls {
    flex-wrap: wrap;
    align-items: stretch;
  }

  #randomChatPage .compact-left,
  #randomChatPage .compact-right {
    width: 100%;
  }

  #randomChatPage .compact-right .call-btn {
    flex: 1 1 0;
  }
}


/* ===== RESPONSIVE — TABLET (>= 768px) ===== */
@media (min-width: 768px) {
  .app-main {
    padding: 16px 16px calc(var(--bottom-nav-h) + 16px);
  }

  .hero-card,
  .entry-card,
  .benefit-card,
  .auth-card,
  .side-info-card,
  .welcome-card,
  .updates-card,
  .room-search-card,
  .room-filter-card,
  .room-list-card,
  .active-room-card,
  .room-empty-state,
  .random-control-card,
  .profile-card,
  .settings-card,
  .content-card,
  .contact-card {
    padding: 22px;
  }

  .entry-cards-section,
  .benefit-grid,
  .home-links-section,
  .auth-layout,
  .profile-layout {
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-actions {
    grid-template-columns: repeat(4, 1fr);
  }

  .profile-layout {
    grid-template-columns: 320px 1fr;
    align-items: start;
  }
}


/* ===== RESPONSIVE — ROOMS MOBILE (<= 768px) ===== */
@media (max-width: 768px) {
  #activeRoomCard {
    position: relative;
    padding-top: 0;
  }

  .room-more-btn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 18px;
  }

  .room-chat-title-wrap,
  .mobile-chat-title {
    padding-right: 50px;
  }

  body.rooms-page-active {
    overflow: auto !important;
  }

  body.rooms-page-active .app-main {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    padding: 8px 8px calc(var(--bottom-nav-h) + 8px) !important;
  }

  #roomsPage.active-page {
    height: auto !important;
    overflow: visible !important;
  }

  #roomsPage .compact-room-header {
    grid-template-columns: 1fr !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  #roomsPage .compact-room-header-left {
    justify-content: flex-start !important;
  }

  #roomsPage .compact-room-header-right {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
    width: 100% !important;
    flex-wrap: nowrap !important;
  }

  #roomsPage .top-strip-room-title {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    padding-right: 0 !important;
  }

  #roomsPage .top-strip-room-title .card-title {
    font-size: 1.05rem !important;
    line-height: 1.15 !important;
  }

  #roomsPage .top-strip-room-title .muted-text {
    font-size: 0.9rem !important;
    line-height: 1.2 !important;
  }

  #roomsPage .top-strip-room-actions {
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
    flex: 0 0 auto !important;
    justify-content: flex-end !important;
    margin-left: auto !important;
  }

  /* room list mode */
  #roomsPage .clean-rooms-layout,
  #roomsPage .rooms-layout {
    grid-template-columns: 1fr !important;
    overflow: visible !important;
    display: block !important;
  }

  #roomsPage .room-sidebar,
  #roomsPage .clean-room-sidebar {
    display: flex !important;
    border-right: 0 !important;
    padding-right: 0 !important;
    margin-bottom: 14px !important;
    overflow: visible !important;
    height: auto !important;
  }

  #roomsPage .room-chat-panel,
  #roomsPage .clean-room-chat-panel {
    display: none !important;
  }

  /* chat mode */
  body.chat-active .app-main {
    padding-bottom: 0 !important;
  }

  body.chat-active #roomsPage.active-page {
    height: calc(100dvh - var(--header-h) - var(--bottom-nav-h) - 8px) !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  body.chat-active #roomsPage .room-sidebar,
  body.chat-active #roomsPage .clean-room-sidebar {
    display: none !important;
  }

  body.chat-active #roomsPage .room-chat-panel,
  body.chat-active #roomsPage .clean-room-chat-panel {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  body.chat-active #roomsPage .mobile-chat-header {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 0 0 10px 0 !important;
    flex: 0 0 auto !important;
  }

  body.chat-active #roomsPage .mobile-chat-title strong {
    display: block !important;
    font-size: 1rem !important;
    line-height: 1.15 !important;
  }

  body.chat-active #roomsPage .mobile-chat-title small {
    display: block !important;
    font-size: 0.84rem !important;
    line-height: 1.2 !important;
    color: var(--muted) !important;
  }

  body.chat-active #roomsPage .mobile-back-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
  }

  body.chat-active #roomsPage #activeRoomCard,
  body.chat-active #roomsPage .active-room-card,
  body.chat-active #roomsPage .clean-active-room-card {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: 100% !important;
    overflow: hidden !important;
  }

  body.chat-active #roomsPage .pinned-info-bar,
  body.chat-active #roomsPage .typing-strip,
  body.chat-active #roomsPage .message-composer,
  body.chat-active #roomsPage .compact-message-composer {
    flex: 0 0 auto !important;
  }

  body.chat-active #roomsPage .chat-messages {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    margin: 0 0 6px 0 !important;
    padding-right: 0 !important;
    padding-bottom: 4px !important;
  }

  body.chat-active #roomsPage .message-composer,
  body.chat-active #roomsPage .compact-message-composer {
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom)) 0 !important;
  }

  body:not(.chat-active) #roomsPage .compact-room-header-right {
    display: none !important;
  }

  body.chat-active #roomsPage .room-header-pill {
    display: none !important;
  }
}


/* ===== RESPONSIVE — DESKTOP (>= 1024px) ===== */
@media (min-width: 1024px) {
  .top-header {
    padding: 0 24px;
  }

  .app-main {
    padding: 18px 18px calc(var(--bottom-nav-h) + 18px);
  }

  .rooms-layout {
    grid-template-columns: 360px 1fr;
    align-items: start;
  }

  .mobile-chat-header {
    display: none;
  }

  .message-bubble {
    max-width: 72%;
  }

  .side-drawer {
    left: -320px;
    width: 300px;
  }
}

@media (min-width: 769px) {
  /* 1. Pure Header Container ko force display karein */
  body #roomsPage .compact-room-header .compact-room-header-right {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    flex: 1 1 auto !important;
  }

  /* 2. Actions wrapper ko visible karein */
  body #roomsPage .compact-room-header-right .top-strip-room-actions,
  body #roomsPage .compact-room-header-right .room-header-actions {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    margin-left: auto !important;
    pointer-events: auto !important;
  }

  /* 3. Button (⋮) - Wahi hierarchy, bas size balanced */
  body #roomsPage .room-more-btn, 
  body #roomsPage .room-header-actions .icon-btn {
    display: inline-grid !important;
    visibility: visible !important;
    opacity: 1 !important;
    color: var(--text) !important;
    font-size: 20px !important; /* Balanced size */
    cursor: pointer !important;
    z-index: 999 !important;
    min-width: 36px !important; /* Balanced width */
  }
}

/* ===== RESPONSIVE — LARGE DESKTOP (>= 1280px) ===== */
@media (min-width: 1280px) {
  .hero-card {
    padding: 32px;
  }

  .app-main {
    padding-left: 20px;
    padding-right: 20px;
  }
}
