/* ==========================================================================
   Rhythm Practice App - Styles
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties (Design Tokens)
   -------------------------------------------------------------------------- */
:root {
    /* Colors */
    /* Colors - Black and White Theme */
    --color-primary: #000000;
    --color-primary-light: #333333;
    --color-primary-dark: #000000;
    --color-accent: #000000;
    --color-accent-light: #333333;
    --color-success: #000000;
    --color-warning: #333333;
    --color-error: #000000;

    /* Background */
    --bg-primary: #ffffff;
    --bg-secondary: #f4f4f5;
    --bg-tertiary: #e4e4e7;
    --bg-glass: rgba(0, 0, 0, 0.05);
    --bg-glass-hover: rgba(0, 0, 0, 0.1);

    /* Text */
    --text-primary: #000000;
    --text-secondary: #3f3f46;
    --text-muted: #71717a;

    /* Borders */
    --border-color: #e4e4e7;
    --border-color-active: #000000;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 0 1px #000000;

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms ease;

    /* Typography */
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'Space Mono', monospace;
}

/* --------------------------------------------------------------------------
   Base Reset & Global Styles
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-md);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    display: grid;
    gap: var(--spacing-lg);
    margin-top: var(--spacing-lg);
}

/* Desktop: Two column layout */
@media (min-width: 1024px) {
    .main-content {
        grid-template-columns: 380px 1fr;
        align-items: start;
    }
}

/* --------------------------------------------------------------------------
   Card Component
   -------------------------------------------------------------------------- */
.glass-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.glass-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-color-active);
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.header {
    text-align: center;
    padding: var(--spacing-xl) var(--spacing-md);
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.logo-icon {
    font-size: 2.5rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.logo h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.tagline {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Mobile header adjustments */
@media (max-width: 640px) {
    .header {
        padding: var(--spacing-lg) var(--spacing-sm);
    }

    .logo h1 {
        font-size: 1.5rem;
    }

    .logo-icon {
        font-size: 2rem;
    }

    .tagline {
        font-size: 0.875rem;
    }
}

/* --------------------------------------------------------------------------
   Section Titles
   -------------------------------------------------------------------------- */
.section-title {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
}

.section-icon {
    font-size: 1.25rem;
}

/* --------------------------------------------------------------------------
   Controls Panel
   -------------------------------------------------------------------------- */
.controls-panel {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xl);
}

.control-section {
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
}

.control-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

/* --------------------------------------------------------------------------
   BPM Control
   -------------------------------------------------------------------------- */
.bpm-display {
    text-align: center;
    margin-bottom: var(--spacing-md);
}

.bpm-value {
    font-family: var(--font-mono);
    font-size: 4rem;
    font-weight: 700;
    color: var(--color-primary-light);
    line-height: 1;
    text-shadow: var(--shadow-glow);
}

.bpm-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: var(--spacing-xs);
}

/* BPM Slider */
.bpm-slider {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    outline: none;
    margin-bottom: var(--spacing-md);
    cursor: pointer;
}

.bpm-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: var(--color-primary);
    border-radius: var(--radius-full);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-fast);
}

.bpm-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    background: var(--color-primary-light);
}

.bpm-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    border-radius: var(--radius-full);
    cursor: pointer;
    border: none;
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

/* BPM Presets */
.bpm-presets {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-sm);
}

.preset-btn {
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.preset-btn:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
    border-color: var(--color-primary);
}

.preset-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

/* --------------------------------------------------------------------------
   Time Signature
   -------------------------------------------------------------------------- */
.time-signature-selector {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-sm);
}

.time-sig-btn {
    padding: var(--spacing-md);
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.time-sig-btn:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
    border-color: var(--color-accent);
}

.time-sig-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

/* Option Toggle */
.option-toggle {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border-color);
}

.option-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    transition: var(--transition-fast);
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: var(--transition-fast);
}

.toggle-switch input:checked+.toggle-slider {
    background: var(--color-primary);
}

.toggle-switch input:checked+.toggle-slider::before {
    transform: translateX(20px);
    background: white;
}

/* --------------------------------------------------------------------------
   Note Toggles
   -------------------------------------------------------------------------- */
.note-toggles {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-sm);
}

@media (min-width: 480px) and (max-width: 1023px) {
    .note-toggles {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 400px) {
    .note-toggles {
        grid-template-columns: repeat(2, 1fr);
    }
}

.note-toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-sm);
    background: var(--bg-glass);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    min-height: 56px;
    min-width: 56px;
}

