* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

@media (min-width: 1000px) {
#toggle-container {
    font-family: "Instrument Serif", serif;
    font-weight: 400;
    font-style: italic;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width:fit-content;
}

.emoji {
    font-size: 1em;
    color: #b00808;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

#toggle-close {
    display: none;
}

#slide-text {
    font-family: "Instrument Serif", serif;
    font-weight: 400;
    font-style: normal;
    font-size: 0.8em;
    margin-bottom: 2%;
    width: fit-content;
    white-space: nowrap;
    color: #b00808;
    text-align: left;
    color: #b00808;
    padding: 3%;
    margin-top: 3%;
    margin-left: 2%;
    position: relative;
    display: none;
    animation: slideIn 0.5s ease-out forwards ;
}

@keyframes slideIn {
    0% {
        transform: translateX(-100%)!important;
    }
    100% {
        transform: translateX(0)!important;
    }
}

#slide-text a{
    color: red;
}

#slide-text a:hover{
    color: red;
    font-style: italic;
}


h2 {
    font-family: "Instrument Serif", serif;
    font-weight: 400;
    font-style: normal;
    margin-bottom: 2%;
    color: #b00808;
    text-align: center;
}
  
  .instrument-serif-regular-italic {
    font-family: "Instrument Serif", serif;
    font-weight: 400;
    font-style: italic;
  }
  
  .eb-garamond-font {
    font-family: "EB Garamond", serif;
    font-optical-sizing: auto;
    font-weight: 400;
    font-style: normal;
  }

  :root {
    --gradient-primary: #fff3c7;
    --gradient-secondary: #d4ab6d;
    --gradient-accent: #d5925b;
    --gradient-dark: #c3684b;
}

  body {
    background: radial-gradient(
        circle at 50% 50%,
        var(--gradient-primary) 0%,
        var(--gradient-secondary) 45%,
        var(--gradient-accent) 75%,
        var(--gradient-dark) 100%
    );
    height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    transition: 0.3s ease;
    overflow: hidden
}

.card {
    background-color:#fdf4c4;
    border: 1px solid #b00808;
    backdrop-filter: blur(10px);
    border-radius: 10px;
    box-shadow: 
        0 15px 35px rgba(139, 119, 102, 0.1),
        0 3px 10px rgba(0, 0, 0, 0.1);
    padding-top: 10%;
    padding-left: 10%;
    padding-right: 10%;
    padding-bottom: 10%;
    width: 30vw;
    height: 30%;
    position: relative;
    opacity: 0; /* Make it invisible initially */
    transition: opacity 2s ease-out, transform 2s ease-out;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 8px;
    background: transparent;
    border: 2px dotted #b00808;  /* Dotted border */
    pointer-events: none; /* Ensures it doesn't interfere with clicks */
    margin: 1.5%;
}

/* When the 'active' class is added, fade in and move up */
.card.active {
    opacity: 1;
    transform: translateY(0); /* Move it to its final position */
}

/* Screen Transitions */
.screen {
    display: none;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.screen.active {
    display: block;
    opacity: 1;
}

/* Verification Screen */
.name-input-container {
    display: flex;
    gap: 10px;
}

input {
    flex: 1;
    padding: 2%;
    padding-left: 5%;
    border-radius: 10px;
    border: 1px solid #b00808;
    background-color: #fffbde;
    font-family: "Instrument Serif", serif;
    font-weight: 400;
    font-style: italic;
    font-size: 0.8em;
}

input:active {
    border: 1px solid #b00808;
}

input:focus {
    border: 2px solid #b00808;  /* You can also add a focus effect, like changing the border color */
    transition: 0.1s ease;
    outline: none;  /* Remove the outline for a cleaner look */
}

.submit-btn {
    padding: 2% 6%;
    background-color:#fffbde;
    border: 1px solid #b00808;
    color: #b00808;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: "Instrument Serif", serif;
    font-weight: 400;
    font-style: normal;
    font-size: 1em;
}

.submit-btn:hover {
    background-color: #b00808;
    color: #fdf4c4;
    transform: translateY(-2px);
}

h1 {
    color: #b00808;
    font-size: 0.8em;
    text-align: center;
    font-family: "Instrument Serif", serif;
    font-weight: 400;
    font-style: italic;
    margin-top: 10%;
}

.error-message {
    color: #b00808;
    font-size: 0.8em;
    text-align: center;
    margin: 10px 0;
    min-height: 20px;
    font-family: "Instrument Serif", serif;
    font-weight: 400;
    font-style: italic;
}

#questionContainer {
    color: #b00808;
    font-size: 1em;
    text-align: left;
    font-family: "Instrument Serif", serif;
    font-weight: 400;
    margin: 5%;
}

