:root {
  --brand-primary: #137fec;
  --brand-primary-hover: #0f6cd0;
  --brand-secondary: #f97316;
  --brand-secondary-hover: #ea580c;
  --brand-secondary-soft: #ffedd5;
  --brand-surface: #f6f7f8;
  --brand-surface-alt: #e0e7f1;
  --brand-surface-strong: #ffffff;
  --brand-text: #111827;
  --brand-text-subtle: #6b7280;
  --brand-text-inverse: #f9fafb;
  --brand-accent: #f59e0b;
  --brand-border: #d1d5db;
}

.dark {
  --brand-primary: #3a8ff8;
  --brand-primary-hover: #1f6fd6;
  --brand-secondary: #fb923c;
  --brand-secondary-hover: #f97316;
  --brand-secondary-soft: rgba(251, 146, 60, 0.18);
  --brand-surface: #101922;
  --brand-surface-alt: #172431;
  --brand-surface-strong: #1f2c39;
  --brand-text: #f9fafb;
  --brand-text-subtle: #9ca3af;
  --brand-text-inverse: #f9fafb;
  --brand-accent: #fbbf24;
  --brand-border: #374151;
}

body {
  margin: 0;
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  background-color: var(--brand-surface);
  color: var(--brand-text);
  transition: background-color 0.3s ease, color 0.3s ease;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background-color: var(--brand-primary);
  color: var(--brand-text-inverse);
  padding: 0.5rem 1rem;
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.15);
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: background-color 0.3s ease, color 0.3s ease;
}

@media (max-width: 1023px) {
  .top-bar {
    padding: 0.4rem 0.75rem;
  }

  .left-icon {
    width: 2.5rem;
    height: 2.5rem;
  }

  .top-bar .top-icon {
    font-size: 1.5rem;
  }

  .middle-logo img {
    max-height: 1.75rem;
  }

  .middle-logo span {
    font-size: 1rem;
  }

  .right-actions {
    gap: 0.5rem;
  }

  .right-actions button,
  .notification-bell {
    height: 2rem;
    width: 2rem;
  }

  .right-actions svg {
    height: 1.125rem;
    width: 1.125rem;
  }
}

.left-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
}

.right-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.top-bar .top-icon {
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  color: inherit;
}

.middle-logo {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.middle-logo img {
  max-height: 2.5rem;
  width: auto;
}

.notification-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  border-radius: 9999px;
  background-color: rgba(255, 255, 255, 0.72);
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.notification-bell:hover {
  background-color: rgba(255, 255, 255, 0.85);
  transform: translateY(-1px);
}

.notification-bell svg {
  width: 1.5rem;
  height: 1.5rem;
  color: var(--brand-primary);
}

.dark .notification-bell {
  background-color: rgba(17, 24, 39, 0.45);
}

.dark .notification-bell:hover {
  background-color: rgba(17, 24, 39, 0.6);
}

.dark .notification-bell svg {
  color: var(--brand-text);
}

.notification-count {
  position: absolute;
  top: -0.35rem;
  right: -0.35rem;
  min-width: 1.25rem;
  height: 1.25rem;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  background: #ef4444;
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.35);
}

#main-container {
  flex: 1 1 auto;
  display: flex;
  overflow: hidden;
  width: 100%;
  min-height: 0;
  background-color: var(--brand-surface);
}

#main-content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  background-color: var(--brand-surface);
}

