:root {
  --bg: #0d1117;
  --card: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #238636;
  --accent-hover: #2ea043;
  --danger: #da3633;
  --danger-hover: #f85149;
  --warning: #d29922;
  --info: #58a6ff;
  --blue: #2f81f7;
  --blue-hover: #388bfd;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}

body {
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
  position: relative;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  padding-bottom: 32px;
}

.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: #0d1117;
  border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: #30363d;
  border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: #484f58;
}

.navbar {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  background: #161b22;
  border-bottom: 1px solid var(--border);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(8px);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
}

.nav-brand svg {
  color: var(--info);
  flex-shrink: 0;
}

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-tab-btn {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  white-space: nowrap;
}

.nav-tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.nav-tab-btn.active {
  color: #58a6ff;
  background: rgba(88, 166, 255, 0.12);
  border-color: rgba(88, 166, 255, 0.3);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-pip-btn {
  background: #21262d;
  color: #c9d1d9;
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: 0.2s;
  white-space: nowrap;
}

.nav-pip-btn:hover {
  background: #30363d;
  color: #fff;
}

.wrapper {
  width: 100%;
  max-width: 1340px;
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr 390px;
  gap: 20px;
  margin: 18px auto 0;
  padding: 0 16px;
}

.card {
  min-width: 0;
  max-width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
  overflow: hidden;
}

h2 {
  font-size: 15px;
  margin-bottom: 14px;
  color: #fff;
  font-weight: 600;
}

.video-container {
  position: relative;
  background: #05070a;
  border-radius: 6px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  min-height: 220px;
}

video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: none;
}

.screen-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px 14px;
  background: radial-gradient(circle at center, #101623 0%, #05070a 100%);
  user-select: none;
}

.monitor-icon {
  margin-bottom: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: rgba(88, 166, 255, 0.1);
  border: 1px solid rgba(88, 166, 255, 0.25);
  flex-shrink: 0;
}

.placeholder-title {
  font-size: 13px;
  color: #8b949e;
  margin-bottom: 6px;
  line-height: 1.5;
}

.placeholder-sub {
  font-size: 14px;
  color: #fff;
  font-weight: bold;
  margin-bottom: 8px;
  line-height: 1.5;
}

.badge-rec {
  color: #3fb950;
  font-size: 12px;
  font-weight: normal;
  background: rgba(63, 185, 80, 0.15);
  padding: 2px 6px;
  border-radius: 4px;
  margin: 0 4px;
  display: inline-block;
}

.badge-warn {
  color: #d29922;
  font-weight: bold;
}

.placeholder-note {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

.btn-center-screen {
  background: #3b82f6;
  border: 1px solid #60a5fa;
  color: #ffffff;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  margin-bottom: 12px;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
  transition: all 0.2s ease;
}

.btn-center-screen:hover:not(:disabled) {
  background: #2563eb;
  border-color: #93c5fd;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(59, 130, 246, 0.5);
}

.btn-center-screen:active:not(:disabled) {
  transform: translateY(0);
}

.btn-center-screen:disabled {
  background: #21262d;
  border-color: var(--border);
  color: var(--text-muted);
  cursor: not-allowed;
  box-shadow: none;
}

.placeholder-footer {
  position: absolute;
  bottom: 10px;
  font-size: 11px;
  color: #484f58;
}

.field {
  margin-bottom: 15px;
}

label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 5px;
}

input[type="text"],
input[type="number"] {
  width: 100%;
  background: #090d13;
  border: 1px solid var(--border);
  color: #fff;
  padding: 9px 11px;
  border-radius: 6px;
  font-size: 13px;
  transition: border-color 0.2s;
}

input[type="text"]:focus,
input[type="number"]:focus {
  outline: none;
  border-color: var(--info);
}

.action-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #21262d;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.btn {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 13px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn:hover {
  background: var(--accent-hover);
}

.btn:disabled {
  background: #21262d;
  color: var(--text-muted);
  cursor: not-allowed;
}

.btn-danger {
  background: var(--danger);
}

.btn-danger:hover {
  background: var(--danger-hover);
}

.test-btn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.btn-test {
  font-size: 13px;
  padding: 11px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
}

.btn-test-lie {
  background: #3c1417;
  border-color: #632327;
  color: #ff9999;
}

.btn-test-lie:hover {
  background: #4f1b1f;
  color: #ffffff;
}

.btn-test-dc {
  background: #142841;
  border-color: #204169;
  color: #8cc4ff;
}

.btn-test-dc:hover {
  background: #1b3557;
  color: #ffffff;
}

.btn-pip {
  background: #21262d;
  border: 1px solid var(--border);
  color: #c9d1d9;
  font-size: 13px;
  padding: 11px 18px;
  border-radius: 8px;
}

