/* 基本样式 */
* {
    text-align: justify;
}
/* 针对所有浏览器 */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* 针对Firefox */
input[type="number"] {
    -moz-appearance: textfield;
}

#mainbody {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    clear: both;
    margin: 2%;
}

#parameters {
    width: 30%;
    display: flex;
    flex-wrap: wrap;
    flex-direction: column;
}

#picture {
    width: 70%;
    display: flex;
    flex-wrap: wrap;
    flex-direction: column;
}

#parameters div, #style div {
    display: flex;
    flex-wrap: wrap;
}

#parameters div *, #style div * {
    display: inline-flex;
}

#result {
    display: flex;
    flex-direction: column;
}

input, select {
    width: 100px;
    box-sizing: border-box;
    margin: 5px;
}

img {
    max-width: 100%;
    height: auto;
    margin: 8px;
}

label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 15px;
}

#header>div:nth-child(2) {
    text-align: right;
    font-style: italic;
    color: gray;
}

p {
    margin: 20px;
}

/* 在小屏幕上，将布局改为垂直排列 */
@media (max-width: 600px) {
    #mainbody {
        flex-direction: column-reverse;
    }

    #parameters, #picture {
        width: 100%;
    }

    label {
        font-size: 15px;
    }

    input, select {
        width: 40%;
    }

    #preview_header {
        display: flex;
        flex-direction: column;
    }

    #img_uploader {
        align-self: center;
    }

    h1 {
        font-size: 1.2em;
    }

    #header>div:nth-child(2) {
        font-size: 8px;
    }

    div #corresponding span {
        width: 150px;
        left: -50%;
    }
}

#img_uploader {
    margin: 10px;
}

#corresponding {
    position: relative;
    display: inline-block;
    text-decoration: underline;
}

#corresponding span {
    visibility: hidden;
    width: 350px;
    background-color: #555;
    color: #fff;
    text-align: left;
    border-radius: 6px;
    padding: 15px;
    position: absolute;
    z-index: 1;
    top: 125%; 
    left: -30%; 
    margin-left: -60px;
    opacity: 0;
    transition: opacity 0.3s;
}

#corresponding:hover span {
    visibility: visible;
    opacity: 1;
}

#togglecookbook {
    color: blue;
    text-decoration: underline;
    font-style: italic;
    float: right;
    padding: 10px 20px;
}

#submitBtn {
    align-self: flex-end;
    width: auto;
    padding: 5px 10px;
}

.header {
    justify-self: center;
    display: inline-flex;
    justify-content: center;
    justify-items: center;
    width: 100%;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
}

.header::before, .header::after {
    content: "";
    flex-grow: 1;
    border-bottom: 2px solid;
}

.header::before {
    margin: auto 5px auto 0px;
}

.header::after {
    margin: auto 0px auto 5px;
}

#input, #style, #result {
    flex-direction: column;
    flex-wrap: wrap;
    align-content: center;
}

.result {
    visibility: hidden;
    display: flex;
    flex-direction: column;
}

#preview_header>div:first-child {
    display: flex;
}

#result span {
    margin: 0px 5px;
}

#result div {
    margin: 5px;
}

#preview_bottom input {
    width: fit-content;
    margin: 10px auto;
}

span.result {
    flex-direction: row;
}

.error {
    color: red;
    font-weight: bold;
    visibility: hidden;
}