:root {
  --page: #f6f8fc;
  --surface: #ffffff;
  --surface-soft: #f8faff;
  --border: #dfe5ef;
  --border-strong: #cbd5e4;
  --text: #111d36;
  --muted: #63708a;
  --blue: #2f73f1;
  --blue-dark: #1f5fd2;
  --blue-soft: #edf4ff;
  --green: #16b86a;
  --red: #e9515d;
  --amber: #e79b22;
  --shadow: 0 16px 42px rgba(24, 46, 89, 0.08);
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 88% 4%, rgba(72, 132, 255, 0.1), transparent 24rem),
    linear-gradient(180deg, #fbfcff 0%, var(--page) 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
a {
  font: inherit;
}

button,
a,
label {
  -webkit-tap-highlight-color: transparent;
}

.page-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 30px 0 26px;
}

.site-header {
  position: relative;
  min-height: 188px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 24px 8px 30px;
  overflow: hidden;
}

.brand-block {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.app-mark {
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: linear-gradient(145deg, #3e87ff, #2162e6);
  box-shadow: 0 12px 26px rgba(47, 115, 241, 0.25);
  color: #fff;
}

.app-mark svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.brand-block h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.04;
  letter-spacing: -0.035em;
}

.brand-block p {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.45;
}

.header-visual {
  position: relative;
  width: 360px;
  height: 150px;
  flex: 0 0 360px;
}

.visual-window {
  position: absolute;
  top: 7px;
  left: 72px;
  width: 220px;
  padding: 11px;
  border: 1px solid #cfe0fb;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 18px 40px rgba(47, 115, 241, 0.12);
  backdrop-filter: blur(8px);
}

.visual-window-bar {
  display: flex;
  gap: 5px;
  margin-bottom: 10px;
}

.visual-window-bar span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #5a8df2;
}

.visual-window-bar span:nth-child(2) { opacity: 0.7; }
.visual-window-bar span:nth-child(3) { opacity: 0.4; }

.visual-window-body {
  height: 92px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(145deg, #f3f7ff, #eaf2ff);
}

.record-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 8px;
  color: #fff;
  background: var(--blue);
  font-weight: 750;
  box-shadow: 0 8px 18px rgba(47, 115, 241, 0.22);
}

.record-pill i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
}

.floating-chip {
  position: absolute;
  z-index: 2;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 8px solid rgba(255, 255, 255, 0.95);
  background: var(--blue-soft);
  color: var(--blue);
  box-shadow: 0 12px 24px rgba(38, 89, 186, 0.12);
}

.floating-chip svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.microphone-chip {
  top: 42px;
  left: 24px;
}

.webcam-chip {
  top: 76px;
  right: 4px;
}

.dot-pattern {
  position: absolute;
  right: 6px;
  top: 20px;
  width: 78px;
  height: 62px;
  opacity: 0.35;
  background-image: radial-gradient(circle, #8db7ff 1.5px, transparent 1.5px);
  background-size: 10px 10px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.setup-panel,
.status-panel,
.preview-panel {
  padding: 24px;
}

.panel-heading h2,
.status-heading h2 {
  margin-bottom: 0;
  font-size: 1.15rem;
  letter-spacing: -0.015em;
}

.mode-picker {
  padding: 0;
  margin: 20px 0 0;
  border: 0;
}

.mode-picker legend {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

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

.mode-card {
  position: relative;
  min-height: 182px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 23px 16px 19px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: #fff;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.mode-card:hover {
  transform: translateY(-2px);
  border-color: #8ab3ff;
  box-shadow: 0 12px 24px rgba(48, 98, 195, 0.08);
}

.mode-card:has(input:checked) {
  border-color: var(--blue);
  background: linear-gradient(180deg, #fff, #fbfdff);
  box-shadow:
    inset 0 0 0 1px var(--blue),
    0 10px 24px rgba(47, 115, 241, 0.1);
}

.mode-card:focus-within {
  outline: 3px solid rgba(47, 115, 241, 0.2);
  outline-offset: 3px;
}

.mode-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.selection-indicator {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 20px;
  height: 20px;
  border: 2px solid #cbd5e4;
  border-radius: 50%;
}

.mode-card:has(input:checked) .selection-indicator {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 4px #fff;
  background: var(--blue);
}

.mode-icon {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-bottom: 13px;
  color: var(--blue);
}

.mode-icon::before {
  content: "";
  position: absolute;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: var(--blue-soft);
  z-index: 0;
}

.mode-icon svg {
  position: relative;
  z-index: 1;
  width: 32px;
  height: 32px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.paired-icons svg {
  width: 27px;
  height: 27px;
}

.mode-card strong {
  margin-bottom: 8px;
  font-size: 0.98rem;
}

.mode-card > span:last-child {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

button,
#downloadLink {
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 720;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
}

.primary-button {
  color: #fff;
  background: linear-gradient(180deg, #347bf6, #286be8);
  box-shadow: 0 10px 22px rgba(47, 115, 241, 0.2);
}

.secondary-button {
  color: #4e5c74;
  background: #fff;
  border-color: var(--border-strong);
}

button:hover:not(:disabled),
#downloadLink:hover {
  transform: translateY(-1px);
}

.primary-button:hover:not(:disabled) {
  background: linear-gradient(180deg, #2f73f1, #205ed3);
  box-shadow: 0 12px 24px rgba(47, 115, 241, 0.25);
}

.secondary-button:hover:not(:disabled) {
  border-color: #96a7bf;
  background: #f9fbff;
}

button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

button:focus-visible,
#downloadLink:focus-visible,
.footer a:focus-visible {
  outline: 3px solid rgba(47, 115, 241, 0.24);
  outline-offset: 3px;
}

.record-button-icon {
  width: 17px;
  height: 17px;
  border: 5px solid #fff;
  border-radius: 50%;
}

.stop-button-icon {
  width: 15px;
  height: 15px;
  border-radius: 2px;
  background: currentColor;
}

.inline-message {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  margin-top: 13px;
  color: var(--muted);
}

.inline-message svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  margin-top: 2px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.inline-message p {
  margin-bottom: 0;
  font-size: 0.84rem;
  line-height: 1.45;
}

.inline-message p[data-type="recording"] { color: #c53d49; font-weight: 650; }
.inline-message p[data-type="success"] { color: #128451; font-weight: 650; }
.inline-message p[data-type="warning"] { color: #a96a10; }
.inline-message p[data-type="error"] { color: #c53d49; font-weight: 650; }

.status-panel {
  align-self: stretch;
}

.status-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.state-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--green);
  font-size: 0.84rem;
  font-weight: 700;
}

.state-label i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px rgba(22, 184, 106, 0.1);
}

.status-panel[data-state="recording"] .state-label { color: var(--red); }
.status-panel[data-state="preparing"] .state-label,
.status-panel[data-state="finalizing"] .state-label { color: var(--amber); }
.status-panel[data-state="error"] .state-label { color: var(--red); }

.stats-list {
  margin: 0;
}

.stats-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 0;
  border-bottom: 1px solid #edf0f5;
}

.stats-list dt {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #4f5c73;
  font-size: 0.9rem;
}

.stats-list dt svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: #65738c;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stats-list dd {
  margin: 0;
  color: #24324b;
  font-size: 0.9rem;
  font-weight: 650;
  text-align: right;
}

.format-note {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  margin-top: 18px;
  padding-top: 2px;
}

.info-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--blue);
  background: var(--blue-soft);
  font-family: Georgia, serif;
  font-weight: 700;
}

.format-note p {
  margin-bottom: 0;
  color: #4e5b72;
  font-size: 0.86rem;
  line-height: 1.55;
}

.preview-panel {
  margin-top: 18px;
}

.preview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 24px;
  margin-top: 16px;
}

.video-shell {
  position: relative;
  min-height: 300px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, #212733, #10151d);
  border: 1px solid #202834;
}

video {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  max-height: 520px;
  background: #0d1118;
}

.hidden {
  display: none;
}

.preview-placeholder {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 26px;
  color: #b8c1d0;
  text-align: center;
}

#finalPreview:not(.hidden) + .preview-placeholder {
  display: none;
}

.play-placeholder {
  width: 70px;
  height: 70px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.24);
  color: #fff;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.2);
}

