:root {
  color-scheme: dark;
  --bg: #08070a;
  --bg-2: #100c16;
  --panel: rgba(23, 17, 32, 0.9);
  --panel-solid: #171020;
  --line: #3a2c50;
  --line-soft: rgba(183, 243, 107, 0.11);
  --text: #f7f3ff;
  --muted: #a99bbf;
  --accent: #b7f36b;
  --accent-2: #d9ff9e;
  --accent-ink: #0a1204;
  --violet: #8b5cf6;
  --magenta: #e935ff;
  --danger: #ff5c8a;
  --ok: #b7f36b;
  --bubble: #181121;
  --bubble-mine: #2a1740;
  --radius: 16px;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.58);
  --mono: ui-monospace, SFMono-Regular, "Cascadia Code", Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(1000px 620px at 8% -12%, rgba(183, 243, 107, 0.14), transparent 62%),
    radial-gradient(900px 620px at 104% 0%, rgba(139, 92, 246, 0.2), transparent 60%),
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    var(--bg);
  background-size: auto, auto, 34px 34px, 34px 34px, auto;
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

* {
  scrollbar-color: #4a3566 transparent;
  scrollbar-width: thin;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.view {
  min-height: 100dvh;
}

.center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 28px 16px;
}

.hero {
  text-align: center;
}

.hero-logo {
  display: block;
  width: min(228px, 62vw);
  height: auto;
  margin: 0 auto 16px;
  border-radius: 24px;
  box-shadow:
    0 0 0 1px rgba(183, 243, 107, 0.28),
    0 18px 60px rgba(139, 92, 246, 0.32),
    0 0 48px rgba(183, 243, 107, 0.12);
}

.admin-hero-logo {
  width: min(150px, 42vw);
  margin-bottom: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-weight: 800;
  letter-spacing: 0.22em;
  font-size: clamp(38px, 8vw, 68px);
  color: var(--accent);
  text-shadow:
    0 0 30px rgba(183, 243, 107, 0.2),
    0 0 50px rgba(139, 92, 246, 0.18);
  padding-left: 0.22em;
}

.brand.small {
  font-size: 15px;
  letter-spacing: 0.16em;
  padding-left: 0;
  gap: 9px;
  color: var(--text);
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid rgba(183, 243, 107, 0.35);
  box-shadow: 0 0 18px rgba(139, 92, 246, 0.35);
  object-fit: cover;
  flex: 0 0 auto;
}

.topbar-brand {
  min-width: 0;
}

.topbar-brand span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-mark {
  display: block;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  margin-bottom: 14px;
  border: 1px solid rgba(183, 243, 107, 0.28);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.28);
}

.tagline {
  margin: 6px 0 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.card {
  position: relative;
  overflow: hidden;
  width: min(430px, 100%);
  background:
    linear-gradient(180deg, rgba(30, 21, 42, 0.94), rgba(16, 12, 22, 0.96));
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow:
    var(--shadow),
    0 0 0 1px rgba(183, 243, 107, 0.04) inset;
  padding: 26px;
  backdrop-filter: blur(12px);
}

.auth-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--violet), var(--magenta));
}

.auth-card h1 {
  margin: 0 0 4px;
  font-size: 24px;
  letter-spacing: -0.02em;
}

.auth-card p {
  color: var(--muted);
}

