:root {
  color-scheme: dark;
  --bg: #070b14;
  --panel: rgba(15, 22, 37, 0.82);
  --panel-solid: #0f1625;
  --panel-raised: rgba(27, 37, 58, 0.72);
  --line: rgba(158, 177, 211, 0.14);
  --line-strong: rgba(158, 177, 211, 0.24);
  --text: #edf2ff;
  --muted: #91a2c0;
  --muted-strong: #b1bfd8;
  --accent: #7e9cff;
  --accent-bright: #a9bcff;
  --mint: #58e2c2;
  --danger: #ff899c;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.24);
  --font: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% -10%, rgba(82, 112, 255, 0.2), transparent 35%),
    radial-gradient(circle at 92% 104%, rgba(50, 222, 190, 0.1), transparent 32%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

.page {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100dvh;
  max-width: 1440px;
  margin: 0 auto;
  padding: clamp(14px, 2.2vh, 26px) clamp(14px, 2.6vw, 36px);
}

.topbar {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 4px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: 0.12em;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.brand-mark {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  width: 38px;
  height: 38px;
  padding: 10px;
  border: 1px solid rgba(151, 172, 255, 0.32);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(126, 156, 255, 0.22), rgba(88, 226, 194, 0.08));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.brand-mark span {
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--accent-bright), var(--mint));
}

.brand-mark span:nth-child(1) {
  height: 7px;
  opacity: 0.55;
}

.brand-mark span:nth-child(2) {
  height: 13px;
  opacity: 0.8;
}

.brand-mark span:nth-child(3) {
  height: 18px;
}

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

.language-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 58px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(15, 22, 37, 0.62);
  color: var(--muted-strong);
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.language-toggle:hover {
  border-color: var(--line-strong);
  background: rgba(126, 156, 255, 0.08);
  color: var(--text);
}

.language-toggle:active {
  transform: translateY(1px);
}

.language-toggle:focus-visible {
  outline: 2px solid rgba(126, 156, 255, 0.75);
  outline-offset: 2px;
}

.language-toggle svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.4;
}

.language-toggle [data-language-target] {
  min-width: 17px;
  text-align: center;
}

html[lang="en"] .brand h1 {
  letter-spacing: 0.02em;
}

html[lang="en"] .brand p {
  letter-spacing: 0.12em;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(15, 22, 37, 0.62);
  color: var(--muted-strong);
  font-size: 12px;
  white-space: nowrap;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6d7890;
  box-shadow: 0 0 0 4px rgba(109, 120, 144, 0.09);
}

.status[data-state="online"] .status-dot {
  background: var(--mint);
  box-shadow: 0 0 0 4px rgba(88, 226, 194, 0.1), 0 0 14px rgba(88, 226, 194, 0.5);
}

.status[data-state="connecting"] .status-dot,
.status[data-state="reconnecting"] .status-dot {
  background: #ffc96b;
  box-shadow: 0 0 0 4px rgba(255, 201, 107, 0.1);
  animation: pulse 1.2s ease-in-out infinite;
}

.status[data-state="offline"] .status-dot {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(255, 137, 156, 0.1);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 40px;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

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

.button:focus-visible,
.send-button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(126, 156, 255, 0.75);
  outline-offset: 2px;
}

.button-ghost {
  min-height: 34px;
  padding: 0 13px;
  border-color: var(--line);
  background: transparent;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 500;
}

.button-ghost:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
}

.chat-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(13, 20, 35, 0.97);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.035);
  contain: paint;
  isolation: isolate;
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 25px 18px 18px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(14, 21, 36, 0.72), rgba(10, 16, 29, 0.36));
}

.sidebar-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0 4px 18px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.online-line {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin: 7px 0 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}

.live-mark {
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 5px rgba(88, 226, 194, 0.08), 0 0 18px rgba(88, 226, 194, 0.45);
}

