* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f0f2f5;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 24px 16px;
}

.container {
  width: 100%;
  max-width: 480px;
}

h1 {
  font-size: 20px;
  font-weight: 600;
  color: #1a1a2e;
  margin-bottom: 20px;
  text-align: center;
}

.version {
  text-align: center;
  color: #8a94a6;
  font-size: 12px;
  margin: -12px 0 16px;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

.card h2 {
  font-size: 14px;
  color: #666;
  font-weight: 500;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* 连接配置 */
.form-row { display: flex; gap: 8px; margin-bottom: 8px; }
.form-row input, .form-row select {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border .2s;
}
.form-row input:focus, .form-row select:focus { border-color: #4f8ef7; }
.form-row label {
  font-size: 13px;
  color: #555;
  white-space: nowrap;
  line-height: 36px;
}

/* 状态指示器 */
.status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #f7f8fa;
  font-size: 13px;
  color: #555;
}
.dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #bbb;
  transition: background .3s;
}
.dot.green  { background: #22c55e; }
.dot.yellow { background: #f59e0b; animation: blink .8s infinite; }
.dot.red    { background: #ef4444; }

@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.3} }

/* 房间列表 */
#roomList {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.room-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border: 1px solid #eee;
  border-radius: 8px;
  cursor: pointer;
  transition: border .2s, background .2s;
}
.room-item:hover { border-color: #4f8ef7; background: #f0f6ff; }
.room-item.active { border-color: #4f8ef7; background: #e8f0fe; }
.room-name { font-size: 14px; font-weight: 500; }
.room-state {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 12px;
  background: #f0f0f0;
  color: #666;
}
.room-state.ringing { background: #fef3c7; color: #d97706; }
.room-state.active  { background: #dcfce7; color: #16a34a; }
.room-state.dialing { background: #ede9fe; color: #7c3aed; }
.no-room { text-align: center; color: #aaa; font-size: 13px; padding: 16px 0; }

/* 通话控制 */
.dial-row { display: flex; gap: 8px; margin-bottom: 12px; }
.dial-row input {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
}
.dial-row input:focus { border-color: #4f8ef7; }

.btn-group { display: flex; gap: 8px; }
.btn {
  flex: 1;
  padding: 10px 0;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity .2s, transform .1s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn-dial   { background: #22c55e; color: #fff; }
.btn-hangup { background: #ef4444; color: #fff; }
.btn-answer { background: #3b82f6; color: #fff; }

/* 音量计 */
.meter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.meter-label { font-size: 12px; color: #888; width: 60px; }
.meter-bar {
  flex: 1; height: 6px;
  background: #eee;
  border-radius: 3px;
  overflow: hidden;
}
.meter-fill {
  height: 100%;
  background: #22c55e;
  width: 0%;
  transition: width .08s linear;
  border-radius: 3px;
}

/* 日志 */
#log {
  height: 140px;
  overflow-y: auto;
  font-size: 12px;
  font-family: "Consolas", monospace;
  color: #444;
  line-height: 1.6;
}
#log .ts { color: #aaa; margin-right: 6px; }
#log .err { color: #ef4444; }
#log .ok  { color: #16a34a; }
