[x-cloak] { display: none !important; }

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

/* 全域鍵盤聚焦樣式：:where() 維持 0 specificity，元件規則可覆蓋 */
:where(a, button, input, textarea, select, [tabindex]):focus-visible {
  outline: 2px solid var(--brand-2);
  outline-offset: 2px;
  border-radius: 6px;
}
html, body {
  min-height: 100%;
  background: var(--bg-main);
  scrollbar-gutter: stable;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-main);
  z-index: -1;
  pointer-events: none;
}

:root {
  --header-height: 56px;
  --layout-top-gap: 28px;
  --layout-padding-top: calc(var(--header-height) + var(--layout-top-gap));
  --bottom-safe-area: env(safe-area-inset-bottom, 0px);
  --mobile-nav-clearance: calc(96px + var(--bottom-safe-area));
  --palette-primary: #2563eb;
  --palette-primary-soft: #dbeafe;
  --palette-primary-strong: #1d4ed8;
  --palette-primary-rgb: 37, 99, 235;
  --palette-secondary: #0d9488;
  --palette-secondary-soft: #ccfbf1;
  --palette-secondary-strong: #0f766e;
  --palette-secondary-rgb: 13, 148, 136;
  --palette-accent: #f43f5e;
  --palette-accent-soft: #ffe4e6;
  --palette-accent-strong: #be123c;
  --palette-accent-rgb: 244, 63, 94;
  --bg-main: linear-gradient(135deg, #f8fafc 0%, #eef6ff 54%, #f0fdfa 100%);
  --bg-soft: rgba(255,255,255,0.76);
  --bg-card: rgba(255,255,255,0.88);
  --bg-card-2: #f8fafc;
  --line: rgba(var(--palette-primary-rgb), 0.14);
  --text-main: #0f172a;
  --text-soft: #475569;
  --text-muted: #64748b;
  --brand-1: var(--palette-secondary);
  --brand-2: var(--palette-primary);
  --brand-3: var(--palette-primary-strong);
  --accent: var(--palette-accent);
  --accent-soft: var(--palette-accent-soft);
  --accent-strong: var(--palette-accent-strong);
  --pill: color-mix(in srgb, var(--palette-primary-soft) 62%, white 38%);
  --shadow: 0 16px 36px rgba(var(--palette-primary-rgb), 0.1);
  --hero: linear-gradient(135deg, var(--palette-secondary) 0%, var(--palette-primary) 68%, var(--palette-primary-strong) 100%);
  --accent-glow: 0 0 0 1px rgba(255,255,255,0.25) inset;
  --modal-scrollbar-offset: 0px;
  --toast-bg: rgba(248, 250, 252, 0.94);
  --toast-border: rgba(var(--palette-primary-rgb), 0.14);
  --toast-shadow: 0 12px 28px rgba(var(--palette-primary-rgb), 0.12);
  --toast-text: #0f172a;
  --toast-muted: #64748b;
  --toast-close-hover: rgba(var(--palette-primary-rgb), 0.08);
  --toast-success: #059669;
  --toast-error: #dc2626;
  --toast-warning: #d97706;
  --toast-info: var(--palette-primary);
}

html.dark {
  --palette-primary: #60a5fa;
  --palette-primary-soft: #1e3a8a;
  --palette-primary-strong: #93c5fd;
  --palette-primary-rgb: 96, 165, 250;
  --palette-secondary: #2dd4bf;
  --palette-secondary-soft: #134e4a;
  --palette-secondary-strong: #5eead4;
  --palette-secondary-rgb: 45, 212, 191;
  --palette-accent: #fb7185;
  --palette-accent-soft: #881337;
  --palette-accent-strong: #fda4af;
  --palette-accent-rgb: 251, 113, 133;
  --bg-main: linear-gradient(135deg, #020617 0%, #0b1220 48%, #102a2a 100%);
  --bg-soft: rgba(15,23,42,0.78);
  --bg-card: rgba(15,23,42,0.86);
  --bg-card-2: rgba(30,41,59,0.72);
  --line: rgba(var(--palette-primary-rgb), 0.18);
  --text-main: #f8fafc;
  --text-soft: #cbd5e1;
  --text-muted: #94a3b8;
  --brand-1: var(--palette-secondary);
  --brand-2: var(--palette-primary);
  --brand-3: var(--palette-primary-strong);
  --accent: var(--palette-accent);
  --accent-soft: var(--palette-accent-soft);
  --accent-strong: var(--palette-accent-strong);
  --pill: rgba(30, 58, 138, 0.44);
  --shadow: 0 18px 42px rgba(2, 8, 23, 0.45);
  --hero: linear-gradient(135deg, var(--palette-secondary) 0%, var(--palette-primary) 64%, #2563eb 100%);
  --accent-glow: 0 0 0 1px rgba(255,255,255,0.05) inset;
  --toast-bg: rgba(2, 8, 23, 0.92);
  --toast-border: rgba(var(--palette-primary-rgb), 0.18);
  --toast-shadow: 0 14px 30px rgba(2, 8, 23, 0.42);
  --toast-text: #f8fafc;
  --toast-muted: #cbd5e1;
  --toast-close-hover: rgba(255, 255, 255, 0.08);
  --toast-success: #34d399;
  --toast-error: #f87171;
  --toast-warning: #fbbf24;
  --toast-info: var(--palette-primary);
}


body {
  font-family: Arial, "Noto Sans TC", sans-serif;
  background: var(--bg-main);
  color: var(--text-main);
  min-height: 100%;
  overflow-x: hidden; /* 橫向溢位只擋在 body:html 不可加,否則手機觸控/滾輪捲動會失效 */
}

html, body {
  scroll-padding-top: calc(var(--header-height) + 18px);
}

body.pull-refresh-dragging {
  user-select: none;
  -webkit-user-select: none;
  cursor: ns-resize;
}

@keyframes pull-refresh-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: var(--modal-scrollbar-offset);
  z-index: 10;
  background: linear-gradient(180deg, rgba(255,255,255,0.68) 0%, color-mix(in srgb, var(--palette-primary-soft) 42%, transparent) 100%);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 9px 24px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.55), 0 6px 24px rgba(var(--palette-primary-rgb),0.08);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}
html.dark .topbar {
  background: linear-gradient(180deg, rgba(30,41,59,0.72) 0%, rgba(15,23,42,0.54) 100%);
  border-bottom-color: var(--line);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 6px 24px rgba(0,0,0,0.32);
}
.topbar.hidden {
  transform: translateY(-100%);
  opacity: 0;
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-copy {
  display: grid;
  gap: 0;
  min-width: 0;
}
.brand a {
  text-decoration: none;
  display: block;
  cursor: pointer;
  position: relative;
  z-index: 1;
}
.brand a:hover .logo-banner {
  transform: translateY(-2px);
  box-shadow: 0 18px 36px rgba(var(--palette-primary-rgb),0.24);
}
.brand a:active .logo-banner {
  transform: translateY(0);
}
.logo {
  width: 48px; height: 48px; border-radius: 16px;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  color: white; display: flex; align-items: center; justify-content: center;
  font-weight: bold; font-size: 18px;
  box-shadow: 0 12px 24px rgba(var(--palette-primary-rgb),0.18);
}
.brand h1 { font-size: 22px; color: var(--text-main); }
.brand p { font-size: 13px; color: var(--text-muted); }

.search { flex: 1 1 320px; max-width: 520px; margin: 0 20px; min-width: 180px; }
.search-shell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 0 12px 0 14px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--line) 84%, rgba(255, 255, 255, 0.16));
  background: color-mix(in srgb, var(--bg-card-2) 86%, rgba(255, 255, 255, 0.36));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.search-shell:focus-within {
  border-color: color-mix(in srgb, var(--brand-2) 48%, var(--line));
  background: color-mix(in srgb, var(--bg-card) 90%, rgba(255, 255, 255, 0.44));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-1) 10%, transparent);
}
.search-icon {
  flex-shrink: 0;
  color: var(--brand-2);
  font-size: 14px;
}
.search input {
  width: 100%;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text-main);
  padding: 0;
  font-size: 14px;
  outline: none;
}
.search input::placeholder {
  color: var(--text-muted);
}
.search-context-label {
  flex-shrink: 0;
  padding: 5px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--brand-1) 10%, transparent);
  color: var(--brand-3);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-topics .topbar .search[hidden] {
  display: none !important;
}

/* === Topbar 頁面工具列：各頁控制列塞進頂列、取代搜尋框 === */
.topbar-tools {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  /* 內容溢出時兩端淡出，暗示可橫向捲動 */
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
}
.topbar-tools::-webkit-scrollbar { display: none; }

/* 平板/小筆電：只有房間（tabs+搜尋+排序+創建鈕最擠）落到整寬第二列；
   話題/聊天第一排很空、單排即可，不浪費垂直空間 */
@media (max-width: 1279px) {
  body.page-rooms .topbar { flex-wrap: wrap; row-gap: 10px; }
  body.page-rooms .topbar .topbar-tools { order: 10; flex-basis: 100%; width: 100%; }
}

/* --- 房間：橫向流，排序靠右 --- */
.topbar-tools .room-tabs-layout {
  display: flex; align-items: center; gap: 12px; width: 100%;
}
.topbar-tools .room-tabs {
  flex: 0 1 auto;
  display: flex; align-items: center; gap: 6px;
  min-width: 0; overflow-x: auto; scrollbar-width: none;
}
.topbar-tools .room-tabs::-webkit-scrollbar { display: none; }
.topbar-tools .room-tab-item {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--line) 84%, rgba(255,255,255,0.16));
  background: color-mix(in srgb, var(--bg-card-2) 86%, rgba(255,255,255,0.3));
  color: var(--text-soft); font-size: 13px; font-weight: 600;
  white-space: nowrap; cursor: pointer;
  transition: color .18s ease, background .18s ease, border-color .18s ease;
}
.topbar-tools .room-tab-item:hover {
  color: var(--brand-2);
  border-color: color-mix(in srgb, var(--brand-2) 40%, var(--line));
}
.topbar-tools .room-tab-item.active {
  background: linear-gradient(135deg, var(--brand-1), var(--brand-3));
  border-color: transparent; color: #fff;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--brand-2) 35%, transparent);
}
.topbar-tools .room-tab-item i { font-size: 13px; }
/* 只顯示圖示，僅 active 展開文字（標籤 sr-only 保留無障礙）；大幅縮短整列 */
.topbar-tools .room-tab-item span {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.topbar-tools .room-tab-item.active span {
  position: static; width: auto; height: auto; margin: 0; clip: auto; overflow: visible;
}
.topbar-tools .room-sort-wrapper {
  flex-shrink: 0; display: flex; align-items: center; gap: 6px;
  padding: 4px 6px 4px 12px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--line) 84%, rgba(255,255,255,0.16));
  background: color-mix(in srgb, var(--bg-card-2) 86%, rgba(255,255,255,0.3));
}
.topbar-tools .room-sort-label { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.topbar-tools .room-sort-select { min-width: 84px; font-size: 12px; padding: 4px 24px 4px 6px; }
/* 房間搜尋（取代原 topbar 搜尋框，由 rooms.twig 綁定 #roomSearch 過濾） */
.topbar-tools .room-topbar-search {
  flex-shrink: 0; display: flex; align-items: center; gap: 6px;
  min-width: 130px; max-width: 200px;
  padding: 5px 12px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--line) 84%, rgba(255,255,255,0.16));
  background: color-mix(in srgb, var(--bg-card-2) 86%, rgba(255,255,255,0.3));
}
.topbar-tools .room-topbar-search i { color: var(--brand-2); font-size: 12px; flex-shrink: 0; }
.topbar-tools .room-topbar-search input {
  width: 100%; min-width: 0; border: 0; background: transparent; outline: none;
  font-size: 13px; color: var(--text-main);
}
.topbar-tools .room-topbar-search input::placeholder { color: var(--text-muted); }

/* --- 話題 tabs：沿用既有膠囊樣式，縮 padding 不換行 --- */
.topbar-tools .topic-tabs { gap: 6px; flex-wrap: nowrap; }
.topbar-tools .topic-tabs .tab-item { padding: 6px 14px; font-size: 13px; }

/* --- 聊天工具 --- */
.topbar-tools .chat-topbar-tools {
  display: flex; align-items: center; gap: 12px; width: 100%;
}
.topbar-tools .chat-topbar-title {
  margin: 0; font-size: 15px; font-weight: 700; color: var(--text-main); white-space: nowrap;
}
.topbar-tools .chat-header-actions { display: flex; gap: 8px; margin-left: auto; flex-wrap: nowrap; }
.topbar-tools .sticker-store-btn,
.topbar-tools .chat-primary-action-btn {
  padding: 7px 14px; font-size: 13px; white-space: nowrap; flex-shrink: 0;
}

.top-actions .user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  background: transparent;
}

.top-actions .user-info span {
  color: var(--text-soft);
  font-weight: 600;
  font-size: 14px;
}

.top-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.top-actions {
  position: relative;
  z-index: 12;
}
.icon-btn, .primary-btn, .mode-btn, .follow-btn, .more {
  border: none; border-radius: 16px; cursor: pointer; text-decoration: none;
  transition: transform 0.18s ease;
}
.icon-btn:hover, .primary-btn:hover, .mode-btn:hover, .follow-btn:hover, .more:hover { transform: translateY(-1px); }

.icon-btn {
  width: 42px; height: 42px; background: var(--pill); color: var(--brand-3);
  font-size: 18px; display: inline-flex; align-items: center; justify-content: center;
}
.primary-btn {
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  color: white; padding: 11px 16px; box-shadow: 0 12px 24px rgba(var(--palette-primary-rgb),0.18);
  display: inline-flex; align-items: center; justify-content: center;
}
.mode-btn {
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  padding: 0;
  border-radius: 13px;
  border: 1px solid color-mix(in srgb, var(--brand-2) 14%, var(--line));
  background: color-mix(in srgb, var(--bg-card) 88%, white 12%);
  color: var(--text-main);
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.32);
  overflow: hidden;
  position: relative;
  z-index: 1;
  touch-action: manipulation;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.mode-btn:hover {
  border-color: color-mix(in srgb, var(--brand-2) 40%, var(--line));
  background: color-mix(in srgb, var(--brand-1) 8%, var(--bg-card));
  box-shadow:
    0 0 0 4px color-mix(in srgb, var(--brand-1) 10%, transparent),
    inset 0 1px 0 rgba(255,255,255,0.34);
}
.mode-btn:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand-2) 28%, transparent);
  outline-offset: 2px;
}
.mode-btn-frame {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--brand-2) 10%, transparent);
  color: var(--brand-3);
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
}
.mode-btn-icon {
  display: inline-flex;
  font-size: 16px;
  line-height: 1;
}
.mode-btn:hover .mode-btn-frame {
  transform: rotate(-8deg) scale(1.04);
}
html.dark .mode-btn {
  background: color-mix(in srgb, var(--bg-card) 86%, #020617 14%);
  border-color: color-mix(in srgb, var(--brand-2) 22%, var(--line));
}
html.dark .mode-btn-frame {
  background: color-mix(in srgb, var(--brand-2) 16%, transparent);
  color: color-mix(in srgb, var(--brand-2) 86%, white 14%);
}
.topbar .avatar { width: 38px; height: 38px; border-radius: 11px; }
.topbar-compose-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  gap: 8px;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid color-mix(in srgb, var(--brand-2) 18%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-card) 92%, white 8%);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.26);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.topbar-compose-btn[hidden] {
  display: none !important;
}
.topbar-compose-btn i {
  color: var(--brand-2);
  font-size: 12px;
}
.topbar-compose-btn:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--brand-2) 30%, var(--line));
  background: color-mix(in srgb, var(--brand-1) 8%, var(--bg-card));
}

.layout {
  --layout-shell-max: 1520px;
  --layout-gutter: 22px;
  --layout-gap: 22px;
  --layout-left-width: clamp(220px, 15vw, 250px);
  --layout-main-width: minmax(0, 900px);
  --layout-right-width: clamp(280px, 18vw, 320px);
  max-width: var(--layout-shell-max); margin: 0 auto; padding: var(--layout-padding-top) var(--layout-gutter) 24px; display: grid;
  grid-template-columns: var(--layout-left-width) var(--layout-main-width) var(--layout-right-width);
  grid-template-areas: "sidebar feed rightbar";
  justify-content: center; gap: var(--layout-gap); align-items: start;
}

.topic-focus-layout {
  --layout-shell-max: 1520px;
  --layout-main-width: minmax(0, 1fr);
  max-width: var(--layout-shell-max);
  grid-template-columns: var(--layout-left-width) var(--layout-main-width);
  grid-template-areas: "sidebar feed";
}

.layout > .desktop-sidebar { grid-area: sidebar; min-width: 0; }
.layout > #main-content { grid-area: feed; min-width: 0; }
.layout > .rightbar { grid-area: rightbar; min-width: 0; }

.panel {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  position: relative;
  overflow: visible;
}

.post, .composer {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
html.dark .post, html.dark .composer {
  background: var(--bg-card);
}

.desktop-sidebar, .composer, .post, .rightbar { padding: 22px; }
.desktop-sidebar { position: sticky; top: calc(var(--header-height) + 24px); height: fit-content; }
.desktop-menu { display: flex; flex-direction: column; gap: 10px; }
.desktop-menu a {
  display: flex; align-items: center; gap: 12px; text-decoration: none;
  color: var(--text-soft); background: var(--pill); border: 1px solid var(--line);
  padding: 14px 16px; border-radius: 18px; font-weight: 600;
}
.desktop-menu a.active { background: var(--hero); color: white; }
.desktop-profile {
  margin-top: 18px; padding: 18px; border-radius: 22px;
  background: linear-gradient(135deg, rgba(34,211,238,0.14), rgba(59,130,246,0.10));
  border: 1px solid var(--line); color: var(--text-soft); line-height: 1.8;
}

.feed { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

@media (min-width: 1280px) {
  .desktop-sidebar {
    position: fixed;
    top: calc(var(--header-height) + 24px);
    left: max(var(--layout-gutter), calc((100vw - var(--layout-shell-max)) / 2 + var(--layout-gutter)));
    width: var(--layout-left-width);
    max-height: calc(100svh - var(--header-height) - 48px);
    overflow-y: auto;
    z-index: 24;
    scrollbar-width: none;
  }

  .desktop-sidebar::-webkit-scrollbar {
    display: none;
  }

  body.page-topics .layout {
    --layout-shell-max: 1520px;
    --layout-main-width: minmax(0, 900px);
    max-width: var(--layout-shell-max);
    grid-template-columns: var(--layout-left-width) var(--layout-main-width) var(--layout-right-width);
  }

  body.page-topics.topic-focus-page .layout {
    --layout-shell-max: 1520px;
    --layout-main-width: minmax(0, 1fr);
    max-width: var(--layout-shell-max);
    grid-template-columns: var(--layout-left-width) var(--layout-main-width);
  }
}

#main-content {
    opacity: 1;
    transition: opacity 0.2s ease-in-out;
}

#main-content.htmx-swapping,
#main-content.is-navigating {
    position: relative;
    min-height: 200px;
}

