/* Страница проверки по фото.

   Сделана по принципам интерфейсов Apple: системный шрифт, тёмная основа,
   полупрозрачные панели поверх контента, отклик на нажатие и пружины без
   отскока. Тёмная — сознательно: снимки тушек сняты на чёрном фоне, и на
   проекторе они должны быть самым ярким на экране.

   Отдельный файл, а не style.css: страница камеры уже проверена на показе,
   и её вид не трогаем. */

:root {
  color-scheme: dark;

  --bg: #000;
  --surface: #1c1c1e;
  --surface-hover: #232325;
  --fill: rgb(118 118 128 / .24);
  --fill-strong: rgb(118 118 128 / .36);
  --label: #fff;
  --label-2: rgb(235 235 245 / .62);
  --label-3: rgb(235 235 245 / .34);
  --separator: rgb(84 84 88 / .55);
  --accent: #0a84ff;
  --accent-hover: #409cff;
  --green: #30d158;
  --red: #ff453a;

  --material: rgb(30 30 32 / .66);
  --material-thick: rgb(36 36 38 / .8);
  --material-edge: rgb(255 255 255 / .1);
  --blur: blur(24px) saturate(180%);
  --float-shadow: inset 0 0 0 .5px var(--material-edge),
                  inset 0 1px 0 rgb(255 255 255 / .05),
                  0 16px 48px rgb(0 0 0 / .55);

  /* Цвета типов дефектов — системная палитра Apple для тёмной темы, по
     порядку классов модели. Где у дефекта есть свой цвет, он и взят:
     жёлчь жёлтая, синяк фиолетовый, перелом красный. */
  --c0: #ffd60a;  /* жёлчь */
  --c1: #bf5af2;  /* синяк */
  --c2: #ff9f0a;  /* вывих */
  --c3: #64d2ff;  /* перо */
  --c4: #ff453a;  /* перелом */
  --c5: #ff375f;  /* гематома */
  --c6: #ac8e68;  /* царапина */
  --c7: #7d7aff;  /* повреждение кожи */

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;

  /* Пружина с критическим затуханием: быстро трогается и мягко садится,
     без перелёта. Форма кривой от скорости не зависит, меняется только
     длительность: 590 мс — response 0.4, 440 мс — response 0.3. */
  --spring: linear(0, 0.0365, 0.1205, 0.2253, 0.3344, 0.4387, 0.5335, 0.6167,
    0.688, 0.748, 0.7978, 0.8386, 0.8719, 0.8987, 0.9202, 0.9373, 0.951, 0.9617,
    0.9702, 0.9768, 0.982, 0.9861, 0.9892, 0.9917, 0.9936, 0.9951, 0.9962,
    0.9971, 0.9978, 0.9983, 0.9987, 1);
  --spring-slow: 590ms;
  --spring-fast: 440ms;

  /* Скругления концентричны: внутреннее = внешнее − отступ. */
  --radius-card: 22px;
  --pad-card: 8px;
  --radius-inner: 14px;
}

@supports not (transition-timing-function: linear(0, 1)) {
  :root { --spring: cubic-bezier(0.22, 1, 0.36, 1); }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--label);
  font: 400 1rem/1.47 var(--font);
  letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
}
body.is-viewing { overflow: hidden; }

button, input, output { font: inherit; color: inherit; letter-spacing: inherit; }
button { -webkit-tap-highlight-color: transparent; }
p { margin: 0; }

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

:is(.button, .icon-button, .glass-button, .chip, .shot__frame, .segmented__item,
    .dropzone, .toast__action):focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* Панель сверху ----------------------------------------------------- */

.toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: calc(10px + env(safe-area-inset-top)) 24px 10px;
  background: var(--material);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}

/* Вместо линии под панелью — мягкая тень, и только когда под панель
   действительно уехал контент. */
.toolbar::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 100%;
  height: 20px;
  background: linear-gradient(rgb(0 0 0 / .5), transparent);
  opacity: 0;
  transition: opacity .25s;
  pointer-events: none;
}
.is-scrolled .toolbar::after { opacity: 1; }

.toolbar__lead { display: flex; align-items: center; gap: 10px; min-width: 0; }
.toolbar__titles { display: grid; min-width: 0; line-height: 1.25; }
.toolbar__title { font-size: .9375rem; font-weight: 600; letter-spacing: -.016em; }
.toolbar__status {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: .8125rem;
  letter-spacing: 0;
  color: var(--label-2);
}
.toolbar__trail { justify-self: end; }
.toolbar__meta { font-size: .8125rem; color: var(--label-3); font-variant-numeric: tabular-nums; }