label {
  display: block;
  margin: 16px 0 7px;
  color: var(--muted);
  font-size: 12px;
  font-family: var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

input,
textarea,
select {
  width: 100%;
  background: #0b0810;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 13px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

input:focus,
textarea:focus,
select:focus {
  background: #0e0a15;
  border-color: rgba(183, 243, 107, 0.72);
  box-shadow: 0 0 0 3px rgba(183, 243, 107, 0.12);
}

textarea {
  resize: none;
  min-height: 44px;
  max-height: 160px;
}

button.primary,
button.ghost {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 11px 16px;
  font-weight: 700;
  transition: transform 0.08s, background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

button.primary {
  margin-top: 18px;
  width: 100%;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  border-color: rgba(217, 255, 158, 0.8);
  color: var(--accent-ink);
  box-shadow: 0 8px 26px rgba(183, 243, 107, 0.16);
}

button.primary:hover {
  filter: brightness(1.04);
  box-shadow: 0 10px 32px rgba(183, 243, 107, 0.25);
}

button.primary:active {
  transform: translateY(1px);
}

button.ghost {
  background: rgba(139, 92, 246, 0.06);
  border-color: var(--line);
  color: var(--muted);
}

button.ghost:hover {
  color: var(--text);
  border-color: rgba(183, 243, 107, 0.45);
  box-shadow: 0 0 18px rgba(139, 92, 246, 0.18);
}

button.wide {
  width: 100%;
  margin: 0 0 12px;
}

.hint {
  color: var(--muted);
  font-size: 12.5px;
  margin: 12px 0 0;
}

.hint.danger,
.error {
  color: var(--danger);
}

.error {
  min-height: 18px;
  margin: 10px 0 0;
  font-size: 13px;
}

.chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: rgba(139, 92, 246, 0.08);
  border-radius: 999px;
  padding: 5px 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--text);
}

.chip.muted {
  color: var(--muted);
}

.spinner {
  width: 26px;
  height: 26px;
  margin: 18px auto 4px;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}

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

/* Chat ---------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  background: rgba(8, 7, 10, 0.86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(183, 243, 107, 0.12);
  box-shadow: 0 8px 34px rgba(0, 0, 0, 0.28);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  height: calc(100dvh - 60px);
}

.sidebar {
  border-right: 1px solid var(--line-soft);
  padding: 16px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background:
    linear-gradient(180deg, rgba(139, 92, 246, 0.08), rgba(8, 7, 10, 0.2));
}

.room-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  min-height: 0;
  padding-right: 2px;
}

.room {
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 12px;
  padding: 10px 12px;
  width: 100%;
}

.room:hover {
  background: rgba(183, 243, 107, 0.05);
}

.room.active {
  background:
    linear-gradient(90deg, rgba(183, 243, 107, 0.12), rgba(139, 92, 246, 0.08));
  border-color: rgba(183, 243, 107, 0.32);
  box-shadow: inset 3px 0 0 var(--accent);
}

.room-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
}

.room-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11.5px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.room-badge {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.room-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line-soft);
}

.room-header h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.room-header .hint {
  margin: 2px 0 0;
}

.fuse {
  width: 110px;
  height: 5px;
  border-radius: 99px;
  background: #241a33;
  overflow: hidden;
  position: relative;
  flex: 0 0 auto;
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.16) inset;
}

.fuse::after {
  content: "";
  position: absolute;
  inset: 0;
  width: var(--fuse, 100%);
  background: linear-gradient(90deg, var(--accent), var(--violet), var(--magenta));
  transition: width 0.4s linear;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.empty-state {
  margin: auto;
  max-width: 360px;
  text-align: center;
  color: var(--muted);
}

.empty-state strong {
  display: block;
  color: var(--text);
  margin-bottom: 6px;
  font-size: 16px;
}

.message {
  max-width: min(680px, 86%);
  padding: 10px 12px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(34, 24, 48, 0.88), rgba(22, 16, 31, 0.9));
  border: 1px solid rgba(139, 92, 246, 0.16);
  align-self: flex-start;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.message.mine {
  align-self: flex-end;
  background:
    linear-gradient(180deg, rgba(55, 27, 82, 0.95), rgba(36, 17, 55, 0.96));
  border-color: rgba(233, 53, 255, 0.32);
  box-shadow:
    0 8px 26px rgba(0, 0, 0, 0.18),
    0 0 24px rgba(139, 92, 246, 0.12);
}

.message-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.message-author {
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.message-time {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
}

.message-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14.5px;
}

.message-expiry {
  margin-top: 6px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.03em;
}

.message-file {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  padding: 10px;
  border: 1px solid rgba(183, 243, 107, 0.16);
  border-radius: 10px;
  background: rgba(8, 7, 10, 0.28);
}

.message-file button {
  flex: 0 0 auto;
}

.message-file button.primary {
  width: auto;
  margin: 0;
  padding: 8px 12px;
  font-size: 12px;
}

.file-meta {
  min-width: 0;
}

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

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

.message-invalid {
  color: var(--danger);
  font-size: 12.5px;
}

.composer {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 12px 16px 8px;
  border-top: 1px solid var(--line-soft);
  background: rgba(8, 7, 10, 0.74);
}

.composer textarea {
  flex: 1;
}

.composer button.primary {
  margin: 0;
  width: auto;
  padding: 12px 18px;
}

button.icon {
  width: 44px;
  height: 44px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

#composer-note {
  margin: 0;
  padding: 0 18px 10px;
  min-height: 18px;
}

.banner {
  background: rgba(255, 92, 138, 0.12);
  border-bottom: 1px solid rgba(255, 92, 138, 0.32);
  color: #ffb8cc;
  padding: 9px 18px;
  font-size: 13px;
  text-align: center;
}

/* Dialog -------------------------------------------------------------- */

.dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-solid);
  color: var(--text);
  padding: 22px;
  width: min(420px, 92vw);
  box-shadow: var(--shadow);
}

.dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
}

.dialog h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.dialog-actions button {
  width: auto;
  margin: 0;
}

/* Toast --------------------------------------------------------------- */

.toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #1b1425;
  border: 1px solid rgba(183, 243, 107, 0.24);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 13px;
  box-shadow: var(--shadow);
  max-width: 90vw;
}

.toast.error {
  border-color: rgba(255, 92, 138, 0.45);
  color: #ffc2d2;
}

/* Responsive ---------------------------------------------------------- */

@media (max-width: 820px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    height: calc(100dvh - 60px);
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
    padding: 10px 12px;
    max-height: 30dvh;
  }

  .room-list {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 8px;
    padding-bottom: 4px;
  }

  .room {
    min-width: 170px;
    width: auto;
  }

  .sidebar-foot {
    display: none;
  }

  .messages {
    padding: 14px;
  }

  .message {
    max-width: 94%;
  }

  .room-header {
    padding: 10px 14px;
  }

  .fuse {
    width: 72px;
  }

  .hero-logo {
    width: min(188px, 58vw);
  }

  .brand.small {
    font-size: 12px;
    letter-spacing: 0.1em;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
  }
}

@media (max-width: 480px) {
  .topbar {
    padding: 0 12px;
  }

  .topbar-brand span {
    max-width: 108px;
  }

  .top-actions {
    gap: 5px;
  }

  .top-actions .ghost {
    padding: 9px 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* Timer messaggi ------------------------------------------------------- */

.timer-panel {
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(139, 92, 246, 0.09), rgba(139, 92, 246, 0.03));
}

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

.timer-head .eyebrow {
  margin: 0;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12.5px;
  margin: 6px 0 10px;
  cursor: pointer;
}

.check input {
  accent-color: var(--accent);
}

.check em {
  color: var(--magenta);
  font-style: normal;
  font-size: 11px;
}

.timer-range {
  width: 100%;
  accent-color: var(--accent);
  height: 20px;
}

.timer-panel .hint {
  margin: 6px 0 0;
  font-size: 11.5px;
}

/* Intestazione stanza -------------------------------------------------- */

.room-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

button.ghost.danger {
  color: var(--danger);
  border-color: rgba(255, 92, 138, 0.3);
}

button.ghost.danger:hover {
  color: #fff;
  border-color: var(--danger);
  box-shadow: 0 0 18px rgba(255, 92, 138, 0.22);
}

button.primary.danger {
  background: linear-gradient(180deg, #ff7aa2, var(--danger));
  border-color: rgba(255, 122, 162, 0.8);
  color: #250510;
  box-shadow: 0 8px 26px rgba(255, 92, 138, 0.18);
}

button.primary.danger:hover {
  filter: brightness(1.05);
  box-shadow: 0 10px 32px rgba(255, 92, 138, 0.28);
}

/* Vista singola -------------------------------------------------------- */

.message.view-once {
  border-style: dashed;
  border-color: rgba(233, 53, 255, 0.45);
}

.message.view-once .message-expiry {
  color: var(--magenta);
}

/* Hero compatta (login) ------------------------------------------------ */

.hero.compact {
  margin-bottom: 4px;
}

.hero.compact .hero-logo {
  width: min(150px, 42vw);
  margin-bottom: 8px;
}

/* Profili, gruppi, segnalazioni --------------------------------------- */

.avatar {
  border-radius: 50%;
  object-fit: cover;
  background: #171020;
  border: 1px solid rgba(183, 243, 107, 0.25);
  flex: 0 0 auto;
}

.avatar.xs {
  width: 22px;
  height: 22px;
}

.avatar.sm {
  width: 32px;
  height: 32px;
}

.avatar.lg {
  width: 44px;
  height: 44px;
}

.avatar.xl {
  width: 72px;
  height: 72px;
  border-radius: 18px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.menu-button {
  display: none;
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 18px;
  align-items: center;
  justify-content: center;
}

.me-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 200px;
  font-size: 12.5px;
  color: var(--text);
}

.me-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.1), rgba(8, 7, 10, 0.16));
  margin-bottom: 12px;
}

