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

:root {
  --bg:        #0f1117;
  --surface:   #1a1d27;
  --border:    #2a2d3a;
  --primary:   #6c63ff;
  --primary-h: #857dff;
  --success:   #22c55e;
  --danger:    #ef4444;
  --text:      #e2e8f0;
  --muted:     #64748b;
  --radius:    12px;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ── 顶栏 ── */
header {
  width: 100%;
  padding: 18px 32px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}
header .logo {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #6c63ff, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
header .tagline {
  color: var(--muted);
  font-size: 0.85rem;
}
#conn-badge {
  margin-left: auto;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 99px;
  background: var(--border);
  color: var(--muted);
  transition: background 0.3s, color 0.3s;
}
#conn-badge.connected {
  background: rgba(34,197,94,0.15);
  color: var(--success);
}

/* ── 主区域 ── */
main {
  width: 100%;
  max-width: 560px;
  padding: 40px 20px 60px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── 卡片 ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 28px 24px;
}
.card h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 18px;
  color: var(--text);
}
.card h2 span {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--muted);
  margin-left: 8px;
}

/* ── 按钮 ── */
button {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 20px;
  transition: opacity 0.15s, transform 0.1s;
}
button:active { transform: scale(0.97); }
button:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--primary-h); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }

/* ── 输入框 ── */
input[type="text"] {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
  padding: 10px 14px;
  width: 100%;
  outline: none;
  transition: border-color 0.2s;
}
input[type="text"]:focus { border-color: var(--primary); }
input[type="text"]::placeholder { color: var(--muted); }

/* ── 房间码显示 ── */
.room-code-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
}
#room-code {
  flex: 1;
  font-family: 'Courier New', monospace;
  font-size: 1.5rem;
  letter-spacing: 0.15em;
  font-weight: 700;
  color: var(--primary);
}
#copy-btn {
  padding: 6px 12px;
  font-size: 0.8rem;
}

/* ── 行内操作行 ── */
.row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.row input { flex: 1; }

/* ── 分隔线 ── */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.8rem;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── 传输区 ── */
#transfer-section { display: none; }

/* ── 拖放区 ── */
#drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
}
#drop-zone.drag-over {
  border-color: var(--primary);
  background: rgba(108,99,255,0.06);
}
#drop-zone .icon { font-size: 2.5rem; margin-bottom: 10px; }
#drop-zone p { color: var(--muted); font-size: 0.9rem; }
#drop-zone strong { color: var(--text); }
#file-input { display: none; }

/* ── 发送队列 ── */
#send-queue { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }

/* ── 文件条目 ── */
.file-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}
.file-item .file-name {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 6px;
}
.file-item .file-meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 8px;
}
.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar .fill {
  height: 100%;
  width: 0%;
  background: var(--primary);
  border-radius: 99px;
  transition: width 0.1s linear;
}
.file-item .status {
  font-size: 0.75rem;
  margin-top: 6px;
}
.status.done   { color: var(--success); }
.status.error  { color: var(--danger); }
.status.active { color: var(--primary); }

/* ── 已收到文件 ── */
#received-section { display: none; }
#received-list { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.recv-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}
.recv-item .recv-name {
  flex: 1;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recv-item .recv-size {
  font-size: 0.75rem;
  color: var(--muted);
  flex-shrink: 0;
}
.recv-item .dl-btn {
  padding: 5px 12px;
  font-size: 0.78rem;
  flex-shrink: 0;
}

/* ── 状态栏 ── */
#status-bar {
  font-size: 0.82rem;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
}
#status-bar.ok     { color: var(--success); border-color: rgba(34,197,94,0.3); }
#status-bar.warn   { color: #f59e0b;        border-color: rgba(245,158,11,0.3); }
#status-bar.error  { color: var(--danger);  border-color: rgba(239,68,68,0.3); }

/* ── 进入中动画点 ── */
.dots::after {
  content: '';
  animation: dots 1.2s steps(4, end) infinite;
}
@keyframes dots {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
}
