/*
 * The camera page. One dark card, the colours and the calm of the AndrIoT dashboard's sign-in
 * card (dashboard/styles.css, .auth-box): green only for "on" and "live", no red but for Stop.
 *
 * Read by old Safari (iOS 12): no `gap` in a flex row, no `inset`, no `aspect-ratio`, no
 * `clamp()`, no `:is()`. The type is the system's: the page's policy lets no font file in.
 */
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  min-height: 100vh;
  background: #0a0d12;
  color: #f8fafc;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

.page {
  width: 100%;
  max-width: 452px;
  margin: 0 auto;
  padding: 16px;
  padding-top: calc(16px + env(safe-area-inset-top));
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

.brand { display: flex; align-items: center; padding: 8px 4px 16px; }
.brand-mark { width: 36px; height: 36px; margin-right: 10px; }
.brand-name { font-size: 16px; font-weight: 700; }
.brand-what { margin-left: 8px; font-size: 14px; color: #8b9bb4; }

.card {
  background: #12161f;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 20px 16px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}

/* The small picture of what the camera sees. */
.picture { margin-bottom: 16px; border-radius: 6px; overflow: hidden; background: #07090d; text-align: center; line-height: 0; }
.preview { width: 100%; max-height: 190px; object-fit: contain; background: #07090d; }

/* The big line: is the camera on? A dot before it, green only while it is. */
.title { position: relative; padding-left: 22px; font-size: 22px; line-height: 1.25; font-weight: 650; }
.title::before { content: ''; position: absolute; left: 2px; top: 9px; width: 10px; height: 10px; border-radius: 50%; background: #54627a; }
.card[data-mood="on"] .title::before { background: #10b981; }
.card[data-mood="no-picture"] .title::before { background: #f59e0b; }
.card[data-mood="pair"] .title, .card[data-mood="blocked"] .title { padding-left: 0; }
.card[data-mood="pair"] .title::before, .card[data-mood="blocked"] .title::before { display: none; }

.name { margin-top: 2px; padding-left: 22px; font-size: 16px; color: #8b9bb4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.watching {
  margin-top: 14px; padding: 10px 12px; border-radius: 6px;
  background: rgba(16, 185, 129, 0.12); border: 1px solid rgba(16, 185, 129, 0.35); color: #d1fae5; font-weight: 600;
}
.notice {
  margin-top: 14px; padding: 10px 12px; border-radius: 6px;
  background: #1a202c; border: 1px solid rgba(255, 255, 255, 0.14); color: #f8fafc;
  overflow-wrap: break-word; word-wrap: break-word;
}

.code { margin-top: 18px; }
.code-label { font-size: 14px; color: #8b9bb4; margin-bottom: 6px; }
.code-help { font-size: 14px; color: #8b9bb4; margin-top: 8px; }
.boxes { display: flex; justify-content: space-between; max-width: 300px; }
.box {
  width: 14.5%; max-width: 44px; height: 52px; padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 6px; background: #07090d; color: #f8fafc;
  font: inherit; font-size: 24px; font-weight: 600; text-align: center; text-transform: uppercase;
  -webkit-appearance: none; appearance: none;
}
.box-gap { margin-left: 3%; }
.box:focus { outline: 2px solid #3b82f6; outline-offset: 1px; border-color: transparent; }

.lines { margin-top: 14px; }
.line { margin-top: 8px; color: #c5cedb; }
.line:first-child { margin-top: 0; }

.buttons { margin-top: 18px; }
.btn {
  display: block; width: 100%; min-height: 50px; margin-top: 10px; padding: 12px 16px;
  border: 1px solid transparent; border-radius: 6px;
  font: inherit; font-size: 16px; font-weight: 600; line-height: 1.2; text-align: center; cursor: pointer;
  -webkit-appearance: none; appearance: none; -webkit-tap-highlight-color: transparent;
}
.btn:first-child { margin-top: 0; }
.btn:focus { outline: 2px solid #3b82f6; outline-offset: 2px; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-primary { background: #2f6be0; color: #ffffff; }
.btn-primary:hover { background: #295fcb; }
.btn-stop { background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.35); color: #fecaca; }
.btn-stop:hover { background: rgba(239, 68, 68, 0.22); }
.btn-quiet { background: #1a202c; border-color: rgba(255, 255, 255, 0.08); color: #f8fafc; }
.btn-quiet:hover { background: #181d28; }
/* Small and plain, away from the others: "Remove this camera from this device". */
.btn-plain { min-height: 44px; margin-top: 22px; padding: 10px 12px; background: transparent; border-color: transparent; color: #8b9bb4; font-size: 14px; font-weight: 400; text-decoration: underline; }
.btn-plain:hover { color: #c5cedb; }

.debug { margin-top: 16px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.08); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; color: #8b9bb4; overflow-wrap: break-word; word-wrap: break-word; }

/*
 * Before the scripts have run. "Loading…" stands there while they are on their way. When no script has
 * run after 30 seconds, the style sheet alone puts it away and shows the sentence about a page that has
 * not loaded (js/first.js does the same at once when a script did not arrive, and then gives that
 * sentence the class of a plain one). "This browser cannot use the camera…" is never shown by the clock:
 * only by js/first.js, when it has found that the browser cannot.
 */
.loading { margin-top: 14px; max-height: 120px; overflow: hidden; color: #c5cedb; animation: loading-goes 0.01s linear 30s forwards; }
.late { margin-top: 0; max-height: 0; overflow: hidden; visibility: hidden; color: #c5cedb; animation: late-appears 0.01s linear 30s forwards; }
@keyframes loading-goes { to { max-height: 0; margin-top: 0; visibility: hidden; } }
@keyframes late-appears { to { max-height: 400px; margin-top: 14px; visibility: visible; } }
.fallback { margin-top: 14px; color: #c5cedb; }

/* "Dim the screen": black, with one dim line that moves. */
.dark { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 10; background: #000000; cursor: pointer; }
.dark-line { position: absolute; left: 10%; top: 10%; max-width: 48%; color: #3d4350; font-size: 14px; line-height: 1.4; }
.dark-clock { display: block; font-size: 30px; line-height: 1.2; color: #4a5160; }
#dark-watching { display: block; }

@media (min-width: 700px) {
  .page { padding-top: 48px; }
  .card { padding: 28px; }
  .preview { max-height: 230px; }
}