.user-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 5px;
  margin: 0;
  padding: 16px 0;
  overflow-y: auto;
  list-style: none;
}

.user-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 5px 7px;
  border-radius: 11px;
  color: var(--muted-strong);
  font-size: 13px;
}

.user-item.is-self {
  background: rgba(126, 156, 255, 0.08);
  color: var(--text);
}

.user-item.is-clickable {
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}

.user-item.is-clickable:hover {
  background: rgba(126, 156, 255, 0.08);
  color: var(--text);
}

.user-item.is-private-target {
  background: rgba(88, 226, 194, 0.09);
  box-shadow: inset 0 0 0 1px rgba(88, 226, 194, 0.18);
  color: var(--text);
}

.user-avatar {
  display: grid;
  flex: none;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 9px;
  color: #08101d;
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}

.user-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.self-tag {
  margin-left: auto;
  color: var(--accent-bright);
  font-size: 10px;
  font-weight: 600;
}

.user-empty {
  padding: 10px 7px;
  color: var(--muted);
  font-size: 12px;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 4px 2px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.sidebar-footer p {
  margin: 0;
}

.lock-mark {
  width: 9px;
  height: 8px;
  border: 1px solid rgba(145, 162, 192, 0.6);
  border-radius: 2px;
  box-shadow: 0 -4px 0 -2px transparent, 0 -4px 0 -1px rgba(145, 162, 192, 0.6);
}

.chat-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background:
    radial-gradient(circle at 82% 0%, rgba(126, 156, 255, 0.055), transparent 38%),
    rgba(9, 15, 27, 0.26);
}

.chat-heading {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 86px;
  padding: 18px clamp(20px, 3vw, 38px);
  border-bottom: 1px solid var(--line);
}

.chat-heading h2 {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 7px 0 0;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: 0.03em;
}

.room-count {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
}

.typing-indicator {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.message-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 17px;
  min-height: 0;
  padding: 26px clamp(18px, 3vw, 38px) 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  scrollbar-color: rgba(140, 158, 194, 0.28) transparent;
  scrollbar-width: thin;
}

.message-list::-webkit-scrollbar,
.user-list::-webkit-scrollbar {
  width: 6px;
}

.message-list::-webkit-scrollbar-thumb,
.user-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(140, 158, 194, 0.24);
}

.message {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: min(78%, 670px);
  animation: message-in 220ms ease both;
}

.message.own {
  flex-direction: row-reverse;
  margin-left: auto;
}

.avatar {
  display: grid;
  flex: none;
  width: 35px;
  height: 35px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 11px;
  color: #08101d;
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.16);
}

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

.message-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 0 3px 5px;
  color: var(--muted);
  font-size: 11px;
}

.message.own .message-meta {
  justify-content: flex-end;
}

.message-author {
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 600;
}

.message.own .message-author {
  color: var(--accent-bright);
}

.message-meta time {
  opacity: 0.7;
}

.message-bubble {
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 4px 16px 16px 16px;
  background: var(--panel-raised);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.13);
  color: #dce5f7;
  font-size: 14px;
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.message.own .message-bubble {
  border-color: rgba(185, 201, 255, 0.18);
  border-radius: 16px 4px 16px 16px;
  background: linear-gradient(135deg, #7895f6, #647ee8);
  box-shadow: 0 10px 28px rgba(83, 111, 219, 0.25);
  color: #fff;
}

.system-message {
  align-self: center;
  max-width: 84%;
  padding: 5px 12px;
  border: 1px solid rgba(158, 177, 211, 0.1);
  border-radius: 999px;
  background: rgba(158, 177, 211, 0.055);
  color: var(--muted);
  font-size: 11px;
  text-align: center;
  animation: message-in 220ms ease both;
}

.empty-state {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  padding: 30px;
  text-align: center;
}

.empty-orbit {
  display: grid;
  width: 68px;
  height: 68px;
  margin-bottom: 22px;
  place-items: center;
  border: 1px solid rgba(126, 156, 255, 0.22);
  border-radius: 50%;
  box-shadow: 0 0 0 13px rgba(126, 156, 255, 0.035), 0 0 45px rgba(126, 156, 255, 0.08);
}

.empty-orbit span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--accent-bright), var(--mint));
  box-shadow: 0 0 18px rgba(126, 156, 255, 0.8);
}

