/* Unpressed state */
/* Unpressed (default) */


#randomAll,
#generate {
    background-color: #ccc;
    color: #aaa;
}


/* Pressed */
#randomAll.pressed,
#generate.pressed {
    background-color: #fff;
    color: #aaa;
}

.slider-sequencer {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-top: 4px;
}

.slider-sequencer-step {
    width: 22px;
    height: 24px;
    border: 1px solid #aaa;
    cursor: pointer;
    background: #fff;
}

.slider-sequencer-step.active {
    background: #aaa;
}

.slider-sequencer-step.current-step {
    outline: 1px solid #aaa;
    filter: brightness(1.3);
}


/* R and G buttons: dark by default, brighten slightly when active */
#randomAll,
#generate {
    /* transición ultrarrápida */
    transition: filter 0.03s ease, background 0.03s ease;
}


/* When active (clicked or sequencer), apply a slight brightness boost */
#randomAll.active,
#generate.active {
    background: #ccc !important;
    filter: brightness(1.2);
}


/* Make all buttons use 10px monospace text */
button,
.bpm-btn,
.format-btn,
.play-controls-row button,
#controls-right-top .top-buttons-row button,
.fill-buttons-row .toggle,
.rnd-toggle,
.effect-toggle {
    font-family: monospace;
    font-size: 8px;
    color: #888;
}

:root {
    --gap: 10px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    width: 100%;
    min-height: 100%;
    background: #fff;
    font: 8px monospace;
    color: #aaa;
    overflow-x: hidden;
}


#container {
    display: flex;
    width: 100%;
    min-height: calc(100vh - 24px);
}

#left-half {
    flex: 1;
    margin: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
}

#left-half canvas {
    max-width: 100%;
    max-height: 100%;
    background: #fff;
    aspect-ratio: 1 / 1;
}


/* ===== RIGHT HALF ===== */
#right-half {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    justify-content: space-between;
    margin: 10px 10px 10px 0;
}


/* ===== PLAY / BPM / SECUENCIADOR ===== */
#controls-top {
    display: flex;
    gap: 20px;
}

#controls-left-top,
#controls-right-top {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}


.play-controls-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--gap);
}

.play-controls-row button {
    width: 100%;
    height: 24px;
    border: 1px solid #aaa;
    background: #fff;
    cursor: pointer;
    transition: background 0.2s;
}

.play-controls-row button:hover {
    background: #eee;
}

.play-controls-row button.active {
    background: #999;
    color: #fff;
}


#bpmControl {
    display: flex;
    align-items: center;
    gap: var(--gap);
}

.bpm-btn {
    width: 20px;
    height: 20px;
    border: 1px solid #aaa;
    background: #fff;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 12px;
    line-height: 1;
    text-align: center;
}

.bpm-btn:hover {
    background: #eee;
}

/* Estilo idéntico a .bpm-btn para los botones + y - */
#bpmInc,
#bpmDec {
    width: 28px;
    height: 24px;
    border: 1px solid #aaa;
    background: #fff;
    cursor: pointer;
    transition: background 0.2s;
    font-family: monospace;
    font-size: 8px;
    line-height: 1;
    text-align: center;
}


#bpmInc:hover,
#bpmDec:hover {
    background: #eee;
}


/* Unified slider appearance for all inputs */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: #ddd;
    border-radius: 3px;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    background: #ddd;
    border-radius: 3px;
}

input[type="range"]::-moz-range-track {
    height: 6px;
    background: #ddd;
    border-radius: 3px;
}

input[type="range"]::-webkit-slider-thumb,
input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #fff;
    border: 1px solid #999;
    box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
    margin-top: -5px;
    cursor: pointer;
}


/* ===== SEQUENCERS ===== */
#sequencers>div {
    display: flex;
    align-items: center;
    gap: var(--gap);
}

#sequencers {
    display: flex;
    flex-direction: column;
    gap: 12px;

}

.sequencer-step {
    width: 22px;
    height: 24px;
    position: relative;
    /* establish positioning context */
}


.sequencer-step .sequencer-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 8px;
    color: #666;
    pointer-events: none;
    /* so clicks still hit the step */
    user-select: none;
}



.sequencer-label {
    font-size: 8px;
    color: #666;
    display: block;
    text-align: center;
    line-height: 8px;
    /* vertically centers label in 10px-tall step */
}

.sequencer {
    display: flex;
    justify-content: space-between;
    flex: 1;
}

.sequencer-step {
    width: 24px;
    height: 24px;
    border: 1px solid #aaa;
    background: #fff;
    cursor: pointer;
    transition: background 0.2s;
}

.sequencer-step:hover {
    background: #eee;
}

.sequencer-step.active {
    background: #666;
}

.sequencer-step.current-step {
    outline: 2px solid #444;
}


/* ===== MAIN BUTTON ROW (R, G, PNG, SVG) ===== */
#controls-right-top .top-buttons-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--gap);
}

#controls-right-top .top-buttons-row button {
    width: 100%;
    height: 24px;
    border: 1px solid #aaa;
    background: #fff;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: -18px;
    /* Separacion de la parte de arriba */
}

#controls-right-top .top-buttons-row button:hover {
    background: #eee;
}

#randomAll.active,
#generate.active,
#exportPNG.active,
#exportSVG.active {
    background: #999;
    color: #fff;
}


/* ===== A3/1:1/9:16/4:5 Y SLIDERS ABAJO ===== */
#controls-bottom {
    display: flex;
    gap: 30px;
    margin-top: auto;
}

