:root {
    color-scheme: light;
    --bg: #f7fafc;
    --panel: rgba(255, 255, 255, 0.92);
    --panel-border: rgba(148, 163, 184, 0.24);
    --text: #111827;
    --muted: #6b7280;
    --accent: #60a5fa;
    --accent-strong: #2563eb;
    --active: #22c55e;
    --border: rgba(148, 163, 184, 0.35);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at top, #ffffff 0%, #e2e8f0 45%, #cbd5e1 100%);
    color: var(--text);
    display: flex;
    justify-content: center;
    padding: 24px;
}

.app-shell {
    width: min(100%, 1080px);
    display: grid;
    gap: 24px;
}

.app-header {
    display: grid;
    gap: 12px;
    text-align: center;
}

.app-label {
    margin: 0;
    font-size: 0.82rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--accent);
}

h1 {
    margin: 0;
    font-size: clamp(2rem, 3.5vw, 3.2rem);
}

.app-description {
    margin: 0 auto;
    max-width: 720px;
    color: var(--muted);
    line-height: 1.6;
}

.controls-panel {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

@media (max-width: 640px) {
    .controls-panel {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: auto auto;
    }

    .tempo-group {
        grid-column: 1 / -1;
    }
}

.control-group {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 20px;
    padding: 18px 20px;
    text-align: left;
}

.control-group label {
    display: block;
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 0.95rem;
}

.control-group select,
.control-group input[type="range"] {
    width: 100%;
    border: none;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    padding: 12px 14px;
    font-size: 1rem;
    outline: none;
}

.control-group select {
    appearance: none;
}

.tempo-group .tempo-control {
    display: grid;
    gap: 12px;
}

#bpm-display {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-width: 58px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    font-weight: 700;
}

.grid-panel {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 28px;
    padding: 22px;
}

#grid {
    display: grid;
    gap: 8px;
    width: 100%;
}

.pad {
    min-height: 52px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer;
    transition: transform 0.14s ease, background 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

.pad:hover {
    transform: translateY(-1px);
    border-color: rgba(106, 222, 255, 0.4);
}

.pad.active {
    border-color: transparent;
}

.pad.clap.active {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
}

.pad.snare.active {
    background: linear-gradient(135deg, #facc15 0%, #eab308 100%);
}

.pad.hi-hat.active {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
}

.pad.kick.active {
    background: linear-gradient(135deg, #86efac 0%, #22c55e 100%);
}

.pad.current-step {
    box-shadow: inset 0 0 0 2px rgba(96, 165, 250, 0.45);
}

.pad.active.current-step {
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.7);
}

.action-panel {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 14px;
}

.playback-buttons,
.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

button {
    border: none;
    border-radius: 16px;
    padding: 14px 22px;
    font-size: 1rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    cursor: pointer;
    transition: transform 0.14s ease, background 0.14s ease;
}

button.icon-button {
    border-radius: 50%;
    width: 56px;
    height: 56px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
}

button.icon-button svg {
    width: 28px;
    height: 28px;
    pointer-events: none;
}

button.icon-button:hover {
    transform: scale(1.08);
    background: rgba(255, 255, 255, 0.12);
}

button#play-toggle.icon-button {
    background: linear-gradient(135deg, #4b7cff 0%, #1f6bfc 100%);
    color: white;
}

button#play-toggle.icon-button:hover {
    transform: scale(1.08);
}

button#play-toggle.icon-button.disabled {
    background: linear-gradient(135deg, #a1afc9 0%, #7a8ba8 100%);
    cursor: not-allowed;
    opacity: 0.6;
}

button#play-toggle.icon-button.disabled:hover {
    transform: none;
    background: linear-gradient(135deg, #a1afc9 0%, #7a8ba8 100%);
}

button#clear.icon-button {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
    color: white;
}

button#save.icon-button {
    background: linear-gradient(135deg, #86efac 0%, #22c55e 100%);
    color: white;
}

@media (max-width: 640px) {
    body {
        padding: 16px;
    }
}