.is-navigating::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-card);
    opacity: 0.7;
    z-index: 5;
    pointer-events: none;
}

@keyframes skeleton-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

.is-navigating::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid var(--line);
    border-top-color: var(--brand-1);
    border-radius: 50%;
    animation: pull-refresh-spin 0.8s linear infinite;
    z-index: 6;
}

.is-navigating {
    opacity: 0.98;
    pointer-events: none;
}

.ocean-banner {
  margin-bottom: 18px; padding: 30px 22px; border-radius: 26px;
  background: var(--hero); color: white; box-shadow: 0 14px 30px rgba(var(--palette-primary-rgb),0.16);
  position: relative; overflow: hidden; text-align: center;
}
.ocean-banner .close-icon {
  position: absolute; top: 10px; left: 10px; cursor: pointer; opacity: 0.7; transition: opacity 0.2s; z-index: 2;
}
body.bottom-sheet-open .ocean-banner .close-icon { display: none; }
body.bottom-sheet-open .bottom-bar { display: none !important; }
body.bottom-sheet-open .menu-dropdown { display: none !important; }
.ocean-banner .close-icon:hover { opacity: 1; }
.ocean-banner::before, .ocean-banner::after {
  content: ""; position: absolute; border-radius: 50%; background: rgba(255,255,255,0.14);
}
.ocean-banner::before { width: 180px; height: 180px; top: -80px; right: -40px; }
.ocean-banner::after { width: 120px; height: 120px; bottom: -40px; left: -30px; }
.ocean-banner .expand-icon {
  position: absolute; top: 10px; right: 10px; cursor: pointer;
  opacity: 0.7; transition: opacity 0.2s; z-index: 2;
}
.ocean-banner .expand-icon:hover { opacity: 1; }
.ocean-banner h2 { font-size: 24px; margin-bottom: 8px; }
.ocean-banner p { opacity: 0.92; line-height: 1.8; font-size: 14px; }

.ocean-guide-modal {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--hero); color: white;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s;
}
.ocean-guide-modal.active { opacity: 1; visibility: visible; }
.ocean-guide-close {
  position: absolute; top: 20px; right: 20px; cursor: pointer;
  font-size: 24px; opacity: 0.7; transition: opacity 0.2s;
}
.ocean-guide-close:hover { opacity: 1; }
.ocean-guide-modal-content { text-align: center; padding: 40px; max-width: 800px; width: 100%; }
.ocean-guide-modal-content h1 { font-size: 32px; margin-bottom: 16px; }
.ocean-guide-modal-content > p { opacity: 0.9; margin-bottom: 40px; font-size: 16px; }
.ocean-guide-steps { display: flex; gap: 30px; justify-content: center; flex-wrap: wrap; }
.guide-step { flex: 1; min-width: 200px; max-width: 250px; padding: 24px; background: rgba(255,255,255,0.1); border-radius: 16px; }
.step-icon { font-size: 40px; margin-bottom: 16px; }
.guide-step h3 { font-size: 18px; margin-bottom: 8px; }
.guide-step p { opacity: 0.85; font-size: 14px; }

.composer-top { display: flex; gap: 14px; align-items: flex-start; }
.avatar, .tiny-avatar {
  background: linear-gradient(135deg, rgba(34,211,238,0.28), rgba(96,165,250,0.34));
  color: var(--brand-3); display: flex; align-items: center; justify-content: center;
  font-weight: bold; flex-shrink: 0;
}
.avatar { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; }
.avatar-initial {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(34,211,238,0.28), rgba(96,165,250,0.34));
  color: var(--brand-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 18px;
}
.tiny-avatar { width: 28px; height: 28px; border-radius: 8px; }

.composer textarea {
  width: 100%; min-height: 110px; border: 1px solid var(--line); border-radius: 22px;
  resize: none; padding: 16px; font-size: 14px; outline: none;
  background: var(--bg-card-2); color: var(--text-main);
}
.composer-actions {
  margin-top: 14px; display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap;
}
.tag-row, .post-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.tag, .chip {
  background: var(--pill); color: var(--brand-3); padding: 9px 14px; border-radius: 999px;
  font-size: 13px; border: 1px solid var(--line);
}

.post-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px;
}
.user { display: flex; gap: 12px; align-items: center; }
.user-info h3 { font-size: 16px; color: var(--text-main); }
.user-info p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.more {
  width: 40px; height: 40px; background: var(--pill); color: var(--brand-3);
  display: inline-flex; align-items: center; justify-content: center;
}
.post-text {
  line-height: 1.9;
  color: var(--text-soft);
  font-size: 14px;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.post-image {
  margin-top: 16px; height: 240px; border-radius: 24px;
  background: radial-gradient(circle at top left, rgba(255,255,255,0.35), transparent 28%),
              radial-gradient(circle at 80% 20%, rgba(255,255,255,0.25), transparent 22%),
              var(--hero);
  display: flex; align-items: center; justify-content: center; color: white;
  font-size: 24px; font-weight: bold; letter-spacing: 1px; position: relative; overflow: hidden;
}
.post-card .post-image,
.topic-post-card .post-image {
  width: 100%;
  max-width: 520px;
  aspect-ratio: 1 / 1;
  height: auto;
  max-height: none;
  margin: 16px auto 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: 0;
}
.post-card .post-image img,
.post-card .post-image video,
.topic-post-card .post-image img,
.topic-post-card .post-image video {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 24px;
  object-fit: contain;
}
.post-card .post-image video,
.topic-post-card .post-image video {
  background: #000;
}
.post-media-grid {
  width: 100%;
  max-width: 620px;
  margin: 16px auto 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.bubble-media-grid {
  margin-bottom: 16px;
}
.post-media-item {
  aspect-ratio: 1 / 1;
  border-radius: 20px;
  overflow: hidden;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.post-media-item img,
.post-media-item video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}
@media (max-width: 639px) {
  .post-card .post-image,
  .topic-post-card .post-image {
    width: 100%;
    border-radius: 16px;
  }

  .post-card .post-image img,
  .post-card .post-image video,
  .topic-post-card .post-image img,
  .topic-post-card .post-image video {
    border-radius: 16px;
  }

  .post-media-grid {
    gap: 6px;
  }

  .post-media-item {
    border-radius: 14px;
  }
}
.post-footer {
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px; color: var(--text-muted); font-size: 13px;
}

.rightbar {
  position: sticky;
  top: calc(var(--header-height) + 24px);
  border: 0;
  border-radius: 28px;
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--brand-1) 12%, transparent) 0%, transparent 38%),
    linear-gradient(180deg, color-mix(in srgb, var(--bg-card) 95%, white 5%) 0%, color-mix(in srgb, var(--bg-card-2) 92%, rgba(255, 255, 255, 0.34)) 100%);
  box-shadow: none;
  overflow: hidden;
}
.rightbar::before {
  display: none;
}
html.dark .rightbar {
  background:
    radial-gradient(circle at top right, rgba(8, 145, 178, 0.16) 0%, transparent 40%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.92) 0%, rgba(30, 41, 59, 0.9) 100%);
  box-shadow: none;
}
.rightbar > * {
  position: relative;
  z-index: 1;
}
.rightbar-drawer-head,
.rightbar-drawer-tab,
.rightbar-drawer-overlay {
  display: none;
}
.rightbar-drawer-head-copy {
  display: grid;
  gap: 4px;
}
.rightbar-drawer-head-copy small {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand-2);
}
.rightbar-drawer-head-copy strong {
  color: var(--text-main);
  font-size: 16px;
  line-height: 1.35;
}
.rightbar-drawer-close {
  width: 38px;
  height: 38px;
  border: 1px solid color-mix(in srgb, var(--brand-2) 14%, var(--line));
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg-card) 88%, white 12%);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.rightbar-drawer-close:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--brand-2) 24%, var(--line));
  background: color-mix(in srgb, var(--brand-1) 10%, var(--bg-card));
}
.rightbar-drawer-tab-copy {
  display: grid;
  gap: 2px;
}
.rightbar-drawer-tab-copy small {
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.72;
}
.rightbar-drawer-tab-copy strong {
  font-size: 13px;
  line-height: 1;
}
.rightbar-mobile-shell { display: none; }
.rightbar-mobile-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.rightbar-mobile-intro small {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-2);
}
.rightbar-mobile-intro strong {
  display: block;
  color: var(--text-main);
  font-size: 16px;
  line-height: 1.45;
}
.rightbar-mobile-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.rightbar-mobile-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--pill);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
}
.rightbar-mobile-feature,
.rightbar-mobile-section {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid color-mix(in srgb, var(--brand-1) 12%, var(--line));
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg-card) 92%, white 8%), var(--bg-card));
}
.rightbar-mobile-feature .section-title,
.rightbar-mobile-section .section-title {
  margin-bottom: 12px;
}
.rightbar-mobile-section + .rightbar-mobile-section {
  margin-top: 12px;
}
.rightbar-mobile-empty {
  display: grid;
  gap: 6px;
  color: var(--text-soft);
}
.rightbar-mobile-empty strong {
  color: var(--text-main);
}
.rightbar-mobile-toggle {
  width: 100%;
  margin-top: 12px;
  border: 1px solid var(--line);
  background: var(--bg-card-2);
  color: var(--text-main);
  border-radius: 18px;
  padding: 12px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.rightbar-mobile-toggle i {
  color: var(--brand-2);
  transition: transform 0.2s ease;
}
.rightbar-mobile-toggle[aria-expanded="true"] i {
  transform: rotate(180deg);
}
.rightbar-mobile-toggle-label-expanded {
  display: none;
}
.rightbar-mobile-toggle[aria-expanded="true"] .rightbar-mobile-toggle-label-collapsed {
  display: none;
}
.rightbar-mobile-toggle[aria-expanded="true"] .rightbar-mobile-toggle-label-expanded {
  display: inline;
}
.rightbar-mobile-extra {
  margin-top: 12px;
}
.rightbar-mobile-extra[data-collapsed="true"] {
  display: none;
}
.rightbar-mobile-inline-info {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.rightbar-note-card {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid color-mix(in srgb, var(--brand-2) 14%, var(--line));
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg-card) 90%, white 10%), color-mix(in srgb, var(--bg-card-2) 88%, white 12%));
}
.rightbar-note-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--line) 88%, var(--brand-2) 12%);
  background: color-mix(in srgb, var(--pill) 78%, transparent);
  color: var(--brand-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.rightbar-note-icon i {
  font-size: 13px;
}
.rightbar-note-icon-sm {
  width: 28px;
  height: 28px;
  border-radius: 9px;
}
.rightbar-note-icon-sm i {
  font-size: 12px;
}
.rightbar-note-copy {
  min-width: 0;
  color: var(--text-soft);
  line-height: 1.6;
}
.rightbar-note-copy strong {
  color: var(--text-main);
}
.rightbar-mobile-tip-card {
  display: grid;
  gap: 10px;
}
.rightbar-mobile-tip-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}
.rightbar-mobile-tip-heading strong {
  color: var(--text-main);
  font-size: 15px;
}
.rightbar-avatar-badge,
.rightbar-online-badge,
.rightbar-recent-avatar,
.rightbar-desktop-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--line) 88%, var(--brand-2) 12%);
}
.rightbar-avatar-badge,
.rightbar-online-badge,
.rightbar-recent-avatar {
  background: color-mix(in srgb, var(--pill) 82%, rgba(255, 255, 255, 0.18));
  color: var(--brand-3);
}
.rightbar-desktop-avatar {
  object-fit: cover;
}
.home-discovery-panel {
  padding: 0;
  position: relative;
  overflow: hidden;
  border-color: color-mix(in srgb, var(--brand-2) 16%, var(--line));
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--brand-1) 16%, transparent) 0%, transparent 34%),
    linear-gradient(180deg, color-mix(in srgb, var(--bg-card) 92%, white 8%), var(--bg-card));
}
.home-discovery-panel::after {
  content: '';
  position: absolute;
  inset: auto -8% -18% auto;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--brand-1) 14%, transparent) 0%, transparent 72%);
  pointer-events: none;
}
.home-discovery-shell {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 22px;
  padding: 22px;
}
.home-discovery-header {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) auto;
  gap: 18px 22px;
  align-items: start;
}
.home-discovery-copy {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.home-discovery-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brand-3);
}
.home-discovery-kicker::before {
  content: '';
  width: 18px;
  height: 1px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.48;
}
.home-discovery-copy h2 {
  margin: 0;
  max-width: 13ch;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.02;
  letter-spacing: -0.04em;
  color: var(--text-main);
}
.home-discovery-copy p {
  margin: 0;
  max-width: 46ch;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.7;
}
.home-discovery-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}
.home-discovery-login {
  min-height: 44px;
}
.home-discovery-meta {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.home-discovery-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--pill) 88%, white 12%);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}
.home-discovery-body {
  display: grid;
  grid-template-columns: minmax(280px, 0.92fr) minmax(0, 1.08fr);
  gap: 18px;
  align-items: start;
}
.home-discovery-hero {
  display: grid;
  gap: 12px;
  align-content: start;
  min-height: 100%;
  padding: 18px;
  border-radius: 28px;
  border: 1px solid color-mix(in srgb, var(--brand-2) 18%, var(--line));
  background:
    linear-gradient(160deg, color-mix(in srgb, white 78%, var(--brand-1) 8%), color-mix(in srgb, var(--bg-card) 86%, var(--brand-2) 10%));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42);
  color: inherit;
  text-decoration: none;
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.home-discovery-hero:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--brand-2) 28%, var(--line));
}
html.dark .home-discovery-hero {
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--bg-card) 90%, rgba(var(--palette-secondary-rgb), 0.2) 10%), color-mix(in srgb, var(--bg-card) 92%, rgba(var(--palette-primary-rgb), 0.16) 8%));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.home-discovery-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.home-discovery-hero-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand-3);
}
.home-discovery-hero-meta {
  color: var(--text-muted);
  font-size: 12px;
}
.home-discovery-hero strong {
  color: var(--text-main);
  font-size: 24px;
  line-height: 1.1;
  letter-spacing: -0.03em;
}
.home-discovery-hero.is-topic strong::before {
  content: '#';
  margin-right: 4px;
}
.home-discovery-hero p {
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.7;
}
.home-discovery-hero-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 600;
}
.home-discovery-hero-link i {
  font-size: 12px;
  color: var(--brand-2);
}
.home-discovery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}
.home-discovery-section {
  display: grid;
  gap: 10px;
  min-width: 0;
}
.home-discovery-section-bulletin {
  grid-column: 1 / -1;
}
.home-discovery-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}
.home-discovery-section-head h3 {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.home-discovery-section-link {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}
.home-discovery-bulletin {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0 0;
  border-top: 1px solid color-mix(in srgb, var(--line) 84%, transparent);
}
.home-discovery-bulletin-label {
  flex-shrink: 0;
  margin-top: 1px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand-3);
  background: color-mix(in srgb, var(--brand-1) 12%, transparent);
}
.home-discovery-bulletin p {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.home-discovery-bulletin strong {
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.45;
}
.home-discovery-bulletin p span {
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.6;
}
.home-discovery-list {
  display: grid;
  gap: 0;
}
.home-discovery-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  text-decoration: none;
  color: inherit;
  border-top: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
}
.home-discovery-row-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}
.home-discovery-row-main strong {
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.44;
}
.home-discovery-row-main small {
  color: var(--text-muted);
  font-size: 12px;
}
.home-discovery-grid .home-discovery-bulletin p > strong,
.home-discovery-grid .home-discovery-bulletin p > span,
.home-discovery-grid .home-discovery-row-main > strong,
.home-discovery-grid .home-discovery-row-main > small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.home-discovery-row.is-topic .home-discovery-row-main small::before {
  content: '#';
  margin-right: 2px;
}
.home-discovery-row:hover .home-discovery-row-main strong {
  color: var(--brand-3);
}
.home-discovery-row-meta {
  flex-shrink: 0;
  padding-top: 2px;
  color: var(--text-muted);
  font-size: 12px;
}
.home-discovery-room-badge {
  width: fit-content;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1.2;
  text-transform: uppercase;
}
.home-discovery-room-badge.live {
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.12);
}
.home-discovery-room-badge.voice {
  color: #b45309;
  background: rgba(245, 158, 11, 0.14);
}
.home-discovery-room-badge.text {
  color: #0f766e;
  background: rgba(13, 148, 136, 0.14);
}
html.dark .home-discovery-room-badge.live {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.2);
}
html.dark .home-discovery-room-badge.voice {
  color: #fde68a;
  background: rgba(245, 158, 11, 0.18);
}
html.dark .home-discovery-room-badge.text {
  color: #99f6e4;
  background: rgba(13, 148, 136, 0.2);
}
.home-discovery-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 18px;
  padding-top: 16px;
  border-top: 1px solid color-mix(in srgb, var(--line) 84%, transparent);
}
.home-discovery-footer p {
  margin: 0;
  max-width: 52ch;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.6;
}
.home-discovery-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.home-discovery-footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--brand-2) 14%, var(--line));
  color: var(--text-main);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}