.page {
  display: none;
  padding: 0.75rem;
  gap: 0.75rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.page.active {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.bottom-nav {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  gap: 0;
  background-color: var(--brand-primary);
  padding: 0.4rem 0.5rem;
  color: #f8fafc;
  box-shadow: 0 -4px 12px rgba(15, 23, 42, 0.18);
  box-sizing: border-box;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
}

.nav-button {
  background: transparent;
  border: none;
  color: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.4rem 0.25rem;
  border-radius: 0.5rem;
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  letter-spacing: 0.02em;
  transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.nav-button:hover,
.nav-button:focus,
.nav-button:focus-visible,
.nav-button:active {
  outline: none;
  background-color: rgba(248, 250, 252, 0.2);
  color: #ffffff;
}

.nav-button--active,
#main-container:has(#page-pub-sub.active) + nav.bottom-nav button[data-target="page-pub-sub"],
#main-container:has(#page-post.active) + nav.bottom-nav button[data-target="page-post"],
#main-container:has(#page-my-post.active) + nav.bottom-nav button[data-target="page-my-post"],
#main-container:has(#page-search.active) + nav.bottom-nav button[data-target="page-search"],
#main-container:has(#page-chat-list.active) + nav.bottom-nav button[data-target="page-chat-list"],
#main-container:has(#page-menu.active) + nav.bottom-nav button[data-target="page-menu"] {
  background-color: rgba(248, 250, 252, 0.88);
  color: var(--brand-primary);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.18);
}

.side-column {
  display: none;
  flex-direction: column;
  gap: 0.5rem;
  width: 16rem;
  padding: 1rem;
  background-color: #ffffff;
  border-right: 1px solid var(--brand-surface-alt);
  overflow-y: auto;
}

.side-column::-webkit-scrollbar {
  width: 0.4rem;
}

.side-column::-webkit-scrollbar-thumb {
  background-color: rgba(99, 102, 241, 0.4);
  border-radius: 9999px;
}

.left-column,
.right-column {
  display: none;
}

.side-button {
  background-color: var(--brand-primary);
  border: none;
  color: var(--brand-text-inverse);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.7rem 0.85rem;
  border-radius: 0.75rem;
  text-align: left;
  width: 100%;
  letter-spacing: 0.01em;
  transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.side-button:hover,
.side-button:focus-visible {
  outline: none;
  background-color: var(--brand-primary-hover);
  box-shadow: 0 10px 18px rgba(19, 127, 236, 0.28);
  transform: translateX(2px);
}

.notifications {
  display: none;
  background-color: #ffffff;
  padding: 1rem;
  border-left: 1px solid var(--brand-surface-alt);
  max-width: 22rem;
  min-width: 18rem;
  box-shadow: -4px 0 12px rgba(15, 23, 42, 0.08);
  z-index: 30;
}

.notifications.active {
  display: block;
}

.notification-item {
  padding: 0.75rem;
  border-radius: 0.75rem;
  cursor: pointer;
  background-color: rgba(15, 23, 42, 0.03);
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.notification-item + .notification-item {
  margin-top: 0.75rem;
}

.notification-item:hover {
  background-color: rgba(16, 185, 129, 0.15);
  transform: translateY(-1px);
}

.chat-container,
.post-container,
.search-container,
.pub-sub-container,
.my-post-container,
.menu-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background-color: transparent;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.menu-container ul {
  overflow-y: auto;
  flex: 1 1 auto;
}

#page-my-post.active .my-post-container {
  min-height: calc(100vh - 200px);
  height: 100%;
}

.chat-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  background: white;
  box-sizing: border-box;
}

.chat-list-column,
.chat-room-column,
.my-post-list-column,
.my-post-response-column,
.my-pub-column,
.my-sub-column,
.my-title-column,
.my-content-column {
  width: 100%;
  background-color: transparent;
  box-sizing: border-box;
}

.chat-list-wrapper {
  position: relative;
  height: 100%;
}

.chat-list-column,
.my-post-list-column,
.my-pub-column,
.my-title-column {
  overflow-y: auto;
}

.chat-list-column {
  padding-bottom: 72px;
}

.chat-room-column,
.my-post-response-column,
.my-sub-column,
.my-content-column {
  display: none;
  flex-direction: column;
  gap: 0.5rem;
}

#page-my-post.active .my-post-list-column,
#page-my-post.active .my-post-response-column {
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-room-column {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

.chat-room-column.active,
.my-post-response-column.active,
.my-sub-column.active,
.my-content-column.active {
  display: flex;
}

@media (min-width: 1024px) {
  .bottom-nav {
    display: none;
  }

  .left-column {
    display: flex;
  }

  .right-column {
    display: flex;
  }

  #main-content {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
  }

  .page {
    flex: 1 1 auto;
  }

  .chat-container {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 0;
    height: 100%;
    max-width: 100%;
  }
  
  #page-my-post.active .my-post-container {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    align-items: stretch;
  }

  #page-my-post .my-post-top-bar .pub-toggle {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    align-items: stretch;
  }

  #page-my-post .my-post-top-bar .segmented-tab {
    flex: none;
    width: 100%;
    justify-content: flex-start;
  }

  /* Match My Post toolbar sizing on Pub/Sub */
  #page-pub-sub .pub-top-bar .pub-toggle {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    align-items: stretch;
  }

  #page-pub-sub .pub-top-bar .segmented-tab {
    flex: none;
    width: 100%;
    justify-content: flex-start;
  }
  
  .my-post-container,
  .pub-sub-container,
  .menu-container {
    flex-direction: row;
    align-items: stretch;
    overflow: hidden;
  }

  .menu-container {
    flex-direction: column;
    overflow-y: auto;
  }

  .chat-list-column {
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e2e8f0;
    background: #f8fafc;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    width: 320px;
    min-width: 320px;
    max-width: 320px;
  }
  
  .chat-list-column::-webkit-scrollbar {
    width: 6px;
  }
  
  .chat-list-column::-webkit-scrollbar-track {
    background: transparent;
  }
  
  .chat-list-column::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
  }
  
  .chat-list-column::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
  }
  
