html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

body {
    font-family: system-ui, Arial, sans-serif;
    margin: 1rem;
}

video {
    width: 48%;
    background: #000;
}

.row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.controls {
    margin: .5rem 0;
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

input, button {
    padding: .5rem;
    font-size: 1rem;
}

.note {
    color: #555;
    font-size: .9rem;
}

video {
    object-fit: contain;
    background-color: #000;
}

video[poster] {
    background-size: cover;
    background-position: center;
}

.video-frame {
    position: relative;
    background: #000;
    aspect-ratio: 16/9;
    overflow: hidden;
}

.video-frame video, .video-frame .placeholder {
    position: absolute;
    inset: 0;
    margin: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.video-frame .placeholder {
    display: none;
}

/* === Layout container === */
.video-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh; /* Fill full viewport height */
    width: 100%;
    background: #111; /* Dark background for contrast */
    box-sizing: border-box;
    padding: 1rem;
    gap: 1.5rem; /* space between videos */
}

/* === Titles === */
.video-card h3 {
    color: #eee;
    margin: 0 0 0.25rem;
    font-weight: 600;
    text-align: center;
}

/* === Scalable video frame === */
.video-frame {
    position: relative;
    width: 100%;
    max-width: 90vw; /* never exceed 90% of window width */
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 6px 24px rgba(0,0,0,.25);
}

/* === Video inside frame === */
.video-frame video {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #000;
    display: block;
}

/* Fit modes depending on orientation */
.video-frame video.landscape {
    width: 100%;
    height: auto;
}

.video-frame video.portrait {
    height: 100%;
    width: auto;
}

/* Mirror local preview */
#localVideo.mirror {
    transform: translate(-50%, -50%) scaleX(-1);
}

/* === Auto-scaling both videos to always fit === */
@media (orientation: landscape) {
    .video-column {
        justify-content: space-evenly; /* distribute evenly vertically */
    }

    .video-frame {
        /* Make sure both fit vertically with gap */
        height: calc((100vh - 4rem) / 2); /* two frames with padding/gap */
        width: auto;
        aspect-ratio: 16 / 9;
        max-height: 45vh; /* safety cap */
    }
}

@media (orientation: portrait) {
    /* On tall screens (phones), still scale down but allow stacking */
    .video-frame {
        width: 100%;
        max-height: 45vh;
    }
}