.play-placeholder svg {
  width: 32px;
  height: 32px;
  fill: currentColor;
}

.preview-placeholder p {
  margin-bottom: 0;
  font-size: 0.9rem;
}

.download-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  padding: 24px;
  border: 1px dashed #d5ddea;
  border-radius: 12px;
  background: var(--surface-soft);
  text-align: center;
}

.download-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  color: #71809a;
}

.download-icon svg {
  width: 44px;
  height: 44px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.download-panel h3 {
  margin-bottom: 7px;
  font-size: 1rem;
}

.download-panel p {
  max-width: 200px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

#downloadLink {
  display: none;
  width: 100%;
  color: var(--blue-dark);
  background: #eaf2ff;
  border-color: #cfe0ff;
}

#downloadLink:hover {
  background: #dfeaff;
  border-color: #b8d0ff;
}

#countdownOverlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: rgba(8, 18, 36, 0.78);
  backdrop-filter: blur(8px);
  font-size: clamp(5rem, 14vw, 9rem);
  font-weight: 800;
  letter-spacing: -0.05em;
}

@media (max-width: 980px) {
  .site-header {
    min-height: auto;
  }

  .header-visual {
    width: 300px;
    flex-basis: 300px;
    transform: scale(0.9);
    transform-origin: right center;
  }

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

  .status-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 0.7fr);
    gap: 24px;
  }

  .status-heading {
    grid-column: 1 / -1;
  }

  .format-note {
    align-content: start;
    margin-top: 0;
    padding: 16px;
    border-radius: 12px;
    background: var(--surface-soft);
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 20px, 1120px);
    padding-top: 12px;
  }

  .site-header {
    padding: 20px 10px 22px;
  }

  .header-visual {
    display: none;
  }

  .brand-block {
    gap: 14px;
  }

  .app-mark {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
  }

  .brand-block h1 {
    font-size: clamp(1.65rem, 8vw, 2.25rem);
  }

  .brand-block p {
    font-size: 0.92rem;
  }

  .setup-panel,
  .status-panel,
  .preview-panel {
    padding: 18px;
  }

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

  .mode-card {
    min-height: 132px;
    align-items: flex-start;
    padding: 18px 54px 18px 84px;
    text-align: left;
  }

  .mode-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
  }

  .mode-icon::before {
    width: 52px;
    height: 52px;
  }

  .mode-icon svg {
    width: 26px;
    height: 26px;
  }

  .paired-icons {
    gap: 0;
  }

  .paired-icons svg {
    width: 20px;
    height: 20px;
    margin-left: -4px;
  }

  .action-row {
    grid-template-columns: 1fr;
  }

  .inline-message {
    justify-content: flex-start;
  }

  .status-panel {
    display: block;
  }

  .format-note {
    margin-top: 18px;
    padding: 0;
    background: transparent;
  }

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

  .video-shell,
  .download-panel {
    min-height: 230px;
  }

  .download-panel {
    min-height: 220px;
  }
}

@media (max-width: 420px) {
  .brand-block {
    align-items: center;
  }

  .brand-block p:last-child {
    display: none;
  }

  .setup-panel,
  .status-panel,
  .preview-panel {
    padding: 16px;
  }

  .mode-card {
    padding-left: 74px;
  }

  .stats-list > div {
    align-items: flex-start;
  }
}

/* Refined mode graphics and compact download card */
.mode-icon {
  min-height: 62px;
  gap: 0;
  margin-bottom: 12px;
}

.mode-icon::before {
  display: none;
}

.icon-orb {
  position: relative;
  z-index: 1;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  flex: 0 0 58px;
  border-radius: 50%;
  color: var(--blue);
  background: linear-gradient(145deg, #f3f7ff 0%, #e9f1ff 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 8px 18px rgba(47, 115, 241, 0.08);
}

.filled-mode-icon {
  width: 32px;
  height: 32px;
  overflow: visible;
}

.mode-icon-duo {
  min-width: 98px;
  justify-content: center;
}

.mode-icon-duo .icon-orb {
  width: 52px;
  height: 52px;
  flex-basis: 52px;
}

.mode-icon-duo .icon-orb + .icon-orb {
  margin-left: -8px;
}

.mode-icon-duo .filled-mode-icon {
  width: 28px;
  height: 28px;
}

.preview-grid {
  grid-template-columns: minmax(0, 1fr) 224px;
  align-items: center;
}

.download-panel {
  align-self: center;
  min-height: 0;
  padding: 28px 20px;
  text-align: center;
}

.download-panel > * {
  margin-left: auto;
  margin-right: auto;
}

.download-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 13px;
}

.download-icon svg {
  width: 40px;
  height: 40px;
}

.download-panel h3 {
  width: 100%;
  margin-bottom: 7px;
  text-align: center;
}

.download-panel p {
  width: 100%;
  max-width: 190px;
  margin-bottom: 17px;
  text-align: center;
}

#downloadLink {
  width: auto;
  min-width: 184px;
  max-width: 100%;
  padding-right: 18px;
  padding-left: 18px;
  text-align: center;
}

@media (max-width: 760px) {
  .mode-icon {
    min-height: 0;
  }

  .icon-orb {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
  }

  .filled-mode-icon {
    width: 28px;
    height: 28px;
  }

  .mode-icon-duo {
    min-width: 64px;
    gap: 0;
  }

  .mode-icon-duo .icon-orb {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
  }

  .mode-icon-duo .icon-orb + .icon-orb {
    margin-left: -13px;
  }

  .mode-icon-duo .filled-mode-icon {
    width: 23px;
    height: 23px;
  }

  .download-panel {
    min-height: 0;
    padding: 26px 20px;
  }
}

.mode-icon .filled-mode-icon {
  fill: initial;
  stroke: none;
  stroke-width: 0;
}

/* Product footer and legal pages */
.footer {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px 32px;
  margin-top: 24px;
  padding: 24px 2px 4px;
  border-top: 1px solid var(--border);
  color: var(--muted);
}

.footer-brand {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  font-size: 0.86rem;
  line-height: 1.5;
}

.footer-brand strong {
  color: var(--text);
  font-size: 0.92rem;
  white-space: nowrap;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px 18px;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--blue-dark);
  font-size: 0.86rem;
  font-weight: 650;
  line-height: 1.5;
  text-decoration: none;
  white-space: nowrap;
}

.footer-links a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer-links a[aria-current="page"] {
  color: var(--text);
}

.footer-links svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.legal-page .page-shell {
  width: min(860px, calc(100% - 32px));
}

.legal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 0 30px;
}

.legal-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 750;
  text-decoration: none;
}

.legal-brand img {
  width: 38px;
  height: 38px;
  border-radius: 9px;
}

.back-link {
  color: var(--blue-dark);
  font-weight: 650;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

.legal-content {
  padding: clamp(28px, 5vw, 52px);
}

.legal-content h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: -0.035em;
}

.legal-updated {
  margin-bottom: 34px;
  color: var(--muted);
}

.legal-content h2 {
  margin: 30px 0 10px;
  font-size: 1.2rem;
}

