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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    color: #ffd700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
    font-size: 1.1em;
    color: #aaa;
}

h3 {
    color: #ffd700;
    margin-bottom: 15px;
    font-size: 1.3em;
}

/* Category Panel */
.category-panel {
    background: rgba(255, 255, 255, 0.08);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
}

.category-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.category-btn {
    flex: 1;
    min-width: 150px;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 10px;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.category-btn:hover {
    background: rgba(255, 215, 0, 0.2);
    border-color: #ffd700;
    transform: translateY(-2px);
}

.category-btn.active {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #1a1a2e;
    border: none;
}

.badge {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.85em;
}

.category-btn.active .badge {
    background: rgba(0, 0, 0, 0.2);
}

/* Settings Panel */
.settings-panel {
    background: rgba(255, 255, 255, 0.08);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
}

.settings-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
}

.settings-row:last-child {
    margin-bottom: 0;
}

.setting-group {
    flex: 1;
    min-width: 150px;
}

.setting-group label {
    display: block;
    margin-bottom: 5px;
    color: #ffd700;
    font-weight: 500;
    font-size: 0.95em;
}

.setting-group input[type="number"],
.setting-group select {
    width: 100%;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    color: #fff;
    font-size: 16px;
}

.setting-group select {
    cursor: pointer;
}

.setting-group input[type="checkbox"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    pointer-events: auto;
    opacity: 1;
    position: relative;
    z-index: 999;
}

.setting-group input[type="checkbox"]:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.setting-group small {
    display: block;
    margin-top: 3px;
    font-size: 0.8em;
}

/* Main Display */
.main-display {
    background: rgba(255, 255, 255, 0.05);
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
}

.exercise-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.exercise-number {
    font-size: 1.3em;
    color: #ffd700;
    font-weight: 600;
}

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

.bpm-value {
    display: flex;
    align-items: baseline;
    gap: 5px;
}

