body {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #222;
  color: white;
  text-align: center;
  font-family: sans-serif;
  box-sizing:border-box;
  overflow-x: hidden;
  overflow-y: auto;
  min-height: 100dvh;
  max-width: 100%;
}
.center{
  position: relative;
  width: 100%;
  text-align: center;
}
.center h1{
  margin:0;
}
.group{
  padding: 5px;
  border: 1px solid #333;
  border-radius: 4px;
}
.setting-item{
  display:flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 15px;
  text-align: left;
}
.setting-item label{
  text-align: left;
}
.setting-item select {
  display: flex;
  margin-left: auto;
  margin-right: 5px;
}
dialog{
  width: 80%;
  max-width: 700px;
  box-sizing: border-box;
  border: none;
  border-radius: 12px;
  padding: 20px;
  padding-bottom: 3rem;
}
dialog h2{
  margin-top: 0;
  margin-bottom: 0;
}
#status {
  width: 100%;
  margin: 10px;
  font-weight: bold;
  background: #555;
  margin-bottom: 10px;
}
.controls {
  display: flex;
  width: 90%;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin: 5px auto;
  flex-wrap: wrap;
}
.toggle-row{
  display:flex;
  align-items: center;
  gap: 10px;
  margin:10px 0;
}
.toggle-row input[type="checkbox"]{
  display: none;
}
.toggle-switch{
  width: 62px;
  min-width: 62px;
  height: 32px;
  background: #AAA;
  border-radius: 20px;
  position: relative;
  cursor: pointer;
  transition: background 0.3s;
}
.toggle-switch::after{
  content: "";
  width: 30px;
  height: 30px;
  background-color: white;
  border-radius: 50%;
  position: absolute;
  top: 1px;
  left: 1px;
  transition: left 0.3s;
}
/* on */
.toggle-row input[type="checkbox"]:checked + .toggle-switch{
  background: #4c50af;
}
/* off */
.toggle-row input[type="checkbox"]:checked + .toggle-switch::after{
  left: 30px;
}

.canvas-position{
  margin: 10px auto  0 auto;
  width: min(95%,90dvh * var(--aspect-ratio));
  max-width: 95%;
  max-height: 90dvh;
  aspect-ratio: 16 / 9;
  position: relative;
  background: black;
  border: 2px solid #fff;
}
.canvas-position canvas{
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: 16 / 9;
  background: transparent;
  pointer-events: none;
}
.canvas-position video{
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: 16 / 9;
  display: none;
}
.set{
  display: flex;
  width: auto;
  margin: 5px;
  padding: 0;
}

button{
  width: auto;
  background-color: #ddd;
  box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2);
  border-radius: 5px;
  font-size: 1rem;
  transition: border-color 0.25s;
  border-color: #eee;
  padding: 10px;
}
button:hover{
  border-color: #ddd;
  background-color: #aaa;
}
button:active{
  border-color: #333;
  background-color: #555;
} 
button:disabled  {
  border-color: #333;
  background-color: #555;
  cursor: not-allowed;
}
#btn-return{
  width: auto;
  display:none;
  position:absolute;
  left:10px;
  top:50%;
  transform: translateY(-50%);
}
#btn-settings{
  width: auto;
  position:absolute;
  right:10px;
  top:50%;
  transform: translateY(-50%);
}
.btn-close{
  display: block;
  position: absolute;
  right: 0%;
  margin: 10px;
  transform: translateY(-50%);
}
#log {
  white-space: pre-wrap;
  text-align: left;
  border: 1px solid #111;
  border-radius: 3px;
  min-height: 10px;
  width: 100%;
  margin:15px 0;
  overflow-y: auto;
  height: 50dvh;
  max-height: 80dvh;
}
#btn-log{
  display: block;
  position: absolute;
  left: 0%;
  margin: 10px;
  transform: translateY(-50%);
}
select{
  width: auto;
  min-width: 8rem;
  margin: 0;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 1rem;
}
#camera-select {
  /* width: 100%; */
  min-width: 8rem;
  margin: 0;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 1rem;
  display: none;
}
#btn-stop-start{
  width: auto;
  display: none;
  background: #4d4dff;
}
#btn-stop-start:disabled{
  background: #eee;
}

input:checked + .slider { background-color: #2196F3; }
input:focus + .slider { box-shadow: 0 0 1px #2196F3; }
input:checked + .slider:before { transform: translateX(26px); }
