html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: #111;
    display: flex;
    justify-content: center;
    align-items: center;
}

.matrix-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2vh;
}

@media (max-width: 600px) {
    #matrixContainer {
        flex-direction: column;
        align-items: center;
        overflow-y: auto;
    }
}


#matrixContainer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    width: 100vw;
    height: 100vh;
    gap: 1vh;
    box-sizing: border-box;
    padding: 0;
    margin: 0;
}

/* 🌀 自动判断屏幕是竖屏还是横屏 */
@media (orientation: portrait) {
    #matrixContainer {
        flex-direction: column;
    }
}

@media (orientation: landscape) {
    #matrixContainer {
        flex-direction: row;
    }
}


/* Canvas阵列保持比例且自动适应布局 */
canvas {
    display: block;
    background: transparent;
    min-width: 25vh;
    min-height: calc(25vh / 0.727);
}

.containInput {
    position: absolute;
    bottom: 2vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2vh;
}

.input-area {
    padding: 4vh;
    text-align: center;
}

input {
    font-size: 2.5vh;
    padding: 1vh 2vh;
    width: 40vh;
    background: #000;
    color: #00FFFF;
    border: 1px solid #00FFFF;
    outline: none;
}

button {
    font-size: 2.2vh;
    padding: 1vh 2vh;
    margin-left: 2vh;
    cursor: pointer;
    background: #000;
    color: #00FFFF;
    border: 1px solid #00FFFF;
}

.palette {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1vh;
}

.color-swatch {
    width: 3vh;
    height: 3vh;
    border-radius: 50%;
    border: 2px solid #444;
    cursor: pointer;
}

.color-swatch:hover {
    border-color: #fff;
}

.color-swatch.selected {
    border-color: #fff;
    box-shadow: 0 0 1vh #00FFFF;
}

#flickerToggle.active {
    border-color: #00FFFF;
    box-shadow: 0 0 1vh #00FFFF;
}

.symbol-btn {
    width: 3vh;
    height: 3vh;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5vh;
    border-radius: 50%;
    background: #222;
    color: #fff;
    border: 2px solid #444;
    cursor: pointer;
}

.symbol-btn:hover {
    border-color: #00FFFF;
    color: #00FFFF;
}