.note-toggle:hover {
    background: var(--bg-glass-hover);
    border-color: var(--color-primary);
    transform: translateY(-2px);
}

.note-toggle.active {
    background: var(--bg-tertiary);
    border-color: var(--color-primary);
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.note-symbol {
    font-size: 2.5rem;
    line-height: 1;
}

/* Specific size overrides for notes that look too large */
.note-symbol.whole,
.note-symbol.half,
.note-symbol.dotted-half,
.note-symbol.sixteenth,
.note-symbol.rest-symbol {
    font-size: 1.8rem;
}

/* Dotted notes - bring dot closer to the note */
.note-symbol.dotted-note {
    display: inline-flex;
    align-items: center;
}


.note-symbol .dot {
    margin-left: -0.25em;
}

/* Specific Dotted Note Styles */
.note-symbol.dotted-quarter .dot {
    margin-left: -0.75em;
}

.symbol.dotted-quarter .dot {
    margin-left: -0.75em;
}

.note-symbol.dotted-eighth .dot {
    margin-left: -0.25em;
}

.note-symbol.dotted-half .dot {
    margin-left: 0.1em;
    /* Move dot away from stem */
}

.symbol.dotted-eighth .dot {
    margin-left: -0.25em;
}

.symbol.dotted-half .dot {
    margin-left: 0.1em;
    /* Move dot away from stem */
}

/* Rest symbols - slightly different styling */
.note-symbol.rest-symbol {
    color: var(--color-accent);
}

/* Beamed Triplet - 3 connected notes with bracket */
.beamed-triplet {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    width: 36px;
    height: 36px;
}

.triplet-bracket {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--color-accent);
    position: absolute;
    top: -2px;
    z-index: 1;
}

.triplet-beam {
    position: absolute;
    top: 6px;
    /* Shifted up from 8px */
    left: 2px;
    right: 2px;
    height: 3px;
    /* Standardized to 3px */
    background: currentColor;
    border-radius: 1px;
}

.triplet-notes {
    display: flex;
    justify-content: space-between;
    width: 100%;
    position: absolute;
    top: 8px;
    /* Shifted up from 10px */
    left: 0;
    right: 0;
    padding: 0 2px;
}

.triplet-notes .stem {
    width: 2px;
    height: 18px;
    background: currentColor;
    border-radius: 1px;
    position: relative;
}

/* Note head attached to bottom of each stem */
.triplet-notes .stem::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: -6px;
    width: 8px;
    height: 6px;
    background: currentColor;
    border-radius: 50%;
    transform: rotate(-20deg);
}

/* Hide the text-based note-heads since we use ::after */
.triplet-heads {
    display: none;
}

/* Triplet display in rhythm visualization */
.triplet-display {
    display: inline-flex;
    align-items: flex-start;
}

.triplet-display sup {
    font-size: 0.6em;
    font-weight: 700;
    color: var(--color-accent);
    margin-left: 1px;
}

/* Smaller triplet for rhythm display */
.beamed-triplet.small {
    width: 28px;
    height: 28px;
}

.beamed-triplet.small .triplet-bracket {
    font-size: 0.5rem;
    top: -1px;
}

.beamed-triplet.small .triplet-beam {
    top: 4px;
    /* Shifted up from 6px */
    height: 3px;
}

.beamed-triplet.small .triplet-notes {
    top: 6px;
    /* Shifted up from 8px */
}

.beamed-triplet.small .triplet-notes .stem {
    height: 14px;
}

.beamed-triplet.small .triplet-notes .stem::after {
    width: 6px;
    height: 5px;
    left: -5px;
    bottom: -1px;
}

/* Quintuplet Styles (Standalone) */
.beamed-quintuplet {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    width: 48px;
    height: 36px;
}

.beamed-quintuplet .quintuplet-bracket {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--color-accent);
    position: absolute;
    top: -2px;
    z-index: 1;
}

.beamed-quintuplet .quintuplet-beam {
    position: absolute;
    top: 6px;
    /* Shifted up from 8px */
    left: 1px;
    right: 1px;
    height: 3px;
    /* Standardized to 3px */
    background: currentColor;
    border-radius: 1px;
    width: 100%;
}

.beamed-quintuplet .quintuplet-notes {
    display: flex;
    justify-content: space-between;
    width: 100%;
    position: absolute;
    top: 8px;
    /* Shifted up from 10px */
    left: 0;
    right: 0;
    padding: 0 2px;
}

