:root {
  --paper: #f4eee2;
  --paper-2: #fffaf0;
  --paper-3: #eae0d0;
  --ink: #17140f;
  --ink-2: #2b251d;
  --muted: #7d7264;
  --line: #d6c9b6;
  --line-ink: #1d1913;
  --accent: #ff5c35;
  --accent-2: #ffd166;
  --lime: #b9e66d;
  --danger: #c74949;
  --danger-bg: #f9e2dc;
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Archivo", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
  --radius: 14px;
  --ease: cubic-bezier(0.22, 0.8, 0.24, 1);
}

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

html {
  background: var(--paper);
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.45;
  background-image: radial-gradient(rgba(23, 20, 15, 0.055) 0.55px, transparent 0.8px);
  background-size: 4px 4px;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
  cursor: pointer;
}

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

p,
h1,
h2,
h3,
ul {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

::selection {
  background: var(--accent-2);
  color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.is-hidden {
  display: none !important;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-xs {
  width: 13px;
  height: 13px;
}

.icon-sm {
  width: 16px;
  height: 16px;
}

/* ── Shared bits ─────────────────────────────────────────────────── */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--ink);
  border-radius: 9px;
  box-shadow: 2px 2px 0 var(--ink);
}

.brand-name {
  color: var(--ink);
  font-family: var(--display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.04em;
  white-space: nowrap;
}

.brand-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex: 0 0 auto;
}

.brand-light .brand-name {
  color: var(--paper);
}

.brand-light .brand-mark {
  border-color: var(--paper);
  box-shadow: 2px 2px 0 var(--accent-2);
}

.brand-light .brand-dot {
  background: var(--accent-2);
}

.sticker {
  display: inline-block;
  padding: 4px 8px;
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  background: var(--accent-2);
  box-shadow: 2px 2px 0 var(--ink);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.02em;
  transform: rotate(-3deg);
  white-space: nowrap;
}

.nav-link {
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 9.5px;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.16s, color 0.16s;
}

.nav-link:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 44px;
  padding: 0 16px;
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  background: var(--paper-2);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: transform 0.16s var(--ease), box-shadow 0.16s var(--ease), background 0.16s;
}

.btn:hover {
  transform: translate(-1px, -1px);
}

.btn:active {
  transform: translate(0, 0);
}

.btn:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}

.btn-primary {
  background: var(--ink);
  color: var(--paper);
  box-shadow: 3px 3px 0 var(--accent);
}

.btn-primary:hover {
  box-shadow: 5px 5px 0 var(--accent);
}

.btn-primary:disabled {
  box-shadow: 3px 3px 0 var(--accent);
}

.btn-soft {
  background: var(--paper-2);
  color: var(--ink);
  box-shadow: 2px 2px 0 var(--line);
}

.btn-soft:hover {
  box-shadow: 4px 4px 0 var(--line);
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}

.btn-ghost:hover {
  background: rgba(244, 238, 226, 0.08);
  color: var(--paper);
  transform: none;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  box-shadow: 2px 2px 0 var(--ink);
  font-size: 10px;
}

.btn-arrow {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1;
}

.btn-spinner {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border: 2px solid rgba(244, 238, 226, 0.3);
  border-top-color: var(--paper);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.btn-spinner.is-hidden {
  display: none !important;
}

.btn-spinner:not(.is-hidden) + .btn-arrow {
  display: none;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 1.5px solid var(--ink);
  border-radius: 7px;
  background: var(--paper-2);
  color: var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  transition: transform 0.15s var(--ease), box-shadow 0.15s, background 0.15s;
}

.icon-btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--ink);
}

.icon-btn-sm {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  box-shadow: 1px 1px 0 var(--ink);
}

.icon-btn-sm .icon {
  width: 13px;
  height: 13px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 13px;
}

.field > span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: lowercase;
}