.status-dot {
  flex: none;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--label-3);
  transition: background-color .3s;
}
.status-dot[data-state="live"] { background: var(--accent); animation: breathe 1.4s ease-in-out infinite; }
.status-dot[data-state="ok"] { background: var(--green); }
.status-dot[data-state="error"] { background: var(--red); }
@keyframes breathe { 50% { opacity: .35; } }

.segmented {
  display: inline-flex;
  padding: 2px;
  border-radius: 9px;
  background: var(--fill);
}
.segmented__item {
  padding: 5px 18px;
  border-radius: 7px;
  font-size: .8125rem;
  font-weight: 500;
  color: var(--label);
  text-decoration: none;
  transition: background-color .2s, transform var(--spring-fast) var(--spring);
}
.segmented__item:not([aria-current]):hover { background: rgb(255 255 255 / .05); }
.segmented__item:active { transform: scale(.95); transition: transform 100ms ease-out; }
.segmented__item[aria-current="page"] {
  font-weight: 600;
  background: #636366;
  box-shadow: 0 3px 8px rgb(0 0 0 / .12), 0 3px 1px rgb(0 0 0 / .04);
}

/* Кнопки ------------------------------------------------------------ */

/* Нажатие отвечает сразу, за 100 мс, а отпускание возвращает пружиной. */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--fill);
  font-size: .9375rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: transform var(--spring-fast) var(--spring), background-color .2s, opacity .2s;
}
.button:hover { background: var(--fill-strong); }
.button:active { transform: scale(.96); transition: transform 100ms ease-out; }
.button:disabled { opacity: .4; cursor: default; transform: none; background: var(--fill); }
.button--primary { background: var(--accent); color: #fff; }
.button--primary:hover { background: var(--accent-hover); }
.button--large { min-height: 50px; padding: 0 30px; font-size: 1.0625rem; }
.button--small { min-height: 30px; padding: 0 12px; font-size: .8125rem; }
.button--destructive { color: var(--red); }

.icon-button {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--fill);
  cursor: pointer;
  transition: transform var(--spring-fast) var(--spring), background-color .2s, opacity .2s;
}
.icon-button svg { width: 18px; height: 18px; }
.icon-button:hover { background: var(--fill-strong); }
.icon-button:active { transform: scale(.9); transition: transform 100ms ease-out; }
.icon-button:disabled { opacity: .3; cursor: default; transform: none; }
.icon-button--accent { background: var(--accent); color: #fff; }
.icon-button--accent:hover { background: var(--accent-hover); }
.icon-button--small { width: 30px; height: 30px; }
.icon-button--small svg { width: 15px; height: 15px; }

/* Страница ---------------------------------------------------------- */

.page {
  max-width: 1480px;
  margin: 0 auto;
  padding: 8px 24px 180px;
}

/* Пустое состояние -------------------------------------------------- */

.empty {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 160px);
  min-height: calc(100svh - 160px);
  padding-block: 24px;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: min(100%, 580px);
  padding: 56px 40px 36px;
  text-align: center;
  border-radius: 30px;
  background: var(--surface);
  box-shadow: inset 0 0 0 .5px var(--material-edge);
  cursor: pointer;
  transition: transform var(--spring-fast) var(--spring), background-color .25s;
}
.dropzone:hover { background: var(--surface-hover); }
.dropzone:active { transform: scale(.985); transition: transform 100ms ease-out; }

.dropzone__icon {
  display: grid;
  place-items: center;
  width: 76px; height: 76px;
  margin-bottom: 8px;
  border-radius: 50%;
  background: rgb(10 132 255 / .16);
  color: var(--accent);
}
.dropzone__icon svg { width: 38px; height: 38px; }