.beamed-quintuplet .quintuplet-notes .stem {
    width: 2px;
    height: 18px;
    background: currentColor;
    border-radius: 1px;
    position: absolute;
}

/* Evenly distribute 5 stems */
.beamed-quintuplet .quintuplet-notes .stem:nth-child(1) {
    left: 0;
}

.beamed-quintuplet .quintuplet-notes .stem:nth-child(2) {
    left: 25%;
}

.beamed-quintuplet .quintuplet-notes .stem:nth-child(3) {
    left: 50%;
}

.beamed-quintuplet .quintuplet-notes .stem:nth-child(4) {
    left: 75%;
}

.beamed-quintuplet .quintuplet-notes .stem:nth-child(5) {
    left: 100%;
}

/* Note head attached to bottom of each stem */
.beamed-quintuplet .quintuplet-notes .stem::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: -6px;
    width: 8px;
    height: 6px;
    background: currentColor;
    border-radius: 50%;
    transform: rotate(-20deg);
}

.beamed-quintuplet .quintuplet-heads {
    display: none;
}

/* Small variant for rhythm display */
.beamed-quintuplet.small {
    width: 58px;
    height: 28px;
}

.beamed-quintuplet.small .quintuplet-bracket {
    font-size: 0.5rem;
    top: -1px;
}

.beamed-quintuplet.small .quintuplet-beam {
    top: 4px;
    /* Shifted up from 6px */
    height: 3px;
}

.beamed-quintuplet.small .quintuplet-notes {
    top: 6px;
    /* Shifted up from 8px */
}

.beamed-quintuplet.small .quintuplet-notes .stem {
    height: 14px;
}

.beamed-quintuplet.small .quintuplet-notes .stem::after {
    width: 6px;
    height: 5px;
    left: -5px;
    bottom: -1px;
}

/* Beamed groups for 8th+16th combinations */
.beamed-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    width: 36px;
    height: 36px;
}

.beamed-group .beam-line {
    position: absolute;
    height: 3px;
    background: currentColor;
    border-radius: 1px;
}

.beamed-group .beam-top {
    top: 6px;
    left: 2px;
    right: 2px;
}

/* Second beam for sixteenth notes */
.beamed-group .beam-second {
    top: 13px;
    /* Increased spacing */
    left: 2px;
    right: 2px;
}

/* Beamed eighth notes - 2 notes with one beam */
.beamed-group.beamed-eighth {
    width: 24px;
}

.beamed-group.beamed-eighth .note-heads {
    letter-spacing: 6px;
}

/* Beamed sixteenth notes - 4 notes with double beam */
.beamed-group.beamed-sixteenth {
    width: 42px;
}

.beamed-group.beamed-sixteenth .note-heads {
    letter-spacing: 5px;
}

/* Partial beam on right side (for 8th + 16ths) */
.beamed-group.eighth-sixteenths .beam-partial-right {
    top: 13px;
    left: 50%;
    right: 2px;
}

/* Partial beam on left side (for 16ths + 8th) */
.beamed-group.sixteenths-eighth .beam-partial-left {
    top: 13px;
    left: 2px;
    right: 50%;
}

/* Partial beams on both sides (for 16th + 8th + 16th) */
.beamed-group.sixteenth-eighth-sixteenth .beam-partial-left-short {
    top: 13px;
    left: 2px;
    width: 8px;
}

.beamed-group.sixteenth-eighth-sixteenth .beam-partial-right-short {
    top: 13px;
    right: 2px;
    width: 8px;
}

.beamed-group .note-stems {
    display: flex;
    justify-content: space-between;
    width: 100%;
    position: absolute;
    top: 8px;
    left: 0;
    right: 0;
    padding: 0 2px;
}

.beamed-group .note-stems .stem {
    width: 2px;
    height: 18px;
    background: currentColor;
    border-radius: 1px;
    position: relative;
}

/* Note head attached to bottom of each stem */
.beamed-group .note-stems .stem::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: -6px;
    width: 8px;
    height: 6px;
    background: currentColor;
    border-radius: 50%;
    transform: rotate(-20deg);
}

/* Hide the text-based note-heads since we use ::after */
.beamed-group .note-heads {
    display: none;
}

/* Small variant for rhythm display */
.beamed-group.small {
    width: 28px;
    height: 28px;
}

