:root {
  --bg: #070d18;
  --bg-2: #0b1526;
  --panel: rgba(14, 26, 46, 0.78);
  --panel-2: rgba(19, 35, 61, 0.72);
  --line: rgba(125, 170, 255, 0.16);
  --line-strong: rgba(125, 170, 255, 0.3);
  --text: #eef4ff;
  --muted: #93a6c6;
  --muted-2: #667a9c;
  --accent: #5b9dff;
  --accent-2: #7de2ff;
  --accent-soft: rgba(91, 157, 255, 0.14);
  --danger: #ff7a90;
  --success: #5ee2b0;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  --radius: 22px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--text);
  font-family: var(--font);
  background:
    radial-gradient(900px 600px at 12% -10%, rgba(58, 119, 255, 0.3), transparent 60%),
    radial-gradient(800px 500px at 95% 0%, rgba(64, 220, 255, 0.14), transparent 55%),
    linear-gradient(160deg, var(--bg) 0%, var(--bg-2) 48%, #060a12 100%);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(125, 170, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(125, 170, 255, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.9), transparent 85%);
}

.hidden { display: none !important; }
button, input { font: inherit; }
button { cursor: pointer; }

.landing {
  position: relative;
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 64px 0 48px;
}

.hero { max-width: 820px; }
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  letter-spacing: 0.22em;
  font-weight: 700;
  color: #cfe0ff;
}
.wordmark .mark {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  box-shadow: 0 0 18px rgba(91, 157, 255, 0.9);
}
.wordmark .slash { color: var(--accent); }
.wordmark.small { font-size: 11px; }

.hero h1 {
  margin: 28px 0 18px;
  font-size: clamp(38px, 6.2vw, 72px);
  line-height: 1.02;
  letter-spacing: -0.045em;
  font-weight: 650;
  background: linear-gradient(180deg, #ffffff 20%, #a9c6f7 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lede {
  margin: 0;
  max-width: 620px;
  color: var(--muted);
  font-size: clamp(15px, 1.6vw, 18px);
  line-height: 1.7;
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}
.pills span {
  border: 1px solid var(--line);
  background: rgba(12, 24, 44, 0.6);
  color: #b9cdf0;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  letter-spacing: 0.02em;
}

.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 48px;
}
.cards.guest {
  grid-template-columns: minmax(0, 560px);
  justify-content: center;
}

.card {
  position: relative;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(18, 33, 57, 0.82), rgba(10, 20, 37, 0.78));
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(125, 190, 255, 0.55), transparent);
}
.card-kicker {
  font-size: 10px;
  letter-spacing: 0.24em;
  color: var(--accent-2);
  margin-bottom: 10px;
}
.card h2 {
  margin: 0 0 8px;
  font-size: 24px;
  letter-spacing: -0.02em;
}
.card-note {
  margin: 0 0 20px;
  color: var(--muted);
  line-height: 1.6;
  font-size: 13px;
}