.dropzone__title {
  font-size: clamp(1.625rem, 3vw, 2rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.024em;
}
.dropzone__text { max-width: 34ch; font-size: 1.0625rem; color: var(--label-2); letter-spacing: -.02em; }
.dropzone .button { margin-top: 16px; }
.dropzone__note { margin-top: 4px; font-size: .8125rem; letter-spacing: 0; color: var(--label-3); }

/* Сводка ------------------------------------------------------------ */

.summary {
  padding: 32px 4px 4px;
  animation: materialize var(--spring-slow) var(--spring) both;
}

.summary__figure { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px 20px; }

/* Крупный текст — отрицательная разрядка и плотный интерлиньяж. */
.summary__total {
  font-size: clamp(4.5rem, 11vw, 8rem);
  font-weight: 700;
  line-height: .8;
  letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
}
.summary__text { padding-bottom: 4px; }
.summary__label {
  font-size: clamp(1.25rem, 2.2vw, 1.75rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -.022em;
}
.summary__sub { margin-top: 4px; font-size: .9375rem; color: var(--label-2); }

.spectrum {
  display: flex;
  gap: 3px;
  height: 12px;
  margin: 26px 0 14px;
  overflow: hidden;
  border-radius: 6px;
  background: var(--fill);
}
.spectrum__segment {
  flex: 0 0 0;
  min-width: 0;
  background: var(--hue);
  transition: flex-grow var(--spring-slow) var(--spring);
}

.hint {
  margin: 22px 4px 0;
  font-size: .875rem;
  letter-spacing: 0;
  color: var(--label-3);
}

/* Плашки дефектов --------------------------------------------------- */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 0 12px 0 10px;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--hue) 16%, transparent);
  font-size: .875rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: transform var(--spring-fast) var(--spring), background-color .2s, color .2s;
}
.chip::before {
  content: "";
  flex: none;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--hue);
}
.chip__count { font-weight: 600; color: var(--hue); font-variant-numeric: tabular-nums; }
.chip:hover { background: color-mix(in srgb, var(--hue) 28%, transparent); }
.chip:active { transform: scale(.94); transition: transform 100ms ease-out; }
.chip[aria-pressed="true"] { background: var(--hue); color: #000; }
.chip[aria-pressed="true"]::before { background: rgb(0 0 0 / .5); }
.chip[aria-pressed="true"] .chip__count { color: #000; }
.chip--none { --hue: var(--green); color: var(--label-2); cursor: default; }
.chip--none:hover { background: color-mix(in srgb, var(--hue) 16%, transparent); }
.chip--none:active { transform: none; }

.legend .chip { min-height: 36px; padding: 0 15px 0 13px; font-size: .9375rem; }

/* Галерея ----------------------------------------------------------- */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 20px;
  align-items: start;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.shot {
  padding: var(--pad-card);
  border-radius: var(--radius-card);
  background: var(--surface);
  animation: materialize var(--spring-slow) var(--spring) both;
  transition: opacity .35s;
}
/* Выбран тип дефекта, а на снимке его нет — снимок уходит на второй план. */
.shot.is-muted { opacity: .35; }

@keyframes materialize {
  from { opacity: 0; transform: translateY(10px) scale(.97); }
}

.shot__frame {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 4 / 3;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-inner);
  background: #0b0b0c;
  cursor: zoom-in;
  -webkit-touch-callout: none;
  user-select: none;
  transition: transform var(--spring-fast) var(--spring);
}
.shot__frame:disabled { cursor: default; }
.shot__frame:not(:disabled):active { transform: scale(.975); transition: transform 100ms ease-out; }

.shot__frame img,
.shot__marks {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}
.shot__frame img {
  object-fit: contain;
  -webkit-user-drag: none;
  transition: opacity .45s, filter .45s;
}
.shot:not([data-state="done"]) .shot__frame img { opacity: .3; filter: grayscale(1) blur(3px); }
.shot[data-state="error"] .shot__frame img { visibility: hidden; }

.shot__marks { transition: opacity .35s; }
.shot:not([data-state="done"]) .shot__marks { opacity: 0; }
.shot__marks g { transition: opacity .25s; }
.shot__marks g.is-dim { opacity: .1; }
.is-bare .shot__marks { opacity: 0; transition-duration: .12s; }

.shot__veil {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px;
  text-align: center;
  font-size: .875rem;
  line-height: 1.4;
  color: var(--label-2);
}
.shot[data-state="done"] .shot__veil { display: none; }
.shot:is([data-state="queued"], [data-state="error"]) .spinner { display: none; }
.shot[data-state="error"] .shot__veil { color: var(--label); }
.shot[data-state="error"] .shot__veil::before {
  content: "!";
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgb(255 69 58 / .18);
  color: var(--red);
  font-size: 1.125rem;
  font-weight: 700;
}

.spinner {
  width: 24px; height: 24px;
  border: 2.5px solid rgb(255 255 255 / .16);
  border-top-color: var(--label);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.shot__info {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  padding: 12px 6px 6px;
}
.shot__head { display: flex; align-items: center; gap: 12px; }
.shot__total {
  min-width: 1.1ch;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.035em;
  font-variant-numeric: tabular-nums;
}
.shot__titles { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.shot__name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: .875rem;
  font-weight: 500;
}
.shot__meta { font-size: .75rem; letter-spacing: 0; color: var(--label-3); font-variant-numeric: tabular-nums; }

.shot [data-retry] { justify-self: start; }
.shot:not([data-state="error"]) [data-retry] { display: none; }
.shot[data-state="error"] [data-download] { display: none; }

/* Плавающая панель управления --------------------------------------- */

.dock {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  translate: -50% 0;
  display: flex;
  align-items: center;
  gap: 16px;
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 8px;
  border-radius: 999px;
  background: var(--material-thick);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: var(--float-shadow);
  animation: rise var(--spring-slow) var(--spring) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(28px) scale(.96); } }

.dock__divider { align-self: stretch; width: 1px; margin-block: 6px; background: var(--separator); }
.dock__actions { display: flex; gap: 8px; }

.threshold { display: flex; align-items: center; gap: 12px; }
.threshold__label { font-size: .875rem; color: var(--label-2); }
.threshold__value { min-width: 2.4em; font-size: .9375rem; font-weight: 600; font-variant-numeric: tabular-nums; }

.threshold input {
  --pct: 35%;
  width: clamp(140px, 20vw, 260px);
  height: 30px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.threshold input:focus-visible { outline: none; }
.threshold input::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--accent) var(--pct), var(--fill-strong) var(--pct));
}
.threshold input::-webkit-slider-thumb {
  width: 26px; height: 26px;
  margin-top: -11px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 .5px 4px rgb(0 0 0 / .12), 0 6px 13px rgb(0 0 0 / .12);
  -webkit-appearance: none;
  appearance: none;
}
.threshold input:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px rgb(10 132 255 / .6); }
.threshold input::-moz-range-track { height: 4px; border-radius: 2px; background: var(--fill-strong); }
.threshold input::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
.threshold input::-moz-range-thumb {
  width: 26px; height: 26px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 .5px 4px rgb(0 0 0 / .12), 0 6px 13px rgb(0 0 0 / .12);
}