.legal-content p,
.legal-content li {
  color: #45536d;
  line-height: 1.75;
}

.legal-content ul {
  padding-left: 22px;
}

.legal-content a {
  color: var(--blue-dark);
}

@media (max-width: 640px) {
  .footer {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 14px;
  }

  .footer-links {
    justify-content: flex-start;
  }

  .legal-header {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* SEO content, guides and article pages */
.hero-kicker,
.section-kicker {
  margin-bottom: 8px;
  color: var(--blue-dark) !important;
  font-size: 0.78rem !important;
  font-weight: 800;
  letter-spacing: 0.11em;
  line-height: 1.3;
  text-transform: uppercase;
}

.seo-content {
  display: grid;
  gap: 22px;
  margin-top: 22px;
}

.seo-intro,
.how-section,
.faq-section {
  padding: clamp(26px, 4vw, 42px);
}

.seo-intro {
  text-align: center;
}

.seo-intro h2,
.how-section h2,
.guides-section h2,
.faq-section h2 {
  margin-bottom: 12px;
  font-size: clamp(1.55rem, 3vw, 2.25rem);
  letter-spacing: -0.03em;
  line-height: 1.16;
}

.seo-intro > p:last-child {
  max-width: 800px;
  margin: 0 auto;
  color: #4f5d75;
  font-size: 1rem;
  line-height: 1.75;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.feature-card {
  position: relative;
  min-height: 220px;
  padding: 24px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(24, 46, 89, 0.05);
}

.feature-number {
  display: block;
  margin-bottom: 32px;
  color: #a9b7cc;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.feature-card h3 {
  margin-bottom: 10px;
  font-size: 1.05rem;
}

.feature-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.65;
}

.how-section {
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) minmax(0, 1.28fr);
  gap: 42px;
  align-items: start;
}

.how-section > div > p:last-child {
  color: var(--muted);
  line-height: 1.65;
}

.steps-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.steps-list li {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 14px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}

.steps-list li:first-child { padding-top: 0; }
.steps-list li:last-child { padding-bottom: 0; border-bottom: 0; }

.steps-list li > span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--blue-dark);
  background: var(--blue-soft);
  font-weight: 800;
}

.steps-list strong { display: block; margin-bottom: 5px; }
.steps-list p { margin: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.55; }

.guides-section {
  padding: 18px 0 4px;
}

.section-heading-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.text-link {
  color: var(--blue-dark);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.text-link:hover { text-decoration: underline; text-underline-offset: 3px; }

.guide-grid,
.article-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.guide-card,
.article-card {
  display: block;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 12px 30px rgba(24, 46, 89, 0.05);
  color: var(--text);
  text-decoration: none;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.guide-card:hover,
.article-card:hover {
  transform: translateY(-2px);
  border-color: #9bbcff;
  box-shadow: 0 16px 34px rgba(47, 115, 241, 0.09);
}

.guide-card > span,
.article-card > span {
  display: block;
  margin-bottom: 16px;
  color: var(--blue-dark);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.guide-card h3,
.article-card h2 {
  margin-bottom: 9px;
  font-size: 1.08rem;
  line-height: 1.35;
}

.guide-card p,
.article-card p {
  margin: 0;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.6;
}

.faq-section {
  display: grid;
  grid-template-columns: minmax(220px, .62fr) minmax(0, 1.38fr);
  gap: 40px;
}

.faq-intro p:last-child { color: var(--muted); line-height: 1.65; }
.faq-intro a,
.article-content a { color: var(--blue-dark); }

.faq-list,
.long-faq {
  display: grid;
  gap: 10px;
}

.faq-list details,
.long-faq details {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
}

.faq-list summary,
.long-faq summary {
  padding: 16px 18px;
  cursor: pointer;
  font-weight: 700;
}

.faq-list details p,
.long-faq details p {
  margin: 0;
  padding: 0 18px 18px;
  color: var(--muted);
  line-height: 1.65;
}

.content-page .page-shell {
  width: min(940px, calc(100% - 32px));
}

.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 0 28px;
}

.content-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px 20px;
}

.content-nav a {
  color: #4b5971;
  font-size: .9rem;
  font-weight: 680;
  text-decoration: none;
}

.content-nav a:hover { color: var(--blue-dark); }

.article-content {
  padding: clamp(30px, 5vw, 56px);
}

.article-content h1 {
  max-width: 760px;
  margin-bottom: 16px;
  font-size: clamp(2rem, 5vw, 3.4rem);
  letter-spacing: -.045em;
  line-height: 1.08;
}

.article-lead {
  max-width: 760px;
  margin-bottom: 36px;
  color: #53617a;
  font-size: 1.08rem;
  line-height: 1.75;
}

.article-content > h2 {
  margin: 34px 0 10px;
  font-size: 1.35rem;
  letter-spacing: -.015em;
}

.article-content > p,
.article-content > ol,
.article-content > ul {
  color: #45536d;
  line-height: 1.78;
}

.article-content > ol,
.article-content > ul { padding-left: 24px; }
.article-content li + li { margin-top: 8px; }

.article-card-grid { margin-top: 30px; }

.article-cta,
.checklist,
.related-links {
  margin-top: 38px;
  padding: 26px;
  border-radius: 16px;
  background: linear-gradient(145deg, #f5f8ff, #edf4ff);
  border: 1px solid #d5e3fb;
}

.article-cta h2,
.checklist h2,
.related-links h2 { margin-bottom: 8px; font-size: 1.25rem; }
.article-cta p { color: var(--muted); line-height: 1.65; }

.primary-link-button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 6px;
  padding: 0 20px;
  border-radius: 10px;
  color: #fff !important;
  background: var(--blue);
  font-weight: 750;
  text-decoration: none;
}

.primary-link-button:hover { background: var(--blue-dark); }

.related-links {
  display: grid;
  gap: 10px;
}

.related-links h2 { margin-bottom: 4px; }
.related-links a { font-weight: 650; }

.article-note {
  margin-top: 28px;
  padding: 18px 20px;
  border-left: 4px solid var(--blue);
  background: var(--blue-soft);
}

@media (max-width: 900px) {
  .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .how-section,
  .faq-section { grid-template-columns: 1fr; gap: 24px; }
  .guide-grid,
  .article-card-grid { grid-template-columns: 1fr; }
  .section-heading-row { align-items: flex-start; flex-direction: column; gap: 4px; }
  .content-header { align-items: flex-start; flex-direction: column; }
  .content-nav { justify-content: flex-start; }
}

@media (max-width: 520px) {
  .feature-grid { grid-template-columns: 1fr; }
  .feature-card { min-height: 0; }
  .seo-intro,
  .how-section,
  .faq-section,
  .article-content { padding: 24px 18px; }
}


/* Browser compatibility guidance */
.browser-compatibility-notice {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid #f2cd7d;
  border-radius: 14px;
  background: #fff8e7;
  color: #5d4717;
}

.browser-compatibility-notice[hidden] {
  display: none !important;
}

.browser-notice-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #ffe3a3;
  color: #765711;
  font-family: Georgia, serif;
  font-weight: 700;
}

.browser-compatibility-notice strong {
  display: block;
  margin-bottom: 3px;
  color: #4c390f;
  font-size: 0.9rem;
}

.browser-compatibility-notice p {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.5;
}