.beamed-group.small .beam-top {
    top: 4px;
}

.beamed-group.small .beam-second {
    top: 10px;
    /* Increased from 8px for better separation */
}

.beamed-group.small .beam-partial-right,
.beamed-group.small .beam-partial-left {
    top: 10px;
}

.beamed-group.small .beam-partial-left-short,
.beamed-group.small .beam-partial-right-short {
    top: 8px;
    width: 6px;
}

.beamed-group.small .note-stems {
    top: 6px;
}

.beamed-group.small .note-stems .stem {
    height: 14px;
}

.beamed-group.small .note-stems .stem::after {
    width: 6px;
    height: 5px;
    left: -5px;
    bottom: -1px;
}

/* Small beamed-eighth */
.beamed-group.beamed-eighth.small {
    width: 18px;
}

/* Small beamed-sixteenth */
.beamed-group.beamed-sixteenth.small {
    width: 32px;
}

/* Base widths for new groups (for UI buttons) */
.beamed-group.two-sixteenths {
    width: 26px;
}

.beamed-group.dotted-eighth-sixteenth {
    width: 34px;
}

.beamed-group.sixteenth-dotted-eighth {
    width: 34px;
}

/* Two Sixteenths */
.beamed-group.two-sixteenths.small {
    width: 22px;
}

.beamed-group.two-sixteenths.small .beam-second {
    position: absolute;
    top: 10px;
    /* Increased from 8px */
    left: 2px;
    right: 2px;
    height: 3px;
    background: currentColor;
    border-radius: 1px;
}

/* Dotted Eighth + Sixteenth */
.beamed-group.dotted-eighth-sixteenth.small {
    width: 34px;
    /* Wider for dot space */
}

/* Note heads are hidden/controlled by stems, so letter-spacing irrelevant here */

.beamed-group.dotted-eighth-sixteenth .beam-partial-right {
    position: absolute;
    top: 13px;
    /* Base spacing increased */
    left: 60%;
    right: 2px;
    height: 3px;
    background: currentColor;
    border-radius: 1px;
}

.beamed-group.dotted-eighth-sixteenth.small .beam-partial-right {
    top: 10px;
    /* Increased from 8px */
}

.beamed-group.dotted-eighth-sixteenth .dot-in-beam {
    position: absolute;
    bottom: 4px;
    /* Higher position */
    left: 8px;
    /* Move right of first stem */
    font-size: 1rem;
    font-weight: 900;
    line-height: 1;
}

/* Sixteenth + Dotted Eighth */
.beamed-group.sixteenth-dotted-eighth.small {
    width: 38px;
    /* Slightly wider */
}

.beamed-group.sixteenth-dotted-eighth .beam-partial-left {
    position: absolute;
    top: 13px;
    /* Base spacing increased */
    left: 2px;
    right: 55%;
    height: 3px;
    background: currentColor;
    border-radius: 1px;
}

.beamed-group.sixteenth-dotted-eighth.small .beam-partial-left {
    top: 10px;
    /* Increased from 8px */
}

.beamed-group.sixteenth-dotted-eighth .dot-in-beam {
    position: absolute;
    bottom: 4px;
    right: -2px;
    /* Moved further right, away from stem */
    font-size: 1rem;
    font-weight: 900;
    line-height: 1;
}

/* --------------------------------------------------------------------------
   Measures Selector
   -------------------------------------------------------------------------- */
.measures-selector {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-sm);
}

.measure-btn {
    padding: var(--spacing-md);
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.measure-btn:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
    border-color: var(--color-primary);
}

.measure-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
    box-shadow: var(--shadow-glow);
}

/* --------------------------------------------------------------------------
   Rhythm Panel
   -------------------------------------------------------------------------- */
.rhythm-panel {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.rhythm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.rhythm-header .section-title {
    margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   Generate Button
   -------------------------------------------------------------------------- */
.generate-btn {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--color-primary);
    border: none;
    border-radius: var(--radius-full);
    color: white;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.generate-btn:active {
    transform: translateY(0);
}

.generate-btn .btn-icon {
    font-size: 1.25rem;
}

/* --------------------------------------------------------------------------
   Rhythm Display
   -------------------------------------------------------------------------- */
.rhythm-display {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    min-height: 200px;
    padding: var(--spacing-lg);
    display: grid;
    grid-template-columns: 1fr 1fr;
    /* Strictly 2 columns */
    gap: var(--spacing-md);
    align-items: stretch;
    justify-content: center;
    overflow-x: auto;
}

.rhythm-placeholder {
    text-align: center;
    color: var(--text-muted);
}

.placeholder-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: var(--spacing-md);
    opacity: 0.5;
}

/* Time Signature Display */
.time-signature-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 2rem;
    line-height: 0.8;
    margin-right: var(--spacing-md);
    color: var(--text-primary);
    user-select: none;
}

