* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #0f1220; color: #e8eaf2; height: 100vh; overflow: hidden;
}
.screen { display: none; height: 100vh; flex-direction: column; }
.screen.active { display: flex; }

/* 加入页 */
.join-card {
  margin: auto; width: min(92vw, 420px); background: #1a1f35; border-radius: 18px;
  padding: 32px 26px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.join-card h1 { font-size: 30px; margin-bottom: 8px; }
.join-card .sub { color: #9aa3c0; font-size: 14px; margin-bottom: 22px; line-height: 1.5; }
.join-card input {
  width: 100%; padding: 14px 16px; margin-bottom: 12px; border-radius: 12px; border: 1px solid #2c3350;
  background: #11162a; color: #fff; font-size: 16px; outline: none;
}
.join-card input:focus { border-color: #5b8cff; }
.primary {
  width: 100%; padding: 14px; border: 0; border-radius: 12px; background: #5b8cff; color: #fff;
  font-size: 17px; font-weight: 600; cursor: pointer; margin-top: 4px;
}
.ghost {
  width: 100%; padding: 12px; margin-top: 10px; border: 1px solid #2c3350; border-radius: 12px;
  background: transparent; color: #9aa3c0; font-size: 15px; cursor: pointer;
}
.ghost.small { width: auto; padding: 6px 14px; }
.ghost.small.danger { border-color: #5a2530; color: #ff8a9b; }
.ghost.small.danger:hover { background: #2a1318; }
.hint { color: #6b739a; font-size: 12px; margin-top: 16px; }

/* PWA 安装引导 */
.install-banner {
  background: linear-gradient(90deg, #14224a, #1a2b5c); border-bottom: 1px solid #2c3350;
  padding: 10px 14px; font-size: 13px; color: #cdd3f0; display: flex; align-items: center;
  gap: 10px; flex-wrap: wrap;
}
.install-banner > span { flex: 1; min-width: 160px; line-height: 1.4; }
.install-banner > div { display: flex; gap: 8px; }
.primary.small, .ghost.small { font-size: 13px; padding: 8px 14px; }
.primary.small { margin-top: 0; width: auto; }

/* 安装为独立 App 后去掉浏览器默认滚动条观感、贴合系统状态栏 */
@media (display-mode: standalone) {
  body { background: #0f1220; }
  .topbar { padding-top: calc(12px + env(safe-area-inset-top)); }
  .controls { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
}

/* 首页 */
.home-body { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 14px; }
.home-card {
  background: #1a1f35; border-radius: 16px; padding: 20px 18px; box-shadow: 0 10px 30px rgba(0,0,0,.3);
}
.home-card h2 { font-size: 19px; margin-bottom: 4px; }
.home-card .sub { color: #9aa3c0; font-size: 13px; margin-bottom: 14px; }
.home-card .sub.tiny { font-size: 11px; margin-top: 8px; margin-bottom: 12px; color: #6b739a; }
.home-card input {
  width: 100%; padding: 13px 15px; margin-bottom: 12px; border-radius: 12px; border: 1px solid #2c3350;
  background: #11162a; color: #fff; font-size: 16px; outline: none;
}
.home-card input:focus { border-color: #5b8cff; }
.my-meetings { margin-bottom: 10px; max-height: 220px; overflow-y: auto; }
.my-meetings .hint { margin-top: 0; }
.mm-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: #11162a; border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; font-size: 14px;
}
.mm-id { color: #5b8cff; font-size: 12px; }

/* 会议室 */
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: #161b30; font-size: 14px;
}
.room-tag { font-weight: 600; }
.conn-state { margin-left: auto; color: #9aa3c0; font-size: 12px; }
.rec-dot { color: #ff5b6e; font-size: 13px; }
.rec-dot em { font-style: normal; font-weight: 700; }
.hidden { display: none; }

.tiles {
  flex: 1; display: grid; gap: 8px; padding: 10px; overflow-y: auto;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-content: start;
}
.tile {
  position: relative; background: #000; border-radius: 12px; overflow: hidden; aspect-ratio: 4/3;
  display: flex; align-items: center; justify-content: center;
}
.tile video { width: 100%; height: 100%; object-fit: cover; }
.tile-ph { font-size: 40px; opacity: .5; }
.tile-label {
  position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,.55); padding: 3px 8px;
  border-radius: 8px; font-size: 12px; max-width: 80%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.controls {
  display: flex; justify-content: space-around; padding: 12px 8px calc(12px + env(safe-area-inset-bottom));
  background: #161b30;
}
.ctrl {
  display: flex; flex-direction: column; align-items: center; gap: 4px; border: 0; background: transparent;
  color: #e8eaf2; font-size: 22px; cursor: pointer;
}
.ctrl span { font-size: 11px; color: #9aa3c0; }
.ctrl.off { color: #ff5b6e; }
.ctrl.off span { color: #ff5b6e; }
.ctrl.on { color: #5bff9b; }
.ctrl.on span { color: #5bff9b; }
.ctrl.rec.on { color: #ff5b6e; }
.ctrl.leave { color: #ff8a5b; }
.tip { text-align: center; font-size: 12px; color: #ffcf5b; padding: 0 12px 8px; min-height: 16px; }

/* 回放 */
.rec-list { flex: 1; overflow-y: auto; padding: 14px; }
.rec-item {
  background: #1a1f35; border-radius: 12px; padding: 14px 16px; margin-bottom: 10px;
  display: flex; align-items: center; gap: 12px;
}
.rec-name { flex: 1; font-size: 14px; word-break: break-all; }
.rec-size { color: #9aa3c0; font-size: 12px; }
.rec-play { background: #5b8cff; color: #fff; padding: 8px 14px; border-radius: 10px; text-decoration: none; font-size: 13px; white-space: nowrap; }

/* 主持人徽章 / 工具条 */
.host-badge { background: #5b8cff; color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 8px; font-weight: 600; }
.host-bar { display: flex; gap: 8px; padding: 8px 16px; background: #161b30; border-bottom: 1px solid #2c3350; }
.host-bar button.on { background: #5b8cff; color: #fff; border-color: #5b8cff; }
.ghost.small.danger { border-color: #5a2530; color: #ff8a9b; }
.ghost.small.danger:hover { background: #2a1318; }

/* 邀请弹窗 */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal.hidden { display: none; }
.modal-card { width: min(92vw, 420px); background: #1a1f35; border-radius: 18px; padding: 26px 22px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.modal-card h2 { font-size: 22px; margin-bottom: 6px; }
.modal-card .sub { color: #9aa3c0; font-size: 14px; margin-bottom: 14px; }
.invite-id { color: #5b8cff; font-size: 18px; letter-spacing: 1px; }
.qr-wrap { background: #fff; border-radius: 12px; padding: 12px; display: inline-block; margin: 4px 0 12px; }
.qr-wrap img { width: 200px; height: 200px; display: block; }
#inviteLink { width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid #2c3350; background: #11162a; color: #cdd3f0; font-size: 13px; margin-bottom: 12px; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions button { flex: 1; }
