:root {
  color-scheme: dark;
  --bg: #05060a;
  --surface: #11141d;
  --surface-2: #191d2a;
  --border: #262c3b;
  --text: #f2f4f8;
  --muted: #99a2b8;
  --accent: #4f7cff;
  --ok: #2ecc8f;
  --warn: #ffb020;
  --err: #ff5a5f;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 3vw, 48px);
}

.shell { width: min(1100px, 100%); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: clamp(20px, 3vw, 40px);
}

h1 {
  margin: 0 0 8px;
  font-size: clamp(22px, 3.2vw, 38px);
  letter-spacing: -0.02em;
}

.sub { margin: 0 0 28px; color: var(--muted); font-size: clamp(14px, 1.4vw, 18px); }

.pair-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(20px, 3vw, 48px);
  align-items: center;
}

@media (max-width: 760px) {
  .pair-grid { grid-template-columns: 1fr; }
}

.step { display: flex; gap: 14px; margin-bottom: 22px; }
.step-num {
  flex: 0 0 30px; height: 30px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border);
  display: grid; place-items: center; font-size: 14px; color: var(--muted);
}
.step-body { flex: 1; }
.step-title { font-weight: 600; margin-bottom: 4px; }
.step-desc { color: var(--muted); font-size: 14px; line-height: 1.5; }

.pin {
  display: flex; gap: clamp(6px, 1vw, 12px); margin: 10px 0 6px;
}
.pin span {
  flex: 1; max-width: 76px; aspect-ratio: 3 / 4;
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  font-size: clamp(26px, 4vw, 46px); font-weight: 700; font-variant-numeric: tabular-nums;
}

.expiry { color: var(--muted); font-size: 13px; }

.qr-wrap { text-align: center; }
.qr {
  background: #fff; border-radius: 18px; padding: 14px;
  width: min(320px, 100%); margin: 0 auto; aspect-ratio: 1;
}
.qr img, .qr svg { width: 100%; height: 100%; display: block; }
.qr-hint { margin-top: 12px; color: var(--muted); font-size: 14px; }

.status {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 14px; margin-bottom: 18px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status[data-tone='ok'] .dot { background: var(--ok); }
.status[data-tone='busy'] .dot { background: var(--warn); animation: pulse 1.2s ease-in-out infinite; }
.status[data-tone='err'] .dot { background: var(--err); }

@keyframes pulse { 50% { opacity: 0.25; } }

button {
  font: inherit; cursor: pointer; border-radius: 12px; padding: 12px 22px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
}
button.primary { background: var(--accent); border-color: transparent; color: #fff; font-weight: 600; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- màn hình đang phản chiếu ---- */
.stage { position: fixed; inset: 0; background: #000; display: none; }
.stage.active { display: block; }
.stage video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.stage-bar {
  position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%);
  display: flex; gap: 12px; align-items: center;
  background: rgba(10, 12, 18, 0.78); backdrop-filter: blur(12px);
  border: 1px solid var(--border); border-radius: 999px; padding: 10px 16px;
  opacity: 0; transition: opacity 0.25s; font-size: 14px;
}
.stage:hover .stage-bar, .stage-bar.show { opacity: 1; }
.stage-stats { color: var(--muted); font-variant-numeric: tabular-nums; }

.hidden { display: none !important; }
.error { color: var(--err); font-size: 14px; margin-top: 12px; min-height: 20px; }