/* The lower preview area is shared by the live webcam and completed recording. */
.preview-panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.preview-subtitle {
  max-width: 720px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.preview-state-label {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef3fb;
  color: #5b6678;
  font-size: 0.75rem;
  font-weight: 750;
}

.preview-state-label[data-state="live"] {
  background: #e8f7ee;
  color: #19703d;
}

.preview-state-label[data-state="finalizing"] {
  background: var(--blue-soft);
  color: var(--blue);
}

.preview-state-label[data-state="ready"] {
  background: #e8f7ee;
  color: #19703d;
}

.webcam-preview-card {
  position: absolute;
  z-index: 3;
  inset: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border-radius: inherit;
  background: #0b1220;
}

.webcam-preview-card[hidden] {
  display: none !important;
}

.webcam-preview-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.97);
  color: var(--text);
  font-size: 0.82rem;
}

.webcam-preview-heading strong::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 50%;
  background: #24a148;
  vertical-align: 1px;
}

.webcam-preview-heading span {
  color: var(--muted);
  font-size: 0.76rem;
}

.webcam-preview-card video {
  width: 100%;
  height: 100%;
  max-height: none;
  background: #05080d;
  object-fit: contain;
}

.webcam-preview-card:not([hidden]) ~ .preview-placeholder {
  display: none;
}

@media (max-width: 640px) {
  .preview-panel-heading {
    flex-direction: column;
    gap: 10px;
  }

  .browser-compatibility-notice {
    grid-template-columns: 30px minmax(0, 1fr);
    padding: 13px 14px;
  }
}

/* Screenio consent controls */
.consent-banner {
  position: fixed;
  z-index: 10000;
  right: 20px;
  bottom: 20px;
  left: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: 1040px;
  margin: 0 auto;
  padding: 18px 20px;
  border: 1px solid #cbd8ed;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 48px rgba(24, 46, 84, 0.2);
  color: var(--text);
}

.consent-banner[hidden],
.consent-settings-button[hidden] {
  display: none !important;
}

.consent-copy {
  max-width: 700px;
}

.consent-copy strong {
  display: block;
  margin-bottom: 5px;
  font-size: 1rem;
}

.consent-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.consent-copy a {
  white-space: nowrap;
  font-weight: 650;
}

.consent-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
}

.consent-button,
.consent-settings-button {
  min-height: 42px;
  border: 1px solid #aebed8;
  border-radius: 10px;
  padding: 0 16px;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
}

.consent-reject {
  background: #fff;
  color: var(--text);
}

.consent-accept {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.consent-button:hover,
.consent-settings-button:hover {
  transform: translateY(-1px);
}

.consent-button:focus-visible,
.consent-settings-button:focus-visible {
  outline: 3px solid rgba(47, 115, 241, 0.28);
  outline-offset: 2px;
}

.consent-settings-button {
  position: fixed;
  z-index: 9999;
  right: 16px;
  bottom: 16px;
  min-height: 38px;
  padding: 0 13px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  box-shadow: 0 8px 24px rgba(24, 46, 84, 0.15);
}

@media (max-width: 700px) {
  .consent-banner {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
  }

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

@media (max-width: 420px) {
  .consent-actions {
    grid-template-columns: 1fr;
  }
}
/* End Screenio consent controls */



/* 2026-08-07 preview/download and status layout cleanup */
.status-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.status-heading h2 {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
}

.state-label {
  flex: 0 0 auto;
  white-space: nowrap;
  text-align: right;
}

.preview-panel-heading {
  display: block;
}

.preview-state-label {
  display: none !important;
}

.preview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}

.download-panel {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: 100%;
  min-height: 0;
  padding: 14px 16px;
  border: 1px solid #d5ddea;
  border-radius: 12px;
  background: var(--surface-soft);
  text-align: left;
}

.download-panel[hidden] {
  display: none !important;
}

.download-copy {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.download-icon {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  margin: 0;
}

.download-icon svg {
  width: 32px;
  height: 32px;
}

.download-panel h3 {
  width: auto;
  margin: 0 0 3px;
  text-align: left;
  font-size: 0.95rem;
}

.download-panel p {
  width: auto;
  max-width: none;
  margin: 0;
  text-align: left;
  font-size: 0.82rem;
}

#downloadLink {
  flex: 0 0 auto;
  width: auto;
  min-width: 190px;
  max-width: 100%;
  align-items: center;
  justify-content: center;
  padding: 11px 18px;
  margin: 0;
  text-align: center;
}

@media (max-width: 640px) {
  .status-heading {
    gap: 10px;
  }

  .status-heading h2 {
    font-size: 1.05rem;
  }

  .state-label {
    font-size: 0.78rem;
  }

  .download-panel {
    flex-direction: column;
    align-items: stretch;
  }

  .download-copy {
    align-items: flex-start;
  }

  #downloadLink {
    width: 100%;
  }
}


/* Layout refresh: webcam side panel, moved status bar, and final result below */
.single-action-row {
  grid-template-columns: minmax(220px, 320px);
  justify-content: start;
}

.mode-card:has(input:disabled) {
  opacity: 0.7;
  cursor: not-allowed;
}

.mode-card:has(input:disabled):hover {
  transform: none;
  box-shadow: none;
}

.recording-stage-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.recording-stage-layout.has-webcam-panel {
  grid-template-columns: minmax(0, 1fr) 300px;
}

.stage-panel,
.webcam-panel,
.relocated-status-panel,
.result-panel {
  padding: 24px;
}

.stage-shell {
  margin-top: 16px;
  min-height: 320px;
  border: 1px solid #202834;
  border-radius: 16px;
  background: linear-gradient(145deg, #212733, #10151d);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.stage-placeholder {
  max-width: 560px;
  padding: 32px;
  display: grid;
  justify-items: center;
  gap: 16px;
  text-align: center;
  color: #d8e0ed;
}

.stage-placeholder strong {
  font-size: 1.08rem;
  color: #fff;
}

.stage-placeholder p,
.stage-subtitle,
.webcam-panel-subtitle,
.preview-subtitle {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.stage-placeholder-icon {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.stage-placeholder-icon svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.webcam-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.overlay-position-group {
  display: grid;
  gap: 12px;
}

.overlay-position-label {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}

.overlay-position-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.overlay-position-btn {
  min-height: 64px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: #4e5c74;
  font-size: 1.6rem;
  font-weight: 700;
}

.overlay-position-btn[data-active="true"] {
  color: var(--blue);
  border-color: #84abff;
  background: #f5f9ff;
  box-shadow: inset 0 0 0 1px rgba(47,115,241,0.08);
}

.webcam-preview-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
}

.webcam-preview-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.webcam-preview-heading strong {
  font-size: 0.96rem;
}

.webcam-preview-heading span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.webcam-preview-card video {
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: none;
  border-radius: 12px;
  background: #0d1118;
  object-fit: cover;
}

.webcam-preview-placeholder {
  min-height: 180px;
  display: grid;
  place-items: center;
  padding: 18px;
  border: 1px dashed #cad6ea;
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
  line-height: 1.55;
  background: #fff;
}

.relocated-status-panel {
  margin-top: 18px;
}

.relocated-status-panel .status-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.relocated-status-panel #stopBtn {
  min-width: 220px;
}

.result-panel {
  margin-top: 18px;
}

.result-panel[hidden] {
  display: none !important;
}

.result-video-shell {
  margin-top: 16px;
}

.result-panel .download-panel {
  width: 100%;
  min-height: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 18px;
  padding: 18px 20px;
  border-style: solid;
  text-align: left;
}

.result-panel .download-copy {
  display: flex;
  align-items: center;
  gap: 14px;
}

.result-panel .download-icon {
  width: 44px;
  height: 44px;
  margin: 0;
}

.result-panel .download-copy h3,
.result-panel .download-copy p {
  margin: 0;
  max-width: none;
  text-align: left;
}

.result-panel #downloadLink {
  display: inline-flex;
  width: auto;
  min-width: 200px;
  flex-shrink: 0;
}