.home-discovery-footer-links a:hover {
  color: var(--brand-3);
}
@media (max-width: 959px) {
  .home-discovery-header,
  .home-discovery-body {
    grid-template-columns: 1fr;
  }

  .home-discovery-actions {
    justify-content: flex-start;
  }
}
@media (max-width: 639px) {
  .home-discovery-grid {
    grid-template-columns: 1fr;
  }
}
.rightbar-desktop-lead {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 24px;
  border: 1px solid color-mix(in srgb, var(--brand-2) 14%, var(--line));
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--brand-1) 16%, transparent) 0%, transparent 42%),
    linear-gradient(180deg, color-mix(in srgb, var(--bg-card) 92%, white 8%), color-mix(in srgb, var(--bg-card-2) 88%, white 12%));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.58),
    0 14px 30px rgba(148, 163, 184, 0.12);
}
.rightbar-desktop-lead-copy {
  display: grid;
  gap: 8px;
}
.rightbar-desktop-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand-3);
}
.rightbar-desktop-eyebrow::before {
  content: "";
  width: 16px;
  height: 1px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.46;
}
.rightbar-desktop-title {
  margin: 0;
  font-size: 21px;
  line-height: 1.18;
  letter-spacing: -0.02em;
  color: var(--text-main);
}
.rightbar-desktop-summary {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.65;
}
.rightbar-desktop-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.rightbar-desktop-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--brand-2) 12%, var(--line));
  background: color-mix(in srgb, var(--bg-card) 82%, white 18%);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
}
html.dark .rightbar-desktop-lead {
  border-color: rgba(56, 189, 248, 0.16);
  background:
    radial-gradient(circle at top right, rgba(8, 145, 178, 0.16) 0%, transparent 44%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.7) 0%, rgba(30, 41, 59, 0.62) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 16px 34px rgba(2, 6, 23, 0.26);
}
html.dark .rightbar-desktop-chip {
  background: rgba(15, 23, 42, 0.54);
  border-color: rgba(56, 189, 248, 0.14);
}
.rightbar-desktop-shell {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.rightbar-desktop-section {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding-bottom: 18px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
}
.rightbar-desktop-section:last-child {
  padding-bottom: 0;
  border-bottom: none;
}
.rightbar-desktop-section + .rightbar-desktop-section {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.rightbar-panel-search {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--brand-2) 14%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg-card) 84%, white 16%);
  color: var(--text-muted);
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.rightbar-panel-search:focus-within {
  border-color: color-mix(in srgb, var(--brand-2) 36%, var(--line));
  background: color-mix(in srgb, var(--bg-card) 92%, white 8%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-2) 10%, transparent);
}
.rightbar-panel-search i {
  flex-shrink: 0;
  color: var(--brand-2);
  font-size: 15px;
}
.rightbar-panel-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-main);
  font: inherit;
  font-size: 13px;
}
.rightbar-panel-search input::placeholder {
  color: var(--text-muted);
}
.rightbar-desktop-shell .section-title {
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 2px;
}
.rightbar-desktop-shell .section-title h2 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.3;
}
.rightbar-desktop-shell .link {
  font-size: 12px;
  color: var(--text-muted);
  transition: color 0.18s ease;
}
.rightbar-desktop-shell a.link:hover {
  color: var(--text-main);
}
.rightbar-desktop-shell .rightbar-tags,
.rightbar-desktop-shell .rightbar-room-list,
.rightbar-desktop-shell .rightbar-online-list,
.rightbar-desktop-shell .rightbar-recent-list,
.rightbar-desktop-shell .rightbar-category-list {
  gap: 8px;
}
.rightbar-desktop-shell .rightbar-tag {
  padding: 7px 13px;
}
.rightbar-desktop-shell .trend {
  padding: 10px 0 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
}
.rightbar-desktop-shell .trend:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.rightbar .friend {
  padding: 12px 14px;
  border-bottom: none;
  border-radius: 18px;
  border: 1px solid color-mix(in srgb, var(--brand-2) 8%, var(--line));
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg-card) 58%, transparent), transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.rightbar .friend + .friend {
  margin-top: 8px;
}
.rightbar .friend:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--brand-2) 18%, var(--line));
  background: color-mix(in srgb, var(--pill) 64%, rgba(255, 255, 255, 0.16));
  box-shadow: 0 10px 22px rgba(148, 163, 184, 0.12);
}
.rightbar-desktop-shell .trend small,
.rightbar-desktop-shell .friend small {
  margin-bottom: 4px;
}
.rightbar-desktop-shell .rightbar-desktop-copy,
.rightbar-desktop-shell .rightbar-desktop-meta {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}
.rightbar-desktop-shell .rightbar-room-item,
.rightbar-desktop-shell .rightbar-online-item,
.rightbar-desktop-shell .rightbar-recent-item,
.rightbar-desktop-shell .rightbar-category-item {
  margin-inline: 0;
  padding: 12px 14px;
  border-radius: 18px;
}
.rightbar-desktop-shell .rightbar-room-item:hover,
.rightbar-desktop-shell .rightbar-online-item:hover,
.rightbar-desktop-shell .rightbar-recent-item:hover,
.rightbar-desktop-shell .rightbar-category-item:hover,
.rightbar-desktop-shell .rightbar-category-item.active {
  background: color-mix(in srgb, var(--pill) 64%, rgba(255, 255, 255, 0.16));
}
.rightbar-desktop-shell .rightbar-room-icon,
.rightbar-desktop-shell .rightbar-category-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
}
.rightbar-desktop-shell .rightbar-stats-grid {
  gap: 10px;
}
.rightbar-desktop-shell .rightbar-stat-item {
  padding: 14px 12px;
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--brand-2) 10%, var(--line));
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg-card) 86%, white 14%), color-mix(in srgb, var(--bg-card-2) 82%, white 18%));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.36);
}
.rightbar-desktop-shell .rightbar-stat-item:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--brand-1) 22%, var(--line));
  background: color-mix(in srgb, var(--pill) 46%, rgba(255, 255, 255, 0.16));
}
.rightbar-desktop-shell .rightbar-stat-item strong {
  font-size: 20px;
}
.rightbar-desktop-shell .rightbar-room-item .follow-btn {
  background: color-mix(in srgb, var(--bg-card) 82%, white 18%);
  color: var(--text-soft);
  border-color: color-mix(in srgb, var(--line) 84%, var(--brand-1) 16%);
  border-radius: 12px;
  pointer-events: none;
}
.rightbar-desktop-shell .rightbar-room-item .follow-btn:hover {
  transform: translateY(-1px);
  background: color-mix(in srgb, var(--pill) 64%, rgba(255, 255, 255, 0.16));
  color: var(--text-main);
}
.rightbar-desktop-shell .rightbar-desktop-note,
.rightbar-desktop-shell .rightbar-desktop-tip-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: var(--text-soft);
  line-height: 1.6;
}
.rightbar-desktop-shell .rightbar-desktop-tip-list {
  display: grid;
  gap: 12px;
}
.rightbar-desktop-shell .rightbar-desktop-tip-item + .rightbar-desktop-tip-item {
  padding-top: 12px;
  border-top: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
}
.rightbar-desktop-shell .rightbar-desktop-tip-item small {
  margin: 0;
  color: var(--text-soft);
}
.rightbar-desktop-shell .rightbar-desktop-note strong {
  color: var(--text-main);
}
.rightbar-desktop-shell .rightbar-desktop-static-row {
  cursor: default;
}
.section-title {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px;
}
.section-title h2 { font-size: 18px; color: var(--text-main); }
.link { color: var(--brand-2); font-size: 13px; text-decoration: none; }
.link-static {
  color: var(--text-muted);
  cursor: default;
}
.trend, .friend { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.trend:last-child, .friend:last-child { border-bottom: none; }
.trend small, .friend small { color: var(--text-muted); display: block; margin-bottom: 6px; }
.trend strong, .friend strong { color: var(--text-main); display: block; margin-bottom: 4px; }
.friend-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.friend-info { display: flex; align-items: center; gap: 10px; }
.follow-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--pill); color: var(--brand-3); padding: 9px 12px; font-size: 13px; border: 1px solid var(--line);
}
/* Rightbar - Tags */
.rightbar-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.rightbar-tag {
  appearance: none;
  background: var(--pill);
  color: var(--brand-3);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  border: 1px solid var(--line);
  text-decoration: none;
  font: inherit;
  cursor: pointer;
  transition: all 0.18s ease;
}
.rightbar-tag:hover,
.rightbar-tag.active {
  background: color-mix(in srgb, var(--brand-1) 15%, var(--pill));
  color: var(--brand-1);
  border-color: var(--brand-1);
}
.rightbar-tag:focus-visible {
  outline: 2px solid var(--brand-1);
  outline-offset: 2px;
}

/* Rightbar - Category List */
.rightbar-category-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rightbar-category-item {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--brand-2) 8%, var(--line));
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg-card) 58%, transparent), transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
  text-decoration: none;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.rightbar-category-item:hover,
.rightbar-category-item.active {
  transform: translateY(-1px);
  background: color-mix(in srgb, var(--pill) 64%, rgba(255, 255, 255, 0.16));
  border-color: color-mix(in srgb, var(--brand-1) 22%, var(--line));
  box-shadow: 0 10px 22px rgba(148, 163, 184, 0.12);
}
.rightbar-category-item.active {
  border-color: color-mix(in srgb, var(--brand-1) 30%, var(--line));
}
.rightbar-category-item:focus-visible {
  outline: 2px solid var(--brand-1);
  outline-offset: 2px;
}
.rightbar-category-item[disabled] {
  opacity: 0.62;
  cursor: not-allowed;
}
.rightbar-category-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--pill) 82%, rgba(255, 255, 255, 0.18));
  border: 1px solid color-mix(in srgb, var(--line) 88%, var(--brand-2) 12%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-3);
  font-size: 14px;
  flex-shrink: 0;
}
.rightbar-category-text strong {
  display: block;
  font-size: 14px;
  color: var(--text-main);
}
.rightbar-category-text small {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Rightbar - Room List */
.rightbar-room-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rightbar-room-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--brand-2) 8%, var(--line));
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg-card) 58%, transparent), transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
  text-decoration: none;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.rightbar-room-item:hover {
  transform: translateY(-1px);
  background: color-mix(in srgb, var(--pill) 64%, rgba(255, 255, 255, 0.16));
  border-color: color-mix(in srgb, var(--brand-1) 22%, var(--line));
  box-shadow: 0 10px 22px rgba(148, 163, 184, 0.12);
}
.rightbar-room-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  color: var(--brand-3);
  border: 1px solid color-mix(in srgb, var(--line) 88%, var(--brand-2) 12%);
}
.rightbar-room-icon.live {
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.14);
}
.rightbar-room-icon.voice {
  background: rgba(168, 85, 247, 0.08);
  color: #a855f7;
  border-color: rgba(168, 85, 247, 0.14);
}
.rightbar-room-icon.text {
  background: rgba(6, 182, 212, 0.08);
  color: var(--brand-1);
  border-color: rgba(6, 182, 212, 0.12);
}
.rightbar-room-text {
  flex: 1;
  min-width: 0;
}
.rightbar-room-text strong {
  display: block;
  font-size: 14px;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rightbar-room-text small {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.rightbar-room-item .follow-btn {
  flex-shrink: 0;
  padding: 6px 12px;
  font-size: 12px;
}

/* Rightbar - Online List */
.rightbar-online-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rightbar-online-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--brand-2) 8%, var(--line));
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg-card) 58%, transparent), transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  cursor: pointer;
}
.rightbar-online-item:hover {
  transform: translateY(-1px);
  background: color-mix(in srgb, var(--pill) 64%, rgba(255, 255, 255, 0.16));
  border-color: color-mix(in srgb, var(--brand-1) 22%, var(--line));
  box-shadow: 0 10px 22px rgba(148, 163, 184, 0.12);
}
.rightbar-online-avatar {
  position: relative;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
}
.rightbar-online-avatar .online-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 11px;
  height: 11px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--bg-card) 96%, white 4%);
}
.rightbar-online-info strong {
  display: block;
  font-size: 14px;
  color: var(--text-main);
}
.rightbar-online-info small {
  display: block;
  font-size: 12px;
  color: #22c55e;
  margin-top: 2px;
}

/* Rightbar - Recent Chat List */
.rightbar-recent-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rightbar-recent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--brand-2) 8%, var(--line));
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg-card) 58%, transparent), transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
  text-decoration: none;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.rightbar-recent-item:hover {
  transform: translateY(-1px);
  background: color-mix(in srgb, var(--pill) 64%, rgba(255, 255, 255, 0.16));
  border-color: color-mix(in srgb, var(--brand-1) 22%, var(--line));
  box-shadow: 0 10px 22px rgba(148, 163, 184, 0.12);
}
.rightbar-recent-info {
  flex: 1;
  min-width: 0;
}
.rightbar-recent-info strong {
  display: block;
  font-size: 14px;
  color: var(--text-main);
}
.rightbar-recent-info small {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rightbar-recent-time {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  align-self: flex-start;
  padding-top: 2px;
}

/* Rightbar - Stats Grid */
.rightbar-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.rightbar-stat-item {
  text-align: center;
  padding: 16px 12px;
  background: var(--pill);
  border: 1px solid var(--line);
  border-radius: 16px;
  transition: all 0.18s ease;
}
.rightbar-stat-item:hover {
  border-color: var(--brand-1);
  transform: translateY(-2px);
}
.rightbar-stat-item strong {
  display: block;
  font-size: 22px;
  color: var(--text-main);
  margin-bottom: 4px;
}
.rightbar-stat-item small {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
}

.info-box {
  margin-top: 22px; padding: 18px; border-radius: 22px;
  background: linear-gradient(135deg, rgba(34,211,238,0.14), rgba(59,130,246,0.10));
  border: 1px solid var(--line); color: var(--text-soft); line-height: 1.8;
}

.bottom-bar {
  position: fixed; left: 50%; bottom: calc(12px + var(--bottom-safe-area)); transform: translateX(-50%);
  width: min(440px, calc(100% - 32px));
  background: linear-gradient(135deg, rgba(255,255,255,0.8) 0%, color-mix(in srgb, var(--palette-primary-soft) 38%, transparent) 100%);
  border: 1px solid color-mix(in srgb, var(--line) 80%, rgba(255,255,255,0.36));
  border-top: 0.5px solid rgba(255,255,255,0.7);
  border-radius: 30px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.55) inset, 0 14px 44px rgba(var(--palette-primary-rgb), 0.18);
  backdrop-filter: blur(32px) saturate(190%);
  -webkit-backdrop-filter: blur(32px) saturate(190%);
  display: none; grid-template-columns: repeat(5, 1fr); gap: 2px; padding: 9px 12px 10px;
  z-index: 30; overflow: visible;
}
html.dark .bottom-bar {
  background: linear-gradient(135deg, rgba(30,41,59,0.84) 0%, rgba(15,23,42,0.66) 100%);
  border-color: rgba(56, 189, 248, 0.22);
  box-shadow: 0 1px 0 rgba(255,255,255,0.06) inset, 0 14px 44px rgba(0,0,0,0.42);
}
.bottom-bar-guest {
  grid-template-columns: repeat(4, 1fr);
}
.bottom-item {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 6px 4px; border-radius: 18px; color: var(--text-muted); text-decoration: none;
  font-size: 10px; font-weight: 600;
  transition: color 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
  min-height: 52px;                              /* 舒適觸控目標 */
  -webkit-tap-highlight-color: transparent;      /* 移除手機點擊灰色閃光 */
  touch-action: manipulation;                    /* 消除 300ms 點擊延遲、避免雙擊縮放 */
  user-select: none; -webkit-user-select: none;  /* 長按不選取文字 */
}
/* 圖示外層膠囊：active 時填入漸層、上浮發光（Material-3 指示器） */
.bottom-item span:first-child {
  display: flex; align-items: center; justify-content: center;
  width: 46px; height: 30px; border-radius: 16px;
  font-size: 20px; line-height: 1;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              background 0.3s ease, box-shadow 0.3s ease, color 0.3s ease;
}
.bottom-item:active { transform: scale(0.92); }
.bottom-item.active { color: var(--brand-2); font-weight: 700; }
.bottom-item.active span:first-child {
  background: color-mix(in srgb, var(--brand-1) 16%, transparent);
  color: var(--brand-2);
}
html.dark .bottom-item.active { color: var(--brand-2); }
/* 標籤一律視覺隱藏（保留無障礙可讀），文字只在 active 的聊天泡泡裡出現 */
.bottom-item > span:last-child {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.bottom-item.active::after {
  content: attr(data-label);
  position: absolute; left: 50%; bottom: calc(100% + 5px); transform: translateX(-50%);
  padding: 4px 11px; border-radius: 13px; white-space: nowrap;
  font-size: 11px; font-weight: 700; line-height: 1.2;
  color: #fff; background: linear-gradient(135deg, var(--brand-1), var(--brand-3));
  box-shadow: 0 6px 16px color-mix(in srgb, var(--brand-2) 42%, transparent);
}
.bottom-item.active::before {
  content: ''; position: absolute; left: 50%; bottom: calc(100% + 1px); transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 6px solid transparent; border-right: 6px solid transparent;
  border-top: 6px solid var(--brand-3);
}
@media (prefers-reduced-motion: reduce) {
  .bottom-item, .bottom-item span:first-child { transition: none; }
  .bottom-item:active,
  .bottom-item.active span:first-child { transform: none; }
}
/* 訪客版登入鍵：圖示膠囊預設就填漸層，凸顯為主要動作 */
.bottom-bar-guest .bottom-item-login { color: var(--brand-2); }
.bottom-bar-guest .bottom-item-login span:first-child {
  background: linear-gradient(135deg, var(--brand-1), var(--brand-3));
  color: #fff;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--brand-2) 42%, transparent);
}

@media (max-width: 1279px) {
  .layout {
    max-width: 1240px;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
    grid-template-areas:
      "sidebar sidebar"
      "feed rightbar";
    gap: 20px;
  }

  .desktop-sidebar,
  .rightbar {
    position: static;
  }

  .desktop-sidebar {
    padding: 0;
  }

  .desktop-menu {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
    gap: 10px;
    width: 100%;
  }

  .desktop-menu a {
    width: 100%;
    min-width: 0;
    min-height: 48px;
    justify-content: center;
    gap: 8px;
    padding: 12px 10px;
  }

  .desktop-menu a > span:first-child {
    flex: 0 0 auto;
  }

  .desktop-menu a > span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 1099px) {
  .topbar {
    gap: 16px;
    padding: 14px 20px;
  }

  .layout {
    max-width: 960px;
    grid-template-columns: 1fr;
    grid-template-areas:
      "sidebar"
      "feed";
    gap: 18px;
    padding-inline: 18px;
  }

  .layout > .rightbar {
    grid-area: auto;
  }

  .desktop-sidebar,
  .composer,
  .post,
  .rightbar {
    padding: 18px;
  }

  .desktop-menu {
    flex-wrap: wrap;
  }

  body.rightbar-drawer-open {
    overflow: hidden;
  }

  .rightbar-drawer-tab {
    position: fixed;
    top: 50%;
    right: 0;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 12px 14px 14px;
    border: 0;
    border-radius: 18px 0 0 18px;
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--bg-card) 92%, white 8%), color-mix(in srgb, var(--bg-card-2) 96%, white 4%));
    color: var(--text-main);
    box-shadow: none;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transform: translate3d(0, -50%, 0);
    transition: transform 0.28s ease, opacity 0.24s ease, box-shadow 0.24s ease;
    z-index: 51;
    cursor: pointer;
  }

  .rightbar-drawer-tab i {
    color: var(--brand-2);
    font-size: 14px;
  }

  .rightbar-drawer-tab:hover {
    box-shadow: none;
  }

  .rightbar-drawer-overlay {
    position: fixed;
    inset: 0;
    display: block;
    background: rgba(15, 23, 42, 0.28);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.24s ease;
    z-index: 48;
  }

  .rightbar {
    position: fixed;
    top: calc(var(--header-height) + 16px);
    right: 14px;
    bottom: 18px;
    width: min(388px, calc(100vw - 28px));
    max-width: calc(100vw - 28px);
    height: auto;
    max-height: calc(100dvh - var(--header-height) - 34px);
    transform: translateX(calc(100% + 22px));
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.24s ease;
    z-index: 49;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .rightbar::before {
    left: 16px;
    right: 16px;
  }

  .rightbar-drawer-head {
    position: sticky;
    top: -18px;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: -18px -18px 18px;
    padding: 16px 18px 14px;
    border-bottom: 1px solid color-mix(in srgb, var(--brand-2) 12%, var(--line));
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--bg-card) 94%, white 6%) 0%, color-mix(in srgb, var(--bg-card) 82%, transparent) 100%);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  body.rightbar-drawer-open .rightbar {
    transform: translateX(0);
    box-shadow: none;
  }

  body.rightbar-drawer-open .rightbar-drawer-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  body.rightbar-drawer-open .rightbar-drawer-tab {
    opacity: 0;
    pointer-events: none;
    transform: translate3d(10px, -50%, 0);
  }
}

