:root {
    --bg-color: #f4f4f4;
    --text-color: #1a1a1a;
    --runente-red: #e63946;
    --runente-blue: #1d3557;
    --runente-yellow: #ffb703;
    --border-width: 2px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.runente-container {
    width: 95vw;
    max-width: 1200px;
    background: #f4f4f4;
    position: relative;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: var(--border-width) solid #000;
    padding-bottom: 20px;
}

.title-block h1 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.global-controls {
    display: flex;
    gap: 30px;
    align-items: center;
}

.input-group,
.tempo-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.input-group label,
.tempo-group label {
    font-weight: 700;
    text-transform: uppercase;
}

#yt-url {
    background: none;
    border: var(--border-width) solid #000;
    padding: 8px 12px;
    font-size: 0.8rem;
    width: 200px;
}

.runente-btn {
    background: #000;
    color: #fff;
    border: none;
    padding: 10px 20px;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: transform 0.1s;
}

.runente-btn:active {
    transform: translate(2px, 2px);
}

.runente-btn.primary {
    background: var(--runente-red);
}

/* Sequencer Styles */
#sequencer {
    display: flex;
    flex-direction: column;
}

.track {
    display: grid;
    grid-template-columns: 100px 45px 30px 30px 30px 1fr;
    grid-template-rows: auto auto;
    /* Two rows per track */
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding: 10px 0;
}

.player-box {
    grid-row: 1 / span 2;
    /* Player spans both rows */
    width: 100px;
    height: 75px;
    background: #000;
    border: 1px solid #000;
    overflow: hidden;
    position: relative;
}

.mini-player {
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.track-mixer {
    grid-row: 2;
    grid-column: 2 / span 4;
    display: flex;
    gap: 5px;
    align-items: center;
}

.vol-slider {
    -webkit-appearance: none;
    width: 80px;
    height: 2px;
    background: #000;
    outline: none;
}

.vol-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px;
    height: 10px;
    background: #000;
    border: 1px solid #fff;
    cursor: pointer;
}

.mixer-btn {
    width: 20px !important;
    height: 20px !important;
    font-size: 0.6rem !important;
}

.track-controls {
    display: contents;
}

.square-btn {
    width: 30px;
    height: 30px;
    border: 1px solid #000;
    background: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
    font-size: 0.8rem;
    transition: transform 0.1s;
}

.square-btn:active {
    transform: scale(0.95);
}

.square-btn.yellow {
    background-color: var(--runente-yellow);
}

.square-btn.active {
    background-color: #000;
    color: #fff;
}

.timestamp-input {
    width: 45px;
    height: 30px;
    border: 1px solid #000;
    padding: 2px;
    font-size: 0.75rem;
    text-align: center;
    background: transparent;
}

.steps {
    grid-row: 1 / span 2;
    /* Steps also span both rows */
    display: grid;
    grid-template-columns: repeat(16, 1fr);
    gap: 8px;
}

.step {
    aspect-ratio: 1;
    min-height: 25px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.2s;
    background: #eee;
}

/* Beat indicators: 1, 5, 9, 13 */
.step:nth-child(4n+1) {
    border: 2px solid #000;
    background: #ddd;
}

.step.on {
    background: #000;
}

.track:nth-child(1) .step.on {
    background: var(--runente-red);
}

.track:nth-child(2) .step.on {
    background: #219ebc;
}

.track:nth-child(3) .step.on {
    background: var(--runente-yellow);
}

.track:nth-child(4) .step.on {
    background: #000;
}

.track:nth-child(5) .step.on {
    background: var(--runente-red);
}

.track:nth-child(6) .step.on {
    background: #219ebc;
}

.track:nth-child(7) .step.on {
    background: var(--runente-yellow);
}

.step.current {
    border: 3px solid #000;
    transform: scale(1.1);
    z-index: 10;
}

/* Preset System */
#presets-container {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.preset-actions {
    display: flex;
    gap: 10px;
}

.preset-actions .runente-btn.active-load {
    background-color: var(--runente-blue);
    animation: pulse 1.5s infinite;
}

.preset-actions .runente-btn.active-save {
    background-color: var(--runente-red);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }

    100% {
        opacity: 1;
    }
}

.preset-slots {
    display: flex;
    gap: 10px;
}

.preset-btn {
    width: 40px;
    height: 40px;
    border: 1px solid #000;
    background: transparent;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s;
}

.preset-btn.filled {
    background: var(--runente-yellow);
}

.preset-btn:hover {
    transform: translateY(-2px);
    box-shadow: 2px 2px 0 #000;
}

.preset-btn.active-target {
    border: 3px solid #000;
    transform: scale(1.1);
}

/* Preset System */
#presets-container {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.preset-actions {
    display: flex;
    gap: 10px;
}

.preset-actions .runente-btn.active-load {
    background-color: var(--runente-blue);
    animation: pulse 1.5s infinite;
}

.preset-actions .runente-btn.active-save {
    background-color: var(--runente-red);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }

    100% {
        opacity: 1;
    }
}

.preset-slots {
    display: flex;
    gap: 10px;
}

.preset-btn {
    width: 40px;
    height: 40px;
    border: 1px solid #000;
    background: transparent;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s;
}

.preset-btn.filled {
    background: var(--runente-yellow);
}

.preset-btn:hover {
    transform: translateY(-2px);
    box-shadow: 2px 2px 0 #000;
}

.preset-btn.active-target {
    border: 3px solid #000;
    transform: scale(1.1);
}

.runente-footer {
    padding-top: 20px;
    text-align: left;
}

.runente-footer p {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 3px;
    opacity: 0.5;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 150px;
    height: 4px;
    background: #000;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--runente-red);
    border: 2px solid #000;
    cursor: pointer;
}