/* Styles */
:root {
    --accent: #83E83E;
    --bg: #0b0b0b;
    --fg: #eaeaea;
    --muted: #666;
    --pad-min: 90px;
    --pad-gap: 10px;
    --pad-font: 'Roboto Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
}

* {
    box-sizing: border-box
}

body {
    font-family: system-ui, Segoe UI, Arial, sans-serif;
    background: #111;
    color: var(--fg);
    margin: 0;
    padding: 16px
}

h1 {
    margin: 0 0 12px
}

.toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 12px
}

.toolbar .status {
    color: var(--muted)
}

.sampler {
    display: flex;
    gap: 16px;
    align-items: flex-start
}

.pads {
    display: grid;
    grid-template-columns: repeat(4, minmax(var(--pad-min), 1fr));
    gap: var(--pad-gap);
    flex: 0 0 380px;
    max-width: 45vw
}

.pad {
    background: #1a1a1a;
    border: 2px solid transparent;
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
    aspect-ratio: 1/1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    font-family: var(--pad-font);
    font-weight: 700;
    letter-spacing: 0.2px;
}

.pad:hover {
    border-color: #444
}

.pad.active {
    border-color: var(--accent)
}

.pad .name {
    display: block;
    margin-top: 6px;
    font-size: 0.95rem;
    color: #ddd;
    font-weight: 700;
}

/* Pad loading bar */
.pad .progress {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 8px;
    height: 6px;
    border-radius: 4px;
    background: #2a2a2a;
    overflow: hidden;
    display: block;
}

.pad .progress .bar {
    height: 100%;
    width: 0%;
    background: var(--accent);
    transition: width .15s ease-out;
}

.visualizer {
    margin-top: 0;
    /* Visualizer width */
    flex: 0 0 500px;
    /* fixed width */
    min-width: 500px;
    max-width: 500px;
}

.canvas-wrapper {
    position: relative;
    /* Canvas wrapper */
    width: 500px;
    max-width: 500px;
    margin: 0;
    overflow: auto
}

canvas {
    display: block;
    background: var(--bg);
    border: 1px solid #444;
    width: 100%;
    height: auto
}

#waveOverlay {
    position: absolute;
    left: 0;
    top: 0;
    background: transparent
}

.wam {
    margin-top: 18px
}

.font-preview {
    margin-top: 8px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 6px;
    font-size: 14px;
    color: #bbb;
}

/* Responsive tweaks */
@media (max-width: 700px) {
    :root {
        --pad-min: 80px;
        --pad-gap: 10px;
    }

    .pad {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    :root {
        --pad-min: 72px;
        --pad-gap: 8px;
    }

    .pad {
        padding: 8px;
    }

    .pad .name {
        font-size: 0.8rem;
    }
}

/* Layout: side-by-side with horizontal scroll if needed */
.sampler {
    overflow-x: auto;
}