@media (max-width: 767px) {
  .page-topics .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand actions"
      "tools tools";
    row-gap: 10px;
    padding-bottom: 12px;
  }

  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas:
      "brand compose actions"
      "search search search";
    align-items: center;
    column-gap: 12px;
    row-gap: 10px;
    padding: 12px 16px 16px;
    overflow: hidden;
    transition:
      transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
      opacity 0.3s ease,
      row-gap 0.24s ease,
      padding-bottom 0.24s ease;
  }

  .topbar.topbar-no-search {
    grid-template-areas: "brand compose actions";
    row-gap: 0;
    padding-bottom: 12px;
  }

  .brand {
    grid-area: brand;
    min-width: 0;
  }

  .brand-copy {
    gap: 4px;
  }


  .topbar-compose-btn {
    grid-area: compose;
    justify-self: center;
    min-width: 0;
    padding-inline: 12px;
    font-size: 11px;
    white-space: nowrap;
  }

  .top-actions {
    grid-area: actions;
    justify-self: end;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
    margin-left: 0;
  }

  .search {
    grid-area: search;
    width: 100%;
    min-width: 0;
    min-height: 0;
    max-width: none;
    margin: 0;
    max-height: 56px;
    overflow: hidden;
    opacity: 1;
    transform: translateY(0);
    transition: max-height 0.28s ease, opacity 0.2s ease, transform 0.28s ease;
  }

  .topbar-tools {
    grid-area: search;
    width: 100%;
    min-width: 0;
  }

  .page-topics .topbar .topbar-tools {
    grid-area: tools;
    justify-self: stretch;
    overflow: visible;
    -webkit-mask-image: none;
    mask-image: none;
  }

  .page-topics .topbar .topic-tabs {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding-inline: 2px;
    scroll-padding-inline: 12px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x proximity;
    touch-action: auto;
  }

  .page-topics .topbar .topic-tabs.is-scrollable {
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 18px, #000 calc(100% - 18px), transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 18px, #000 calc(100% - 18px), transparent 100%);
  }

  .page-topics .topbar .topic-tabs.is-scrollable.is-at-start {
    -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 18px), transparent 100%);
    mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 18px), transparent 100%);
  }

  .page-topics .topbar .topic-tabs.is-scrollable.is-at-end {
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 18px, #000 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 18px, #000 100%);
  }

  .page-topics .topbar .topic-tabs::-webkit-scrollbar {
    display: none;
  }

  .page-topics .topbar .topic-tabs .tab-item {
    flex: 0 0 auto;
    scroll-snap-align: start;
  }

  .page-topics .topbar .topic-tabs::after {
    content: "";
    flex: 0 0 10px;
  }

  .topbar-tools .chat-topbar-tools,
  .topbar-tools .room-tabs-layout,
  .topbar-tools .topic-tabs {
    min-width: max-content;
  }

  /* 第二列：加大觸控目標、搜尋框維持可用寬度 */
  .topbar-tools .room-tab-item,
  .topbar-tools .topic-tabs .tab-item {
    min-height: 44px;
    padding: 8px 14px;
  }
  .topbar-tools .room-topbar-search {
    min-width: 120px;
  }

  .topbar.search-collapsed {
    row-gap: 0;
    padding-bottom: 12px;
  }

  .topbar.search-collapsed .search {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
  }

  .search-shell {
    transition: opacity 0.2s ease, transform 0.28s ease;
  }

  .topbar.search-collapsed .search-shell {
    opacity: 0;
    transform: translateY(-8px);
  }

  .search-shell {
    min-height: 46px;
    border-radius: 17px;
    padding: 0 10px 0 12px;
  }

  .search input {
    font-size: 13px;
  }

  .search-context-label {
    padding: 4px 8px;
    font-size: 10px;
  }

  .top-actions .primary-btn,
  .top-actions .mode-btn,
  .top-actions .user-info {
    min-height: 42px;
  }

  .top-actions .primary-btn {
    white-space: nowrap;
    padding-inline: 14px;
  }

  .layout {
    grid-template-columns: 1fr;
    grid-template-areas: "feed";
    gap: 16px;
    padding: var(--layout-padding-top) 16px calc(var(--mobile-nav-clearance) + 12px);
  }

  .desktop-sidebar { display: none; }
  .bottom-bar { display: grid; }
  .composer, .post, .rightbar { padding: 16px; }
  .post, .composer { border-radius: 20px; }
  .home-discovery-panel { margin-top: 0; }
  .home-discovery-shell {
    padding: 16px;
    gap: 14px;
  }
  .home-discovery-copy h2 {
    max-width: none;
    font-size: 26px;
  }
  .home-discovery-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .home-discovery-login {
    width: 100%;
  }
  .home-discovery-hero {
    padding: 14px;
  }
  .home-discovery-grid {
    gap: 12px;
  }
  .post-footer { align-items: flex-start; }
  .topbar.user-menu-open {
    overflow: visible;
  }
  .menu-dropdown {
    right: 0;
    top: calc(100% + 10px);
    min-width: 152px;
    max-width: min(220px, calc(100vw - 24px));
  }
  html, body { overscroll-behavior-y: contain; }
  .rightbar-desktop-shell { display: none; }
  .rightbar-mobile-shell { display: block; }
  .rightbar {
    top: calc(var(--header-height) + 12px);
    right: 10px;
    bottom: calc(var(--mobile-nav-clearance) + 8px);
    width: min(380px, calc(100vw - 20px));
    max-width: calc(100vw - 20px);
    max-height: calc(100dvh - var(--header-height) - var(--mobile-nav-clearance) - 20px);
    gap: 0;
  }
  .rightbar-drawer-head {
    top: -16px;
    margin: -16px -16px 16px;
    padding: 14px 16px 12px;
  }
  .rightbar-drawer-head-copy strong {
    font-size: 15px;
  }
  .rightbar-mobile-feature,
  .rightbar-mobile-section {
    padding: 13px;
    border-radius: 16px;
  }
  .rightbar-mobile-feature .section-title,
  .rightbar-mobile-section .section-title {
    margin-bottom: 10px;
  }
  .rightbar-mobile-shell .section-title h2 {
    font-size: 16px;
  }
  .rightbar-mobile-shell .rightbar-room-item,
  .rightbar-mobile-shell .rightbar-recent-item,
  .rightbar-mobile-shell .rightbar-online-item,
  .rightbar-mobile-shell .rightbar-category-item {
    padding-inline: 12px;
  }
  .rightbar-mobile-shell .trend,
  .rightbar-mobile-shell .friend {
    padding-inline: 12px;
  }
}

/* Danger Button */
.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
}

/* Post Preview */
.post-preview {
  background: var(--bg-card-2);
  border-radius: 16px;
  padding: 16px;
  margin: 24px 0;
  text-align: left;
  border: 1px solid var(--line);
}

.post-content-short {
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.6;
}

.warning-text {
  color: #f87171;
  font-size: 14px;
  margin-bottom: 24px;
}

/* Menu Dropdown */
.user-menu {
  position: relative;
  z-index: 13;
}

.user-menu-trigger {
  cursor: pointer;
  display: inline-flex;
  border-radius: 14px;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  appearance: none;
  -webkit-appearance: none;
  touch-action: manipulation;
}
.user-menu-trigger .avatar {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-1) 30%, transparent);
  transition: box-shadow 0.18s ease;
}
.user-menu-trigger:hover {
  transform: translateY(-1px);
}
.user-menu-trigger:hover .avatar {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-2) 45%, transparent), 0 8px 18px rgba(var(--palette-primary-rgb),0.2);
}

.menu-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 8px;
  min-width: 140px;
  max-width: min(220px, calc(100vw - 24px));
  z-index: 1000;
  box-shadow: var(--shadow);
  pointer-events: auto;
}

.menu-dropdown[hidden] {
  display: none !important;
}

html.dark .menu-dropdown {
  background: #1e293b;
}

.menu-dropdown a, .menu-dropdown button {
  display: block;
  padding: 10px 16px;
  color: var(--text-soft);
  text-decoration: none;
  font-size: 14px;
  border-radius: 12px;
  transition: background 0.18s ease, color 0.18s ease;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}

.menu-dropdown a:hover, .menu-dropdown button:hover {
  background: var(--pill);
  color: var(--brand-3);
}

.menu-dropdown .menu-item.text-danger {
  color: #dc2626;
}

.menu-dropdown .menu-item.text-danger:hover {
  background: rgba(239, 68, 68, 0.08);
  color: #b91c1c;
}

html.dark .menu-dropdown .menu-item.text-danger {
  color: #fca5a5;
}

html.dark .menu-dropdown .menu-item.text-danger:hover {
  background: rgba(248, 113, 113, 0.12);
  color: #fecaca;
}

.menu-dropdown .menu-item {
  display: flex !important;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.menu-item i {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.notification-badge {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  padding: 4px 6px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  animation: badge-pulse 2s ease-in-out infinite;
}

@keyframes badge-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.notification-badge:empty {
  display: none;
}

.menu-item {
  display: flex !important;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  color: var(--text-soft);
  text-decoration: none;
  font-size: 14px;
  border-radius: 12px;
  transition: background 0.18s ease, color 0.18s ease;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  position: relative;
  flex-direction: row;
}

.menu-item:hover {
  background: var(--pill);
  color: var(--brand-3);
}

.menu-item i {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.notification-badge {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: white;
  padding: 4px 6px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  animation: badge-pulse 2s ease-in-out infinite;
}

@keyframes badge-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.notification-badge:empty {
  display: none;
}

.notification-menu-item .notification-badge {
  margin-left: auto;
}

.notification-menu-item.has-notifications {
  color: var(--brand-3);
}

.menu-dropdown.notification-expanded {
  width: min(300px, calc(100vw - 24px));
  max-width: min(300px, calc(100vw - 24px));
}

.menu-dropdown.notification-compact {
  width: min(190px, calc(100vw - 24px));
  max-width: min(190px, calc(100vw - 24px));
}

.menu-notification-panel {
  margin-top: 2px;
  padding-top: 2px;
  border-top: 1px solid #e5e7eb;
  background: #ffffff;
  overflow: hidden;
  animation: menu-notification-enter 0.16s ease-out;
}

.menu-notification-panel[hidden] {
  display: none;
}

.menu-notification-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 2px 5px;
}

.menu-notification-head strong {
  color: #0f172a;
  font-size: 12px;
  font-weight: 700;
}

.menu-dropdown .menu-notification-head button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: #f1f5f9;
  color: #2563eb;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  border-radius: 8px;
  padding: 4px 7px;
}

.menu-notification-list {
  display: block;
  max-height: min(260px, calc(100vh - var(--header-height) - 120px));
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 #ffffff;
}

.menu-notification-list::-webkit-scrollbar {
  width: 6px;
}

.menu-notification-list::-webkit-scrollbar-track {
  background: #ffffff;
}

.menu-notification-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

.menu-dropdown .menu-notification-item {
  display: flex;
  gap: 8px;
  padding: 8px 2px;
  border-radius: 0;
  color: #0f172a;
  text-decoration: none;
  border: 0;
  border-bottom: 1px solid #e5e7eb;
  background: #ffffff;
}

.menu-dropdown .menu-notification-item:hover {
  background: #f8fafc;
}

.menu-dropdown .menu-notification-item.is-unread {
  background: #eff6ff;
}

.menu-notification-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  margin-top: 1px;
  color: #64748b;
  background: #ffffff;
  font-size: 14px;
}

.menu-notification-item.is-unread .menu-notification-icon {
  color: #2563eb;
  background: #eff6ff;
}

.menu-notification-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.menu-notification-copy strong {
  font-size: 13px;
  line-height: 1.3;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-notification-copy small {
  font-size: 12px;
  line-height: 1.35;
  color: #475569;
  overflow-wrap: anywhere;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.menu-notification-copy time {
  font-size: 11px;
  color: #64748b;
}

.menu-notification-empty {
  display: flex;
  align-items: center;
  color: #64748b;
  padding: 8px 2px;
  background: #ffffff;
  text-align: left;
}

.menu-notification-empty strong {
  color: #64748b;
  font-size: 12px;
  font-weight: 650;
}

@keyframes menu-notification-enter {
  from { transform: translateY(-4px); }
  to { transform: translateY(0); }
}

html.dark .menu-notification-panel {
  border-top-color: #334155;
  background: #1e293b;
  box-shadow: none;
}

html.dark .menu-notification-head strong {
  color: #f8fafc;
}

html.dark .menu-dropdown .menu-notification-head button {
  background: #334155;
  color: #93c5fd;
}

html.dark .menu-notification-list {
  scrollbar-color: #475569 #1e293b;
}

html.dark .menu-notification-list::-webkit-scrollbar-track {
  background: #1e293b;
}

html.dark .menu-notification-list::-webkit-scrollbar-thumb {
  background: #475569;
}

html.dark .menu-dropdown .menu-notification-item {
  color: #f8fafc;
  border-bottom-color: #334155;
  background: #1e293b;
}

html.dark .menu-dropdown .menu-notification-item:hover {
  background: #334155;
}

html.dark .menu-dropdown .menu-notification-item.is-unread {
  background: #1d4ed8;
}

html.dark .menu-notification-icon {
  color: #cbd5e1;
  background: #1e293b;
}

html.dark .menu-notification-item.is-unread .menu-notification-icon {
  color: #dbeafe;
  background: #1d4ed8;
}

html.dark .menu-notification-copy strong {
  color: #f8fafc;
}

html.dark .menu-notification-copy small,
html.dark .menu-notification-copy time,
html.dark .menu-notification-empty,
html.dark .menu-notification-empty strong {
  color: #cbd5e1;
}

html.dark .menu-notification-empty {
  background: #1e293b;
}

.post-menu {
  position: relative;
}

.brand a { text-decoration: none; display: block; }

.logo-banner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 5px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: linear-gradient(135deg, var(--brand-1) 0%, var(--brand-2) 56%, var(--brand-3) 100%);
  color: #ffffff !important;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.03em;
  box-shadow: 0 14px 30px rgba(var(--palette-primary-rgb),0.16);
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.logo-banner::before,
.logo-banner::after {
  display: none;
}

/* Toast Notifications */
#toast-container {
  --pull-refresh-offset: 0px;
  position: fixed;
  top: calc(var(--header-height) + 18px);
  right: 18px;
  z-index: 9999;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
  transform: translateY(var(--pull-refresh-offset));
  transition: transform 0.2s ease;
  will-change: transform;
}

.toast {
  width: fit-content;
  max-width: min(320px, calc(100vw - 36px));
  background: var(--toast-bg);
  border: 1px solid var(--toast-border);
  border-radius: 14px;
  box-shadow: var(--toast-shadow);
  padding: 10px 12px;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  opacity: 0;
  pointer-events: auto;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--toast-muted);
}

.toast-message {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--toast-text);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.toast-close {
  display: none;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  color: var(--toast-muted);
  cursor: pointer;
  border-radius: 999px;
  align-items: center;
  justify-content: center;
  transition: color 0.18s ease, background-color 0.18s ease, opacity 0.18s ease;
  opacity: 0.6;
}

.toast.is-dismissible .toast-close {
  display: inline-flex;
}

.toast-close:hover {
  background: var(--toast-close-hover);
  color: var(--toast-text);
  opacity: 1;
}

.toast-success .toast-icon {
  color: var(--toast-success);
}
.toast-error .toast-icon {
  color: var(--toast-error);
}
.toast-warning .toast-icon {
  color: var(--toast-warning);
}
.toast-info .toast-icon {
  color: var(--toast-info);
}

