/* ============================================================
   LinguaRoom — multilingual realtime chat
   ============================================================ */
:root {
  --bg: #060a13;
  --bg-soft: #0a1120;
  --panel: rgba(16, 25, 44, 0.82);
  --panel-solid: #101a2e;
  --card: #131f35;
  --card-hi: #172540;
  --line: rgba(135, 166, 216, 0.17);
  --line-strong: rgba(135, 166, 216, 0.3);
  --text: #f2f6ff;
  --muted: #94a8c7;
  --muted-2: #657a99;
  --accent: #5eead4;
  --accent-deep: #14b8a6;
  --blue: #60a5fa;
  --violet: #a78bfa;
  --pink: #f472b6;
  --danger: #fb7185;
  --ok: #34d399;
  --warn: #fbbf24;
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --shadow: 0 34px 90px rgba(0, 0, 0, 0.52);
  --font: "Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans", "Apple SD Gothic Neo", "Noto Sans CJK SC",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden],
.hidden {
  display: none !important;
}

html {
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

button {
  cursor: pointer;
  border: none;
  background: none;
}

button:disabled {
  cursor: not-allowed;
}

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

::selection {
  background: rgba(94, 234, 212, 0.28);
}

/* ---------- ambient background ---------- */
.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(1100px 700px at 12% -10%, rgba(37, 99, 235, 0.2), transparent 60%),
    radial-gradient(900px 700px at 100% 0%, rgba(168, 85, 247, 0.15), transparent 60%),
    radial-gradient(900px 800px at 50% 110%, rgba(20, 184, 166, 0.11), transparent 60%),
    linear-gradient(180deg, #060a13 0%, #070d19 55%, #050911 100%);
}

.ambient::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(125, 160, 220, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(125, 160, 220, 0.035) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 72%);
  -webkit-mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 72%);
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  animation: drift 22s ease-in-out infinite alternate;
}

.orb-a {
  width: 420px;
  height: 420px;
  left: -120px;
  top: 4%;
  background: #1d4ed8;
}

.orb-b {
  width: 360px;
  height: 360px;
  right: -100px;
  top: 20%;
  background: #7c3aed;
  animation-delay: -7s;
}

.orb-c {
  width: 460px;
  height: 460px;
  left: 38%;
  bottom: -280px;
  background: #0f766e;
  animation-delay: -12s;
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(36px, -26px, 0) scale(1.08); }
}

/* ---------- shell / topbar ---------- */
.app-shell {
  width: 100%;
  max-width: 1320px;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
  padding: 18px 28px 28px;
  display: flex;
  flex-direction: column;
}

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

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

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  font-size: 23px;
  font-weight: 700;
  color: #05201c;
  background: linear-gradient(135deg, #5eead4 0%, #60a5fa 60%, #a78bfa 100%);
  box-shadow: 0 10px 26px rgba(45, 212, 191, 0.28);
  font-family: "PingFang SC", "Hiragino Sans", "Apple SD Gothic Neo", sans-serif;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.16;
  min-width: 0;
}

.brand-text strong {
  font-size: 18px;
  letter-spacing: 0.2px;
}

.brand-text small {
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

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

.lang-picker {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(15, 24, 42, 0.72);
  transition: border-color 0.18s ease, background 0.18s ease;
}

.lang-picker:hover,
.lang-picker:focus-within {
  border-color: var(--line-strong);
  background: rgba(23, 36, 62, 0.9);
}

.lang-globe {
  font-size: 14px;
  opacity: 0.8;
}

.lang-picker select {
  appearance: none;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  padding: 0 16px 0 0;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 7px) 52%, calc(100% - 2px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.lang-picker option {
  background: #111c30;
  color: var(--text);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 44px;
  padding: 4px 5px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(15, 24, 42, 0.72);
}

.user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  max-width: 150px;
}

.user-meta strong {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-meta small {
  font-size: 10.5px;
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
  transition: all 0.16s ease;
  flex-shrink: 0;
  font-size: 16px;
}

.icon-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--line);
}

.logout-btn {
  font-size: 17px;
}

/* ---------- shared primitives ---------- */
.view {
  flex: 1;
  min-height: 0;
  animation: viewIn 0.35s ease both;
}

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

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.19em;
  text-transform: uppercase;
  color: var(--accent);
}

.eyebrow i {
  width: 20px;
  height: 1.5px;
  background: linear-gradient(90deg, var(--accent), transparent);
  border-radius: 2px;
}

