/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    width: 600px;
    max-width: 90%;
    text-align: center;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
}

.mode-options {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 20px;
}

.mode-card {
    flex: 1;
    background-color: #f8f9fa;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.mode-card:hover:not(.disabled) {
    border-color: #0056b3;
    background-color: #e7f1ff;
    transform: translateY(-2px);
}

.mode-card.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #eee;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group select, .form-group input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

button {
    padding: 10px 20px;
    background-color: #0056b3;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
}

button:hover {
    background-color: #004494;
}

.btn-secondary {
    background-color: #6c757d;
    margin-left: 10px;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

/* 现有样式继续... */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f0f2f5;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

header {
    background-color: #0056b3;
    color: white;
    padding: 15px 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    margin: 0;
    font-size: 1.2rem;
}

#game-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

#sidebar {
    width: 200px;
    background-color: white;
    border-right: 1px solid #ddd;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 2px 0 5px rgba(0,0,0,0.05);
    z-index: 10;
    overflow-y: auto;
}

.tool-item {
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 10px;
    cursor: grab;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
    user-select: none;
}

.tool-item:hover {
    background-color: #e9ecef;
    border-color: #0056b3;
}

.tool-item img {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.tool-item span {
    font-size: 0.9rem;
}

/* Night Mode */
body.night-mode {
    background-color: #1a1a1a;
    color: #eee;
}

body.night-mode .road-surface {
    background: #222;
    border-color: #444;
}

body.night-mode .lane-line {
    background: repeating-linear-gradient(to bottom, rgba(255,255,255,0.5), rgba(255,255,255,0.5) 20px, transparent 20px, transparent 40px);
}

body.night-mode #sidebar,
body.night-mode #info-panel,
body.night-mode .modal-content {
    background-color: #2c2c2c;
    color: #eee;
    border-color: #444;
}

body.night-mode .tool-item {
    background-color: #333;
    border-color: #555;
    color: #eee;
}

body.night-mode .tool-item:hover {
    background-color: #444;
}

body.night-mode .panel-section {
    background-color: #333;
    border-color: #444;
}

body.night-mode h3 {
    color: #eee;
}

/* Road Container (Replaces Canvas Wrapper) */
.road-container {
    flex: 1;
    overflow-y: scroll;
    position: relative;
    background: #333;
    cursor: crosshair;
    scrollbar-width: thin;
    scrollbar-color: #555 #333;
}

/* Road Surface */
.road-surface {
    width: 300px;
    min-height: 2000px; 
    background: #555;
    margin: 0 auto;
    position: relative;
    border-right: 5px solid white;
    overflow: visible; 
}

/* Road Elements */
.lane-line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 4px;
    background: repeating-linear-gradient(to bottom, #fff, #fff 20px, transparent 20px, transparent 40px);
    z-index: 1;
}

.median-line {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    background: #f1c40f;
    z-index: 2;
}

.left-boundary-line {
    position: absolute;
    left: -60px; /* Moved left by 1 sign width */
    top: 0;
    bottom: 0;
    width: 5px;
    background: white;
    z-index: 2;
}

.emergency-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #fff;
    z-index: 1;
}

/* Work Zone */
.work-area {
    position: absolute; 
    /* top, left, width set by JS */
    background: repeating-linear-gradient(45deg, #c0392b, #c0392b 10px, #2c3e50 10px, #2c3e50 20px);
    border: 2px solid #e74c3c; 
    z-index: 1;
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-weight: bold; 
    text-shadow: 1px 1px 0 #000;
    color: white;
    font-size: 14px;
    text-align: center;
}

/* Ruler */
.ruler {
    position: absolute;
    left: -205px; /* Moved left by 2 sign widths (approx 120px) from -85px */
    top: 0;
    bottom: 0;
    width: 50px;
    text-align: right;
    color: #aaa;
    font-size: 12px;
}

.tick {
    position: absolute;
    right: 0;
    width: 10px;
    border-top: 1px solid #aaa;
}

.tick.major {
    width: 20px;
    border-top: 2px solid #fff;
    color: #fff;
    font-weight: bold;
}

/* Zones */
.zone-rect {
    position: absolute;
    left: 0;
    right: 0;
    z-index: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: rgba(255,255,255,0.8);
    font-weight: bold;
    text-align: center;
    pointer-events: none;
}

/* Placed Items */
.placed-item {
    position: absolute;
    transform: translate(-50%, -50%);
    z-index: 100;
    cursor: grab;
    filter: drop-shadow(2px 2px 2px rgba(0,0,0,0.5));
}

.placed-item:active {
    cursor: grabbing;
}

.placed-item img {
    display: block;
}

/* Placed Cone Style */
.cone-taper {
    width: 6px; /* Reduced from 24px (approx 1/5 of original visual impact) */
    height: 6px;
    background: conic-gradient(
        from 0deg,
        #e67e22 0%, 
        #d35400 40%, 
        #e67e22 80%, 
        #d35400 100%
    );
    border-radius: 50%; /* Base circle */
    border: 1px solid white;
    box-shadow: 
        0 1px 2px rgba(0,0,0,0.4),
        inset 0 -1px 2px rgba(0,0,0,0.2);
    position: relative;
    pointer-events: none; /* Let clicks pass through to container */
}

.cone-taper::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: radial-gradient(circle, #fff 40%, #ddd 100%);
    border: 0.5px solid #ccc;
}

/* Selected Tool Highlight */
.tool-item.selected {
    border-color: #e67e22;
    background-color: #fff3e0;
    box-shadow: 0 0 5px rgba(230, 126, 34, 0.5);
}

/* Info Panel */
#info-panel {
    width: 250px;
    background-color: white;
    border-left: 1px solid #ddd;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: -2px 0 5px rgba(0,0,0,0.05);
    z-index: 10;
    overflow-y: auto;
}

.panel-section {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    border: 1px solid #eee;
}

.panel-section h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1rem;
    color: #333;
    border-bottom: 2px solid #0056b3;
    padding-bottom: 5px;
    display: inline-block;
}

#check-btn {
    width: 100%;
    padding: 12px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.2s;
}

#check-btn:hover {
    background-color: #218838;
}

/* Distance Markers */
.distance-marker-group {
    position: absolute;
    width: 0; /* Width is handled by children */
    display: flex;
    justify-content: center;
    pointer-events: none;
    z-index: 90; /* Below placed-item (100) but above road elements */
}

.marker-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: #39ff14; /* Bright Green */
    box-shadow: 0 0 4px rgba(57, 255, 20, 0.6);
    left: 50%;
    transform: translateX(-50%);
}

/* Add horizontal ticks at ends */
.distance-marker-group::before,
.distance-marker-group::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 2px;
    background-color: #39ff14; /* Bright Green */
    box-shadow: 0 0 4px rgba(57, 255, 20, 0.6);
    left: 50%;
    transform: translateX(-50%);
}

.distance-marker-group::before {
    top: 0;
}

.distance-marker-group::after {
    bottom: 0;
}

.marker-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: #39ff14; /* Bright Green Text */
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 91;
    border: 1px solid #39ff14; /* Green Border */
    font-weight: bold;
}