:root {
  color-scheme: dark;
  --vrws-bg: #05070c;
  --vrws-ink: #f8fafc;
  --vrws-muted: rgba(248, 250, 252, 0.7);
  --vrws-line: rgba(255, 255, 255, 0.16);
  --vrws-panel: rgba(5, 7, 12, 0.8);
  --vrws-red: #b91c1c;
  --vrws-green: #22c55e;
  --vrws-gold: #facc15;
}

* {
  box-sizing: border-box;
}

body.vrws-standalone {
  min-height: 100%;
  margin: 0;
  background: var(--vrws-bg);
  color: var(--vrws-ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.vrws button {
  min-height: 42px;
  border: 1px solid var(--vrws-line);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.9);
  color: var(--vrws-ink);
  font: inherit;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.vrws button:disabled {
  cursor: default;
  opacity: 0.45;
}

.vrws button[data-active="true"] {
  background: var(--vrws-gold);
  color: #000;
}

.vrws-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.vrws-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top)) 14px calc(16px + env(safe-area-inset-bottom));
}

.vrws-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.vrws-kicker {
  margin: 0;
  color: var(--vrws-muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.vrws-topbar h1 {
  margin: 3px 0 0;
  color: #fff;
  font-size: 17px;
  line-height: 1.2;
}

.vrws-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.vrws-links a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid var(--vrws-line);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.74);
  color: var(--vrws-ink);
  text-decoration: none;
  font-size: 13px;
  font-weight: 850;
}

.vrws-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.6fr);
  gap: 12px;
  align-items: stretch;
}

.vrws {
  min-height: calc(100vh - 112px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--vrws-line);
  border-radius: 8px;
  background: #000;
}

.vrws-camera {
  position: relative;
  min-height: 62vh;
  flex: 1;
  overflow: hidden;
  background: #000;
}

.vrws-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vrws-guide {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(86vw, 720px);
  height: clamp(86px, 16vh, 150px);
  transform: translate(-50%, -50%);
  border: 2px solid rgba(250, 204, 21, 0.95);
  border-radius: 8px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.2);
}

.vrws-guide::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  top: 50%;
  height: 2px;
  transform: translateY(-50%);
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, rgba(34, 197, 94, 0.9), transparent);
  animation: vrws-scan 1.8s ease-in-out infinite;
}

.vrws-telemetry {
  position: absolute;
  left: 10px;
  bottom: 10px;
  max-width: min(520px, calc(100% - 20px));
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--vrws-line);
  border-radius: 8px;
  background: rgba(3, 7, 18, 0.76);
  color: rgba(248, 250, 252, 0.9);
  font-size: 12px;
  font-weight: 750;
  backdrop-filter: blur(12px);
}

.vrws-telemetry div {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
}

.vrws-telemetry code {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #d1fae5;
  font-size: 11px;
}

.vrws-pulse {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--vrws-green);
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.65);
  animation: vrws-pulse 1.4s ease-out infinite;
}

.vrws-status {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 10px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border: 1px solid var(--vrws-line);
  border-radius: 8px;
  background: rgba(3, 7, 18, 0.76);
  color: #fff;
  text-align: center;
  font-size: 14px;
  font-weight: 900;
  backdrop-filter: blur(12px);
}

.vrws-status[data-bad="true"] {
  color: #fecaca;
}

.vrws-controls {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  background: rgba(5, 7, 12, 0.92);
}

.vrws-error {
  padding: 10px 12px;
  border-top: 1px solid rgba(185, 28, 28, 0.35);
  background: rgba(127, 29, 29, 0.42);
  color: #fecaca;
  font-size: 13px;
  font-weight: 750;
}

.vrws-side {
  min-height: calc(100vh - 112px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.vrws-panel {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--vrws-line);
  border-radius: 8px;
  background: var(--vrws-panel);
}

.vrws-label {
  margin: 0 0 8px;
  color: var(--vrws-muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.vrws-result {
  min-height: 92px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.vrws-vin {
  color: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(18px, 4.6vw, 24px);
  font-weight: 900;
  overflow-wrap: anywhere;
}

.vrws-detail {
  color: var(--vrws-muted);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.4;
}

.vrws-panel pre {
  min-height: 148px;
  max-height: 42vh;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: rgba(226, 232, 240, 0.94);
  font-size: 11px;
  line-height: 1.45;
}

@keyframes vrws-scan {
  0% { opacity: 0.45; }
  50% { opacity: 1; }
  100% { opacity: 0.45; }
}

@keyframes vrws-pulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.62); }
  100% { box-shadow: 0 0 0 9px rgba(34, 197, 94, 0); }
}

@media (max-width: 860px) {
  .vrws-shell {
    padding-left: 10px;
    padding-right: 10px;
  }

  .vrws-topbar {
    align-items: flex-start;
  }

  .vrws-layout {
    grid-template-columns: 1fr;
  }

  .vrws,
  .vrws-side {
    min-height: auto;
  }

  .vrws-camera {
    min-height: 70vh;
  }

  .vrws-controls {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .vrws-topbar {
    flex-direction: column;
  }

  .vrws-links {
    justify-content: flex-start;
  }

  .vrws-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .vrws-controls button[data-action="ocr"] {
    grid-column: 1 / -1;
  }
}
