body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#stage {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;

    --tap-size: 74px;
    --icon-size: 40px;
    --controls-top: 0px;
    --content-left: 0px;
    --content-width: 100%;
    --controls-gap: 10px;
}

.video-channel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    z-index: 1;
    transition: opacity 0.12s linear;
    background: #000;
}

.video-channel.active {
    opacity: 1;
    z-index: 2;
}

.instant-cut {
    transition: none !important;
    animation: none !important;
}

.ui-layer {
    position: absolute;
    inset: 0;
    z-index: 70;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
}

.ui-layer.visible {
    opacity: 1;
    pointer-events: auto;
}

.ui-layer.on-content .ui-btn {
    color: #333333;
}

.ui-layer.on-bar .ui-btn {
    color: #ffffff;
}

.ui-controls {
    position: absolute;
    left: var(--content-left);
    top: var(--controls-top);
    width: var(--content-width);
    height: var(--tap-size);
    pointer-events: none;
}

.ui-center-group {
    position: absolute;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    display: flex;
    gap: var(--controls-gap);
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.ui-btn {
    position: absolute;
    top: 0;
    width: var(--tap-size);
    height: var(--tap-size);
    border: none;
    padding: 0;
    margin: 0;
    background: transparent;
    color: #333;
    cursor: pointer;
    pointer-events: auto;
    touch-action: manipulation;
}

.ui-btn:disabled {
    pointer-events: none;
}

.ui-center-group .ui-btn {
    position: relative;
}

#btn-mic {
    left: 0;
}

#btn-fullscreen {
    right: 0;
}

.ui-btn::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: var(--icon-size);
    height: var(--icon-size);
    transform: translate(-50%, -50%);
    background-color: currentColor;
    opacity: 0.95;

    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    -webkit-mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: contain;
}

.ui-btn:active::before {
    transform: translate(-50%, -50%) scale(0.94);
}

#btn-mic.muted::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: calc(var(--icon-size) * 0.95);
    height: 2px;
    background: currentColor;
    transform: translate(-50%, -50%) rotate(-30deg);
    opacity: 0.95;
}

.icon-mic::before {
    -webkit-mask-image: url('icons/microphone.svg');
    mask-image: url('icons/microphone.svg');
}

.icon-prev::before {
    -webkit-mask-image: url('icons/prev-page.svg');
    mask-image: url('icons/prev-page.svg');
}

.icon-advance::before {
    -webkit-mask-image: url('icons/advance.svg');
    mask-image: url('icons/advance.svg');
}

.icon-next::before {
    -webkit-mask-image: url('icons/next-page.svg');
    mask-image: url('icons/next-page.svg');
}

.icon-fullscreen::before {
    -webkit-mask-image: url('icons/fullscreen.svg');
    mask-image: url('icons/fullscreen.svg');
}

.hidden {
    display: none !important;
}

#overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 110;
    color: white;
    padding: 20px;
    text-align: center;
}

#loader {
    width: min(440px, 82vw);
    height: 14px;
    margin-top: 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    overflow: hidden;
}

#loader-bar {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, #32cd7a 0%, #7bffb2 100%);
    transition: width 0.2s ease;
}

.access-modal {
    position: fixed;
    inset: 0;
    z-index: 150;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.86);
}

.access-modal-card {
    width: min(92vw, 420px);
    background: #161616;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    padding: 24px 20px;
    text-align: center;
    color: #fff;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.45);
}

.access-modal-card h2 {
    margin: 0 0 10px;
    font-size: 24px;
}

.access-modal-card p {
    margin: 0 0 16px;
    color: #d9d9d9;
}

#access-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#access-password-input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 18px;
    padding: 12px 14px;
    text-align: center;
    outline: none;
}

#access-password-input:focus {
    border-color: #32cd7a;
    box-shadow: 0 0 0 3px rgba(50, 205, 122, 0.22);
}

.access-error {
    min-height: 20px;
    margin: 0;
    color: #ff7b7b;
    font-size: 14px;
}

.access-submit {
    border: none;
    border-radius: 10px;
    background: linear-gradient(90deg, #32cd7a 0%, #7bffb2 100%);
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    padding: 12px 16px;
    cursor: pointer;
}

button.start-btn {
    padding: 20px 50px;
    font-size: 24px;
    cursor: pointer;
    background: linear-gradient(90deg, #32cd7a 0%, #7bffb2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    margin-top: 20px;
}

#status-panel {
    position: absolute;
    left: 12px;
    top: 12px;
    z-index: 85;
    max-width: min(72vw, 700px);
    background: rgba(0, 0, 0, 0.36);
    border-radius: 10px;
    padding: 8px 10px;
    color: #f1f1f1;
    pointer-events: none;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.status-line {
    font-size: 14px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#status-speech {
    margin-top: 4px;
    color: #e3e3e3;
}

.keyword-hit {
    color: #ff4f4f;
    font-weight: 700;
}

.speech-modal {
    position: fixed;
    inset: 0;
    z-index: 140;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.75);
    padding: 20px;
}

.speech-modal-card {
    width: min(92vw, 520px);
    background: rgba(18, 18, 18, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 16px;
    color: #fff;
    text-align: center;
    padding: 22px 20px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.45);
}

.speech-modal-card h2 {
    margin: 0 0 12px;
    font-size: 22px;
}

.speech-modal-card p {
    margin: 0 0 18px;
    color: #d2d2d2;
    line-height: 1.45;
}

.speech-modal-btn {
    border: none;
    border-radius: 10px;
    background: #1e8e3e;
    color: #fff;
    font-weight: 600;
    font-size: 16px;
    padding: 12px 18px;
    cursor: pointer;
}

.speech-modal-btn:active {
    transform: scale(0.98);
}