/* Multiple Choice Questions */
.multiple-choice {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10% 3%;
    margin-top: 3%;
    margin-bottom: 5%;
}

.choice-btn {
    padding: 4% 6%;
    background-color:#fffbde;
    border: 1px solid #b00808;
    color: #b00808;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: "Instrument Serif", serif;
    font-weight: 400;
    font-style: normal;
    font-size: 0.8em;
    margin-bottom: 2%;
    line-height:100%;
}

.choice-btn:hover {
    background-color: #b00808;
    color: #fdf4c4;
    transform: translateY(-2px);}

.choice-btn.selected {
    background-color: #b00808;
    color: #fdf4c4;
    transform: translateY(-2px);
}
#loadingScreen {
    transition: opacity 0.5s ease;
}

.screen {
    display: flex;
    opacity: 0;
}

#loadingScreen.screen.active {
    display: flex;
    opacity: 1;
}

.loading-message {
    text-align: center;
}

.loading-message h2 {
    font-size: 1.5em;
    margin: 0;
    padding: 0;
}

.screen {
    display: none;
}
#lettersScreen .card {
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    padding: 0 !important;
}

#lettersScreen .card::before {
    display: none !important;
}
.envelope-container {
    width: 100%;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70vh;
    position: relative;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    animation: slideIn 1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideIn {
    0% {
        transform: translateY(100vh); /* Start from below the viewport */
    }
    100% {
        transform: translateY(0); /* End at natural position */
    }
}

/* Add sliding animation for container */
.envelope-container.shift-down {
    animation: 1s ease; /* Remove the initial animation */
    transform: translateY(30vh); /* Use !important to override the initial animation */
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);}

.initial-envelope {
    width: 300px;
    height: 200px;
    background: #fff6ea;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    margin: 0 auto;
}

.envelope-text {
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    left: 50%;
    bottom: -15%;  /* Position below the letter content */
    transform: translateX(-50%);
    color: #b00808;
    font-family: "Instrument Serif", serif;
    font-weight: 400;
    font-style: italic;
    font-size: 1em;
    opacity: 0.8;
    transition: opacity 0.3s ease;
    text-transform: lowercase;
    z-index: 10;
    width: 100%;
    text-align: center;
}

.envelope-flap {
    position: absolute;
    top: 0;
    width: 100%;
    height: 100%;
    background: #e0d3c1;
    clip-path: polygon(0 0, 50% 50%, 100% 0);
    z-index: 3;
    transition: transform 0.8s ease;
    transform-origin: top;
}

#letterScreen {
    width: 200%;
    height: 100%;
}

/* Letter Animation Styles */
.letter-content {
    position: absolute;
    width: 170%;
    max-width: 800px;
    border: 1px solid #b00808;
    height: auto;
    background: #fff3c7;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    padding: 10% 10% 20% 10%;  /* Increased bottom padding to make room for click text */
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    z-index: 5;
    border-radius: 10px;
    font-family: "Instrument Serif", serif;
    position: relative;  /* Added to establish positioning context for envelope-text */
}

.letter-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 8px;
    background: transparent;
    border: 2px dotted #b00808;  /* Dotted border */
    pointer-events: none; /* Ensures it doesn't interfere with clicks */
    margin: 1.5%;
}

/* Opening Animation States */
.envelope.opening .envelope-flap {
    transform: rotateX(180deg);
}

.envelope.opening .letter-content {
    transform: translate(-50%, -50%) translateY(-20vh);
    opacity: 1;
}

pre {
    font-family: "Instrument Serif", serif;  /* Optional: set font */
    white-space: pre-line;  /* Preserve line breaks and allow wrapping */
}
}