.empty-state p {
  margin: 0;
  color: var(--muted-strong);
  font-size: 14px;
}

.empty-state > span {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.composer {
  flex: none;
  padding: 13px clamp(18px, 3vw, 38px) 18px;
  border-top: 1px solid transparent;
  background: linear-gradient(180deg, rgba(9, 15, 27, 0), rgba(9, 15, 27, 0.5));
}

.composer-box {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 7px 7px 7px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(20, 29, 47, 0.8);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.composer-box:focus-within {
  border-color: rgba(126, 156, 255, 0.45);
  box-shadow: 0 0 0 4px rgba(126, 156, 255, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

#message-input {
  flex: 1;
  width: 100%;
  max-height: 140px;
  padding: 10px 0;
  overflow-y: auto;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  scrollbar-width: none;
}

#message-input::-webkit-scrollbar {
  display: none;
}

#message-input::placeholder {
  color: #7383a1;
}

#message-input:disabled {
  cursor: not-allowed;
}

.send-button {
  display: grid;
  flex: none;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 13px;
  background: linear-gradient(145deg, var(--accent-bright), #6884ed);
  box-shadow: 0 8px 22px rgba(89, 117, 231, 0.3);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.send-button svg {
  width: 19px;
  height: 19px;
  fill: #0a1020;
}

.send-button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(89, 117, 231, 0.42);
}

.send-button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
  box-shadow: none;
}

.composer-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 4px 0;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.02em;
}

.join-screen {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  padding: 20px;
  place-items: center;
  background: rgba(4, 7, 13, 0.86);
}

.join-card {
  position: relative;
  width: min(438px, 100%);
  overflow: hidden;
  padding: clamp(28px, 5vw, 42px);
  border: 1px solid rgba(158, 177, 211, 0.18);
  border-radius: 26px;
  background: linear-gradient(155deg, #1a2740, #0b111e);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  animation: card-in 420ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.join-glow {
  display: none;
}

.join-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: clamp(28px, 6vh, 44px);
}

.join-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.2em;
}

.brand-mark-large {
  width: 42px;
  height: 42px;
  border-radius: 13px;
}

.join-card h2 {
  position: relative;
  margin: 0;
  font-size: clamp(24px, 5vw, 30px);
  font-weight: 650;
  letter-spacing: -0.02em;
}

.join-copy {
  position: relative;
  margin: 13px 0 28px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.75;
}

.join-card label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 600;
}

.join-card input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  background: rgba(6, 11, 21, 0.45);
  color: var(--text);
  font-size: 15px;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.join-card input::placeholder {
  color: #687895;
}

.join-card input:focus {
  border-color: rgba(126, 156, 255, 0.55);
  box-shadow: 0 0 0 4px rgba(126, 156, 255, 0.08);
}

.form-error {
  min-height: 19px;
  margin: 8px 2px 4px;
  color: var(--danger);
  font-size: 11px;
  line-height: 1.6;
}

.button-primary {
  width: 100%;
  height: 52px;
  margin-top: 5px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent-bright), #7089f1);
  box-shadow: 0 14px 34px rgba(86, 113, 226, 0.26);
  color: #08101d;
  font-size: 14px;
  font-weight: 700;
}

.button-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 17px 39px rgba(86, 113, 226, 0.37);
}

.button-primary:disabled {
  cursor: wait;
  opacity: 0.65;
}

.button-arrow {
  font-size: 19px;
  font-weight: 400;
  line-height: 1;
  transition: transform 160ms ease;
}

.button-primary:hover:not(:disabled) .button-arrow {
  transform: translateX(3px);
}

