:root {
  --fvr-navy: #0b1f4d;
  --fvr-navy-ink: #10244f;
  --fvr-blue: #1565d8;
  --fvr-blue-dark: #0f4fb0;
  --fvr-blue-soft: #eef4ff;
  --fvr-ink: #12203a;
  --fvr-muted: #5b6b82;
  --fvr-line: #d9e2ef;
  --fvr-surface: #ffffff;
  --fvr-bg: #f3f6fb;
  --fvr-danger: #c4322a;
  --fvr-success: #0f8a56;
  --fvr-warn: #b45309;
  --fvr-radius: 12px;
  --fvr-radius-sm: 8px;
  --fvr-shadow: 0 1px 2px rgba(16, 36, 79, 0.06), 0 8px 24px rgba(16, 36, 79, 0.06);
  --fvr-header: 68px;
  --fvr-sidebar: 232px;
  --fvr-dock: 72px;
  --header-height: 68px;
  --sidebar-width: 232px;
  --blue: #1565d8;
  --blue-dark: #0f4fb0;
  --blue-soft: #eef4ff;
  --navy: #0b1f4d;
  --ink: #12203a;
  --muted: #5b6b82;
  --border: #d9e2ef;
  --bg: #f3f6fb;
}

html { scroll-padding-bottom: env(safe-area-inset-bottom, 0px); }
body {
  font-family: "Segoe UI", Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  background: var(--fvr-bg);
  color: var(--fvr-ink);
}

