:root {
    --pink: #ff77b7;
    --purple: #7a5cff;
    --blue: #7ad7ff;
    --yellow: #ffe66d;
    --cream: #fff9f2;
    --ink: #2d2a32;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
    background: radial-gradient(
        circle at 20% 10%,
        #fff5fb 0%,
        #f0f6ff 60%,
        #ffffff 100%
    );
    color: var(--ink);
    min-height: 100vh;
}

header {
    padding: 48px 24px 24px;
    text-align: center;
}

header h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3.5rem);
    letter-spacing: 1px;
}

header p {
    margin: 12px auto 0;
    max-width: 620px;
    font-size: 1.1rem;
}

.sparkle {
    display: inline-block;
    font-family: "Baloo 2", "Trebuchet MS", cursive;
    letter-spacing: 0.5px;
    background: linear-gradient(
        120deg,
        var(--pink),
        var(--purple),
        var(--blue)
    );
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}

main {
    display: grid;
    gap: 24px;
    padding: 24px;
    max-width: 1000px;
    margin: 0 auto;
}

.card {
    background: var(--cream);
    border-radius: 18px;
    padding: 24px;
    border: 2px solid #f5e1ff;
    box-shadow: 0 10px 30px rgba(122, 92, 255, 0.1);
}

.card h2 {
    margin-top: 0;
}

.idea-card {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    align-items: start;
}

.idea-section + .idea-section {
    padding-left: 16px;
    border-left: 2px dashed #e6d5ff;
}

.grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.beat-controls {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.beat-controls label {
    font-weight: 700;
}

.beat-controls input[type="range"] {
    width: min(320px, 100%);
    accent-color: var(--purple);
}

.beat-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.beat-grid {
    display: grid;
    gap: 12px;
}

.beat-row {
    display: grid;
    grid-template-columns: 80px repeat(8, minmax(32px, 1fr));
    gap: 8px;
    align-items: center;
}

.beat-row strong {
    text-align: right;
    font-size: 0.95rem;
}

.beat-step {
    padding: 8px 0;
    border-radius: 10px;
    border: 2px solid #d6c2ff;
    background: #ffffff;
    color: var(--ink);
    font-weight: 600;
    transition:
        transform 0.15s ease,
        background-color 0.15s ease;
}

.beat-step.active {
    background: #7a5cff;
    border-color: #5b3df5;
    color: #ffffff;
}

.beat-step.is-playing {
    box-shadow: 0 0 0 3px rgba(255, 230, 109, 0.75);
    transform: translateY(-2px);
}

.badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--yellow);
    font-weight: 600;
    font-size: 0.85rem;
}

ul,
ol {
    padding-left: 20px;
}

button {
    background: var(--purple);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease;
}

button:hover {
    transform: translateY(-2px) scale(1.02);
}

#happy {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 14px;
    border-radius: 14px;
    background: #ffe66d;
    color: #2d2a32;
    border: 2px solid #2d2a32;
    font-weight: 600;
    text-align: center;
    line-height: 1.3;
    transition:
        opacity 0.2s ease,
        background-color 0.2s ease,
        transform 0.2s ease;
}

#happy:empty {
    opacity: 0;
    transform: translateY(4px);
}

.fun-output-wrap {
    position: relative;
    margin-top: 6px;
    padding-bottom: 56px;
}

footer {
    text-align: center;
    padding: 24px;
    font-size: 0.9rem;
}

.emoji-cloud {
    font-size: 1.5rem;
    letter-spacing: 8px;
}

@media (max-width: 600px) {
    header {
        padding-top: 36px;
    }

    .emoji-cloud {
        letter-spacing: 4px;
    }

    .beat-row {
        grid-template-columns: 70px repeat(8, minmax(30px, 1fr));
        gap: 6px;
    }

    .beat-step {
        padding: 7px 0;
    }

    .idea-section + .idea-section {
        padding-left: 0;
        padding-top: 14px;
        border-left: none;
        border-top: 2px dashed #e6d5ff;
    }
}