.load-more-button {
  position: absolute;
  right: 16px;
  bottom: 16px;
  margin: 0;
  padding: 10px 14px;
  background: #0f172a;
  color: #f8fafc;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
  z-index: 15;
  border-radius: 9999px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.load-more-button:hover {
  transform: translateY(-1px) scale(1.01);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.3);
}

.load-more-button:active {
  transform: translateY(1px);
}

.load-more-button svg {
  transition: transform 0.25s ease;
}

.load-more-button:hover svg {
  transform: translateY(2px);
}

.load-more-button.loading {
  opacity: 0.7;
  pointer-events: none;
}

.load-more-button.loading svg {
  animation: bounce 1s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(4px); }
}
  
  .my-post-list-column,
  .my-pub-column,
  .my-title-column {
    width: 320px;
    max-width: 100%;
    flex: 0 0 320px;
    margin-right: 0;
    display: flex;
    flex-direction: column;
    min-width: 0;
  }

  .chat-room-column {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    background: white;
    min-width: 0;
    overflow: hidden;
  }
  
  .my-post-response-column,
  .my-sub-column,
  .my-content-column {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
  }
}

.message-detail-card {
  width: 100%;
  display: none;
}

.chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background-color: var(--chat-card);
  border-top: 1px solid var(--chat-border);
  width: 100%;
  border-bottom-left-radius: 1rem;
  border-bottom-right-radius: 1rem;
  flex-shrink: 0;
  color: #0f172a;
}

.chat-input-area textarea,
.chat-input-area .editor {
  width: 100%;
  min-height: 44px;
  max-height: 120px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  padding: 10px 12px;
  font-size: 14px;
  background-color: #ffffff;
  color: #1e293b;
  line-height: 1.5;
  overflow-y: auto;
  transition: all 0.2s ease;
}

.chat-input-area .editor:focus,
.chat-input-area textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.chat-input-area .editor:empty:before {
  content: attr(placeholder);
  color: #94a3b8;
}

.send-message {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  color: white;
  background: #3b82f6;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  flex-shrink: 0;
}

.send-message:hover,
.send-message:focus-visible {
  outline: none;
  transform: translateY(-1px);
  background: #2563eb;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

@media (max-width: 640px) {
  .page {
    padding: 0.5rem;
    gap: 0.5rem;
    overflow-y: auto;
  }

  #page-menu {
    overflow-y: auto;
    padding-bottom: 0;
  }

  .menu-container {
    max-height: none;
    overflow-y: visible;
  }

  #main-content {
    padding-bottom: 0;
  }

  #main-container {
    padding-bottom: 3.5rem;
  }

  .right-column.notifications {
    position: fixed;
    inset: 0;
    width: 100%;
    max-width: 20rem;
    margin-left: auto;
    height: 100vh;
    background-color: #ffffff;
    box-shadow: -8px 0 20px rgba(15, 23, 42, 0.2);
    padding-top: 5rem;
  }

  .bottom-nav {
    padding: 0.35rem 0.4rem;
    border-top-left-radius: 1rem;
    border-top-right-radius: 1rem;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 100vw;
    z-index: 50;
  }

  body {
    padding-bottom: 0;
    height: 100vh;
    overflow: hidden;
  }

  #main-container {
    padding-bottom: 3.5rem;
    overflow-y: auto;
  }

  .nav-button {
    font-size: 0.75rem;
    padding: 0.35rem 0.2rem;
    letter-spacing: 0.01em;
  }

  .nav-button svg {
    height: 1.25rem;
    width: 1.25rem;
  }

  .nav-button span {
    font-size: 0.625rem;
  }
}
:root {
  --accent-primary: #10b981;
  --accent-primary-dark: #059669;
  --accent-muted: #d1fae5;
  --surface-card: #ffffff;
  --surface-muted: #f8fafc;
  --border-soft: #e2e8f0;
  --text-muted: #475569;
}

