:root {
  color-scheme: dark;
  --bg: #08111f;
  --panel: rgba(16, 29, 48, 0.78);
  --line: rgba(148, 163, 184, 0.18);
  --text: #eaf1ff;
  --muted: #93a4bd;
  --accent: #5eead4;
  --accent-2: #60a5fa;
  --danger: #fb7185;
  --shadow: 0 24px 70px rgba(2, 8, 23, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(circle at 12% -10%, rgba(94, 234, 212, 0.16), transparent 34%),
    radial-gradient(circle at 92% 8%, rgba(96, 165, 250, 0.16), transparent 32%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.glow {
  position: fixed;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.18;
  pointer-events: none;
}

.glow-one {
  top: 16%;
  left: -120px;
  background: var(--accent);
}

.glow-two {
  right: -100px;
  bottom: 8%;
  background: var(--accent-2);
}

.view {
  position: relative;
}

.app {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 24px 36px;
}

.phone-shell {
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 16px 30px;
}

.topbar,
.phone-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #07131f;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 28px rgba(94, 234, 212, 0.25);
}

.brand-mark svg {
  width: 26px;
  height: 26px;
}

.brand h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.02em;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.brand.compact h1 {
  font-size: 19px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(15, 27, 45, 0.72);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.status .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #facc15;
  box-shadow: 0 0 0 4px rgba(250, 204, 21, 0.12);
}

.status.online .dot {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(94, 234, 212, 0.14);
}

.status.offline .dot {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(251, 113, 133, 0.14);
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.82fr) minmax(0, 1.18fr);
  gap: 24px;
  align-items: start;
}

.card {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  padding: 26px;
}

.pairing-card h2,
.phone-card h2 {
  margin: 0;
  font-size: 21px;
}

.eyebrow {
  display: block;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  margin-bottom: 8px;
}

.card-desc {
  margin: 14px 0 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.qr-wrap {
  width: min(100%, 260px);
  margin: 0 auto 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #ffffff;
  display: grid;
  place-items: center;
}

.qr-placeholder {
  color: #64748b;
  font-size: 13px;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}

.qr-image {
  display: block;
  width: 100%;
  height: auto;
}

.pair-code {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 14px;
}

.pair-code strong {
  margin-left: 6px;
  color: var(--text);
  letter-spacing: 0.12em;
  font-size: 14px;
}

.btn {
  padding: 12px 16px;
  border: 0;
  border-radius: 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.1s ease;
}

.btn.full {
  width: 100%;
}

.btn.primary {
  color: #07131f;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.btn.secondary {
  color: var(--text);
  background: rgba(148, 163, 184, 0.14);
}

.btn.ghost {
  color: var(--muted);
  background: rgba(148, 163, 184, 0.1);
}

.btn.small {
  padding: 9px 13px;
  font-size: 12px;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.manual {
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
}

.manual summary {
  cursor: pointer;
}

.manual code {
  display: block;
  margin-top: 10px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(2, 8, 23, 0.6);
  color: #bae6fd;
  word-break: break-all;
  line-height: 1.6;
}

.steps {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 12px;
}

.steps li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.08);
  white-space: nowrap;
}

.steps span {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--accent);
  background: rgba(94, 234, 212, 0.12);
  font-weight: 700;
}

.card-head.split {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.head-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.card-head h2 {
  margin: 0;
  font-size: 21px;
}

.card-head p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    linear-gradient(rgba(148, 163, 184, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.05) 1px, transparent 1px),
    #050c16;
  background-size: 28px 28px;
}

.stage.flash {
  animation: stage-flash 0.5s ease;
}

@keyframes stage-flash {
  0% { box-shadow: inset 0 0 0 0 rgba(94, 234, 212, 0.5); }
  100% { box-shadow: inset 0 0 0 12px rgba(94, 234, 212, 0); }
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  color: var(--muted);
}

.empty-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin-bottom: 4px;
  border-radius: 18px;
  color: rgba(148, 163, 184, 0.65);
  background: rgba(148, 163, 184, 0.08);
}

.empty-icon svg {
  width: 30px;
  height: 30px;
}

.empty-state strong {
  color: var(--text);
  font-size: 15px;
}

.empty-state span {
  font-size: 12px;
}

.stage-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.stage-caption {
  position: absolute;
  left: 14px;
  bottom: 14px;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(2, 8, 23, 0.72);
  color: #dbeafe;
  font-size: 11px;
  backdrop-filter: blur(8px);
}

.download-current {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 9px 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(2, 8, 23, 0.74);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.download-current:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.gallery-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 22px 2px 12px;
}

.gallery-bar h3 {
  margin: 0;
  font-size: 14px;
}

.gallery-bar span {
  color: var(--muted);
  font-size: 12px;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 10px;
}

.thumb {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(2, 8, 23, 0.6);
  cursor: pointer;
}

.thumb.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(94, 234, 212, 0.18);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.shoot-btn {
  width: 100%;
  min-height: 190px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  border: 1.5px dashed rgba(94, 234, 212, 0.5);
  border-radius: 20px;
  background:
    radial-gradient(circle at 50% 20%, rgba(94, 234, 212, 0.12), transparent 60%),
    rgba(6, 16, 29, 0.55);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.shoot-icon {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #07131f;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 14px 34px rgba(94, 234, 212, 0.28);
}

.shoot-icon svg {
  width: 32px;
  height: 32px;
}

.shoot-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.shoot-label strong {
  font-size: 17px;
}

.shoot-label small {
  color: var(--muted);
  font-size: 12px;
}

.preview-frame {
  border-radius: 18px;
  overflow: hidden;
  background: rgba(2, 8, 23, 0.6);
  border: 1px solid var(--line);
}

.preview-frame img {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: contain;
}

.preview-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 2px 16px;
  color: var(--muted);
  font-size: 12px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 12px;
}

.notice {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(251, 113, 133, 0.3);
  border-radius: 12px;
  background: rgba(251, 113, 133, 0.08);
  color: #fecdd3;
  font-size: 12px;
  line-height: 1.6;
}

.footer {
  margin-top: 24px;
  text-align: center;
  color: rgba(147, 164, 189, 0.65);
  font-size: 12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 10;
  transform: translate(-50%, 20px);
  padding: 11px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(12, 23, 39, 0.95);
  color: var(--text);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: var(--shadow);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hidden {
  display: none !important;
}

@media (max-width: 960px) {
  .app {
    padding: 22px 18px 32px;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .stage {
    aspect-ratio: 4 / 3;
  }
}

@media (max-width: 560px) {
  .app {
    padding: 16px 14px 28px;
  }

  .phone-shell {
    padding: 16px 14px 28px;
  }

  .phone-top {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .card {
    padding: 18px;
    border-radius: 20px;
  }

  .card-head h2,
  .pairing-card h2 {
    font-size: 19px;
  }

  .shoot-btn {
    min-height: 160px;
  }

  .preview-frame img {
    max-height: 260px;
  }

  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  }
}
