@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: optional;
  src: url('fonts/JetBrainsMono-wght.woff2') format('woff2');
}
:root {
  --bg: #0c0c0c;
  --bg-raised: #161616;
  --bg-chip: #141414;
  --bg-hover: #1d1d1d;
  --rule: #2a2a2a;
  --ink: #e8e8e6;
  --ink-dim: #6b6b6b;
  --ink-faint: #454545;
  --accent: #ff5fd7;
  --cyan: #4fd6d6;
  --green: #5fd75f;
  --amber: #ffcb5f;
  --red: #ff5f5f;
  --channel-pipe: 3px;
  --mono: 'JetBrains Mono', ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --bottom-bar-height: 52px;
  --bottom-bar-inset: 8px;
  --bottom-bar-pad-x: 0.9rem;
  --compose-field-h: calc(var(--bottom-bar-height) - 1px - 2 * var(--bottom-bar-inset));
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html {
  height: 100%;
  overflow: hidden;
  touch-action: manipulation;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
body.app {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 100vh; height: 100dvh; height: var(--app-height, 100dvh);
  transform: translate(var(--app-offset-left, 0px), var(--app-offset-top, 0px));
  overflow: hidden;
  overscroll-behavior: none;
}
button, input, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}
input, textarea { font-size: 16px; }
a { color: var(--cyan); text-decoration: underline; text-underline-offset: 2px; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--bg-raised); border: 1px solid var(--rule); color: var(--ink);
  padding: 0.6rem 1rem; border-radius: 6px; font-size: 0.82rem; max-width: min(90vw, 420px);
  box-shadow: 0 12px 30px -10px rgba(0,0,0,0.6); z-index: 1000;
}
.toast.err { border-color: var(--red); color: #ffb3b3; }
.screen-auth {
  height: 100vh; height: 100dvh; height: var(--app-height, 100dvh); overflow-y: auto;
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  padding-left: max(1.5rem, env(safe-area-inset-left));
  padding-right: max(1.5rem, env(safe-area-inset-right));
}
.auth-card {
  width: 100%; max-width: 380px;
  background: var(--bg-raised); border: 1px solid var(--rule); border-radius: 10px;
  padding: 1.6rem 1.6rem 1.4rem;
}
.brand-row { display: flex; align-items: baseline; gap: 0.5rem; margin-bottom: 0.3rem; }
.brand { font-weight: 700; font-size: 1.2rem; color: var(--accent); letter-spacing: -0.01em;
  text-shadow: 0 0 18px rgba(255, 95, 215, 0.45); }
.tagline { color: var(--ink-dim); font-size: 0.82rem; margin: 0 0 1.3rem; line-height: 1.5; }
.tagline.pending-check { color: var(--green); font-weight: 600; }
.pending-body { color: #b7b7b3; font-size: 0.85rem; line-height: 1.6; margin: 0 0 1.4rem; }
#registerForm label, #loginForm label {
  display: block; font-size: 0.75rem; color: var(--ink-dim); margin-bottom: 0.9rem;
}
#registerForm input, #loginForm input {
  display: block; width: 100%; margin-top: 0.35rem;
  background: var(--bg-chip); border: 1px solid var(--rule); border-radius: 5px;
  padding: 0.5rem 0.6rem; outline: none;
}
#registerForm input:focus, #loginForm input:focus { border-color: var(--cyan); }
.hint { display: block; color: var(--ink-faint); font-size: 0.68rem; margin-top: 0.3rem; }
.form-error {
  color: var(--red); font-size: 0.78rem; margin: -0.3rem 0 0.9rem;
  background: rgba(255,95,95,0.08); border: 1px solid rgba(255,95,95,0.3);
  border-radius: 5px; padding: 0.5rem 0.6rem;
}
.primary-btn {
  width: 100%; background: var(--accent); color: #1a0714; border: none;
  border-radius: 5px; padding: 0.6rem; font-weight: 700; cursor: pointer;
}
.primary-btn:hover { filter: brightness(1.08); }
.primary-btn:active { filter: brightness(0.92); }
.switch { margin: 1rem 0 0; font-size: 0.78rem; color: var(--ink-dim); text-align: center; }
.link-btn {
  background: none; border: none; color: var(--cyan); cursor: pointer; padding: 0;
  font-family: inherit; font-size: inherit; text-decoration: underline; text-underline-offset: 2px;
}
.app-shell {
  display: flex; height: 100vh; height: 100dvh; height: var(--app-height, 100dvh); overflow: hidden;
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
}
#sidebar {
  width: 220px; flex: 0 0 auto; display: flex; flex-direction: column;
  background: var(--bg); border-right: 1px solid var(--rule);
  overflow: hidden; position: relative;
}
#sidebar::before {
  content: ""; position: absolute; left: 50%; top: -80px; width: 280px; height: 220px;
  transform: translateX(-50%); pointer-events: none; z-index: 0;
  background: radial-gradient(closest-side, rgba(255, 95, 215, 0.18), rgba(255, 95, 215, 0) 72%);
  filter: blur(4px);
  animation: breathe 5s ease-in-out infinite;
}
#sidebar::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background-image: repeating-linear-gradient(
    0deg, rgba(255,255,255,0.025) 0px, rgba(255,255,255,0.025) 1px,
    transparent 1px, transparent 4px
  );
}
@keyframes breathe { 50% { opacity: 0.65; } }
.sidebar-head, .me, #channelList, .channel-list-fill {
  position: relative; z-index: 1;
}
.sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.8rem 0.9rem; border-bottom: 1px solid var(--rule);
  padding-top: max(0.8rem, env(safe-area-inset-top));
}
.sidebar-head-actions {
  display: flex; align-items: stretch; gap: 0.4rem; flex: 0 0 auto;
}
.sidebar-head-actions .ghost-btn {
  display: inline-flex; align-items: center; justify-content: center;
}
.ghost-btn {
  background: none; border: 1px solid var(--rule); border-radius: 4px; color: var(--ink-dim);
  cursor: pointer; padding: 0.2rem 0.45rem; line-height: 1;
}
.ghost-btn:hover { color: var(--ink); border-color: var(--ink-dim); }
.me {
  padding: 0.6rem 0.9rem; font-size: 0.75rem; color: var(--cyan); border-bottom: 1px solid var(--rule);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-shadow: 0 0 10px rgba(79, 214, 214, 0.25);
}
#channelList { list-style: none; margin: 0; padding: 0 0.55rem 0.4rem; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.channel-item {
  display: flex; align-items: baseline; gap: 0.45rem; padding: 0.22rem 0.55rem;
  color: var(--ink-dim); cursor: pointer; font-size: 0.92rem;
  position: relative;
}
.channel-item-copy {
  min-width: 0; flex: 1;
}
.channel-item .name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: inherit; font-weight: 500;
}
.channel-item:hover { background: rgba(79, 214, 214, 0.06); color: var(--ink); }
.channel-item.active {
  color: var(--accent);
  text-shadow: 0 0 6px rgba(255, 95, 215, 0.35);
  background: linear-gradient(90deg,
    transparent 0,
    transparent var(--channel-pipe),
    rgba(255, 95, 215, 0.22) var(--channel-pipe),
    rgba(255, 95, 215, 0.14) 36%,
    rgba(255, 95, 215, 0.06) 68%,
    transparent 88%);
}
.channel-item.active:hover {
  background: linear-gradient(90deg,
    transparent 0,
    transparent var(--channel-pipe),
    rgba(255, 95, 215, 0.22) var(--channel-pipe),
    rgba(255, 95, 215, 0.14) 36%,
    rgba(255, 95, 215, 0.06) 68%,
    transparent 88%);
}
.channel-item .bar {
  display: none;
}
.channel-item.active .bar {
  display: block;
  position: absolute; left: 0; top: 0; bottom: 0;
  width: var(--channel-pipe); min-width: var(--channel-pipe); border-radius: 0;
  pointer-events: none;
  background: var(--cyan);
  z-index: 1;
  animation: bar-glow 2s ease-in-out infinite;
}
.channel-item.active .bar::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: 0; right: -5px;
  border-radius: 0;
  pointer-events: none;
  background: rgba(79, 214, 214, 0.4);
  filter: blur(6px);
  animation: bar-bloom 2s ease-in-out infinite;
}
.channel-item.active .prompt { color: var(--cyan); }
.channel-item .prompt { color: var(--cyan); font-weight: 700; flex: 0 0 auto; }
.channel-list-fill { display: none; }
.channel-list-idle {
  display: inline-flex; align-items: center; gap: 0.45rem;
  color: var(--ink); font-size: 0.95rem; position: relative; z-index: 3;
  isolation: isolate;
  text-shadow: 0 0 10px var(--bg), 0 1px 0 var(--bg);
}
.channel-list-idle::before {
  content: "";
  position: absolute; left: 50%; top: 50%;
  width: 16rem; height: 4.2rem;
  transform: translate(-50%, -50%);
  pointer-events: none; z-index: -1;
  filter: blur(16px);
  background:
    radial-gradient(ellipse 48% 65% at 38% 50%, rgba(79, 214, 214, 0.1), transparent 72%),
    radial-gradient(ellipse 48% 65% at 62% 50%, rgba(255, 95, 215, 0.1), transparent 72%);
  animation: breathe 5s ease-in-out infinite;
}
.channel-list-mark { color: var(--cyan); font-weight: 700; }
.channel-list-typed {
  display: inline-flex; align-items: center;
}
.channel-list-hint { color: var(--ink); white-space: pre; }
.tty-cursor {
  display: inline-block; width: 0.46em; height: 0.85em; margin-left: 0.08em;
  background: var(--cyan); vertical-align: -0.05em; border-radius: 1px;
  box-shadow: 0 0 10px rgba(79, 214, 214, 0.55);
  animation: blink 1.05s step-end infinite;
}
@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}
.new-channel-btn {
  box-sizing: border-box;
  min-width: 1.55rem; padding: 0.2rem 0.45rem;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 500; line-height: 1;
  color: var(--cyan);
}
.new-channel-btn:hover { color: var(--cyan); border-color: var(--cyan); }
.channel-modal {
  position: fixed; inset: 0; z-index: 35;
  display: flex; align-items: flex-start; justify-content: center;
  background: rgba(0, 0, 0, 0.72);
  padding: max(2.2rem, 12vh) 1.2rem 1.2rem;
  overflow: hidden;
}
.channel-modal[hidden] { display: none !important; }
.channel-modal-card {
  width: 100%; max-width: 340px;
  background: var(--bg-raised); border: 1px solid var(--rule); border-radius: 10px;
  padding: 1.2rem 1.2rem 1rem;
}
.channel-modal-card p {
  margin: 0 0 0.75rem; color: var(--ink); font-size: 0.95rem;
}
.channel-modal-card input {
  display: block; width: 100%; margin-bottom: 0.9rem;
  background: var(--bg-chip); border: 1px solid var(--rule); border-radius: 5px;
  padding: 0.55rem 0.65rem; font-size: 16px; outline: none; color: var(--ink);
}
.channel-modal-card input:focus { border-color: var(--cyan); }
.channel-modal-actions {
  display: flex; gap: 0.5rem; justify-content: flex-end; align-items: stretch;
}
.channel-modal-actions .primary-btn,
.channel-modal-actions .ghost-btn {
  box-sizing: border-box;
  width: auto; min-width: 5.75rem;
  padding: 0.5rem 0.9rem; line-height: 1.2; font-size: 0.85rem; font-weight: 700;
  border-radius: 5px; border-style: solid; border-width: 1px;
}
.channel-modal-actions .primary-btn { border-color: transparent; }
.bottom-bar {
  display: flex; align-items: stretch; gap: 0.35rem;
  box-sizing: border-box;
  min-height: calc(var(--bottom-bar-height) + var(--ime-safe-bottom, env(safe-area-inset-bottom, 0px)));
  padding: var(--bottom-bar-inset) var(--bottom-bar-pad-x);
  padding-bottom: calc(var(--bottom-bar-inset) + var(--ime-safe-bottom, env(safe-area-inset-bottom, 0px)));
  border-top: 1px solid var(--rule);
}
.chat-pane { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--ink-dim); text-align: center; gap: 0.2rem;
  position: relative; overflow: visible;
}
.chat-empty .dim { color: var(--ink-faint); font-size: 0.82rem; }
.chat-active { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.channel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.7rem 1.1rem; border-bottom: 1px solid var(--rule);
  color: var(--cyan); font-weight: 600; font-size: 0.92rem; flex: 0 0 auto;
  padding-top: max(0.7rem, env(safe-area-inset-top));
}
.channel-header-left { display: flex; align-items: center; gap: 0.7rem; min-width: 0; }
.channel-header-left #channelName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back-btn {
  display: none; flex: 0 0 auto; font-family: var(--mono); font-size: 0.78rem;
  color: var(--ink-dim); background: none; border: 1px solid var(--rule); border-radius: 4px;
  padding: 0.3rem 0.5rem; cursor: pointer;
}
.back-btn:hover { color: var(--cyan); border-color: var(--cyan); }
.online-indicator {
  display: flex; align-items: center; gap: 0.35rem; flex: 0 0 auto;
  font-size: 0.72rem; font-weight: 400; color: var(--ink-dim);
}
.online-indicator::after { content: 'online'; }
.online-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 5px rgba(95, 215, 95, 0.6); flex: 0 0 auto;
}
.channel-created {
  font-size: 0.65rem; font-weight: 400; color: var(--ink-faint);
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#channelCreatedBy { font-weight: 500; }
#channelCreatedBy.self { color: var(--cyan); }
.call-bar {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.45rem 0.7rem;
  padding: 0.45rem 1.1rem; flex: 0 0 auto;
  background: rgba(95, 215, 95, 0.08); border-bottom: 1px solid rgba(95, 215, 95, 0.35);
  font-size: 0.82rem; line-height: 1.4;
}
.call-bar-badge {
  flex: 0 0 auto; font-weight: 700; color: var(--green);
  letter-spacing: 0.04em; text-transform: uppercase; font-size: 0.68rem;
}
.call-roster {
  color: var(--ink); font-weight: 500; min-width: 0;
  overflow: visible; text-overflow: unset; white-space: normal;
}
.call-mic-hint { width: 100%; color: var(--amber); font-size: 0.72rem; }
.stream-status {
  font-size: 0.68rem; font-weight: 400; letter-spacing: 0.03em;
  color: var(--ink-faint); flex: 0 0 auto;
}
.stream-status[data-state="connected"] { color: var(--cyan); }
.stream-status[data-state="connecting"] { color: var(--amber); }
.stream-status[data-state="disconnected"] { color: var(--red); }
.log {
  flex: 1; overflow-y: auto; padding: 0.9rem 1.1rem; font-size: 0.87rem; line-height: 1.7;
  overflow-anchor: auto;
}
.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;
}
.msg {
  display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 0.4rem;
  padding: 0.2rem 0.5rem;
  margin: 0 -0.5rem 0.4rem;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: background 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.msg.own { -webkit-touch-callout: none; }
.msg.own.row-hover,
.msg.own:hover,
.msg.own.delete-armed,
.msg.own:focus-within {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.06);
}
.msg .who { font-weight: 700; flex: 0 0 auto; }
.msg .who.self { color: var(--cyan); }
.msg .body { color: var(--ink); flex: 1 1 8rem; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg .body a { color: var(--cyan); }
.msg.system .body { color: var(--ink-dim); font-style: italic; }
.msg .ts {
  color: var(--ink-faint); font-size: 0.72em; font-weight: 400;
  flex: 0 0 auto; margin-left: auto; white-space: nowrap;
}
.day-rule {
  display: flex; align-items: center; gap: 0.55rem;
  margin: 0.65rem 0 0.4rem;
  font-size: 0.68rem; font-weight: 500; color: var(--ink-faint);
  letter-spacing: 0.03em;
}
.day-rule::before, .day-rule::after {
  content: ''; flex: 1; height: 1px; background: var(--rule);
}
.msg-delete {
  padding: 0.05rem 0.1rem;
  border: 0;
  background: none;
  color: var(--ink-faint);
  font: inherit;
  font-size: 0.72em;
  letter-spacing: 0.02em;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  opacity: 0;
}
.msg-delete svg { display: block; pointer-events: none; }
.msg.own.row-hover .msg-delete,
.msg:hover .msg-delete,
.msg.delete-armed .msg-delete,
.msg-delete:focus-visible,
.msg-delete.confirm { opacity: 1; }
.msg-delete:hover,
.msg-delete.confirm { color: var(--red); }
@media (hover: none) {
  .msg-delete { opacity: 0; }
  .msg.delete-armed .msg-delete,
  .msg-delete.confirm { opacity: 1; }
  .msg.own:hover:not(.row-hover):not(.delete-armed):not(:focus-within) {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
  }
}
.compose-row {
  background: var(--bg-raised); flex: 0 0 auto;
  position: relative;
  min-width: 0;
  overflow-x: hidden;
}
.compose-row .prompt {
  flex: 0 0 3px;
  width: 3px;
  min-width: 3px;
  align-self: stretch;
  margin-right: 0.55rem;
  font-size: 0;
  line-height: 0;
  background: var(--accent);
  border-radius: 1px;
  animation: prompt-glow 1.7s ease-in-out infinite;
}
@keyframes prompt-glow {
  0%, 100% {
    background: var(--accent);
    box-shadow:
      0 0 4px rgba(255, 95, 215, 0.55),
      0 0 10px rgba(255, 95, 215, 0.28);
  }
  50% {
    background: #ff9ae4;
    box-shadow:
      0 0 8px rgba(255, 182, 232, 0.85),
      0 0 18px rgba(255, 95, 215, 0.55);
  }
}
@keyframes bar-glow {
  0%, 100% {
    background: var(--cyan);
    box-shadow:
      0 0 4px rgba(79, 214, 214, 0.55),
      0 0 9px rgba(79, 214, 214, 0.28);
  }
  50% {
    background: #8af6f6;
    box-shadow:
      0 0 6px rgba(138, 246, 246, 0.7),
      0 0 14px rgba(79, 214, 214, 0.45);
  }
}
@keyframes bar-bloom {
  0%, 100% { opacity: 0.22; }
  50% { opacity: 0.55; }
}
@media (prefers-reduced-motion: reduce) {
  .compose-row .prompt {
    animation: none;
    background: var(--accent);
    box-shadow: 0 0 6px rgba(255, 95, 215, 0.5);
  }
  .channel-item.active .bar {
    animation: none;
    background: var(--cyan);
    box-shadow:
      0 0 4px rgba(79, 214, 214, 0.55),
      0 0 9px rgba(79, 214, 214, 0.28);
  }
  .channel-item.active .bar::after { animation: none; opacity: 0.35; }
  .tty-cursor { animation: none; opacity: 1; }
  #sidebar::before, .channel-list-idle::before { animation: none; }
}
#composeInput {
  flex: 1 1 0; min-width: 0; resize: none; background: none; border: none; outline: none; color: var(--ink);
  font-family: var(--mono); font-size: 16px; line-height: 1.4; max-height: 7.5em;
  min-height: var(--compose-field-h);
  padding: calc((var(--compose-field-h) - 1.4em) / 2) 0;
  caret-color: var(--cyan);
}
.compose-actions {
  display: flex; align-items: stretch; gap: 0.3rem; flex: 0 0 auto;
  align-self: flex-end;
  height: var(--compose-field-h);
}
.compose-btn {
  box-sizing: border-box;
  width: var(--compose-field-h);
  height: 100%;
  padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 1rem; line-height: 1; font-weight: 700;
  background: none; border: 1px solid var(--rule); border-radius: 4px;
  cursor: pointer; color: var(--ink-dim); flex: 0 0 auto;
}
.compose-btn:hover { color: var(--ink); border-color: var(--ink-dim); }
.compose-btn:disabled { cursor: default; opacity: 0.4; }
.compose-btn-wide {
  width: auto; min-width: calc(var(--bottom-bar-height) - 1px - 2 * var(--bottom-bar-inset));
  padding: 0 0.55rem;
  font-size: 0.78rem; font-weight: 600;
}
.send-btn { color: var(--bg); background: var(--cyan); border-color: var(--cyan); }
.send-btn:hover { filter: brightness(1.08); color: var(--bg); }
.send-btn:disabled { opacity: 0.4; cursor: default; filter: none; }
.upload-banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem 0.7rem;
  padding: 0.55rem 1.1rem 0.35rem; border-top: 1px solid var(--rule);
  background: var(--bg-raised); flex: 0 0 auto;
}
.upload-banner-copy { font-size: 0.78rem; color: var(--ink); min-width: 0; }
#uploadBannerKind { color: var(--amber); font-weight: 700; margin-right: 0.4rem; text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.68rem; }
.upload-banner.ready #uploadBannerKind { color: var(--green); }
#uploadBannerName { color: var(--ink-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 18rem; }
.upload-banner-track {
  flex: 1 1 8rem; height: 0.45rem; min-width: 6rem; background: var(--bg-chip);
  border: 1px solid var(--rule); border-radius: 99px; overflow: hidden;
}
.upload-banner-fill {
  height: 100%; width: 0; background: var(--amber); transition: width 0.15s linear;
}
.upload-banner.ready .upload-banner-fill { background: var(--green); }
#uploadBannerStatus { font-size: 0.75rem; color: var(--amber); flex: 1 1 auto; }
.upload-banner.ready #uploadBannerStatus { color: var(--green); }
.upload-banner-cancel {
  font-family: var(--mono); font-size: 0.72rem; background: none; border: 1px solid var(--rule);
  border-radius: 4px; padding: 0.25rem 0.5rem; cursor: pointer; color: var(--ink-dim);
}
.attach-frame {
  display: block; position: relative; margin: 0.4rem 0 0.15rem;
  background: var(--bg-chip); border-radius: 4px; border: 1px solid var(--rule);
  overflow: hidden; overflow-anchor: none;
}
.attach-frame:not(.unknown-size) {
  width: min(240px, 80vw, calc(60vh * var(--attach-w) / var(--attach-h)));
  aspect-ratio: var(--attach-w) / var(--attach-h);
}
.attach-frame.unknown-size {
  width: 0; height: 0; margin: 0; border: none; background: none;
}
.attach-frame.unknown-size .attach-shimmer { display: none; }
.attach-shimmer {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(90deg, var(--bg-chip) 0%, var(--bg-hover) 45%, var(--bg-chip) 100%);
  background-size: 200% 100%;
  animation: attach-load 1.1s linear infinite;
}
.attach-frame.loaded .attach-shimmer { display: none; }
@keyframes attach-load {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}
.attach-image, .attach-video {
  position: absolute; inset: 0; display: block; width: 100%; height: 100%;
  object-fit: contain; object-position: center; background: transparent; border: none;
}
.attach-image { cursor: zoom-in; }
.photo-lightbox {
  position: fixed; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.88);
  cursor: zoom-out;
  touch-action: none;
  overflow: hidden;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.photo-lightbox[hidden] { display: none !important; }