@media (max-width: 999px){
    #toggle-container {
        font-family: "Instrument Serif", serif;
        font-weight: 400;
        font-style: italic;
        position: fixed;
        top: 2%;
        left: 5%;
        z-index: 1000;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        width:fit-content;
    }
    
    .emoji {
        font-size: 3em;
        color: #b00808;
        cursor: pointer;
        transition: opacity 0.3s ease;
    }
    
    #toggle-close {
        display: none;
    }
    
    #slide-text {
        font-family: "Instrument Serif", serif;
        font-weight: 400;
        font-style: normal;
        font-size: 2em;
        margin-bottom: 2%;
        width: fit-content;
        white-space: nowrap;
        color: #b00808;
        text-align: left;
        color: #b00808;
        padding: 0%;
        margin-top: 2%;
        margin-left: 2%;
        position: relative;
        display: none;
        animation: slideIn 0.5s ease-out forwards ;
    }
    
    @keyframes slideIn {
        0% {
            transform: translateX(-100%)!important;
        }
        100% {
            transform: translateX(0)!important;
        }
    }
    
    #slide-text a{
        color: red;
    }
    
    #slide-text a:hover{
        color: red;
        font-style: italic;
    }
    
    
    h2 {
        font-family: "Instrument Serif", serif;
        font-weight: 400;
        font-style: normal;
        margin-bottom: 4%;
        line-height: 100%;
        color: #b00808;
        text-align: center;
        font-size: 3.5em;
    }
      
      .instrument-serif-regular-italic {
        font-family: "Instrument Serif", serif;
        font-weight: 400;
        font-style: italic;
      }
      
      .eb-garamond-font {
        font-family: "EB Garamond", serif;
        font-optical-sizing: auto;
        font-weight: 400;
        font-style: normal;
      }
    
      :root {
        --gradient-primary: #fff3c7;
        --gradient-secondary: #d4ab6d;
        --gradient-accent: #d5925b;
        --gradient-dark: #c3684b;
    }
    
      body {
        background: radial-gradient(
            circle at 50% 50%,
            var(--gradient-primary) 0%,
            var(--gradient-secondary) 45%,
            var(--gradient-accent) 75%,
            var(--gradient-dark) 100%
        );
        height: 100vh;
        width: 100vw;
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 20px;
        transition:  0.3s ease;
        overflow: hidden;
    }
    
    .card {
        background-color:#fdf4c4;
        border: 2.5px solid #b00808;
        backdrop-filter: blur(10px);
        border-radius: 10px;
        box-shadow: 
            0 15px 35px rgba(139, 119, 102, 0.1),
            0 3px 10px rgba(0, 0, 0, 0.1);
        padding-top: 10%;
        padding-left: 15%;
        padding-right: 15%;
        padding-bottom: 10%;
        width: 60vw;
        height: 30%;
        position: relative;
        opacity: 0; /* Make it invisible initially */
        transition: opacity 2s ease-out, transform 2s ease-out;
    }
    
    .card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        border-radius: 8px;
        background: transparent;
        border: 5px dotted #b00808;  /* Dotted border */
        pointer-events: none; /* Ensures it doesn't interfere with clicks */
        margin: 1.5%;
    }
    
    /* When the 'active' class is added, fade in and move up */
    .card.active {
        opacity: 1;
        transform: translateY(0); /* Move it to its final position */
    }
    
    /* Screen Transitions */
    .screen {
        display: none;
        opacity: 0;
        transition: opacity 0.8s ease;
    }
    
    .screen.active {
        display: block;
        opacity: 1;
    }
    
    /* Verification Screen */
    .name-input-container {
        display: flex;
        gap: 10px;
    }
    
    input {
        flex: 1;
        padding: 2%;
        padding-left: 5%;
        border-radius: 10px;
        border: 2px solid #b00808;
        background-color: #fffbde;
        font-family: "Instrument Serif", serif;
        font-weight: 400;
        font-style: italic;
        font-size: 1.5em;
    }
    
    input:active {
        border: 2px solid #b00808;
    }
    
    input:focus {
        border: 2.5px solid #b00808;  /* You can also add a focus effect, like changing the border color */
        transition: 0.1s ease;
        outline: none;  /* Remove the outline for a cleaner look */
    }
    
    .submit-btn {
        padding: 2% 6%;
        background-color:#fffbde;
        border: 2px solid #b00808;
        color: #b00808;
        border-radius: 10px;
        cursor: pointer;
        transition: all 0.3s ease;
        font-family: "Instrument Serif", serif;
        font-weight: 400;
        font-style: normal;
        font-size: 1.5em;
    }
    
    .submit-btn:hover {
        background-color: #b00808;
        color: #fdf4c4;
        transform: translateY(-2px);
    }
    
    h1 {
        color: #b00808;
        font-size: 1em;
        text-align: center;
        font-family: "Instrument Serif", serif;
        font-weight: 400;
        font-style: italic;
        margin-top: 10%;
    }
    
    .error-message {
        color: #b00808;
        font-size: 1.5em;
        text-align: center;
        margin: 10px 0;
        min-height: 20px;
        font-family: "Instrument Serif", serif;
        font-weight: 400;
        font-style: italic;
    }