.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.switch__label { font-size: .875rem; color: var(--label-2); }
.switch__input {
  position: relative;
  flex: none;
  width: 51px; height: 31px;
  margin: 0;
  border-radius: 999px;
  background: var(--fill-strong);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background-color .25s;
}
.switch__input::before {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 27px; height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 8px rgb(0 0 0 / .15), 0 3px 1px rgb(0 0 0 / .06);
  transition: transform var(--spring-fast) var(--spring);
}
.switch__input:checked { background: var(--green); }
.switch__input:checked::before { transform: translateX(20px); }
.switch__input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Уведомление с отменой --------------------------------------------- */

.toast {
  position: fixed;
  z-index: 31;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  translate: -50% 0;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100% - 32px);
  padding: 8px 8px 8px 22px;
  border-radius: 999px;
  background: var(--material-thick);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: var(--float-shadow);
  font-size: .9375rem;
  animation: rise var(--spring-slow) var(--spring) both;
}
.toast__action {
  min-height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
}
.toast__action:hover { background: var(--fill); }

/* Перетаскивание файлов --------------------------------------------- */

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  padding: 16px;
  background: rgb(0 0 0 / .5);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  pointer-events: none;
  animation: fade .2s ease-out both;
}
.drop-overlay__panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  border-radius: 30px;
  box-shadow: inset 0 0 0 3px var(--accent);
  background: rgb(10 132 255 / .08);
  animation: materialize var(--spring-fast) var(--spring) both;
}
.drop-overlay__title { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 700; letter-spacing: -.024em; }
@keyframes fade { from { opacity: 0; } }

/* Просмотр крупно --------------------------------------------------- */

.viewer { position: fixed; inset: 0; z-index: 40; }

.viewer__scrim {
  position: absolute;
  inset: 0;
  background: rgb(0 0 0 / .82);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
}

.viewer__stage {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: calc(72px + env(safe-area-inset-top)) 24px calc(24px + env(safe-area-inset-bottom));
  pointer-events: none;
}

/* Из карточки в крупный вид снимок летит трансформацией от левого верхнего
   угла — так прямоугольник карточки точно ложится на прямоугольник здесь. */
.viewer__frame {
  position: relative;
  flex: none;
  overflow: hidden;
  border-radius: 16px;
  background: #0b0b0c;
  box-shadow: 0 30px 90px rgb(0 0 0 / .6);
  transform-origin: 0 0;
  pointer-events: auto;
  touch-action: none;
  -webkit-touch-callout: none;
  user-select: none;
}
.viewer__frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  -webkit-user-drag: none;
}

