* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d);
    min-height: 100vh;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: white;
}

.loading{
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh !important;
    background-color: #fff;
    z-index: 999999999;
    text-align: center;
    line-height: 50%;
    display: grid;
    place-items: center ;
    overflow: hidden;
}

.background
{
    background-color: #000;
    opacity: 0.8;
    position: fixed;
    width: 100%;
    bottom: 0 !important;
    height: 30vh;
}

.background-text
{
   
   
    position: fixed;
    width: 100%;
    bottom: 0 !important;
    height: 25vh;
    text-align: center;
    color: #e0e0e0;
    transition: 2s;
}

.background-text p
{
    transition: 4s;
}


.container {
    max-width: 800px;
    width: 100%;
    text-align: center;
}

header {
    padding: 20px 0;
    margin-bottom: 30px;
}

h1 {
    font-size: 2.5rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

#cameraContainer {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    aspect-ratio: 16/16;
    background: #000;
}

#cameraView {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transform: scaleX(-1); /* Effet miroir pour selfie */
}

#captureBtn {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: #fff;
    border: 5px solid #4285f4;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    transition: all 0.2s ease;
    z-index: 10;
}

#captureBtn:hover {
    transform: translateX(-50%) scale(1.05);
}

#captureBtn:active {
    transform: translateX(-50%) scale(0.95);
    background: #e0e0e0;
}

.inner-circle {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #4285f4;
}

#resultContainer,.resultContainer {
    width: 100%;
    max-width: 600px;
    margin: 30px auto;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    display: none;
}

.resultContainer {
    display: block !important;
}


#result,.result {
    width: 100%;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

#result img, .result img {
    width: 100%;
    display: block;
    transform: scaleX(-1); /* Effet miroir pour selfie */
}

.instructions {
    margin-top: 30px;
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 15px;
    max-width: 600px;
}

.instructions h2 {
    margin-bottom: 15px;
}

.instructions ol {
    text-align: left;
    padding-left: 20px;
}

.instructions li {
    margin-bottom: 10px;
    line-height: 1.6;
}

.error-message {
    color: #ff6b6b;
    font-weight: bold;
    padding: 20px;
    display: none;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    margin-top: 20px;
}

.status {
    margin: 15px 0;
    font-style: italic;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

.flash {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: white;
    opacity: 0;
    pointer-events: none;
    z-index: 5;
}




  /* HTML: <div class="loader"></div> */
.loader {
    height: 15px;
    margin-left: 30px;
    aspect-ratio: 5;
    display: grid;
    animation: l39-0 1s infinite linear; 
  }
  .loader:before,
  .loader:after {
    content: "";
    width: calc(140%/3);
    grid-area: 1/1;
    --_g: no-repeat radial-gradient(farthest-side,#000 94%,#0000);
    background:
      var(--_g) left,
      var(--_g) right;
    background-size: calc(300%/7) 100%;
    animation: l39-1 1s infinite linear; 
  }
  .loader:after {
    margin-left: auto;
    --s:-1;
  }
  @keyframes l39-0 {
    0%,30% {transform: rotate(0)}
    50%,100% {transform: rotate(.5turn)}
  }
  @keyframes l39-1 {
    30%,70% {transform:translate(calc(var(--s,1)*400%/14))}
  }

@keyframes flash {
    0% { opacity: 0; }
    50% { opacity: 0.8; }
    100% { opacity: 0; }
}

.flash.active {
    animation: flash 0.3s ease-out;
}

.selfie-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 100 100"><circle cx="50" cy="50" r="48" fill="none" stroke="%23fff" stroke-width="0.5" stroke-dasharray="5,5"/></svg>');
}

.first-photo
{

}

@media (max-width: 600px) {
    h1 {
        font-size: 2rem;
    }
    
    #cameraContainer {
        border-radius: 15px;
    }
    
    #captureBtn {
        width: 60px;
        height: 60px;
        bottom: 20px;
    }
    
    .inner-circle {
        width: 40px;
        height: 40px;
    }
}