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

:root {
  --bg: #0f1420;
  --card: #1a2130;
  --line: #2a3550;
  --text: #e8edf7;
  --muted: #8b96ad;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --danger: #ef4444;
}

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.hidden { display: none !important; }

/* ---------- 加入界面 ---------- */
.join-wrap {
  min-height: 100%;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}

.join-card {
  width: 100%; max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
}

.logo { font-size: 28px; font-weight: 800; letter-spacing: .5px; }
.logo span { color: var(--primary); font-size: 16px; font-weight: 600; margin-left: 6px; }

.sub { color: var(--muted); font-size: 13px; margin: 8px 0 22px; line-height: 1.6; }

.join-card input {
  width: 100%; padding: 12px 14px; margin-bottom: 12px;
  background: #111827; color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; font-size: 15px;
  outline: none;
}
.join-card input:focus { border-color: var(--primary); }

.primary {
  width: 100%; padding: 13px; margin-top: 4px;
  background: var(--primary); color: #fff; border: none;
  border-radius: 10px; font-size: 16px; font-weight: 600; cursor: pointer;
}
.primary:hover { background: var(--primary-hover); }
.primary:disabled { opacity: .6; cursor: not-allowed; }

.secondary {
  width: 100%; padding: 13px; margin-top: 10px;
  background: transparent; color: var(--primary);
  border: 1px solid var(--primary); border-radius: 10px;
  font-size: 16px; font-weight: 600; cursor: pointer;
}
.secondary:hover { background: rgba(59,130,246,.1); }

.err { color: #f87171; font-size: 13px; min-height: 18px; margin-top: 10px; }
.tip { color: var(--muted); font-size: 12px; margin-top: 14px; line-height: 1.6; }

/* ---------- 会议界面 ---------- */
.meet-wrap { position: relative; height: 100vh; display: flex; flex-direction: column; }

.grid {
  flex: 1; display: flex; flex-wrap: wrap; gap: 10px;
  padding: 12px; align-content: flex-start; overflow-y: auto;
}

.tile {
  position: relative; flex: 1 1 320px; min-width: 240px; height: 300px;
  background: #0b0f1a; border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden;
}

.tile video { width: 100%; height: 100%; object-fit: cover; background: #000; }

.tile.local video { transform: scaleX(-1); }

.tile .name-tag {
  position: absolute; left: 8px; bottom: 8px;
  background: rgba(0,0,0,.55); color: #fff;
  font-size: 12px; padding: 3px 9px; border-radius: 20px;
  max-width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.tile .speaking { position: absolute; right: 8px; top: 8px; font-size: 18px; }

/* 无画面占位 */
.tile .avatar {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 48px; font-weight: 700; color: #fff;
}

/* ---------- 控制栏 ---------- */
.controls {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 10px 14px;
  background: var(--card); border-top: 1px solid var(--line);
}

.room-label { color: var(--muted); font-size: 13px; }

.ctrl-btns { display: flex; gap: 8px; }

.ctrl-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 64px; padding: 8px 10px;
  background: #111827; color: var(--text);
  border: 1px solid var(--line); border-radius: 12px;
  font-size: 18px; cursor: pointer;
}
.ctrl-btn .lbl { font-size: 11px; color: var(--muted); }
.ctrl-btn:hover { border-color: var(--primary); }
.ctrl-btn.on { border-color: var(--primary); background: rgba(59,130,246,.15); }
.ctrl-btn.off { border-color: var(--danger); background: rgba(239,68,68,.15); }
.ctrl-btn.leave { border-color: var(--danger); }
.ctrl-btn.leave:hover { background: var(--danger); color: #fff; }
.ctrl-btn.leave .lbl { color: inherit; }

/* ---------- 聊天 ---------- */
.chat {
  position: absolute; right: 12px; top: 12px; bottom: 84px;
  width: 300px; max-width: 90%;
  display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,.4); z-index: 10;
}

.chat-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid var(--line);
  font-size: 14px; font-weight: 600;
}
.chat-head button { background: none; border: none; color: var(--muted); font-size: 18px; cursor: pointer; }

.chat-msgs { flex: 1; overflow-y: auto; padding: 10px 14px; font-size: 13px; }
.chat-msgs .msg { margin-bottom: 8px; line-height: 1.5; word-break: break-word; }
.chat-msgs .who { color: var(--primary); font-weight: 600; margin-right: 6px; }
.chat-msgs .sys { color: var(--muted); text-align: center; font-size: 12px; }

.chat-input { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); }
.chat-input input {
  flex: 1; padding: 9px 12px; background: #111827; color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; font-size: 13px; outline: none;
}
.chat-input button {
  padding: 9px 16px; background: var(--primary); color: #fff;
  border: none; border-radius: 8px; font-size: 13px; cursor: pointer;
}

/* ---------- 邀请弹窗 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.55); padding: 20px;
}
.modal-box {
  width: 100%; max-width: 400px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 24px;
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 16px; font-weight: 700; margin-bottom: 10px;
}
.modal-head button { background: none; border: none; color: var(--muted); font-size: 20px; cursor: pointer; }
.modal-sub { color: var(--muted); font-size: 13px; margin-bottom: 12px; line-height: 1.6; }
.modal-box input {
  width: 100%; padding: 11px 12px; margin-bottom: 12px;
  background: #111827; color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; font-size: 13px; outline: none;
}

/* ---------- 移动端 ---------- */
@media (max-width: 640px) {
  .tile { flex: 1 1 100%; min-width: 0; height: 42vh; }
  .controls { flex-wrap: wrap; }
  .ctrl-left { width: 100%; order: 3; text-align: center; }
  .ctrl-btns { flex: 1; justify-content: space-around; }
  .ctrl-btn { min-width: 56px; }
  .chat { bottom: 130px; width: 100%; right: 0; top: 0; border-radius: 0; }
}
