*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&display=swap');

body {
  font-family: 'Playfair Display', serif;
}
body.welcome{
    background: url(bg/1.png);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}
body.welcome .container{
    text-align: center;
    color: #ffe99a;
    background-color: #ff9898;
    border-radius: 20px;
    padding: 40px;
    font-family: 'Playfair Display', serif;
    width: 35%;
}
body.welcome .container h1{
    font-size: 40px;
    font-weight: bolder;
}
body.welcome .container p{
    font-size: 30px;
    margin-bottom: 20px;
    font-weight: bolder;
}
#username{
    padding: 10px;
    font-size: 20px;
    border-radius: 10px;
    border: none;
    outline: none;
    margin-bottom: 20px;
    text-align: center;
    background-color: #ffe99a;
}
body.welcome .container button{
    padding: 10px 20px;
    font-size: 20px;
    border-radius: 10px;
    border: none;
    outline: none;
    background-color: #ffe99a;
    cursor: pointer;
    color: #ff9898;
}
body.welcome .container button:hover{
    background-color: #fadf7e;
}

body.welcome .container {
    text-align: center;
    color: #ffe99a;
    background-color: rgba(255, 152, 152, 0.95);
    border-radius: 20px;
    padding: 40px;
    font-family: 'Playfair Display', serif;
    width: 35%;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);

    /* Initially hidden */
    opacity: 0;
    transform: scale(0.7);
    transition: all 0.5s ease;
}

/* When active, it pops up */
body.welcome .container.show {
    opacity: 1;
    transform: scale(1);
}

/*MANUAL*/
body.manual{
    background-color: #ff9898;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-family: 'Playfair Display', serif;
}

body.manual .box{
    text-align: center;
    color:#ff9898  ;
    background-color:  #ffe99a;
    border-radius: 20px;
    padding: 30px;
    font-family: 'Playfair Display', serif;
    width: 80%;
    height: 70vh;
    font-size: 30px;
    font-style: italic;
    font-weight: bolder;
}
body.manual h1{
    font-size: 50px;
    margin-bottom: 10px;
    font-weight: bolder;
    color: #fadf7e;
    font-style: italic;
    font-family: 'Playfair Display', serif;
    font-weight: bolder;
}

body.manual .box button{
    padding: 10px 50px;
    font-size: 30px;
    border-radius: 50px;
    border: none;
    outline: none;
    background-color: #ff9898;
    cursor: pointer;
    color: #ffe99a;
    margin-top: 40px;
    font-style: italic;
    font-family: 'Playfair Display', serif;
    font-weight: bolder;
}
body.manual .box button:hover{
    background-color: #f88d8d;
    color: #fadf7e;
}
body.manual .box button a{
    text-decoration: none;
    color: #ffe99a;
}

body.manual .box p{
    margin-top: 20px;

}


/*frame*/
body.frame{
    background: url(bg/bg2.png);
    width: 100%;
    height: 100vh;
    justify-content: center;
    align-items: center;
}

body.frame .frame-selector{
    text-align: center;
    color: #ff9898;
    font-size: 30px;
    padding: 30px;
    font-family: 'Playfair Display', serif;
    margin: auto;
    font-style: italic;
    font-weight: bolder;
}

.frames-grid {
  display: flex;
  justify-content: center;
  margin-top: 20px;
    gap: 20px;
}

.frame-option {
  cursor: pointer;
  transition: transform 0.3s ease;
}

.frame-option img {
  width: 170px;
  padding: 10px;
}

.frame-option img:hover {
  transform: scale(1.05);
}