.join-note {
  margin: 21px 0 0;
  color: #6c7b96;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-align: center;
}

.toast {
  position: fixed;
  z-index: 100;
  bottom: max(24px, env(safe-area-inset-bottom));
  left: 50%;
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(24, 33, 52, 0.96);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
  color: var(--muted-strong);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.composer-target {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 0 4px 8px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.recipient-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  color: var(--muted-strong);
}

.recipient-wrap svg {
  position: absolute;
  left: 9px;
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-linejoin: round;
  stroke-width: 1.4;
  pointer-events: none;
}

#recipient-select {
  height: 28px;
  max-width: 210px;
  padding: 0 27px 0 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  outline: none;
  appearance: none;
  background: rgba(20, 29, 47, 0.8);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font);
  font-size: 11px;
  transition: border-color 160ms ease, background 160ms ease;
}

#recipient-select:hover {
  border-color: var(--line-strong);
}

#recipient-select:focus-visible {
  outline: 2px solid rgba(126, 156, 255, 0.75);
  outline-offset: 2px;
}

.recipient-wrap::after {
  content: "";
  position: absolute;
  right: 11px;
  width: 5px;
  height: 5px;
  border-right: 1px solid var(--muted);
  border-bottom: 1px solid var(--muted);
  pointer-events: none;
  transform: translateY(-2px) rotate(45deg);
}

.private-hint {
  padding: 4px 8px;
  border: 1px solid rgba(88, 226, 194, 0.2);
  border-radius: 999px;
  background: rgba(88, 226, 194, 0.07);
  color: var(--mint);
  font-size: 10px;
}

.composer.is-private .composer-box {
  border-color: rgba(88, 226, 194, 0.36);
}

.composer.is-private #message-input::placeholder {
  color: rgba(88, 226, 194, 0.7);
}

.composer-meta-right {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.admin-trigger {
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font);
  font-size: 10px;
  letter-spacing: 0.04em;
  transition: color 160ms ease;
}

.admin-trigger:hover {
  color: var(--accent-bright);
}

.admin-trigger.is-admin {
  color: var(--danger);
}

.admin-trigger:focus-visible {
  outline: 2px solid rgba(126, 156, 255, 0.75);
  outline-offset: 3px;
}

.message-meta {
  flex-wrap: wrap;
}

.private-tag {
  padding: 1px 7px;
  border: 1px solid rgba(88, 226, 194, 0.22);
  border-radius: 999px;
  background: rgba(88, 226, 194, 0.07);
  color: var(--mint);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.message.own .private-tag {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.1);
  color: #e7fffa;
}

.message.private-message .message-bubble {
  border-color: rgba(88, 226, 194, 0.18);
}

.message.private-message:not(.own) .message-bubble {
  background: linear-gradient(145deg, rgba(28, 48, 54, 0.9), rgba(24, 37, 48, 0.86));
}

.translate-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font);
  font-size: 10px;
  transition: color 160ms ease;
}

.translate-button:hover {
  color: var(--accent-bright);
}

.translate-button:focus-visible {
  outline: 2px solid rgba(126, 156, 255, 0.75);
  outline-offset: 2px;
}

.translate-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.message-translation {
  max-width: 100%;
  margin-top: 7px;
  padding: 8px 11px;
  border-left: 2px solid rgba(126, 156, 255, 0.55);
  border-radius: 2px 10px 10px 2px;
  background: rgba(126, 156, 255, 0.065);
}

.message.own .message-translation {
  border-left-color: rgba(88, 226, 194, 0.6);
  background: rgba(88, 226, 194, 0.065);
}