.field input {
  width: 100%;
  height: 45px;
  padding: 0 12px;
  border: 1.5px solid var(--ink);
  border-radius: 7px;
  outline: 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  transition: box-shadow 0.16s, background 0.16s;
}

.field input::placeholder {
  color: #9a8f80;
}

.field input:focus {
  background: var(--paper-2);
  box-shadow: 3px 3px 0 var(--accent-2);
}

.field input:disabled {
  opacity: 0.55;
}

.form-error {
  margin: 0 0 12px;
  padding: 8px 10px;
  border: 1px solid var(--danger);
  border-radius: 5px;
  background: var(--danger-bg);
  color: #982f2f;
  font-size: 10.5px;
  line-height: 1.5;
}

/* ── Landing ──────────────────────────────────────────────────────── */

.landing-page {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  overflow-x: hidden;
}

.landing-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
  padding: 20px 0;
  border-bottom: 1.5px solid var(--ink);
}

.landing-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.landing-main {
  position: relative;
  z-index: 1;
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: minmax(0, 1.06fr) minmax(360px, 0.94fr);
  align-items: center;
  gap: 64px;
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
  padding: 48px 0 42px;
}

.hero {
  position: relative;
  max-width: 630px;
}

.hero-kicker {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 18px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.015em;
}

.hero-kicker span {
  color: var(--accent);
  font-size: 12px;
}

.hero-title {
  max-width: 620px;
  color: var(--ink);
  font-family: var(--display);
  font-size: clamp(46px, 5.6vw, 70px);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 0.98;
  text-wrap: balance;
}

.marker {
  display: inline-block;
  padding: 0 0.08em;
  border-radius: 2px;
  background: var(--accent-2);
  color: var(--ink);
  transform: rotate(-1.4deg);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.hero-description {
  max-width: 500px;
  margin-top: 22px;
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.62;
}

.feature-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
}

.feature-list li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 9.5px;
}

.feature-list li span {
  color: var(--accent);
  font-size: 11px;
}

.privacy-note {
  margin-top: 18px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8.5px;
  line-height: 1.5;
}

.hero-star {
  position: absolute;
  top: -48px;
  right: 2px;
  color: var(--accent);
  font-family: var(--display);
  font-size: 92px;
  line-height: 1;
  transform: rotate(11deg);
  pointer-events: none;
  user-select: none;
}

.entry-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  justify-self: end;
  padding: 26px;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper-2);
  box-shadow: 8px 8px 0 var(--ink);
}

.entry-card::before {
  content: "";
  position: absolute;
  top: -13px;
  left: 50%;
  width: 82px;
  height: 23px;
  border: 1px solid var(--ink);
  background: var(--accent-2);
  transform: translateX(-50%) rotate(-2.3deg);
  opacity: 0.92;
  pointer-events: none;
}

.entry-head {
  margin-bottom: 18px;
}

.entry-eyebrow {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.06em;
  text-transform: lowercase;
}

.entry-head h2 {
  margin-top: 4px;
  color: var(--ink);
  font-family: var(--display);
  font-size: 29px;
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.1;
}

.entry-head p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11.5px;
}

.mode-switch {
  display: flex;
  gap: 20px;
  margin: 0 0 5px;
  border-bottom: 1.5px solid var(--ink);
}

.mode-btn {
  margin-bottom: -1.5px;
  padding: 8px 0 9px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  transition: color 0.16s, border-color 0.16s;
}

.mode-btn:hover {
  color: var(--ink);
}

.mode-btn.is-active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.entry-card .field:first-of-type {
  margin-top: 18px;
}

.entry-foot {
  margin-top: 15px;
  padding-top: 13px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  text-align: center;
}

.landing-footer {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: min(1120px, calc(100% - 48px));
  margin: auto auto 0;
  padding: 16px 0 22px;
  border-top: 1.5px solid var(--ink);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
}

.landing-footer strong {
  color: var(--ink);
  font-weight: 500;
}

.landing-footer a {
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
}