/*camera page*/
/* Popup Modal */
.popup {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(255, 253, 184, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
}

.popup-content {
  background: #ff9898;
  padding: 60px;
  border-radius: 15px;
  text-align: center;
  color: #ffe99a;
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-weight: bolder;
  font-size: larger;
  box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.popup-content h2 {
  margin-bottom: 15px;
  font-size: 40px;
}

.popup-content .buttons {
  margin-top: 20px;
}

.popup-content button {
  margin: 5px;
  padding: 10px 30px;
  font-size: 25px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: #ffe99a;
  color: #f88d8d;
  transition: 0.3s;
  font-family: 'Playfair Display', serif;
  font-weight: bolder;
  font-style: italic;
}

.popup-content button:hover {
  background: #fadf7e;
}

/* Hidden utility */
.hidden {
  display: none;
}

/* Camera */
.camera-box {
  text-align: center;
  margin-top: 30px;
}

#countdown {
  width: 110px;
  height: 110px;
  line-height: 110px; /* centers text vertically */
  font-size: 47px;
  font-weight: bold;
  color: #ffe99a;
  margin: 0 auto 20px; /* center horizontally + space below */
  background-color: #ff9898;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
#camera-stream {
  border: 8px solid #ffc9e0;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  max-width: 90%;
}


.photos img {
  width: 100px;
  margin: 5px;
  border-radius: 10px;
  border: 3px solid #ffe99a;
}

body.camera{
    background: url(bg/bg2.png);
    justify-content: center;
    align-items: center;
    font-family: 'Playfair Display', serif;
}

/* Success Popup */
.success-popup {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
}

.success-content {
  background: #ff9898;
  color: #ffe99a;
  padding: 40px;
  border-radius: 20px;
  text-align: center;
  font-family: 'Playfair Display', serif;
  box-shadow: 0 8px 25px rgba(0,0,0,0.3);
  animation: popIn 0.4s ease;
}

.success-content h2 {
  margin-bottom: 25px;
}

.success-content button {
  margin-top: 20px;
  padding: 20px 28px;
  font-size: 18px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: #ffe99a;
  color: #f88d8d;
  font-weight: bold;
  transition: 0.3s;
}

.success-content button:hover {
  background: #fadf7e;
}

@keyframes popIn {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}


/* Preview Page */
body.preview {
  background: url(bg/bg3.png);
  font-family: 'Playfair Display', serif;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

.preview-container {
  text-align: center;
  background: rgba(255, 253, 184, 0.9);
  padding: 20px;
  border-radius: 15px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
  margin: 10px;
}

.preview-container h1 {
  color: #ff9898;
  margin-bottom: 20px;
  font-size: 36px;
  font-weight: bolder;
}

.photo-grid {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  margin: 10px 0;
}

.photo-grid img {
  width: 150px;
  margin: 8px;
  border: 3px solid #ff9898;
  border-radius: 10px;
}

.buttons button {
  margin: 20px;
  padding: 12px 30px;
  font-size: 18px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  font-style: italic;
  transition: 0.3s;
}

#retakeBtn {
  background: #f88d8d;
  color: #fff;
}
#retakeBtn:hover {
  background: #ff5c5c;
}

#downloadBtn {
  background: #98ffb0;
  color: #1f5c3c;
}
#downloadBtn:hover {
  background: #5cd67e;
}

.photos {
  display: flex;
  gap: 10px;
  margin-top: 15px;
  flex-wrap: wrap;
  justify-content: center;
}

.photos img.thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}


#previewPhotos canvas {
  max-width: 100%;     /* fit to screen width */
  max-height: 80vh;    /* limit height to viewport */
  height: auto;        /* keep aspect ratio */
  display: block;
  margin: 0 auto;      /* center it */
}

/* Media Queries for Mobile Phones */
@media (max-width: 600px) {

    /* WELCOME Page */
    body.welcome .container {
        width: 85%;
        padding: 20px;
    }

    body.welcome .container h1 {
        font-size: 28px;
    }

    body.welcome .container p {
        font-size: 20px;
        margin-bottom: 15px;
    }

    #username {
        width: 80%;
        font-size: 16px;
    }

    body.welcome .container button {
        font-size: 16px;
        padding: 8px 16px;
    }

    /* MANUAL Page */
    body.manual .box {
        width: 90%;
        padding: 20px;
        height: auto;
    }

    body.manual h1 {
        font-size: 30px;
    }

    body.manual .box p {
        font-size: 18px;
        margin-top: 10px;
    }

    body.manual .box button {
        font-size: 20px;
        padding: 8px 30px;
        margin-top: 20px;
    }

    /* FRAME Page */
    body.frame .frame-selector {
        font-size: 20px;
        padding: 20px;
    }

    .frames-grid {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }

    .frame-option img {
        width: 120px;
    }

    /* CAMERA Page */
    .popup-content {
        width: 90%;
        padding: 30px;
        font-size: medium;
    }

    .popup-content h2 {
        font-size: 24px;
    }

    .popup-content button {
        font-size: 18px;
        padding: 8px 20px;
    }

    #countdown {
        width: 80px;
        height: 80px;
        font-size: 30px;
        line-height: 80px;
    }

    #camera-stream {
        max-width: 100%;
        border-width: 4px;
    }

    .success-content {
        width: 90%;
        padding: 30px;
    }

    /* PREVIEW Page */
    body.preview {
        flex-direction: column;
        justify-content: flex-start;
        padding: 20px 0;
        min-height: 100vh;
    }

    .preview-container {
        width: 95%;
        padding: 15px;
    }

    .preview-container h1 {
        font-size: 24px;
        margin-bottom: 15px;
    }

    .photo-grid img {
        width: 100px;
        margin: 5px;
    }

    #previewPhotos canvas {
        max-width: 95%;
        max-height: 60vh;
    }

    .buttons button {
        padding: 10px 20px;
        font-size: 16px;
        margin: 10px;
    }
}