:root {
  color-scheme: dark;
  --bg: #0b1020;
  --panel: rgba(8, 15, 31, 0.95);
  --panel-soft: rgba(15, 23, 42, 0.82);
  --line: rgba(148, 163, 184, 0.24);
  --line-strong: rgba(148, 163, 184, 0.46);
  --text: #f8fafc;
  --muted: #94a3b8;
  --cyan: #38bdf8;
  --cyan-strong: #0ea5e9;
  --green: #22c55e;
  --red: #f87171;
  --amber: #fbbf24;
  --radius: 18px;
  --shadow: 0 24px 60px rgba(2, 6, 23, 0.58);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 12% -10%, rgba(14, 165, 233, 0.18), transparent 34rem),
    radial-gradient(circle at 100% 22%, rgba(37, 99, 235, 0.1), transparent 30rem),
    var(--bg);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button,
a,
select,
input[type="file"] {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--cyan);
  text-decoration: none;
}

a:hover {
  color: #7dd3fc;
}

.page-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 18px 14px 46px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 56px;
  margin-bottom: 18px;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.035em;
}

.brand span {
  color: var(--cyan);
}

.brand small {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.top-actions,
.button-row,
.status-row,
.race-tools,
.field-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: radial-gradient(circle at top left, rgba(30, 41, 59, 0.98), var(--panel) 58%);
  box-shadow: var(--shadow);
  padding: clamp(17px, 3vw, 26px);
  margin-bottom: 16px;
}

.card-subtle {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(2, 6, 23, 0.46);
  padding: 15px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--cyan);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 7px;
  font-size: clamp(1.65rem, 5vw, 2.55rem);
  line-height: 1.08;
}

h2 {
  margin-bottom: 6px;
  font-size: clamp(1.2rem, 3vw, 1.55rem);
}

h3 {
  margin-bottom: 5px;
  font-size: 1rem;
}

.muted,
.helper,
.event-description,
.athlete-secondary,
.empty-state p {
  color: var(--muted);
}

.helper {
  margin: 7px 0 0;
  font-size: 0.78rem;
  line-height: 1.45;
}

.event-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}

.event-hero.with-image {
  grid-template-columns: minmax(0, 1.5fr) minmax(220px, 0.7fr);
}

.event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 13px 0 0;
}

.meta-chip,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.7);
  font-size: 0.74rem;
  font-weight: 700;
}

.badge.live {
  border-color: rgba(34, 197, 94, 0.55);
  color: #bbf7d0;
  background: rgba(22, 101, 52, 0.25);
}

.badge.ready {
  border-color: rgba(56, 189, 248, 0.45);
  color: #bae6fd;
}

.badge.complete {
  color: #cbd5e1;
}

.badge.warning {
  border-color: rgba(251, 191, 36, 0.55);
  color: #fde68a;
}

.event-image-link,
.event-image-frame {
  display: block;
  min-height: 190px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #020617;
}

.event-image-link img,
.event-image-frame img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 190px;
  max-height: 280px;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.event-image-link:hover img {
  transform: scale(1.015);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 9px 16px;
  color: var(--text);
  background: rgba(15, 23, 42, 0.82);
  font-weight: 750;
  line-height: 1.15;
  cursor: pointer;
  touch-action: manipulation;
}

.btn:hover:not(:disabled) {
  border-color: rgba(125, 211, 252, 0.72);
  background: rgba(30, 41, 59, 0.95);
  color: #fff;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.btn-primary {
  border: 0;
  color: #06111f;
  background: linear-gradient(135deg, var(--cyan), var(--cyan-strong));
}

.btn-primary:hover:not(:disabled) {
  color: #020617;
  background: linear-gradient(135deg, #7dd3fc, var(--cyan));
}

.btn-danger {
  border-color: rgba(248, 113, 113, 0.5);
  color: #fecaca;
  background: rgba(127, 29, 29, 0.2);
}

.btn-small {
  min-height: 44px;
  padding: 7px 12px;
  font-size: 0.8rem;
}

.form-grid,
.filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.filter-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 7px;
}

.field-wide {
  grid-column: 1 / -1;
}

.field label,
.field-label {
  color: #cbd5e1;
  font-size: 0.78rem;
  font-weight: 750;
}

.input,
.select,
.time-input,
.bib-input,
.race-name-input {
  width: 100%;
  min-height: 44px;
  border: 1px solid #334155;
  border-radius: 10px;
  outline: none;
  padding: 9px 11px;
  color: var(--text);
  background: #0f172a;
}

.input:focus,
.select:focus,
.time-input:focus,
.bib-input:focus,
.race-name-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.16);
}