.pull-refresh-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
  max-width: 320px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255,255,255,0.92);
  border: 1px solid var(--line);
  box-shadow: 0 10px 24px rgba(var(--palette-primary-rgb), 0.16);
  color: var(--text-main);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  opacity: 0;
  transform: translateY(-12px) scale(0.98);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

html.dark .pull-refresh-toast {
  background: rgba(15,23,42,0.92);
  border-color: rgba(56, 189, 248, 0.22);
  box-shadow: 0 12px 28px rgba(2, 8, 23, 0.4);
}

.pull-refresh-toast .pull-refresh-spinner {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-1);
  transition: transform 0.18s ease;
  flex-shrink: 0;
}

.pull-refresh-toast .pull-refresh-text {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

body.pull-refresh-active .pull-refresh-toast,
body.pull-refresh-ready .pull-refresh-toast,
body.pull-refresh-loading .pull-refresh-toast {
  opacity: 1;
  transform: translateY(0) scale(1);
}

body.pull-refresh-ready .pull-refresh-toast .pull-refresh-spinner {
  transform: rotate(180deg);
}

body.pull-refresh-loading .pull-refresh-toast .pull-refresh-spinner {
  animation: pull-refresh-spin 0.9s linear infinite;
}

@media (max-width: 768px) {
  #toast-container {
    right: 12px;
    left: 12px;
    top: calc(var(--header-height) + 16px);
    align-items: stretch;
  }

  .toast {
    width: 100%;
    max-width: none;
  }

  .pull-refresh-toast {
    min-width: auto;
    max-width: none;
    width: 100%;
  }
}

/* Confirm Dialog */
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.confirm-overlay.confirm-visible {
  opacity: 1;
}

.confirm-overlay.confirm-closing {
  opacity: 0;
}

.confirm-dialog {
  --confirm-button-bg: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  --confirm-button-bg-hover: linear-gradient(135deg, var(--brand-2), var(--brand-3));
  --confirm-button-shadow: 0 12px 24px rgba(var(--palette-primary-rgb),0.18);
  --confirm-button-shadow-hover: 0 14px 28px rgba(var(--palette-primary-rgb),0.22);
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  width: min(90vw, 400px);
  overflow: hidden;
  transform: translateY(8px) scale(0.985);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.confirm-visible .confirm-dialog {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.confirm-closing .confirm-dialog {
  transform: translateY(8px) scale(0.985);
  opacity: 0;
}

.confirm-dialog-body {
  padding: 22px 20px 18px;
}

.confirm-dialog-danger {
  --confirm-button-bg: linear-gradient(135deg, #ef4444, #dc2626);
  --confirm-button-bg-hover: linear-gradient(135deg, #dc2626, #b91c1c);
  --confirm-button-shadow: 0 12px 24px rgba(220, 38, 38, 0.2);
  --confirm-button-shadow-hover: 0 14px 28px rgba(220, 38, 38, 0.24);
}

.confirm-dialog-warning {
  --confirm-button-bg: linear-gradient(135deg, #f59e0b, #d97706);
  --confirm-button-bg-hover: linear-gradient(135deg, #d97706, #b45309);
  --confirm-button-shadow: 0 12px 24px rgba(217, 119, 6, 0.2);
  --confirm-button-shadow-hover: 0 14px 28px rgba(217, 119, 6, 0.24);
}

.confirm-dialog-info {
  --confirm-button-bg: var(--brand-2);
  --confirm-button-bg-hover: var(--brand-3);
  --confirm-button-shadow: 0 8px 18px rgba(var(--palette-primary-rgb), 0.2);
  --confirm-button-shadow-hover: 0 10px 22px rgba(var(--palette-primary-rgb), 0.26);
}

.confirm-dialog-title {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.confirm-dialog-copy {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.confirm-dialog-message {
  font-size: 14px;
  color: var(--text-soft);
  line-height: 1.6;
  margin: 0;
}

.confirm-dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 20px 20px;
}

.confirm-btn {
  flex: 0 0 auto;
  min-width: 110px;
  padding: 11px 16px;
  border: none;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

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

.confirm-btn:active {
  transform: translateY(0);
}

.confirm-btn-cancel {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--line);
}

.confirm-btn-cancel:hover {
  background: var(--pill);
  color: var(--brand-3);
}

.confirm-btn-danger,
.confirm-btn-warning,
.confirm-btn-info {
  background: var(--confirm-button-bg);
  color: white;
  box-shadow: var(--confirm-button-shadow);
}

.confirm-btn-danger:hover,
.confirm-btn-warning:hover,
.confirm-btn-info:hover {
  background: var(--confirm-button-bg-hover);
  box-shadow: var(--confirm-button-shadow-hover);
}

@media (max-width: 768px) {
  .confirm-overlay {
    align-items: flex-end;
  }

  .confirm-dialog {
    max-width: 100%;
    width: 100%;
    border-radius: 24px 24px 0 0;
    transform: translateY(100%);
    max-height: 85vh;
    box-shadow: 0 -18px 48px rgba(15, 23, 42, 0.16);
  }

  .confirm-visible .confirm-dialog {
    transform: translateY(0);
  }

  .confirm-closing .confirm-dialog {
    transform: translateY(100%);
  }

  .confirm-dialog-body {
    padding: 22px 20px 18px;
  }

  .confirm-dialog-footer {
    flex-direction: column;
    padding: 0 20px 32px;
  }

  .confirm-btn {
    width: 100%;
    min-width: 0;
    padding: 14px 20px;
    font-size: 16px;
  }

  .confirm-btn-cancel {
    order: 2;
  }

  .confirm-btn-danger,
  .confirm-btn-warning,
  .confirm-btn-info {
    order: 1;
  }
}

/* Topics Page Styles */
.topics-page {
  display: grid;
  gap: 18px;
}

.topic-detail-panel {
  display: grid;
  gap: 18px;
  padding: 22px 24px;
  border-radius: 24px;
  border: 1px solid color-mix(in srgb, var(--brand-2) 14%, var(--line));
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--brand-1) 12%, transparent) 0%, transparent 42%),
    linear-gradient(180deg, color-mix(in srgb, var(--bg-card) 94%, white 6%), color-mix(in srgb, var(--bg-card-2) 88%, white 12%));
}

.topic-detail-view {
  display: grid;
  gap: 18px;
}

.topic-detail-fullscreen {
  width: min(100%, 1520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 28px 36px;
  display: grid;
  align-content: start;
}

.topic-detail-empty {
  width: min(100%, 960px);
}

.topic-detail-hero {
  --topic-detail-hero-progress: 0;
  --topic-detail-copy-progress: 0;
  position: sticky;
  top: 16px;
  z-index: 8;
  align-self: start;
  min-height: auto;
  padding: 28px 32px;
  border-radius: 28px;
  opacity: calc(1 - var(--topic-detail-hero-progress));
  transform: translateY(calc(var(--topic-detail-hero-progress) * -18px)) scale(calc(1 - (var(--topic-detail-hero-progress) * 0.04)));
  transform-origin: top center;
  will-change: opacity, transform;
  transition: opacity 0.2s ease, transform 0.24s ease;
}

.topic-detail-hero.is-hero-collapsed {
  opacity: 0;
  pointer-events: none;
}

.topic-detail-topbar {
  display: grid;
  grid-template-columns: minmax(150px, auto) minmax(0, 1fr) minmax(120px, auto);
  align-items: center;
  gap: 18px;
}

.topic-detail-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.topic-detail-back:hover {
  color: var(--text-main);
}

.topic-detail-count {
  display: inline-flex;
  align-items: center;
  justify-self: end;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--brand-2) 12%, var(--line));
  background: color-mix(in srgb, var(--bg-card) 90%, white 10%);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}

.topic-detail-copy {
  display: grid;
  gap: 10px;
}

.topic-detail-copy-topbar {
  justify-items: center;
  text-align: center;
}

.topic-detail-copy small {
  color: var(--brand-2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.topic-detail-copy h1 {
  font-size: 32px;
  line-height: 1.04;
  letter-spacing: -0.04em;
  color: var(--text-main);
}

.topic-detail-copy p {
  max-width: 980px;
  color: var(--text-soft);
  font-size: 15px;
  line-height: 1.8;
}

.topic-detail-summary {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(240px, 0.8fr);
  gap: 14px;
}

.topic-detail-section-copy {
  display: grid;
  gap: 8px;
}

.topic-detail-section-copy small {
  color: var(--brand-2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.topic-detail-section-copy h2 {
  color: var(--text-main);
  font-size: 24px;
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.topic-detail-summary-block {
  display: grid;
  gap: 10px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  background: color-mix(in srgb, var(--bg-card) 84%, white 16%);
}

.topic-detail-summary-block small {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.topic-detail-summary-block p {
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.7;
}

.topic-posts-panel {
  gap: 18px;
}

.topic-posts-list {
  display: grid;
  gap: 16px;
}

.topic-post-card {
  padding: 22px;
  border-radius: 24px;
}

.topic-post-category {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--brand-1) 10%, transparent);
  color: var(--brand-3);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.topic-post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.topic-post-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--brand-2) 12%, var(--line));
  background: color-mix(in srgb, var(--pill) 74%, transparent);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.topic-post-chip:hover {
  color: var(--brand-3);
  border-color: color-mix(in srgb, var(--brand-2) 18%, var(--line));
}

.topic-posts-empty {
  display: grid;
  gap: 8px;
  padding: 18px 0 6px;
}

.topic-posts-empty strong {
  color: var(--text-main);
  font-size: 16px;
}

.topic-posts-empty p {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.7;
}

.topic-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.topic-tabs .tab-item {
  background: transparent;
  color: var(--text-soft);
  border: 1px solid transparent;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
  text-decoration: none;
  white-space: nowrap;
}

.topic-tabs .tab-item:hover {
  background: color-mix(in srgb, var(--brand-1) 8%, transparent);
  color: var(--brand-3);
}

.topic-tabs .tab-item.active {
  background: color-mix(in srgb, var(--brand-1) 12%, var(--bg-card));
  color: var(--brand-3);
  border-color: color-mix(in srgb, var(--brand-2) 18%, var(--line));
}

.topics-spotlight-block {
  display: grid;
  gap: 14px;
}

.topics-section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 0 4px;
}

.topics-section-heading > div {
  display: grid;
  gap: 6px;
}

.topics-section-heading small {
  color: var(--brand-2);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.topics-section-heading h3 {
  color: var(--text-main);
  font-size: 20px;
  line-height: 1.1;
}

.topics-section-heading p {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.topic-cards {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.9fr);
  grid-auto-rows: minmax(132px, auto);
  gap: 14px;
  margin: 0;
  padding: 0;
}

.topic-card {
  appearance: none;
  display: grid;
  gap: 14px;
  min-height: 220px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  border: 1px solid color-mix(in srgb, white 18%, transparent);
  border-radius: 24px;
  color: white;
  text-align: left;
  text-decoration: none;
  font: inherit;
  box-shadow: 0 20px 36px rgba(15, 23, 42, 0.12);
}

.topic-card-feature {
  grid-row: 1 / span 2;
  min-height: 278px;
}

.topic-card-compact {
  min-height: 132px;
  align-content: start;
  gap: 10px;
}

.topic-card::before {
  content: "";
  position: absolute;
  inset: auto -12% -28% auto;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  pointer-events: none;
}

.topic-card:hover {
  transform: translateY(-2px);
}

.topic-card.is-selected {
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.9),
    0 20px 36px rgba(15, 23, 42, 0.16);
}

.topic-card:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.92);
  outline-offset: 3px;
}

.topic-card-design {
  background: linear-gradient(140deg, var(--palette-secondary-strong) 0%, var(--brand-1) 48%, var(--brand-2) 100%);
}

.topic-card-campus {
  background: linear-gradient(140deg, var(--brand-3) 0%, var(--accent) 62%, var(--accent-strong) 100%);
}

.topic-card-tech {
  background: linear-gradient(140deg, #0f172a 0%, var(--brand-3) 55%, var(--brand-1) 100%);
}

.topic-card-topline {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.topic-card .topic-rank {
  color: rgba(255, 255, 255, 0.92);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.06em;
  line-height: 1;
}

.topic-card-count {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  font-size: 12px;
  font-weight: 700;
}

.topic-card .hashtag {
  color: rgba(255, 255, 255, 0.88);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.topic-card .title {
  color: white;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.topic-card .summary {
  margin-top: auto;
  color: rgba(255, 255, 255, 0.84);
  font-size: 13px;
  line-height: 1.55;
}

.topic-card-compact .title {
  font-size: 18px;
  line-height: 1.1;
}

.topic-card-compact .summary {
  margin-top: 0;
  font-size: 12px;
  line-height: 1.5;
}

.topic-card-footer {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  color: rgba(255, 255, 255, 0.86);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.topics-feed-panel {
  overflow: hidden;
  padding: 0;
}

.topic-list-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
}

.topic-list-copy {
  display: grid;
  gap: 6px;
}

.topic-list-copy h2 {
  font-size: 20px;
  color: var(--text-main);
}

.topic-list-copy p {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
}

.topic-list-controls {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.sort-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.sort-select {
  background: var(--pill);
  color: var(--text-soft);
  border: 1px solid var(--line);
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 13px;
  cursor: pointer;
  outline: none;
}

.sort-select:focus {
  border-color: var(--brand-2);
}

.trend-list {
  display: grid;
}

.trend-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 18px 24px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
}

.trend-item:last-child {
  border-bottom: none;
}

.trend-item:hover {
  background: color-mix(in srgb, var(--brand-1) 5%, transparent);
}

.trend-item.is-selected {
  background: color-mix(in srgb, var(--brand-1) 8%, transparent);
}

.trend-item .rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  padding: 0 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--brand-1) 10%, transparent);
  color: var(--brand-3);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.trend-item .trend-content {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.trend-item .hashtag {
  font-size: 12px;
  font-weight: 700;
  color: var(--brand-2);
}

.trend-item .title {
  color: var(--text-main);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
}

.trend-item .count {
  font-size: 13px;
  color: var(--text-muted);
}

.trend-meta {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid color-mix(in srgb, var(--brand-2) 10%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-card) 92%, white 8%);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.trend-item .trend-arrow {
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.trend-item:hover .trend-arrow {
  opacity: 1;
  transform: translateX(2px);
}

@media (max-width: 1024px) {
  .topic-focus-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "feed";
  }

  .topic-detail-summary {
    grid-template-columns: 1fr;
  }

  .topic-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topic-card-feature {
    grid-column: 1 / -1;
    grid-row: auto;
    min-height: 224px;
  }
}

@media (max-width: 767px) {
  .topic-detail-fullscreen {
    width: 100%;
    min-height: 100svh;
    padding: 16px 16px 24px;
  }

  .topic-focus-layout {
    max-width: none;
  }

  .topic-detail-panel {
    padding: 18px;
  }

  .topic-detail-hero {
    top: max(10px, env(safe-area-inset-top, 0px));
    min-height: auto;
    padding: 14px 14px 12px;
    border-radius: 22px;
    background: color-mix(in srgb, var(--bg-card) 82%, white 18%);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    transform: translateY(calc(var(--topic-detail-hero-progress) * -12px)) scale(calc(1 - (var(--topic-detail-hero-progress) * 0.03)));
  }

  .topic-detail-topbar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 44px;
  }

  .topic-detail-topbar .topic-detail-back {
    position: relative;
    z-index: 2;
    min-height: 36px;
    padding: 0 10px;
  }

  .topic-detail-topbar .topic-detail-count {
    position: relative;
    z-index: 2;
    min-height: 36px;
    padding: 0 10px;
  }

  .topic-detail-copy-topbar {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 1;
    width: min(56vw, 220px);
    gap: 2px;
    opacity: calc(1 - var(--topic-detail-copy-progress));
    transform: translate(-50%, calc(-50% - (var(--topic-detail-copy-progress) * 10px))) scale(calc(1 - (var(--topic-detail-copy-progress) * 0.08)));
    filter: blur(calc(var(--topic-detail-copy-progress) * 4px));
    transform-origin: center center;
    will-change: opacity, transform, filter;
    transition: opacity 0.18s ease, transform 0.22s ease, filter 0.18s ease;
    pointer-events: none;
  }

  .topic-detail-hero.is-copy-collapsed .topic-detail-copy-topbar {
    opacity: 0;
  }

  .topic-detail-copy-topbar small,
  .topic-detail-copy h1 {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .topic-detail-copy-topbar small {
    font-size: 9px;
    letter-spacing: 0.12em;
  }

  .topic-detail-copy-topbar h1 {
    font-size: 15px;
    line-height: 1.2;
  }

  .topic-detail-section-copy h2 {
    font-size: 20px;
  }

  .topic-post-card {
    padding: 18px;
  }

  .topic-post-card .post-head {
    align-items: start;
    flex-direction: column;
  }

  .topics-section-heading {
    align-items: start;
    flex-direction: column;
    padding: 0;
  }

  .topic-cards {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }

  .topic-cards::-webkit-scrollbar {
    display: none;
  }

  .topic-card {
    min-width: min(84vw, 300px);
    min-height: 210px;
    flex: 0 0 auto;
    scroll-snap-align: start;
  }

  .topic-card-feature,
  .topic-card-compact {
    min-height: 210px;
  }

  .topic-card .title {
    font-size: 22px;
  }

  .topic-list-header {
    align-items: start;
    flex-direction: column;
    padding: 18px;
  }

  .topic-list-controls {
    width: 100%;
    justify-content: space-between;
  }

  .trend-item {
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding: 16px 18px;
  }

  .trend-meta {
    display: none;
  }

  .trend-item .trend-arrow {
    opacity: 1;
  }
}

/* Topics page workspace refresh */
.topic-panel-search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--brand-2) 14%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg-card) 84%, white 16%);
  color: var(--text-muted);
}

.topic-panel-search:focus-within {
  border-color: color-mix(in srgb, var(--brand-2) 36%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-2) 10%, transparent);
}

.topic-panel-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-main);
  font: inherit;
  font-size: 13px;
}

body.page-topics .topic-filter-rightbar {
  display: grid;
  gap: 16px;
  align-content: start;
  padding: 18px;
}

