body {
    font-family: sans-serif;
    display: flex;
    margin: 0;
    height: 100vh;
    background-color: #efefef;
    color: #1e1e1e;
    overflow: hidden;
}

#shuomingshu {
    gap: 0px;
    max-width: 500px;
}

.container_que {
    text-align: center;
}

.container_que img {
    max-width: 100%;
    height: auto;
    border: 1px solid #1e1e1e;
    border-radius: 10px;
}

p {
    max-width: 500px;
}

#mainContainer {
    display: flex;
    width: 100%;
    height: 100%;
}

#canvasPanel {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
    background-color: #efefef;
    position: relative;
}

#lissajousCanvas {
    border: 1px solid #ccc;
    border-radius: 8px;
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    display: block;
}

#controlsPanel {
    min-width: 500px;
    padding: 20px;
    background-color: #ffffff;
    border-left: 1px solid #ccc;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-sizing: border-box;
}

#controlsPanel h1 {
    font-size: 1.5em;
    margin-top: 0;
    margin-bottom: 10px;
    text-align: center;
}

#controls {
    padding: 15px;
    background-color: #efefef;
    border-radius: 8px;
    border: 1px solid #ccc;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-sizing: border-box;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-group label {
    min-width: 150px;
    font-size: 0.9em;
    flex-shrink: 0;
}

input[type="file"],
button,
input[type="range"],
input[type="color"],
input[type="text"],
input[type="checkbox"] {
    background-color: #fff;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ccc;
    box-sizing: border-box;
    vertical-align: middle;
}

input[type="checkbox"] {
    padding: 0;
    margin: 0 5px;
    width: 16px;
    height: 16px;
}

input[type="range"] {
    flex-grow: 1;
}

input[type="color"] {
    min-width: 50px;
    padding: 4px;
    height: 36px;
}

button {
    background-color: #efefef;
    color: #1e1e1e;
    cursor: pointer;
    min-width: 90px;
    font-size: 0.9em;
    height: 36px;
    border: #ccc 1px solid;
}

button:hover {
    background-color: #1e1e1e;
    color: #efefef;
}

button:disabled {
    background-color: #aaa;
    cursor: not-allowed;
}

.info-area {
    font-size: 0.85em;
    min-height: 1.2em;
    color: #1e1e1e;
    padding: 8px;
    background-color: #efefef;
    border: #ccc 1px solid;
    border-radius: 8px;
}

#errorMessage {
    font-size: 0.85em;
    color: red;
    min-height: 1.2em;
    padding: 8px;
    background-color: #ffe0e0;
}

#progressBar:not(:disabled) {
    cursor: pointer;
}


/* 响应式布局：当屏幕宽度小于 1024px 时，采用上下布局 */
@media (max-width: 1023px) {

    p {
        max-width: 1022px;
    }

    #mainContainer {
        flex-direction: column;
    }

    #shuomingshu {
        max-width: 1022px;
    }

    #canvasPanel {
        flex: none;
        width: 100%;
        height: calc(100vw - 40px);
        max-height: calc(100vh - 250px);
        min-width: auto;
        padding: 15px;
    }

    #controlsPanel {
        width: 100%;
        min-width: auto;
        flex: 1;
        border-left: none;
        border-top: 1px solid #ccc;
        box-shadow: none;
        padding: 15px;
    }

    #controlsPanel h1 {
        font-size: 1.3em;
    }

    .control-group label {
        min-width: 120px;
    }
}

/* 针对非常窄的屏幕，例如手机纵向模式 */
@media (max-width: 480px) {
    #canvasPanel {
        height: calc(100vw - 30px);
        padding: 10px;
    }

    #controlsPanel {
        padding: 10px;
    }

    #controlsPanel h1 {
        font-size: 1.1em;
    }

    .control-group {
        flex-direction: column;
        align-items: flex-start;
    }

    .control-group label {
        min-width: auto;
        margin-bottom: 5px;
    }

    input[type="file"],
    input[type="range"] {
        width: 100%;
    }
}

.simple-switch {
    position: relative;
    display: inline-block;
    width: 40px !important;
    height: 20px;
    flex-shrink: 0;
    background-color: #efefef;
}

.simple-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.mysteriousToggle {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    transition: 0.4s;
    border-radius: 10px;
    background-color: #fff;
    border: 1px solid #ccc;
}

.mysteriousToggle:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    top: 0.5px;
    bottom: 2px;
    background-color: #efefef;
    transition: 0.4s;
    border-radius: 50%;
    border: 1px solid #ccc;
}

input:checked+.mysteriousToggle {
    background-color: #1e1e1e;
}

input:checked+.mysteriousToggle:before {
    transform: translateX(20px);
}

#gridToggleLabel {
    width: 40px;
}

#gridToggleLabel2 {
    width: 40px;
}