.gradient-text {
  background: linear-gradient(100deg, #5eead4 0%, #60a5fa 45%, #c084fc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lead {
  color: var(--muted);
  font-size: 15.5px;
  line-height: 1.75;
  max-width: 54ch;
}

.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 22px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 14.5px;
  color: #04211d;
  background: linear-gradient(135deg, #5eead4, #38bdf8);
  box-shadow: 0 12px 30px rgba(45, 212, 191, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
  box-shadow: 0 16px 38px rgba(45, 212, 191, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.primary:active {
  transform: translateY(0);
}

.primary:disabled {
  opacity: 0.55;
  transform: none;
  box-shadow: none;
}

.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(20, 32, 54, 0.7);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.16s ease;
}

.ghost:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: rgba(30, 46, 76, 0.8);
}

.ghost.small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field > span {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.field input {
  width: 100%;
  height: 47px;
  padding: 0 15px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: rgba(8, 14, 26, 0.72);
  color: var(--text);
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.field input::placeholder {
  color: #5a6f8d;
}

.field input:focus {
  border-color: rgba(94, 234, 212, 0.55);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.09);
  background: rgba(8, 14, 26, 0.95);
}

.form-error {
  min-height: 20px;
  color: var(--danger);
  font-size: 12.5px;
  line-height: 1.45;
}

.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(4, 33, 29, 0.25);
  border-top-color: #04211d;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  flex-shrink: 0;
}

.spinner.light {
  border-color: rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
}

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

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-weight: 700;
  font-size: 17px;
  color: #fff;
  background: var(--avatar-color, #3b82f6);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 5px 14px rgba(0, 0, 0, 0.28);
  user-select: none;
  text-transform: uppercase;
}

.avatar-sm {
  width: 36px;
  height: 36px;
  font-size: 14px;
}

/* ---------- auth ---------- */
.auth-view {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.82fr);
  gap: clamp(34px, 6vw, 92px);
  align-items: center;
  padding: 3vh 4% 5vh;
}

.auth-copy h1 {
  margin: 20px 0 18px;
  font-size: clamp(38px, 5vw, 68px);
  line-height: 1.06;
  letter-spacing: -0.03em;
  font-weight: 800;
}

.auth-copy .lead {
  max-width: 46ch;
}

.feature-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 17px;
  margin-top: 34px;
}

.feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.feature-icon {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 18px;
  background: rgba(94, 234, 212, 0.08);
  border: 1px solid rgba(94, 234, 212, 0.15);
  flex-shrink: 0;
}

.feature-list strong {
  display: block;
  font-size: 14.5px;
  font-weight: 650;
  margin-bottom: 3px;
}

.feature-list small {
  display: block;
  color: var(--muted-2);
  font-size: 12.5px;
}

.language-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 34px;
}

.language-cloud span {
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(18, 30, 51, 0.6);
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.03em;
}

.language-cloud span:nth-child(1) { color: #5eead4; border-color: rgba(94, 234, 212, 0.22); }
.language-cloud span:nth-child(2) { color: #f9a8d4; border-color: rgba(244, 114, 182, 0.2); }
.language-cloud span:nth-child(3) { color: #fcd34d; border-color: rgba(251, 191, 36, 0.2); }
.language-cloud span:nth-child(4) { color: #93c5fd; border-color: rgba(96, 165, 250, 0.22); }

.auth-card {
  width: 100%;
  max-width: 440px;
  justify-self: end;
  padding: 26px 26px 22px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(23, 37, 64, 0.9), rgba(13, 22, 39, 0.94));
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(7, 13, 25, 0.65);
  border: 1px solid var(--line);
  margin-bottom: 22px;
}

.auth-tab {
  height: 39px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 650;
  color: var(--muted);
  transition: all 0.18s ease;
}

.auth-tab.active {
  color: var(--text);
  background: linear-gradient(180deg, rgba(45, 65, 100, 0.95), rgba(30, 45, 72, 0.95));
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-submit {
  width: 100%;
  margin-top: 2px;
}

.auth-hint {
  margin-top: 16px;
  text-align: center;
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.5;
}

/* ---------- lobby ---------- */
.lobby-view {
  padding: 2vh 0 4vh;
}

.lobby-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 30px;
}

.lobby-hero h1 {
  margin: 12px 0 9px;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 15px;
  border-radius: 999px;
  border: 1px solid rgba(52, 211, 153, 0.22);
  background: rgba(16, 185, 129, 0.08);
  color: #6ee7b7;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.55);
  animation: pulse 2.2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5); }
  70% { box-shadow: 0 0 0 9px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

.lobby-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.panel {
  position: relative;
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(155deg, rgba(23, 37, 64, 0.86), rgba(12, 21, 38, 0.9));
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.24);
  overflow: hidden;
}

.panel::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, rgba(94, 234, 212, 0.24), transparent 36%, transparent 65%, rgba(167, 139, 250, 0.19));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.panel-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: rgba(94, 234, 212, 0.08);
  border: 1px solid rgba(94, 234, 212, 0.15);
  font-size: 18px;
  margin-bottom: 14px;
}