.topic-panel-tools {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.topic-panel-section {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding-bottom: 14px;
  border-bottom: 1px solid color-mix(in srgb, var(--brand-2) 10%, var(--line));
}

.topic-panel-section:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.topic-panel-heading {
  display: grid;
  gap: 3px;
}

.topic-panel-heading small {
  color: var(--brand-2);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.topic-panel-heading strong {
  color: var(--text-main);
  font-size: 15px;
  line-height: 1.25;
}

.topic-filter-rightbar .topic-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}

.topic-filter-rightbar .topic-tabs .tab-item {
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border-radius: 8px;
  border-color: color-mix(in srgb, var(--brand-2) 12%, var(--line));
  background: color-mix(in srgb, var(--bg-card) 76%, white 24%);
}

.topic-filter-rightbar .topic-tabs .tab-item.active {
  border-color: color-mix(in srgb, var(--brand-2) 24%, var(--line));
  background: color-mix(in srgb, var(--brand-2) 12%, var(--bg-card));
}

.topic-filter-rightbar .topic-panel-search {
  width: 100%;
}

.topic-filter-rightbar .topic-sort {
  width: 100%;
}

.topic-filter-rightbar .rightbar-tags {
  margin-bottom: 0;
}

.topic-filter-rightbar .rightbar-category-item {
  cursor: pointer;
}

.topics-page {
  gap: 20px;
  min-width: 0;
}

.topics-section-heading small {
  color: var(--brand-2);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.topics-section-heading p {
  max-width: 560px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

.topics-section-heading {
  align-items: end;
  padding: 0 2px;
}

.topics-section-heading h3,
.topic-list-copy h2 {
  margin: 0;
  color: var(--text-main);
  font-size: 19px;
  line-height: 1.15;
  letter-spacing: 0;
}

.topic-cards {
  grid-template-columns: minmax(0, 1.15fr) minmax(230px, 0.85fr);
  gap: 12px;
}

.topic-card {
  min-height: 206px;
  padding: 18px;
  border-radius: 8px;
  box-shadow: none;
  transition: transform 0.18s ease, border-color 0.18s ease, filter 0.18s ease;
}

.topic-card::before {
  inset: auto 18px 18px auto;
  width: 54px;
  height: 2px;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.42);
}

.topic-card:hover {
  filter: brightness(1.03);
}

.topic-card-feature {
  min-height: 264px;
}

.topic-card-compact {
  min-height: 126px;
}

.topic-card .topic-rank,
.topic-card .title,
.topic-card .hashtag,
.topic-card-footer {
  letter-spacing: 0;
}

.topic-card .title {
  font-size: 23px;
  line-height: 1.12;
}

.topic-card-compact .title {
  font-size: 17px;
}

.topic-card .summary {
  font-size: 13px;
  line-height: 1.55;
}

.topics-feed-panel {
  border: 1px solid color-mix(in srgb, var(--brand-2) 12%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg-card) 86%, white 14%);
  box-shadow: none;
}

.topic-list-header {
  align-items: center;
  padding: 18px 20px;
}

.topic-list-copy {
  min-width: 0;
}

.topic-list-copy p {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
}

.sort-select {
  min-height: 38px;
  border-radius: 8px;
}

.trend-item {
  min-height: 76px;
  padding: 15px 20px;
}

.trend-item .rank {
  min-width: 38px;
  min-height: 38px;
  border-radius: 8px;
  letter-spacing: 0;
}

.trend-item .title {
  font-size: 15px;
  line-height: 1.35;
}

.trend-meta {
  border-radius: 8px;
}

.topics-empty-inline,
.topics-empty-state {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 28px 18px;
  border: 1px dashed color-mix(in srgb, var(--brand-2) 18%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg-card) 74%, white 26%);
  color: var(--text-muted);
  text-align: center;
}

.topics-empty-state[hidden] {
  display: none;
}

.topics-empty-state i {
  color: var(--brand-2);
  font-size: 24px;
}

.topics-empty-state strong {
  color: var(--text-main);
  font-size: 15px;
}

.topics-empty-state span {
  font-size: 13px;
}

@media (min-width: 1760px) {
  body.page-topics .topics-page {
    gap: 22px;
  }
}

@media (max-width: 1099px) {
  .topic-panel-search {
    max-width: none;
  }
}

@media (max-width: 767px) {
  .page-topics .topbar {
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas: "brand compose actions";
    row-gap: 0;
  }

  .topic-panel-search {
    min-height: 40px;
  }

  .topics-page {
    gap: 16px;
    padding-bottom: 2px;
  }

  .topics-section-heading {
    align-items: start;
    flex-direction: column;
    gap: 8px;
    padding: 0;
  }

  .topic-card {
    min-width: min(82vw, 312px);
    min-height: 196px;
    border-radius: 8px;
  }

  .topic-card-feature,
  .topic-card-compact {
    min-height: 196px;
  }

  .topic-card .title {
    font-size: 21px;
  }

  .topic-list-header {
    align-items: start;
    flex-direction: column;
    padding: 16px;
  }

  .topic-list-controls {
    width: 100%;
  }

  .sort-select {
    flex: 1;
    min-width: 0;
  }

  .trend-item {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 11px;
    min-height: 72px;
    padding: 14px 16px;
  }

  .trend-item .trend-arrow {
    opacity: 1;
  }
}

.room-tabs-wrapper {
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--bg-card-2);
}

.room-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.room-tabs .tab-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--pill);
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--line);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.room-tabs .tab-item:hover {
  background: color-mix(in srgb, var(--brand-1) 15%, var(--pill));
  color: var(--brand-3);
}

.room-tabs .tab-item.active {
  background: var(--hero);
  color: white;
  border-color: transparent;
}

.room-tabs .tab-item i {
  font-size: 14px;
}

.room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding: 0 0 20px 0;
}

.room-card {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 20px;
  border: 1px solid var(--line);
  transition: all 0.2s ease;
}

.room-card:hover {
  border-color: var(--brand-1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.room-type {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
}

.room-type.live {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

.room-type.voice {
  background: rgba(168, 85, 247, 0.12);
  color: #a855f7;
}

.room-type.text {
  background: rgba(34, 197, 94, 0.12);
  color: #22c55e;
}

.room-type i {
  font-size: 12px;
}

.room-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 8px 0;
}

.room-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0 0 16px 0;
  line-height: 1.5;
}

.room-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.room-creator {
  display: flex;
  align-items: center;
  gap: 8px;
}

.room-creator .avatar-initial {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand-1);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}

.room-creator span {
  font-size: 13px;
  color: var(--text-soft);
}

.room-count {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.room-count i {
  font-size: 14px;
}

.room-join-btn {
  width: 100%;
  padding: 12px !important;
  font-size: 14px !important;
  text-align: center;
}

@media (max-width: 600px) {
  .room-grid {
    grid-template-columns: 1fr;
  }
}

/* Room modal */
.room-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.room-modal-content {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 24px;
  width: 90%;
  max-width: 440px;
}

.room-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.room-modal-header h2 {
  font-size: 20px;
  color: var(--text-main);
  margin: 0;
}

.room-modal-label {
  display: block;
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 8px;
}

.room-modal-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 16px;
  background: var(--bg-card-2);
  color: var(--text-main);
}

.room-modal-input:focus {
  outline: none;
  border-color: var(--brand-1);
}

.room-modal-textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 16px;
  background: var(--bg-card-2);
  color: var(--text-main);
  resize: none;
}

.room-modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* Room type buttons */
.room-type-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--bg-card-2);
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.room-type-btn i {
  font-size: 20px;
}

.room-type-btn:hover {
  border-color: var(--brand-1);
  color: var(--text-main);
}

.room-type-btn.active {
  border-color: var(--brand-1);
  background: color-mix(in srgb, var(--brand-1) 10%, transparent);
  color: var(--brand-1);
}

/* Room card joined state */
.room-card.joined {
  cursor: pointer;
}

.room-card.joined:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.room-card.joined .room-info::after {
  content: '點擊進入';
  position: absolute;
  right: 0;
  bottom: 0;
  font-size: 12px;
  color: var(--brand-1);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.room-card.joined:hover .room-info::after {
  opacity: 1;
}

.room-join-btn.joined-btn {
  background: rgba(34, 197, 94, 0.12);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3);
  box-shadow: none;
}

.room-join-btn.joined-btn:hover {
  background: rgba(34, 197, 94, 0.2);
  border-color: rgba(34, 197, 94, 0.5);
}

.room-info {
  position: relative;
}

/* Room page header */
.room-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.room-page-header h2 {
  font-size: 24px;
  color: var(--text-main);
}

/* Room empty state */
.room-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.room-empty p {
  margin: 0;
}

.room-empty .primary-btn {
  display: inline-block;
  margin-top: 16px;
}

.room-avatar-img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Post Stats - Bubble Style */
.panel.post .bubble-stats {
  display: flex;
  gap: 8px;
  padding: 12px 0 0;
  border-top: 1px solid var(--line);
  margin-top: 16px;
}

.stat-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  justify-content: center;
  background: color-mix(in srgb, var(--pill) 48%, transparent);
  border: 1px solid color-mix(in srgb, var(--line) 84%, transparent);
  border-radius: 16px;
  font-size: 13px;
  color: var(--text-soft);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.stat-btn:hover {
  background: color-mix(in srgb, var(--pill) 84%, transparent);
  border-color: color-mix(in srgb, var(--brand-1) 30%, var(--line));
  color: var(--text-main);
  transform: translateY(-1px);
}

.stat-btn.like-btn:hover,
.stat-btn.like-btn.active {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(var(--palette-accent-rgb), 0.1);
}

.stat-btn.like-btn.active i {
  animation: heartBeat 0.3s ease;
}

.stat-btn.comment-btn:hover {
  color: #3b82f6;
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
}

.stat-btn.share-btn:hover {
  color: #10b981;
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.1);
}

.panel.post .thread-actions {
  align-items: center;
  gap: 4px;
  padding-top: 10px;
  border-top: 0;
  margin-top: 12px;
}

.panel.post .thread-action-btn {
  width: auto;
  min-width: 36px;
  min-height: 36px;
  padding: 0 8px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-main);
  font-size: 14px;
  gap: 6px;
  transform: none;
}

.panel.post .thread-action-btn i {
  width: 18px;
  font-size: 17px;
  line-height: 1;
  text-align: center;
}

.panel.post .thread-action-count {
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1;
}

.panel.post .thread-action-btn:hover {
  border-color: transparent;
  background: color-mix(in srgb, var(--text-main) 8%, transparent);
  color: var(--text-main);
  transform: none;
}

.panel.post .thread-action-btn:hover .thread-action-count {
  color: var(--text-main);
}

.panel.post .thread-action-btn.like-btn.active,
.panel.post .thread-action-btn.like-btn:hover {
  border-color: transparent;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent);
}

.panel.post .thread-action-btn.like-btn.active .thread-action-count,
.panel.post .thread-action-btn.like-btn:hover .thread-action-count {
  color: var(--accent);
}

.panel.post .thread-action-btn.comment-btn:hover,
.panel.post .thread-action-btn.share-btn:hover {
  border-color: transparent;
  background: color-mix(in srgb, var(--text-main) 8%, transparent);
  color: var(--text-main);
}

@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}

/* Post Head Actions */
.post-head-actions {
  position: relative;
}

.post-head-actions .actions-trigger {
  width: 32px;
  height: 32px;
  border: 1px solid color-mix(in srgb, var(--line) 84%, transparent);
  background: color-mix(in srgb, var(--bg-card-2) 78%, transparent);
  border-radius: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.post-head-actions .actions-trigger:hover {
  background: color-mix(in srgb, var(--pill) 80%, transparent);
  color: var(--text-main);
  border-color: color-mix(in srgb, var(--brand-2) 24%, var(--line));
}

.actions-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px;
  min-width: 150px;
  box-shadow: var(--shadow);
  z-index: 100;
}
html.dark .actions-menu {
  background: #1e293b;
}

.actions-menu.show {
  display: block;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.actions-menu a,
.actions-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  background: none;
  border: none;
  color: var(--text-soft);
  font-size: 14px;
  cursor: pointer;
  border-radius: 10px;
  transition: background 0.2s ease;
  text-decoration: none;
}

.actions-menu a:hover,
.actions-menu button:hover {
  background: rgba(var(--palette-secondary-rgb), 0.1);
}

.actions-menu .delete-action {
  color: var(--accent);
}

.actions-menu .delete-action:hover {
  background: rgba(var(--palette-accent-rgb), 0.1);
}

.actions-menu [data-action="bookmark"].active {
  color: var(--brand-2);
}

/* Quick Comment */

  display: flex;
  gap: 10px;
}

.quick-comment-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--bg-card-2);
  color: var(--text-main);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
}

.quick-comment-input::placeholder {
  color: var(--text-muted);
}

.quick-comment-input:focus {
  border-color: var(--brand-2);
}

.quick-comment-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--brand);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quick-comment-btn:hover {
  transform: scale(1.05);
}

.quick-comment-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.quick-comment-btn i {
  color: #1e40af;
  font-size: 16px;
}

html.dark .quick-comment-btn i {
  color: #e0f2fe;
}

html.dark .quick-comment-btn {
  border-color: rgba(255, 255, 255, 0.15);
}

/* Likes Modal */
.likes-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.likes-modal .modal-content {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 20px;
  width: 90%;
  max-width: 400px;
  max-height: 500px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.likes-modal .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.likes-modal .modal-header h3 {
  font-size: 18px;
  color: var(--text-main);
}

.likes-modal .modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--pill);
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.likes-modal .modal-body {
  max-height: 400px;
  overflow-y: auto;
}

.likes-list .like-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  transition: background 0.2s ease;
}

.likes-list .like-user:hover {
  background: var(--pill);
}

.likes-list .like-user:last-child {
  border-bottom: none;
}

.likes-list .like-user .avatar {
  width: 44px;
  height: 44px;
  font-size: 18px;
}

.likes-list .like-user .user-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-main);
}

.likes-list .empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}

/* ===================================
   Composer Component
   =================================== */

@keyframes composer-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.composer {
  position: relative;
  border-radius: 30px;
  overflow: hidden;
}

.composer > * {
  position: relative;
  z-index: 1;
  animation: composer-rise 0.45s ease both;
}

.composer .composer-form {
  display: grid;
  gap: 22px;
}

.composer .composer-panel-tools {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 3;
}

.feed-search-status {
  display: none;
  align-items: center;
  width: fit-content;
  max-width: calc(100% - 8px);
  margin: 4px 4px 16px;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--brand-2) 16%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--pill) 84%, transparent);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: normal;
  overflow-wrap: normal;
}

.feed-search-status:not(:empty) {
  display: inline-flex;
}

.feed-search-empty .post-text {
  text-align: center;
  padding: 12px 8px;
  color: var(--text-muted);
}

.feed-search-empty .post-text strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text-main);
}

.feed-search-empty .post-text p {
  margin: 0;
}

.composer .composer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.composer .composer-user {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.composer .composer-avatar {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  border: 1px solid color-mix(in srgb, var(--brand-2) 14%, var(--line));
  object-fit: cover;
  box-shadow: 0 14px 28px rgba(var(--palette-primary-rgb), 0.1);
}

.composer .composer-avatar.avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.24), rgba(96, 165, 250, 0.32));
  color: var(--brand-3);
  font-size: 20px;
  font-weight: 700;
}

.composer .composer-user-info {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.composer .composer-username {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.composer .composer-header-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.composer .composer-status-pill,
.composer .composer-media-limit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 7px 12px;
  border: 1px solid color-mix(in srgb, var(--brand-2) 14%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--pill) 84%, rgba(255, 255, 255, 0.1));
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
}

.composer .composer-status-pill i,
.composer .composer-media-limit i {
  color: var(--brand-2);
}

.composer .composer-expand-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--pill) 68%, rgba(255, 255, 255, 0.08));
  color: var(--text-soft);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.composer .composer-expand-btn:hover {
  transform: translateY(-1px);
  background: color-mix(in srgb, var(--brand-1) 10%, var(--pill));
  color: var(--brand-3);
}

.composer .composer-expand-btn i {
  color: var(--brand-2);
  font-size: 12px;
}

.composer .composer-stage {
  display: grid;
  gap: 20px;
  align-items: start;
}

.composer .composer-stage-main {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.composer .composer-stage-actions {
  padding-top: 18px;
  border-top: 1px solid color-mix(in srgb, var(--brand-2) 10%, var(--line));
}

.composer .composer-textarea-wrapper {
  border: 1px solid color-mix(in srgb, var(--brand-2) 12%, var(--line));
  border-radius: 24px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg-card) 92%, white 8%), color-mix(in srgb, var(--bg-card-2) 96%, white 4%));
}

.composer .composer-textarea-wrapper {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.composer .composer-textarea {
  width: 100%;
  min-height: 188px;
  padding: 0;
  border: 0;
  border-radius: 0;
  resize: none;
  outline: none;
  background: transparent;
  color: var(--text-main);
  font-size: 15px;
  line-height: 1.85;
}

.composer .composer-textarea::placeholder {
  color: var(--text-muted);
}

/* 收合狀態：只留頭像＋名稱＋單行輸入，點擊／聚焦才展開 */
.composer.composer-collapsed { cursor: text; }
.composer.composer-collapsed .composer-panel-tools,
.composer.composer-collapsed .composer-header-status,
.composer.composer-collapsed .composer-textarea-footer,
.composer.composer-collapsed .composer-media,
.composer.composer-collapsed .composer-stage-actions {
  display: none !important;
}
.composer.composer-collapsed .composer-textarea {
  min-height: 28px;
  line-height: 1.6;
}

.composer .composer-textarea-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid color-mix(in srgb, var(--brand-2) 10%, var(--line));
}

.composer .toolbar-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.composer .composer-topic-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.composer .composer-topic-status[hidden] {
  display: none !important;
}

.composer .composer-status-pill-topic [data-topic-status-text] {
  font-size: inherit;
  font-weight: inherit;
}

.composer-topic-sheet-panel .remove-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: currentColor;
  cursor: pointer;
  opacity: 0.82;
}

.composer-topic-sheet-panel .remove-tag:hover {
  opacity: 1;
  background: color-mix(in srgb, currentColor 12%, transparent);
}