.landing-footer a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.footer-sep {
  margin: 0 6px;
  color: #b3a695;
}

.footer-tech {
  color: #9a8f80;
}

/* ── Chat layout ──────────────────────────────────────────────────── */

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

.chat-shell {
  position: relative;
  z-index: 1;
  display: flex;
  height: 100dvh;
}

.chat-sidebar {
  display: flex;
  flex-direction: column;
  width: 292px;
  flex: 0 0 292px;
  padding: 18px;
  border-right: 1.5px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(244, 238, 226, 0.22);
}

.sidebar-head .brand-name {
  font-size: 17px;
}

.sidebar-head .brand-mark {
  width: 31px;
  height: 31px;
}

.sidebar-close {
  display: none;
  border-color: rgba(244, 238, 226, 0.35);
  background: transparent;
  color: var(--paper);
  box-shadow: none;
}

.room-card {
  margin-top: 18px;
  padding: 12px;
  border: 1.5px solid var(--ink);
  border-radius: 9px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 4px 4px 0 var(--accent);
}

.room-card-label {
  display: block;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.04em;
  text-transform: lowercase;
}

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

.room-card-code code {
  overflow: hidden;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
  text-overflow: ellipsis;
}

.room-card p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 8.5px;
  line-height: 1.5;
}

.members-section {
  margin-top: 26px;
  min-height: 0;
}

.section-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.section-line h2 {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #c7bdaf;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.section-line h2 .icon {
  color: var(--accent-2);
}

.count-badge {
  display: inline-grid;
  place-items: center;
  min-width: 19px;
  height: 18px;
  padding: 0 5px;
  border: 1px solid rgba(244, 238, 226, 0.3);
  border-radius: 4px;
  color: var(--paper);
  font-family: var(--mono);
  font-size: 8px;
}

.member-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: min(300px, 36vh);
  overflow-y: auto;
}

.member {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 5px 6px;
  border-radius: 6px;
}

.member:hover {
  background: rgba(244, 238, 226, 0.07);
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  color: var(--ink);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: -0.02em;
  box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.35);
}

.member-name {
  overflow: hidden;
  min-width: 0;
  color: var(--paper);
  font-size: 10.5px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-you {
  margin-left: auto;
  color: var(--accent-2);
  font-family: var(--mono);
  font-size: 7px;
}

.sidebar-spacer {
  flex: 1 1 auto;
}

.sidebar-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 16px;
  padding: 10px;
  border: 1px solid rgba(244, 238, 226, 0.22);
  border-radius: 7px;
  color: #c7bdaf;
}

.sidebar-note .icon {
  margin-top: 1px;
  color: var(--accent-2);
}

.sidebar-note p {
  font-size: 8px;
  line-height: 1.55;
}

.sidebar-foot {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(244, 238, 226, 0.22);
}

.sidebar-foot .btn {
  justify-content: flex-start;
  padding-left: 4px;
  color: #c7bdaf;
}

.sidebar-hosted {
  display: block;
  margin-top: 8px;
  color: #9c9181;
  font-family: var(--mono);
  font-size: 7px;
  text-align: center;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
}

.sidebar-hosted:hover {
  color: var(--accent-2);
  text-decoration-color: var(--accent-2);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(23, 20, 15, 0.42);
}

.chat-main {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  background: var(--paper);
}

.chat-header {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 68px;
  padding: 0 18px;
  border-bottom: 1.5px solid var(--ink);
  background: var(--paper);
}

.mobile-menu {
  display: none;
}

.chat-heading {
  min-width: 0;
}

.chat-kicker {
  display: block;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1;
  text-transform: lowercase;
}

.chat-heading h1 {
  display: inline-flex;
  max-width: 100%;
  margin-top: 4px;
  padding: 3px 8px;
  overflow: hidden;
  border-radius: 5px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-heading h1 span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.connection-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 27px;
  padding: 0 9px;
  border: 1.5px solid var(--ink);
  border-radius: 99px;
  background: var(--paper-2);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 8px;
  white-space: nowrap;
}

