:root {
    --bg: #0f2018;
    --panel: #f6efe1;
    --panel-dark: #dfceb3;
    --ink: #1e1914;
    --muted: #6f6254;
    --accent: #b8651d;
    --accent-dark: #7b3f17;
    --green: #1c6f4b;
    --green-dark: #0e3c2d;
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.32);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Georgia, "Times New Roman", serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.08), transparent 30rem),
        linear-gradient(135deg, #0f2018, #183a2c 55%, #0f2018);
}

button,
input,
select {
    font: inherit;
}

.app-shell {
    width: min(980px, calc(100% - 32px));
    margin: 0 auto;
    padding: 48px 0;
}

.hero {
    color: #fff9ec;
    text-align: center;
    margin-bottom: 28px;
}

.eyebrow {
    margin: 0 0 8px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    font-size: 0.78rem;
    color: #f0d7aa;
}

h1 {
    margin: 0;
    font-size: clamp(2.6rem, 7vw, 5.2rem);
    line-height: 0.95;
}

.intro {
    width: min(720px, 100%);
    margin: 20px auto 0;
    font-size: 1.08rem;
    line-height: 1.65;
    color: #efe5d1;
}

.metronome-card {
    background: var(--panel);
    border: 8px solid var(--panel-dark);
    border-radius: 32px;
    padding: clamp(22px, 5vw, 44px);
    box-shadow: var(--shadow);
}

.tempo-display {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 12px;
    line-height: 1;
}

#bpmValue {
    font-family: "Trebuchet MS", Arial, sans-serif;
    font-size: clamp(4rem, 16vw, 8.5rem);
    font-weight: 800;
    color: var(--green-dark);
}

.tempo-unit {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--muted);
}

.tempo-controls {
    display: grid;
    grid-template-columns: 56px 1fr 56px;
    gap: 14px;
    align-items: center;
    margin: 20px 0 28px;
}

.round-button,
.play-button {
    border: 0;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.round-button {
    width: 56px;
    height: 56px;
    border-radius: 999px;
    background: var(--green);
    color: white;
    font-size: 2rem;
    line-height: 1;
    box-shadow: 0 8px 18px rgba(14, 60, 45, 0.25);
}

.round-button:hover,
.play-button:hover {
    transform: translateY(-1px);
}

.round-button:active,
.play-button:active {
    transform: translateY(1px);
}

.slider-wrap {
    display: block;
}

input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
}

.play-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: min(280px, 100%);
    margin: 0 auto;
    padding: 18px 28px;
    border-radius: 999px;
    background: var(--accent);
    color: white;
    font-size: 1.35rem;
    font-weight: 700;
    box-shadow: 0 12px 24px rgba(123, 63, 23, 0.25);
}

.play-button.is-playing {
    background: var(--accent-dark);
}

.play-icon {
    font-family: Arial, sans-serif;
}

.beat-lamps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(46px, 1fr));
    gap: 12px;
    margin: 34px 0;
}

.beat-lamp {
    display: grid;
    place-items: center;
    min-height: 52px;
    border-radius: 16px;
    background: #eadcc3;
    border: 2px solid #cfb891;
    color: var(--muted);
    font-family: "Trebuchet MS", Arial, sans-serif;
    font-weight: 800;
}

.beat-lamp.main-pulse {
    border-color: var(--accent);
}

.beat-lamp.active {
    background: var(--green);
    color: white;
    border-color: var(--green-dark);
    box-shadow: 0 0 0 4px rgba(28, 111, 75, 0.18);
}

.beat-lamp.active.main-pulse {
    background: var(--accent);
    border-color: var(--accent-dark);
}

.control-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.field {
    display: grid;
    gap: 8px;
    padding: 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.38);
}

.field span {
    font-weight: 800;
}

.field small {
    color: var(--muted);
    line-height: 1.4;
}

input[type="number"],
select {
    width: 100%;
    border: 2px solid #cfb891;
    border-radius: 12px;
    padding: 12px;
    background: #fffaf0;
    color: var(--ink);
}

.practice-notes {
    margin-top: 24px;
    padding: 18px;
    border-radius: 18px;
    background: #efe3cd;
}

.practice-notes summary {
    cursor: pointer;
    font-weight: 800;
}

.stroke-pattern {
    margin-bottom: 0;
    font-family: "Trebuchet MS", Arial, sans-serif;
    font-size: 1.6rem;
    font-weight: 900;
    letter-spacing: 0.2em;
    color: var(--green-dark);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

@media (max-width: 760px) {
    .control-grid {
        grid-template-columns: 1fr;
    }

    .tempo-controls {
        grid-template-columns: 48px 1fr 48px;
    }

    .round-button {
        width: 48px;
        height: 48px;
    }
}

.meter-row {
    display: grid;
    grid-template-columns: minmax(180px, 0.7fr) minmax(260px, 1.3fr);
    gap: 18px;
    margin-top: 28px;
}

.compact-field {
    min-width: 0;
}

.preset-field label {
    display: block;
}

.preset-controls {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
}

.secondary-button {
    border: 0;
    border-radius: 12px;
    padding: 12px 18px;
    background: var(--green);
    color: #fff;
    cursor: pointer;
    font-weight: 800;
    box-shadow: 0 8px 18px rgba(14, 60, 45, 0.18);
}

.secondary-button:hover {
    transform: translateY(-1px);
}

.secondary-button:active {
    transform: translateY(1px);
}

.beat-editor {
    margin-top: 30px;
}

.section-heading {
    margin-bottom: 16px;
}

.section-heading h2 {
    margin: 0 0 6px;
    font-size: 1.4rem;
    color: var(--green-dark);
}

.section-heading p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

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

.beat-button {
    display: grid;
    gap: 8px;
    min-height: 88px;
    padding: 14px 10px;
    border: 2px solid #cfb891;
    border-radius: 18px;
    background: #fffaf0;
    color: var(--ink);
    cursor: pointer;
    box-shadow: 0 8px 16px rgba(54, 37, 20, 0.08);
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.beat-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(54, 37, 20, 0.12);
}

.beat-button:active {
    transform: translateY(1px);
}

.beat-button.main-pulse {
    border-color: var(--accent);
}

.beat-button.active {
    background: var(--green);
    color: #fff;
    border-color: var(--green-dark);
    box-shadow: 0 0 0 4px rgba(28, 111, 75, 0.18);
}

.beat-button.active.main-pulse {
    background: var(--accent);
    border-color: var(--accent-dark);
}

.beat-number {
    font-family: "Trebuchet MS", Arial, sans-serif;
    font-size: 1.45rem;
    font-weight: 900;
    line-height: 1;
}

.beat-sample {
    font-family: "Trebuchet MS", Arial, sans-serif;
    font-size: 0.92rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

@media (max-width: 760px) {
    .meter-row,
    .preset-controls {
        grid-template-columns: 1fr;
    }
}

.slot-editor {
    margin-top: 30px;
}

.slot-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.slot-field {
    background: #fff6e8;
}

.beat-slot {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin: 0 auto;
    border-radius: 999px;
    background: var(--green-dark);
    color: #fff;
    font-family: "Trebuchet MS", Arial, sans-serif;
    font-size: 1.3rem;
    font-weight: 900;
    line-height: 1;
}

.beat-button.slot-b .beat-slot {
    background: var(--accent);
}

.beat-button.slot-c .beat-slot {
    background: var(--ink);
}

.beat-button.active .beat-slot {
    background: #fff;
    color: var(--green-dark);
}

@media (max-width: 760px) {
    .slot-grid {
        grid-template-columns: 1fr;
    }
}