@media (max-width: 980px) {
  .recording-stage-layout.has-webcam-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .single-action-row {
    grid-template-columns: 1fr;
  }

  .stage-panel,
  .webcam-panel,
  .relocated-status-panel,
  .result-panel {
    padding: 18px;
  }

  .stage-shell {
    min-height: 260px;
  }

  .webcam-preview-placeholder {
    min-height: 160px;
  }

  .relocated-status-panel .status-actions {
    justify-content: stretch;
  }

  .relocated-status-panel #stopBtn {
    width: 100%;
    min-width: 0;
  }

  .result-panel .download-panel {
    flex-direction: column;
    align-items: stretch;
    text-align: left;
  }

  .result-panel .download-copy {
    align-items: flex-start;
  }

  .result-panel #downloadLink {
    width: 100%;
    min-width: 0;
  }
}


/* Final recorder layout correction — intentionally last in the stylesheet. */
#workspaceGrid.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

#workspaceGrid.workspace-grid.has-webcam-panel {
  grid-template-columns: minmax(0, 1fr) 300px;
}

#workspaceGrid .setup-panel {
  min-width: 0;
}

#webcamPanel.webcam-panel {
  position: static;
  inset: auto;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  padding: 24px;
}

#webcamPanel.webcam-panel[hidden] {
  display: none !important;
}

#webcamPanel .panel-heading {
  display: block;
}

#webcamPanel .panel-heading h2 {
  margin: 0;
}

#webcamPanel .webcam-panel-subtitle {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

#webcamPanel .overlay-position-group {
  display: grid;
  gap: 10px;
}

#webcamPanel .overlay-position-label {
  margin: 0;
  color: #4f5c73;
  font-size: 0.86rem;
  font-weight: 700;
}

#webcamPanel .overlay-position-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

#webcamPanel .overlay-position-btn {
  min-height: 58px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: #fff;
  color: #506078;
  box-shadow: none;
  font-size: 1.55rem;
  line-height: 1;
}

#webcamPanel .overlay-position-btn[data-active="true"] {
  color: var(--blue);
  border-color: var(--blue);
  background: #f4f8ff;
  box-shadow: 0 0 0 2px rgba(47, 115, 241, 0.08);
}

/* The preview used to fill the finished-video area; reset it for the side panel. */
#webcamPanel .webcam-preview-card {
  position: static;
  inset: auto;
  z-index: auto;
  overflow: visible;
  display: block;
  min-width: 0;
  border-radius: 0;
  background: transparent;
}

#webcamPanel .webcam-preview-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0;
  margin-bottom: 10px;
  background: transparent;
}

#webcamPanel .webcam-preview-heading strong::before {
  display: none;
}

#webcamPanel .webcam-preview-card video {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  max-height: none;
  border-radius: 12px;
  background: #0d1118;
  object-fit: cover;
}

#webcamPanel .webcam-preview-placeholder {
  min-height: 170px;
  display: grid;
  place-items: center;
  padding: 16px;
  border: 1px dashed #cfd9e8;
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--muted);
  text-align: center;
  font-size: 0.84rem;
  line-height: 1.5;
}

#webcamPanel .webcam-preview-placeholder[hidden] {
  display: none !important;
}

/* Status is now one full-width panel below the setup/webcam row. */
#recorderStatus.relocated-status-panel {
  width: 100%;
  margin-top: 18px;
}

#recorderStatus .status-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

#recorderStatus #stopBtn {
  min-width: 220px;
}

/* Finished video is hidden until Stop completes, then download sits underneath it. */
#previewPanel.result-panel {
  width: 100%;
  margin-top: 18px;
}

#previewPanel.result-panel[hidden] {
  display: none !important;
}

#previewPanel .preview-grid {
  display: block;
}

#previewPanel .video-shell {
  width: 100%;
  min-height: 300px;
}

#previewPanel .download-panel {
  width: 100%;
  min-height: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 16px;
  padding: 16px 18px;
  border-style: solid;
  text-align: left;
}

#previewPanel .download-panel[hidden] {
  display: none !important;
}

#previewPanel .download-copy {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

#previewPanel .download-icon {
  flex: 0 0 auto;
  margin: 0;
}

#previewPanel .download-panel h3,
#previewPanel .download-panel p {
  width: auto;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
  text-align: left;
}

#previewPanel #downloadLink {
  flex: 0 0 auto;
  width: auto;
  min-width: 200px;
}

/* Start remains in the setup card; Stop lives with the status panel. */
.setup-panel .single-action-row {
  grid-template-columns: minmax(220px, 320px);
  justify-content: start;
}

.mode-card:has(input:disabled) {
  opacity: 0.68;
  cursor: not-allowed;
}

.mode-card:has(input:disabled):hover {
  transform: none;
  box-shadow: none;
}

@media (max-width: 980px) {
  #workspaceGrid.workspace-grid.has-webcam-panel {
    grid-template-columns: minmax(0, 1fr) 270px;
  }
}

@media (max-width: 760px) {
  #workspaceGrid.workspace-grid.has-webcam-panel {
    grid-template-columns: 1fr;
  }

  #webcamPanel.webcam-panel {
    padding: 18px;
  }

  .setup-panel .single-action-row {
    grid-template-columns: 1fr;
  }

  #recorderStatus .status-actions {
    justify-content: stretch;
  }

  #recorderStatus #stopBtn {
    width: 100%;
    min-width: 0;
  }

  #previewPanel .download-panel {
    flex-direction: column;
    align-items: stretch;
  }

  #previewPanel #downloadLink {
    width: 100%;
    min-width: 0;
  }
}


/* Compact horizontal recording status bar */
#recorderStatus.relocated-status-panel {
  padding: 14px 16px 16px;
}

#recorderStatus .compact-status-heading {
  display: block;
  padding: 0 0 10px;
  margin: 0;
  border-bottom: 1px solid var(--border);
}

#recorderStatus .compact-status-heading h2 {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.3;
  font-weight: 750;
}

#recorderStatus .status-inline-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 0;
  margin-top: 10px;
}

#recorderStatus .status-state-cell {
  display: flex;
  align-items: center;
  padding: 0 18px 0 0;
  border-right: 1px solid var(--border);
}

#recorderStatus .state-label {
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(22, 184, 106, 0.10);
  font-size: 0.78rem;
  line-height: 1;
}

#recorderStatus[data-state="recording"] .state-label {
  background: rgba(218, 60, 72, 0.10);
}

#recorderStatus[data-state="preparing"] .state-label,
#recorderStatus[data-state="finalizing"] .state-label {
  background: rgba(224, 151, 35, 0.12);
}

#recorderStatus[data-state="error"] .state-label {
  background: rgba(218, 60, 72, 0.10);
}

#recorderStatus .stats-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(100px, 1fr));
  align-items: stretch;
  margin: 0;
}

#recorderStatus .stats-list > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  padding: 0 16px;
  border-bottom: 0;
  border-right: 1px solid var(--border);
}

#recorderStatus .stats-list dt {
  gap: 7px;
  font-size: 0.72rem;
  line-height: 1.15;
  white-space: nowrap;
}

#recorderStatus .stats-list dt svg {
  width: 15px;
  height: 15px;
}

#recorderStatus .stats-list dd {
  width: 100%;
  margin: 0;
  padding-left: 22px;
  font-size: 0.78rem;
  line-height: 1.2;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#recorderStatus .status-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin: 0;
  padding: 0 0 0 18px;
  border-top: 0;
}