.field { display: block; margin-bottom: 14px; }
.field span {
  display: block;
  margin-bottom: 7px;
  color: #b8c9e8;
  font-size: 12px;
  letter-spacing: 0.04em;
}
.field input {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(6, 14, 27, 0.8);
  color: var(--text);
  border-radius: 13px;
  padding: 13px 14px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.field input::placeholder { color: var(--muted-2); }
.field input:focus {
  border-color: rgba(105, 178, 255, 0.65);
  box-shadow: 0 0 0 4px rgba(91, 157, 255, 0.12);
  background: rgba(8, 18, 34, 0.95);
}

.primary {
  border: 0;
  border-radius: 13px;
  padding: 13px 18px;
  color: #041022;
  font-weight: 700;
  letter-spacing: 0.01em;
  background: linear-gradient(135deg, #8edaff, #5b9dff 55%, #7c7dff);
  box-shadow: 0 12px 30px rgba(63, 135, 255, 0.28);
  transition: transform 140ms ease, filter 140ms ease, opacity 140ms ease;
}
.primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.primary:active { transform: translateY(0); }
.primary:disabled { opacity: 0.5; cursor: wait; transform: none; }
.primary.wide { width: 100%; margin-top: 6px; }
.primary.small { padding: 9px 14px; font-size: 12px; border-radius: 10px; }

.hint {
  min-height: 18px;
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 12px;
  line-height: 1.5;
}

.landing-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-top: 26px;
  color: var(--muted-2);
  font-size: 12px;
}

/* Room */
.room {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  width: min(1080px, calc(100% - 28px));
  margin: 0 auto;
  padding: 16px 0 14px;
}
.room-header {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(10, 20, 36, 0.76);
  backdrop-filter: blur(16px);
}
.room-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.room-code {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.room-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  margin-left: auto;
  white-space: nowrap;
}
.sep { width: 1px; height: 14px; background: var(--line-strong); margin: 0 4px; }
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #475a7a;
  box-shadow: 0 0 0 3px rgba(71, 90, 122, 0.14);
}
.dot.connecting { background: #ffcf6e; animation: pulse 1.2s infinite; }
.dot.online { background: var(--success); box-shadow: 0 0 0 3px rgba(94, 226, 176, 0.14), 0 0 14px rgba(94, 226, 176, 0.55); }
.dot.offline { background: #ff9a6e; }
.dot.wrong { background: var(--danger); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

.room-actions { display: flex; gap: 8px; }
.ghost {
  border: 1px solid var(--line);
  background: rgba(9, 18, 33, 0.6);
  color: #c0d2f2;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 12px;
  transition: border-color 140ms ease, background 140ms ease;
}
.ghost:hover { border-color: var(--line-strong); background: rgba(16, 31, 55, 0.8); }
.ghost.danger { color: #ffb3c0; }

.share {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 10px;
  padding: 12px 16px;
  border: 1px solid rgba(125, 190, 255, 0.24);
  border-radius: 14px;
  background: linear-gradient(90deg, rgba(28, 63, 120, 0.42), rgba(15, 32, 58, 0.42));
}
.share-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.share-copy strong { font-size: 13px; }
.share-copy span { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.share button { margin-left: auto; flex: 0 0 auto; }

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 22px 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}
.messages::before {
  content: "";
  flex: 1 0 auto;
}
.messages::-webkit-scrollbar { width: 8px; }
.messages::-webkit-scrollbar-thumb { background: rgba(120, 160, 230, 0.2); border-radius: 8px; }

.empty {
  margin: auto;
  max-width: 440px;
  text-align: center;
  color: var(--muted);
  line-height: 1.7;
  font-size: 13px;
  padding: 30px 20px;
}
.empty-icon {
  font-size: 26px;
  color: var(--accent-2);
  margin-bottom: 12px;
  text-shadow: 0 0 24px rgba(125, 226, 255, 0.6);
}
.empty-title { color: var(--text); font-size: 18px; font-weight: 650; margin-bottom: 8px; }
.empty-note { color: var(--muted-2); font-size: 12px; margin-top: 10px; }

.msg { display: flex; flex-direction: column; max-width: min(76%, 680px); animation: rise 180ms ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg.theirs { align-self: flex-start; align-items: flex-start; }
.msg-meta {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin: 0 4px 5px;
  color: var(--muted-2);
  font-size: 11px;
}
.msg-meta .who { color: #a9c4ee; font-weight: 600; }
.bubble {
  border: 1px solid var(--line);
  background: rgba(17, 31, 54, 0.78);
  border-radius: 16px 16px 16px 6px;
  padding: 11px 14px;
  line-height: 1.6;
  font-size: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.msg.mine .bubble {
  background: linear-gradient(135deg, rgba(58, 116, 231, 0.92), rgba(76, 84, 210, 0.86));
  border-color: rgba(140, 190, 255, 0.32);
  border-radius: 16px 16px 6px 16px;
  color: #f6f9ff;
}

.file-card {
  min-width: 240px;
  max-width: 360px;
  border: 1px solid var(--line);
  background: rgba(13, 26, 47, 0.86);
  border-radius: 14px;
  padding: 12px;
  font-size: 13px;
}
.msg.mine .file-card { background: rgba(27, 54, 105, 0.72); border-color: rgba(140, 190, 255, 0.25); }
.file-top { display: flex; align-items: center; gap: 10px; }
.file-icon {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-2);
  font-size: 16px;
  flex: 0 0 auto;
}
.file-name { font-weight: 600; overflow-wrap: anywhere; }
.file-size { color: var(--muted); font-size: 11px; margin-top: 2px; }
.file-progress { margin-top: 10px; color: var(--muted); font-size: 11px; }
.file-bar { height: 4px; border-radius: 4px; background: rgba(120, 160, 230, 0.16); margin-top: 6px; overflow: hidden; }
.file-bar > i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 120ms linear; }
.file-download {
  display: inline-block;
  margin-top: 10px;
  color: var(--accent-2);
  text-decoration: none;
  font-weight: 600;
  font-size: 12px;
}
.file-download:hover { text-decoration: underline; }

.composer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(9, 19, 34, 0.86);
  backdrop-filter: blur(16px);
}
.icon-btn {
  width: 42px; height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(16, 30, 52, 0.8);
  color: #cfe0ff;
  font-size: 17px;
  flex: 0 0 auto;
}
.icon-btn:hover { border-color: var(--line-strong); }
.message-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  padding: 10px 6px;
  font-size: 14px;
}
.message-input::placeholder { color: var(--muted-2); }
.send { flex: 0 0 auto; padding: 11px 18px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 12px);
  max-width: min(560px, calc(100% - 32px));
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(12, 24, 44, 0.96);
  color: #dbe9ff;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 20;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 820px) {
  .landing { width: min(100% - 28px, 620px); padding-top: 40px; }
  .cards { grid-template-columns: 1fr; margin-top: 32px; }
  .room { width: calc(100% - 16px); padding-top: 8px; }
  .room-header { flex-wrap: wrap; gap: 10px; padding: 10px 12px; }
  .room-status { order: 3; width: 100%; margin-left: 0; }
  .room-actions { margin-left: auto; }
  .room-actions .ghost { padding: 8px 9px; font-size: 11px; }
  .msg { max-width: 88%; }
  .share { flex-wrap: wrap; }
  .share button { margin-left: 0; }
}
