/* Экран сканера. Всё, что видит ассистент во время лекции. */

.scan-screen {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.scan-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elev);
}
.scan-head .grow { flex: 1; min-width: 0; }
.scan-head .title {
  font-weight: 650;
  font-size: .95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.scan-head .sub { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.counter {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 56px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--bg-elev-2);
}
.counter b { font-size: 1.5rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.counter span { font-size: .65rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

.queue-chip {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  background: var(--warn-dim);
  color: #f2ca72;
}
.queue-chip.is-empty { display: none; }
.queue-chip.is-offline { background: var(--err-dim); color: #f2a0a0; }

/* ------------------------------- видео ----------------------------------- */

.video-box {
  position: relative;
  flex: 1;
  min-height: 46vh;
  background: #000;
  overflow: hidden;
}
.video-box video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.reticle {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.reticle::before {
  content: "";
  width: min(62vw, 260px);
  aspect-ratio: 1;
  border: 3px solid rgba(255, 255, 255, .75);
  border-radius: 18px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35);
}

.cam-hint {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  background: var(--bg);
}

/* ---------------------------- статус скана ------------------------------- */

.status {
  padding: 14px 16px;
  min-height: 96px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--bg-elev);
  border-top: 1px solid var(--line);
  transition: background-color .12s ease-out;
}
.status .st-main { font-size: 1.25rem; font-weight: 700; line-height: 1.2; }
.status .st-sub { font-size: .9rem; color: var(--muted); margin-top: 2px; }
.status .st-num { font-family: ui-monospace, Menlo, Consolas, monospace; opacity: .85; }

.status.is-ok { background: #12472c; }
.status.is-ok .st-sub { color: #b9e8cd; }
.status.is-dup { background: #4a3a10; }
.status.is-dup .st-sub { color: #f0dcae; }
.status.is-err { background: #4a1c1c; }
.status.is-err .st-sub { color: #f0c2c2; }
.status.is-queued { background: #123a4a; }
.status.is-queued .st-sub { color: #b6dff0; }

/* вспышка на весь экран — видно даже боковым зрением */
#flash {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  opacity: 0;
  transition: opacity .18s ease-out;
}
#flash.on { opacity: .5; }
#flash.ok { background: #29c06e; }
#flash.dup { background: #e0a326; }
#flash.err { background: #e05252; }

/* ------------------------------ управление ------------------------------- */

.scan-controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: var(--bg-elev);
  border-top: 1px solid var(--line);
}
.scan-controls button {
  flex-direction: column;
  gap: 3px;
  min-height: 60px;
  padding: 6px 4px;
  font-size: .72rem;
  font-weight: 500;
  line-height: 1.1;
}
.scan-controls .ico { font-size: 1.25rem; }

/* --------------------------- нижние панели ------------------------------- */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: rgba(0, 0, 0, .55);
}
.sheet-body {
  background: var(--bg-elev);
  border-radius: 18px 18px 0 0;
  border-top: 1px solid var(--line);
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  max-height: 82dvh;
  overflow-y: auto;
}
.sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  margin: -6px auto 12px;
}

.scan-log { list-style: none; margin: 0; padding: 0; }
.scan-log li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 2px;
  border-bottom: 1px solid var(--line);
}
.scan-log .n { font-family: ui-monospace, Menlo, Consolas, monospace; color: var(--muted); min-width: 4.5em; }
.scan-log .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scan-log .t { font-size: .8rem; color: var(--muted); }
.scan-log .pending { color: var(--warn); }