#question-text {
    margin-top: 10%;
}
    
    #questionContainer {
        color: #b00808;
        font-size: 1.5em;
        text-align: left;
        font-family: "Instrument Serif", serif;
        font-weight: 400;
        margin: 5%;
    }
    
    /* Multiple Choice Questions */
    .multiple-choice {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10% 3%;
        margin-top: 3%;
        margin-bottom: 10%;
    }
    
    .choice-btn {
        padding: 2% 6%;
        background-color:#fffbde;
        border: 1px solid #b00808;
        color: #b00808;
        border-radius: 10px;
        cursor: pointer;
        transition: all 0.3s ease;
        font-family: "Instrument Serif", serif;
        font-weight: 400;
        font-style: normal;
        font-size: 1em;
        margin-bottom: 2%;
        line-height: 100%;
    }
    
    .choice-btn:hover {
        background-color: #b00808;
        color: #fdf4c4;
        transform: translateY(-2px);}
    
    .choice-btn.selected {
        background-color: #b00808;
        color: #fdf4c4;
        transform: translateY(-2px);
    }
    #loadingScreen {
        transition: opacity 0.5s ease;
    }
    
    .screen {
        display: flex;
        opacity: 0;
    }
    
    #loadingScreen.screen.active {
        display: flex;
        opacity: 1;
    }
    
    .loading-message {
        text-align: center;
    }
    
    .loading-message h2 {
        font-size: 2.5em;
        margin: 0;
        padding: 0;
    }
    
    .screen {
        display: none;
    }
    #lettersScreen .card {
        background-color: transparent !important;
        border: none !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
        padding: 0 !important;
    }
    
    #lettersScreen .card::before {
        display: none !important;
    }
    .envelope-container {
        width: 100%;
        padding: 20px;
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 70vh;
        position: relative;
        transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
        animation: slideIn 1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    }
    
    .initial-envelope {
        width: 90%;
        max-width: 500px;
        height: 300px;
        background: #fff6ea;
        position: relative;
        cursor: pointer;
        transition: all 0.3s ease;
        box-shadow: 0 5px 15px rgba(0,0,0,0.2);
        margin: 0 auto;
    }
    
    .envelope-flap {
        position: absolute;
        top: 0;
        width: 100%;
        height: 100%;
        background: #e0d3c1;
        clip-path: polygon(0 0, 50% 50%, 100% 0);
        z-index: 3;
        transition: transform 0.8s ease;
        transform-origin: top;
    }
    
    .envelope-text {
        display: flex;
        justify-content: center;
        align-items: center;
        position: absolute;
        left: 50%;
        bottom: -20%;  /* Position below the letter content */
        transform: translateX(-50%);
        color: #b00808;
        font-family: "Instrument Serif", serif;
        font-weight: 400;
        font-style: italic;
        font-size: 2em;
        opacity: 0.8;
        transition: opacity 0.3s ease;
        text-transform: lowercase;
        z-index: 10;  /* Lower z-index than the letter content */
        width: 100%;
        text-align: center;
    }
    
    .letter-content {
        width: 90%;
        max-width: 500px;
        font-size: 2em;
        padding: 8% 8% 25% 8%;  /* Increased bottom padding for mobile to make room for click text */
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        border: 1px solid #b00808;
        background: #fff3c7;
        box-shadow: 0 0 10px rgba(0,0,0,0.1);
        transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
        opacity: 0;
        z-index: 15;  /* Increased z-index to ensure it's above the envelope text */
        border-radius: 10px;
        font-family: "Instrument Serif", serif;
    }
    
    .letter-content::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        border-radius: 8px;
        background: transparent;
        border: 2px dotted #b00808;  /* Dotted border */
        pointer-events: none; /* Ensures it doesn't interfere with clicks */
        margin: 1.5%;
    }
    
    .envelope.opening .letter-content {
        transform: translate(-50%, -50%) translateY(-4vh);
        opacity: 1;
    }

    .envelope.opening .envelope-flap {
        transform: rotateX(180deg);
    }

    [data-name="letters"].envelope.opening .letter-content {
        transform: translate(-50%, -50%) translateY(-4vh);
        opacity: 1;
    }
    
    pre {
        font-family: "Instrument Serif", serif;  /* Optional: set font */
        white-space: pre-line;  /* Preserve line breaks and allow wrapping */
    }
    }