.container {
  display: flex;
  flex-wrap: wrap;
  margin-top: 2.5rem;
  gap: 1.5rem;
  min-height: 100vh;
}

.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  color: white;
  background: #3b82f6;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transition: all 0.2s ease;
  cursor: pointer;
}

.action-button:hover,
.action-button:focus-visible {
  outline: none;
  transform: translateY(-1px);
  background: #2563eb;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

#notification-button {
  padding: 0.75rem;
  text-align: center;
  flex-grow: 1;
  border-radius: 0.75rem;
  background-color: var(--accent-muted);
  color: #065f46;
  font-weight: 600;
}

.search-section {
  background-color: #eff6ff;
  border-radius: 1rem;
  padding: 1.25rem;
}

.message-section {
  background-color: #f1f5f9;
  border-radius: 1rem;
  padding: 1.25rem;
}

textarea {
  width: 100%;
  min-height: 120px;
  border-radius: 8px;
  padding: 10px 12px;
  box-sizing: border-box;
  font-size: 14px;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  background-color: #ffffff;
  line-height: 1.5;
  transition: all 0.2s ease;
}

textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.dark textarea {
  background-color: var(--brand-surface-strong);
  color: var(--brand-text);
  border-color: var(--brand-border);
}

textarea:focus-visible {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
}

.style-buttons {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  max-width: 32rem;
  margin: 0.75rem auto;
}

#removeAdvBtn,
#addMoreContent,
#removeMoreContent,
.remove-button {
  background-color: var(--accent-primary);
  color: #f8fafc;
  width: 5.5rem;
  border: none;
  border-radius: 0.75rem;
  margin: 0;
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  transition: background-color 0.2s ease, transform 0.2s ease;
  cursor: pointer;
}

#removeAdvBtn:hover,
#addMoreContent:hover,
#removeMoreContent:hover,
.remove-button:hover,
#removeAdvBtn:focus-visible,
#addMoreContent:focus-visible,
#removeMoreContent:focus-visible,
.remove-button:focus-visible {
  outline: none;
  background-color: var(--accent-primary-dark);
  transform: translateY(-1px);
}

.custom-button {
  background-color: var(--brand-secondary);
  color: var(--brand-text-inverse);
  min-width: 6.5rem;
  padding: 0.65rem 1rem;
  border: none;
  border-radius: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.custom-button:hover,
.custom-button:focus-visible {
  outline: none;
  background-color: var(--brand-secondary-hover);
  box-shadow: 0 10px 18px rgba(234, 88, 12, 0.22);
  transform: translateY(-1px);
}

.message-card {
  width: 100%;
  max-width: 32rem;
  min-height: 5.5rem;
  border-radius: 1rem;
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.5rem;
  background-color: var(--surface-card);
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
}

.message-card img {
  width: 3rem;
  height: 3rem;
  border-radius: 9999px;
  object-fit: cover;
}

.message-info h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.message-info p {
  margin: 0.25rem 0 0;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.message-time {
  align-self: flex-end;
  font-size: 0.75rem;
  color: #94a3b8;
}

.material-symbols-outlined {
  color: #ef4444;
  font-size: 2.25rem;
  line-height: 1;
}

.post-field,
.button {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 3.5rem;
}

.post-field label,
label {
  flex: 0 0 30%;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
}

input[type="text"],
.post-field input[type="text"] {
  flex: 1 1 auto;
  height: 2.5rem;
  border: 1px solid var(--border-soft);
  border-radius: 0.75rem;
  font-size: 1rem;
  padding: 0.5rem 0.75rem;
  background-color: #ffffff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="text"]:focus-visible,
.post-field input[type="text"]:focus-visible {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.18);
}

input[list] {
  background-image: url('/static/images/arrow_dropdown.png');
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem;
  cursor: pointer;
}

.canvas {
  width: 100%;
  max-width: 40rem;
  min-height: 2.5rem;
  border-radius: 1rem;
  background-color: var(--surface-card);
  border: 1px dashed rgba(148, 163, 184, 0.6);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
}

.adv-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.side-item {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-size: 1.15rem;
  padding: 1rem;
  background-color: var(--surface-card);
  border-radius: 1rem;
  box-shadow: 0 15px 35px rgba(15, 23, 42, 0.08);
}

.message-detail-card {
  width: 100%;
}

.scrollable-content {
  overflow: auto;
}
:root {
  --chat-surface: #f8fafc;
  --chat-card: #ffffff;
  --chat-border: #e2e8f0;
  --chat-accent: #2563eb;
  --chat-accent-dark: #1d4ed8;
  --chat-success: #22c55e;
  --chat-danger: #ef4444;
}

.chat-section {
  display: flex;
  flex-direction: column;
  background-color: white;
  border-radius: 0;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

.chat-room {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  background-color: white;
  padding: 12px 8px;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
}

#page-chat-list.active {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#page-chat-list.active .chat-container {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 0;
}

@media (max-width: 768px) {
  #page-chat-list.active {
    min-height: calc(100vh - 10rem);
    padding: 0;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 10rem);
    position: relative;
  }

  #page-chat-list.active .chat-container {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    height: 100%;
    overflow: hidden;
  }
  
  #page-chat-list.active .chat-list-column {
    border-right: none;
    border-bottom: 1px solid #e2e8f0;
    width: 100%;
    flex: 1 1 auto;
    overflow-y: auto;
    padding-bottom: 72px;
  }
  
  #page-chat-list.active .chat-room-column:not(.active) {
    display: none;
  }
  
  #page-chat-list.active .chat-room-column .chat-section {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
  }
  
