body {
    font-family: "Kosugi maru", sans-serif;
    background-color: #fcfcff;
    color: #505070;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    text-align: center;
    overflow-y: scroll;
    line-height: 1.5;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1100px;
    background-color: #f0f0ff;
    font-size: clamp(12px, 1.8vw, 18px);
    font-family: "Zen Maru Gothic", sans-serif;
    margin: 0 auto;
    border-bottom: 5px solid #e7e7ff;
    box-sizing: border-box;
}

header h1 {
    margin-left: 10px;
}

main {
    flex-grow: 1;
    margin: 0 auto;
    width: 100%;
    max-width: 1100px;
    display: flex;
    flex-direction: column;
}

section {
    box-sizing: border-box;
}

.menu-button {
    position: fixed;
    z-index: 1200;
}
.menu-button::after { content: '☰'; }
.menu-button.open::after { content: '✕'; }

@media screen and (min-width: 769px) {
    main {
        flex-direction: row;
    }

    #system {
        background-color: #eeeeff;
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        padding-top: 50px;
    }

    .menu-button {
        display: none;
    }

    #s, #search, #d, #fixed-system-content {
        margin-bottom: 20px;
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    #search {
        flex-direction: row;
        justify-content: center;
        gap: 5px;
    }

    #sinput {
        width: 140px;
        height: 30px;
        border: 2px solid #ccccff;
        background-color: #fcfcff;
        border-radius: 5px;
    }

    #sbutton {
        width: 55px;
        height: 34px;
        color: #505070;
        font-size: 12px;
        border: 2px solid #ccccff;
        background-color: #fcfcff;
        border-radius: 5px;
        cursor: pointer;
    }

    #sbutton:hover {
        background-color: #eeeeff;
        border-color: #aaaaff;
    }

    #datepicker {
        font-family: "Kosugi maru", sans-serif;
        width: 190px;
        height: 30px;
        border: 2px solid #ccccff;
        border-radius: 5px;
    }

    #datepicker:focus, #sinput:focus {
        outline: none;
        border-color: #aaaaff;
    }

    #system-content {
        text-align: left;
        margin: 20px;
        padding: 15px;
        background-color: #ffffff;
        border-radius: 20px;
        border: 2px solid #ccccff;
        word-wrap: break-word;
        font-size: clamp(10px, 1.5vw, 14px);
        width: 80%;
    }

    #diary {
        background-color: #ffffff;
        flex: 3;
        padding: 20px 30px 15px;
        border-right: 5px solid #eeeeff;
        display: flex;
        flex-direction: column;
    }

    #diary-head {
        display: flex;
        align-items: baseline; 
        position: relative;
        margin-bottom: 30px;
        padding-bottom: 10px;
    }

    #diary-head h3 {
        margin: 0;
        font-family: "Zen Maru Gothic", sans-serif;
        z-index: 1; 
    }

    #diary-head h2 {
        margin: 0;
        font-family: "Zen Maru Gothic", sans-serif;
        position: absolute;
        left: 0;
        right: 0;
        text-align: center;
        pointer-events: none;
    }

    #diary p {
        text-align: left;
        flex-grow: 1;
    }
}

@media screen and (max-width: 768px) {
    #system {
        position: fixed;
        top: 10%;
        left: 0;
        width: 80%;
        height: 80%;
        border-radius: 0 10% 10% 0;
        background-color: #f8f8ff;
        z-index: 1100;
        transform: translateX(-100%);
        opacity: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        overflow-y: auto;
        transition: opacity 0.6s ease, transform 0.4s ease;
        border: 2px solid #ccccff;
        border-left: 0;
        padding-top: 40px;
    }

    main.menu-open #system {
        transform: translateX(0);
        opacity: 1;
    }

    .menu-button {
        top: 10%;
        right: 20px;
        font-size: 25px;
        cursor: pointer;
        color: #aaaaff;
    }

    #diary {
        width: 100%;
        padding: 20px 10px 100px;
        border-top: 5px solid #eeeeff;
    }

    #system-content {
        text-align: left;
        background-color: #ffffff;
        border-radius: 15px;
        margin: 20px;
        padding: 15px;
        width: 80%;
        min-height: 100px;
        border: 2px solid #ccccff;
        word-wrap: break-word;
        font-size: 15px;
    }

    #diary p{
        text-align: left;
    }
}

.diary-navigation {
    display: flex;
    justify-content: space-between;
    border-top: 2px dashed #eeeeff;
    padding-top: 15px;
    margin-top: 30px;
}

.nav-btn {
    font-family: "Zen Maru Gothic", sans-serif;
    background-color: #ffffff;
    color: #505070;
    border: 2px solid #ccccff;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background-color: #f0f0ff;
    border-color: #aaaaff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(204, 204, 255, 0.5);
}

#login {
    background-color: #ffffff;
    width: 120px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Kosugi maru", sans-serif;
    border: 2px solid #ccccff;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 10px;
}

#login:hover{
    background-color: #f0f0ff;
    border-color: #aaaaff;
    transform: translateY(-10%);
    box-shadow: 0 4px 8px rgba(204, 204, 255, 0.5);
}

#login a {
    text-decoration: none;
    color: #505070;
    display: block;
    line-height: 45px;
}

footer {
    background-color: #e7e7ff;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 10px 0;
}