:root {
    font-family: 'Courier New', Courier, monospace;
    color: #f0f0f0;
    background: #0a0a0a;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

.header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #000;
    border: 4px solid #fff;
    box-shadow: 8px 8px 0 #fff;
}

.logo {
    width: 80px;
    height: 80px;
    background: #fff;
    border: 3px solid #fff;
    filter: contrast(1.2);
}

.header h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #fff;
    text-shadow: 3px 3px 0 #000;
}

.container {
    width: min(960px, 100%);
    background: #000;
    padding: 2rem;
    border: 5px solid #fff;
    box-shadow: 12px 12px 0 #333;
}

label {
    font-weight: 700;
    display: block;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
}

.script-input,
textarea {
    width: 100%;
    min-height: 220px;
    resize: vertical;
    padding: 1rem;
    border: 4px solid #fff;
    background: #1a1a1a;
    color: #f0f0f0;
    font-size: 0.85rem;
    line-height: 1.4;
    font-family: 'Courier New', Courier, monospace;
    box-sizing: border-box;
    box-shadow: inset 4px 4px 0 rgba(255, 255, 255, 0.1);
}

.script-input:focus,
textarea:focus {
    outline: none;
    box-shadow: inset 4px 4px 0 rgba(255, 255, 255, 0.2), 0 0 0 2px #fff;
}

.script-input .script-line {
    white-space: pre-wrap;
}

.script-input .active-line {
    background: #001800;
    color: #4dff4d;
}

input[type="number"] {
    width: 80px;
    padding: 0.6rem;
    border: 3px solid #fff;
    background: #1a1a1a;
    color: #f0f0f0;
    font-size: 1rem;
    font-family: 'Courier New', Courier, monospace;
    font-weight: 700;
}

input[type="number"]:focus {
    outline: none;
    box-shadow: 0 0 0 2px #fff;
}

.controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 1.5rem 0;
}

.controls-downloads {
    display: flex;
    gap: 1rem;
    width: 100%;
    margin-top: 0.5rem;
}

button {
    padding: 0.8rem 1.5rem;
    border: 4px solid #fff;
    font-size: 1rem;
    font-weight: 900;
    cursor: pointer;
    background: #fff;
    color: #000;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'Courier New', Courier, monospace;
    transition: all 0.1s ease;
    box-shadow: 4px 4px 0 #666;
}

button:hover:not(:disabled) {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 #666;
}

button:active:not(:disabled) {
    transform: translate(4px, 4px);
    box-shadow: none;
}

button.secondary {
    background: #000;
    color: #fff;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.4;
    box-shadow: none;
}

.status {
    margin-top: 1rem;
    padding: 1rem;
    font-size: 0.9rem;
    background: #1a1a1a;
    border: 3px solid #fff;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.note {
    font-size: 0.85rem;
    color: #ccc;
    margin-top: 0.5rem;
    padding: 1rem;
    background: #111;
    border-left: 4px solid #fff;
}

.note > p {
    margin: 0.5rem 0 0 0;
    font-style: italic;
    color: #aaa;
}

.note strong {
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.note ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.note li {
    margin: 0.6rem 0;
    line-height: 1.4;
}

.note code {
    background: #000;
    padding: 2px 6px;
    border: 2px solid #fff;
    font-family: 'Courier New', Courier, monospace;
}

.note-example {
    display: block;
    margin-top: 0.2rem;
}

.rendered-audio {
    display: none;
}

#renderedAudio {
    width: 100%;
    display: none;
}

.range-wrap {
    flex: 1;
    min-width: 0;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 26px;
    background: transparent;
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    background: #1a1a1a;
    border: 3px solid #fff;
}

input[type="range"]::-moz-range-track {
    height: 6px;
    background: #1a1a1a;
    border: 3px solid #fff;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #fff;
    border: 3px solid #fff;
    cursor: pointer;
    margin-top: -10px;
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #fff;
    border: 3px solid #fff;
    border-radius: 0;
    cursor: pointer;
}

input[type="range"]:focus {
    box-shadow: 0 0 0 2px #fff;
}

.inline {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.inline + .inline {
    margin-top: 0.25rem;
}

.inline label {
    width: 240px;
    flex-shrink: 0;
    margin-bottom: 0;
}

footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 4px solid #fff;
    font-size: 0.8rem;
    color: #999;
}

footer p {
    margin: 0.25rem 0;
}

footer strong {
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 1px;
}

footer ul {
    margin: 0.8rem 0;
    padding-left: 1.5rem;
    line-height: 1.8;
}

footer a {
    color: #fff;
    text-decoration: none;
    border-bottom: 2px solid #fff;
    font-weight: 700;
}

footer a:hover {
    background: #fff;
    color: #000;
}

/* Responsive layout tweaks for small screens */
@media (max-width: 640px) {
    body {
        padding: 1rem;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }

    .logo {
        width: 64px;
        height: 64px;
    }

    .container {
        padding: 1.25rem;
        box-shadow: 8px 8px 0 #333;
    }

    .inline {
        flex-direction: column;
        align-items: flex-start;
    }

    .inline label {
        width: 100%;
    }

    .controls {
        flex-wrap: wrap;
        width: 100%;
        gap: 0.75rem;
    }

    /* Start / Pause / Stop */
    .controls > button {
        flex: 1 1 calc(33.333% - 0.75rem);
        min-width: 0;
        text-align: center;
        padding-inline: 0.5rem;
    }

    /* Downloads row on its own line */
    .controls-downloads {
        flex-basis: 100%;
        display: flex;
        flex-wrap: nowrap;
        gap: 0.75rem;
    }

    .controls-downloads button {
        flex: 1 1 0;
        min-width: 0;
        text-align: center;
        padding-inline: 0.5rem;
    }
}