.viewer__caption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  max-width: 100%;
  padding: 10px 10px 10px 20px;
  border-radius: 24px;
  background: var(--material);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: inset 0 0 0 .5px var(--material-edge);
  pointer-events: auto;
}
.viewer__total {
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.035em;
  font-variant-numeric: tabular-nums;
}
.viewer__titles { display: grid; min-width: 0; max-width: 34ch; line-height: 1.3; }
.viewer__name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: .9375rem; font-weight: 600; }
.viewer__meta { font-size: .8125rem; letter-spacing: 0; color: var(--label-3); }
.viewer__caption .chips { flex: 1 1 240px; }
.viewer__hint { font-size: .8125rem; letter-spacing: 0; color: var(--label-3); }

.viewer__controls { position: absolute; inset: 0; pointer-events: none; }

.glass-button {
  position: absolute;
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--material-thick);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: inset 0 0 0 .5px var(--material-edge);
  cursor: pointer;
  pointer-events: auto;
  transition: transform var(--spring-fast) var(--spring), background-color .2s;
}
.glass-button svg { width: 20px; height: 20px; }
.glass-button:hover { background: rgb(72 72 74 / .85); }
.glass-button:active { transform: scale(.9); transition: transform 100ms ease-out; }
.viewer__close { top: calc(16px + env(safe-area-inset-top)); right: 20px; }
.viewer__nav { top: 50%; margin-top: -22px; }
.viewer__nav--prev { left: 20px; }
.viewer__nav--next { right: 20px; }

/* Телефон ----------------------------------------------------------- */

@media (max-width: 640px) {
  .toolbar { grid-template-columns: minmax(0, 1fr) auto; padding-inline: 16px; }
  .toolbar__trail { display: none; }
  .page { padding: 4px 16px 210px; }
  .dropzone { padding: 40px 22px 28px; border-radius: 26px; }
  .summary { padding-top: 18px; }
  .gallery { gap: 14px; }

  .dock {
    left: 12px;
    right: 12px;
    translate: none;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px 12px;
    width: auto;
    max-width: none;
    padding: 12px;
    border-radius: 26px;
  }
  .threshold { order: -1; flex: 1 1 100%; padding-inline: 4px; }
  .threshold input { flex: 1; width: auto; }
  .dock__divider { display: none; }
  /* Вторая строка — всё остальное в один ряд, иначе панель закрывает
     треть экрана со снимками. */
  .switch { gap: 8px; }
  .switch__label { font-size: .8125rem; }
  .dock__actions { margin-left: auto; gap: 6px; }
  .dock__actions .button { min-height: 34px; padding: 0 12px; font-size: .875rem; }

  .viewer__stage { padding: calc(68px + env(safe-area-inset-top)) 12px calc(16px + env(safe-area-inset-bottom)); gap: 12px; }
  .viewer__caption { padding: 12px 12px 12px 16px; border-radius: 20px; }
  .viewer__hint { display: none; }
  .viewer__nav { top: calc(16px + env(safe-area-inset-top)); margin-top: 0; }
  .viewer__nav--prev { left: 16px; }
  .viewer__nav--next { left: 68px; right: auto; }
  .viewer__close { right: 16px; }
}

/* Настройки доступности --------------------------------------------- */

/* Меньше движения — не значит без отклика: сдвиги и масштаб заменяются
   короткой сменой прозрачности. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
  .shot, .summary, .dock, .toast, .drop-overlay__panel { animation: fade .2s ease-out both !important; }
  .shot__marks g, .shot__marks, .shot.is-muted { transition: opacity .2s !important; }
  .status-dot[data-state="live"] { animation: none !important; }
  .spinner { animation: none !important; border-top-color: rgb(255 255 255 / .5); }
  :is(.button, .icon-button, .glass-button, .chip, .shot__frame, .segmented__item, .dropzone):active { transform: none; }
}

@media (prefers-reduced-transparency: reduce) {
  :root { --material: #1c1c1e; --material-thick: #2c2c2e; }
  :is(.toolbar, .dock, .toast, .glass-button, .viewer__caption, .viewer__scrim, .drop-overlay) {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .viewer__scrim { background: #000; }
  .drop-overlay { background: rgb(0 0 0 / .9); }
}

@media (prefers-contrast: more) {
  :root {
    --label-2: rgb(235 235 245 / .82);
    --label-3: rgb(235 235 245 / .64);
    --material-edge: rgb(255 255 255 / .4);
    --separator: rgb(255 255 255 / .4);
  }
  .shot, .dropzone { box-shadow: inset 0 0 0 1px var(--material-edge); }
}
