:root {
  --bg-primary: #0d0f14;
  --bg-secondary: #141721;
  --bg-card: #181c28;
  --bg-card-hover: #1e2333;
  --bg-input: #12141d;
  --border-color: #272d3f;
  --border-focus: #ff4500;
  --text-main: #f3f4f6;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;
  --accent-orange: #ff4500;
  --accent-orange-hover: #e03d00;
  --accent-orange-subtle: rgba(255, 69, 0, 0.12);
  --accent-blue: #3b82f6;
  --accent-green: #10b981;
  --accent-purple: #8b5cf6;
  --accent-pink: #ec4899;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.5);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

[data-theme="light"] {
  --bg-primary: #f0f2f5;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-input: #f1f5f9;
  --border-color: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-subtle: #94a3b8;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(20, 23, 33, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  height: 64px;
  display: flex;
  align-items: center;
}

.header-inner {
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.logo-img {
  height: 42px;
  width: auto;
  display: block;
}

.header-search {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.header-search input {
  width: 100%;
  height: 40px;
  padding: 0 16px 0 40px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-main);
  font-size: 14px;
  transition: all 0.2s ease;
}

.header-search input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-orange-subtle);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 14px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.btn-new-thread {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-orange);
  color: #ffffff;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 700;
  transition: background 0.2s;
}

.btn-new-thread:hover {
  background: var(--accent-orange-hover);
}

.theme-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 8px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.btn-login-open {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 13.5px;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-login-open:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-orange);
}

.user-profile-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 4px 12px 4px 6px;
  border-radius: var(--radius-full);
  transition: all 0.2s;
}

.user-profile-pill:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-orange);
}

.user-nav-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.user-nav-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
}

.user-nav-karma {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent-orange);
}

.btn-logout {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}

.btn-logout:hover {
  color: #ef4444;
  background: var(--bg-card-hover);
}

.theme-toggle:hover {
  color: var(--text-main);
}

/* Category Filter Bar */
.category-nav-bar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 8px 0;
}

.category-nav-inner {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.category-nav-inner::-webkit-scrollbar {
  display: none;
}

.nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.nav-pill:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: var(--text-subtle);
}

.nav-pill.active {
  background: var(--accent-orange);
  color: #ffffff;
  border-color: var(--accent-orange);
  box-shadow: 0 2px 8px rgba(255, 69, 0, 0.3);
}

/* Main Layout Grid */
.layout-container {
  max-width: 1360px;
  width: 100%;
  margin: 20px auto 40px;
  padding: 0 16px;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 300px;
  gap: 24px;
  align-items: start;
}

/* Left Sidebar */
.sidebar-left, .sidebar-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 130px;
}

.side-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.side-card-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-subtle);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.side-nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.side-nav-item a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
}

.side-nav-item a:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
}

.side-nav-item.active a {
  background: var(--accent-orange-subtle);
  color: var(--accent-orange);
  font-weight: 600;
}

.nav-badge {
  background: var(--bg-primary);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  color: var(--text-subtle);
}

.rule-list {
  padding-left: 20px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

.rule-list li {
  margin-bottom: 6px;
}

/* Right Sidebar: Top Creators & Recent Activity */
.creator-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}

.creator-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.creator-rank {
  font-weight: 800;
  font-size: 14px;
  color: var(--text-subtle);
  width: 18px;
  text-align: center;
}

.creator-rank.gold { color: #f59e0b; }
.creator-rank.silver { color: #94a3b8; }
.creator-rank.bronze { color: #b45309; }

.creator-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  object-fit: cover;
}

.creator-info {
  flex: 1;
  min-width: 0;
}

.creator-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.creator-karma {
  font-size: 11.5px;
  color: var(--accent-orange);
  font-weight: 700;
}

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

/* Quick Composer Box at top of Feed */
.quick-composer {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color 0.2s;
}

.quick-composer:hover {
  border-color: var(--text-subtle);
}

.composer-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
}

.composer-input-fake {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 8px 16px;
  color: var(--text-muted);
  font-size: 14px;
}

.composer-quick-actions {
  display: flex;
  gap: 8px;
}

.btn-composer-icon {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 13px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}

.btn-composer-icon:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
}

