:root {
  --bg: #0f1115;
  --card: #171a21;
  --card-2: #1d212b;
  --text: #e7e9ee;
  --muted: #9aa3b2;
  --line: #262b37;
  --accent: #4d8bff;
  --ok: #39c47f;
  --bad: #ff6b6b;
  --warn: #f5a623;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f6fb;
    --card: #ffffff;
    --card-2: #eef1f7;
    --text: #1a1f28;
    --muted: #5b6472;
    --line: #e2e6ef;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 520px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  min-height: 100vh;
}

.head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 18px;
}
.head h1 { margin: 0; font-size: 20px; letter-spacing: 0.5px; }

.pill {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.pill[data-kind="idle"] { color: var(--muted); }
.pill[data-kind="ok"] { color: var(--ok); border-color: var(--ok); }
.pill[data-kind="bad"] { color: var(--bad); border-color: var(--bad); }
.pill[data-kind="warn"] { color: var(--warn); border-color: var(--warn); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
}

.lead { color: var(--muted); font-size: 14px; line-height: 1.6; margin: 0 0 18px; }

.actions { display: flex; flex-direction: column; gap: 12px; }

.join { display: flex; gap: 8px; }
.join input {
  flex: 1;
  padding: 12px;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 4px;
  text-align: center;
  background: var(--card-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.join input:focus { outline: 2px solid var(--accent); }

.btn {
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.05s ease, filter 0.15s ease;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(0.985); }
.btn.primary { background: var(--accent); color: #fff; border-color: transparent; }
.btn.small { padding: 9px 12px; font-size: 13px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.tips { margin: 18px 0 0; padding-left: 18px; color: var(--muted); font-size: 13px; line-height: 1.7; }

.room-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.label { color: var(--muted); font-size: 12px; }
.code { font-size: 34px; font-weight: 700; letter-spacing: 8px; font-variant-numeric: tabular-nums; }
.qr {
  width: 112px;
  height: 112px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 6px;
}

.share { display: flex; gap: 8px; margin-bottom: 18px; }
.share input {
  flex: 1;
  padding: 9px 10px;
  font-size: 12px;
  color: var(--muted);
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.hint { font-size: 12px; color: var(--muted); flex: 1 1 140px; min-width: 0; }

.drop {
  border: 2px dashed var(--line);
  border-radius: 14px;
  padding: 30px 20px;
  text-align: center;
  color: var(--muted);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.drop.dragover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.drop p { margin: 0 0 14px; }
.drop.disabled { opacity: 0.45; }

.list { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }

.item {
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}
.item-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.name { font-size: 14px; word-break: break-all; }
.pct { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.bar { height: 6px; border-radius: 999px; background: var(--line); margin: 10px 0 8px; overflow: hidden; }
.bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.15s linear;
}
.meta { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 10px; }
.meta .dir { text-transform: none; }
.state-error .bar i { background: var(--bad); }
.state-error .pct { color: var(--bad); }

.foot {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin-top: 24px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 10;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

.hidden { display: none !important; }