#controls-col1,
#controls-col2 {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}


.format-row,
.fill-buttons-row {
    display: flex;
    gap: 10px;
}

.format-btn,
.fill-buttons-row .toggle {
    flex: 1;
    height: 24px;
    border: 1px solid #aaa;
    background: #fff;
    cursor: pointer;
    transition: background 0.2s;
}

.format-btn:hover,
.fill-buttons-row .toggle:hover {
    background: #eee;
}

.format-btn.active,
.fill-buttons-row .toggle.active {
    background: #999;
    color: #fff;
}


/* ===== SLIDER CONTROLS (original look) ===== */
.control {
    display: flex;
    align-items: center;
    height: 20px;
    gap: var(--gap);
}

.control label {
    width: 28px;
    text-align: left;
    color: #aaa;
    user-select: none;
    font-size: 8px;
}

.control input[type="range"] {
    flex: 1;
    height: 6px;
    opacity: 0.6;
}

.control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: white;
    border: 1px solid #999;
    cursor: pointer;
    box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
    margin-top: -5px;
}

.control input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: white;
    border: 1px solid #999;
    cursor: pointer;
    box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}


/* ===== TOGGLE BUTTONS BY SLIDERS (original look) ===== */
.rnd-toggle,
.effect-toggle {
    width: 20px;
    height: 20px;
    background: white;
    color: black;
    border: 1px solid #999;
    font-weight: bold;
    box-shadow: 2px 2px 0 #eee;
    cursor: pointer;
    text-align: center;
    line-height: 18px;
    padding: 0;
    font-family: monospace;
    font-size: 11px;
    transition:
        background 0.2s ease,
        color 0.2s ease,
        box-shadow 0.2s ease,
        border 0.2s ease,
        transform 0.2s ease;
    flex-shrink: 0;
    user-select: none;
}

.rnd-toggle:hover,
.effect-toggle:hover {
    border-color: #555;
}

.rnd-toggle.active,
.effect-toggle.active {
    background: #aaa;
    color: white;
    box-shadow: none;
    border: 1px solid #999;
    transform: scale(0.94);
}

/* ===== ANIMATION TOGGLE BUTTONS ===== */
.anim-toggle {
    width: 16px;
    height: 16px;
    border: 1px solid #aaa;
    background: #fff;
    cursor: pointer;
    font-family: monospace;
    font-size: 8px;
    margin-left: 4px;
  }
  
  .anim-toggle.active {
    background: #aaa;
    color: #fff;
  }


/* ===== BPM SLIDER MATCHING ORIGINAL SLIDER CONTROLS ===== */
/* Override the default thumb (blue circle) with a white square */
#bpmRange::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #fff;
    border: 1px solid #999;
    box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
    margin-top: -5px;
    cursor: pointer;
    border-radius: 0;
}

#bpmRange::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #fff;
    border: 1px solid #999;
    box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    border-radius: 0;
}

/* Restore original sequencer color behavior: only outline on the current step */
.sequencer-step.current-step {
    outline: 1px solid #aaa;
    background: #eee;
    /* ensure it doesn’t get the gray fill */
}

/* Keep the active step fill as before */
.sequencer-step.active {
    background: #666;
    background: #aaa;
}

/* Lighten the active step when it's the current playing step */
.sequencer-step.current-step.active {
    /* Increase brightness by 20% */
    outline: 1px solid #aaa;
    filter: brightness(1.3);
}


/* Darken the inactive step when it's the current playing step */
.sequencer-step.current-step:not(.active) {
    /* Decrease brightness to 80% */
    outline: 1px solid #aaa;
    filter: brightness(1);
}

#randomAll,
#generate {
    background-color: #aaa;
    color: #888;
    transition: background 0.1s, color 0.1s;
}


/* 2) Flash state */
#randomAll.pressed,
#generate.pressed {
    background-color: #fff;
    color: #aaa;
}

header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    box-sizing: border-box;
    z-index: 1000;
    font-size: 1.3em;
    margin-bottom: 20px;
}

.title .hover-text {
        opacity: 0;
        max-width: 0;
        overflow: hidden;
        white-space: nowrap;
        display: inline-block;
        vertical-align: middle;
        transition: max-width 0.5s ease-in-out, opacity 0.3s ease-in-out, margin-left 0.5s ease-in-out;
        color: #555;
    }
    .title:hover .hover-text {
        opacity: 1;
        max-width: 800px; /* Adjust if text is longer */
        margin-left: 1em;
    }
    .title:hover .hover-text  a{
        color: #555;
    }

@media (max-width: 1024px) {
      header {
        display: none;
      }
      body {
        overflow-y: auto;
      }
      #container {
        flex-direction: column;
        height: auto;
        margin-top: 0;
      }
      #left-half, #right-half {
        width: 100%;
        height: auto;
        flex: none;
        margin: 0;
        padding: 10px;
      }
      #left-half {
        min-height: 50vh;
        order: 1;
      }
      #right-half {
        order: 2;
        justify-content: flex-start;
      }
      #controls-top {
        flex-direction: column;
      }
      #controls-left-top, #controls-right-top {
        width: 100%;
      }
      #controls-bottom {
        flex-direction: column;
        margin-top: 20px;
        gap: 12px; /* Use the smaller gap for consistency */
      }
      #controls-col1, #controls-col2 {
        width: 100%;
      }
    }