#content-div:has(.ylyl-app) {
    max-width: 75em;
}

.ylyl-app {
    max-width: none;
    width: 100%;
    margin: 0 auto;
}

.ylyl-panel {
    margin-bottom: 1.5rem;
}

.ylyl-setup-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
    margin: 1rem 0;
}

.ylyl-url-input {
    flex: 1;
    min-width: 240px;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
}

.ylyl-note {
    color: #666;
    font-size: 0.9rem;
}

.ylyl-video-stack {
    position: relative;
    width: 100%;
    margin-bottom: 1rem;
    border-radius: 4px;
    overflow: hidden;
    background: #000;
}

.ylyl-video-stack .ylyl-player-host {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
}

.ylyl-webcam-pip {
    position: absolute;
    bottom: 0.75rem;
    right: 0.75rem;
    width: 24%;
    min-width: 120px;
    max-width: 200px;
    aspect-ratio: 4 / 3;
    z-index: 4;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.55);
    background: #111;
}

.ylyl-webcam-pip #webcam,
.ylyl-webcam-pip #webcam-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ylyl-webcam-pip #webcam-overlay {
    pointer-events: none;
}

.ylyl-webcam-pip .ylyl-meter {
    padding: 0.35rem 0.5rem;
}

.ylyl-webcam-pip .ylyl-meter-row {
    grid-template-columns: 2.25rem 1fr 1.75rem;
    gap: 0.35rem;
    margin-bottom: 0.25rem;
}

.ylyl-webcam-pip .ylyl-meter-name,
.ylyl-webcam-pip .ylyl-meter-val {
    font-size: 0.7rem;
}

.ylyl-webcam-pip .ylyl-meter-bar {
    height: 6px;
}

@media (max-width: 768px) {
    .ylyl-webcam-pip {
        width: 30%;
        min-width: 96px;
        max-width: 140px;
        bottom: 0.5rem;
        right: 0.5rem;
        border-width: 1px;
    }
}

/* Slight zoom crops side "more videos" panels YouTube shows on pause. */
.ylyl-player-host #player {
    position: absolute;
    inset: -6% -10%;
    width: 120%;
    height: 112%;
}

.ylyl-player-host #player,
.ylyl-player-host iframe {
    border: 0;
}

.ylyl-app > #player {
    display: none;
}

.ylyl-meter {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.5rem 0.75rem;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
}

.ylyl-meter-row {
    display: grid;
    grid-template-columns: 3.5rem 1fr 2.5rem;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.ylyl-meter-row:last-child {
    margin-bottom: 0;
}

.ylyl-meter-name {
    font-size: 0.8rem;
}

.ylyl-meter-bar {
    height: 8px;
    background: #333;
    border-radius: 4px;
    overflow: hidden;
}

.ylyl-meter-fill {
    height: 100%;
    width: 0%;
    transition: width 0.08s linear;
}

.ylyl-meter-fill.smile {
    background: linear-gradient(90deg, #4caf50, #ff9800);
}

.ylyl-meter-fill.jaw {
    background: linear-gradient(90deg, #2196f3, #f44336);
}

.ylyl-meter-val {
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.ylyl-stats-row {
    display: flex;
    gap: 2rem;
    justify-content: center;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.ylyl-stat {
    text-align: center;
}

.ylyl-stat-val {
    display: block;
    font-size: 1.75rem;
    font-weight: bold;
    color: orange;
}

.ylyl-stat-label {
    font-size: 0.85rem;
    color: #666;
}

.ylyl-timeline-wrap {
    margin: 1rem 0;
}

.ylyl-timeline-label {
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
    color: #444;
}

.ylyl-timeline-label-prominent {
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
}

.ylyl-timeline-canvas-wrap {
    position: relative;
    height: 80px;
    border-radius: 4px;
    overflow: hidden;
    background: #e8e8e8;
}

.ylyl-timeline-canvas {
    display: block;
    width: 100%;
    height: 80px;
    cursor: crosshair;
}

.ylyl-timeline-playhead {
    position: absolute;
    top: 0;
    width: 2px;
    height: 100%;
    background: #2196f3;
    pointer-events: none;
    z-index: 2;
    left: 0;
}

.ylyl-timeline-times {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.25rem;
}

.ylyl-abort {
    margin-top: 0.5rem;
}

.ylyl-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.ylyl-result-card {
    text-align: center;
    padding: 1rem;
    background: #f5f5f5;
    border-radius: 8px;
}

.ylyl-result-card-clickable {
    cursor: pointer;
    transition: background 0.15s ease;
}

.ylyl-result-card-clickable:hover:not(.ylyl-result-card-disabled) {
    background: #e8e8e8;
}

.ylyl-result-card-clickable:focus-visible {
    outline: 2px solid orange;
    outline-offset: 2px;
}

.ylyl-result-card-disabled {
    cursor: default;
    opacity: 0.65;
}

.ylyl-result-val {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    color: orange;
}

.ylyl-result-label {
    font-size: 0.85rem;
    color: #666;
}

.ylyl-replay-wrap {
    margin: 1.5rem 0;
}

.ylyl-replay-wrap h4 {
    color: #fff;
    margin-bottom: 0.75rem;
}

.ylyl-replay-stack {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    max-height: min(70vh, 720px);
    margin: 0 auto;
    background: #000;
    border-radius: 4px;
    overflow: hidden;
}

.ylyl-replay-stack #replay-video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}

.ylyl-youtube-pip {
    position: absolute;
    bottom: 0.75rem;
    right: 0.75rem;
    width: 32%;
    min-width: 140px;
    max-width: 240px;
    z-index: 4;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.55);
    background: #000;
}

.ylyl-player-host-pip {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
}

.ylyl-youtube-pip .ylyl-player-host #player {
    inset: -4% -8%;
    width: 116%;
    height: 108%;
}

@media (max-width: 768px) {
    .ylyl-youtube-pip {
        width: 38%;
        min-width: 112px;
        max-width: 180px;
        bottom: 0.5rem;
        right: 0.5rem;
        border-width: 1px;
    }
}

.ylyl-loading {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.ylyl-loading-text {
    color: #fff;
    font-size: 1.25rem;
    padding: 1.5rem 2rem;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 8px;
}
