/* Add these styles at the end */
#sdi-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 10px;
    font-family: 'MS Sans Serif', Tahoma, sans-serif;
    cursor: pointer;
    background: #c0c0c0;
    border: 2px solid;
    border-color: #ffffff #808080 #808080 #ffffff;
    z-index: 1000;
    font-size: 14px;
}

#sdi-button:active {
    border-color: #808080 #ffffff #ffffff #808080;
}

.table-container {
    overflow-x: auto;
    max-width: 100%;
    margin: 10px 0;
}

.table-container table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.table-container th {
    background: #c0c0c0;
    font-weight: bold;
    text-align: left;
}

.table-container th, 
.table-container td {
    border: 1px solid #808080;
    padding: 8px;
    font-size: 14px;
}

@media (max-width: 768px) {
    #sdi-button {
        bottom: 10px;
        right: 10px;
        font-size: 12px;
        padding: 8px;
    }
    
    .table-container th, 
    .table-container td {
        padding: 4px;
        font-size: 12px;
    }
}* {
    font-family: 'MS Sans Serif', Tahoma, sans-serif;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    margin: 0;
    background-color: #008080;
    min-height: 100vh;
    padding: clamp(10px, 2vw, 20px);
    overflow: hidden;
}

.window {
    width: clamp(300px, 90vw, 700px);
    max-width: 95vw;
    background-color: #c0c0c0;
    border: 2px solid;
    border-color: #ffffff #808080 #808080 #ffffff;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
    position: absolute;
    z-index: 1;
    max-height: 90vh;
    overflow: auto;
}

.window.active {
    z-index: 2;
}

.title-bar {
    background: linear-gradient(90deg, #000080 0%, #1084d0 100%);
    color: white;
    padding: clamp(2px, 0.5vw, 4px) clamp(4px, 1vw, 8px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: clamp(12px, 2vw, 14px);
    cursor: move;
    user-select: none;
}

.window:not(.active) .title-bar {
    background: linear-gradient(90deg, #808080 0%, #b5b5b5 100%);
}

.title-bar-text {
    flex-grow: 1;
    margin-left: clamp(4px, 1vw, 8px);
}

.window-body {
    margin: clamp(8px, 1.5vw, 12px);
    border: 1px solid #808080;
    background-color: white;
    padding: clamp(8px, 1.5vw, 12px);
}

.canvas-container {
    position: relative;
    background: black;
    border: 1px solid #333;
    margin-bottom: clamp(8px, 1.5vw, 12px);
    width: 100%;
    height: 0;
    padding-top: 100%;
}

#canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    touch-action: none;
}

.modulation-controls, .frequency-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: clamp(8px, 1.5vw, 12px);
    background: #c0c0c0;
    padding: clamp(8px, 1.5vw, 12px);
    border: 1px solid #808080;
}

.preset-control, .snr-control, .input-group {
    display: flex;
    flex-direction: column;
    gap: clamp(4px, 0.8vw, 6px);
}

.preset-control label, .snr-control label, .input-group label {
    font-size: clamp(11px, 1.8vw, 13px);
    white-space: normal;
}

.preset-control select, .snr-control input, .input-group input, .input-group select {
    width: 100%;
    background: white;
    border: 1px solid #808080;
    padding: clamp(4px, 0.8vw, 6px);
    font-size: clamp(11px, 1.8vw, 13px);
    height: clamp(28px, 4vw, 32px);
}

.modulation-description, .frequency-description {
    width: 100%;
    text-align: center;
    font-size: clamp(11px, 1.8vw, 13px);
    color: #000;
    margin-top: clamp(8px, 1.5vw, 12px);
    grid-column: 1 / -1;
}

.frequency-result {
    width: 100%;
    text-align: center;
    font-weight: bold;
    font-size: clamp(13px, 2vw, 15px);
    margin-top: clamp(8px, 1.5vw, 12px);
    grid-column: 1 / -1;
    white-space: pre-line;
}

.checkbox-group {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    height: auto;
    margin-right: 8px;
}

/* Screen size specific adjustments */
@media (max-width: 768px) {
    .window {
        position: relative;
        left: 0 !important;
        top: 0 !important;
        margin-bottom: 20px;
    }

    .modulation-controls, .frequency-controls {
        grid-template-columns: 1fr;
    }

    body {
        overflow-y: auto;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .window {
        max-width: 600px;
    }
}

@media (min-width: 1025px) {
    .window {
        max-width: 800px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .title-bar {
        background: #000080;
    }
    
    .window:not(.active) .title-bar {
        background: #808080;
    }
}