.panel h2 {
  font-size: 19px;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.panel > p {
  color: var(--muted-2);
  font-size: 13px;
  margin-bottom: 17px;
}

.create-panel .field {
  margin-bottom: 14px;
}

.create-panel .primary {
  width: 100%;
}

.join-panel {
  display: flex;
  flex-direction: column;
}

.join-form {
  display: flex;
  gap: 10px;
}

.code-input {
  flex: 1;
  min-width: 0;
  height: 47px;
  padding: 0 15px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: rgba(8, 14, 26, 0.72);
  color: var(--text);
  font-family: "SF Mono", "Roboto Mono", "Cascadia Code", monospace;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.code-input::placeholder {
  color: #536783;
  letter-spacing: 0.12em;
  font-weight: 500;
}

.code-input:focus {
  border-color: rgba(94, 234, 212, 0.55);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.09);
}

.join-form .primary {
  min-width: 92px;
  padding: 0 18px;
}

.rooms-section {
  margin-top: 34px;
}

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

.section-head h2 {
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 9px;
}

.count-badge,
.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 21px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(94, 234, 212, 0.1);
  border: 1px solid rgba(94, 234, 212, 0.17);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}

.rooms-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(292px, 1fr));
  gap: 14px;
}

.room-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 17px 17px 15px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(22, 36, 61, 0.84), rgba(13, 23, 41, 0.9));
  color: var(--text);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.room-card:hover {
  transform: translateY(-3px);
  border-color: rgba(94, 234, 212, 0.34);
  background: linear-gradient(160deg, rgba(28, 45, 76, 0.92), rgba(15, 27, 48, 0.94));
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.28);
}

.room-card-top {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}

.room-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 18px;
  background: rgba(96, 165, 250, 0.09);
  border: 1px solid rgba(96, 165, 250, 0.16);
  flex-shrink: 0;
}

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

.room-card-title h3 {
  font-size: 14.5px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.room-card-code {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: "SF Mono", "Roboto Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--accent);
}

.room-card-code i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.7;
}

.room-card-online {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted-2);
  font-size: 11px;
  white-space: nowrap;
}

.room-card-online i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
}

.room-preview {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
  min-height: 20px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.room-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(135, 166, 216, 0.1);
  color: var(--muted-2);
  font-size: 11px;
}

.room-card-foot .open-hint {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--accent);
  font-weight: 650;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 38px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  color: var(--muted-2);
  font-size: 13px;
  text-align: center;
}

.empty-icon {
  font-size: 28px;
  opacity: 0.8;
}

/* ---------- chat shell ---------- */
.chat-view {
  min-height: 0;
  height: calc(100vh - 128px);
  height: calc(100svh - 128px);
  min-height: 540px;
}

.chat-shell {
  height: 100%;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background: rgba(11, 18, 32, 0.9);
  box-shadow: var(--shadow);
  overflow: hidden;
  backdrop-filter: blur(18px);
}

.chat-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 17px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(20, 32, 55, 0.94), rgba(13, 22, 39, 0.9));
  min-height: 70px;
}

.back-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
  font-size: 18px;
}

.room-head {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  flex: 1;
}

.room-emoji {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 20px;
  background: linear-gradient(150deg, rgba(94, 234, 212, 0.15), rgba(96, 165, 250, 0.1));
  border: 1px solid rgba(94, 234, 212, 0.16);
  flex-shrink: 0;
}

.room-head-text {
  min-width: 0;
}

.room-head-text h2 {
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.room-code-line {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted-2);
  font-size: 10.5px;
  white-space: nowrap;
}

.room-code-line code {
  font-family: "SF Mono", "Roboto Mono", monospace;
  color: var(--accent);
  font-size: 11.5px;
  letter-spacing: 0.16em;
}

