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

body {
    background: #CBCBCB;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.container {
    background: #ffffff;
    border-radius: 12px;
    padding: 36px 40px;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.12);
    border: 1px solid #b9b9b9;
    text-align: center;
    max-width: 680px;
    width: 100%;
}

h1 {
    margin-bottom: 14px;
}

.feedback-footer {
    margin-top: 28px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
}

.feedback-footer p {
    margin-bottom: 0;
    color: #888;
}

.feedback-footer a {
    color: #666;
    text-decoration: none;
}

.feedback-footer a:hover {
    text-decoration: underline;
    color: #333;
}

.control-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.pattern-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pattern-selector label {
    font-weight: 600;
    color: #4A4A4A;
    font-size: 14px;
}

.pattern-selector select {
    padding: 8px 12px;
    border: 2px solid #CBCBCB;
    border-radius: 8px;
    background: #ffffff;
    color: #4A4A4A;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.18s ease;
}

.pattern-selector select:hover {
    border-color: #6D8196;
}

.pattern-selector select:focus {
    outline: none;
    border-color: #6D8196;
    box-shadow: 0 0 0 3px rgba(109, 129, 150, 0.15);
}


.bpm-control {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.bpm-control label {
    font-weight: 600;
    color: #4A4A4A;
    font-size: 14px;
    cursor: pointer;
    transition: color 0.2s ease;
    white-space: nowrap;
    min-width: 50px; /* keep layout stable across label lengths (Rock/Blues/DnB) */
    display: flex;
    justify-content: flex-end; /* keep extra space on the left, not between label and input */
}

.bpm-control label:hover {
    color: #6D8196;
}

.bpm-control input[type="range"] {
    accent-color: #6D8196;
    width: 180px;
    cursor: pointer;
}

.bpm-control input[type="number"] {
    width: 56px;
    padding: 8px 8px;
    border: 2px solid #CBCBCB;
    border-radius: 8px;
    font-size: 14px;
    color: #4A4A4A;
    font-weight: 600;
    text-align: right;
    -moz-appearance: textfield;
    appearance: textfield;
}

.bpm-control input[type="number"]::-webkit-outer-spin-button,
.bpm-control input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.bpm-control input[type="number"]:focus {
    outline: none;
    border-color: #6D8196;
    box-shadow: 0 0 0 3px rgba(109, 129, 150, 0.15);
}

.bpm-display {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.bpm-display input[type="number"] {
    cursor: pointer;
}

.bpm-display:hover input[type="number"] {
    border-color: #6D8196;
    background-color: #f9f9f9;
}

.bpm-unit {
    font-size: 12px;
    color: #CBCBCB;
    font-weight: 600;
}

.beat-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 36px 0 40px; /* add more breathing room above/below the core grid */
}

.beat-row-wrap {
    display: grid;
    grid-template-columns: 70px 1fr;
    align-items: center;
    gap: 10px;
}

.beat-row-label {
    justify-self: end;
    text-align: right;
    font-weight: 700;
    color: #4A4A4A;
    font-size: 14px;
}

.beat-row {
    display: grid;
    grid-template-columns: repeat(16, 1fr);
    gap: 8px;
}

.beat-cell {
    background: #ffffff;
    border: 2px solid #CBCBCB;
    border-radius: 8px;
    padding: 12px 0;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    color: #4A4A4A;
    font-size: 12px;
}

/* Alternating beat backgrounds (8 beats total, nodes grouped in pairs for beat/half-beat) */
.beat-cell:nth-child(1),
.beat-cell:nth-child(2),
.beat-cell:nth-child(5),
.beat-cell:nth-child(6),
.beat-cell:nth-child(9),
.beat-cell:nth-child(10),
.beat-cell:nth-child(13),
.beat-cell:nth-child(14) {
    background: #ffffff;
}

.beat-cell:nth-child(3),
.beat-cell:nth-child(4),
.beat-cell:nth-child(7),
.beat-cell:nth-child(8),
.beat-cell:nth-child(11),
.beat-cell:nth-child(12),
.beat-cell:nth-child(15),
.beat-cell:nth-child(16) {
    background: #d4dce8;
}

.beat-cell.active {
    background: #6D8196;
    color: #ffffff;
    border-color: #4A4A4A;
    font-weight: 700;
}

.beat-cell.current {
    box-shadow: 0 0 0 3px rgba(109, 129, 150, 0.28), 0 8px 18px rgba(0, 0, 0, 0.10);
    transform: translateY(-2px);
}

.controls {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn {
    padding: 12px 28px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.btn-play {
    background: #6D8196;
    color: #ffffff;
}

.btn-play:hover:not(:disabled) {
    background: #5d7084;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(109, 129, 150, 0.35);
}

.btn-play:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-play.is-stop {
    background: #4A4A4A;
    color: #ffffff;
}

.btn-play.is-stop:hover:not(:disabled) {
    background: #3d3d3d;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.28);
}

.status {
    padding: 16px;
    background: #ffffff;
    border: 1px solid #b9b9b9;
    border-radius: 8px;
    font-size: 16px;
    color: #4A4A4A;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 90px; /* prevents layout shift when status text or bunnies appear */
}

#statusText {
    margin: 0;
    min-height: 24px; /* reserve one line of text height */
}

.status-bunnies {
    display: inline-flex;
    align-items: center;
    font-size: 20px;
    min-width: 80px;
    justify-content: center;
}

.bunny-frame {
    line-height: 1.2;
}

.bunny-frame.hidden {
    display: none;
}

#statusText {
    margin: 0;
    font-weight: 500;
}

@media (max-width: 600px) {
    .container {
        padding: 30px 20px;
    }

    h1 {
        font-size: 24px;
    }

    .controls {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}