.input.invalid,
.time-input.invalid,
.bib-input.invalid {
  border-color: var(--red);
}

input[type="file"]::file-selector-button {
  min-height: 36px;
  border: 0;
  border-radius: 999px;
  margin-right: 10px;
  padding: 7px 12px;
  color: #06111f;
  background: var(--cyan);
  font-weight: 800;
  cursor: pointer;
}

.timer-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(300px, 0.88fr);
  gap: 16px;
  align-items: stretch;
}

.race-select-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-bottom: 12px;
}

.race-name-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.clock-panel {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  background:
    radial-gradient(circle at 50% 0%, rgba(56, 189, 248, 0.12), transparent 55%),
    rgba(2, 6, 23, 0.64);
}

.clock {
  width: 100%;
  margin: 8px 0 18px;
  overflow: hidden;
  color: #f8fafc;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: clamp(3rem, 10vw, 6.4rem);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  letter-spacing: -0.07em;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

.timer-actions {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(130px, 0.62fr) minmax(180px, 1.38fr);
  gap: 12px;
}

.timer-actions.start-only {
  grid-template-columns: 1fr;
}

.start-button,
.finish-button {
  min-height: 132px;
  border-radius: 16px;
  font-size: clamp(1.15rem, 4vw, 1.65rem);
  font-weight: 900;
  letter-spacing: 0.025em;
}

.timer-actions.start-only .start-button {
  min-height: 154px;
  font-size: clamp(1.45rem, 5vw, 2rem);
}

.start-button {
  border: 1px solid rgba(56, 189, 248, 0.55);
  color: #bae6fd;
  background: rgba(3, 105, 161, 0.26);
}

.finish-button {
  border: 0;
  color: #03140a;
  background: linear-gradient(145deg, #4ade80, #16a34a);
  box-shadow: 0 14px 32px rgba(22, 163, 74, 0.24);
}

.finish-button:active:not(:disabled),
.start-button:active:not(:disabled) {
  transform: translateY(1px) scale(0.995);
}

.queue-status {
  min-height: 22px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.76rem;
  text-align: center;
}

.compact-time-grid {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: -4px 0 18px;
}

.compact-time-grid > div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 9px;
  background: rgba(15, 23, 42, 0.72);
}

.compact-time-grid span,
.compact-time-grid strong {
  display: block;
}

.compact-time-grid span {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.compact-time-grid strong {
  overflow: hidden;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.focus-safety {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-top: 12px;
  padding: 10px 11px;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.72);
  font-size: 0.76rem;
  text-align: left;
}

.focus-safety.active {
  border-color: rgba(34, 197, 94, 0.38);
}

.focus-safety.warning {
  border-color: rgba(251, 191, 36, 0.62);
  color: #fde68a;
  background: rgba(120, 53, 15, 0.22);
}

.end-race-card {
  border-color: rgba(248, 113, 113, 0.38);
  margin-top: 30px;
}

.status-banner {
  display: none;
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 13px;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.88);
  font-size: 0.84rem;
}

.status-banner.visible {
  display: block;
}

.status-banner.error {
  border-color: rgba(248, 113, 113, 0.5);
  color: #fecaca;
  background: rgba(127, 29, 29, 0.22);
}

.status-banner.success {
  border-color: rgba(34, 197, 94, 0.45);
  color: #bbf7d0;
  background: rgba(20, 83, 45, 0.22);
}

.results-toolbar {
  border-top: 1px solid var(--line);
  margin-top: 16px;
  padding-top: 16px;
}

.result-list {
  margin-top: 14px;
}

.result-head,
.result-row {
  display: grid;
  grid-template-columns: 58px minmax(128px, 0.62fr) minmax(100px, 0.48fr) minmax(210px, 1.4fr) 110px;
  gap: 10px;
  align-items: center;
}

.result-head {
  padding: 0 12px 7px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.result-row {
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.69);
}

.place-cell,
.public-time {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-weight: 850;
}

.place-cell {
  color: #bae6fd;
  font-size: 1rem;
}

.time-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

.athlete-primary {
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.athlete-secondary {
  margin-top: 3px;
  overflow: hidden;
  font-size: 0.75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
}

.insert-control {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 2px 8px;
}

.insert-control::before,
.insert-control::after {
  height: 1px;
  background: rgba(56, 189, 248, 0.17);
  content: "";
}

.insert-button {
  min-height: 44px;
  border: 0;
  padding: 3px 9px;
  color: #7dd3fc;
  background: transparent;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
}

.insert-button:hover {
  color: #e0f2fe;
}

.public-race-card {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 14px;
  background: rgba(2, 6, 23, 0.4);
}

.public-race-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 10px;
}

.public-start-grid {
  width: auto;
  min-width: min(250px, 100%);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}

.public-result {
  display: grid;
  grid-template-columns: 56px minmax(116px, 0.55fr) minmax(64px, 0.35fr) minmax(190px, 1.3fr) minmax(100px, 0.58fr) minmax(72px, 0.36fr);
  gap: 11px;
  align-items: center;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
  padding: 12px 8px;
}

.public-result:first-child {
  border-top: 0;
}

.public-time {
  font-size: 1rem;
}

.public-bib {
  color: #cbd5e1;
  font-weight: 800;
}

.public-demographic {
  color: var(--muted);
  font-size: 0.78rem;
}

.public-photo {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

.photo-finish-button {
  display: block;
  width: 72px;
  min-height: 48px;
  overflow: hidden;
  border: 1px solid rgba(125, 211, 252, 0.38);
  border-radius: 9px;
  padding: 0;
  background: #020617;
  box-shadow: 0 5px 14px rgba(2, 6, 23, 0.28);
  cursor: pointer;
}

.photo-finish-button:hover {
  border-color: rgba(125, 211, 252, 0.8);
  transform: translateY(-1px);
}

.photo-finish-button img {
  display: block;
  width: 100%;
  height: 48px;
  object-fit: cover;
}

.photo-finish-button span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.photo-finish-pending {
  color: #bae6fd;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: right;
}

.photo-finish-dialog {
  width: min(960px, calc(100vw - 24px));
  max-width: none;
  max-height: calc(100dvh - 24px);
  border: 1px solid var(--line-strong);
  border-radius: 17px;
  padding: 0;
  color: var(--text);
  background: #070d1c;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.64);
}

.photo-finish-dialog::backdrop {
  background: rgba(2, 6, 23, 0.86);
  backdrop-filter: blur(5px);
}

.photo-finish-dialog-card {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.photo-finish-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.photo-finish-dialog-head h2,
.photo-finish-dialog-head p,
.photo-finish-caption {
  margin: 0;
}

.photo-finish-dialog img {
  display: block;
  width: 100%;
  max-height: calc(100dvh - 160px);
  border-radius: 11px;
  background: #020617;
  object-fit: contain;
}

.photo-finish-caption {
  color: #cbd5e1;
  font-size: 0.82rem;
  text-align: center;
}

body.photo-finish-open {
  overflow: hidden;
}

.empty-state,
.loading-state {
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  padding: 28px 18px;
  text-align: center;
}

.empty-state h3 {
  margin-bottom: 7px;
}

.loading-state {
  margin-top: 12vh;
  color: #cbd5e1;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.11);
}

details.config-panel {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

details.config-panel summary {
  min-height: 44px;
  color: #cbd5e1;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
}

.config-content {
  padding-top: 8px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  color: #cbd5e1;
  font-size: 0.82rem;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--cyan);
}

.footer {
  margin-top: 24px;
  color: #64748b;
  font-size: 0.72rem;
  text-align: center;
}

.mobile-label {
  display: none;
}

:focus-visible {
  outline: 3px solid rgba(125, 211, 252, 0.8);
  outline-offset: 2px;
}

@media (max-width: 860px) {
  .event-hero.with-image,
  .timer-layout {
    grid-template-columns: 1fr;
  }

  .event-image-link img,
  .event-image-frame img {
    max-height: 230px;
  }

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

  .public-result {
    grid-template-columns: 50px minmax(104px, 0.55fr) 60px minmax(160px, 1.3fr) 90px 72px;
  }
}

@media (max-width: 680px) {
  .page-shell {
    padding: 12px 10px 34px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 12px;
  }

  .top-actions {
    width: 100%;
  }

  .top-actions .btn {
    flex: 1;
  }

  .section-head {
    flex-direction: column;
    margin-bottom: 14px;
  }

  .section-head .button-row {
    width: 100%;
  }

  .section-head .button-row .btn,
  .button-row.mobile-full .btn {
    flex: 1;
  }

  .card {
    border-radius: 15px;
    padding: 16px 13px;
  }

  .form-grid,
  .filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 11px;
  }

  .timer-actions {
    grid-template-columns: 0.72fr 1.28fr;
  }

  .start-button,
  .finish-button {
    min-height: 148px;
  }

  .clock-panel {
    padding: 17px 10px;
  }

  .clock {
    font-size: clamp(2.9rem, 17vw, 5rem);
  }

  .end-race-card {
    min-height: 220px;
    margin-top: 56px;
    padding-top: 28px;
  }

  .result-head {
    display: none;
  }

  .result-row {
    grid-template-columns: 54px minmax(0, 1fr) minmax(0, 0.78fr);
    grid-template-areas:
      "place athlete athlete"
      "time time bib"
      "actions actions actions";
    gap: 8px;
    padding: 12px;
  }

  .result-row .place-cell {
    grid-area: place;
  }

  .result-row .time-cell {
    grid-area: time;
  }

  .result-row .bib-cell {
    grid-area: bib;
  }

  .result-row .athlete-cell {
    min-width: 0;
    grid-area: athlete;
  }

  .result-row .row-actions {
    grid-area: actions;
  }

  .result-row .row-actions .btn {
    width: 100%;
  }

  .mobile-label {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 0.64rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
  }

  .public-race-card {
    padding: 11px;
  }

  .public-result {
    grid-template-columns: 50px minmax(0, 1fr) auto;
    grid-template-areas:
      "place athlete time"
      "bib athlete demographic";
    gap: 5px 9px;
    padding: 12px 4px;
  }

  .public-result .place-cell {
    grid-area: place;
  }

  .public-result .public-time {
    grid-area: time;
    text-align: right;
  }

  .public-result .public-bib {
    grid-area: bib;
  }

  .public-result .public-athlete {
    min-width: 0;
    grid-area: athlete;
  }

  .public-result .public-demographic {
    grid-area: demographic;
    text-align: right;
  }

  .public-result.has-photo {
    grid-template-areas:
      "place athlete time"
      "bib athlete demographic"
      "photo photo photo";
  }

  .public-result .public-photo {
    justify-content: flex-start;
    grid-area: photo;
  }

  .photo-finish-button {
    width: 92px;
    min-height: 52px;
  }

  .photo-finish-button img {
    height: 52px;
  }

  .photo-finish-pending {
    min-height: 30px;
    padding-top: 8px;
    text-align: left;
  }

  .photo-finish-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
  }

  .photo-finish-dialog-card {
    padding: 10px;
  }

  .photo-finish-dialog img {
    max-height: calc(100dvh - 154px);
  }
}

@media (max-width: 430px) {
  .brand small {
    display: none;
  }

  .race-select-row,
  .race-name-row {
    grid-template-columns: 1fr;
  }

  .race-select-row .btn,
  .race-name-row .btn {
    width: 100%;
  }

  .filter-grid {
    grid-template-columns: 1fr 1fr;
  }

  .timer-actions {
    grid-template-columns: 1fr;
  }

  .start-button {
    min-height: 170px;
  }

  .finish-button {
    min-height: 190px;
    font-size: 1.8rem;
  }

  .focus-safety {
    align-items: stretch;
    flex-direction: column;
  }

  .focus-safety .btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

.photo-finish-control {
  display: grid;
  gap: 12px;
  margin-top: 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px;
  background: rgba(2, 6, 23, 0.55);
  text-align: left;
}

.photo-finish-control.enabled {
  border-color: rgba(56, 189, 248, 0.42);
}

.photo-finish-heading,
.photo-finish-actions,
.camera-dock-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.photo-finish-heading > div {
  display: grid;
  gap: 3px;
}

.photo-finish-heading span:not(.badge) {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.4;
}

.photo-finish-actions .field {
  min-width: min(100%, 270px);
  flex: 1;
}

.photo-finish-actions .field > span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 750;
}

.camera-dock {
  position: fixed;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 30;
  width: min(290px, calc(100vw - 24px));
  border: 1px solid rgba(56, 189, 248, 0.5);
  border-radius: 15px;
  padding: 10px;
  color: var(--text);
  background: rgba(2, 6, 23, 0.96);
  box-shadow: var(--shadow);
}

.camera-dock[hidden] {
  display: none;
}

.camera-dock video {
  display: block;
  width: 100%;
  max-height: 170px;
  margin-top: 8px;
  border-radius: 10px;
  background: #000;
  object-fit: cover;
}

.camera-dock p {
  margin: 7px 2px 0;
  color: var(--muted);
  font-size: 0.7rem;
}

@media (max-width: 860px) {
  .photo-finish-heading,
  .photo-finish-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .photo-finish-actions .field,
  .photo-finish-actions .btn {
    width: 100%;
  }

  .camera-dock {
    top: 0;
    right: 0;
    bottom: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    border: 0;
    padding: 0;
    opacity: 0.01;
    pointer-events: none;
  }

  .camera-dock-head strong,
  .camera-dock p {
    display: none;
  }

  .camera-dock video {
    width: 1px;
    height: 1px;
    max-height: 1px;
    margin-top: 0;
  }
}