.composer .tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid color-mix(in srgb, var(--brand-2) 12%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--pill) 84%, rgba(255, 255, 255, 0.1));
  color: var(--brand-3);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.composer .tool-btn:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--brand-2) 24%, var(--line));
  background: color-mix(in srgb, var(--brand-1) 10%, var(--pill));
}

.composer .tool-btn.active {
  background: var(--hero);
  color: white;
  border-color: transparent;
}

.composer .tool-btn[data-tool="tag"].active {
  background: color-mix(in srgb, var(--brand-1) 12%, var(--pill));
  border-color: color-mix(in srgb, var(--brand-2) 20%, var(--line));
  color: var(--brand-3);
}

.composer .tool-btn i {
  font-size: 14px;
}

.composer .tool-btn .tool-label {
  display: inline;
}

.composer .char-counter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--brand-2) 14%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--pill) 84%, rgba(255, 255, 255, 0.08));
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.composer .char-counter .char-divider {
  margin: 0 2px;
}

.composer .char-counter[data-warning="true"] {
  color: #f59e0b;
}

.composer .char-counter[data-error="true"] {
  color: #ef4444;
}


.composer .visibility-selector {
  position: relative;
}

.composer .composer-header-status .visibility-selector {
  min-width: 0;
}

.composer .visibility-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--brand-2) 12%, var(--line));
  border-radius: 16px;
  background: color-mix(in srgb, var(--bg-card-2) 90%, rgba(255, 255, 255, 0.08));
  color: var(--text-soft);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.composer .composer-header-status .visibility-btn {
  width: auto;
  min-width: 0;
  min-height: 32px;
  padding: 7px 12px;
  border-radius: 999px;
  border-color: color-mix(in srgb, var(--brand-2) 14%, var(--line));
  background: color-mix(in srgb, var(--pill) 84%, rgba(255, 255, 255, 0.1));
  font-size: 12px;
  font-weight: 600;
}

.composer .visibility-btn:hover {
  border-color: color-mix(in srgb, var(--brand-2) 24%, var(--line));
}

.composer .composer-header-status .visibility-btn > i {
  color: var(--brand-2);
  font-size: 12px;
}

.composer .visibility-btn [data-hugeicon="caretDown"] {
  transition: transform 0.18s ease;
}

.composer .visibility-btn.open [data-hugeicon="caretDown"] {
  transform: rotate(180deg);
}

.composer .visibility-btn span {
  flex: 1;
  text-align: left;
}

.composer .visibility-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 100%;
  min-width: 0;
  padding: 4px;
  border: 1px solid color-mix(in srgb, var(--brand-2) 12%, var(--line));
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.1);
  display: none;
  z-index: 100;
}

html.dark .composer .visibility-dropdown {
  background: #0f172a;
  border-color: rgba(56, 189, 248, 0.18);
  box-shadow: 0 12px 24px rgba(2, 8, 23, 0.34);
}

.composer .composer-header-status .visibility-dropdown {
  width: 184px;
  min-width: 184px;
}

.composer .visibility-dropdown.show {
  display: grid;
  gap: 0;
}

.composer .visibility-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.composer .visibility-option + .visibility-option {
  border-top: 1px solid color-mix(in srgb, var(--brand-2) 10%, var(--line));
}

.composer .visibility-option:hover {
  background: #f3faff;
}

.composer .visibility-option.active {
  border-color: transparent;
  background: transparent;
}

html.dark .composer .visibility-option:hover {
  background: #162033;
}

.composer .visibility-option i {
  width: 14px;
  font-size: 12px;
  color: var(--text-muted);
}

.composer .option-title {
  flex: 1;
  color: var(--text-main);
  font-size: 12px;
  font-weight: 600;
}

.composer .visibility-option.active i,
.composer .visibility-option.active .option-title {
  color: var(--brand-3);
}

.composer .visibility-option.active::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--brand-2);
}

.composer .composer-media {
  margin: 0;
  display: grid;
  gap: 14px;
  padding-top: 14px;
  border-top: 1px solid color-mix(in srgb, var(--brand-2) 10%, var(--line));
}

.composer .media-dropzone {
  border: 1px dashed color-mix(in srgb, var(--brand-2) 22%, var(--line));
  border-radius: 18px;
  padding: 28px 22px;
  background: color-mix(in srgb, var(--pill) 58%, transparent);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.composer .media-dropzone:hover,
.composer .media-dropzone.dragover {
  transform: translateY(-1px);
  border-color: var(--brand-2);
  background: color-mix(in srgb, var(--brand-1) 8%, var(--pill));
}

.composer .dropzone-content {
  color: var(--text-muted);
}

.composer .dropzone-content i {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--brand-2);
  font-size: 34px;
}

.composer .dropzone-content p {
  margin-bottom: 4px;
  color: var(--text-main);
  font-size: 14px;
  font-weight: 600;
}

.composer .dropzone-hint {
  font-size: 12px;
}

.composer .media-input {
  display: none;
}

.composer .media-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
}

.composer .media-preview-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
}

.composer .media-preview-item img,
.composer .media-preview-item video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.composer .media-preview-item .preview-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.62);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.composer .media-preview-item:hover .preview-remove {
  opacity: 1;
}

.composer .media-url-input {
  display: flex;
  gap: 8px;
}

.composer .url-input {
  flex: 1;
  min-width: 0;
  padding: 12px 16px;
  border: 1px solid color-mix(in srgb, var(--brand-2) 12%, var(--line));
  border-radius: 16px;
  background: color-mix(in srgb, var(--bg-card-2) 90%, rgba(255, 255, 255, 0.06));
  color: var(--text-main);
  font-size: 13px;
  outline: none;
}

.composer .url-input:focus {
  border-color: color-mix(in srgb, var(--brand-2) 28%, var(--line));
}

.composer .url-add-btn {
  width: 44px;
  height: 44px;
  border: 1px solid color-mix(in srgb, var(--brand-2) 12%, var(--line));
  border-radius: 16px;
  background: color-mix(in srgb, var(--pill) 82%, rgba(255, 255, 255, 0.08));
  color: var(--brand-2);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.composer .url-add-btn:hover {
  transform: translateY(-1px);
  background: var(--brand-2);
  color: white;
}

.composer .composer-submit-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  width: 100%;
  gap: 12px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.composer .submit-btn {
  width: auto;
  min-width: 168px;
  min-height: 50px;
  padding: 12px 20px;
  border-radius: 18px;
  font-size: 14px;
  font-weight: 700;
}

.composer .submit-btn i {
  margin-right: 8px;
}

.composer .submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.composer-topic-sheet-overlay {
  z-index: 100100;
  padding: 0 clamp(14px, 2.4vw, 28px) clamp(14px, 2.8vh, 28px);
}

.composer-topic-sheet-overlay .bottom-sheet {
  width: min(100%, 720px);
  max-width: 720px;
  min-height: 0;
  max-height: min(72svh, 640px);
  top: 50%;
  bottom: auto;
  border-radius: 28px;
  box-shadow: 0 -18px 48px rgba(15, 23, 42, 0.16);
}

html.dark .composer-topic-sheet-overlay .bottom-sheet {
  background: #0f172a;
  box-shadow: 0 -20px 54px rgba(2, 8, 23, 0.4);
}

@media (min-width: 768px) {
  .composer-topic-sheet-shell.bottom-sheet-animate {
    animation: composer-topic-sheet-center-in 0.28s ease-out forwards;
  }
}

.composer-topic-sheet-content {
  min-height: 0;
  padding: 0;
}

.composer-topic-sheet-panel {
  display: grid;
  gap: 18px;
  min-height: 0;
  padding: 18px clamp(18px, 3vw, 32px) calc(24px + env(safe-area-inset-bottom, 0px));
}

.composer-topic-sheet-panel .tag-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.composer-topic-sheet-panel .tag-modal-heading {
  display: grid;
  gap: 6px;
}

.composer-topic-sheet-panel .tag-modal-heading small {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brand-2);
}

.composer-topic-sheet-panel .tag-modal-heading small::before {
  content: "";
  width: 16px;
  height: 1px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.48;
}

.composer-topic-sheet-panel .tag-modal-header h4 {
  color: var(--text-main);
  font-size: 24px;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.composer-topic-sheet-panel .tag-modal-heading p {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.6;
}

.composer-topic-sheet-panel .tag-modal-body {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 0;
  overflow-y: auto;
}

.composer-topic-sheet-panel .tag-search-shell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid color-mix(in srgb, var(--brand-2) 12%, var(--line));
  border-radius: 16px;
  background: color-mix(in srgb, var(--bg-card-2) 90%, rgba(255, 255, 255, 0.06));
}

.composer-topic-sheet-panel .tag-search-shell i {
  color: var(--text-muted);
  font-size: 14px;
}

.composer-topic-sheet-panel .tag-search {
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-main);
  font-size: 14px;
  outline: none;
}

.composer-topic-sheet-panel .tag-search-shell:focus-within {
  border-color: color-mix(in srgb, var(--brand-2) 28%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-1) 10%, transparent);
}

.composer-topic-sheet-panel .tag-list,
.composer-topic-sheet-panel .selected-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.composer-topic-sheet-panel .tag-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  max-height: none;
  overflow: visible;
}

.composer-topic-sheet-panel .tag-item,
.composer-topic-sheet-panel .selected-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 600;
}

.composer-topic-sheet-panel .tag-item {
  width: 100%;
  border: 1px solid color-mix(in srgb, var(--brand-2) 12%, var(--line));
  background: color-mix(in srgb, var(--pill) 84%, rgba(255, 255, 255, 0.1));
  color: var(--text-soft);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.composer-topic-sheet-panel .tag-item:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--brand-2) 24%, var(--line));
  color: var(--brand-2);
  background: color-mix(in srgb, var(--brand-1) 10%, var(--pill));
}

.composer-topic-sheet-panel .tag-item.selected,
.composer-topic-sheet-panel .selected-tag {
  border-color: color-mix(in srgb, var(--brand-2) 18%, var(--line));
  background: color-mix(in srgb, var(--brand-1) 12%, var(--pill));
  color: var(--brand-3);
}

.composer-topic-sheet-panel .selected-tags {
  min-height: 0;
}

.composer-topic-sheet-panel .selected-tags:empty {
  display: none;
}

.composer-topic-sheet-panel .selected-tag {
  justify-content: flex-start;
}

@keyframes composer-topic-sheet-center-in {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 28px)) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes composer-expand-sheet-center-in {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 24px)) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.composer-expand-sheet-overlay {
  z-index: 100000;
  padding: 0 clamp(16px, 2.4vw, 28px) clamp(16px, 3vh, 28px);
}

.composer-expand-sheet-shell.bottom-sheet {
  width: min(100%, 980px);
  max-width: 980px;
  min-height: 0;
  max-height: min(90svh, 920px);
  top: 50%;
  bottom: auto;
  border-radius: 30px;
  box-shadow: 0 28px 72px rgba(15, 23, 42, 0.2);
}

html.dark .composer-expand-sheet-shell.bottom-sheet {
  background: #0f172a;
  box-shadow: 0 28px 72px rgba(2, 8, 23, 0.52);
}

@media (min-width: 768px) {
  .composer-expand-sheet-shell.bottom-sheet-animate {
    animation: composer-expand-sheet-center-in 0.28s ease-out forwards;
  }
}

.composer-expand-sheet-content {
  min-height: 0;
  padding: 14px 14px calc(18px + env(safe-area-inset-bottom, 0px));
}

.composer-expand-sheet-panel {
  min-height: 0;
}

.composer-sheet-shell {
  margin: 0;
}

.composer-sheet-shell .composer-expand-btn {
  display: none;
}

body.composer-expand-open .composer.composer-is-expanded {
  visibility: hidden;
  pointer-events: none;
}

.composer-publisher {
  border: 1px solid color-mix(in srgb, var(--brand-2) 20%, var(--line));
  background: radial-gradient(circle at top right, color-mix(in srgb, var(--brand-1) 14%, transparent) 0%, transparent 36%), linear-gradient(180deg, color-mix(in srgb, var(--bg-card) 95%, white 5%) 0%, color-mix(in srgb, var(--bg-card-2) 94%, rgba(255, 255, 255, 0.42)) 100%);
  box-shadow: 0 24px 52px rgba(148, 163, 184, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.62);
}

.composer-publisher::after {
  content: "";
  position: absolute;
  top: 0;
  left: 22px;
  right: 22px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.84), transparent);
  pointer-events: none;
}

html.dark .composer-publisher {
  border-color: rgba(56, 189, 248, 0.18);
  background: radial-gradient(circle at top right, rgba(8, 145, 178, 0.18) 0%, transparent 38%), linear-gradient(180deg, rgba(15, 23, 42, 0.94) 0%, rgba(30, 41, 59, 0.92) 100%);
  box-shadow: 0 24px 52px rgba(2, 6, 23, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.composer-publisher .composer-header {
  padding-bottom: 18px;
  border-bottom: 1px solid color-mix(in srgb, var(--brand-2) 12%, var(--line));
}

.composer-publisher:not(.composer-sheet-shell) .composer-header {
  padding-right: 52px;
}

@media (max-width: 1100px) {
  .composer .composer-stage {
    gap: 18px;
  }


  .composer .submit-btn {
    width: auto;
    min-width: 168px;
    flex: 0 0 auto;
  }
}

@media (max-width: 767px) {
  .composer {
    border-radius: 24px;
  }

  .composer .composer-panel-tools {
    top: 14px;
    right: 14px;
  }

  .composer-publisher:not(.composer-sheet-shell) .composer-header {
    padding-right: 44px;
  }

  .composer .composer-header {
    flex-direction: column;
    align-items: flex-start;
  }

  /* footer 仍維持橫向：工具列靠左、字數計數靠右，工具列不夠寬時自行換行 */
  .composer .composer-textarea-footer {
    flex-wrap: wrap;
  }
  .composer .composer-textarea-footer .char-counter {
    margin-left: auto;
  }

  .composer .composer-header-status {
    justify-content: flex-start;
  }

  .composer .composer-header-status .visibility-selector {
    min-width: 0;
  }

  .composer .composer-header-status .visibility-btn {
    width: 100%;
    min-width: 0;
  }

  .composer .composer-header-status .visibility-dropdown {
    width: 100%;
    min-width: 0;
  }

  .composer .composer-textarea-wrapper {
    padding: 14px;
    border-radius: 18px;
  }

  .composer-topic-sheet-overlay {
    padding: 0 16px 16px;
  }

  .composer-topic-sheet-overlay .bottom-sheet {
    width: min(100%, 640px);
    max-width: 640px;
    max-height: min(74svh, 580px);
    top: 50%;
    bottom: auto;
    border-radius: 24px;
  }

  .composer-topic-sheet-panel {
    padding: 18px;
  }

  .composer-topic-sheet-panel .tag-modal-header h4 {
    font-size: 22px;
  }

  .composer-topic-sheet-panel .tag-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .composer-expand-sheet-overlay {
    padding: 0;
  }

  .composer-expand-sheet-shell.bottom-sheet {
    width: 100%;
    max-width: none;
    max-height: min(100svh, 860px);
    top: auto;
    bottom: 0;
    border-radius: 24px 24px 0 0;
  }

  .composer-expand-sheet-content {
    padding: 10px 10px calc(16px + env(safe-area-inset-bottom, 0px));
  }

  .composer-sheet-shell {
    border-radius: 22px;
  }

  .composer .composer-stage-actions {
    padding-top: 12px;
  }

  .composer .composer-submit-wrapper {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    border-radius: 0;
  }


  .composer .submit-btn {
    width: 100%;
    min-width: 0;
  }

  .composer .composer-textarea {
    min-height: 148px;
  }

  .composer .tool-btn .tool-label {
    display: none;
  }

  .composer .media-url-input {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .composer-publisher::after {
    left: 16px;
    right: 16px;
  }
}

@media (max-width: 767px) {
  .composer-topic-sheet-overlay {
    padding: 0;
  }

  .composer-topic-sheet-overlay .bottom-sheet {
    width: 100%;
    max-width: none;
    max-height: min(82svh, 720px);
    top: auto;
    bottom: 0;
    border-radius: 24px 24px 0 0;
  }

  .composer-expand-sheet-overlay {
    padding: 0;
  }

  .composer-expand-sheet-shell.bottom-sheet {
    width: 100%;
    max-width: none;
    max-height: min(100svh, 860px);
    top: auto;
    bottom: 0;
    border-radius: 24px 24px 0 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .composer > *,
  .composer .composer-expand-btn,
  .composer .tool-btn,
  .composer .media-dropzone,
  .composer .url-add-btn,
  .composer .modal-close {
    animation: none;
    transition: none;
  }
}


/* ============================================
   Bottom Sheet Modal - Settings (Alpine.js)
   ============================================ */

.bottom-sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
}

.bottom-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1;
}

.bottom-sheet {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 100%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.2);
  max-height: 85vh;
  overflow: hidden;
  z-index: 10;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  touch-action: none;
}
html.dark .bottom-sheet {
  background: #1e293b;
}

.translate-y-full {
  transform: translateX(-50%) translateY(100%) !important;
}
.translate-y-0 {
  transform: translateX(-50%) translateY(0) !important;
}

@keyframes slideUp {
  from { transform: translateX(-50%) translateY(100%); }
  to { transform: translateX(-50%) translateY(0); }
}
@keyframes slideDown {
  from { transform: translateX(-50%) translateY(0); }
  to { transform: translateX(-50%) translateY(100%); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

.overlay-animate {
  animation: fadeIn 0.3s ease-out forwards;
}
.overlay-close-animate {
  animation: fadeOut 0.2s ease-in forwards;
}

#avatarLightbox {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

#avatarLightbox.active {
  opacity: 1;
  visibility: visible;
}

#avatarLightbox .lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
}

#avatarLightbox .lightbox-card {
  position: relative;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
}

#avatarLightbox .lightbox-avatar-wrapper {
  width: 320px;
  height: 320px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid rgba(255,255,255,0.2);
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}

#avatarLightbox .lightbox-avatar-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#avatarLightbox .lightbox-username {
  margin-top: 16px;
  color: white;
  font-size: 1.125rem;
  font-weight: 600;
  text-align: center;
}