.time-signature-display .numerator {
    margin-bottom: 4px;
}

/* Measure and Note Styling */
.measure {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    /* Align content to start to accommodate time sig */
    gap: var(--spacing-xs);
    padding: var(--spacing-md);
    background: var(--bg-glass);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    width: 100%;
    /* Remove flex properties as grid controls layout */
}

.measure.active {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-glow);
}

.note-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    flex: 1;
    /* Allow notes to grow and spread evenly */
    min-height: 60px;
    padding: var(--spacing-xs);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.note-cell.active {
    background: var(--bg-tertiary);
    transform: scale(1.1);
    box-shadow: var(--shadow-sm);
}

.note-cell .symbol {
    font-size: 2.5rem;
    line-height: 1;
}

/* Specific size overrides for display */
.note-cell.whole .symbol,
.note-cell.half .symbol,
.note-cell.dottedHalf .symbol,
.note-cell.sixteenth .symbol,
.note-cell.wholeRest .symbol,
.note-cell.halfRest .symbol,
.note-cell.quarterRest .symbol,
.note-cell.eighthRest .symbol,
.note-cell.sixteenthRest .symbol,
.symbol.dotted-half {
    font-size: 1.8rem;
}

.measure-bar {
    width: 2px;
    height: 60px;
    background: var(--text-muted);
    margin: 0 var(--spacing-xs);
}


.playback-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-lg);
    padding: var(--spacing-md);
}

.control-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.control-btn.primary {
    width: 80px;
    height: 80px;
    background: var(--color-primary);
    box-shadow: var(--shadow-md);
    font-size: 2rem;
    color: white;
}

.control-btn.primary:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
    background: #000000;
}

.control-btn.primary:active {
    transform: scale(0.98);
}

.control-btn.secondary {
    width: 56px;
    height: 56px;
    background: white;
    border: 2px solid var(--border-color);
    font-size: 1.5rem;
    color: var(--text-primary);
}

.control-btn.secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--color-primary);
}

.control-btn.secondary.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.hidden {
    display: none !important;
}

/* --------------------------------------------------------------------------
   Count Display
   -------------------------------------------------------------------------- */
.count-display {
    text-align: center;
    padding: var(--spacing-sm);
}

.count-label {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-right: var(--spacing-sm);
}

.count-value {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary-light);
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.footer {
    text-align: center;
    padding: var(--spacing-lg);
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* --------------------------------------------------------------------------
   Animations
   -------------------------------------------------------------------------- */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

.measure {
    animation: fadeIn 0.3s ease forwards;
}

/* --------------------------------------------------------------------------
   Mobile Optimizations
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
    .app-container {
        padding: var(--spacing-sm);
    }

    .glass-card {
        padding: var(--spacing-md);
        border-radius: var(--radius-lg);
    }

    .bpm-value {
        font-size: 3rem;
    }

    .bpm-presets {
        grid-template-columns: repeat(3, 1fr);
    }

    .control-btn.primary {
        width: 72px;
        height: 72px;
    }

    .control-btn.secondary {
        width: 48px;
        height: 48px;
    }

    .rhythm-display {
        min-height: 150px;
        padding: var(--spacing-md);
    }

    .generate-btn {
        padding: var(--spacing-sm) var(--spacing-md);
    }

    .generate-btn .btn-text {
        display: none;
    }
}

/* Touch-friendly targets */
@media (pointer: coarse) {

    .preset-btn,
    .time-sig-btn,
    .note-toggle,
    .measure-btn {
        min-height: 48px;
    }

    .bpm-slider::-webkit-slider-thumb {
        width: 32px;
        height: 32px;
    }
}

/* --------------------------------------------------------------------------
   Print Styles
   -------------------------------------------------------------------------- */
@media print {
    body {
        background: white;
        color: black;
    }

    .glass-card {
        background: white;
        border: 1px solid #ccc;
        box-shadow: none;
    }

    .playback-controls,
    .beat-indicator,
    .footer {
        display: none;
    }
}