/* Basic styling for the audio test tool */

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.5;
    color: #222;
    background: #fafafa;
}

header {
    background: #2c3e50;
    color: #ecf0f1;
    padding: 1rem;
    text-align: center;
}

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

header p {
    margin: 0.5rem 0 0;
    font-size: 1rem;
}

/* Master volume slider */
.volume-control {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #ecf0f1;
}

.volume-control input[type="range"] {
    width: 150px;
    margin-left: 0.5rem;
}

section {
    padding: 1rem;
    max-width: 900px;
    margin: 0 auto;
}

h2 {
    margin-top: 2rem;
    color: #34495e;
    font-size: 1.5rem;
}

.test {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 1rem;
    margin: 1rem 0;
}

.test h3 {
    margin-top: 0;
    font-size: 1.2rem;
    color: #2c3e50;
}

.test p {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.controls label {
    display: flex;
    flex-direction: column;
    font-size: 0.8rem;
}

.controls input,
.controls select,
.controls button {
    padding: 0.4rem;
    font-size: 0.9rem;
    margin-top: 0.2rem;
}

button {
    cursor: pointer;
    border: none;
    border-radius: 4px;
    background: #8e44ad;
    color: white;
    transition: background 0.2s;
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
}

button:hover {
    background: #71368a;
}

button:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

/* Active state for toggle buttons when audio is playing */
button.active {
    background: #d35400;
}

/* Secondary buttons for overtone reset and all off */
.secondary-button {
    background: #95a5a6;
    color: #fff;
}

.secondary-button:hover {
    background: #7f8c8d;
}

.status {
    min-width: 3rem;
    font-weight: bold;
    color: #e74c3c;
    margin-left: 0.5rem;
}

.noise-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.5rem;
}

.noise-item {
    background: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 4px;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    align-items: flex-start;
    font-size: 0.85rem;
}

/* remove custom noise styles so all buttons share the same palette */


/* Note buttons */
.note-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.note-buttons button {
    /* Note buttons share the global button colours */
}

/* active style is defined globally for all buttons */


/* Piano keyboard */
.keyboard {
    display: grid;
    grid-template-columns: repeat(24, 1fr);
    gap: 1px;
    position: relative;
    user-select: none;
}
.keyboard .key {
    border: 1px solid #444;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    cursor: pointer;
    font-size: 0.7rem;
    position: relative;
}
.keyboard .white {
    background: #ffffff;
    color: #000;
    height: 100px;
}
.keyboard .black {
    background: #333;
    color: #f5f5f5;
    height: 60px;
    margin-top: 0;
}
.key .label {
    position: absolute;
    bottom: 2px;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 0.5rem;
    line-height: 0.6rem;
    pointer-events: none;
    user-select: none;
}
.keyboard .white .label {
    color: #000;
}
.keyboard .black .label {
    color: #fff;
}
.keyboard .active.white {
    background: #ffe680;
}
.keyboard .active.black {
    background: #b39ddb;
}

/* Overtones panel */
/* Overtones container now stacks rows vertically */
.harmonics-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}
.harmonic-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    flex-wrap: nowrap;
}
/* Each text span in a harmonic row gets a fixed width so that columns align */
.harmonic-row span {
    min-width: 75px;
    flex: 0 0 75px;
}
.harmonic-row input[type="range"] {
    flex: 1 1 auto;
}

/* Alternate row backgrounds for better readability */
.harmonic-row:nth-child(odd) {
    background: #f7f7f7;
}
.harmonic-row:nth-child(even) {
    background: #ffffff;
}
/* Add subtle dividers between columns */
.harmonic-row span:not(:last-child),
.harmonic-row input[type="range"] {
    border-right: 1px solid #e0e0e0;
    padding-right: 0.25rem;
    margin-right: 0.25rem;
}