#recorderStatus #stopBtn {
  min-width: 164px;
  min-height: 42px;
  padding: 9px 16px;
  color: #fff;
  border-color: #df4854;
  background: linear-gradient(180deg, #f04f5c, #db3947);
  box-shadow: 0 7px 16px rgba(219, 57, 71, 0.18);
  white-space: nowrap;
}

#recorderStatus #stopBtn:hover:not(:disabled) {
  background: linear-gradient(180deg, #e94855, #c93340);
}

#recorderStatus #stopBtn:disabled {
  color: #738096;
  border-color: #d8dfeb;
  background: #f1f4f8;
  box-shadow: none;
}

@media (max-width: 980px) {
  #recorderStatus .status-inline-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  #recorderStatus .status-state-cell {
    padding: 0 0 10px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  #recorderStatus .stats-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  #recorderStatus .stats-list > div:first-child {
    padding-left: 0;
  }

  #recorderStatus .stats-list > div:last-child {
    border-right: 0;
  }

  #recorderStatus .status-actions {
    justify-content: flex-end;
    padding: 12px 0 0;
    border-top: 1px solid var(--border);
  }
}

@media (max-width: 700px) {
  #recorderStatus .stats-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
  }

  #recorderStatus .stats-list > div {
    padding: 12px;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
  }

  #recorderStatus .stats-list > div:nth-child(2n) {
    border-right: 0;
  }

  #recorderStatus .stats-list > div:nth-last-child(-n+2) {
    border-bottom: 0;
  }

  #recorderStatus .stats-list dd {
    padding-left: 22px;
  }

  #recorderStatus #stopBtn {
    width: 100%;
    min-width: 0;
  }
}


/* One-button recorder layout: webcam controls below modes */
#workspaceGrid.workspace-grid,
.workspace-grid {
  grid-template-columns: 1fr !important;
}

.setup-panel {
  display: block;
}

.setup-panel > #webcamPanel.webcam-panel {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(260px, 340px);
  align-items: start;
  gap: 18px;
  margin-top: 18px;
  padding: 18px 0 0;
  border-top: 1px solid var(--border);
  background: transparent;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
}

.setup-panel > #webcamPanel.webcam-panel[hidden] {
  display: none !important;
}

.setup-panel > #webcamPanel .panel-heading {
  display: none;
}

.setup-panel > #webcamPanel .overlay-position-group {
  display: grid;
  gap: 10px;
  align-content: start;
}

.setup-panel > #webcamPanel .overlay-position-label {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}

.setup-panel > #webcamPanel .overlay-position-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.setup-panel > #webcamPanel .overlay-position-btn {
  min-height: 58px;
  font-size: 1.5rem;
}

.setup-panel > #webcamPanel .webcam-preview-card {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 14px;
  margin: 0;
  min-height: 0;
}

.setup-panel > #webcamPanel .webcam-preview-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.setup-panel > #webcamPanel .webcam-preview-card video {
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 220px;
}

.setup-panel > #webcamPanel .webcam-preview-placeholder {
  min-height: 170px;
}

#recorderStatus .status-actions {
  display: flex !important;
  justify-content: flex-end;
  align-items: center;
}

#recorderStatus .record-toggle-button {
  min-width: 220px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

#recorderStatus .record-toggle-button.is-start {
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.25);
}

#recorderStatus .record-toggle-button.is-start:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.32);
}

#recorderStatus .record-toggle-button.is-stop {
  background: linear-gradient(180deg, #ef4444, #dc2626);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 10px 24px rgba(220, 38, 38, 0.24);
}

#recorderStatus .record-toggle-button.is-stop:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(220, 38, 38, 0.32);
}

#recorderStatus .record-toggle-button:disabled {
  opacity: 0.85;
  cursor: wait;
  transform: none;
}

@media (max-width: 980px) {
  .setup-panel > #webcamPanel.webcam-panel {
    grid-template-columns: 1fr;
  }

  .setup-panel > #webcamPanel .overlay-position-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .setup-panel > #webcamPanel .overlay-position-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #recorderStatus .record-toggle-button {
    width: 100%;
    min-width: 0;
  }
}


/* Webcam control refinement: compact monitor-style position selector */
.setup-panel > #webcamPanel.webcam-panel {
  grid-template-columns: 210px minmax(320px, 430px) !important;
  justify-content: start;
  align-items: start;
  gap: 24px;
}

.setup-panel > #webcamPanel .overlay-position-group {
  width: 210px;
}

.setup-panel > #webcamPanel .overlay-position-monitor {
  position: relative;
  width: 190px;
  height: 150px;
  display: grid;
  grid-template-columns: 1fr 1fr !important;
  grid-template-rows: 1fr 1fr;
  gap: 0 !important;
  padding: 8px;
  border: 2px solid #bfd0e7;
  border-radius: 14px;
  background: #fbfdff;
  box-shadow: inset 0 0 0 4px #fff;
}

.setup-panel > #webcamPanel .overlay-position-monitor::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -13px;
  width: 3px;
  height: 12px;
  transform: translateX(-50%);
  border-radius: 2px;
  background: #9fb2cd;
}

.setup-panel > #webcamPanel .overlay-position-monitor::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -17px;
  width: 54px;
  height: 4px;
  transform: translateX(-50%);
  border-radius: 4px;
  background: #9fb2cd;
}

.setup-panel > #webcamPanel .overlay-position-btn {
  min-width: 0;
  min-height: 0;
  height: auto;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  box-shadow: none;
  color: #63728a;
  font-size: 1.55rem;
  line-height: 1;
}

.setup-panel > #webcamPanel .overlay-position-btn:hover:not(:disabled) {
  transform: none;
  background: #eef4ff;
  color: var(--blue);
}

.setup-panel > #webcamPanel .overlay-position-btn[data-active="true"] {
  color: var(--blue);
  background: #eaf2ff;
  border: 1px solid #8db4ff;
  box-shadow: inset 0 0 0 1px rgba(47,115,241,0.08);
}

.setup-panel > #webcamPanel .webcam-preview-card {
  width: min(100%, 430px);
}

#recorderStatus .status-actions:empty {
  display: none !important;
}

#recorderStatus #recordToggleBtn {
  display: inline-flex !important;
  visibility: visible !important;
  opacity: 1;
}

@media (max-width: 760px) {
  .setup-panel > #webcamPanel.webcam-panel {
    grid-template-columns: 1fr !important;
  }

  .setup-panel > #webcamPanel .overlay-position-group {
    width: 100%;
  }

  .setup-panel > #webcamPanel .overlay-position-monitor {
    width: min(190px, 100%);
  }
}


/* Three-column webcam controls layout */
.setup-panel > #webcamPanel.webcam-panel {
  display: block;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  background: transparent;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
}

.setup-panel > #webcamPanel .panel-heading {
  margin-bottom: 14px;
}

.setup-panel > #webcamPanel .webcam-controls-layout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.setup-panel > #webcamPanel .webcam-control-card {
  min-height: 250px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
}

.setup-panel > #webcamPanel .overlay-position-card,
.setup-panel > #webcamPanel .overlay-style-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.setup-panel > #webcamPanel .overlay-position-label,
.setup-panel > #webcamPanel .slider-header-row label {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text);
}

.setup-panel > #webcamPanel .overlay-position-monitor {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  width: 160px;
  height: 160px;
  margin-top: 14px;
  border: 2px solid #c8d7ef;
  border-radius: 18px;
  overflow: hidden;
  position: relative;
  background: linear-gradient(180deg, #fbfdff, #f3f7ff);
}

.setup-panel > #webcamPanel .overlay-position-monitor::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -16px;
  width: 10px;
  height: 14px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: #9eb0cf;
}

.setup-panel > #webcamPanel .overlay-position-monitor::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -22px;
  width: 64px;
  height: 5px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: #9eb0cf;
}