.connection-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-2);
}

.connection-pill.is-online .connection-dot {
  background: var(--lime);
  box-shadow: 0 0 0 1px rgba(23, 20, 15, 0.2);
}

.connection-pill.is-offline .connection-dot {
  background: var(--danger);
}

.connection-pill.is-connecting .connection-dot {
  background: var(--accent);
  animation: pulse 1.4s infinite;
}

.connection-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-bottom: 1.5px solid var(--ink);
  background: var(--accent-2);
  color: var(--ink);
  font-size: 9.5px;
}

.connection-banner .icon {
  color: var(--ink);
}

.connection-banner .btn {
  margin-left: auto;
  color: var(--ink);
  background: var(--paper-2);
}

.messages {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px 24px 12px;
  background-color: var(--paper);
  background-image: linear-gradient(rgba(23, 20, 15, 0.045) 1px, transparent 1px);
  background-size: 100% 34px;
  scrollbar-width: thin;
  scrollbar-color: #b7a995 transparent;
}

.messages::-webkit-scrollbar {
  width: 9px;
}

.messages::-webkit-scrollbar-thumb {
  border: 2px solid var(--paper);
  border-radius: 99px;
  background: #b7a995;
}

.messages-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: min(880px, 100%);
  margin: 0 auto;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: min(390px, 100%);
  min-height: 100%;
  margin: 0 auto;
  padding: 36px 18px;
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  margin-bottom: 14px;
  border: 1.5px solid var(--ink);
  border-radius: 9px;
  background: var(--accent-2);
  color: var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
}

.empty-icon .icon {
  width: 23px;
  height: 23px;
}

.empty-state h2 {
  color: var(--ink);
  font-family: var(--display);
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.empty-state p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10.5px;
}

.empty-state .btn {
  margin-top: 16px;
}

.message {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  max-width: 78%;
  animation: messageIn 0.22s var(--ease) both;
}

.message-avatar {
  margin-top: 2px;
}

.message-body {
  min-width: 0;
}

.message-meta {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin: 0 0 3px 2px;
}

