* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f4f6fb;
  color: #1a1a2e;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ===== 顶部状态栏 ===== */
.header {
  position: sticky;
  top: 0;
  background: #fff;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  z-index: 10;
  flex-wrap: wrap;
  gap: 8px;
}

.status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #555;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.dot-on  { background: #22c55e; box-shadow: 0 0 6px #22c55e; }
.dot-off { background: #ef4444; }

.mode-switch {
  display: flex;
  gap: 4px;
  background: #eef1f6;
  padding: 3px;
  border-radius: 8px;
}

.mode-btn {
  border: none;
  background: transparent;
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 6px;
  color: #555;
  cursor: pointer;
  transition: all 0.2s;
}
.mode-btn.active {
  background: #fff;
  color: #2563eb;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  font-weight: 600;
}

/* ===== 房间号栏 ===== */
.room-bar {
  background: #fff;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #eef1f6;
  flex-wrap: wrap;
}
.room-label {
  font-size: 13px;
  color: #555;
  font-weight: 600;
}
#roomInput {
  flex: 1;
  min-width: 80px;
  max-width: 140px;
  font-size: 16px;
  padding: 8px 10px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  text-align: center;
  letter-spacing: 2px;
  text-transform: uppercase;
  outline: none;
  font-weight: 700;
  color: #2563eb;
}
#roomInput:focus { border-color: #2563eb; }
.room-btn {
  background: #2563eb;
  color: #fff;
  border: none;
  padding: 8px 14px;
  font-size: 13px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}
.room-btn:active { transform: scale(0.97); }
.share-btn { background: #22c55e; }
.share-btn:active { background: #16a34a; }

/* ===== 通用视图 ===== */
.view {
  padding: 18px 16px 40px;
  max-width: 640px;
  margin: 0 auto;
}
.hidden { display: none !important; }

.title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  color: #1a1a2e;
}

/* ===== 发送端 ===== */
.sender-box {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

#numberInput {
  flex: 1;
  font-size: 24px;
  padding: 14px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  text-align: center;
  outline: none;
  background: #fff;
  transition: border-color 0.2s;
}
#numberInput:focus { border-color: #2563eb; }

.primary-btn {
  background: #2563eb;
  color: #fff;
  border: none;
  padding: 0 24px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  min-height: 56px;
}
.primary-btn:active { transform: scale(0.97); background: #1d4ed8; }

.ghost-btn {
  background: #fff;
  color: #555;
  border: 1px solid #d1d5db;
  padding: 0 18px;
  font-size: 14px;
  border-radius: 10px;
  cursor: pointer;
  min-height: 48px;
}

.last-call {
  background: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  min-height: 60px;
  display: flex;
  align-items: center;
  font-size: 18px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.quick-tip {
  color: #888;
  font-size: 12px;
  margin-bottom: 16px;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 8px;
}

.quick-btn {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 0;
  font-size: 14px;
  cursor: pointer;
  color: #2563eb;
  transition: all 0.15s;
}
.quick-btn:active { background: #2563eb; color: #fff; }

/* ===== 接收端 + 语音播报 ===== */
.alert-options {
  background: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.alert-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
  color: #1a1a2e;
}
.alert-options .switch-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 16px;
  margin-bottom: 8px;
  font-size: 14px;
  cursor: pointer;
  color: #444;
}
.alert-options .switch-label input {
  width: 18px;
  height: 18px;
  accent-color: #2563eb;
}
.rate-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  font-size: 13px;
  color: #555;
}
.rate-row input[type="range"] {
  flex: 1;
  accent-color: #2563eb;
}
.rate-text { min-width: 32px; }

#testAlertBtn { margin-top: 10px; font-size: 13px; padding: 6px 14px; min-height: auto; }

.display-card {
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  color: #fff;
  border-radius: 20px;
  padding: 40px 20px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(37, 99, 235, 0.3);
  margin-bottom: 16px;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.display-number {
  font-size: 80px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 12px;
  letter-spacing: -2px;
}

.display-name {
  font-size: 32px;
  font-weight: 500;
  word-break: break-all;
}

.display-card.flash {
  animation: flash 0.5s ease;
}
@keyframes flash {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.05); box-shadow: 0 10px 40px rgba(37, 99, 235, 0.5); }
  100% { transform: scale(1); }
}

.receiver-controls {
  background: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 14px;
  margin-bottom: 16px;
}

.switch-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.switch-label input {
  width: 18px;
  height: 18px;
  accent-color: #2563eb;
}

#rateRange {
  flex: 1;
  min-width: 100px;
  accent-color: #2563eb;
}

.rate-text {
  color: #666;
  font-size: 13px;
  white-space: nowrap;
}

.history {
  background: #fff;
  border-radius: 12px;
  padding: 12px;
  max-height: 220px;
  overflow-y: auto;
}
.history-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 4px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 14px;
  color: #555;
}
.history-item:last-child { border-bottom: none; }
.history-item .num {
  color: #2563eb;
  font-weight: 600;
  width: 40px;
}
.history-item .name { flex: 1; }
.history-item .time { color: #999; font-size: 12px; }

/* ===== 名单管理 ===== */
.hint {
  font-size: 13px;
  color: #666;
  margin-bottom: 12px;
  line-height: 1.6;
}
.hint code {
  background: #eef1f6;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: "Consolas", monospace;
}

.names-editor {
  width: 100%;
  min-height: 320px;
  padding: 14px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-family: "Consolas", "PingFang SC", monospace;
  font-size: 15px;
  line-height: 1.7;
  resize: vertical;
  outline: none;
  background: #fff;
  transition: border-color 0.2s;
}
.names-editor:focus { border-color: #2563eb; }

.manager-actions {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.save-tip {
  font-size: 13px;
  color: #22c55e;
  font-weight: 500;
}
