body {
    background-color: #fffefc;
    font-family: Arial, sans-serif;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 10px;
    padding-bottom: 40px;
    box-sizing: border-box;
}

.header-container {
    margin: 20px 0 20px 0;
    text-align: center;
    width: 100%;
    max-width: 800px;
}
.header-container h1 {
    font-family: Arial, sans-serif;
    font-size: 3rem; 
    font-weight: 700;
    color: #3a3a3a;
    border-bottom: 4px dashed #6b6b6b;
    padding-bottom: 10px;
    display: inline-block; 
}
.container {
    display: flex;
    flex-wrap: wrap; 
    justify-content: center;
    gap: 30px; 
    width: 100%;
    max-width: 1200px;
}

.note-card {
    width: 250px;
    height: 250px; 
    aspect-ratio: 1 / 1; 
    cursor: pointer;
    margin-bottom: 10px; 
    position: relative; 
    background-color: #ffffff; 
}

.note-card:nth-child(n+4) { margin-top: 20px; }
.note-card:nth-child(2) { margin-top: 15px; }

.front-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%; 
    overflow: hidden; 
    z-index: 10;
    
    transition: height 0.6s ease-in-out, box-shadow 0.6s ease-in-out, transform 0.6s ease-in-out;

    box-shadow: 
        4px 4px 10px rgba(0, 0, 0, 0.2),
        0 0 1px 0 rgba(0, 0, 0, 0.15) inset; 
        
}

.back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    
    display: flex;
    flex-direction: column; 
    align-items: center;
    
    background-color: #ffffff; 
    z-index: 5; 
    
    box-shadow: none; 
    border: none;
    box-sizing: border-box;
    
    padding: 15px; 
    justify-content: center; 
    gap: 10px;
}

.front {
    position: absolute; 
    top: 0; 
    left: 0;
    width: 100%;
    height: 100%; 
    
    font-family: 'Gochi Hand', cursive; 
    font-size: 1.5rem; 
    font-weight: 400;
    color: #333;
    text-align: center;
    
    transition: transform 0.6s ease-in-out, opacity 0.1s ease-out; 
    opacity: 1; 
    
    display: flex; 
    justify-content: center;
    align-items: center;
    padding: 15px;
    box-sizing: border-box;
    
    box-shadow: none; 
    border: none;
    background-color: transparent !important; 
    
    box-shadow: 0 -140px 20px -140px rgba(0, 0, 0, 0.3) inset;
    -webkit-box-shadow: 0 -140px 20px -140px rgba(0, 0, 0, 0.3) inset; 
}

.yellow .front-layer { 
    background-color: #fff740; 
    background-image: 
        -webkit-linear-gradient(top, rgba(251,236,63,.0) 75%, #f7bb37 95%),
        -moz-linear-gradient(top, rgba(251,236,63,.0) 75%, #f7bb37 95%),
        linear-gradient(to bottom, rgba(251,236,63,.0) 75%, #f7bb37 95%);
} 

.pink .front-layer { 
    background-color: #ff7eb9; 
    background-image: 
        -webkit-linear-gradient(top, rgba(255,126,185,.0) 75%, #e04092 95%),
        -moz-linear-gradient(top, rgba(255,126,185,.0) 75%, #e04092 95%),
        linear-gradient(to bottom, rgba(255,126,185,.0) 75%, #e04092 95%);
}  

.green .front-layer { 
    background-color: #99ff99; 
    background-image: 
        -webkit-linear-gradient(top, rgba(153,255,153,.0) 75%, #50c850 95%),
        -moz-linear-gradient(top, rgba(153,255,153,.0) 75%, #50c850 95%),
        linear-gradient(to bottom, rgba(153,255,153,.0) 75%, #50c850 95%);
} 

.blue .front-layer { 
    background-color: #9966cc; 
    background-image: 
        -webkit-linear-gradient(top, rgba(153,102,204,.0) 75%, #7a3eaf 95%),
        -moz-linear-gradient(top, rgba(153,102,204,.0) 75%, #7a3eaf 95%),
        linear-gradient(to bottom, rgba(153,102,204,.0) 75%, #7a3eaf 95%);
}  

.orange .front-layer { 
    background-color: #ffc14a; 
    background-image: 
        -webkit-linear-gradient(top, rgba(255,193,74,.0) 75%, #e68a00 95%),
        -moz-linear-gradient(top, rgba(255,193,74,.0) 75%, #e68a00 95%),
        linear-gradient(to bottom, rgba(255,193,74,.0) 75%, #e68a00 95%);
}  

.bright-blue .front-layer { 
    background-color: #00bfff; 
    background-image: 
        -webkit-linear-gradient(top, rgba(0,191,255,.0) 75%, #0080ff 95%),
        -moz-linear-gradient(top, rgba(0,191,255,.0) 75%, #0080ff 95%),
        linear-gradient(to bottom, rgba(0,191,255,.0) 75%, #0080ff 95%);
}  

.back a {
    text-decoration: none;
    color: #0000ff; 
    font-weight: bold;
    font-size: 1rem; 
    font-family: Arial, sans-serif;
    padding: 5px;
    transition: color 0.3s;
    text-align: center;
}
.back a:hover {
    color: #ff00ff; 
}

.note-card:hover .front-layer {
    
    height: 30%; 
    
    box-shadow: 
        0 10px 15px 5px rgba(0, 0, 0, 0.4), 
        0 4px 8px -4px rgba(0, 0, 0, 0.5) inset;
        transform: translateY(-5px); 
}

.note-card:hover .front {
    opacity: 0; 
    transform: translateY(0); 
    transition: opacity 0.1s ease-out, transform 0.6s ease-in-out;

    box-shadow: inset 0 -125px 50px -80px rgba(0, 0, 0, 0.15);
    -webkit-box-shadow: inset 0 -125px 50px -80px rgba(0, 0, 0, 0.15);
}

.note-card:hover .front-layer::after {
    border-width: 0 0 0 0; 
}

.note-card:nth-child(1) { transform: rotate(2deg); }
.note-card:nth-child(2) { transform: rotate(-3deg); }
.note-card:nth-child(3) { transform: rotate(1deg); }
.note-card:nth-child(4) { transform: rotate(-4deg); }
.note-card:nth-child(5) { transform: rotate(3deg); }
.note-card:nth-child(6) { transform: rotate(-2deg); }

@media (max-width: 768px) {
    body {
        min-height: auto;
        padding-bottom: 20px;
    }
    .header-container h1 { font-size: 2rem; }
    .container {
        flex-direction: column; 
        align-items: center;
        gap: 20px;
        padding: 10px;
        padding-bottom: 0;
    }
    .note-card {
        width: 80vw; 
        max-width: 300px;
        height: auto; 
        aspect-ratio: 1/1; 
        margin-top: 0 !important; 
        margin-bottom: 10px !important;
        transform: rotate(0deg) !important; 
    }
    .note-card:nth-child(n+4) { margin-top: 0 !important; }
    .note-card:nth-child(2) { margin-top: 0 !important; }
    .note-card:last-child { margin-bottom: 0 !important; }
    .back a { font-size: 1.1rem; }
}
