:root {
  --bg: #0f1117;
  --panel: #171b23;
  --panel-2: #1e2430;
  --text: #ecf0f6;
  --muted: #99a2b3;
  --accent: #67ea94;
  --accent-2: #f4a259;
  --border: rgba(255,255,255,0.08);
  --danger: #ff6b6b;
  --shadow: 0 10px 30px rgba(0,0,0,0.28);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: #9dc1ff; text-decoration: none; }
a:hover { text-decoration: underline; }

body.obs-transparent {
  background: transparent;
}

.app-shell {
  width: min(1200px, calc(100vw - 24px));
  margin: 12px auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

body.obs .app-shell {
  width: calc(100vw - 8px);
  margin: 4px auto;
  gap: 6px;
}

.topbar,
.channel-tabs,
.message-feed {
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.topbar {
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

body.obs .topbar {
  padding: 10px 14px;
  border-radius: 14px;
}

.kicker {
  color: var(--accent-2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

h1 {
  font-size: clamp(1.1rem, 2vw, 1.75rem);
  line-height: 1.15;
  margin: 4px 0;
}

.subline {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.92rem;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(103,234,148,0.12);
  color: var(--accent);
  font-weight: 700;
}

.live-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(103,234,148,0.75);
}

.controls { display: flex; gap: 8px; }
.control-btn,
.channel-tab {
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  transition: 0.18s ease;
}

body.obs .control-btn,
body.obs .channel-tab {
  padding: 8px 10px;
  border-radius: 10px;
}

.control-btn:hover,
.channel-tab:hover { transform: translateY(-1px); }
.control-btn.active,
.channel-tab.active {
  background: linear-gradient(135deg, rgba(103,234,148,0.18), rgba(244,162,89,0.12));
  border-color: rgba(103,234,148,0.35);
}

.channel-tabs {
  padding: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.message-feed {
  min-height: 60vh;
  padding: 8px;
  overflow: hidden;
}

body.obs .message-feed {
  min-height: calc(100vh - 90px);
}

.message {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 16px;
}

.message:hover {
  background: rgba(255,255,255,0.03);
}

body.compact .message {
  grid-template-columns: 42px 1fr;
  gap: 10px;
  padding: 8px 10px;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: #2a3242;
}

body.compact .avatar {
  width: 34px;
  height: 34px;
}

.message-header {
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
}

.message-author {
  font-weight: 800;
}

.message-time,
.message-meta {
  color: var(--muted);
  font-size: 0.82rem;
}

.message-body {
  margin-top: 2px;
  color: var(--text);
  line-height: 1.45;
  word-break: break-word;
}

.msg-inline-code {
  background: rgba(255,255,255,0.08);
  padding: 2px 6px;
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.msg-codeblock {
  margin: 8px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: #0b0e13;
  border: 1px solid var(--border);
  overflow-x: auto;
}

.msg-underline { text-decoration: underline; }
.msg-strike { text-decoration: line-through; }

.attachments {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.attachment-card {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  max-width: 100%;
}

.attachment-image {
  max-width: min(100%, 520px);
  border-radius: 14px;
  border: 1px solid var(--border);
}

.deleted {
  opacity: 0.72;
}

.deleted .message-body {
  color: #c3cad6;
  font-style: italic;
}

.empty-state {
  min-height: 220px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  padding: 20px;
}

@media (max-width: 760px) {
  .app-shell {
    width: calc(100vw - 12px);
    margin: 6px auto;
  }

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

  .message {
    grid-template-columns: 42px 1fr;
    gap: 10px;
    padding: 8px 10px;
  }

  .avatar {
    width: 34px;
    height: 34px;
  }
}