.message-author {
  overflow: hidden;
  max-width: 180px;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-time {
  color: #9a8f80;
  font-family: var(--mono);
  font-size: 7.5px;
}

.message-bubble {
  padding: 9px 12px;
  border: 1.5px solid var(--ink);
  border-radius: 4px 13px 13px 13px;
  background: var(--paper-2);
  color: var(--ink);
  box-shadow: 2px 2px 0 rgba(23, 20, 15, 0.18);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.message.is-own {
  flex-direction: row-reverse;
  align-self: flex-end;
}

.message.is-own .message-body {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.message.is-own .message-meta {
  flex-direction: row;
  margin: 0 2px 3px 0;
}

.message.is-own .message-author {
  color: var(--ink-2);
}

.message.is-own .message-bubble {
  border-color: var(--ink);
  border-radius: 13px 4px 13px 13px;
  background: var(--accent);
  color: var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
}

.message.is-own .message-avatar {
  display: none;
}

.message.is-grouped {
  margin-top: -10px;
}

.message.is-grouped .message-avatar,
.message.is-grouped .message-meta {
  visibility: hidden;
  height: 0;
  margin: 0;
}

.message.is-system {
  max-width: 100%;
  justify-content: center;
  margin: 1px 0;
}

.message-system-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border: 1px dashed var(--line);
  border-radius: 99px;
  background: transparent;
  color: #8d8172;
  font-family: var(--mono);
  font-size: 8px;
  text-align: center;
}

.message-system-pill .icon {
  width: 10px;
  height: 10px;
  color: var(--accent);
}

.message-status {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  color: #9a8f80;
  font-family: var(--mono);
  font-size: 7.5px;
}

.message-status.is-failed {
  color: var(--danger);
}

.message-status .retry-btn {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 7.5px;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.file-bubble {
  max-width: 340px;
  padding: 4px;
  overflow: hidden;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  background: var(--paper-2);
  box-shadow: 2px 2px 0 rgba(23, 20, 15, 0.18);
}

.message.is-own .file-bubble {
  border-color: var(--ink);
  background: var(--paper-2);
  box-shadow: 2px 2px 0 var(--ink);
}

.file-image {
  display: block;
  max-width: 100%;
  max-height: 280px;
  border-radius: 6px;
  object-fit: cover;
}

.file-video {
  display: block;
  width: 100%;
  max-height: 280px;
  border-radius: 6px;
  background: var(--ink);
}

.file-card {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 210px;
  padding: 9px;
}

.file-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  background: var(--accent-2);
  color: var(--ink);
}

.file-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.file-name {
  overflow: hidden;
  max-width: 230px;
  color: var(--ink);
  font-size: 9.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7.5px;
}

.file-download {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-left: auto;
  flex: 0 0 auto;
  border-radius: 5px;
  color: var(--muted);
}

.file-download:hover {
  background: var(--paper-3);
  color: var(--ink);
}

.scroll-bottom {
  position: absolute;
  right: 22px;
  bottom: 112px;
  z-index: 8;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 10px;
  border: 1.5px solid var(--ink);
  border-radius: 99px;
  background: var(--ink);
  color: var(--paper);
  box-shadow: 3px 3px 0 var(--accent);
  font-family: var(--mono);
  font-size: 8px;
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity 0.16s, transform 0.16s;
}

.scroll-bottom.is-visible {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.typing-indicator {
  min-height: 21px;
  padding: 0 26px;
  color: #8d8172;
  font-family: var(--mono);
  font-size: 8px;
  line-height: 21px;
}

.typing-indicator .typing-dots {
  display: inline-flex;
  gap: 2px;
  margin-left: 4px;
  vertical-align: middle;
}

.typing-indicator .typing-dots span {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--accent);
  animation: typing 1.2s infinite;
}

.typing-indicator .typing-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-indicator .typing-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

.composer-area {
  position: relative;
  z-index: 4;
  padding: 0 18px 13px;
  background: var(--paper);
}

.file-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  width: min(880px, 100%);
  margin: 0 auto 7px;
}

.file-chips:empty {
  display: none;
}

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 220px;
  height: 27px;
  padding: 0 5px 0 8px;
  border: 1.5px solid var(--ink);
  border-radius: 5px;
  background: var(--paper-2);
  color: var(--ink);
  box-shadow: 1px 1px 0 var(--line);
  font-size: 8.5px;
}

.file-chip-name {
  overflow: hidden;
  max-width: 150px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-chip-size {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7px;
}

.file-chip-remove {
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
}

.file-chip-remove:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  width: min(880px, 100%);
  margin: 0 auto;
  padding: 5px;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  background: var(--paper-2);
  box-shadow: 4px 4px 0 var(--ink);
  transition: box-shadow 0.16s;
}

.composer:focus-within {
  box-shadow: 4px 4px 0 var(--accent);
}

.attach-btn {
  display: grid;
  place-items: center;
  width: 33px;
  height: 33px;
  flex: 0 0 auto;
  border-radius: 5px;
  color: var(--muted);
  cursor: pointer;
}

.attach-btn:hover {
  background: var(--paper-3);
  color: var(--ink);
}

.composer textarea {
  width: 100%;
  min-height: 33px;
  max-height: 150px;
  padding: 7px 4px;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.5;
  scrollbar-width: thin;
}

.composer textarea::placeholder {
  color: #9a8f80;
}

.composer textarea:disabled {
  opacity: 0.5;
}

.send-btn {
  display: grid;
  place-items: center;
  width: 33px;
  height: 33px;
  flex: 0 0 auto;
  border: 1.5px solid var(--ink);
  border-radius: 5px;
  background: var(--accent);
  color: var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  transition: transform 0.15s var(--ease), box-shadow 0.15s, opacity 0.15s;
}