.translation-label {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.translation-text {
  margin: 0;
  color: var(--muted-strong);
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.admin-screen {
  position: fixed;
  z-index: 70;
  inset: 0;
  display: grid;
  padding: 20px;
  place-items: center;
  background: rgba(4, 7, 13, 0.88);
}

.admin-card {
  position: relative;
  width: min(420px, 100%);
  overflow: hidden;
  padding: clamp(26px, 4vw, 36px);
  border: 1px solid rgba(158, 177, 211, 0.18);
  border-radius: 24px;
  background: linear-gradient(155deg, #1a2740, #0b111e);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  animation: card-in 320ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.admin-card h2 {
  position: relative;
  margin: 9px 0 0;
  font-size: clamp(22px, 4vw, 27px);
  font-weight: 650;
}

.admin-copy {
  position: relative;
  margin: 12px 0 22px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.admin-card label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 600;
}

.admin-card input {
  width: 100%;
  height: 48px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: none;
  background: rgba(6, 11, 21, 0.45);
  color: var(--text);
  font-size: 14px;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.admin-card input:focus {
  border-color: rgba(126, 156, 255, 0.55);
  box-shadow: 0 0 0 4px rgba(126, 156, 255, 0.08);
}

.admin-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 10px;
}

.admin-actions .button {
  width: auto;
  min-width: 92px;
  height: 44px;
  margin-top: 0;
  padding: 0 18px;
  font-size: 13px;
}

.admin-actions .button-ghost {
  color: var(--muted-strong);
}

@keyframes message-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

@media (max-width: 820px) {
  .chat-shell {
    grid-template-columns: 1fr;
    border-radius: 22px;
  }

  .sidebar {
    display: none;
  }

  .chat-heading {
    min-height: 76px;
  }
}

@media (max-width: 560px) {
  .page {
    padding: 10px;
    padding-top: max(10px, env(safe-area-inset-top));
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  .topbar {
    padding-bottom: 11px;
  }

  .brand p {
    display: none;
  }

  .brand h1 {
    font-size: 16px;
  }

  .status {
    min-height: 30px;
    padding: 0 10px;
    font-size: 11px;
  }

  .button-ghost {
    min-height: 30px;
    padding: 0 9px;
  }

  .topbar-actions {
    gap: 7px;
  }

  .language-toggle {
    min-width: 52px;
    min-height: 30px;
    padding: 0 8px;
    font-size: 10px;
  }

  .language-toggle svg {
    width: 13px;
    height: 13px;
  }

  .chat-heading {
    min-height: 70px;
    padding: 14px 18px;
  }

  .chat-heading h2 {
    margin-top: 5px;
    font-size: 18px;
  }

  .typing-indicator {
    max-width: 46%;
    font-size: 10px;
  }

  .message-list {
    gap: 14px;
    padding: 18px 14px 14px;
  }

  .message {
    max-width: 88%;
  }

  .avatar {
    width: 32px;
    height: 32px;
    border-radius: 10px;
  }

  .message-bubble {
    padding: 9px 12px;
    font-size: 13px;
  }

  .composer {
    padding: 10px 12px 12px;
  }

  .composer-target {
    gap: 6px;
    padding-bottom: 6px;
  }

  #recipient-select {
    max-width: 165px;
    height: 26px;
    font-size: 10px;
  }

  .private-hint {
    display: none;
  }

  .composer-box {
    padding-left: 13px;
    border-radius: 16px;
  }

  .composer-meta {
    padding-top: 6px;
  }

  .composer-hint {
    display: none;
  }

  .composer-meta {
    justify-content: flex-end;
  }

  .composer-meta-right {
    gap: 9px;
  }

  .message-meta {
    gap: 6px;
  }

  .translate-button {
    font-size: 9px;
  }

  .admin-screen {
    padding: 14px;
  }

  .admin-card {
    padding: 26px 20px;
    border-radius: 21px;
  }

  .admin-actions .button {
    flex: 1;
    min-width: 0;
  }

  .join-card {
    padding: 28px 22px;
    border-radius: 22px;
  }

  .join-top {
    margin-bottom: 26px;
  }

  .join-copy {
    margin-bottom: 24px;
  }
}

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