.app-header,
.public-header {
  min-height: var(--fvr-header);
  height: auto;
  padding: env(safe-area-inset-top, 0px) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  gap: 12px;
  box-shadow: none;
  border-bottom: 1px solid var(--fvr-line);
  background: #fff;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
}
.app-header::after,
.public-header::after { height: 2px; background: var(--fvr-blue); }
.header-logo,
.public-header .site-logo,
.public-header .header-logo {
  height: 56px;
  max-width: 260px;
}
.header-logo img,
.public-header .site-logo img,
.public-header .header-logo img {
  max-width: 250px;
  max-height: 48px;
  width: auto;
  height: auto;
  object-fit: contain;
}
.header-mid { display: flex; align-items: center; justify-content: center; min-width: 0; }
.header-end {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.header-end .primary-button,
.header-end .site-cta {
  min-height: 40px;
  font-size: 14px;
  padding: 0 14px;
  border-radius: var(--fvr-radius-sm);
}
.header-account { display: inline-flex; align-items: center; gap: 8px; }
.header-account .account-link {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--fvr-line);
  border-radius: var(--fvr-radius-sm);
  background: #fff;
  color: var(--fvr-ink);
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.public-nav a { border-radius: var(--fvr-radius-sm); }
.site-doc .app-header,
.site-doc .public-header { position: sticky; top: 0; z-index: 40; }
@media (min-width: 1101px) {
  .app-header,
  .public-header {
    height: var(--fvr-header);
    min-height: var(--fvr-header);
  }
  .app-header .public-nav,
  .header-end { flex-wrap: nowrap; }
}

@media (max-width: 1100px) {
  .app-header .public-nav { display: none; }
  .app-header .public-menu-toggle,
  .app-header #menuToggle { display: inline-grid; place-items: center; }
}

.sidebar {
  background: #0b1f4d;
  border-right: 0;
  color: #d7e3f7;
}
.nav-item { color: #d7e3f7; border-radius: var(--fvr-radius-sm); }
.nav-item:hover { background: rgba(255,255,255,.08); }
.nav-item.active {
  background: rgba(21, 101, 216, .28);
  color: #fff;
  box-shadow: inset 3px 0 0 #7eb3ff;
}
.nav-section { border-top-color: rgba(255,255,255,.12); }
.nav-section-label { color: #8ea0c0; }
.sidebar-footer, .credit-block strong, .credit-block span { color: #b7c6df; }
.privacy-badge { background: rgba(15, 138, 86, .16); color: #8ee0b5; border-color: transparent; }

.home-hero { margin: 0 0 12px; max-width: 760px; }
#view-home.view.active { padding-top: 12px; }
.home-kicker {
  margin: 0 0 6px;
  color: var(--fvr-blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.home-title {
  margin: 0 0 8px;
  color: var(--fvr-navy);
  font-size: clamp(26px, 3vw, 36px);
  letter-spacing: -.03em;
  line-height: 1.15;
}
.home-lead { margin: 0; color: var(--fvr-muted); font-size: 15px; line-height: 1.5; }

.capability-banner {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid #f3d2a4;
  background: #fff8ee;
  border-radius: var(--fvr-radius);
}
.capability-banner p { margin: 4px 0 0; color: #7a4b12; font-size: 13px; line-height: 1.4; }
.capability-banner-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.session-status {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 14px;
}
.session-status > div {
  min-width: 0;
  padding: 10px 12px;
  background: var(--fvr-surface);
  border: 1px solid var(--fvr-line);
  border-radius: var(--fvr-radius-sm);
}
.session-status span {
  display: block;
  color: var(--fvr-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
}
.session-status strong {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: var(--fvr-navy);
}

.mode-grid { gap: 12px; }
.mode-grid.is-two-up { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mode-grid.is-two-up .mode-card { max-height: none; }
.segmented.is-compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
[data-record-mode].is-unavailable { opacity: .72; }
.mode-card {
  min-height: 132px;
  max-height: none;
  border: 1px solid var(--fvr-line);
  border-top-width: 1px;
  border-radius: var(--fvr-radius);
  box-shadow: none;
  padding: 14px 16px;
  background: var(--fvr-surface);
}
.mode-card:hover { transform: none; border-color: #b9cceb; }
.mode-card.selected {
  border-color: var(--fvr-blue);
  background: #f7faff;
  box-shadow: 0 0 0 3px rgba(21, 101, 216, .12);
}
.mode-card.is-unavailable {
  opacity: 1;
  background: #f7f8fb;
  color: #6b778c;
  pointer-events: auto;
  cursor: pointer;
}
.mode-card.is-unavailable.selected { box-shadow: none; border-color: var(--fvr-line); }
.mode-unavail-note {
  display: inline-flex;
  margin-top: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #fff4e5;
  color: #9a3412;
  font-size: 11px;
}

.quick-settings-card,
.preview-card,
.settings-card,
.settings-panel,
.info-grid article,
.home-demo-card,
.home-banner-card,
.recording-card,
.library-toolbar,
.empty-state {
  border-radius: var(--fvr-radius);
  box-shadow: var(--fvr-shadow);
}

.record-button,
.primary-button {
  background: var(--fvr-blue);
  border-radius: var(--fvr-radius-sm);
}
.record-button:hover,
.primary-button:hover { background: var(--fvr-blue-dark); }
.secondary-button, .danger-button, .ghost-button {
  border-radius: var(--fvr-radius-sm);
  min-height: 44px;
}
.ghost-button {
  border: 1px solid var(--fvr-line);
  background: #fff;
  color: var(--fvr-ink);
  padding: 0 12px;
  font-weight: 700;
}

.recorder-layout { grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; }
.preview-stage {
  border-radius: 10px;
  width: 100%;
  max-height: calc(100dvh - var(--fvr-header) - 13rem);
}
.record-controls { gap: 8px; }
.live-mic-mute {
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid var(--fvr-line);
  border-radius: var(--fvr-radius);
  background: #f8fbff;
}
#liveMicMuteBtn { min-height: 48px; }

.fvr-toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(12px);
  z-index: 80;
  max-width: min(440px, calc(100vw - 24px));
  padding: 12px 14px;
  border-radius: var(--fvr-radius);
  background: #12203a;
  color: #fff;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.4;
  box-shadow: var(--fvr-shadow);
  opacity: 0;
  pointer-events: none;
}
.fvr-toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }
html.fvr-mobile-ui .fvr-toast { bottom: calc(var(--fvr-dock) + 12px + env(safe-area-inset-bottom, 0px)); }

.message-dialog,
.complete-dialog,
.fvr-mobile-dialog {
  width: min(480px, calc(100vw - 20px));
  max-height: min(90dvh, 640px);
  overflow: auto;
  border-radius: 14px;
}
.complete-dialog { width: min(820px, calc(100vw - 20px)); }

button, select, input[type="text"], input[type="email"], input[type="password"], textarea {
  font-size: 16px;
  border-radius: var(--fvr-radius-sm);
}

html.fvr-camera-only .mode-card[data-mode="webcam"] {
  order: -1;
  border-color: var(--fvr-blue);
}
html.fvr-camera-only .home-lead { max-width: 42rem; }

@media (min-width: 1181px) {
  #view-record.view.active { padding: 16px 20px; }
  .preview-card { min-height: 0; }
}

@media (max-width: 1180px) {
  :root, html { --header-height: 64px; --fvr-header: 64px; }
  .recorder-layout { grid-template-columns: minmax(0, 1fr); }
  .settings-card { max-height: none; order: 2; }
  .preview-card { order: 1; }
  .session-status { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  :root, html { --header-height: 58px; --fvr-header: 58px; }
  html, body { overflow-x: hidden; }
  .app-header,
  .public-header {
    padding: env(safe-area-inset-top, 0px) max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left));
  }
  .header-logo,
  .public-header .site-logo,
  .public-header .header-logo { height: 46px; max-width: 168px; }
  .header-logo img,
  .public-header .site-logo img,
  .public-header .header-logo img { max-width: 168px; max-height: 40px; }
  .page-context { display: none; }
  .home-title { font-size: 26px; }
  .home-hero { margin-bottom: 10px; }
  #view-home.view.active { padding-top: 10px; }
  .mode-grid, .mode-grid.is-two-up, .quick-settings-card, .info-grid, .home-promo, .settings-page-grid, .library-toolbar {
    grid-template-columns: minmax(0, 1fr);
  }
  .mode-card { min-height: 0; }
  .session-status { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .capability-banner { flex-direction: column; align-items: stretch; }
  .start-row { flex-direction: column; align-items: stretch; }
  #homeStartBtn, #startBtn, #pauseBtn, #stopBtn, #liveMicMuteBtn {
    min-height: 52px;
    width: 100%;
  }
  .record-controls { flex-direction: column; }
  .record-controls button { flex: 1 1 auto; }
  #view-record.view.active {
    height: auto;
    overflow: visible;
    padding: 10px 12px calc(var(--fvr-dock) + 18px + env(safe-area-inset-bottom, 0px));
  }
  .preview-stage {
    width: 100%;
    max-width: 100%;
    max-height: min(46dvh, 420px);
    min-height: 200px;
    aspect-ratio: 16 / 9;
  }
  html.fvr-camera-only .preview-stage {
    aspect-ratio: 3 / 4;
    max-height: min(48dvh, 440px);
    min-height: 200px;
  }
  @media (orientation: landscape) {
    .preview-stage,
    html.fvr-camera-only .preview-stage {
      aspect-ratio: 16 / 9;
      max-height: min(42dvh, 280px);
      min-height: 160px;
    }
  }
  .app-body { padding-bottom: calc(var(--fvr-dock) + env(safe-area-inset-bottom, 0px)); }
  .sidebar {
    inset: auto 0 0 0;
    height: calc(var(--fvr-dock) + env(safe-area-inset-bottom, 0px));
    background: #fff;
    color: var(--fvr-ink);
    border-top: 1px solid var(--fvr-line);
  }
  .sidebar .nav-item { color: #344054; }
  .sidebar .nav-item.active { background: var(--fvr-blue-soft); color: var(--fvr-blue); box-shadow: none; }
  .view { padding: 12px 12px 20px; }
  .info-grid article, .home-demo-card, .home-banner-card { max-height: none; min-height: 0; }
  .home-banner-card img { max-height: 160px; }
  .site-footer.home-site-footer { margin-bottom: 8px; }
}

@media (max-width: 390px) {
  .session-status { grid-template-columns: 1fr 1fr; }
  .header-end .lang-current-name { display: none; }
}

html[dir="rtl"] .nav-item.active { box-shadow: inset -3px 0 0 #7eb3ff; }
html[dir="rtl"] .fvr-toast { transform: translateX(50%) translateY(12px); }
html[dir="rtl"] .fvr-toast.is-visible { transform: translateX(50%) translateY(0); }
