:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1d2430;
  --muted: #5b6573;
  --accent: #1f6feb;
  --accent-dark: #1858c0;
  --danger: #d1242f;
  --ok: #1a7f37;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
}

.screen[hidden] { display: none !important; }

.center {
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
}

h1 { font-size: 1.6rem; line-height: 1.25; margin: 8px 0 16px; }
h2 { font-size: 1.25rem; line-height: 1.3; margin: 0 0 8px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}

.vacancy p { margin: 8px 0; color: var(--muted); }

label { display: block; font-weight: 600; margin: 4px 0 6px; }

input {
  width: 100%;
  font-family: inherit;
  font-size: 16px; /* prevents iOS zoom on focus */
  padding: 12px 14px;
  border: 1px solid #c9d1db;
  border-radius: 10px;
  margin-bottom: 14px;
  background: #fff;
  color: var(--text);
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }

.notice { font-size: .92rem; color: var(--muted); margin: 4px 0 14px; }
.error { color: var(--danger); font-weight: 600; margin: 0 0 12px; }
.error-big { color: var(--text); font-size: 1.1rem; max-width: 30em; }

.btn {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 14px 18px;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  touch-action: manipulation;
}
.btn:hover { background: var(--accent-dark); }
.btn:disabled { opacity: .55; cursor: default; }

.q-label { margin: 0 0 4px; color: var(--muted); font-weight: 600; }
.q-text { font-size: 1.3rem; margin-bottom: 12px; }

.video-box {
  position: relative;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  max-height: 45vh;
  margin: 0 auto 12px;
}
.video-box video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* mirror preview only; the recording itself is not mirrored */
  display: block;
}
.rec-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 20px);
  padding: 4px 10px 4px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: .85rem;
  font-weight: 600;
}
.rec-dot {
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--danger);
  animation: blink 1.2s infinite;
}
.btn-narrow { width: auto; min-width: 200px; margin-top: 8px; }
.btn[hidden] { display: none; }
@keyframes blink { 50% { opacity: .25; } }

.timer-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-weight: 600;
}
.timer { font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.timer.low { color: var(--danger); }

.progress {
  height: 6px;
  background: #dde3ea;
  border-radius: 3px;
  overflow: hidden;
  margin: 6px 0 10px;
}
.progress div { height: 100%; width: 100%; background: var(--accent); transition: width .25s linear; }

.hint { font-size: .9rem; color: var(--muted); margin: 0 0 14px; }

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid #d3dae3;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.check, .warn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 2rem;
  font-weight: 700;
}
.check { background: var(--ok); }
.check::after { content: ""; width: 14px; height: 28px; border: solid #fff; border-width: 0 5px 5px 0; transform: rotate(45deg) translate(-2px, -3px); }
.warn { background: var(--danger); }

@media (min-width: 700px) {
  .wrap { padding-top: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  .rec-dot, .spinner { animation-duration: 3s; }
}