.send-btn:hover:not(:disabled) {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--ink);
}

.send-btn:disabled {
  border-color: var(--line);
  background: var(--paper-3);
  color: #a99e8f;
  box-shadow: none;
  cursor: not-allowed;
}

.send-btn .icon {
  width: 16px;
  height: 16px;
}

.composer-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  width: min(880px, 100%);
  margin: 5px auto 0;
  padding: 0 4px;
  color: #9a8f80;
  font-family: var(--mono);
  font-size: 7.5px;
}

.composer-hint {
  color: #a99e8f;
}

/* ── Join modal & toasts ──────────────────────────────────────────── */

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(23, 20, 15, 0.42);
  animation: fadeIn 0.18s ease both;
}

.modal-card {
  position: relative;
  width: min(390px, 100%);
  padding: 26px;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper-2);
  box-shadow: 8px 8px 0 var(--ink);
  animation: modalIn 0.22s var(--ease) both;
}

.modal-card::before {
  content: "";
  position: absolute;
  top: -12px;
  left: 50%;
  width: 74px;
  height: 21px;
  border: 1px solid var(--ink);
  background: var(--accent-2);
  transform: translateX(-50%) rotate(2deg);
  opacity: 0.9;
}

.modal-logo {
  display: block;
  width: 44px;
  height: 44px;
  margin-bottom: 14px;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  box-shadow: 2px 2px 0 var(--ink);
}

.modal-card h2 {
  margin-top: 4px;
  color: var(--ink);
  font-family: var(--display);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.08;
}

.modal-card .field {
  margin-top: 18px;
}

.modal-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.04em;
  text-transform: lowercase;
}

.eyebrow code {
  color: var(--ink-2);
  letter-spacing: 0;
}

.modal-back {
  display: block;
  margin-top: 14px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  text-align: center;
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

.toast-stack {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: min(340px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 11px;
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  background: var(--ink);
  box-shadow: 3px 3px 0 var(--accent);
  color: var(--paper);
  font-size: 10px;
  line-height: 1.45;
  pointer-events: auto;
  animation: toastIn 0.22s var(--ease) both;
}

.toast .icon {
  width: 14px;
  height: 14px;
  margin-top: 1px;
  color: var(--accent-2);
}

.toast.is-error {
  box-shadow: 3px 3px 0 var(--danger);
}

.toast.is-error .icon {
  color: #ff9b8f;
}

.toast.is-warning .icon {
  color: var(--accent-2);
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(4px);
  transition: 0.16s;
}

/* ── Not found ────────────────────────────────────────────────────── */

.not-found-page {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 24px;
}

.not-found-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  padding: 30px;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper-2);
  box-shadow: 8px 8px 0 var(--ink);
}

.not-found-card .modal-logo {
  margin-bottom: 16px;
}

.not-found-card h1 {
  margin-top: 5px;
  color: var(--ink);
  font-family: var(--display);
  font-size: 33px;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.08;
}

.not-found-card p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.6;
}

.not-found-card .btn {
  margin-top: 20px;
}

.noscript-message {
  position: fixed;
  inset: auto 16px 16px;
  z-index: 120;
  padding: 12px;
  border: 1.5px solid var(--danger);
  border-radius: 6px;
  background: var(--danger-bg);
  color: #8f2c2c;
  font-size: 11px;
  text-align: center;
}

/* ── Responsive ───────────────────────────────────────────────────── */

@media (max-width: 980px) {
  .landing-main {
    grid-template-columns: minmax(0, 1fr) minmax(330px, 0.86fr);
    gap: 38px;
  }

  .hero-title {
    font-size: clamp(44px, 5.8vw, 60px);
  }

  .hero-star {
    font-size: 72px;
  }
}

