/* car s-t&v-t.html specific styles */

body {
    font-family: 'Microsoft YaHei', sans-serif;
    margin: 20px;
    background-color: #f5f5f5;
    font-size: 22px;
}

.container {
    display: flex;
    flex-direction: column;
    max-width: 1200px;
    margin: 0 auto;
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.main-content {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.animation-section {
    flex: 1;
    min-width: 0;
}

.controls-section {
    width: 350px;
    flex-shrink: 0;
}

.controls-section label {
    font-size: 20px;
    white-space: nowrap;
    margin-right: 3px;
}

.controls-section .control-item {
    font-size: 14px;
    flex-wrap: nowrap;
}

.controls-section .control-group {
    gap: 6px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #999;
}

h1 {
    color: black;
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: normal;
    text-align: center;
}

.controls {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #e9f7ef;
    border-radius: 8px;
}

.control-group {
    margin: 15px 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.control-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    white-space: nowrap;
}

.control-row {
    display: flex;
    align-items: center;
    gap: 5px;
    width: 100%;
}

.control-values {
    display: flex;
    align-items: center;
    gap: 3px;
}

.animation-area {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    overflow: hidden;
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: #f0f8ff;
    transition: background-color 1s ease-out;
    position: relative;
    height: 300px;
    width: 100%;
}

#motionCanvas {
    position: absolute;
    height: 300px;
    min-width: 2000px;
    width: fit-content;
    left: 0;
}

#ground-elements {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    transition: transform 1s ease-in-out;
    transform: translateY(0);
}

#ground-elements.hide-road {
    transform: translateY(100%);
}

.graphs canvas {
    overflow: visible;
}

#start-area {
    position: absolute;
    left: 0;
    bottom: 0px;
    height: 80px;
    background-color: #d1b46a;
    z-index: 1;
}

#road, #dashed-line {
    position: absolute;
    right: 0;
}

#road {
    bottom: 0px;
    height: 80px;
    background-color: #7f8c8d;
}

#dashed-line {
    bottom: 40px;
    height: 3px;
    background-image: linear-gradient(to right, #f1c40f 50%, transparent 50%);
    background-size: 30px 3px;
}

#flag-pole {
    position: absolute;
    width: 5px;
    height: 120px;
    background-color: #555;
    z-index: 5;
    bottom: 80px;
}

#flag-triangle {
    position: absolute;
    width: 0;
    height: 0;
    border-left: 60px solid red;
    border-top: 20px solid transparent;
    border-bottom: 20px solid transparent;
    bottom: 160px;
    transform: translateY(0%);
    z-index: 6;
}

#car {
    transition: transform 1s ease-out, opacity 1s ease-out, bottom 1s ease-out;
    position: absolute;
    z-index: 10;
    left: 50%;
    transform: translateX(-50%);
    bottom: 80px;
}

.propeller-stem {
    position: absolute;
    width: 4px;
    height: 0;
    background-color: #555;
    left: 50%;
    transform: translateX(-50%);
    bottom: 100%;
    transition: height 0.8s ease-out, opacity 0.8s ease-out;
    opacity: 0;
    z-index: 11;
}

.propeller {
    position: absolute;
    width: 0;
    height: 0;
    left: 50%;
    top: 0;
    transform: translate(-50%, -50%);
    transition: width 0.5s ease-out, height 0.5s ease-out;
    transform-origin: center center;
    z-index: 12;
    display: block;
}

.propeller-blade-part {
    position: absolute;
    width: 50px;
    height: 12px;
    background-color: #ddd;
    border-radius: 8px / 4px;
    opacity: 0.9;
    left: 50%;
    top: 50%;
    transform-origin: center center;
}

.propeller-blade-part:nth-child(1) {
    transform: translate(-50%, -50%) skewX(20deg);
}

.propeller-blade-part:nth-child(2) {
    transform: translate(-50%, -50%) skewX(-20deg) rotate(90deg);
}

@keyframes spin {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.propeller.spinning {
    animation: spin 1.5s linear infinite;
}

.propeller-center {
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: #333;
    border-radius: 50%;
    z-index: 13;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.tree {
    pointer-events: none;
    transition: opacity 0.3s ease-in-out;
}

#ground-elements.hide-road .tree {
    opacity: 0.3;
}

.graphs {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.graph-container {
    flex: 1;
    min-width: 300px;
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 5px;
    background-color: #fff;
}

canvas {
    border: 1px solid #aaa;
    background-color: #fff;
    border-radius: 4px;
}

button {
    padding: 10px 18px;
    margin: 0 5px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 20px;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #45a049;
}

button:disabled {
    background-color: #a5d6a7;
    cursor: not-allowed;
}

#addSegmentBtn {
    background-color: #007bff;
}

#addSegmentBtn:hover {
    background-color: #0069d9;
}

select {
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ccc;
    font-size: 20px;
}

input[type="range"] {
    width: 200px;
    vertical-align: middle;
}

.slider-value {
    display: inline-block;
    width: 45px;
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    color: #2c3e50;
}

h2 {
    color: #2e7d32;
    border-bottom: 2px solid #4CAF50;
    padding-bottom: 5px;
    font-size: 24px;
}

.graph-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.graph-toggle-btn {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.3s;
}

.graph-toggle-btn:hover {
    background-color: #45a049;
}

.graph-toggle-btn.hidden {
    background-color: #ccc;
}

label {
    font-size: 16px;
    font-weight: bold;
}

/* 响应式布局 */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .animation-section {
        order: 1;
    }
    
    .controls-section {
        order: 2;
        width: 100%;
    }
    
    .controls-section label {
        font-size: 14px;
        margin-right: 2px;
    }
    
    .controls-section .control-item {
        font-size: 14px;
        gap: 3px;
    }
    
    .controls-section .control-group {
        gap: 5px;
    }
    
    .slider-value {
        font-size: 14px;
        width: 40px;
    }
    
    .animation-area {
        height: 250px;
    }
    
    .graphs {
        flex-direction: column;
    }
    
    .graph-container {
        min-width: 100%;
        overflow: hidden;
    }
    
    .graph-container canvas {
        max-width: 100%;
        width: 100%;
        height: auto;
        display: block;
    }
    
    #stGraph, #vtGraph {
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
        box-sizing: border-box;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 18px;
    }
    
    .container {
        padding: 15px;
    }
    
    .animation-area {
        height: 200px;
    }
    
    select, button {
        font-size: 16px;
    }
    
    input[type="range"] {
        width: 150px;
    }
    
    .controls-section label {
        font-size: 14px;
        margin-right: 1px;
    }
    
    .controls-section .control-item {
        font-size: 12px;
        gap: 2px;
    }
    
    .controls-section .control-group {
        gap: 4px;
    }
    
    .slider-value {
        font-size: 12px;
        width: 35px;
    }
}