.copy-code {
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 10px;
  color: var(--muted);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  transition: all 0.15s ease;
}

.copy-code:hover {
  color: var(--accent);
  border-color: rgba(94, 234, 212, 0.3);
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
}

.online-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(10, 18, 32, 0.7);
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
}

.online-badge strong {
  color: #6ee7b7;
  font-size: 12px;
}

.online-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.8);
}

.members-toggle {
  display: none;
}

.chat-body {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
}

/* ---------- members ---------- */
.members-sidebar {
  width: 218px;
  flex: 0 0 218px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: rgba(10, 17, 31, 0.7);
  padding: 15px 10px 12px;
  min-height: 0;
}

.members-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px 12px;
  color: var(--muted-2);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.member-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 2px;
}

.member-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: 11px;
  opacity: 0.62;
  transition: opacity 0.18s ease, background 0.18s ease;
}

.member-item.online {
  opacity: 1;
}

.member-item:hover {
  background: rgba(255, 255, 255, 0.035);
}

.member-item .avatar {
  width: 30px;
  height: 30px;
  font-size: 12px;
}

.member-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

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

.member-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 9.5px;
  color: var(--muted-2);
  white-space: nowrap;
}

.member-status i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted-2);
}

.member-item.online .member-status {
  color: #6ee7b7;
}

.member-item.online .member-status i {
  background: var(--ok);
  box-shadow: 0 0 6px rgba(52, 211, 153, 0.8);
}

.you-tag {
  font-size: 8.5px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(94, 234, 212, 0.11);
  color: var(--accent);
  margin-left: 4px;
  font-weight: 700;
  vertical-align: 1px;
}

.sidebar-foot {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 8px 2px;
  border-top: 1px solid rgba(135, 166, 216, 0.08);
  margin-top: 8px;
  color: var(--muted-2);
  font-size: 9.5px;
  line-height: 1.35;
}

.mini-brand {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #05201c;
  background: linear-gradient(135deg, #5eead4, #60a5fa);
  flex-shrink: 0;
}

.member-backdrop {
  display: none;
}

/* ---------- messages ---------- */
.chat-main {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(700px 420px at 50% 0%, rgba(37, 99, 235, 0.055), transparent 70%),
    rgba(9, 15, 27, 0.56);
}

.connection-banner {
  position: absolute;
  z-index: 6;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid rgba(251, 191, 36, 0.25);
  background: rgba(46, 34, 16, 0.94);
  color: #fcd34d;
  font-size: 11px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
}

.mini-spinner {
  width: 10px;
  height: 10px;
  border: 1.5px solid rgba(252, 211, 77, 0.3);
  border-top-color: #fcd34d;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.messages-container {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px 24px 10px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

.messages-loading {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.message-skeleton {
  display: flex;
  gap: 11px;
  align-items: flex-start;
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(148, 168, 199, 0.1);
  animation: shimmer 1.5s infinite;
}

.skeleton-lines {
  flex: 1;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.skeleton-line {
  height: 11px;
  border-radius: 6px;
  background: rgba(148, 168, 199, 0.1);
  animation: shimmer 1.5s infinite;
}

.skeleton-line:nth-child(1) { width: 32%; }
.skeleton-line:nth-child(2) { width: 78%; height: 34px; border-radius: 12px; }
.skeleton-line:nth-child(3) { width: 64%; }

@keyframes shimmer {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.9; }
}

.load-older {
  align-self: center;
  margin-bottom: 2px;
}

.date-separator {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted-2);
  font-size: 10px;
  letter-spacing: 0.08em;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(15, 25, 44, 0.76);
  border: 1px solid rgba(135, 166, 216, 0.09);
}

.empty-chat {
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  padding: 30px 20px;
  max-width: 440px;
}

.empty-chat-icon {
  width: 66px;
  height: 66px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  font-size: 30px;
  background: linear-gradient(150deg, rgba(94, 234, 212, 0.1), rgba(96, 165, 250, 0.08));
  border: 1px solid var(--line);
  margin-bottom: 4px;
}

.empty-chat h3 {
  font-size: 17px;
  letter-spacing: -0.01em;
}

.empty-chat p {
  color: var(--muted-2);
  font-size: 12.5px;
  line-height: 1.6;
  max-width: 38ch;
}

.suggestion-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin-top: 9px;
}

.suggestion-chip {
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(22, 36, 61, 0.68);
  color: var(--muted);
  font-size: 11.5px;
  transition: all 0.16s ease;
}

.suggestion-chip:hover {
  color: var(--text);
  border-color: rgba(94, 234, 212, 0.32);
  background: rgba(32, 50, 82, 0.8);
}

.message {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  max-width: min(780px, 92%);
  animation: messageIn 0.28s ease both;
}

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

.message .avatar {
  width: 40px;
  height: 40px;
  font-size: 15px;
  margin-top: 2px;
}

.message-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.message-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.message-sender {
  font-size: 13px;
  font-weight: 700;
  color: #e7eefb;
}

.self-tag {
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--accent);
  background: rgba(94, 234, 212, 0.09);
  border: 1px solid rgba(94, 234, 212, 0.15);
  padding: 1px 5px;
  border-radius: 4px;
}