#page-chat-list.active .chat-room-column .message-header {
  flex-shrink: 0;
  padding: 0.5rem 0.75rem 0.35rem !important;
  width: 100%;
  box-sizing: border-box;
}
  
  .chat-room {
    padding: 8px 4px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
  }
  
  #page-chat-list.active .chat-room-column .icon-button {
    flex-shrink: 0;
    padding: 0.5rem !important;
  }
  
  .chat-input-area {
    padding: 8px;
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    z-index: 10;
  }
  
  /* Mobile Pub/Sub section - make POST area wider */
  .pub-sub-container {
    width: 100%;
    padding: 1rem !important;
  }
  
  .my-pub-column,
  .my-sub-column {
    width: 100%;
    max-width: 100%;
  }
  
  .pub-post-container,
  #pub-container {
    width: 100%;
  }
  
  .pub-post-container .text-input,
  .pub-post-container custom-dropdown,
  .pub-post-container text-editor {
    width: 100%;
    max-width: 100%;
  }
}

@media (min-width: 768px) {
  #page-chat-list.active .chat-container {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 0;
    width: 100%;
    max-width: 100%;
  }

  #page-chat-list.active .chat-list-column {
    display: flex !important;
    flex-direction: column;
    border-right: 1px solid #e2e8f0;
    background: #f8fafc;
    padding: 0 0 72px 0;
    margin: 0;
    width: 320px;
    min-width: 320px;
    max-width: 320px;
  }

  #page-chat-list.active .chat-room-column {
    display: flex !important;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    background: white;
    min-width: 0;
    overflow: hidden;
  }
  
  .chat-room {
    padding: 12px;
    width: 100%;
    box-sizing: border-box;
  }
}

.chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 16px;
  background-color: white;
  border-top: 1px solid #e2e8f0;
  width: 100%;
  border-radius: 0;
  flex-shrink: 0;
}

.chat-input-area .editor {
  flex: 1 1 auto;
  min-height: 6rem;
  max-height: 14rem;
  padding: 0.85rem;
  border: 1px solid var(--chat-border);
  border-radius: 0.9rem;
  font-size: 0.95rem;
  line-height: 1.5;
  color: #0f172a;
  overflow-y: auto;
  background-color: #ffffff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chat-input-area .editor:focus-visible {
  outline: none;
  border-color: var(--chat-accent);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

.chat-input-area button {
  padding: 0.75rem 1rem;
  border-radius: 0.9rem;
  border: none;
  font-weight: 600;
  color: #f8fafc;
  background: linear-gradient(135deg, var(--chat-accent), #38bdf8);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chat-input-area button:hover,
.chat-input-area button:focus-visible {
  outline: none;
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(37, 99, 235, 0.25);
}

.send-message {
  padding: 0.9rem 1.5rem;
  border-radius: 0.9rem;
  border: none;
  font-size: 1rem;
  font-weight: 700;
  color: #f8fafc;
  background: linear-gradient(135deg, var(--chat-success), #16a34a);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.send-message:hover,
.send-message:focus-visible {
  outline: none;
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(34, 197, 94, 0.28);
}

#chat {
  flex: 1 1 auto;
  max-height: 30rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#chat p {
  display: inline-flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 0.5rem;
  margin: 0;
}

#chat p.me {
  justify-content: flex-end;
}

#chat p.other {
  justify-content: flex-start;
}

#sender {
  font-weight: 700;
  font-size: 0.9rem;
  margin-right: 0.5rem;
}

#sender.me {
  color: var(--chat-success);
}

