/* clyr â€” where you belong | Primary: #40dbf1 */
/* ZT Nature: add font files to fonts/ and uncomment @font-face in fonts/README.md */
/* Until then we use Syne (loaded in HTML) as the main font. */

:root {
  --teal: #40dbf1;
  --teal-dim: #2ab8cc;
  --teal-bright: #7aebfa;
  --teal-glow: rgba(64, 219, 241, 0.4);
  --teal-subtle: rgba(64, 219, 241, 0.08);
  --bg: #06090c;
  --bg-mid: #0c1116;
  --bg-card: #0f1419;
  --bg-card-hover: #141b22;
  --text: #f0f4f8;
  --text-soft: #9aabbb;
  --text-muted: #5c6f82;
  --border: rgba(64, 219, 241, 0.12);
  --font: 'Syne', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  opacity: 1;
  transform: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

/* Chat page: lock viewport so only chat area scrolls */
body.chat-page {
  height: 100vh;
  overflow: hidden;
}

body.page-ready {
  opacity: 1;
  transform: none;
}

body.page-leave {
  opacity: 0;
  transform: translateY(-4px);
}

a {
  color: var(--teal);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover { color: var(--teal-bright); }

/* ---- Page grain (optional depth) ---- */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 9999;
}

/* ---- Header ---- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 1.125rem 1.5rem;
  background: rgba(6, 9, 12, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.04em;
}
.logo:hover { color: var(--teal); }

.nav-links {
  display: flex;
  gap: 2.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  color: var(--text-soft);
  font-weight: 500;
  font-size: 0.9375rem;
}
.nav-links a:hover { color: var(--text); }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.nav-toggle span {
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
}

/* ---- Hero ---- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7rem 1.5rem 5rem;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 100% 80% at 50% -20%, var(--teal-glow) 0%, transparent 55%),
    radial-gradient(ellipse 70% 50% at 50% 100%, rgba(64, 219, 241, 0.06) 0%, transparent 50%);
}

.hero-orb {
  position: absolute;
  width: min(90vw, 720px);
  height: min(90vw, 720px);
  left: 50%;
  top: 45%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(64, 219, 241, 0.15) 0%, rgba(64, 219, 241, 0.04) 40%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 900px;
  text-align: center;
}

.hero-badge {
  display: inline-block;
  margin-bottom: 1.5rem;
  padding: 0.4rem 0.9rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--teal);
  border: 1px solid var(--border);
  border-radius: 100px;
  background: var(--teal-subtle);
}

.hero h1 {
  margin: 0 0 1.5rem;
  font-size: clamp(3.5rem, 12vw, 7rem);
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.hero h1 .line { display: block; }

.hero h1 .accent {
  color: var(--teal);
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-bright) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.you-emphasis {
  color: var(--teal);
  font-weight: 600;
  position: relative;
  display: inline-block;
}

.hero-tagline {
  margin: 0 0 2.25rem;
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  color: var(--text-soft);
  font-weight: 400;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 2rem;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

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

.btn-primary {
  background: var(--teal);
  color: #ffffff;
}
.btn-primary:hover {
  background: var(--teal-bright);
  box-shadow: 0 12px 40px var(--teal-glow);
}

.btn-secondary {
  background: transparent;
  color: var(--teal);
  border: 1.5px solid rgba(64, 219, 241, 0.5);
}
.btn-secondary:hover {
  background: var(--teal-subtle);
  border-color: var(--teal);
}

.btn-large {
  padding: 1.125rem 2.5rem;
  font-size: 1.0625rem;
}

/* ---- Features ---- */
.features {
  padding: 6rem 1.5rem;
}

.section-title {
  font-size: clamp(2.25rem, 5vw, 3.25rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  margin: 0 0 0.75rem;
  text-align: center;
  line-height: 1.1;
}
.section-title .accent {
  color: var(--teal);
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-bright) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-subtitle {
  text-align: center;
  color: var(--text-soft);
  font-size: 1.125rem;
  max-width: 520px;
  margin: 0 auto 3.5rem;
  line-height: 1.5;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  max-width: 1000px;
  margin: 0 auto;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.25rem;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.feature-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(64, 219, 241, 0.25);
  transform: translateY(-4px);
}

.feature-icon {
  width: 52px;
  height: 52px;
  margin-bottom: 1.5rem;
  color: var(--teal);
  display: flex;
  align-items: center;
  justify-content: center;
}

.feature-icon svg { width: 100%; height: 100%; }

.feature-card h3 {
  margin: 0 0 0.6rem;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.feature-card p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.9375rem;
  line-height: 1.55;
}

@media (max-width: 900px) {
  .feature-grid {
    grid-template-columns: 1fr;
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* ---- Why ---- */
.why {
  background: var(--bg-mid);
  padding: 6rem 1.5rem;
  border-top: 1px solid var(--border);
}

.why-content { text-align: center; }

.why-list {
  list-style: none;
  margin: 2.5rem auto 0;
  padding: 0;
  max-width: 480px;
  text-align: left;
}

.why-list li {
  position: relative;
  padding: 1rem 0 1rem 2.25rem;
  color: var(--text-soft);
  font-size: 1.0625rem;
  border-bottom: 1px solid var(--border);
}
.why-list li:last-child { border-bottom: none; }

.why-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 1.35rem;
  width: 10px;
  height: 10px;
  background: var(--teal);
  border-radius: 50%;
  box-shadow: 0 0 20px var(--teal-glow);
}

/* ---- CTA ---- */
.cta-section { padding: 6rem 1.5rem; }

.cta-box {
  max-width: 560px;
  margin: 0 auto;
  background: linear-gradient(160deg, var(--bg-card) 0%, var(--bg-mid) 100%);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3.5rem 2.5rem;
  text-align: center;
}

.cta-box h2 {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.cta-box > p {
  margin: 0 0 1.75rem;
  color: var(--text-soft);
  font-size: 1rem;
}

.cta-buttons { margin-bottom: 1rem; }

.cta-note {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0 !important;
}

/* ---- Footer ---- */
.footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 1.5rem;
  background: var(--bg-mid);
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}

.footer .logo {
  display: inline-block;
  margin-bottom: 0.25rem;
}

.footer-tagline {
  color: var(--text-muted);
  font-size: 0.9375rem;
  margin: 0 0 1.5rem;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.75rem;
  margin-bottom: 1.5rem;
}

.footer-nav a {
  color: var(--text-muted);
  font-size: 0.9375rem;
}
.footer-nav a:hover { color: var(--teal); }

.footer-copy {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* ---- Mobile ---- */
@media (max-width: 640px) {
  .nav-links { display: none; }
  .nav-toggle { display: flex; }

  .nav.open .nav-links {
    display: flex;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    padding: 1rem;
    background: var(--bg-mid);
    border-bottom: 1px solid var(--border);
  }
  .nav.open .nav-links li {
    padding: 0.875rem 0;
    border-bottom: 1px solid var(--border);
  }
  .nav.open .nav-links li:last-child { border-bottom: none; }

  .hero { padding: 6rem 1.25rem 4rem; }
  .hero h1 { font-size: clamp(2.75rem, 14vw, 4rem); }
}

/* ---- Auth (register / login) ---- */
.auth-page .auth-main {
  min-height: 100vh;
  padding: 6rem 1.5rem 4rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2.5rem;
}

.auth-step h1 {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.auth-subtitle {
  margin: 0 0 1.75rem;
  color: var(--text-soft);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.auth-form label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-soft);
}

.auth-form input {
  width: 100%;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-family: var(--font);
  font-size: 1rem;
  color: var(--text);
  background: var(--bg-mid);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.2s ease;
}

.auth-form input::placeholder {
  color: var(--text-muted);
}

.auth-form input:focus {
  border-color: var(--teal);
}

.auth-form .btn-block {
  width: 100%;
  margin-top: 0.5rem;
}

.auth-error {
  margin: 0 0 1rem;
  padding: 0.5rem 0;
  font-size: 0.875rem;
  color: #f87171;
}

.auth-error[hidden] { display: none; }

/* 2FA setup */
.twofa-setup {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 1.75rem;
  padding: 1.25rem;
  background: var(--bg-mid);
  border-radius: 14px;
  border: 1px solid var(--border);
}

.twofa-qr-wrap {
  flex-shrink: 0;
  text-align: center;
}

.twofa-qr-label,
.twofa-manual-label {
  margin: 0 0 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
}

.twofa-qr {
  display: block;
  width: 200px;
  height: 200px;
  border-radius: 10px;
  background: #fff;
}

.twofa-manual {
  flex: 1;
  min-width: 0;
}

.twofa-secret {
  display: block;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.75rem;
  font-size: 0.8125rem;
  letter-spacing: 0.05em;
  word-break: break-all;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-soft);
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

/* Success step */
.auth-step-success {
  text-align: center;
}

.success-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1.25rem;
  background: var(--teal);
  border-radius: 50%;
  position: relative;
}

.success-icon::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 22px;
  margin-left: -6px;
  margin-top: -14px;
  border: solid #06090c;
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}

.auth-step-success .btn-block {
  margin-top: 1rem;
}

.auth-footer-link {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.auth-footer-link a {
  color: var(--teal);
  font-weight: 500;
}

.auth-field-hint {
  margin: -0.75rem 0 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.auth-success {
  margin: 0 0 1rem;
  padding: 0.5rem 0;
  font-size: 0.875rem;
  color: var(--teal);
}

.auth-success[hidden] { display: none; }

.settings-section {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.settings-section h2 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
}

.auth-form textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-family: var(--font);
  font-size: 1rem;
  color: var(--text);
  background: var(--bg-mid);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  resize: vertical;
  transition: border-color 0.2s ease;
}

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

.auth-form textarea:focus {
  border-color: var(--teal);
}

/* Profile preview (settings page) */
.profile-preview {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin: 1.5rem 0 1rem;
}

.profile-avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: var(--bg-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-soft);
  overflow: hidden;
  background-size: cover;
  background-position: center;
}

.profile-preview-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.profile-preview-username {
  font-size: 0.9rem;
  font-weight: 600;
}

.profile-preview-display {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.nav-links a.active {
  color: var(--teal);
}

/* ---- Legal pages (Privacy, Terms) ---- */
.legal-main {
  min-height: calc(100vh - 200px);
  padding: 7rem 1.5rem 4rem;
  max-width: 800px;
  margin: 0 auto;
}

.legal-content {
  color: var(--text);
}

.legal-content h1 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 0.5rem;
  color: var(--text);
}

.legal-content h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 2.5rem 0 1rem;
  color: var(--text);
}

.legal-content h2:first-of-type {
  margin-top: 2rem;
}

.legal-updated {
  color: var(--text-muted);
  font-size: 0.9375rem;
  margin: 0 0 2rem;
}

.legal-content p {
  margin: 0 0 1.25rem;
  line-height: 1.7;
  color: var(--text-soft);
}

.legal-content ul,
.legal-content ol {
  margin: 1rem 0 1.5rem;
  padding-left: 1.75rem;
  color: var(--text-soft);
  line-height: 1.7;
}

.legal-content li {
  margin-bottom: 0.75rem;
}

.legal-content strong {
  color: var(--text);
  font-weight: 600;
}

.legal-content a {
  color: var(--teal);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.legal-content a:hover {
  color: var(--teal-bright);
}

.legal-content section {
  margin-bottom: 2.5rem;
}

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

/* ---- Why / Features page ---- */
.why-page .why-hero {
  position: relative;
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7rem 1.5rem 4rem;
  overflow: hidden;
}

.why-hero-inner {
  position: relative;
  z-index: 1;
  max-width: 920px;
  text-align: center;
}

.why-title {
  margin: 0 0 1.25rem;
  font-size: clamp(2.75rem, 7.5vw, 4.75rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.02;
}

.why-lede {
  margin: 0 auto 2.25rem;
  max-width: 640px;
  color: var(--text-soft);
  font-size: 1.125rem;
  line-height: 1.6;
}

.why-section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 5.5rem 1.5rem;
}

.why-grid {
  max-width: 1000px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.why-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.75rem;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.why-card:hover {
  transform: translateY(-4px);
  border-color: rgba(64, 219, 241, 0.25);
  background: var(--bg-card-hover);
}

.why-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.why-card p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.65;
  font-size: 0.95rem;
}

.why-split {
  background: var(--bg-mid);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.why-split {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 2rem;
  align-items: start;
}

.why-split-col {
  padding: 0;
}

.why-metrics {
  display: grid;
  gap: 1rem;
}

.metric {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
}

.metric-value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--teal);
}

.metric-label {
  margin-top: 0.25rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

@media (max-width: 980px) {
  .why-grid { grid-template-columns: 1fr; max-width: 520px; }
  .why-split { grid-template-columns: 1fr; }
}

/* ---- Chat layout ---- */
.chat-page {
  background: var(--bg-mid);
}

.chat-layout {
  display: grid;
  grid-template-columns: 72px 260px minmax(0, 1fr);
  height: 100vh;
}

.chat-sidebar {
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.chat-sidebar-zones {
  align-items: center;
  padding: 0.75rem 0.5rem;
  gap: 0.75rem;
}

.chat-sidebar-header .logo-mini {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--teal);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.06em;
  margin-bottom: 0.5rem;
}

.zones-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.zone-pill {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: none;
  background: var(--bg-mid);
  color: var(--text-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-radius 0.15s ease, transform 0.15s ease;
}

.zone-pill:hover {
  background: var(--teal-subtle);
  color: var(--teal);
  transform: translateY(-1px);
}

.zone-pill-active {
  background: var(--teal);
  color: #ffffff;
}

.zone-pill-initial {
  font-weight: 700;
  font-size: 0.95rem;
}

.zone-pill-add {
  font-size: 1.4rem;
  font-weight: 600;
}

.chat-sidebar-main {
  background: var(--bg-mid);
}

.chat-zone-header {
  height: 52px;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-zone-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.zone-manage-btn,
.zone-invite-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.3rem;
  border-radius: 6px;
  transition: background 0.15s ease, color 0.15s ease;
}

.zone-manage-btn:hover,
.zone-invite-btn:hover {
  background: var(--bg-mid);
  color: var(--text);
}

.chat-zone-name {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.dot-online {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--teal);
  box-shadow: 0 0 12px var(--teal-glow);
}

.channel-list {
  flex: 1;
  padding: 0.75rem 0.5rem 0.5rem 0.4rem;
  overflow-y: auto;
}

.channel-section-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  color: var(--text-muted);
  padding: 0.4rem 0.75rem;
}

.channel-item {
  width: 100%;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.9rem;
  color: var(--text-soft);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.channel-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.channel-item-active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.channel-hash {
  font-weight: 600;
  color: var(--text-muted);
}

.channel-icon {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.chat-user-footer {
  border-top: 1px solid var(--border);
  padding: 0.55rem 0.75rem;
}

.chat-user-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.avatar-mini {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--teal);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: #ffffff;
  background-size: cover;
  background-position: center;
  overflow: hidden;
}

.chat-user-meta {
  display: flex;
  flex-direction: column;
}

.chat-user-name {
  font-size: 0.9rem;
  font-weight: 600;
}

.chat-user-tag {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.chat-main {
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.chat-main-header {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}

.chat-main-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.chat-main-title h1 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.chat-main-subtitle {
  margin: 0.3rem 0 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.chat-messages {
  flex: 1;
  padding: 1rem 1rem 0.5rem;
  overflow-y: auto;
  min-height: 0;
  max-height: 100%;
}

.message {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-soft);
  background-size: cover;
  background-position: center;
  overflow: hidden;
}

.message-avatar.bot {
  background: var(--teal-subtle);
  color: var(--teal);
}

.message-body {
  flex: 1;
}

.message-header {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.message-author {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.message-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.message-text {
  margin: 0.1rem 0 0;
  font-size: 0.95rem;
  color: var(--text-soft);
}

.chat-input-bar {
  padding: 0.5rem 1rem 0.85rem;
  border-top: 1px solid var(--border);
}

.chat-input-inner {
  display: flex;
  gap: 0.5rem;
}

.chat-input {
  flex: 1;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-mid);
  padding: 0.7rem 1rem;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.95rem;
  outline: none;
}

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

.chat-input:focus {
  border-color: var(--teal);
}

.chat-send-btn {
  padding-inline: 1.25rem;
}

.chat-input-hint {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.chat-loading {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.zone-invite-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 6px;
  transition: background 0.2s ease, color 0.2s ease;
}

.zone-invite-btn:hover {
  background: var(--bg-mid);
  color: var(--text);
}

.chat-zone-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-content {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-content h2 {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
  font-weight: 700;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

.invite-link-box {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0;
}

.invite-url-input {
  flex: 1;
  padding: 0.75rem 1rem;
  font-family: var(--font-mono, monospace);
  font-size: 0.875rem;
  background: var(--bg-mid);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
}

@media (max-width: 900px) {
  .chat-layout {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .chat-sidebar-main {
    display: none;
  }
}


/* ============================
   CLYR CORE LAYOUT FIX
   ============================ */

html,
body {
  height: 100%;
}

body.chat-page {
  height: 100vh;
  overflow: hidden;
}

/* Root layout */
.chat-layout {
  display: flex;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

/* Sidebars */
.chat-sidebar {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.chat-sidebar-zones {
  flex: 0 0 72px;
}

.chat-sidebar-main {
  flex: 0 0 260px;
}

/* Scrollable lists */
.zones-list,
.channel-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

/* User footer must NEVER scroll */
.chat-user-footer {
  flex-shrink: 0;
}

/* Main chat column */
.chat-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 100%;
  min-width: 0;
  overflow: hidden;
}

/* Chat header stays fixed */
.chat-main-header {
  flex-shrink: 0;
}

/* Messages scroll â€” nothing else */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

/* Input bar locked to bottom */
.chat-input-bar {
  flex-shrink: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: inherit;
}

/* Prevent flex overflow bugs (Chrome/Safari fix) */
.chat-sidebar *,
.chat-main * {
  min-height: 0;
}