.message-time {
  font-size: 10px;
  color: var(--muted-2);
}

.message-text {
  align-self: flex-start;
  max-width: 100%;
  padding: 11px 15px;
  border-radius: 17px;
  border-top-left-radius: 5px;
  background: linear-gradient(160deg, #1c2a43, #172237);
  border: 1px solid rgba(135, 166, 216, 0.12);
  color: #edf3fc;
  font-size: 14.5px;
  line-height: 1.62;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
}

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

.message.self .message-content {
  align-items: flex-end;
}

.message.self .message-header {
  flex-direction: row-reverse;
}

.message.self .message-text {
  border-radius: 17px;
  border-top-right-radius: 5px;
  border-top-left-radius: 17px;
  background: linear-gradient(135deg, #1f5f8a, #177a78);
  border-color: rgba(94, 234, 212, 0.2);
  color: #f3fffd;
}

/* ---------- translation panel ---------- */
.translation-panel {
  width: 100%;
  max-width: 100%;
  border-radius: 13px;
  border: 1px solid rgba(94, 234, 212, 0.13);
  background: linear-gradient(160deg, rgba(17, 31, 47, 0.92), rgba(12, 23, 38, 0.94));
  overflow: hidden;
}

.translation-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border-bottom: 1px solid rgba(94, 234, 212, 0.08);
  color: var(--muted-2);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.translation-head .globe-mini {
  color: var(--accent);
  font-size: 10px;
}

.translation-head .translation-state {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: rgba(94, 234, 212, 0.75);
  text-transform: none;
  letter-spacing: 0;
  font-size: 9.5px;
}

.translation-body {
  display: flex;
  flex-direction: column;
}

.translation-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 24px;
  align-items: start;
  gap: 9px;
  padding: 8px 11px;
  border-bottom: 1px solid rgba(135, 166, 216, 0.06);
}

.translation-row:last-child {
  border-bottom: none;
}

.lang-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 19px;
  padding: 0 6px;
  border-radius: 5px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  color: #5eead4;
  background: rgba(94, 234, 212, 0.08);
}

.translation-row[data-lang="ja"] .lang-tag {
  color: #f9a8d4;
  background: rgba(244, 114, 182, 0.08);
}

.translation-row[data-lang="ko"] .lang-tag {
  color: #fcd34d;
  background: rgba(251, 191, 36, 0.08);
}

.translation-row[data-lang="en"] .lang-tag {
  color: #93c5fd;
  background: rgba(96, 165, 250, 0.08);
}

.lang-text {
  color: #c5d4e9;
  font-size: 12.8px;
  line-height: 1.5;
  word-break: break-word;
  overflow-wrap: anywhere;
  padding-top: 1px;
}

.speak-btn {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: var(--muted-2);
  font-size: 10px;
  opacity: 0.5;
  transition: all 0.15s ease;
}

.speak-btn:hover {
  opacity: 1;
  color: var(--accent);
  background: rgba(94, 234, 212, 0.08);
}

.translation-panel.pending .translation-body {
  padding: 4px 0;
}

.translation-pending-row {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 9px;
  padding: 7px 11px;
  align-items: center;
}

.translation-pending-row .lang-tag {
  opacity: 0.45;
}

.skeleton-text {
  height: 9px;
  border-radius: 5px;
  background: rgba(148, 168, 199, 0.12);
  animation: shimmer 1.4s infinite;
}

.translation-failed {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: var(--muted-2);
  font-size: 11.5px;
}

