:root {
  color-scheme: dark;
  --bg: #0b0b0f;
  --fg: #f4f4f6;
  --accent: #ffb020;
  --muted: #8a8a94;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}

button {
  font-family: inherit;
}

.screen {
  height: 100dvh;
  width: 100vw;
  display: flex;
}

.screen[hidden] {
  display: none;
}

/* ---------- display screen ---------- */
#display {
  transition: background-color 0.3s ease;
}

.frame {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
}

.qr-wrap {
  width: min(62vmin, 320px);
  height: min(62vmin, 320px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-canvas {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s ease;
}

.qr-canvas img, .qr-canvas canvas, .qr-canvas table {
  width: 100% !important;
  height: 100% !important;
}

.scan-fab {
  position: absolute;
  top: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.85rem;
  cursor: pointer;
  backdrop-filter: blur(4px);
  z-index: 1;
}

/* ---------- scanner overlay ---------- */
.scanner-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.scanner-overlay[hidden] {
  display: none;
}

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

.scan-frame {
  position: relative;
  width: min(70vw, 280px);
  aspect-ratio: 1;
  border: 3px solid var(--accent);
  border-radius: 16px;
  box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.55);
}

.scan-cancel {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: 16px;
  background: rgba(0, 0, 0, 0.6);
  color: var(--fg);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
}

.scan-status {
  position: absolute;
  bottom: max(32px, env(safe-area-inset-bottom));
  left: 24px;
  right: 24px;
  color: #fff;
  font-size: 0.9rem;
  text-align: center;
  margin: 0;
}
