:root {
    --button-size: calc(6em * (min(90vh, 90vw) / 1080));
    --counter-size: calc(5em * (min(90vh, 90vw) / 1080));
    --counter-margin: auto;
    --metronome-width: calc(20em * (min(90vh, 90vw) / 1080));
}

body {
    background-color: #181319;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    overflow: hidden;
}

.container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1em;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-items: center;
}

.metronome {
    width: var(--metronome-width);
    border: 1px solid #9a9299;
    border-radius: .3em;
    background-color: #000000;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
}

.counter {
    width: var(--counter-size);
    height: var(--counter-size);
    border-radius: 50%;
    background-color: #39512c;
    border: 2px solid #28381e;
    box-sizing: border-box;
    margin: var(--counter-margin);
}

.counter.active {
    border: 2px solid #97f85d;
    background-color: #d8ff8e;
    box-shadow: rgba(151, 248, 93, 1) 0 0 20px 0px;
}

.soundboard {
    border: 1px solid #9a9299;
    border-radius: .3em;
    background-color: #000000;
}

.buttonArea {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
}

.column {
    display: flex;
    flex-direction: column;
    margin: 10px;
    gap: 1em;
    align-items: center;
    position: relative;
}

.column button {
    border: 2px solid black;
    border-radius: 0%;
    width: 6em;
    height: 6em;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.buttonArea .column button {
    width: var(--button-size);
    height: var(--button-size);
}


.column button::before {
    content: '';
    position: absolute;
    width: 2px;
    height: calc(50% + 2px);
    background: #878188;
    /* Line color */
    top: calc(100% + 2px);
    /* Start at the bottom of the button */
    left: 50%;
    transform: translateX(-50%);
}

.column button:last-child::before {
    display: none;
    /* Hide bottom line for the last button */
}

.column button:disabled {
    color: black;
}

.glow {
    transition: .15s ease-in-out;
}

.drums.glow {
    background: radial-gradient(circle, rgba(255, 211, 255, 1) 0%, rgba(255, 166, 255, 1) 100%);
    border-color: #ffa6ff !important;
    box-shadow: rgba(253, 128, 197, 1) 0 0 20px 5px;
}

.fx.glow {
    background: radial-gradient(circle, rgba(242, 216, 255, 1) 0%, rgba(224, 143, 255, 1) 100%);
    border-color: #e08fff !important;
    box-shadow: rgba(168, 120, 255, 1) 0 0 20px 5px;
}

.bass.glow {
    background: radial-gradient(circle, rgba(217, 255, 208, 1) 0%, rgba(180, 255, 157, 1) 100%);
    border-color: #b4ff9d !important;
    box-shadow: rgba(139, 236, 84, 1) 0 0 20px 5px;
}

.goatsoul.glow {
    background: radial-gradient(circle, rgba(255, 240, 169, 1) 0%, rgba(255, 216, 70, 1) 100%);
    border-color: #ffd846 !important;
    box-shadow: rgba(255, 201, 108, 1) 0 0 20px 5px;
}

.melody.glow {
    background: radial-gradient(circle, rgba(166, 255, 255, 1) 0%, rgba(91, 229, 255, 1) 100%);
    border-color: #5be5ff !important;
    box-shadow: rgba(76, 189, 255, 1) 0 0 20px 5px;
}

.drums {
    border-color: #66395f !important;
    background: radial-gradient(circle, rgba(123, 50, 104, 1) 0%, rgba(106, 34, 88, 1) 100%);
}

.fx {
    border-color: #7448ab !important;
    background: radial-gradient(circle, rgba(130, 75, 203, 1) 0%, rgba(104, 44, 174, 1) 100%);
}

.bass {
    border-color: #45543f !important;
    background: radial-gradient(circle, rgba(76, 100, 62, 1) 0%, rgba(55, 91, 40, 1) 100%);
}

.goatsoul {
    border-color: #766655 !important;
    background: radial-gradient(circle, rgba(142, 115, 97, 1) 0%, rgba(105, 81, 62, 1) 100%);
}

.melody {
    border-color: #365972 !important;
    background: radial-gradient(circle, rgba(52, 104, 134, 1) 0%, rgba(25, 78, 117, 1) 100%);
}

.column p {
    font-weight: bold;
}

.arrows {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-left: 10px;
}

.arrows p {
    font-size: 1.5em;
    font-weight: bold;
    color: white;
}

.title {
    height: 1.5em;
    margin: 10px;
}

#loadingScreen {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    z-index: 1000;
}