.setup-panel > #webcamPanel .overlay-position-btn {
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 2rem;
  font-weight: 700;
  color: #60718f;
}

.setup-panel > #webcamPanel .overlay-position-btn:nth-child(1),
.setup-panel > #webcamPanel .overlay-position-btn:nth-child(2) {
  border-bottom: 1px solid #d7e3f4;
}

.setup-panel > #webcamPanel .overlay-position-btn:nth-child(1),
.setup-panel > #webcamPanel .overlay-position-btn:nth-child(3) {
  border-right: 1px solid #d7e3f4;
}

.setup-panel > #webcamPanel .overlay-position-btn[data-active="true"] {
  background: #edf4ff;
  color: var(--blue);
  box-shadow: inset 0 0 0 2px rgba(59, 130, 246, 0.22);
}

.setup-panel > #webcamPanel .overlay-style-card {
  gap: 18px;
}

.setup-panel > #webcamPanel .slider-control-group {
  width: 100%;
  display: grid;
  gap: 10px;
}

.setup-panel > #webcamPanel .slider-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.setup-panel > #webcamPanel .slider-header-row span {
  font-size: 0.92rem;
  color: var(--muted);
  font-weight: 700;
}

.setup-panel > #webcamPanel input[type="range"] {
  width: 100%;
  accent-color: var(--blue);
}

.setup-panel > #webcamPanel .webcam-preview-card {
  display: grid;
  gap: 12px;
  min-height: 250px;
  margin: 0;
}

.setup-panel > #webcamPanel .webcam-preview-card video,
.setup-panel > #webcamPanel .webcam-preview-placeholder {
  width: 100%;
  min-height: 170px;
}

.setup-panel > #webcamPanel .webcam-preview-card video {
  max-height: 220px;
  object-fit: cover;
  background: #0f172a;
}

@media (max-width: 1100px) {
  .setup-panel > #webcamPanel .webcam-controls-layout {
    grid-template-columns: 1fr;
  }

  .setup-panel > #webcamPanel .webcam-control-card {
    min-height: 0;
  }
}


/* Slider behavior + live webcam style preview */
.setup-panel > #webcamPanel .overlay-style-card {
  justify-content: center;
}

.setup-panel > #webcamPanel .slider-control-group + .slider-control-group {
  margin-top: 20px;
}

.setup-panel > #webcamPanel input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, #dbeafe, #bfdbfe);
  outline: none;
}

.setup-panel > #webcamPanel input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 1px 5px rgba(30, 64, 175, 0.35);
  cursor: pointer;
}

.setup-panel > #webcamPanel input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 1px 5px rgba(30, 64, 175, 0.35);
  cursor: pointer;
}

.setup-panel > #webcamPanel .webcam-preview-card {
  align-content: start;
}

.setup-panel > #webcamPanel .webcam-preview-card video,
.setup-panel > #webcamPanel .webcam-preview-placeholder {
  transition: width .15s ease, height .15s ease, border-radius .15s ease;
}


/* Slider correction: normalized 0–100 scale and distortion-free preview */
.setup-panel > #webcamPanel input[type="range"] {
  width: 100%;
  height: 22px;
  padding: 0;
  margin: 2px 0 0;
  appearance: auto;
  -webkit-appearance: auto;
  accent-color: var(--blue);
  background: transparent;
  border: 0;
  border-radius: 0;
}

/* Let the browser render a consistent, correctly scaled native range track. */
.setup-panel > #webcamPanel input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: auto;
  width: auto;
  height: auto;
  border: 0;
  box-shadow: none;
}

.setup-panel > #webcamPanel input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 1px 4px rgba(30, 64, 175, 0.25);
}

.setup-panel > #webcamPanel .webcam-preview-card video {
  min-height: 0 !important;
  object-fit: cover !important;
  object-position: center !important;
}


/* Final webcam-control polish: centered position selector and meaningful size scale */
.setup-panel > #webcamPanel .overlay-position-card {
  align-items: center !important;
  justify-content: flex-start;
  text-align: center;
}

.setup-panel > #webcamPanel .overlay-position-label {
  width: 100%;
  text-align: center;
}

.setup-panel > #webcamPanel .overlay-position-monitor {
  margin: 16px auto 28px !important;
}

.setup-panel > #webcamPanel .slider-range-hints {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: -2px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.3;
}

.setup-panel > #webcamPanel #overlaySizeRange {
  direction: ltr;
}


/* Final recorder grid polish: 2 rows of 3 matching cards */
.setup-panel {
  display: grid;
  gap: 18px;
}

.setup-panel .mode-picker {
  margin: 0;
}

.setup-panel .mode-grid,
.setup-panel > #webcamPanel .webcam-controls-layout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.setup-panel > #webcamPanel.webcam-panel {
  margin-top: 0;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

.setup-panel > #webcamPanel .panel-heading {
  display: none;
}

.setup-panel > #webcamPanel .webcam-controls-layout {
  gap: 18px;
}

.setup-panel > #webcamPanel .webcam-control-card {
  min-height: 205px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: #fff;
  box-shadow: none;
  display: flex;
  flex-direction: column;
}

.setup-panel > #webcamPanel .overlay-position-card,
.setup-panel > #webcamPanel .overlay-style-card,
.setup-panel > #webcamPanel .webcam-preview-card {
  justify-content: flex-start;
}

.setup-panel > #webcamPanel .overlay-position-label,
.setup-panel > #webcamPanel .slider-header-row label,
.setup-panel > #webcamPanel .webcam-preview-heading strong {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text);
}

.setup-panel > #webcamPanel .overlay-position-card {
  align-items: center;
}

.setup-panel > #webcamPanel .overlay-position-monitor {
  margin: 18px auto 0;
}

.setup-panel > #webcamPanel .overlay-style-card {
  gap: 18px;
}

.setup-panel > #webcamPanel .slider-control-group {
  width: 100%;
}

.setup-panel > #webcamPanel .slider-range-hints {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.setup-panel > #webcamPanel .webcam-preview-card {
  align-items: stretch;
}

.setup-panel > #webcamPanel .webcam-preview-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.setup-panel > #webcamPanel .webcam-preview-heading span {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
}

.setup-panel > #webcamPanel .webcam-preview-card video,
.setup-panel > #webcamPanel .webcam-preview-placeholder {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}

.setup-panel > #webcamPanel .webcam-preview-card video {
  min-height: 150px;
  max-height: 170px;
}

.setup-panel > #webcamPanel .webcam-preview-placeholder {
  min-height: 150px;
  display: grid;
  place-items: center;
  text-align: center;
}

.setup-panel .inline-message {
  margin-top: 0;
  padding-top: 2px;
  border-top: 0;
}

@media (max-width: 1100px) {
  .setup-panel .mode-grid,
  .setup-panel > #webcamPanel .webcam-controls-layout {
    grid-template-columns: 1fr;
  }

  .setup-panel > #webcamPanel .webcam-control-card {
    min-height: 0;
  }
}


/* Firefox polish: compatibility notice below webcam controls + visible sliders */
.setup-panel > #firefoxWebcamNotice.browser-compatibility-notice {
  margin-top: 0;
}