/* Post Cards */
.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.post-card:hover {
  border-color: #374151;
  box-shadow: var(--shadow-md);
}

.post-header {
  padding: 14px 16px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.author-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.author-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--bg-input);
}

.author-details {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.author-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.author-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.post-timestamp {
  font-size: 12px;
  color: var(--text-subtle);
}

.category-tag {
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: var(--bg-input);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.category-tag.tag-video { background: rgba(236, 72, 153, 0.15); color: #f472b6; border-color: rgba(236, 72, 153, 0.3); }
.category-tag.tag-cat { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border-color: rgba(245, 158, 11, 0.3); }
.category-tag.tag-it { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border-color: rgba(59, 130, 246, 0.3); }
.category-tag.tag-hot { background: rgba(239, 68, 68, 0.15); color: #f87171; border-color: rgba(239, 68, 68, 0.3); }

.post-content {
  padding: 4px 16px 12px;
}

.post-title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 8px;
  color: var(--text-main);
}

.post-title a:hover {
  color: var(--accent-orange);
}

.post-body {
  font-size: 14.5px;
  color: #d1d5db;
  line-height: 1.55;
  white-space: pre-line;
  margin-bottom: 12px;
}

/* Media Containers (Videos and Images) */
.media-wrapper {
  background: #000000;
  max-height: 600px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
}

.post-video {
  width: 100%;
  max-height: 540px;
  display: block;
  object-fit: contain;
}

.post-image {
  width: 100%;
  max-height: 560px;
  display: block;
  object-fit: contain;
  transition: transform 0.25s ease;
}

.post-image:hover {
  transform: scale(1.005);
}

.media-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  pointer-events: none;
}

/* Post Actions Footer */
.post-footer {
  padding: 10px 16px 12px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Votes widget */
.vote-pill {
  display: inline-flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.btn-vote {
  padding: 6px 10px;
  color: var(--text-muted);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.btn-vote:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
}

.btn-vote.up:hover, .btn-vote.up.active {
  color: var(--accent-orange);
}

.btn-vote.down:hover, .btn-vote.down.active {
  color: var(--accent-blue);
}

.vote-score {
  font-size: 13px;
  font-weight: 700;
  padding: 0 4px;
  min-width: 24px;
  text-align: center;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}

/* Emoji Reactions */
.reactions-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.reaction-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 4px 8px;
  font-size: 12.5px;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.reaction-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--text-subtle);
  transform: translateY(-1px);
}

.reaction-btn.reacted {
  background: var(--accent-orange-subtle);
  border-color: var(--accent-orange);
  color: var(--accent-orange);
  font-weight: 700;
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-post-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s;
}

.btn-post-action:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
}

/* Thread Page View */
.thread-detail-wrap {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

.back-link:hover {
  color: var(--accent-orange);
}

/* Comments Section */
.comments-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.comments-header {
  font-size: 16px;
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.comment-input {
  width: 100%;
  min-height: 85px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
}

.comment-input:focus {
  outline: none;
  border-color: var(--accent-orange);
}

.form-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.author-input-inline {
  max-width: 200px;
  padding: 7px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-main);
  font-size: 13px;
}

.btn-submit-comment {
  background: var(--accent-orange);
  color: #fff;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: 13.5px;
  font-weight: 700;
  transition: background 0.2s;
}

.btn-submit-comment:hover {
  background: var(--accent-orange-hover);
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 8px;
}

.comment-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.comment-content {
  flex: 1;
  min-width: 0;
}

.comment-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.comment-author {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
}

.comment-time {
  font-size: 11.5px;
  color: var(--text-subtle);
}

.comment-text {
  font-size: 14px;
  color: #d1d5db;
  line-height: 1.5;
  white-space: pre-wrap;
}

/* Modal for New Thread */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 620px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

.modal-title {
  font-size: 18px;
  font-weight: 800;
}

.btn-close-modal {
  font-size: 20px;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

.btn-close-modal:hover {
  color: var(--text-main);
  background: var(--bg-input);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.form-input, .form-textarea, .form-select {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 14px;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: var(--accent-orange);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

.file-dropzone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
  background: var(--bg-input);
  cursor: pointer;
  transition: border-color 0.2s;
}

.file-dropzone:hover {
  border-color: var(--accent-orange);
}

.dropzone-text {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Toast Notifications */
.toast-box {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1e293b;
  border: 1px solid #334155;
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 999;
}

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

/* Nav Icons & Badges */
.btn-icon-nav {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-main);
  text-decoration: none;
  font-size: 16px;
  transition: all 0.2s;
}
.btn-icon-nav:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-orange);
  transform: translateY(-1px);
}
.nav-badge-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  background: var(--accent-orange);
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(255, 69, 0, 0.8);
}
.side-badge {
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  margin-left: auto;
}
.side-badge.live {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Messenger Interface */
.messenger-box {
  display: grid;
  grid-template-columns: 280px 1fr;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  min-height: 600px;
  max-height: 720px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.messenger-sidebar {
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.15);
}
.messenger-sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tcp-secure-pill {
  font-size: 10px;
  font-weight: 800;
  color: #10b981;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  letter-spacing: 0.5px;
}
.dialogs-scroll {
  overflow-y: auto;
  flex: 1;
}
.dialog-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  text-decoration: none;
  color: var(--text-main);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background 0.15s;
}
.dialog-item:hover {
  background: var(--bg-card-hover);
}
.dialog-item.active {
  background: rgba(255, 69, 0, 0.1);
  border-left: 3px solid var(--accent-orange);
}
.dialog-avatar-wrap {
  position: relative;
}
.dialog-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-input);
  display: block;
}
.online-indicator {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  background: #10b981;
  border: 2px solid var(--bg-card);
  border-radius: 50%;
}
.dialog-info {
  flex: 1;
  min-width: 0;
}
.dialog-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 3px;
}
.dialog-name {
  font-weight: 700;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dialog-time {
  font-size: 11px;
  color: var(--text-muted);
}
.dialog-preview {
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.messenger-chat-area {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
}
.chat-top-bar {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.015);
}
.chat-top-user {
  display: flex;
  align-items: center;
  gap: 12px;
}
.chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
}
.chat-header-name {
  font-weight: 700;
  font-size: 15px;
}
.chat-header-status {
  font-size: 11.5px;
  color: #10b981;
  font-weight: 500;
}
.btn-tcp-call {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #10b981;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  transition: all 0.2s;
}
.btn-tcp-call:hover {
  background: #10b981;
  color: #fff;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.chat-scroll-area {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.chat-empty-state {
  margin: auto;
  text-align: center;
  padding: 40px;
}
.chat-message-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  max-width: 75%;
}
.chat-message-row.bubble-own {
  margin-left: auto;
  flex-direction: row-reverse;
}
.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}
.msg-bubble {
  background: var(--bg-card-hover);
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.45;
}
.bubble-own .msg-bubble {
  background: var(--accent-orange);
  border-color: var(--accent-orange);
  color: #fff;
}
.msg-author {
  font-size: 11px;
  font-weight: 700;
  opacity: 0.8;
  margin-bottom: 3px;
}
.msg-time {
  font-size: 10px;
  opacity: 0.7;
  text-align: right;
  margin-top: 4px;
}

