body {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-family: sans-serif;
    margin-top: 50px;
}

/* 容器：限制最大宽度，并保持 4:3 比例 */
.canvas-container {
    position: relative;
    width: 800px;
    max-width: 95vw;
    /* 关键：最大宽度不超过屏幕视口的 95% */
    aspect-ratio: 4 / 3;
    /* 关键：锁定 4:3 比例，这样高度会自动计算 */
    height: auto;
    border: 2px solid #333;
    background-color: #f9f9f9;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* 画布：完全撑满容器 */
.canvas-container canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    /* 关键：由 CSS 容器来决定最终显示尺寸 */
    height: 100% !important;
    background: transparent;
}

/* 让顶层海龟画布不阻挡鼠标事件（非必需，但好习惯） */
#turtleCanvas {
    pointer-events: none;
}

.controls {
    margin-top: 20px;
}

input {
    padding: 8px;
    width: 400px;
    font-size: 16px;
}

button {
    padding: 8px 16px;
    font-size: 16px;
    cursor: pointer;
}