.translation-failed .retry-btn {
  margin-left: auto;
  padding: 4px 9px;
  border-radius: 6px;
  border: 1px solid rgba(251, 113, 133, 0.25);
  color: #fda4af;
  font-size: 10.5px;
  background: rgba(251, 113, 133, 0.07);
}

.translation-failed .retry-btn:hover {
  background: rgba(251, 113, 133, 0.14);
}

/* ---------- new messages / typing / asr ---------- */
.new-messages {
  position: absolute;
  z-index: 5;
  right: 24px;
  bottom: 84px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: 999px;
  background: linear-gradient(135deg, #14b8a6, #0ea5e9);
  color: #03211e;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 10px 28px rgba(20, 184, 166, 0.3);
  animation: popIn 0.2s ease both;
}

@keyframes popIn {
  from { opacity: 0; transform: translateY(6px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.typing-indicator {
  flex: 0 0 auto;
  min-height: 22px;
  padding: 1px 26px 3px;
  color: var(--muted-2);
  font-size: 10.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.typing-dots {
  display: inline-flex;
  gap: 2px;
}

.typing-dots i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--muted);
  animation: typing 1s infinite;
}

.typing-dots i:nth-child(2) { animation-delay: 0.15s; }
.typing-dots i:nth-child(3) { animation-delay: 0.3s; }

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

.asr-status {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: 82px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 15px;
  border-radius: 999px;
  border: 1px solid rgba(94, 234, 212, 0.22);
  background: rgba(8, 28, 28, 0.95);
  color: #99f6e4;
  font-size: 11.5px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
}

.asr-status .spinner {
  border-color: rgba(153, 246, 228, 0.25);
  border-top-color: #99f6e4;
}

/* ---------- composer ---------- */
.chat-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 17px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(15, 24, 42, 0.97), rgba(11, 18, 32, 0.99));
}

.recorder-wrap {
  position: relative;
  flex-shrink: 0;
}

.record-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(42, 55, 78, 0.8);
  border: 1px solid rgba(135, 166, 216, 0.18);
  color: #fda4af;
  font-size: 18px;
  transition: all 0.18s ease;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}

.record-btn:hover {
  background: rgba(56, 72, 100, 0.9);
  transform: translateY(-1px);
}

.record-btn.recording {
  background: linear-gradient(135deg, #e11d48, #f43f5e);
  border-color: transparent;
  color: #fff;
  animation: recordPulse 1.3s infinite;
}

.record-btn:disabled {
  opacity: 0.38;
  transform: none;
}

@keyframes recordPulse {
  0% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.45); }
  70% { box-shadow: 0 0 0 11px rgba(244, 63, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); }
}

.recording-panel {
  position: absolute;
  bottom: 58px;
  left: -4px;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px 9px 12px;
  border-radius: 14px;
  border: 1px solid rgba(244, 63, 94, 0.28);
  background: rgba(38, 15, 25, 0.98);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.42);
  white-space: nowrap;
  animation: popIn 0.18s ease both;
}

.recording-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fb7185;
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.recording-time {
  font-family: "SF Mono", "Roboto Mono", monospace;
  color: #fecdd3;
  font-size: 11.5px;
  min-width: 32px;
}

.waveform {
  display: flex;
  align-items: center;
  gap: 2.5px;
  height: 18px;
  padding: 0 2px;
}

.waveform i {
  width: 2.5px;
  height: 5px;
  border-radius: 2px;
  background: #fb7185;
  animation: wave 0.9s ease-in-out infinite;
}

.waveform i:nth-child(1) { animation-delay: 0s; }
.waveform i:nth-child(2) { animation-delay: 0.14s; }
.waveform i:nth-child(3) { animation-delay: 0.28s; }
.waveform i:nth-child(4) { animation-delay: 0.42s; }
.waveform i:nth-child(5) { animation-delay: 0.56s; }

@keyframes wave {
  0%, 100% { height: 5px; opacity: 0.55; }
  50% { height: 17px; opacity: 1; }
}

.cancel-record {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  color: #fda4af;
  font-size: 10px;
  background: rgba(255, 255, 255, 0.05);
}

.cancel-record:hover {
  background: rgba(255, 255, 255, 0.1);
}

.input-wrapper {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 12px 8px 15px;
  border-radius: 18px;
  border: 1px solid rgba(135, 166, 216, 0.17);
  background: rgba(8, 15, 28, 0.8);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.input-wrapper:focus-within {
  border-color: rgba(94, 234, 212, 0.4);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.06);
}