#avatarLightbox .lightbox-close {
  position: absolute;
  top: -44px;
  right: 0;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  transition: transform 0.2s;
}

#avatarLightbox .lightbox-close:hover {
  transform: scale(1.1);
}

@media (max-width: 480px) {
  #avatarLightbox .lightbox-avatar-wrapper {
    width: 240px;
    height: 240px;
  }
}

.avatar-preview-wrapper:hover .avatar-upload-overlay {
  opacity: 1;
}

.bottom-sheet-animate {
  animation: slideUp 0.3s ease-out forwards;
}
.bottom-sheet-close-animate {
  animation: slideDown 0.2s ease-in forwards;
}

.bottom-sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  margin: 12px auto;
  cursor: grab;
}

.bottom-sheet-handle:active {
  cursor: grabbing;
}

.bottom-sheet-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border: none;
  background: var(--bg-card-2);
  border-radius: 50%;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.2s;
  z-index: 10;
}

.bottom-sheet-close:hover {
  background: var(--brand-1);
  color: white;
  transform: scale(1.1);
}

.bottom-sheet-content {
  flex: 1 1 auto;
  min-height: 200px;
  padding: 12px 24px 40px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.bottom-sheet-content::-webkit-scrollbar {
  width: 6px;
}

.bottom-sheet-content::-webkit-scrollbar-track {
  background: transparent;
}

.bottom-sheet-content::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 3px;
}

.bottom-sheet-content::-webkit-scrollbar-thumb:hover {
  background: var(--brand-1);
}

/* Settings Content Styles */
.settings-content {
  padding-top: 0;
}

.settings-header {
  padding-right: 52px;
}

.settings-header h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 24px;
}

.settings-section {
  margin-bottom: 32px;
}

.settings-section:last-child {
  margin-bottom: 0;
}

.settings-section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.settings-section-header i {
  font-size: 20px;
  color: var(--brand-1);
}

.settings-section-header h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-main);
}

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px;
  background: var(--bg-card-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  margin-bottom: 12px;
  transition: all 0.2s;
}

.settings-item:hover {
  border-color: var(--brand-1);
  transform: translateY(-2px);
}

.settings-item:last-child {
  margin-bottom: 0;
}

.settings-item-info {
  flex: 1 1 220px;
  min-width: 0;
}

.settings-item-info h4 {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: 4px;
}

.settings-item-info p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

.settings-value {
  flex: 0 1 320px;
  min-width: 0;
  max-width: 100%;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  text-align: right;
  word-break: break-word;
}

.settings-runtime-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.5;
}

.settings-status-stack {
  display: flex;
  flex: 0 1 320px;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}

.settings-status-summary {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(245, 158, 11, 0.25);
  background: rgba(245, 158, 11, 0.12);
  color: #92400e;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.settings-status-summary.is-verified {
  border-color: rgba(16, 185, 129, 0.24);
  background: rgba(16, 185, 129, 0.12);
  color: #065f46;
}

.settings-status-summary.is-neutral {
  border-color: var(--line);
  background: var(--bg-main);
  color: var(--text-muted);
}

.settings-status-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.settings-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

.settings-chip i {
  font-size: 12px;
}

.settings-chip.is-verified {
  border-color: rgba(16, 185, 129, 0.24);
  background: rgba(16, 185, 129, 0.1);
  color: #065f46;
}

.settings-chip.is-pending {
  border-color: rgba(245, 158, 11, 0.24);
  background: rgba(245, 158, 11, 0.1);
  color: #92400e;
}

.settings-chip.is-neutral {
  background: var(--bg-main);
  color: var(--text-muted);
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  width: 52px;
  height: 28px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch .slider {
  position: absolute;
  inset: 0;
  background: var(--line);
  border-radius: 28px;
  transition: 0.3s;
  cursor: pointer;
}

.toggle-switch .slider:before {
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .slider {
  background: var(--brand-2);
}

.toggle-switch input:checked + .slider:before {
  transform: translateX(24px);
}

/* Theme Toggle Buttons */
.theme-toggle {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 100%;
}

.theme-btn {
  padding: 10px 16px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  border-radius: 12px;
  color: var(--text-soft);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  font-family: inherit;
  white-space: nowrap;
}

.theme-btn:hover {
  border-color: var(--brand-1);
  background: var(--bg-card-2);
}

.theme-btn.active {
  background: var(--brand-1);
  border-color: var(--brand-1);
  color: white;
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3);
}

/* Settings Select */
.settings-select {
  padding: 10px 16px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  border-radius: 12px;
  color: var(--text-main);
  font-size: 14px;
  cursor: pointer;
  min-width: 140px;
  max-width: 100%;
  font-family: inherit;
  transition: all 0.2s;
}

.settings-select:hover {
  border-color: var(--brand-1);
}

.settings-select:focus {
  outline: none;
  border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(var(--palette-primary-rgb), 0.1);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .bottom-sheet {
    max-height: 90vh;
    border-radius: 24px 24px 0 0;
  }

  .bottom-sheet-content {
    max-height: calc(90vh - 60px);
    padding: 0 20px 40px;
  }

  .settings-header h2 {
    font-size: 22px;
  }

  .settings-section-header h3 {
    font-size: 16px;
  }

  .settings-item {
    padding: 14px;
    gap: 12px;
  }

  .settings-value,
  .settings-status-stack {
    flex-basis: 100%;
    align-items: flex-start;
    text-align: left;
  }

  .settings-status-badges {
    justify-content: flex-start;
  }

  .theme-toggle {
    width: 100%;
    justify-content: stretch;
  }

  .theme-btn {
    flex: 1;
    justify-content: center;
  }

  .settings-select {
    width: 100%;
    margin-top: 0;
  }

  .toggle-switch {
    align-self: flex-start;
    margin-top: 4px;
  }
}

/* Dark Theme Adjustments */
html.dark .bottom-sheet {
  background: var(--bg-card);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
}

html.dark .bottom-sheet-backdrop {
  background: rgba(0, 0, 0, 0.7);
}

html.dark .settings-item {
  background: rgba(30, 41, 59, 0.5);
}

html.dark .theme-btn {
  background: rgba(30, 41, 59, 0.5);
}

html.dark .theme-btn.active {
  background: var(--brand-1);
}

html.dark .settings-select {
  background: rgba(30, 41, 59, 0.5);
}

.fullscreen-page {
    margin: 0;
    padding: 0;
    background: var(--bg-main);
}

.fullscreen-content{
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================
   Room Pages - Enhanced UI Styles
   ============================================ */

/* Room Header Section */
.room-header-section {
  display: none;
}

.room-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.room-page-title h2 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.room-page-title h2 i {
  color: var(--brand-1);
}

.room-page-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin: 6px 0 0 0;
}

.room-create-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--hero);
  color: white;
  border: none;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 16px rgba(var(--palette-primary-rgb), 0.28);
}

.room-create-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(var(--palette-primary-rgb), 0.36);
}

.room-create-btn:active {
  transform: translateY(0);
}

/* ============================================
   Responsive Create Room Button Styles
   ============================================ */

/* Topbar Create Room Button (Desktop & Tablet) */
.topbar-create-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  background: var(--hero);
  color: white;
  border: none;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 12px 24px rgba(var(--palette-primary-rgb),0.18);
}

.topbar-create-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(var(--palette-primary-rgb),0.26);
}

.topbar-create-btn:active {
  transform: translateY(0);
}

/* ============================================
   Responsive Breakpoints
   ============================================ */

/* Desktop & Tablet (>= 768px) - Show topbar/header buttons, hide FAB */
@media (min-width: 768px) {
  .responsive-desktop {
    display: inline-flex !important;
  }
  
  .responsive-mobile {
    display: none !important;
  }
}

/* Mobile (< 768px) - Hide desktop-only controls */
@media (max-width: 767px) {
  .responsive-desktop {
    display: none !important;
  }
  
  .responsive-mobile {
    display: inline-flex !important;
  }
}


.room-search-wrapper {
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-card-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  transition: all 0.2s ease;
}

.room-search-wrapper:focus-within {
  border-color: var(--brand-1);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
}

.room-search-wrapper i {
  color: var(--text-muted);
  font-size: 14px;
}

.room-search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14px;
  color: var(--text-main);
  outline: none;
}

.room-search-input::placeholder {
  color: var(--text-muted);
}

.room-tabs-layout {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
}

.room-sort-wrapper {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: end;
  padding: 8px 10px 8px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--bg-card-2) 88%, transparent);
}

.room-sort-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.room-sort-select {
  padding: 6px 28px 6px 8px;
  background: transparent;
  border: none;
  border-radius: 10px;
  font-size: 12px;
  color: var(--text-main);
  cursor: pointer;
  outline: none;
  appearance: none;
  min-width: 112px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M2.5 4.5L6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: all 0.2s ease;
}

.room-sort-select:hover {
  color: var(--brand-1);
}

.room-sort-select:focus {
  color: var(--brand-1);
}

/* Room Grid */
.room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  padding: 0 0 40px 0;
}

/* Room Card - New Design */
.room-card {
  background: var(--bg-card);
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid var(--line);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.room-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
  border-color: var(--brand-1);
}

.room-card.joined {
  cursor: pointer;
}

.room-card.joined:hover {
  border-color: #22c55e;
}

/* Room Card Cover */
.room-card-cover {
  height: 120px;
  background-size: cover;
  background-position: center;
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px;
}

.room-card-cover::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.3) 100%);
}

.room-card-type-badge {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  position: relative;
  z-index: 1;
  backdrop-filter: blur(8px);
}

.room-card-type-badge.live {
  background: rgba(239, 68, 68, 0.9);
  color: white;
}

.room-card-type-badge.voice {
  background: rgba(168, 85, 247, 0.9);
  color: white;
}

.room-card-type-badge.text {
  background: rgba(6, 182, 212, 0.9);
  color: white;
}

.room-card-joined-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: rgba(34, 197, 94, 0.9);
  color: white;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  position: relative;
  z-index: 1;
  backdrop-filter: blur(8px);
}

/* Room Card Body */
.room-card-body {
  padding: 16px;
}

.room-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.room-card-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.room-live-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  flex-shrink: 0;
}

.live-dot {
  width: 6px;
  height: 6px;
  background: #ef4444;
  border-radius: 50%;
  animation: livePulse 1.5s ease-in-out infinite;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
}

.room-card-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0 0 12px 0;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Room Card Meta */
.room-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.room-card-creator {
  display: flex;
  align-items: center;
  gap: 8px;
}

.room-card-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.room-card-avatar-placeholder {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand-1);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}

.room-card-creator-name {
  font-size: 13px;
  color: var(--text-soft);
  font-weight: 500;
}

.room-card-online {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.room-online-pulse {
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  animation: onlinePulse 2s ease-in-out infinite;
}

@keyframes onlinePulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
  50% { opacity: 0.8; box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
}

.room-online-count {
  font-weight: 600;
  color: #22c55e;
}

/* Room Card Action */
.room-card-action {
  display: flex;
  gap: 8px;
}

.room-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 20px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  text-decoration: none;
}

.room-btn i {
  font-size: 14px;
}

.room-btn-join {
  width: 100%;
  background: var(--hero);
  color: white;
  box-shadow: 0 4px 12px rgba(var(--palette-primary-rgb), 0.22);
}

.room-btn-join:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(var(--palette-primary-rgb), 0.3);
}

.room-btn-enter {
  width: 100%;
  background: rgba(34, 197, 94, 0.12);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.room-btn-enter:hover {
  background: rgba(34, 197, 94, 0.2);
  border-color: rgba(34, 197, 94, 0.5);
}

.room-btn-primary {
  background: var(--hero);
  color: white;
  box-shadow: 0 4px 12px rgba(var(--palette-primary-rgb), 0.22);
}

.room-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(var(--palette-primary-rgb), 0.3);
}

.room-btn-secondary {
  background: var(--bg-card-2);
  color: var(--text-soft);
  border: 1px solid var(--line);
}

.room-btn-secondary:hover {
  background: var(--pill);
  color: var(--text-main);
}

/* Room Empty State */
.room-empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

.room-empty-icon {
  width: 100px;
  height: 100px;
  margin: 0 auto 24px;
  background: linear-gradient(135deg, rgba(var(--palette-secondary-rgb), 0.14), rgba(var(--palette-primary-rgb), 0.1));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.room-empty-icon i {
  font-size: 40px;
  color: var(--brand-1);
  opacity: 0.6;
}

.room-empty-state h3 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-main);
  margin: 0 0 8px 0;
}

.room-empty-state p {
  font-size: 14px;
  margin: 0 0 24px 0;
}

/* Room Modal - Enhanced */
.room-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.room-modal-content {
  background: var(--bg-card);
  border-radius: 24px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2);
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.room-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px;
  border-bottom: 1px solid var(--line);
}

.room-modal-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.room-modal-header h2 i {
  color: var(--brand-1);
}

.room-modal-close {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--bg-card-2);
  border-radius: 50%;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.2s ease;
}

.room-modal-close:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.room-modal-body {
  padding: 24px;
  max-height: 60vh;
  overflow-y: auto;
}

.room-form-group {
  margin-bottom: 20px;
}

.room-form-group:last-child {
  margin-bottom: 0;
}

.room-form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: 8px;
}

.room-form-label .required {
  color: #ef4444;
}

.room-form-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-card-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  font-size: 15px;
  color: var(--text-main);
  transition: all 0.2s ease;
}

.room-form-input:focus {
  outline: none;
  border-color: var(--brand-1);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
}

.room-form-input::placeholder {
  color: var(--text-muted);
}

.room-form-textarea {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-card-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  font-size: 15px;
  color: var(--text-main);
  resize: none;
  transition: all 0.2s ease;
  font-family: inherit;
}

.room-form-textarea:focus {
  outline: none;
  border-color: var(--brand-1);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
}

.room-form-textarea::placeholder {
  color: var(--text-muted);
}

/* Room Type Selector */
.room-type-selector {
  display: flex;
  gap: 12px;
}

.room-type-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 12px;
  background: var(--bg-card-2);
  border: 2px solid var(--line);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.room-type-option:hover {
  border-color: var(--brand-1);
}

.room-type-option.selected {
  border-color: var(--brand-1);
  background: rgba(6, 182, 212, 0.08);
}

.type-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.type-icon.live {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.type-icon.voice {
  background: rgba(168, 85, 247, 0.15);
  color: #a855f7;
}

.type-icon.text {
  background: rgba(6, 182, 212, 0.15);
  color: var(--brand-1);
}

.type-info {
  text-align: center;
}

.type-name {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.type-desc {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.room-type-option.selected .type-icon {
  transform: scale(1.1);
}

.room-type-option.selected .type-name {
  color: var(--brand-1);
}

/* Room Modal Footer */
.room-modal-footer {
  display: flex;
  gap: 12px;
  padding: 20px 24px;
  border-top: 1px solid var(--line);
  background: var(--bg-card-2);
}

.room-modal-footer .room-btn {
  flex: 1;
  padding: 14px 20px;
}

/* Responsive - Rooms */
@media (max-width: 768px) {
  .room-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .room-type-selector {
    flex-direction: column;
  }

  .room-type-option {
    flex-direction: row;
    justify-content: flex-start;
    text-align: left;
  }

  .type-info {
    text-align: left;
  }

  .room-modal-content {
    max-width: 100%;
    border-radius: 24px 24px 0 0;
    margin-top: auto;
  }

  .room-modal {
    align-items: flex-end;
  }
}

@media (max-width: 480px) {
  .room-page-header {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .room-create-btn {
    width: 100%;
    justify-content: center;
  }

  .room-card-cover {
    height: 100px;
  }

  .room-card-name {
    font-size: 16px;
  }

  .room-card-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

/* ============================================
   Responsive Layout Refresh
   ============================================ */

.room-card-desc,
.room-card-name,
.rightbar-room-text strong,
.rightbar-recent-info small,
.trend strong,
.friend strong {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.detail-comment-composer {
  margin-top: 20px;
}

.detail-comment-form {
  margin-top: 12px;
}

.detail-comment-textarea {
  width: 100%;
  min-height: 100px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  font-size: 14px;
  line-height: 1.7;
  outline: none;
  resize: vertical;
  background: var(--bg-card-2);
  color: var(--text-main);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.detail-comment-submit {
  margin-top: 12px;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.detail-comment-card {
  padding: 16px;
}

.detail-comment-avatar {
  width: 40px;
  height: 40px;
}

.stat-btn {
  min-height: 40px;
}

.post-head-actions .actions-trigger {
  width: 38px;
  height: 38px;
}

.room-empty-state-search {
  padding-top: 56px;
}

@media (max-width: 1024px) {
  .room-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
  }

  .room-card-cover {
    height: 112px;
  }

  .room-card-body {
    padding: 15px;
  }
}

@media (max-width: 767px) {
  .ocean-banner {
    padding: 22px 18px;
  }

  .detail-comment-composer {
    margin-top: 16px;
  }

  .detail-comment-textarea {
    min-height: 88px;
    padding: 14px;
    border-radius: 14px;
  }

  .detail-comment-submit {
    width: 100%;
  }

  .detail-comment-card {
    padding: 14px;
  }

  .panel.post .bubble-stats {
    gap: 6px;
  }

  .stat-btn {
    flex: 1 1 calc(33.333% - 6px);
    justify-content: center;
    min-height: 46px;
    padding: 10px 12px;
    border-radius: 14px;
  }

  .panel.post .thread-actions {
    gap: 2px;
  }

  .panel.post .thread-action-btn {
    flex: 0 0 auto;
    min-width: 42px;
    min-height: 42px;
    padding: 0 9px;
    border-radius: 999px;
  }

  .post-head-actions .actions-trigger {
    width: 44px;
    height: 44px;
    border-radius: 14px;
  }

  .room-card-cover {
    height: 104px;
  }

  .room-card-body {
    padding: 14px;
  }

  .room-card-action .room-btn {
    min-height: 44px;
  }
}

@media (pointer: coarse) {
  .stat-btn {
    min-height: 44px;
  }

  .panel.post .thread-action-btn {
    min-height: 42px;
  }

  .post-head-actions .actions-trigger {
    width: 44px;
    height: 44px;
  }
}
