* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #0077be;
    overflow: hidden;
    color: white;
}

#ui {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    padding: 20px;
    border-radius: 8px;
    z-index: 10;
}

#wind-ui {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    padding: 20px;
    border-radius: 8px;
    pointer-events: auto;
    z-index: 10;
    width: 280px;
}

#wind-dial-container {
    display: flex;
    justify-content: center;
    margin: 15px 0;
}

#wind-dial {
    width: 80px;
    height: 80px;
    background: #333;
    border-radius: 50%;
    position: relative;
    border: 2px solid #555;
    cursor: pointer;
    touch-action: none;
}

#wind-dial-arrow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(0deg);
    font-size: 2rem;
    font-weight: bold;
    color: #ffeb3b;
    pointer-events: none;
    transition: transform 0.1s;
}

#wind-dial-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    height: 14px;
    background: #4fc3f7;
    border-radius: 50%;
    transform: translate(-50%, -50%) translate(34px, 0);
    pointer-events: none;
}

#wind-ui h2 {
    font-size: 1rem;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.advanced-settings {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.1);
}
.advanced-settings summary {
    cursor: pointer;
    font-size: 0.8em;
    font-weight: bold;
    color: #bbb;
    margin-bottom: 10px;
    outline: none;
}
.advanced-settings summary:hover {
    color: #fff;
}


.controls-info h2 {
    margin-bottom: 15px;
    font-size: 1.2rem;
    text-transform: uppercase;
}

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

.throttle-bar {
    width: 200px;
    height: 10px;
    background: #444;
    border-radius: 5px;
    margin-top: 5px;
    overflow: hidden;
    position: relative;
}

.fill {
    height: 100%;
    width: 0%;
    background: #00ff00;
    transition: width 0.1s, background 0.1s;
}

.hint {
    font-size: 0.8rem;
    opacity: 0.8;
    margin-top: 5px;
}

.settings {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255,255,255,0.2);
    pointer-events: auto;
}

.setting-item {
    margin-bottom: 10px;
}

.setting-item label {
    display: block;
    font-size: 0.75rem;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.setting-item input[type="range"] {
    flex: 1;
}

.setting-item input[type="number"] {
    width: 60px;
    background: #444;
    border: 1px solid #666;
    color: white;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 0.8rem;
}

.input-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

#stats {
    margin-top: 20px;
    font-family: monospace;
    font-size: 1.1rem;
}

#speed-panel {
    position: absolute;
    bottom: 30px;
    left: calc(50% - 255px);
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    padding: 15px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 160px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 10;
}

#speed-visual {
    width: 100px;
    height: 50px;
    border: 2px solid #666;
    border-bottom: none;
    border-radius: 50px 50px 0 0;
    position: relative;
    overflow: hidden;
    background: rgba(255,255,255,0.05);
}

#speed-needle {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 3px;
    height: 45px;
    background: #ffeb3b;
    transform-origin: bottom center;
    transform: translateX(-50%) rotate(-90deg);
    transition: transform 0.1s ease-out;
    border-radius: 2px;
    z-index: 2;
}

#speed-value {
    margin-top: 8px;
    font-family: monospace;
    font-size: 1.1rem;
    font-weight: bold;
}

#steering-panel {
    position: absolute;
    bottom: 30px;
    left: calc(50% - 85px);
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    padding: 15px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 160px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 10;
}

#heading-panel {
    position: absolute;
    bottom: 30px;
    left: calc(50% + 85px);
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    padding: 15px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 160px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 10;
}

#anchor-panel {
    position: absolute;
    bottom: 30px;
    left: calc(50% + 255px);
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    padding: 15px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 160px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 10;
}

#compass-visual {
    width: 80px;
    height: 80px;
    border: 2px solid #666;
    border-radius: 50%;
    position: relative;
    margin-bottom: 5px;
    background: rgba(255,255,255,0.05);
}

#compass-rose {
    position: absolute;
    width: 100%;
    height: 100%;
    font-size: 0.6rem;
    font-weight: bold;
    color: #aaa;
}

.cardinal {
    position: absolute;
    width: 10px;
    text-align: center;
}
.cardinal.n { top: 2px; left: 50%; transform: translateX(-50%); color: #ff3300; }
.cardinal.e { right: 2px; top: 50%; transform: translateY(-50%); }
.cardinal.s { bottom: 2px; left: 50%; transform: translateX(-50%); }
.cardinal.w { left: 2px; top: 50%; transform: translateY(-50%); }

#compass-needle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 60px;
    background: linear-gradient(to bottom, #ff3300 50%, #fff 50%);
    transform: translate(-50%, -50%) rotate(0deg);
}

#heading-value {
    margin-top: 8px;
    font-family: monospace;
    font-size: 1.1rem;
    font-weight: bold;
}

.panel-label {
    font-size: 0.7rem;
    font-weight: bold;
    letter-spacing: 1px;
    margin-bottom: 10px;
    color: #4fc3f7;
}

#steering-visual {
    width: 100px;
    height: 50px;
    border: 2px solid #666;
    border-top: none;
    border-radius: 0 0 50px 50px;
    position: relative;
    overflow: hidden;
    display: flex;
}

.steering-half {
    width: 50%;
    height: 100%;
}

.steering-half.port {
    background: rgba(0, 255, 0, 0.2); 
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.steering-half.starboard {
    background: rgba(255, 0, 0, 0.2); 
}

#steering-needle {
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 40px;
    background: #ffeb3b;
    transform-origin: top center;
    transform: translateX(-50%) rotate(0deg);
    transition: transform 0.1s ease-out;
    border-radius: 2px;
}

#steering-value {
    margin-top: 8px;
    font-family: monospace;
    font-size: 1.1rem;
    font-weight: bold;
}

#rudder-status {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #4fc3f7;
    font-weight: bold;
}



#reset-container {
    position: absolute;
    bottom: 30px;
    right: 20px;
    z-index: 20;
}

#reset-btn {
    background: #f44336;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
    padding: 10px 30px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    font-family: inherit;
    text-transform: uppercase;
    transition: background 0.2s, transform 0.1s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

#reset-btn:hover {
    background: #d32f2f;
}

#reset-btn:active {
    transform: scale(0.95);
}

#cameraToggleBtn {
    width: 100%;
    margin-bottom: 10px;
    background: #0077be;
    color: white;
    border: none;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    text-transform: uppercase;
}

#cameraToggleBtn.toggle-inactive {
    background: #444;
}

.collapse-btn {
    width: 100%;
    background: #333;
    color: #fff;
    border: 1px solid #555;
    padding: 5px;
    font-size: 0.8rem;
    font-weight: bold;
    cursor: pointer;
    text-align: left;
    margin-bottom: 5px;
    border-radius: 4px;
}

.panel-content {
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
    max-height: 1000px;
    overflow: visible;
}

.collapsed .panel-content {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    padding: 0 !important;
    margin: 0 !important;
}

.collapsed .collapse-btn {
    margin-bottom: 0;
}

canvas {
    display: block;
}