.input-wrapper textarea {
  flex: 1;
  width: 100%;
  min-height: 26px;
  max-height: 120px;
  padding: 4px 0;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.5;
  overflow-y: auto;
}

.input-wrapper textarea::placeholder {
  color: #586d8c;
}

.input-counter {
  display: none;
  align-self: flex-end;
  padding-bottom: 3px;
  color: var(--muted-2);
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.input-counter.visible {
  display: inline;
}

.input-counter.over {
  color: var(--danger);
}

.send-btn {
  flex-shrink: 0;
  height: 46px;
  padding: 0 19px;
  border-radius: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #04211d;
  font-size: 13px;
  font-weight: 700;
  background: linear-gradient(135deg, #5eead4, #38bdf8);
  box-shadow: 0 8px 22px rgba(45, 212, 191, 0.18);
  transition: filter 0.16s ease, transform 0.16s ease, opacity 0.16s ease;
}

.send-btn:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.send-btn:disabled {
  opacity: 0.45;
  transform: none;
  filter: none;
}

.send-arrow {
  font-size: 12px;
  transform: rotate(-8deg);
}

/* ---------- toasts ---------- */
.toast-host {
  position: fixed;
  z-index: 100;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 9px;
  pointer-events: none;
  max-width: min(360px, calc(100vw - 32px));
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(18, 30, 51, 0.97);
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.45;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  backdrop-filter: blur(14px);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  background: rgba(94, 234, 212, 0.12);
  color: var(--accent);
}

.toast.error {
  border-color: rgba(251, 113, 133, 0.3);
}

.toast.error .toast-icon {
  background: rgba(251, 113, 133, 0.14);
  color: #fda4af;
}

.toast.success .toast-icon {
  background: rgba(52, 211, 153, 0.14);
  color: #6ee7b7;
}

/* ---------- scrollbars ---------- */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(135, 166, 216, 0.22);
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(135, 166, 216, 0.35);
}

/* ---------- focus / reduced motion ---------- */
:focus-visible {
  outline: 2px solid rgba(94, 234, 212, 0.65);
  outline-offset: 2px;
}

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

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1080px) {
  .app-shell {
    padding: 16px 20px 22px;
  }

  .auth-view {
    gap: 36px;
    padding: 2vh 1% 4vh;
  }

  .auth-copy h1 {
    font-size: clamp(36px, 5.4vw, 54px);
  }

  .members-sidebar {
    width: 196px;
    flex-basis: 196px;
  }
}

@media (max-width: 900px) {
  .auth-view {
    grid-template-columns: 1fr;
    gap: 30px;
    padding: 1vh 0 4vh;
    align-items: start;
  }

  .auth-card {
    justify-self: stretch;
    max-width: 520px;
    margin: 0 auto;
  }

  .auth-copy h1 {
    font-size: clamp(34px, 7vw, 52px);
  }

  .feature-list {
    display: none;
  }

  .language-cloud {
    margin-top: 20px;
  }

  .lobby-grid {
    grid-template-columns: 1fr;
  }

  .chat-view {
    height: calc(100svh - 112px);
    min-height: 480px;
  }

  .chat-shell {
    border-radius: 22px;
  }

  .members-sidebar {
    position: absolute;
    z-index: 20;
    top: 0;
    left: 0;
    bottom: 0;
    width: 246px;
    flex-basis: 246px;
    transform: translateX(-104%);
    transition: transform 0.25s ease;
    border-right: 1px solid var(--line-strong);
    background: rgba(10, 18, 32, 0.99);
    box-shadow: 24px 0 60px rgba(0, 0, 0, 0.4);
  }

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

  .member-backdrop {
    display: block;
    position: absolute;
    z-index: 19;
    inset: 0;
    background: rgba(3, 7, 14, 0.6);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    backdrop-filter: blur(2px);
  }

  .member-backdrop.show {
    opacity: 1;
    pointer-events: auto;
  }

  .members-toggle {
    display: grid;
  }

  .lobby-view {
    padding-top: 0;
  }
}