#sender.other {
  color: var(--chat-accent);
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background-color: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  padding: 1.5rem;
  overflow-y: auto;
}

.modal.open {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: var(--chat-card);
  padding: 1.5rem;
  border-radius: 1rem;
  width: 100%;
  max-width: 38rem;
  box-shadow: 0 25px 50px -12px rgba(30, 64, 175, 0.35);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.form-group {
  width: 100%;
  padding: 0.75rem 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: #1f2937;
}

.form-group select {
  width: 100%;
  padding: 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid var(--chat-border);
  background-color: #ffffff;
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group select:focus-visible {
  outline: none;
  border-color: var(--chat-accent);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18);
}

#translateText {
  transform: scale(1.35);
}

.disclaimer {
  font-size: 0.85rem;
  color: #64748b;
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border: 1px dashed var(--chat-border);
  border-radius: 0.75rem;
  background-color: #f1f5f9;
}

.save-button {
  width: 7rem;
  padding: 0.9rem 0;
  text-align: center;
  border-radius: 0.9rem;
  border: none;
  font-weight: 700;
  color: var(--brand-text-inverse);
  background-color: var(--brand-primary);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 10px 22px rgba(19, 127, 236, 0.24);
}

.save-button:hover,
.save-button:focus-visible {
  outline: none;
  transform: translateY(-1px);
  background-color: var(--brand-primary-hover);
  box-shadow: 0 12px 26px rgba(15, 108, 208, 0.3);
}

canvas {
  width: min(100%, 32rem);
  height: 22.5rem;
  background-color: var(--chat-surface);
  border-radius: 1rem;
  border: 1px dashed rgba(148, 163, 184, 0.6);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
  margin: 0.75rem 0;
}

.buttons {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

.chat-button {
  flex: 1 1 0;
  padding: 0.75rem;
  border-radius: 0.9rem;
  border: none;
  font-weight: 600;
  color: var(--brand-text-inverse);
  background-color: var(--brand-secondary);
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.chat-button:hover,
.chat-button:focus-visible {
  outline: none;
  background-color: var(--brand-secondary-hover);
  box-shadow: 0 10px 18px rgba(234, 88, 12, 0.22);
  transform: translateY(-1px);
}

.chat-button:disabled {
  background-color: rgba(148, 163, 184, 0.25);
  color: rgba(148, 163, 184, 0.75);
  cursor: not-allowed;
}

@media (max-width: 640px) {
  .modal-content {
    margin-top: 4rem;
  }

  .chat-button {
    flex: 1 1 100%;
  }
}

#progressBar {
  width: 100%;
  height: 0.5rem;
  background-color: #e2e8f0;
  margin-top: 1rem;
  border-radius: 9999px;
  overflow: hidden;
}

#progressBar > div {
  width: 0;
  height: 100%;
  background: linear-gradient(135deg, var(--chat-accent), #38bdf8);
  transition: width 0.3s ease;
}

#transcriptionText {
  width: 100%;
  min-height: 4rem;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--chat-border);
  border-radius: 0.9rem;
  box-sizing: border-box;
  font-size: 0.95rem;
  resize: none;
  background-color: #ffffff;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
}

#transcriptionText:focus-visible {
  outline: none;
  border-color: var(--chat-accent);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

audio {
  width: 100%;
  margin-top: 1rem;
  border-radius: 0.75rem;
  background-color: #0f172a;
}

.icon-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  margin: 0;
  flex-wrap: nowrap;
  flex-shrink: 0;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}

.icon-button button {
  width: auto;
  height: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #64748b;
  box-shadow: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-button button:hover,
.icon-button button:focus-visible {
  outline: none;
  background: #e2e8f0;
  transform: none;
  box-shadow: none;
}

.close-button {
  align-self: flex-end;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--chat-danger);
  cursor: pointer;
}

#close-btn {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 9999px;
  border: none;
  background-color: var(--chat-danger);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(239, 68, 68, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#close-btn:hover,
#close-btn:focus-visible {
  outline: none;
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(220, 38, 38, 0.3);
}

.message-cards {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 0.9rem;
  background-color: #f1f5f9;
}