.hidden {
    display: none !important;
}
/* User-gesture audio start, preserving the original soundboard beneath. */
.loading-inner {
    max-width: 24rem;
    padding: 1.5rem;
    text-align: center;
    font-family: system-ui, sans-serif;
}
#startAudio {
    padding: 0.75rem 1.25rem;
    border: 2px solid #97f85d;
    background: #263e25;
    color: #f3ffe9;
    font: inherit;
    font-weight: bold;
    cursor: pointer;
}
#startAudio:hover:not(:disabled),
#startAudio:focus-visible {
    background: #39512c;
    outline: 2px solid #d8ff8e;
    outline-offset: 3px;
}
#startAudio:disabled {
    opacity: 0.6;
    cursor: progress;
}
#loadingMessage {
    font-size: 0.75em;
    line-height: 1.5;
}

/* Status is visible only while a new Opus sample is loading or needs retrying. */
#audioStatus {
    color: #d8ff8e;
    font: 0.8rem/1.4 system-ui, sans-serif;
    text-align: center;
    margin: 0.5rem 1rem;
}
#audioStatus:empty { display: none; }

/* Small, unobtrusive attribution for the original fan-made software. */
.goatpad-credit { color: #b8b7b9; font: 0.7rem/1.35 system-ui, sans-serif; text-align: center; margin: 0.25rem 0.8rem 0.75rem; }
.goatpad-credit a { color: #d8ff8e; }
.goatpad-credit a:focus-visible { outline: 2px solid #d8ff8e; outline-offset: 2px; }


/* Keep the original eight-column layout together rather than shrinking pads
   to illegible sizes. The viewport is horizontally scrollable on narrow phones. */
.sequence-viewport {
    max-width: 100%;
}
.sequence-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.metronome {
    box-sizing: border-box;
    margin: 0.45em auto 0.35em;
}
.buttonArea .column button {
    color: #fff;
    touch-action: manipulation;
    cursor: pointer;
}
.buttonArea .column button.glow {
    color: #141414;
}
.buttonArea .column button p {
    margin: 0;
    text-align: center;
    font-size: 0.8rem;
    line-height: 1.1;
}
.title {
    display: block;
    max-width: calc(100% - 1rem);
    margin: 0.6rem auto;
}
.mobile-scroll-hint {
    display: none;
}

@media (max-width: 720px), (max-height: 520px) and (pointer: coarse) {
    body {
        display: block;
        width: 100%;
        height: auto;
        min-height: 100vh;
        min-height: 100dvh;
        overflow-x: hidden;
        overflow-y: auto;
    }
    .container {
        display: flex;
        justify-content: center;
        align-items: flex-start;
        width: 100%;
        height: auto;
        min-height: 100vh;
        min-height: 100dvh;
        box-sizing: border-box;
        padding: 1rem 0.5rem;
        gap: 0;
    }
    .side-column {
        display: none;
    }
    .soundboard-column {
        box-sizing: border-box;
        width: min(100%, 640px);
        margin: 0;
        gap: 0;
    }
    .soundboard {
        box-sizing: border-box;
        width: 100%;
        max-width: 100%;
        padding: 0.4rem 0 0.6rem;
    }
    .sequence-viewport {
        width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        overscroll-behavior-x: contain;
        scrollbar-width: thin;
        -webkit-overflow-scrolling: touch;
    }
    .sequence-inner {
        width: max-content;
        min-width: 100%;
    }
    .buttonArea .column {
        margin: 0 2px;
        gap: 5px;
    }
    .buttonArea .column button {
        box-sizing: border-box;
        width: 44px;
        height: 44px;
        flex: 0 0 44px;
    }
    .buttonArea .column button::before {
        top: 100%;
        height: 5px;
    }
    .buttonArea .column button p {
        font-size: 0;
    }
    .buttonArea .column button p::after {
        content: attr(data-short);
        font-size: 0.7rem;
        font-weight: 700;
        letter-spacing: 0.01em;
    }
    .metronome {
        box-sizing: border-box;
        width: 100%;
        height: 32px;
        padding: 2px 0;
        margin: 0 auto 0.5rem;
    }
    .counter {
        box-sizing: border-box;
        width: 24px;
        height: 24px;
        margin: auto;
        flex: 0 0 auto;
    }
    .title {
        height: 30px;
        max-width: calc(100% - 1rem);
        object-fit: contain;
    }
    #audioStatus {
        margin: 0.5rem 0.75rem;
    }
    .goatpad-credit {
        max-width: 32rem;
        margin: 0.4rem auto 0;
        padding: 0 0.75rem;
        font-size: 0.72rem;
        line-height: 1.45;
    }
    #loadingScreen {
        box-sizing: border-box;
        height: 100vh;
        height: 100dvh;
        padding: 1rem;
        font-size: 1.1rem;
    }
    .loading-inner {
        padding: 1rem;
    }
    #startAudio {
        min-height: 44px;
    }
}
/* The 44px pads need a small horizontal swipe on the narrowest phones. */
@media (max-width: 400px) {
    .mobile-scroll-hint {
        display: block;
        margin: 0.4rem 0.5rem 0;
        color: #d8ff8e;
        font: 0.72rem/1.4 system-ui, sans-serif;
        text-align: center;
    }
}
