:root {
  --bg-color: #0f0f13;
  --card-bg: rgba(25, 25, 35, 0.75);
  --card-border: rgba(255, 255, 255, 0.08);
  --text-color: #f3f4f6;
  --text-muted: #9ca3af;
  --primary-color: #6366f1;
  --primary-hover: #4f46e5;
  --secondary-color: #a855f7;
  --success-color: #10b981;
  --error-color: #ef4444;
}

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

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  background: radial-gradient(circle at 50% 50%, #1a183a 0%, var(--bg-color) 100%);
  color: var(--text-color);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start; /* 靠顶端放置，避开手机键盘 */
  padding: 10px;
  overflow-x: hidden;
}

/* 高扁平化卡片，节省高度 */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 16px;
  width: 100%;
  max-width: 460px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
  margin-top: 10px;
}

/* 顶部紧凑控制栏 */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

/* 左侧状态与扫描连接 */
.left-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-badge::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
}

.status-badge.disconnected::before { background: var(--error-color); }
.status-badge.connecting::before {
  background: #f59e0b;
  animation: pulse 1s infinite alternate;
}
.status-badge.connected {
  color: var(--success-color);
  background: rgba(16, 185, 129, 0.1);
}
.status-badge.connected::before { background: var(--success-color); }

@keyframes pulse {
  from { opacity: 0.4; }
  to { opacity: 1; }
}

.btn-connect {
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: opacity 0.15s ease;
}

.btn-connect:hover {
  opacity: 0.9;
}

/* 右侧即时输入 Switch 开关 */
.switch-container {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #374151;
  transition: .3s;
  border-radius: 20px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary-color);
}

input:checked + .slider:before {
  transform: translateX(16px);
}

/* 输入区域 */
textarea {
  width: 100%;
  height: 80px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px;
  font-family: inherit;
  font-size: 14px;
  color: white;
  resize: none;
  outline: none;
  transition: all 0.2s ease;
}

textarea:focus {
  border-color: var(--primary-color);
  background: rgba(0, 0, 0, 0.35);
}

/* 经典模式按钮组 */
.button-group {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

.btn {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-send {
  background: var(--primary-color);
  color: white;
}

.btn-send:disabled {
  background: #374151;
  color: #9ca3af;
  cursor: not-allowed;
}

.btn-clear {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* 剪贴板同步按钮组 */
.clipboard-group {
  margin-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 12px;
  display: flex;
  gap: 8px;
}

.btn-pull {
  background: rgba(168, 85, 247, 0.1);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.2);
}

.btn-pull:hover {
  background: rgba(168, 85, 247, 0.2);
  border-color: rgba(168, 85, 247, 0.4);
}

.btn-push {
  background: rgba(99, 102, 241, 0.1);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.btn-push:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.4);
}