.photo-lightbox-img {
  max-width: min(100vw, 100%);
  max-height: min(100vh, 100%);
  object-fit: contain;
  background: transparent;
  transform-origin: center center;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
}
.call-btn-on, .compose-btn.call-btn-on:hover {
  color: var(--green); border-color: var(--green);
}
.call-btn-joining, .compose-btn.call-btn-joining:hover {
  color: var(--amber); border-color: var(--amber);
}
.call-remote-audio {
  position: absolute; width: 1px; height: 1px; margin: 0; padding: 0; border: 0;
  overflow: hidden; clip: rect(0, 0, 0, 0); pointer-events: none;
}
.attach-file {
  display: inline-block; margin-top: 0.35rem; padding: 0.5rem 0.9rem;
  border: 1px solid var(--rule); border-radius: 4px; background: var(--bg-chip);
  font-size: 0.8rem; color: var(--ink);
}
.attach-file .name { color: var(--cyan); }
.attach-file .meta { color: var(--ink-dim); margin-left: 0.5rem; }
@media (max-width: 640px) {
  .app-shell { position: relative; }
  #sidebar { width: 100%; }
  .chat-pane { display: none; }
  .app-shell.show-chat #sidebar { display: none; }
  .app-shell.show-chat .chat-pane { display: flex; }
  .back-btn { display: inline-flex; align-items: center; }
  .call-bar { padding: 0.55rem 1.1rem; font-size: 0.88rem; }
  .call-bar-badge { font-size: 0.72rem; }
  .sidebar-head { padding: 1rem 1.1rem; }
  .sidebar-head-actions .ghost-btn {
    min-height: 2.25rem;
    padding: 0 0.75rem;
    font-size: 0.88rem;
    display: inline-flex; align-items: center; justify-content: center;
  }
  .new-channel-btn {
    width: auto; height: auto; min-width: 2.25rem; font-size: 1.2rem;
  }
  .me { padding: 0.75rem 1.1rem; font-size: 0.82rem; }
  #channelList { padding: 0 0.7rem 0.5rem; flex: 0 1 auto; }
  .channel-item {
    min-height: 44px; padding: 0.4rem 0.7rem 0.4rem 0.9rem; font-size: 1.05rem;
    align-items: center; line-height: 1.25;
  }
  .channel-list-fill {
    display: flex; flex: 1 1 0; min-height: 4.5rem; flex-direction: column;
    align-items: center; justify-content: center; gap: 0.35rem; pointer-events: none;
    overflow: hidden; position: relative;
  }
  .channel-list-mark {
    color: var(--cyan); font-weight: 700; font-size: 1rem; line-height: 1;
  }
  .channel-list-hint {
    font-size: 0.95rem; color: var(--ink); letter-spacing: 0;
  }
  .log { padding: 0.75rem 0.8rem; }
  .channel-created { display: none; }
  .attach-frame:not(.unknown-size) {
    width: min(240px, 100%, calc(70vh * var(--attach-w) / var(--attach-h)));
  }
}