* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#canvas-svg {
    width: 100vw;
    height: 100vh;
    display: block;
    cursor: crosshair;
    background-color: lightgray; /*#03060d*/
}

/* Pannello di Controllo */
#control-panel {
    position: absolute;
    top: 20px;
    right: 0;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.1, 0.9, 0.2, 1);
    background: rgba(8, 14, 28, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-right: none;
    border-radius: 12px 0 0 12px;
    padding: 20px;
    width: 320px;
    color: #ffd700;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.6);
    z-index: 100;
}

#control-panel.open {
    transform: translateX(0);
}

#panel-toggle {
    position: absolute;
    left: -42px;
    top: 20px;
    width: 42px;
    height: 50px;
    background: rgba(8, 14, 28, 0.85);
    border: 1px solid rgba(255, 215, 0, 0.4);
    border-right: none;
    border-radius: 8px 0 0 8px;
    color: #ffd700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    box-shadow: -4px 2px 10px rgba(0,0,0,0.5);
    transition: background 0.2s, color 0.2s;
}

#panel-toggle:hover {
    background: rgba(255, 215, 0, 0.2);
    color: #fff;
}

#control-panel h3 {
    margin-bottom: 12px;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    border-bottom: 1px solid rgba(255, 215, 0, 0.25);
    padding-bottom: 6px;
    color: #ffee55;
    text-align: center;
}

.control-group {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.control-group label {
    font-size: 12px;
    letter-spacing: 0.5px;
    display: flex;
    justify-content: space-between;
}

.control-group input[type="range"], .control-group select {
    accent-color: #ffd700;
    cursor: pointer;
    background: #0a1428;
    color: #ffd700;
    border: 1px solid rgba(255, 215, 0, 0.4);
    padding: 4px;
    border-radius: 4px;
}

/* Pulsanti Fluttuanti */
#floating-controls {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 90;
}

.action-btn {
    padding: 10px 20px;
    background: rgba(10, 20, 40, 0.75);
    border: 1.5px solid #ffd700;
    border-radius: 30px;
    color: #ffd700;
    font-weight: bold;
    font-size: 13px;
    letter-spacing: 1px;
    cursor: pointer;
    backdrop-filter: blur(6px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 140px;
}

.action-btn:hover {
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.5);
    background: rgba(20, 35, 65, 0.85);
}

#freeze-btn.frozen {
    background: rgba(180, 40, 40, 0.8);
    border-color: #ff6b6b;
    color: #ffffff;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #00ff88;
    box-shadow: 0 0 8px #00ff88;
}

#freeze-btn.frozen .status-dot {
    background-color: #ff3333;
    box-shadow: 0 0 8px #ff3333;
}

/* Legenda Litologia */
#terrain-legend {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(8, 14, 28, 0.8);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    padding: 10px 15px;
    color: #fff;
    font-size: 12px;
    display: flex;
    gap: 20px;
    z-index: 90;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 3px;
}

/* Sismogramma 2D */
#seismogram-container {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 600px; /* Aumentato da 380px per dare pił respiro al tracciato */
    height: 180px;
    background: rgba(4, 9, 20, 0.88);
    border: 1px solid rgba(0, 255, 136, 0.4);
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.7);
    backdrop-filter: blur(6px);
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

#seismogram-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #00ff88;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(0, 255, 136, 0.2);
    padding-bottom: 4px;
}

#seismogram-canvas {
    width: 100%;
    height: 110px;
    background: #02050b;
    border-radius: 4px;
}

#seismometer-marker {
    cursor: pointer;
}