.chat-send-bar {
  padding: 14px 18px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.1);
}
.chat-input-text {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 10px 18px;
  color: var(--text-main);
  font-size: 14px;
  outline: none;
}
.chat-input-text:focus {
  border-color: var(--accent-orange);
}
.btn-send-chat {
  background: var(--accent-orange);
  border: none;
  color: #fff;
  font-weight: 700;
  font-size: 13.5px;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-send-chat:hover {
  background: var(--accent-orange-hover);
  transform: translateY(-1px);
}

/* Calls & Voice Rooms (TCP Streaming) */
.calls-page-wrapper {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.calls-header-banner {
  background: linear-gradient(135deg, rgba(255, 69, 0, 0.12), rgba(16, 185, 129, 0.1));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.call-studio-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.studio-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 14px;
}
.studio-room-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
}
.live-pulse-dot {
  width: 10px;
  height: 10px;
  background: #10b981;
  border-radius: 50%;
  animation: pulse-ring 1.8s infinite;
}
@keyframes pulse-ring {
  0% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
.studio-transport-badge {
  font-size: 12px;
  background: var(--bg-input);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 8px;
}
.studio-participants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 16px;
}
.peer-card {
  background: var(--bg-card-hover);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
}
.peer-card.active-speaker {
  border-color: #10b981;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.2);
}
.peer-avatar-wrap {
  position: relative;
  width: 56px;
  height: 56px;
}
.peer-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: block;
}
.speaking-ring {
  display: none;
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border: 2px solid #10b981;
  border-radius: 50%;
  animation: speak-anim 1.2s infinite ease-in-out;
}
.peer-card.active-speaker .speaking-ring {
  display: block;
}
@keyframes speak-anim {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.08); opacity: 1; }
}
.peer-name {
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.peer-audio-bar {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 12px;
}
.peer-audio-bar .bar {
  width: 3px;
  background: #10b981;
  border-radius: 2px;
  animation: audio-bounce 0.8s infinite alternate ease-in-out;
}
.peer-audio-bar .b1 { height: 4px; animation-delay: 0.1s; }
.peer-audio-bar .b2 { height: 9px; animation-delay: 0.3s; }
.peer-audio-bar .b3 { height: 12px; animation-delay: 0.15s; }
.peer-audio-bar .b4 { height: 6px; animation-delay: 0.4s; }
.peer-audio-bar.static .bar {
  height: 3px;
  background: var(--text-subtle);
  animation: none;
}
@keyframes audio-bounce {
  0% { transform: scaleY(0.4); }
  100% { transform: scaleY(1.3); }
}

.studio-waveform-box {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
#callWaveformCanvas {
  width: 100%;
  height: 48px;
}

.studio-controls-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.btn-call-ctrl {
  background: var(--bg-card-hover);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 18px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}
.btn-call-ctrl:hover {
  border-color: var(--text-muted);
  transform: translateY(-1px);
}
.btn-call-ctrl.active {
  background: rgba(16, 185, 129, 0.18);
  border-color: #10b981;
  color: #10b981;
}
.btn-call-ctrl.btn-leave {
  background: rgba(239, 68, 68, 0.18);
  border-color: #ef4444;
  color: #ef4444;
}
.btn-call-ctrl.btn-leave:hover {
  background: #ef4444;
  color: #fff;
}

.calls-rooms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.call-room-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.2s;
}
.call-room-card:hover {
  border-color: var(--accent-orange);
  transform: translateY(-2px);
}
.call-room-card.active-room {
  border-color: #10b981;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.15);
}
.room-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.room-title {
  font-weight: 700;
  font-size: 14.5px;
}
.room-live-pill {
  font-size: 11px;
  font-weight: 700;
  color: #10b981;
  background: rgba(16, 185, 129, 0.15);
  padding: 3px 8px;
  border-radius: var(--radius-full);
}
.room-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
  flex: 1;
}
.room-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--border-color);
  padding-top: 10px;
}
.room-protocol-tag {
  font-size: 10.5px;
  color: var(--text-subtle);
  font-weight: 600;
}
.btn-join-room {
  background: var(--bg-card-hover);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  text-align: center;
  padding: 7px 14px;
  border-radius: var(--radius-full);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 700;
  transition: all 0.15s;
}
.btn-join-room:hover {
  background: var(--accent-orange);
  border-color: var(--accent-orange);
  color: #fff;
}

/* Responsive Media Queries */
@media (max-width: 1100px) {
  .layout-container {
    grid-template-columns: minmax(0, 1fr) 280px;
  }
  .sidebar-left {
    display: none;
  }
}

@media (max-width: 780px) {
  .layout-container {
    grid-template-columns: 1fr;
    margin-top: 12px;
    padding: 0 10px;
  }
  .sidebar-right {
    display: none;
  }
  .header-search {
    max-width: 180px;
  }
  .messenger-box {
    grid-template-columns: 1fr;
    max-height: none;
  }
  .messenger-sidebar {
    max-height: 220px;
  }
}