.btn-pip:hover {
  background: #30363d;
  color: #fff;
}

.stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.stat-item {
  background: #090d13;
  padding: 10px 6px;
  border-radius: 6px;
  text-align: center;
  border: 1px solid var(--border);
}

.stat-val {
  font-size: 15px;
  font-weight: bold;
  color: var(--info);
  font-variant-numeric: tabular-nums;
}

.stat-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

.alarm-banner {
  display: none;
  margin-top: 16px;
  padding: 14px;
  border-radius: 6px;
  background: rgba(218, 54, 51, 0.15);
  border: 1px solid var(--danger);
  text-align: center;
  color: #ff7b72;
}

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: bold;
  white-space: nowrap;
}

.pill-green {
  background: rgba(35, 134, 54, 0.25);
  color: #3fb950;
  border: 1px solid rgba(63, 185, 80, 0.3);
}

.pill-yellow {
  background: rgba(210, 153, 34, 0.25);
  color: #d29922;
  border: 1px solid rgba(210, 153, 34, 0.3);
}

.pill-red {
  background: rgba(218, 54, 51, 0.25);
  color: #ff7b72;
  border: 1px solid rgba(218, 54, 51, 0.3);
}

.tutorial-card {
  grid-column: 1 / -1;
  margin-top: 8px;
  background: #161b22;
  border: 1px solid #30363d;
}

.tutorial-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #21262d;
  padding-bottom: 12px;
  margin-bottom: 18px;
  gap: 10px;
}

.tutorial-header h2 {
  margin-bottom: 0;
  font-size: 16px;
  color: #f0f6fc;
  display: flex;
  align-items: center;
  gap: 10px;
}

.tutorial-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.tutorial-box {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 18px 20px;
}

.tutorial-box h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid #21262d;
}

.step-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
  font-size: 13.5px;
  color: #e6edf3;
  line-height: 1.65;
}

.step-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  margin-top: 2px;
}

.step-num.android {
  background: rgba(63, 185, 80, 0.2);
  color: #3fb950;
  border: 1px solid #238636;
}

.step-num.ios {
  background: rgba(88, 166, 255, 0.2);
  color: #58a6ff;
  border: 1px solid #1f6feb;
}

.step-text strong {
  color: #ffffff;
  font-weight: 600;
}

.code-tag {
  background: #0d1117;
  border: 1px solid #38bdf8;
  color: #38bdf8;
  padding: 2px 7px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-weight: 600;
  display: inline-block;
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  padding: 16px;
}

.modal-content {
  background: #161b22;
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 440px;
  max-width: 100%;
  padding: 24px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6);
}

.modal-title {
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 16px;
}

.modal-err {
  font-size: 12px;
  color: #ff7b72;
  min-height: 18px;
  margin-top: 8px;
  margin-bottom: 12px;
}

@media (max-width: 992px) {
  .wrapper {
    grid-template-columns: 1fr;
    margin: 14px auto 0;
    gap: 16px;
  }
}

@media (max-width: 768px) {
  .navbar {
    padding: 12px 14px 10px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    overflow: hidden;
  }

  .nav-brand {
    font-size: 15px;
    justify-content: center;
    width: 100%;
    max-width: 100%;
  }

  .nav-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    background: #090d13;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 3px;
    gap: 4px;
  }

  .nav-tab-btn {
    justify-content: center;
    padding: 8px 0;
    font-size: 13px;
    border-radius: 6px;
  }

  .nav-tab-btn.active {
    background: #21262d;
    color: #58a6ff;
    border-color: rgba(88, 166, 255, 0.3);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  }

  .nav-actions {
    display: none;
  }

  .wrapper {
    padding: 0 10px;
    margin-top: 10px;
    max-width: 100%;
  }

  .card {
    padding: 14px;
    max-width: 100%;
  }

  .video-container {
    aspect-ratio: 16 / 9;
    min-height: 190px;
  }

  .btn-center-screen {
    font-size: 13px;
    padding: 8px 18px;
    margin-top: 10px;
    margin-bottom: 8px;
  }

  .placeholder-footer {
    font-size: 10px;
  }

  .stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .stat-item:last-child:nth-child(odd) {
    grid-column: span 2;
  }

  .stat-item {
    padding: 8px 6px;
  }

  .stat-val {
    font-size: 14px;
  }

  .tutorial-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .tutorial-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .tutorial-header h2 {
    font-size: 14px;
    line-height: 1.5;
  }

  .tutorial-box {
    padding: 14px;
  }

  .step-item {
    font-size: 12.5px;
  }

  .modal-content {
    padding: 18px;
  }

  .modal-title {
    font-size: 15px;
  }

  .modal-desc {
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .test-btn-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}