@media (max-width: 680px) {
  body {
    font-size: 14px;
  }

  .app-shell {
    padding: 10px 10px 12px;
  }

  .topbar {
    padding: 2px 0 10px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 13px;
    font-size: 20px;
  }

  .brand-text strong {
    font-size: 15.5px;
  }

  .brand-text small {
    display: none;
  }

  .topbar-actions {
    gap: 7px;
  }

  .lang-picker {
    height: 35px;
    padding: 0 7px;
  }

  .lang-globe {
    display: none;
  }

  .user-meta {
    display: none;
  }

  .user-chip {
    height: 40px;
    padding: 2px;
    gap: 2px;
    border-radius: 13px;
  }

  .user-chip .avatar {
    width: 34px;
    height: 34px;
  }

  .logout-btn {
    width: 28px;
    height: 28px;
  }

  .auth-view {
    padding: 0 2px 26px;
  }

  .auth-copy h1 {
    margin: 14px 0 12px;
    font-size: clamp(31px, 9.5vw, 44px);
  }

  .auth-copy .lead {
    font-size: 14px;
    line-height: 1.65;
  }

  .language-cloud {
    display: none;
  }

  .auth-card {
    padding: 20px 18px 18px;
    border-radius: 22px;
  }

  .lobby-hero {
    align-items: flex-start;
    flex-direction: column;
    gap: 13px;
    margin-bottom: 20px;
  }

  .lobby-hero h1 {
    font-size: 30px;
  }

  .panel {
    padding: 19px;
    border-radius: 19px;
  }

  .join-form {
    flex-direction: column;
  }

  .join-form .primary {
    width: 100%;
  }

  .rooms-list {
    grid-template-columns: 1fr;
  }

  .rooms-section {
    margin-top: 24px;
  }

  .chat-view {
    height: calc(100svh - 82px);
    min-height: 0;
  }

  .chat-shell {
    border-radius: 18px;
  }

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

  .back-btn {
    width: 32px;
    height: 32px;
    font-size: 15px;
  }

  .room-emoji {
    width: 34px;
    height: 34px;
    font-size: 16px;
    border-radius: 10px;
  }

  .room-head {
    gap: 8px;
  }

  .room-head-text h2 {
    font-size: 14px;
  }

  .room-code-line {
    font-size: 9px;
    gap: 5px;
  }

  .room-code-line code {
    font-size: 10px;
  }

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

  .share-btn {
    display: none;
  }

  .online-badge {
    height: 28px;
    padding: 0 8px;
    font-size: 10px;
    gap: 4px;
  }

  .online-badge > span[data-i18n="online"] {
    display: none;
  }

  .members-toggle {
    width: 30px;
    height: 30px;
  }

  .messages-container {
    padding: 15px 12px 6px;
    gap: 15px;
  }

  .message {
    max-width: 100%;
    gap: 8px;
  }

  .message .avatar {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }

  .message-text {
    font-size: 13.5px;
    padding: 9px 12px;
  }

  .message-sender {
    font-size: 12px;
  }

  .translation-row {
    grid-template-columns: 46px minmax(0, 1fr) 20px;
    gap: 7px;
    padding: 7px 9px;
  }

  .lang-text {
    font-size: 12px;
  }

  .translation-head {
    padding: 6px 9px;
  }

  .chat-footer {
    gap: 7px;
    padding: 9px 10px calc(9px + env(safe-area-inset-bottom));
  }

  .record-btn {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }

  .input-wrapper {
    padding: 6px 9px 6px 12px;
    border-radius: 14px;
  }

  .input-wrapper textarea {
    font-size: 13.5px;
  }

  .send-btn {
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 13px;
  }

  .send-btn > span[data-i18n="send"] {
    display: none;
  }

  .new-messages {
    right: 12px;
    bottom: 72px;
  }

  .asr-status {
    bottom: 68px;
    max-width: calc(100% - 24px);
    white-space: normal;
    text-align: center;
  }

  .typing-indicator {
    padding-left: 12px;
    padding-right: 12px;
  }

  .toast-host {
    right: 12px;
    bottom: 12px;
    left: 12px;
    align-items: stretch;
    max-width: none;
  }

  .toast {
    width: 100%;
  }

  .empty-chat {
    padding: 20px 10px;
  }

  .empty-chat-icon {
    width: 54px;
    height: 54px;
    font-size: 24px;
    border-radius: 18px;
  }
}

@media (max-width: 400px) {
  .brand-text strong {
    font-size: 14px;
  }

  .lang-picker select {
    font-size: 12px;
  }

  .online-badge {
    display: none;
  }

  .room-code-line > span[data-i18n="roomCode"] {
    display: none;
  }
}
.avatar {
  position: relative;
  overflow: hidden;   /* 关键：圆角裁剪图片 */
  /* 原有的宽高、flex 居中、背景色等保持不变 */
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}