body {
    font-family: Arial, sans-serif;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background-color: #333;
    /* Dark background for better contrast */
    color: #fff;
    /* White text color */
    overflow: hidden;
    /* Prevent scrollbars */
    user-select: none;
    -webkit-user-select: none;
}

.container {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    width: 100vw;
    height: 100vh;
}

.camera-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.camera-container {
    position: relative;
    width: 72px;
    height: 66px;
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 2rem;
}

.camera-button {
    width: 100%;
    height: 100%;
    background-color: transparent;
    border-radius: 50%;
    border: 3px solid white;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: background-color 0.3s ease;
    z-index: 2;
}

.camera-button:hover {
    background-color: white;
}

.camera-button:hover .time-counter {
    color: black;
}

.camera-button:focus,
.camera-button:active,
.camera-container:focus,
.camera-container:active {
    outline: none;
    box-shadow: none;
    -webkit-tap-highlight-color: transparent;
}

.progress {
    width: 120%;
    /* Outer circle size */
    height: 120%;
    /* Outer circle size */
    position: absolute;
    top: 49%;
    /* Center below button */
    left: 50%;
    transform: translate(-50%, -50%) rotate(-90deg);
    /* Center and rotate to start from the top */
    z-index: 1;
    /* Ensure circle is beneath the camera button */
    overflow: visible;
    /* Allow circle to show outside of container */
}

.progress circle {
    fill: none;
    stroke: none;
    /* Stroke color */
    stroke-width: 12px;
    /* Stroke width */
    stroke-dasharray: 314;
    /* Circumference of the circle */
    stroke-dashoffset: 314;
    /* Start hidden */
    transition: stroke-dashoffset 20s ease-in-out;
    /* Smooth transition */
}

@keyframes progress {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.display {
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.display img,
.display video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: none;
}

.time-counter {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: #fff;
    user-select: none;
}

.button-wrapper {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-around;
    position: fixed;
    bottom: 5vh;
}

#Ar,
#videoElement,
#canvasElement {
    width: 80vw;
    height: 90vh;
    object-fit: cover
}

#canvasElement {
    display: none;
}

.upload-button {
    margin-top: 20px;
    padding: 10px 20px;
    background-color: transparent;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s ease-in-out;
}

.upload-button:hover {
    background-color: #004084;
}

#fileInput {
    display: none;
}

.switch-camera-button {
    margin-top: 10px;
    padding: 10px 20px;
    background-color: transparent;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s ease-in-out;
}

.switch-camera-button:hover {
    background-color: #186729;
}

.toggle-camera-button {
    position: absolute;
    right: 1%;
    margin-top: 10px;
    background-color: transparent;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 24px;
    padding: 10px 20px;
    z-index: 2;
    transition: background-color 0.3s ease-in-out;
}

.action-buttons {
    display: none;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 1rem;
    position: absolute;
    bottom: 20%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
}

.action-buttons.disabled {
    opacity: 0.35;
    pointer-events: none;
    filter: grayscale(100%);
}

.action-buttons button {
    background: none;
    border: none;
    padding: 0;
    flex-shrink: 0;
    /* chống ép nhỏ */
}

.action-buttons img {
    width: 7rem;
    height: auto;
    display: block;
}

#loadingIndicator {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 64px;
    /* điều chỉnh kích thước nếu cần */
    height: 64px;
    transform: translate(-50%, -50%);
    z-index: 9999;
    animation: spin 1s linear infinite;
    pointer-events: none;
    /* tránh gây chặn nhấn các phần khác */
}

@keyframes spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.hidden {
    display: none !important;
}

@media (max-width: 729px) {
    #Ar {
        width: 100vw;
        height: 100vh;
    }
}