.profile-card-text {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.profile-card-text strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-card-text .hint {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

button.ghost.small {
  padding: 7px 9px;
  font-size: 11px;
}

.sidebar-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin: 0 0 12px;
}

.sidebar-actions button {
  margin: 0;
  padding: 9px 12px;
  font-size: 12px;
}

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

.room-body {
  min-width: 0;
  flex: 1;
}

.room-title {
  align-items: center;
}

.room-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-badge {
  flex: 0 0 auto;
}

.member-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 230px;
  overflow-y: auto;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 8px;
  background: rgba(8, 7, 10, 0.26);
}

.member-option {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  padding: 7px 8px;
  border-radius: 8px;
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

.member-option:hover {
  background: rgba(183, 243, 107, 0.06);
}

.member-option input {
  width: auto;
  accent-color: var(--accent);
}

.member-option em {
  margin-left: auto;
  font-style: normal;
  color: var(--accent);
  font-size: 10px;
  font-family: var(--mono);
}

.avatar-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}

.avatar-picker-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.avatar-picker-actions button {
  margin: 0;
  padding: 8px 10px;
  font-size: 12px;
  width: auto;
}

.label-note {
  font-style: normal;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
}

.message-author-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.message-author {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hint.danger {
  color: var(--danger);
}

.sidebar-overlay {
  display: none;
}

.dialog {
  max-height: 90dvh;
  overflow-y: auto;
}

/* Mobile: drawer, composer a prova di pollice -------------------------- */

@media (min-width: 821px) {
  .menu-button {
    display: none;
  }
}

@media (max-width: 820px) {
  body.sidebar-open {
    overflow: hidden;
  }

  .topbar {
    height: 58px;
    padding: 0 12px;
  }

  .menu-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .topbar-left {
    gap: 6px;
  }

  .topbar-brand span {
    display: none;
  }

  .me-chip {
    max-width: 118px;
  }

  .me-chip .avatar {
    width: 26px;
    height: 26px;
  }

  #ttl-chip {
    display: none;
  }

  .layout {
    display: block;
    height: calc(100dvh - 58px);
  }

  .sidebar {
    position: fixed;
    top: 58px;
    bottom: 0;
    left: 0;
    z-index: 40;
    width: min(344px, 90vw);
    max-height: none;
    overflow-y: auto;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    background: #0d0913;
    box-shadow: 24px 0 60px rgba(0, 0, 0, 0.6);
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    padding: 14px;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-foot {
    display: block;
    padding-top: 12px;
  }

  .sidebar-foot button {
    width: 100%;
    margin: 0;
  }

  .sidebar-overlay {
    display: block;
    position: fixed;
    top: 58px;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 35;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(2px);
  }

  .sidebar-overlay.hidden {
    display: none !important;
  }

  .main {
    height: 100%;
  }

  .room-list {
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    gap: 6px;
    padding-bottom: 4px;
  }

  .room {
    min-width: 0;
    width: 100%;
  }

  .messages {
    padding: 14px;
  }

  .message {
    max-width: 94%;
  }

  .room-header {
    padding: 10px 12px;
    gap: 8px;
  }

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

  .room-heading h2 {
    font-size: 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .room-head-actions {
    gap: 6px;
  }

  .room-head-actions button {
    padding: 8px 9px;
    font-size: 11px;
  }

  .fuse {
    width: 54px;
  }

  .composer {
    padding: 10px 10px calc(8px + env(safe-area-inset-bottom));
  }

  .composer textarea {
    font-size: 16px;
  }

  .composer button.primary {
    padding: 11px 14px;
  }

  #composer-note {
    padding: 0 12px 8px;
  }

  .dialog {
    width: calc(100vw - 20px);
    max-height: 90dvh;
    overflow-y: auto;
  }

  .toast {
    bottom: calc(16px + env(safe-area-inset-bottom));
  }

  .hero-logo {
    width: min(188px, 58vw);
  }

  .brand.small {
    font-size: 12px;
    letter-spacing: 0.1em;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
  }
}

@media (max-width: 480px) {
  .topbar {
    padding: 0 8px;
  }

  .me-chip span {
    display: none;
  }

  .me-chip {
    max-width: none;
  }

  .topbar-brand span {
    max-width: 92px;
  }
}