@supports (-moz-appearance: none) {
  .setup-panel > #webcamPanel input[type="range"] {
    appearance: none;
    -moz-appearance: none;
    width: 100%;
    height: 22px;
    padding: 0;
    margin: 2px 0 0;
    background: transparent;
    border: 0;
    outline: none;
  }

  .setup-panel > #webcamPanel input[type="range"]::-moz-range-track {
    height: 6px;
    border: 0;
    border-radius: 999px;
    background: #dbe4f3;
  }

  .setup-panel > #webcamPanel input[type="range"]::-moz-range-progress {
    height: 6px;
    border: 0;
    border-radius: 999px;
    background: var(--blue);
  }

  .setup-panel > #webcamPanel input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: var(--blue);
    box-shadow: 0 1px 5px rgba(30, 64, 175, 0.32);
    cursor: pointer;
  }

  .setup-panel > #webcamPanel input[type="range"]:focus-visible::-moz-range-thumb {
    box-shadow: 0 0 0 4px rgba(47, 115, 241, 0.18), 0 1px 5px rgba(30, 64, 175, 0.32);
  }
}


/* Mobile screen-capture compatibility */
.mobile-unsupported-notice {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 17px 18px;
  border: 1px solid #b9d3ff;
  border-radius: 14px;
  background: #f2f7ff;
  color: #27446f;
}
.mobile-unsupported-notice[hidden] { display: none !important; }
.mobile-unsupported-icon {
  width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: 50%; background: #dceaff; color: var(--blue);
  font-family: Georgia, serif; font-weight: 800; font-size: 1.05rem;
}
.mobile-unsupported-notice strong {
  display: block; margin-bottom: 5px; color: #16345f; font-size: 0.98rem;
}
.mobile-unsupported-notice p { margin: 0; line-height: 1.55; font-size: 0.9rem; }
.mobile-screen-capture-unsupported .mode-card { cursor: not-allowed; }
.mobile-screen-capture-unsupported .mode-card:has(input:disabled) { opacity: 0.58; }
.mobile-screen-capture-unsupported #recordToggleBtn:disabled { opacity: 0.62; cursor: not-allowed; }
@media (max-width: 760px) {
  .mobile-unsupported-notice { grid-template-columns: 34px minmax(0, 1fr); gap: 12px; padding: 15px; }
  .mobile-unsupported-icon { width: 32px; height: 32px; }
}


/* Exact overlay preview: miniature representation of the recorded frame */
.setup-panel > #webcamPanel .webcam-preview-card {
  overflow: visible;
}

.setup-panel > #webcamPanel .webcam-preview-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #d8e2f1;
  border-radius: 14px;
  background:
    linear-gradient(rgba(255,255,255,.88), rgba(255,255,255,.88)),
    linear-gradient(135deg, #e9eff8, #dfe8f5);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.55);
}

.setup-panel > #webcamPanel .webcam-preview-stage::before {
  content: "Recording frame";
  position: absolute;
  left: 10px;
  top: 8px;
  z-index: 1;
  padding: 3px 7px;
  border-radius: 999px;
  color: #74839c;
  background: rgba(255,255,255,.82);
  font-size: 0.68rem;
  font-weight: 700;
  pointer-events: none;
}

.setup-panel > #webcamPanel .webcam-preview-stage #webcamPreviewVideo {
  position: absolute;
  z-index: 3;
  min-width: 0;
  min-height: 0;
  max-width: none;
  max-height: none;
  background: #0f172a;
  object-fit: cover;
}

.setup-panel > #webcamPanel .webcam-preview-stage #webcamPreviewPlaceholder {
  position: absolute;
  inset: 0;
  z-index: 2;
  min-width: 0;
  min-height: 0;
  padding: 34px 18px 18px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  text-align: center;
}

.setup-panel > #webcamPanel .webcam-preview-stage #webcamPreviewPlaceholder[hidden],
.setup-panel > #webcamPanel .webcam-preview-stage #webcamPreviewVideo.hidden {
  display: none !important;
}


/* Simple webcam preview: show the overlay itself, not a miniature screen */
.setup-panel > #webcamPanel .webcam-preview-stage {
  position: relative;
  width: 100%;
  min-height: 170px;
  aspect-ratio: auto !important;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 12px;
  border: 1px dashed #d5dfed;
  border-radius: 14px;
  background: #f8faff;
  box-shadow: none;
}

.setup-panel > #webcamPanel .webcam-preview-stage::before {
  display: none !important;
  content: none !important;
}

.setup-panel > #webcamPanel .webcam-preview-stage #webcamPreviewVideo {
  position: relative;
  inset: auto;
  z-index: 2;
  flex: 0 0 auto;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
  background: #0f172a;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

.setup-panel > #webcamPanel .webcam-preview-stage #webcamPreviewPlaceholder {
  position: relative;
  inset: auto;
  width: 100%;
  height: 100%;
  min-height: 145px;
  padding: 18px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  text-align: center;
}


/* Clean webcam controls: four standalone position buttons + frameless preview */
.setup-panel > #webcamPanel .overlay-position-card {
  align-items: center;
}

.setup-panel > #webcamPanel .overlay-position-label {
  width: 100%;
  text-align: center;
}

.setup-panel > #webcamPanel .overlay-position-grid {
  width: min(100%, 230px);
  height: auto;
  margin: 18px auto 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.setup-panel > #webcamPanel .overlay-position-grid::before,
.setup-panel > #webcamPanel .overlay-position-grid::after {
  display: none !important;
  content: none !important;
}

.setup-panel > #webcamPanel .overlay-position-btn,
.setup-panel > #webcamPanel .overlay-position-btn:nth-child(1),
.setup-panel > #webcamPanel .overlay-position-btn:nth-child(2),
.setup-panel > #webcamPanel .overlay-position-btn:nth-child(3),
.setup-panel > #webcamPanel .overlay-position-btn:nth-child(4) {
  width: 100%;
  min-width: 0;
  aspect-ratio: 1 / 1;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: #fff;
  color: #60718f;
  font-size: 2rem;
  line-height: 1;
  box-shadow: none;
}

.setup-panel > #webcamPanel .overlay-position-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: #9ebcff;
  background: #f8fbff;
}

.setup-panel > #webcamPanel .overlay-position-btn[data-active="true"] {
  border: 2px solid var(--blue);
  background: #f2f7ff;
  color: var(--blue);
  box-shadow: 0 8px 18px rgba(47, 115, 241, 0.10);
}

/* The preview card itself is the container. No second box around the camera. */
.setup-panel > #webcamPanel .webcam-preview-stage {
  position: relative;
  width: 100%;
  min-height: 170px;
  aspect-ratio: auto !important;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.setup-panel > #webcamPanel .webcam-preview-stage::before,
.setup-panel > #webcamPanel .webcam-preview-stage::after {
  display: none !important;
  content: none !important;
}

.setup-panel > #webcamPanel .webcam-preview-stage #webcamPreviewVideo {
  position: relative;
  inset: auto;
  z-index: 2;
  flex: 0 0 auto;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 175px;
  margin: auto;
  object-fit: cover;
  background: #0f172a;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14);
}

.setup-panel > #webcamPanel .webcam-preview-stage #webcamPreviewPlaceholder {
  position: relative;
  inset: auto;
  width: 100%;
  height: auto;
  min-height: 150px;
  padding: 16px 12px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 0 !important;
  background: transparent;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1100px) {
  .setup-panel > #webcamPanel .overlay-position-grid {
    width: min(100%, 260px);
  }
}


/* Final title alignment cleanup */
.setup-panel > #webcamPanel .overlay-style-card .slider-control-group:first-child .slider-header-row {
  position: relative;
  justify-content: center;
}

.setup-panel > #webcamPanel .overlay-style-card .slider-control-group:first-child .slider-header-row label {
  text-align: center;
}

.setup-panel > #webcamPanel .overlay-style-card .slider-control-group:first-child .slider-header-row span {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

.setup-panel > #webcamPanel .webcam-preview-heading {
  justify-content: center;
  text-align: center;
}

.setup-panel > #webcamPanel .webcam-preview-heading span {
  display: none;
}