@media (max-width: 860px) {
  .landing-main {
    grid-template-columns: 1fr;
    gap: 42px;
    width: min(600px, calc(100% - 36px));
    padding: 48px 0 42px;
  }

  .hero {
    max-width: none;
  }

  .entry-card {
    max-width: 500px;
    justify-self: stretch;
  }

  .hero-star {
    display: none;
  }

  .landing-footer {
    width: min(600px, calc(100% - 36px));
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .chat-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    width: min(308px, 86vw);
    transform: translateX(-102%);
    transition: transform 0.22s var(--ease);
  }

  .chat-sidebar.is-open {
    transform: none;
  }

  .sidebar-close,
  .mobile-menu {
    display: inline-grid;
  }

  .chat-header {
    padding: 0 12px;
  }

  .messages {
    padding: 16px 14px 10px;
  }

  .message {
    max-width: 88%;
  }

  .composer-area {
    padding: 0 12px 10px;
  }

  .typing-indicator {
    padding: 0 16px;
  }

  .scroll-bottom {
    right: 14px;
    bottom: 116px;
  }
}

@media (max-width: 560px) {
  .landing-header {
    width: calc(100% - 32px);
    padding: 16px 0;
  }

  .landing-nav {
    gap: 12px;
  }

  .sticker {
    display: none;
  }

  .brand-name {
    font-size: 18px;
  }

  .nav-link {
    font-size: 9px;
  }

  .landing-main {
    width: calc(100% - 32px);
    padding: 38px 0 32px;
    gap: 30px;
  }

  .hero-kicker {
    margin-bottom: 14px;
    font-size: 8px;
  }

  .hero-title {
    font-size: clamp(40px, 12.5vw, 51px);
  }

  .hero-description {
    margin-top: 16px;
    font-size: 13px;
  }

  .feature-list {
    gap: 9px 16px;
    margin-top: 20px;
    padding-top: 13px;
  }

  .feature-list li {
    font-size: 8.5px;
  }

  .privacy-note {
    margin-top: 14px;
    font-size: 7.5px;
  }

  .entry-card {
    padding: 20px;
    box-shadow: 6px 6px 0 var(--ink);
  }

  .entry-head h2 {
    font-size: 26px;
  }

  .entry-card::before {
    width: 70px;
  }

  .landing-footer {
    width: calc(100% - 32px);
    font-size: 7.5px;
  }

  .chat-header {
    min-height: 60px;
    gap: 8px;
  }

  .chat-kicker {
    display: none;
  }

  .chat-heading h1 {
    margin-top: 0;
    font-size: 11px;
  }

  .connection-pill {
    height: 25px;
    padding: 0 7px;
    font-size: 7px;
  }

  .chat-header-actions {
    gap: 5px;
  }

  .chat-header-actions .icon-btn {
    width: 30px;
    height: 30px;
  }

  .messages {
    padding: 12px 10px 8px;
  }

  .messages-list {
    gap: 13px;
  }

  .message {
    max-width: 93%;
    gap: 6px;
  }

  .avatar {
    width: 25px;
    height: 25px;
    border-radius: 5px;
    font-size: 9px;
  }

  .message-bubble {
    padding: 8px 10px;
    font-size: 12px;
  }

  .file-bubble {
    max-width: 250px;
  }

  .composer-area {
    padding: 0 8px 8px;
  }

  .composer-meta {
    font-size: 6.5px;
  }

  .composer-hint {
    display: none;
  }

  .typing-indicator {
    min-height: 18px;
    padding: 0 12px;
    font-size: 7px;
    line-height: 18px;
  }

  .modal-card {
    padding: 22px;
    box-shadow: 6px 6px 0 var(--ink);
  }

  .modal-card h2 {
    font-size: 27px;
  }

  .sidebar-note {
    display: none;
  }

  .scroll-bottom {
    right: 9px;
    bottom: 108px;
  }

  .toast-stack {
    right: 9px;
    bottom: 9px;
    width: calc(100vw - 18px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

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

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

@keyframes messageIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes typing {
  0%,
  60%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-2px);
  }
}