#client_message_card,
#post_message_card {
  max-height: 8rem;
  width: 100%;
  overflow-y: auto;
  padding: 0.75rem;
  border-radius: 0.75rem;
  background-color: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.4);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
}
:root {
  --pub-surface: #ffffff;
  --pub-accent: #0ea5e9;
  --pub-accent-dark: #0284c7;
  --pub-success: #22c55e;
  --pub-border: #e2e8f0;
  --pub-muted: #f8fafc;
}

.pub-post-container {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1rem;
  padding: 1.25rem;
  background-color: var(--pub-surface);
  border-radius: 1rem;
  box-shadow: 0 15px 35px rgba(15, 23, 42, 0.08);
  width: 100%;
}

.pub-post-container .text-input {
  width: 100%;
  border-radius: 0.9rem;
  background-color: #eff6ff;
  padding: 0.85rem 1rem;
  border: 1px solid var(--pub-border);
}

.sub-container {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1rem;
  padding: 1.25rem;
  background-color: var(--pub-surface);
  width: 100%;
  border-radius: 1rem;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.sub-container .text-area {
  width: 100%;
  min-height: 3rem;
  border-radius: 0.9rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--pub-border);
  background-color: var(--pub-muted);
  font-size: 1rem;
}

.sub-container .text-area:focus-visible {
  outline: none;
  border-color: var(--pub-accent);
  box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.18);
}

.sub-container .canvas {
  width: 100%;
  min-height: 6rem;
  max-height: 20rem;
  border-radius: 1rem;
  border: 1px dashed rgba(148, 163, 184, 0.6);
  background-color: var(--pub-muted);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
}

.pub-buttons,
.sub-buttons {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  padding: 0.25rem 0;
}

.pubsub-button {
  flex: 0 0 auto;
  min-width: 100px;
  padding: 10px 16px;
  text-align: center;
  border-radius: 8px;
  border: none;
  color: white;
  background: #3b82f6;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.pubsub-button:hover,
.pubsub-button:focus-visible {
  outline: none;
  transform: translateY(-1px);
  background: #2563eb;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.bar-button {
  flex: 0 0 auto;
  min-width: 120px;
  padding: 10px 16px;
  text-align: center;
  border-radius: 8px;
  border: none;
  color: white;
  background: #f59e0b;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.bar-button:hover,
.bar-button:focus-visible {
  outline: none;
  background: #d97706;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.pub-toggle {
  display: flex;
  width: 100%;
  align-items: stretch;
  gap: 12px;
  padding: 8px;
  border-radius: 14px;
  background: linear-gradient(135deg, #e2e8f0, #f8fafc);
  border: 1px solid #e2e8f0;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.dark .pub-toggle {
  background: linear-gradient(135deg, #0b1220, #0f172a);
  border-color: #1f2937;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.segmented-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: 10px;
  text-align: left;
  color: #0f172a;
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1 1 0;
  justify-content: flex-start;
}

.dark .segmented-tab {
  color: #cbd5e1;
}

.segmented-tab:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.segmented-tab .tab-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #e2e8f0;
  color: #0f172a;
}

.dark .segmented-tab .tab-icon {
  background: #1f2937;
  color: #e2e8f0;
}

.tab-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
}

.tab-title {
  font-weight: 700;
  font-size: 15px;
}

.tab-subtitle {
  font-size: 12px;
  color: #475569;
}

.dark .tab-subtitle {
  color: #94a3b8;
}

.segmented-tab.active {
  background: white;
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.15);
  color: #0f172a;
}

.dark .segmented-tab.active {
  background: #0f172a;
  color: #e2e8f0;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
}

.segmented-tab.active .tab-icon {
  background: #0f172a;
  color: #f8fafc;
}

.dark .segmented-tab.active .tab-icon {
  background: #1d4ed8;
  color: #f8fafc;
}

.segmented-tab.active .tab-subtitle {
  color: inherit;
}

.segmented-tab:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.14);
}

.pub-top-bar,
.menu-top-bar {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 12px;
  background: white;
  padding: 0;
  color: #1e293b;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  position: relative;
  box-shadow: 0 8px 16px rgba(2, 132, 199, 0.25);
  width: 100%;
}

.pub-top-bar {
  background: transparent;
  border: none;
  box-shadow: none;
  position: sticky;
  top: 0;
  z-index: 2;
}

.menu-top-bar {
  padding: 12px 16px;
  background: white;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 8px 16px rgba(2, 132, 199, 0.25);
}

