* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #000;
    color: #fff;
    overflow: hidden;
}
#container { width: 100vw; height: 100vh; margin: 20px; }

/* UI Controls Styling */
#controls {
    position: absolute;
    top: 20px; left: 20px;
    background: radial-gradient(120% 120% at 0% 0%, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.75) 100%);
    /* border: 1px solid rgba(0, 212, 255, 0.15); */
    border-radius: 16px;
    z-index: 100;
    backdrop-filter: blur(10px) saturate(125%);
    transition: width 0.3s, height 0.3s, box-shadow 0.3s;
    overflow: hidden;
    /* box-shadow: 0 10px 30px rgba(0, 212, 255, 0.15); */
}
#controls.showing-select { overflow: visible !important; }
#controls.collapsed { width: 50px; height: 50px; border-radius: 25px; }
#controls:not(.collapsed) { width: 360px; height: auto; }

.content { padding: 20px 20px 20px 70px; opacity: 1; transition: opacity 0.3s 0.1s; }
#controls.collapsed .content { opacity: 0; pointer-events: none; }
 
.toggle-btn {
    position: absolute; top: 0; left: 0;
    width: 50px; height: 50px;
    background: transparent; 
    border: none;
    color: #313435; font-size: 24px; 
    cursor: pointer; z-index: 101;
}
.toggle-btn:hover { color: #fff; text-shadow: 0 0 10px #00d4ff; }

h2 {
    font-size: 18px; margin-bottom: 15px;
    color: #00d4ff; letter-spacing: 1px;
    text-shadow: 0 0 12px rgba(0,212,255,0.35);
}

button {
    width: 100%;
    padding: 12px;
    margin: 6px 0;
    background: #121418;
    border: 1px solid #2a3238;
    border-radius: 8px;
    color: #e9eef4;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}
button:hover { background: #181c21; border-color: #3a424b; }
button:active { transform: translateY(1px); }

.ghost-btn {
    width: 100%;
    padding: 12px;
    margin: 6px 0 0;
    background: transparent;
    border: 1px solid #2a3238;
    border-radius: 8px;
    color: #e9eef4;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.ghost-btn:hover { background: rgba(255,255,255,0.05); border-color: #3a424b; }
.ghost-btn:active { background: rgba(255,255,255,0.08); }

label[for="shapeSelect"] {
    display: block;
    margin: 6px 0 4px;
    color: #e9eef4;
    font-weight: 600;
}

#shapeSelect {
    width: 100%;
    padding: 10px 36px 10px 12px;
    margin: 6px 0 10px;
    background: #121418;
    border: 1px solid #2a3238;
    border-radius: 8px;
    color: #e9eef4;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23e9eef4"><path d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}

#shapeSelect:hover { background: #181c21; border-color: #3a424b; }
#shapeSelect:focus { border-color: #00d4ff; }

/* Custom Select (styled dropdown replacing native popup) */
.visually-hidden-select {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.custom-select {
    position: relative;
    width: 100%;
    z-index: 102;
}
.custom-select .selected {
    width: 100%;
    padding: 12px;
    margin: 6px 0; /* align with other buttons */
    background: #121418;
    border: 1px solid #2a3238;
    border-radius: 8px;
    color: #e9eef4;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding-right: 36px; /* reserve space for arrow */
    min-height: 48px;
}
.custom-select .selected:hover { background: #181c21; border-color: #3a424b; }
.custom-select .selected::after {
    content: '';
    position: absolute;
    right: 12px; top: 50%; transform: translateY(-50%);
    width: 10px; height: 10px;
    border-right: 2px solid #e9eef4;
    border-bottom: 2px solid #e9eef4;
    transform: translateY(-50%) rotate(45deg);
}
.custom-select .options {
    position: absolute;
    top: calc(100% + 6px);
    left: 0; right: 0;
    background: #121418;
    border: 1px solid #2a3238;
    border-radius: 8px;
    padding: 6px;
    list-style: none;
    margin: 0;
    display: none;
    max-height: 260px;
    overflow-y: auto;
}
.custom-select.open .options { display: block; }
.custom-select .option {
    padding: 8px 10px;
    border-radius: 6px;
    color: #e9eef4;
    cursor: pointer;
}
.custom-select .option:hover { background: #181c21; }
.custom-select .option.active { background: #0b2a3b; border: 1px solid #224659; }

.hidden { display: none !important; }

input[type="file"] { width: 100%; margin: 10px 0; font-size: 12px; color: #aaa; }

.info { font-size: 11px; margin-top: 15px; color: #666; line-height: 1.4; border-top: 1px solid #333; padding-top: 10px; }
.fps { position: absolute; bottom: 10px; left: 10px; color: #444; font-size: 10px; font-family: monospace; pointer-events: none; }

#transcript {
    position: absolute;
    bottom: 40px;
    left: 20px;
    right: 20px;
    width: auto;
    max-width: calc(100vw - 40px);
    height: 120px;

    border-radius: 8px;

    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 15px;
    padding: 0 15px;
    box-sizing: border-box;
}
#waveform {
    flex: 1;
    min-width: 0;
    height: 100%;
    cursor: pointer;
    user-select: none;
    max-width: 100%;
}
#audioControls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
#playPauseBtn {
    width: 32px;
    height: 32px;
    padding: 0;
    background: rgba(0, 212, 255, 0.2);
    border: 1px solid #00d4ff;
    border-radius: 50%;
    color: #00d4ff;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}
#playPauseBtn:hover {
    background: rgba(0, 212, 255, 0.4);
    transform: scale(1.1);
}
#playPauseBtn:active {
    transform: scale(0.95);
}
#audioTimer {
    color: #00d4ff;
    font-family: monospace;
    font-size: 14px;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
    white-space: nowrap;
}

.freq-visualizer {
    position: fixed;
    top: 0;
    width: 60px;
    height: 100vh;
    z-index: 50;
    pointer-events: none;
}
#freqLeft {
    left: 30px;
}
#freqRight {
    right: 30px;
}
