/* Linxi Chat - design system */
:root {
  --bg-0: #06070a;
  --bg-1: #0a0c12;
  --glass: rgba(255, 255, 255, 0.045);
  --glass-hi: rgba(255, 255, 255, 0.075);
  --panel: rgba(13, 16, 22, 0.72);
  --stroke: rgba(255, 255, 255, 0.085);
  --stroke-weak: rgba(255, 255, 255, 0.048);
  --ink: #edeff3;
  --ink-2: #a9b0bc;
  --ink-3: #6e7683;
  --accent: #6fe3c4;
  --accent-2: #4fcdae;
  --accent-dim: rgba(111, 227, 196, 0.12);
  --accent-line: rgba(111, 227, 196, 0.26);
  --warm: #e7c89a;
  --danger: #f08a8a;
  --radius: 22px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
  --ease: cubic-bezier(0.22, 0.82, 0.22, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg-0);
  color: var(--ink);
  font-family: "Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(900px 600px at 8% -6%, rgba(111, 227, 196, 0.11), transparent 62%),
    radial-gradient(760px 520px at 96% 6%, rgba(90, 120, 200, 0.10), transparent 60%),
    radial-gradient(1000px 700px at 60% 108%, rgba(231, 200, 154, 0.07), transparent 62%),
    linear-gradient(180deg, #07080c 0%, #090b10 46%, #06070a 100%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.30'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

::selection { background: rgba(111, 227, 196, 0.26); color: #fff; }

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }

/* ------------------------------------------------------------ primitives */
.glass {
  background: linear-gradient(158deg, rgba(255, 255, 255, 0.062), rgba(255, 255, 255, 0.022));
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.055);
  -webkit-backdrop-filter: blur(26px) saturate(135%);
  backdrop-filter: blur(26px) saturate(135%);
}

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

.field label {
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.input {
  height: 50px;
  width: 100%;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.035);
  color: var(--ink);
  font-size: 15px;
  letter-spacing: 0.01em;
  transition: border-color 0.22s var(--ease), background 0.22s var(--ease), box-shadow 0.22s var(--ease);
  outline: none;
}

.input::placeholder { color: #5c6470; }

.input:focus {
  border-color: var(--accent-line);
  background: rgba(255, 255, 255, 0.055);
  box-shadow: 0 0 0 3px rgba(111, 227, 196, 0.09);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 50px;
  padding: 0 22px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 520;
  letter-spacing: 0.01em;
  transition: transform 0.18s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.btn:hover { background: rgba(255, 255, 255, 0.085); border-color: rgba(255, 255, 255, 0.14); }
.btn:active { transform: translateY(1px) scale(0.995); }

.btn-primary {
  background: linear-gradient(135deg, #8bf0d5, #56d3b6);
  border: 1px solid rgba(255, 255, 255, 0.24);
  color: #06231d;
  font-weight: 640;
  box-shadow: 0 14px 34px rgba(78, 205, 175, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #9bf6dd, #61dcbf);
  box-shadow: 0 18px 44px rgba(78, 205, 175, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.btn-ghost {
  height: 40px;
  padding: 0 14px;
  border-radius: 11px;
  border: 1px solid var(--stroke-weak);
  background: rgba(255, 255, 255, 0.028);
  color: var(--ink-2);
  font-size: 13px;
  transition: all 0.2s var(--ease);
}

.btn-ghost:hover { color: var(--ink); border-color: rgba(255, 255, 255, 0.14); background: rgba(255, 255, 255, 0.06); }

.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-grid;
  place-items: center;
  color: var(--ink-2);
  border: 1px solid transparent;
  transition: all 0.2s var(--ease);
}

.icon-btn:hover { color: var(--ink); background: rgba(255, 255, 255, 0.06); border-color: var(--stroke-weak); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 26px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--stroke-weak);
  background: rgba(255, 255, 255, 0.04);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px rgba(111, 227, 196, 0.7); }

/* ------------------------------------------------------------ brand */
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, rgba(111, 227, 196, 0.2), rgba(111, 227, 196, 0.04));
  border: 1px solid var(--accent-line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 8px 24px rgba(70, 200, 170, 0.16);
  flex: 0 0 auto;
}

.mark svg { width: 18px; height: 18px; display: block; }

.wordmark { display: flex; flex-direction: column; line-height: 1.15; }
.wordmark b { font-size: 14.5px; letter-spacing: 0.02em; font-weight: 620; }
.wordmark span { font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-3); }

/* ------------------------------------------------------------ landing */
.landing {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(22px, 4vh, 38px);
  padding: clamp(28px, 6vh, 60px) 22px;
  position: relative;
  overflow: hidden;
}

.landing-orb {
  position: absolute;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  pointer-events: none;
}
.landing-orb.a { background: radial-gradient(circle, rgba(111, 227, 196, 0.24), transparent 68%); top: -180px; left: -120px; }
.landing-orb.b { background: radial-gradient(circle, rgba(231, 200, 154, 0.16), transparent 70%); bottom: -220px; right: -140px; }

.landing-inner {
  width: min(1120px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 452px;
  gap: clamp(38px, 6vw, 88px);
  align-items: center;
  position: relative;
  z-index: 2;
  animation: rise 0.7s var(--ease) both;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 560px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #7c848f;
}
.eyebrow .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(111, 227, 196, 0.8);
}

.hero-logo {
  width: 72px;
  height: 72px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, rgba(111, 227, 196, 0.22), rgba(255, 255, 255, 0.03) 60%);
  border: 1px solid var(--accent-line);
  box-shadow: 0 26px 60px rgba(60, 190, 160, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  flex: 0 0 auto;
}

.hero-logo svg { width: 34px; height: 34px; }

.hero-title {
  margin: 0;
  font-size: clamp(30px, 3.5vw, 46px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.2;
}

.hero-title em {
  font-style: normal;
  background: linear-gradient(96deg, #f4f7f6, #a9efe0 55%, #e7c89a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-lead {
  margin: 0;
  max-width: 46ch;
  font-size: 14px;
  line-height: 1.9;
  letter-spacing: 0.01em;
  color: var(--ink-2);
}

.hero-points {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.hero-points li { display: flex; align-items: center; gap: 13px; }

.pt-ico {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--stroke-weak);
  flex: 0 0 auto;
}

.hero-points b { display: block; font-size: 13.5px; font-weight: 560; letter-spacing: 0.01em; }
.hero-points span { display: block; margin-top: 2px; font-size: 12px; color: var(--ink-3); letter-spacing: 0.01em; }

.hero-panel { display: flex; flex-direction: column; gap: 18px; }

.panel-head { display: flex; align-items: center; gap: 12px; }
.panel-head .hero-logo {
  width: 46px;
  height: 46px;
  border-radius: 15px;
  box-shadow: 0 14px 34px rgba(60, 190, 160, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.panel-head .hero-logo svg { width: 22px; height: 22px; }

.panel-brand b { display: block; font-size: 14.5px; font-weight: 600; letter-spacing: 0.01em; }
.panel-brand span {
  display: block;
  margin-top: 2px;
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.join-card {
  width: 100%;
  border-radius: var(--radius);
  padding: 26px 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: relative;
  overflow: hidden;
}

.join-card::before {
  content: "";
  position: absolute;
  top: 0; left: 12%; right: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent);
}

.room-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--stroke-weak);
  background: rgba(255, 255, 255, 0.03);
}

.room-badge .sq {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 620;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid var(--accent-line);
  flex: 0 0 auto;
}

.room-badge .meta { min-width: 0; }
.room-badge .meta b { display: block; font-size: 14.5px; font-weight: 600; letter-spacing: 0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-badge .meta span { font-size: 11.5px; color: var(--ink-3); letter-spacing: 0.08em; }

.join-form { display: flex; flex-direction: column; gap: 16px; }
.join-form .btn-primary { width: 100%; margin-top: 2px; }

.form-error {
  display: none;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: #ffb1b1;
  background: rgba(240, 138, 138, 0.1);
  border: 1px solid rgba(240, 138, 138, 0.24);
  border-radius: 11px;
  padding: 9px 12px;
}
.form-error.show { display: flex; }

.landing-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  color: #5a616d;
  letter-spacing: 0.06em;
}
.landing-foot .sep { width: 3px; height: 3px; border-radius: 50%; background: #3c424c; }

/* ------------------------------------------------------------ app shell */
.app {
  height: 100dvh;
  display: grid;
  grid-template-columns: 318px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  overflow: hidden;
  animation: fade 0.5s var(--ease) both;
}

.rail {
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.main {
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.rail-head {
  padding: 20px 20px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.rail-block {
  padding: 4px 16px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
}

.room-panel {
  border-radius: 16px;
  border: 1px solid var(--stroke-weak);
  background: rgba(255, 255, 255, 0.032);
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.room-avatar {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: #07231d;
  background: linear-gradient(140deg, #8bf0d5, #59d2b6);
  box-shadow: 0 10px 26px rgba(80, 205, 175, 0.22);
  flex: 0 0 auto;
}

.room-title { min-width: 0; }
.room-title b { display: block; font-size: 15px; font-weight: 620; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-title span { display: block; margin-top: 3px; font-size: 11.5px; color: var(--ink-3); letter-spacing: 0.03em; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 6px 8px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.section-head i { font-style: normal; color: #8f97a4; letter-spacing: 0.05em; }

.member-list {
  flex: 1;
  min-height: 90px;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 0 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.member {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 9px;
  border-radius: 11px;
  transition: background 0.2s var(--ease);
}
.member:hover { background: rgba(255, 255, 255, 0.04); }

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 12.5px;
  font-weight: 600;
  color: #0a1512;
  flex: 0 0 auto;
  position: relative;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.avatar .presence {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #0b0e14;
  box-shadow: 0 0 8px rgba(111, 227, 196, 0.6);
}
.avatar.off .presence { background: #4a515c; box-shadow: none; }

.member .m-meta { min-width: 0; flex: 1; }
.member .m-meta b { display: block; font-size: 13.5px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member .m-meta span { font-size: 10.5px; letter-spacing: 0.06em; color: var(--ink-3); text-transform: uppercase; }

.rail-actions {
  padding: 14px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  border-top: 1px solid var(--stroke-weak);
}

.rail-actions .btn-ghost { width: 100%; justify-content: flex-start; gap: 10px; }

.rail-note {
  font-size: 10.5px;
  color: #555c68;
  letter-spacing: 0.05em;
  text-align: center;
  padding-bottom: 4px;
}

/* ------------------------------------------------------------ topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 22px;
  min-height: 72px;
  border-bottom: 1px solid var(--stroke-weak);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.012));
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

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

.mobile-menu { display: none; }

.top-title { min-width: 0; }
.top-title b { display: block; font-size: 15.5px; font-weight: 620; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-title span { display: flex; align-items: center; gap: 6px; margin-top: 3px; font-size: 11.5px; color: var(--ink-3); letter-spacing: 0.03em; }

.conn-state { display: inline-flex; align-items: center; gap: 6px; }
.conn-state .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.conn-state.off .dot { background: var(--danger); }
.conn-state .txt { color: var(--ink-3); }

/* ------------------------------------------------------------ thread */
.thread {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 22px clamp(18px, 4vw, 34px) 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scroll-behavior: smooth;
}

.load-more {
  align-self: center;
  margin-bottom: 12px;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--stroke-weak);
  background: rgba(255, 255, 255, 0.03);
  transition: all 0.2s var(--ease);
}
.load-more:hover { color: var(--ink-2); border-color: var(--stroke); }

.welcome {
  align-self: center;
  text-align: center;
  max-width: 420px;
  margin: 34px 0 20px;
  color: var(--ink-3);
  font-size: 12.5px;
  line-height: 1.8;
  letter-spacing: 0.02em;
}
.welcome .wl { font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: #5d646f; }
.welcome .wbig { display: block; margin: 8px 0 6px; font-size: 18px; letter-spacing: -0.01em; color: var(--ink-2); }

.day {
  align-self: center;
  margin: 22px 0 12px;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #5f6672;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--stroke-weak);
}

.msg {
  display: flex;
  gap: 11px;
  max-width: min(760px, 82%);
  margin-top: 10px;
  animation: rise 0.32s var(--ease) both;
}

.msg.cont { margin-top: 4px; }
.msg.cont .avatar, .msg.cont .who { display: none; }
.msg.cont { padding-left: 43px; }

.msg.own { flex-direction: row-reverse; align-self: flex-end; padding-left: 0; }
.msg.own.cont { padding-left: 0; padding-right: 43px; }

.msg .bubble-wrap { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.msg.own .bubble-wrap { align-items: flex-end; }

.who {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding-bottom: 1px;
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}
.who b { font-size: 12px; font-weight: 560; color: #b6bcc7; letter-spacing: 0.02em; }
.who .role-host { color: var(--warm); }

.bubble {
  position: relative;
  padding: 10px 14px;
  border-radius: 15px;
  border: 1px solid var(--stroke-weak);
  background: rgba(255, 255, 255, 0.048);
  font-size: 14.5px;
  line-height: 1.62;
  letter-spacing: 0.005em;
  color: #e4e7ec;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.16);
  transition: border-color 0.2s var(--ease);
}

.bubble:hover { border-color: rgba(255, 255, 255, 0.13); }

.msg.own .bubble {
  background: linear-gradient(142deg, rgba(111, 227, 196, 0.19), rgba(111, 227, 196, 0.075));
  border-color: rgba(111, 227, 196, 0.24);
  color: #eafff9;
  box-shadow: 0 8px 26px rgba(50, 170, 145, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.msg.own .bubble::after { border-color: rgba(111, 227, 196, 0.24); }

.bubble.media { padding: 5px; background: rgba(255, 255, 255, 0.04); border-radius: 16px; overflow: hidden; }
.msg.own .bubble.media { background: rgba(111, 227, 196, 0.09); }

.bubble img {
  display: block;
  max-width: 100%;
  max-height: 380px;
  border-radius: 12px;
  cursor: zoom-in;
  object-fit: cover;
}

.file-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px 4px 4px;
  min-width: 220px;
}
.file-ico {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--stroke-weak);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  flex: 0 0 auto;
}
.file-meta { min-width: 0; }
.file-meta b { display: block; font-size: 13px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.file-meta span { font-size: 10.5px; color: var(--ink-3); letter-spacing: 0.05em; }

.msg-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px;
  font-size: 10.5px;
  color: #626a76;
  letter-spacing: 0.04em;
  opacity: 0.9;
}
.msg.own .msg-foot { justify-content: flex-end; }

.msg-foot .recall {
  opacity: 0;
  font-size: 10.5px;
  color: #767e8a;
  padding: 1px 4px;
  border-radius: 5px;
  transition: all 0.18s var(--ease);
}
.msg:hover .msg-foot .recall { opacity: 1; }
.msg-foot .recall:hover { color: var(--danger); background: rgba(240, 138, 138, 0.1); }

.tomb {
  font-size: 12px;
  color: #676e7a;
  font-style: italic;
  padding: 6px 12px;
  border-radius: 12px;
  border: 1px dashed var(--stroke-weak);
  background: transparent;
}

.msg.system {
  align-self: center;
  max-width: 80%;
  margin: 14px 0;
  padding: 0;
}
.msg.system .sys-line {
  font-size: 11px;
  letter-spacing: 0.06em;
  color: #5f6672;
}

/* ------------------------------------------------------------ typing */
.typing-line {
  height: 26px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 clamp(18px, 4vw, 34px) 2px;
  font-size: 11.5px;
  color: #6f7784;
  opacity: 0;
  transition: opacity 0.25s var(--ease);
  letter-spacing: 0.02em;
}
.typing-line.show { opacity: 1; }
.typing-dots { display: inline-flex; gap: 3px; }
.typing-dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--accent); animation: blink 1.2s infinite; }
.typing-dots i:nth-child(2) { animation-delay: 0.18s; }
.typing-dots i:nth-child(3) { animation-delay: 0.36s; }

/* ------------------------------------------------------------ composer */
.composer-shell {
  padding: 6px clamp(16px, 3.4vw, 30px) 18px;
  position: relative;
}

.composer {
  border-radius: 18px;
  padding: 9px 9px 9px 12px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.composer:focus-within {
  border-color: var(--accent-line);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45), 0 0 0 3px rgba(111, 227, 196, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.composer textarea {
  flex: 1;
  min-height: 34px;
  max-height: 148px;
  padding: 8px 4px 6px;
  border: 0;
  outline: none;
  background: transparent;
  resize: none;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink);
  overflow-y: auto;
}

.composer textarea::placeholder { color: #616975; letter-spacing: 0.02em; }

.send-btn {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, #8bf0d5, #54d0b2);
  color: #06231d;
  box-shadow: 0 10px 26px rgba(78, 205, 175, 0.3);
  transition: transform 0.18s var(--ease), box-shadow 0.2s var(--ease), opacity 0.2s;
  flex: 0 0 auto;
}
.send-btn svg { width: 18px; height: 18px; }
.send-btn:hover { transform: translateY(-1px); box-shadow: 0 14px 32px rgba(78, 205, 175, 0.38); }
.send-btn:active { transform: scale(0.97); }
.send-btn[data-empty="1"] { opacity: 0.42; box-shadow: none; }

.composer-tools { display: flex; align-items: center; gap: 2px; }

.attach-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 4px 8px;
}
.attach-preview[hidden] { display: none; }

.attach-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px 7px 8px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.05);
  font-size: 12px;
  max-width: 260px;
}
.attach-chip .thumb { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; background: rgba(255,255,255,.08); }
.attach-chip .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.attach-chip .rm { color: #7d8591; width: 18px; height: 18px; border-radius: 6px; display: grid; place-items: center; }
.attach-chip .rm:hover { color: var(--danger); background: rgba(240, 138, 138, 0.12); }

.emoji-pop {
  position: absolute;
  bottom: 84px;
  right: clamp(16px, 3.4vw, 30px);
  width: 268px;
  padding: 10px;
  border-radius: 16px;
  display: none;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  z-index: 20;
  animation: rise 0.2s var(--ease) both;
}
.emoji-pop.open { display: grid; }
.emoji-pop button {
  height: 32px;
  border-radius: 8px;
  font-size: 17px;
  line-height: 1;
  transition: background 0.15s;
}
.emoji-pop button:hover { background: rgba(255, 255, 255, 0.08); }

.jump {
  position: absolute;
  left: 50%;
  bottom: 96px;
  transform: translate(-50%, 8px);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(20, 24, 31, 0.9);
  border: 1px solid var(--stroke);
  color: var(--ink-2);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s var(--ease);
  z-index: 10;
}
.jump.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }

/* ------------------------------------------------------------ search */
.search-panel {
  display: none;
  align-items: center;
  gap: 10px;
  margin: 10px clamp(18px, 4vw, 34px) 0;
  padding: 9px 14px;
  border-radius: 13px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.045);
}
.search-panel.open { display: flex; }
.search-panel input {
  flex: 1;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 14px;
}
.search-panel .hits { font-size: 11px; color: var(--ink-3); letter-spacing: 0.06em; }

/* ------------------------------------------------------------ toast & lightbox */
.toast-wrap {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 60;
  pointer-events: none;
}

.toast {
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(18, 22, 29, 0.92);
  color: var(--ink-2);
  font-size: 12.5px;
  letter-spacing: 0.02em;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  animation: toastIn 0.28s var(--ease) both;
}
.toast.err { color: #ffc0c0; border-color: rgba(240, 138, 138, 0.3); }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  place-items: center;
  padding: 5vh 5vw;
  background: rgba(4, 5, 8, 0.86);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.lightbox.open { display: grid; }
.lightbox img { max-width: 100%; max-height: 90vh; border-radius: 14px; box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6); }

/* ------------------------------------------------------------ admin */
.admin-page {
  min-height: 100dvh;
  padding: 28px clamp(16px, 4vw, 48px) 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

.admin-head { width: min(980px, 100%); display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 6px 2px; }

.admin-card {
  width: min(980px, 100%);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.admin-card h2 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.admin-card p.hint { margin: 0; font-size: 12px; color: var(--ink-3); letter-spacing: 0.02em; }

.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.admin-grid .wide { grid-column: 1 / -1; }

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

.room-row {
  display: grid;
  grid-template-columns: 1.5fr 0.8fr 0.8fr 0.6fr auto;
  gap: 12px;
  align-items: center;
  padding: 13px 14px;
  border-radius: 13px;
  border: 1px solid var(--stroke-weak);
  background: rgba(255, 255, 255, 0.028);
  transition: all 0.2s var(--ease);
}
.room-row:hover { border-color: var(--stroke); background: rgba(255, 255, 255, 0.045); }

.room-row .rn { min-width: 0; }
.room-row .rn b { display: block; font-size: 14px; font-weight: 570; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-row .rn span { font-size: 10.5px; color: var(--ink-3); letter-spacing: 0.06em; }
.room-row .rc {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
  letter-spacing: 0.14em;
  color: var(--warm);
}
.room-row .rmeta { font-size: 11.5px; color: var(--ink-3); letter-spacing: 0.04em; }
.room-row .rstate { font-size: 11px; letter-spacing: 0.06em; color: #7dd6bd; }
.room-row .rstate.off { color: #6b7280; }
.room-row .ractions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

.admin-empty { padding: 26px 8px; text-align: center; color: var(--ink-3); font-size: 12.5px; }

.login-card { width: min(400px, 100%); border-radius: var(--radius); padding: 28px 24px; display: flex; flex-direction: column; gap: 16px; margin-top: 12vh; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 900px) {
  .landing { gap: 22px; padding: 26px 18px 34px; }
  .landing-inner { grid-template-columns: 1fr; width: min(452px, 100%); gap: 22px; }
  .hero-copy { gap: 12px; max-width: none; align-items: flex-start; }
  .hero-title { font-size: clamp(25px, 7vw, 33px); line-height: 1.25; }
  .hero-lead { font-size: 13px; line-height: 1.8; }
  .hero-points { display: none; }
  .join-card { padding: 22px 18px 18px; gap: 15px; }
  .app { grid-template-columns: 1fr; padding: 8px; gap: 8px; }
  .rail {
    position: fixed;
    z-index: 40;
    left: 8px;
    top: 8px;
    bottom: 8px;
    width: min(320px, 84vw);
    transform: translateX(calc(-100% - 16px));
    transition: transform 0.32s var(--ease);
  }
  .rail.open { transform: translateX(0); }
  .rail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 5, 8, 0.6);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    z-index: 30;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s var(--ease);
  }
  .rail-overlay.show { opacity: 1; pointer-events: auto; }
  .mobile-menu { display: inline-grid; }
  .thread { padding: 16px 14px 10px; }
  .composer-shell { padding: 4px 10px calc(12px + env(safe-area-inset-bottom)); }
  .msg { max-width: 88%; }
  .admin-grid { grid-template-columns: 1fr; }
  .room-row { grid-template-columns: 1fr auto; }
  .room-row .rmeta, .room-row .rstate { display: none; }
}

@media (max-width: 560px) {
  .hero-lead { display: none; }
  .hero-title { font-size: clamp(23px, 7.4vw, 29px); }
  .landing { justify-content: flex-start; padding-top: 46px; }
}

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

/* ------------------------------------------------------------ keyframes */
@keyframes rise { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes blink { 0%, 60%, 100% { opacity: 0.25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }

/* scrollbar */
.thread::-webkit-scrollbar, .member-list::-webkit-scrollbar { width: 8px; }
.thread::-webkit-scrollbar-thumb, .member-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 99px;
}
.thread::-webkit-scrollbar-thumb:hover, .member-list::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.18); }
.thread::-webkit-scrollbar-track, .member-list::-webkit-scrollbar-track { background: transparent; }