.chat-toolbar {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: linear-gradient(120deg, #e2e8f0, #f8fafc);
  border: 1px solid #e2e8f0;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
}

.dark .chat-toolbar {
  background: linear-gradient(120deg, #0b1220, #111827);
  border-color: #1f2937;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.32);
}

.chat-filter-bar {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.chat-filter-btn {
  flex: 1 1 0;
  text-align: center;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: white;
  color: #0f172a;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.chat-filter-btn:hover {
  border-color: #3b82f6;
  color: #0f172a;
  box-shadow: 0 6px 14px rgba(59, 130, 246, 0.18);
  transform: translateY(-1px);
}

.chat-filter-btn.active {
  background: #0f172a;
  color: #f8fafc;
  border-color: #0f172a;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.18);
}

.dark .chat-filter-btn {
  background: #111827;
  color: #e2e8f0;
  border-color: #1f2937;
}

.dark .chat-filter-btn.active {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.chat-room-toolbar {
  justify-content: space-between;
  padding: 6px 8px;
}

.chat-room-toolbar show-message-card {
  width: 100%;
}

@media (min-width: 1024px) {
  .chat-list-column > .chat-toolbar,
  .chat-room-column > .chat-toolbar {
    position: sticky;
    top: 0;
    z-index: 5;
    margin-bottom: 8px;
  }
}

ul {
  list-style: none;
  margin: 1.5rem 0;
  padding: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

ul li {
  background-color: var(--pub-surface);
  color: #0f172a;
  padding: 0.9rem 1rem;
  border-radius: 0.9rem;
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
  border: 1px solid transparent;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

ul li:hover {
  transform: translateY(-2px);
  border-color: rgba(2, 132, 199, 0.45);
  background-color: #e0f2fe;
  box-shadow: 0 15px 26px rgba(14, 165, 233, 0.22);
}



/* Base: mobile-first — full width on phones */
#page-search {
  /* if this element is a flex container in your app, stretch children on mobile */
  align-items: stretch;
  position: relative;
  /* keeps iOS from passing scroll to parent during pull-to-reveal */
  overscroll-behavior-y: contain;
}

#page-search .search-container {
  width: 100%;
  max-width: none;          /* no cap on small screens */
  box-sizing: border-box;
  overflow-x: hidden;       /* runtime content can’t widen it */
  min-width: 0;             /* flex/grid min-content fix */
  flex: 0 0 auto;
  margin-inline: 0;         /* full-bleed on mobile */
}

/* Desktop / larger screens: center & cap width, keep layout stable */
@media (min-width: 768px) {
  #page-search {
    align-items: center;                /* center the blocks horizontally */
    scrollbar-gutter: stable both-edges;/* avoid width jump when scrollbar appears */
  }

  #page-search .search-container {
    max-width: clamp(640px, 56vw, 1100px); /* responsive but bounded */
    margin-inline: auto;                    /* centered on wide screens */
  }
}

#page-search .search-container.search-form {
  position: sticky;
  top: var(--topbar-h);
  z-index: 30;                  /* above results */
  /* smooth collapse/expand transitions */
  transition:
    transform 200ms ease,
    opacity 180ms ease,
    max-height 200ms ease,
    padding 200ms ease,
    margin 200ms ease;
  will-change: transform;
  /* guard against width changes when content updates while allowing dropdowns to overflow vertically */
  overflow-x: hidden;
  overflow-y: visible;
  min-width: 0;
}

/* Collapse state (we toggle on #page-search) */
#page-search.is-collapsed .search-container.search-form {
  max-height: 0;
  padding-block: 0;
  margin-block: 0;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
}

/* Optional: a slim “handle” that shows when collapsed (clickable space under topbar) */
#page-search .search-reveal {
  display: none;
  position: sticky;
  top: var(--topbar-h);
  z-index: 25;
  height: 40px;
  align-items: center;
  justify-content: center;
  background: rgba(248, 250, 252, 0.8); /* slate-50-ish */
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(148, 163, 184, 0.35); /* slate-400-ish */
  cursor: pointer;
  user-select: none;
}


#page-search.is-collapsed .search-reveal { display: flex; }

/* Results block */
#page-search .search-container.search-results {
  /* prevent results content from pushing width */
  overflow-x: hidden;
  min-width: 0;
  /* ensures in-page anchors/scrollTo land below the sticky bar */
  scroll-margin-top: calc(var(--topbar-h) + 16px);
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  #page-search .search-container.search-form {
    transition: none;
  }
}

/* Ensure results never force horizontal growth */
search-message-list {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

search-message-list img,
search-message-list video,
search-message-list canvas {
  max-width: 100%;
  height: auto;
  display: block;
}