.bpm-value span:first-child {
    font-size: 3em;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.bpm-label {
    font-size: 1em;
    color: #aaa;
}

/* Metronome Visual Beat Indicators */
.metronome-visual {
    display: flex;
    gap: 8px;
}

.beat-indicator {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #666;
    transition: all 0.05s ease;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.beat-indicator.active {
    background: #ffd700;
    color: #1a1a2e;
    border-color: #ffd700;
    box-shadow: 0 0 20px #ffd700;
    transform: scale(1.2);
}

.beat-indicator.accent {
    background: #ff6b6b;
    color: #fff;
    border-color: #ff6b6b;
    box-shadow: 0 0 25px #ff6b6b;
    transform: scale(1.3);
}

/* Measure Counter */
.measure-counter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin-bottom: 20px;
}

.measure-label {
    font-size: 1.2em;
    color: #aaa;
}

.measure-value {
    font-size: 2.5em;
    font-weight: bold;
    color: #ffd700;
    min-width: 80px;
    text-align: center;
}

/* Rudiment Container with Preview */
.rudiment-container {
    position: relative;
    margin-bottom: 20px;
}

/* Main Rudiment Display - Compact with Large Image */
.main-rudiment {
    background: #fff;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    transition: transform 0.6s cubic-bezier(0.4, 0.0, 0.2, 1), 
                opacity 0.6s ease;
}

.main-rudiment.slide-out-left {
    transform: translateX(-120%);
    opacity: 0;
}

/* Flash animation when exercise changes */
.main-rudiment.flash {
    animation: exerciseFlash 0.5s ease-out;
}

@keyframes exerciseFlash {
    0% {
        background: #fff;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    }
    30% {
        background: #fff8dc;
        box-shadow: 0 0 60px 20px rgba(255, 215, 0, 0.8);
    }
    60% {
        background: #fffacd;
        box-shadow: 0 0 40px 10px rgba(255, 215, 0, 0.5);
    }
    100% {
        background: #fff;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    }
}

.main-rudiment img {
    width: auto;
    height: auto;
    min-width: 500px;
    max-width: 800px;
    display: block;
    margin: 0 auto;
}

.main-rudiment .pattern-display {
    padding: 15px;
    min-height: 250px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Rudiment Preview - Bottom Right */
.rudiment-preview {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.95);
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    max-width: 180px;
    transition: transform 0.6s cubic-bezier(0.4, 0.0, 0.2, 1),
                opacity 0.6s ease;
    z-index: 10;
}

.rudiment-preview.move-to-center {
    transform: translate(-200%, -200%) scale(2.5);
    opacity: 0;
}

.preview-label {
    font-size: 0.85em;
    font-weight: bold;
    color: #666;
    margin-bottom: 8px;
    text-align: center;
}

.rudiment-preview img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 5px;
}

/* Pattern Display Styles */
.pattern-display-small {
    padding: 10px;
}

.pattern-name-small {
    font-size: 0.9em;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
    text-align: center;
}

.pattern-text-small {
    font-size: 1.2em;
    font-weight: bold;
    color: #333;
    letter-spacing: 2px;
    font-family: 'Courier New', monospace;
    word-wrap: break-word;
    text-align: center;
}

.pattern-text-small .R {
    color: #e74c3c;
}

.pattern-text-small .L {
    color: #3498db;
}

/* Pattern Display for Stick Control */
.pattern-display {
    padding: 40px;
}

.pattern-name {
    font-size: 2em;
    font-weight: bold;
    color: #1a1a2e;
    margin-bottom: 30px;
}

.pattern-text {
    font-size: 3.5em;
    font-weight: bold;
    color: #333;
    letter-spacing: 10px;
    font-family: 'Courier New', monospace;
    line-height: 1.6;
    word-wrap: break-word;
}

.pattern-text .R {
    color: #e74c3c;
}

.pattern-text .L {
    color: #3498db;
}

/* Exercise Stats */
.exercise-stats {
    display: flex;
    justify-content: space-around;
    gap: 20px;
    flex-wrap: wrap;
}

.stat {
    text-align: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    flex: 1;
    min-width: 120px;
}

.stat-label {
    display: block;
    font-size: 0.9em;
    color: #aaa;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 1.5em;
    font-weight: bold;
    color: #ffd700;
}

/* Control Panel */
.control-panel {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.control-btn {
    flex: 1;
    min-width: 120px;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 10px;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.control-btn:hover {
    background: rgba(255, 215, 0, 0.2);
    border-color: #ffd700;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.3);
}

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

.control-btn.primary {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #1a1a2e;
    border: none;
}

.control-btn.primary:hover {
    background: linear-gradient(135deg, #ffed4e 0%, #ffd700 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(255, 215, 0, 0.4);
}

.control-btn.secondary {
    background: rgba(100, 149, 237, 0.2);
    border-color: rgba(100, 149, 237, 0.5);
}

.control-btn.secondary:hover {
    background: rgba(100, 149, 237, 0.3);
    border-color: #6495ed;
}

.btn-icon {
    font-size: 1.2em;
}

.btn-shortcut {
    font-size: 0.75em;
    opacity: 0.6;
    margin-left: 4px;
}

/* Session Panel */
.session-panel {
    background: rgba(255, 255, 255, 0.05);
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
}

.session-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.session-stat {
    flex: 1;
    min-width: 150px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    text-align: center;
}

.session-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* Progress Bar */
.progress-container {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px 20px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    margin-bottom: 20px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.progress-label {
    color: #aaa;
    font-size: 0.9em;
}

.auto-advance-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ffd700;
    font-size: 0.9em;
    cursor: pointer;
}

.auto-advance-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffd700 0%, #ffed4e 100%);
    border-radius: 15px;
    transition: width 0.5s ease;
    width: 0%;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

.keyboard-shortcuts {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 10px;
    font-size: 0.8em;
    color: #666;
    flex-wrap: wrap;
}

.keyboard-shortcuts span {
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 10px;
    border-radius: 5px;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    header {
        padding: 12px;
        margin-bottom: 15px;
    }
    
    h1 {
        font-size: 1.6em;
        margin-bottom: 5px;
    }
    
    .subtitle {
        font-size: 0.9em;
    }
    
    h3 {
        font-size: 1.1em;
        margin-bottom: 10px;
    }

    .control-panel {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 15px;
    }

    .control-btn {
        min-width: calc(50% - 4px);
        flex: 1 1 calc(50% - 4px);
        padding: 12px 10px;
        font-size: 14px;
    }

    .exercise-info {
        flex-direction: column;
        text-align: center;
        gap: 10px;
        margin-bottom: 15px;
    }
    
    .exercise-number {
        font-size: 1.1em;
    }

    .bpm-display {
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 15px;
    }
    
    .bpm-value span:first-child {
        font-size: 2.2em;
    }

    .settings-panel,
    .session-panel,
    .category-panel {
        padding: 15px;
        margin-bottom: 15px;
    }

    .settings-row {
        flex-direction: column;
        gap: 10px;
    }

    .setting-group {
        width: 100%;
    }

    .category-buttons {
        flex-direction: column;
        gap: 8px;
    }

    .category-btn {
        min-width: 100%;
        padding: 12px 15px;
    }

    .beat-indicator {
        width: 32px;
        height: 32px;
        font-size: 0.85em;
    }

    .pattern-text {
        font-size: 1.8em;
        letter-spacing: 4px;
    }
    
    /* MOBILE: Hide preview completely */
    .rudiment-preview {
        display: none !important;
    }
    
    /* MOBILE: Adjust container */
    .main-rudiment {
        min-height: 180px;
        padding: 15px;
    }
    
    /* MOBILE: Make bitmap fill width */
    .main-rudiment img {
        min-width: 280px;
        max-width: 100%;
        width: 90%;
    }
    
    /* MOBILE: Stick Control patterns smaller */
    .main-rudiment .pattern-display {
        padding: 10px;
        min-height: auto;
    }
    
    .pattern-name {
        font-size: 1.2em;
        margin-bottom: 8px;
    }
    
    .pattern-text {
        font-size: 1.6em;
        letter-spacing: 3px;
    }
    
    /* MOBILE: Compact measure counter */
    .measure-counter {
        padding: 10px;
        margin-bottom: 15px;
    }
    
    .measure-value {
        font-size: 2em;
    }
    
    /* MOBILE: Compact exercise stats */
    .exercise-stats {
        gap: 10px;
    }
    
    .stat {
        padding: 10px;
        min-width: 90px;
    }
    
    .stat-value {
        font-size: 1.2em;
    }
    
    /* MOBILE: Main display compact */
    .main-display {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    /* MOBILE: Progress bar compact */
    .progress-container {
        padding: 12px 15px;
        margin-bottom: 15px;
    }
    
    .progress-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .keyboard-shortcuts {
        display: none; /* Hide on mobile */
    }
    
    .btn-shortcut {
        display: none; /* Hide shortcut hints on mobile */
    }
    
    /* MOBILE: Session stats compact */
    .session-stats {
        gap: 10px;
    }
    
    .session-stat {
        padding: 10px;
        min-width: 100px;
    }
}

/* Disabled state */
.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.control-btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Hidden elements */
.hidden {
    display: none !important;
}

/* Timer countdown special styling */
.timer-countdown {
    font-size: 1.8em !important;
    color: #ffd700 !important;
}

.timer-countdown.warning {
    color: #ff6b6b !important;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}
