/* bestfreeonlinemetronome v10 — hybrid simple/advanced interface */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    transition: all 0.3s ease;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    transition: all 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}


/* Header */
.app-header {
    text-align: center;
    margin-bottom: 30px;
}

.app-header h1 {
    font-size: 2.5rem;
    font-weight: 300;
    color: #333;
    transition: all 0.3s ease;
    margin-bottom: 15px;
}

/* Index: long descriptive headline — readable on narrow screens */
.app-header h1.app-title-lead {
    font-size: 1.65rem;
    font-weight: 500;
    line-height: 1.4;
    max-width: 38rem;
    margin-left: auto;
    margin-right: auto;
}

.app-header .app-brand-line {
    font-size: 0.95rem;
    font-weight: 500;
    color: #555;
    margin-top: 0;
}

@media (max-width: 800px) {
    .app-header h1.app-title-lead {
        font-size: 1.35rem !important;
    }
}

@media (max-width: 480px) {
    .app-header h1.app-title-lead {
        font-size: 1.2rem !important;
    }
}

/* Feedback Button */
.feedback-btn {
    background-color: #4CAF50 !important;
    color: white !important;
    border: none !important;
    padding: 12px 24px !important;
    border-radius: 8px !important;
    font-size: 1rem !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3) !important;
    display: inline-block !important;
    text-decoration: none !important;
    margin-top: 0 !important;
}

.feedback-btn:hover {
    background-color: #45a049 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4) !important;
    color: white !important;
}

.feedback-btn:active {
    transform: translateY(0) !important;
}

.ad-slot {
    width: 100%;
    min-height: 90px;
    border: 1px dashed #bbb;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    background: #fafafa;
    margin: 0 auto 20px;
}

.ad-slot-top {
    margin-top: 16px;
    margin-bottom: 24px;
}

.app-footer {
    margin: 20px 0 10px;
    text-align: center;
    font-size: 0.9rem;
    color: #666;
}

.app-footer a {
    color: #666;
    text-decoration: none;
}

.app-footer a:hover {
    text-decoration: underline;
}

.feedback-bottom-wrap {
    text-align: center;
    margin: 12px 0 10px;
}

.honeypot-field {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}





/* MAIN METRONOME STYLES */
.main-mode {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Main Metronome Display (Advanced) */
.metronome-display {
    background: white;
    border-radius: 20px;
    padding: 40px;
    margin-bottom: 30px;
    text-align: center;
    color: #333;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid #ddd;
    position: relative;
}

.metronome-display:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.3);
}

.beat-visualization {
    margin-bottom: 104px;
    padding-bottom: 28px;
    position: relative;
    z-index: 1;
}

.pulsing-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(76, 175, 80, 0.14);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    transition: all 0.1s ease;
    border: 3px solid rgba(46, 125, 50, 0.45);
}

.pulsing-circle.pulse {
    background: rgba(76, 175, 80, 0.32);
    transform: scale(1.1);
    border-color: rgba(27, 94, 32, 0.75);
}

.pulsing-circle.pulse-main {
    background: rgba(76, 175, 80, 0.5);
    transform: scale(1.2);
    border-color: #1b5e20;
    box-shadow: 0 0 22px rgba(76, 175, 80, 0.45);
}

.pulsing-circle.pulse-subdivision {
    background: rgba(76, 175, 80, 0.22);
    transform: scale(1.05);
    border-color: rgba(46, 125, 50, 0.55);
}

.beat-number {
    font-size: 2.5rem;
    font-weight: 300;
    color: #1b5e20;
}

/* Advanced Mode Beat Dots - Identical to Simple Mode */
.advanced-beat-dots {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 100%;
    padding: 0 10px;
    margin-top: 20px;
    margin-bottom: 40px;
    flex-wrap: wrap;
    gap: 4px;
    position: relative;
    z-index: 1;
}

.advanced-beat-dots .beat-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: #cfd8dc;
    transition: background-color 0.1s ease, transform 0.1s ease, border-color 0.1s ease, box-shadow 0.1s ease;
    border: 1px solid #90a4ae;
}

.advanced-beat-dots .beat-dot.active {
    background-color: #4caf50;
    transform: scale(1.2);
    border-color: #2e7d32;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.35), 0 2px 8px rgba(46, 125, 50, 0.35);
}

.advanced-beat-dots .beat-dot.emphasized {
    background-color: #c8e6c9;
    border-color: #558b2f;
}

.advanced-beat-dots .beat-dot.emphasized.active {
    background-color: #43a047;
    border-color: #1b5e20;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.45), 0 2px 10px rgba(27, 94, 32, 0.35);
}

.advanced-beat-dots .beat-dot.main-beat {
    width: 18px;
    height: 18px;
    background-color: #b0bec5;
    border: 2px solid #546e7a;
}

.advanced-beat-dots .beat-dot.subdivision {
    width: 12px;
    height: 12px;
    background-color: #eceff1;
    border: 1px solid #78909c;
}

.advanced-beat-dots .beat-dot.subdivision.active {
    background-color: #81c784;
    border-color: #388e3c;
    transform: scale(1.3);
    box-shadow: 0 0 0 1px rgba(56, 142, 60, 0.4);
}

.tempo-display {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 20px;
}

.tempo-controls-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 40px;
}

.tempo-controls-display .tempo-display {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
}

.tempo-btn-display {
    padding: 8px 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: white;
    color: #333;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tempo-btn-display:hover {
    background: #f0f0f0;
    border-color: #999;
}

.tempo-btn-display:active {
    transform: scale(0.95);
}

.tempo-value {
    font-size: 2rem;
    font-weight: 500;
    color: #333;
}

.tempo-label {
    font-size: 0.9rem;
    color: #666;
}


.metronome-controls {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    z-index: 20;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: stretch;
    align-items: stretch;
    gap: 10px;
    padding-top: 32px;
}

.metronome-tap-tempo-btn,
.metronome-start-btn,
.metronome-countin-btn {
    flex: 1 1 0;
    min-width: 0;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    line-height: 1.25;
    text-align: center;
    white-space: normal;
}

.metronome-start-btn {
    background-color: #4CAF50;
    color: white;
}

.metronome-start-btn:hover {
    background-color: #45a049;
    transform: translateY(-2px);
}

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

.metronome-tap-tempo-btn {
    background-color: #ff9800;
    color: white;
}

.metronome-tap-tempo-btn:hover {
    background-color: #f57c00;
    transform: translateY(-2px);
}

.metronome-tap-tempo-btn:active {
    transform: translateY(0);
}

/* Count In is the secondary/tertiary transport action (after Start).
   Outline style keeps it readable without competing with Start (green) or
   Tap Tempo (orange). */
.metronome-countin-btn {
    background-color: #ffffff;
    color: #333333;
    border: 2px solid #d0d0d0;
    /* Cancel the 12px padding inherited from the shared button rule so the
       2px border doesn't push the label taller than Start / Tap. */
    padding: 10px 14px;
}

.metronome-countin-btn:hover {
    background-color: #f5f5f5;
    border-color: #b0b0b0;
    transform: translateY(-2px);
}

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

.metronome-countin-btn.counting-in,
.metronome-countin-btn:disabled {
    background-color: #eeeeee;
    color: #888888;
    border-color: #e0e0e0;
    cursor: not-allowed;
}

.metronome-countin-btn.counting-in:hover,
.metronome-countin-btn:disabled:hover {
    background-color: #eeeeee;
    border-color: #e0e0e0;
    transform: none;
}

.metronome-start-btn.stopped, .metronome-countin-btn.stopped, .metronome-tap-tempo-btn.stopped {
    background-color: #f44336;
}

.metronome-start-btn.stopped:hover, .metronome-countin-btn.stopped:hover, .metronome-tap-tempo-btn.stopped:hover {
    background-color: #d32f2f;
}

/* Advanced Controls Section — single column so rhythm (time signature) stacks above sound (voice commands) */
.controls-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.control-tile {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    position: relative;
}

.control-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.drag-handle {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 20px;
    height: 20px;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23ccc"><path d="M8 6h2v2H8V6zm6 0h2v2h-2V6zM8 10h2v2H8v-2zm6 0h2v2h-2v-2zM8 14h2v2H8v-2zm6 0h2v2h-2v-2z"/></svg>') center/contain no-repeat;
    cursor: grab;
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.control-tile:hover .drag-handle {
    opacity: 0.8;
}

/* Advanced Control Styles */
.time-signature-section,
.voice-section {
    text-align: center;
}

.time-signature-section h3,
.voice-section h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.1rem;
    font-weight: 500;
}


.time-signature-select {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    background-color: white;
    margin-bottom: 20px;
}

.subdivision-section h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.1rem;
    font-weight: 500;
    text-align: center;
}

.subdivision-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.subdivision-sounds-toggle {
    margin-bottom: 20px;
    text-align: center;
}

.subdivision-btn {
    flex: 1;
    padding: 10px 8px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background-color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 56px;
}

.subdivision-btn.active {
    background-color: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

/* Dot row: language-agnostic representation of subdivisions per beat.
   1 dot = quarter, 2 dots = 8th, 3 dots = triplet, 4 dots = 16th. */
.subdivision-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    line-height: 0;
}

.subdivision-dots .sd-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: currentColor;
    opacity: 0.85;
    display: inline-block;
}

.subdivision-btn.active .subdivision-dots .sd-dot {
    background-color: #ffffff;
    opacity: 1;
}

.subdivision-caption {
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.01em;
}

/* First dot is the downbeat — draw slightly larger so the eye reads "this one
   is the emphasized beat" even at a glance. Ties into the audible emphasis fix. */
.subdivision-dots .sd-dot:first-child {
    width: 9px;
    height: 9px;
    opacity: 1;
}

.emphasis-options {
    margin-bottom: 15px;
}

.emphasis-option {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    cursor: pointer;
}

/* Combined Emphasis and Display Section */
.emphasis-display-section {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.emphasis-section,
.display-section {
    text-align: center;
}

.emphasis-section h3,
.display-section h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.1rem;
    font-weight: 500;
    text-align: center;
}

.beat-emphasis-section h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.1rem;
    font-weight: 500;
    text-align: center;
}

.emphasis-presets {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.preset-btn {
    flex: 1;
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.preset-btn:hover {
    background-color: #f0f0f0;
}

/* Voice Controls */
.voice-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
}

.indicator-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #ddd;
    transition: background-color 0.3s ease;
}

.voice-indicator.active .indicator-dot {
    background-color: #4CAF50;
    animation: pulse 1.5s infinite;
}

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

.voice-btn, .voice-help-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin-right: 8px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.voice-btn {
    background-color: #4CAF50;
    color: white;
}

.voice-btn:hover {
    background-color: #45a049;
}

.voice-help-btn {
    background-color: #f0f0f0;
    color: #666;
}

.voice-help-btn:hover {
    background-color: #e0e0e0;
}

/* Display Buttons */
.display-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.display-btn {
    flex: 1;
    min-width: 80px;
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background-color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    text-align: center;
}

.display-btn.active {
    background-color: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

.theme-toggle {
    margin-top: 15px;
    text-align: center;
}

.theme-toggle-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #333;
}

.theme-toggle-checkbox {
    margin: 0;
    width: 18px;
    height: 18px;
}

/* Sound, voice, and silent pattern controls */
.sound-counter-silent-controls {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.sound-section,
.silent-section {
    text-align: center;
}

.sound-section h3,
.silent-section h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.1rem;
    font-weight: 500;
    text-align: center;
}

/* Sound Options */
.sound-controls h3 {
    margin-bottom: 15px;
    color: #333;
}

.sound-options {
    display: flex;
    flex-direction: row;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.sound-option {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sound-option input[type="radio"] {
    margin: 0;
}

/*
 * Narrow viewports: visible left inset for voice status, subdivision-sounds toggle,
 * and beat-sound radios. Uses 1024px so tablets & desktop “responsive” widths still match.
 */
@media (max-width: 1024px) {
    .subdivision-section > h3,
    .voice-section > h3,
    .sound-section > h3 {
        text-align: center;
    }

    .subdivision-sounds-toggle {
        text-align: left !important;
        padding-left: 2rem !important;
        padding-right: 0.75rem !important;
        box-sizing: border-box;
        width: 100%;
    }

    .subdivision-sounds-toggle .emphasis-option {
        justify-content: flex-start !important;
        width: 100%;
    }

    .sound-section {
        text-align: left;
    }

    .sound-options {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        justify-content: flex-start !important;
        gap: 0.625rem !important;
        padding-left: 2rem !important;
        padding-right: 0.75rem !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .sound-option {
        justify-content: flex-start !important;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .voice-section {
        text-align: left;
    }

    .voice-section .voice-controls {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .voice-section .voice-indicator {
        align-self: flex-start !important;
        margin-left: 2rem !important;
        margin-right: auto !important;
        justify-content: flex-start !important;
    }

    .voice-section .voice-status {
        text-align: center;
        width: 100%;
    }
}


/* Silent Bars Controls */
.pattern-mode-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.pattern-mode-selector .mode-btn {
    flex: 1;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background-color: white;
}

.pattern-inputs {
    display: flex;
    gap: 15px;
}

.pattern-input-group {
    flex: 1;
}

.pattern-input-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
    color: #666;
}

.pattern-number {
    width: 100%;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 4px;
}

/* Info Section */
.info {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-top: 30px;
}

.info h2 {
    font-size: 1.5rem;
    font-weight: 400;
    margin-bottom: 15px;
    color: #333;
}

.info p {
    color: #666;
    line-height: 1.7;
}

.info em {
    font-style: italic;
    color: #333;
}

/* SEO Content Blocks */
.app-subtitle {
    color: #555;
    font-size: 1rem;
    max-width: 760px;
    margin: 0 auto;
}

.seo-content {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin: 0 0 30px;
}

.seo-content h2 {
    font-size: 1.6rem;
    font-weight: 500;
    margin-bottom: 12px;
}

.seo-content p {
    color: #555;
    margin-bottom: 18px;
}

.seo-links {
    border: 1px solid #e3e3e3;
    border-radius: 10px;
    padding: 16px;
    background: #fff;
    margin-bottom: 20px;
}

.seo-links h3 {
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.seo-links ul {
    margin-left: 20px;
}

.seo-links li {
    margin-bottom: 6px;
}

.seo-links a {
    color: #2e7d32;
    text-decoration: none;
}

.seo-links a:hover,
.seo-links a:focus {
    text-decoration: underline;
}

.seo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.seo-card {
    border: 1px solid #e3e3e3;
    border-radius: 10px;
    padding: 16px;
    background: #fafafa;
}

.seo-card h3 {
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.seo-card ul,
.seo-card ol {
    margin-left: 20px;
    color: #444;
}

.faq-section h3 {
    margin-bottom: 12px;
}

.faq-section details {
    border: 1px solid #e3e3e3;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 10px;
    background: #fff;
}

.faq-section summary {
    cursor: pointer;
    font-weight: 500;
}

.faq-section details p {
    margin-top: 10px;
    margin-bottom: 0;
}

/* Feedback Modal */
.feedback-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.feedback-modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.feedback-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid #eee;
    background-color: #f8f9fa;
    border-radius: 12px 12px 0 0;
}

.feedback-modal-header h2 {
    margin: 0;
    color: #333;
    font-size: 1.5rem;
    font-weight: 500;
}

.feedback-close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.feedback-close:hover {
    background-color: #e9ecef;
    color: #333;
}

.feedback-form {
    padding: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
    font-family: inherit;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 30px;
}

.feedback-cancel,
.feedback-submit {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.feedback-cancel {
    background-color: #f8f9fa;
    color: #666;
    border: 2px solid #ddd;
}

.feedback-cancel:hover {
    background-color: #e9ecef;
    border-color: #bbb;
}

.feedback-submit {
    background-color: #4CAF50;
    color: white;
}

.feedback-submit:hover {
    background-color: #45a049;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.feedback-submit:active {
    transform: translateY(0);
}

/* Responsive Design - Mobile and Tablet */
@media (max-width: 800px) {
    .app-container {
        padding: 10px !important;
        max-width: 100% !important;
    }
    
    .app-header h1 {
        font-size: 1.8rem !important;
    }
    
    .controls-section {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
    
    .control-tile {
        width: 100% !important;
        margin-bottom: 15px !important;
        box-sizing: border-box !important;
    }
    
    .metronome-display {
        padding: 20px !important;
        margin-bottom: 20px !important;
    }
    
    .tempo-slider {
        width: 200px !important;
    }
    
    .beat-options {
        flex-wrap: wrap !important;
        justify-content: center !important;
        max-width: 300px !important;
    }
}

/* Responsive Design - Tablet */
@media screen and (max-width: 768px) {
    .app-container {
        padding: 10px !important;
        max-width: 100% !important;
    }
    
    .app-header h1 {
        font-size: 1.8rem !important;
    }
    
    .current-beat {
        font-size: 2.5rem !important;
    }
    
    .metronome-display {
        padding: 20px !important;
        margin-bottom: 20px !important;
    }
    
    .tempo-slider {
        width: 200px !important;
    }
    
    .controls {
        flex-direction: column !important;
        align-items: center !important;
        gap: 15px !important;
    }
    
    .beat-options {
        flex-wrap: wrap !important;
        justify-content: center !important;
        max-width: 300px !important;
    }
    
    .controls-section {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
    
    .control-tile {
        margin-bottom: 15px !important;
        width: 100% !important;
    }
    
    .sound-options {
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    .pattern-inputs {
        flex-direction: column !important;
    }
    
    /* Combined tempo, signature, and voice container responsive */
    .tempo-signature-voice-controls {
        gap: 15px !important;
    }
    
    /* Combined emphasis and display container responsive */
    .emphasis-display-section {
        gap: 15px !important;
    }
    
    /* Combined sound, counter, and silent container responsive */
    .sound-counter-silent-controls {
        gap: 15px !important;
    }
    
    /* Beat dots responsive adjustments */
    .advanced-beat-dots {
        gap: 2px !important;
        padding: 0 5px !important;
    }
    
    .advanced-beat-dots .beat-dot.main-beat {
        width: 14px !important;
        height: 14px !important;
    }
    
    .advanced-beat-dots .beat-dot.subdivision {
        width: 10px !important;
        height: 10px !important;
    }
    
    .metronome-controls {
        flex-direction: row !important;
        justify-content: stretch !important;
        gap: 8px !important;
    }

    .metronome-tap-tempo-btn,
    .metronome-start-btn,
    .metronome-countin-btn {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        width: auto !important;
        max-width: none !important;
        padding: 10px 8px !important;
        font-size: 0.82rem !important;
    }
}

/* Additional responsive breakpoints for beat dots */
@media (max-width: 768px) {
    .beat-visualization {
        margin-bottom: 124px;
        padding: 20px 0 36px;
    }
    
    .advanced-beat-dots {
        margin-bottom: 60px;
        padding: 0 20px;
        gap: 8px;
    }
    
    .advanced-beat-dots .beat-dot {
        width: 14px;
        height: 14px;
    }
    
    .advanced-beat-dots .beat-dot.main-beat {
        width: 16px;
        height: 16px;
    }
    
    .advanced-beat-dots .beat-dot.subdivision {
        width: 10px;
        height: 10px;
    }
    
    .metronome-controls {
        padding-top: 40px;
        bottom: 15px;
    }
}

@media screen and (max-width: 480px) {
    .app-container {
        padding: 5px !important;
    }
    
    .app-header h1 {
        font-size: 1.5rem !important;
    }
    
    .metronome-display {
        padding: 15px !important;
        margin-bottom: 15px !important;
    }
    
    .beat-visualization {
        margin-bottom: 112px !important;
        padding: 20px 0 32px !important;
    }
    
    .pulsing-circle {
        width: 100px !important;
        height: 100px !important;
    }
    
    .beat-number {
        font-size: 2rem !important;
    }
    
    .advanced-beat-dots {
        margin-bottom: 60px !important;
        padding: 0 20px !important;
        gap: 4px !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
    }
    
    .advanced-beat-dots .beat-dot {
        width: 12px !important;
        height: 12px !important;
    }
    
    .advanced-beat-dots .beat-dot.main-beat {
        width: 14px !important;
        height: 14px !important;
    }
    
    .advanced-beat-dots .beat-dot.subdivision {
        width: 8px !important;
        height: 8px !important;
    }
    
    .metronome-controls {
        padding-top: 44px !important;
        bottom: 10px !important;
        left: 12px !important;
        right: 12px !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        justify-content: stretch !important;
        gap: 6px !important;
    }
    
    .metronome-tap-tempo-btn,
    .metronome-start-btn,
    .metronome-countin-btn {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        width: auto !important;
        max-width: none !important;
        padding: 10px 4px !important;
        font-size: 0.72rem !important;
    }
    
    .tempo-controls-display {
        flex-wrap: wrap !important;
        gap: 10px !important;
        justify-content: center !important;
    }
    
    .tempo-btn-display {
        min-width: 50px !important;
        padding: 8px 12px !important;
        font-size: 0.9rem !important;
    }
    
    .tempo-display {
        font-size: 1.5rem !important;
    }
    
    .control-tile {
        margin-bottom: 10px !important;
    }
    
    .control-tile h3 {
        font-size: 1rem !important;
    }
    
    .sensitivity-slider-container {
        flex-direction: column !important;
        gap: 5px !important;
    }
    
    .interval-controls {
        flex-direction: column !important;
        gap: 8px !important;
    }
    
    .interval-input {
        font-size: 0.9rem !important;
    }
}

@media (min-width: 1200px) {
    .advanced-beat-dots {
        gap: 6px;
        padding: 0 20px;
    }
    
    .advanced-beat-dots .beat-dot.main-beat {
        width: 20px;
        height: 20px;
    }
    
    .advanced-beat-dots .beat-dot.subdivision {
        width: 14px;
        height: 14px;
    }
}

/* Mode Transition Animations */
.mode-transition {
    opacity: 0;
    transform: translateY(20px);
    animation: modeSlideIn 0.4s ease forwards;
}

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

/* Dark Mode Styles */
body.dark-mode {
    background-color: #1a1a1a;
    color: #e0e0e0;
}

body.dark-mode .app-header h1 {
    color: #e0e0e0;
}

body.dark-mode .app-subtitle {
    color: #c9c9c9;
}

body.dark-mode .app-header .app-brand-line {
    color: #b0b0b0;
}

body.dark-mode .metronome-display {
    background: #2d2d2d;
    color: #e0e0e0;
    border-color: #444;
}

/* Beat UI: light-on-dark (defaults above are for light mode / white card) */
body.dark-mode .pulsing-circle {
    background: rgba(255, 255, 255, 0.12);
    border: 3px solid rgba(255, 255, 255, 0.28);
}

body.dark-mode .pulsing-circle.pulse {
    background: rgba(255, 255, 255, 0.28);
    border-color: rgba(255, 255, 255, 0.55);
}

body.dark-mode .pulsing-circle.pulse-main {
    background: rgba(255, 255, 255, 0.42);
    border-color: rgba(255, 255, 255, 0.78);
    box-shadow: 0 0 20px rgba(132, 216, 137, 0.35);
}

body.dark-mode .pulsing-circle.pulse-subdivision {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

body.dark-mode .beat-number {
    color: #e8f5e9;
}

body.dark-mode .advanced-beat-dots .beat-dot {
    background-color: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.4);
}

body.dark-mode .advanced-beat-dots .beat-dot.active {
    background-color: rgba(132, 216, 137, 0.95);
    border-color: #c8e6c9;
    box-shadow: 0 0 8px rgba(132, 216, 137, 0.55);
}

body.dark-mode .advanced-beat-dots .beat-dot.emphasized {
    background-color: rgba(255, 255, 255, 0.32);
    border-color: rgba(255, 255, 255, 0.55);
}

body.dark-mode .advanced-beat-dots .beat-dot.emphasized.active {
    background-color: #a5d6a7;
    border-color: #e8f5e9;
    box-shadow: 0 0 12px rgba(165, 214, 167, 0.65);
}

body.dark-mode .advanced-beat-dots .beat-dot.main-beat {
    background-color: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

body.dark-mode .advanced-beat-dots .beat-dot.subdivision {
    background-color: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.28);
}

body.dark-mode .advanced-beat-dots .beat-dot.subdivision.active {
    background-color: rgba(132, 216, 137, 0.75);
    border-color: rgba(200, 230, 201, 0.9);
    box-shadow: 0 0 6px rgba(132, 216, 137, 0.45);
}

body.dark-mode .tempo-controls-display .tempo-btn-display {
    background: #3d3d3d;
    border-color: #555;
    color: #e0e0e0;
}

body.dark-mode .tempo-controls-display .tempo-display {
    background: transparent;
    border: none;
}

body.dark-mode .tempo-controls-display .tempo-btn-display:hover {
    background: #4d4d4d;
    border-color: #666;
}

body.dark-mode .tempo-value {
    color: #e0e0e0;
}

body.dark-mode .control-tile {
    background: #2d2d2d;
    border-color: #444;
}

body.dark-mode .seo-content {
    background: #2d2d2d;
}

body.dark-mode .seo-content h2,
body.dark-mode .seo-card h3,
body.dark-mode .faq-section h3 {
    color: #f0f0f0;
}

body.dark-mode .seo-content p,
body.dark-mode .seo-card ul,
body.dark-mode .seo-card ol {
    color: #d0d0d0;
}

body.dark-mode .seo-card,
body.dark-mode .faq-section details {
    background: #252525;
    border-color: #4a4a4a;
}

body.dark-mode .seo-links {
    background: #252525;
    border-color: #4a4a4a;
}

body.dark-mode .seo-links h3 {
    color: #f0f0f0;
}

body.dark-mode .seo-links a {
    color: #84d889;
}

body.dark-mode .control-tile h3 {
    color: #e0e0e0;
}

body.dark-mode .subdivision-btn,
body.dark-mode .display-btn,
body.dark-mode .preset-btn,
body.dark-mode .mode-btn {
    background-color: #3d3d3d;
    border-color: #555;
    color: #e0e0e0;
}

body.dark-mode .subdivision-btn:hover,
body.dark-mode .display-btn:hover,
body.dark-mode .preset-btn:hover,
body.dark-mode .mode-btn:hover {
    background-color: #4d4d4d;
}

body.dark-mode .subdivision-btn.active,
body.dark-mode .display-btn.active,
body.dark-mode .mode-btn.active {
    background-color: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

body.dark-mode .time-signature-select {
    background-color: #3d3d3d;
    border-color: #555;
    color: #e0e0e0;
}

body.dark-mode .emphasis-label,
body.dark-mode .theme-toggle-text {
    color: #e0e0e0;
}

body.dark-mode .pattern-number {
    background-color: #3d3d3d;
    border-color: #555;
    color: #e0e0e0;
}

body.dark-mode .voice-btn,
body.dark-mode .voice-help-btn {
    background-color: #3d3d3d;
    border-color: #555;
    color: #e0e0e0;
}

body.dark-mode .voice-btn:hover,
body.dark-mode .voice-help-btn:hover {
    background-color: #4d4d4d;
}

body.dark-mode .theme-toggle-text {
    color: #e0e0e0;
}

body.dark-mode .metronome-start-btn,
body.dark-mode .metronome-tap-tempo-btn {
    color: white;
}

/* Count In is the outline/secondary button. In dark mode it becomes a dim
   translucent pill so it still reads as secondary (never competing with the
   Start button) but isn't invisible on the dark card. */
body.dark-mode .metronome-countin-btn {
    background-color: #2d2d2d;
    color: #e0e0e0;
    border-color: #555;
}

body.dark-mode .metronome-countin-btn:hover {
    background-color: #3a3a3a;
    border-color: #777;
}

body.dark-mode .metronome-countin-btn:disabled,
body.dark-mode .metronome-countin-btn.counting-in {
    background-color: #1f1f1f;
    color: #8a8a8a;
    border-color: #3a3a3a;
}

body.dark-mode .metronome-start-btn.stopped, 
body.dark-mode .metronome-tap-tempo-btn.stopped,
body.dark-mode .metronome-countin-btn.stopped {
    background-color: #d32f2f;
}

body.dark-mode .metronome-start-btn.stopped:hover, 
body.dark-mode .metronome-tap-tempo-btn.stopped:hover,
body.dark-mode .metronome-countin-btn.stopped:hover {
    background-color: #b71c1c;
}

body.dark-mode .metronome-countin-btn.counting-in {
    background-color: #616161;
    color: #e0e0e0;
}

body.dark-mode .metronome-countin-btn.counting-in:hover {
    background-color: #616161;
}

/* Dark mode styles for feedback modal */
body.dark-mode .feedback-modal-content {
    background-color: #2d2d2d;
    color: #e0e0e0;
}

body.dark-mode .feedback-modal-header {
    background-color: #3d3d3d;
    border-color: #555;
}

body.dark-mode .feedback-modal-header h2 {
    color: #e0e0e0;
}

body.dark-mode .feedback-close {
    color: #b0b0b0;
}

body.dark-mode .feedback-close:hover {
    background-color: #4d4d4d;
    color: #e0e0e0;
}

body.dark-mode .form-group label {
    color: #e0e0e0;
}

body.dark-mode .form-group input,
body.dark-mode .form-group textarea {
    background-color: #3d3d3d;
    border-color: #555;
    color: #e0e0e0;
}

body.dark-mode .form-group input:focus,
body.dark-mode .form-group textarea:focus {
    border-color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

body.dark-mode .feedback-cancel {
    background-color: #3d3d3d;
    color: #b0b0b0;
    border-color: #555;
}

body.dark-mode .feedback-cancel:hover {
    background-color: #4d4d4d;
    border-color: #666;
}

/* Dark mode styles for feedback button */
body.dark-mode .feedback-btn {
    background-color: #4CAF50 !important;
    color: white !important;
}

body.dark-mode .feedback-btn:hover {
    background-color: #45a049 !important;
    color: white !important;
}

body.dark-mode .ad-slot {
    background: #2a2a2a;
    border-color: #555;
    color: #b0b0b0;
}

body.dark-mode .app-footer,
body.dark-mode .app-footer a {
    color: #b0b0b0;
}

@media (max-width: 768px) {
    /* Feedback modal responsive */
    .feedback-modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .feedback-modal-header {
        padding: 15px 20px;
    }
    
    .feedback-form {
        padding: 20px;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .feedback-cancel,
    .feedback-submit {
        width: 100%;
    }
}

/* Additional responsive fixes for smaller screens */
@media (max-width: 1024px) {
    .sensitivity-slider-container {
        flex-wrap: wrap;
    }
    
    .sensitivity-slider {
        max-width: 120px;
    }
    
    .sensitivity-value {
        min-width: 30px;
        font-size: 0.8rem;
    }
}

/* file:// — voice samples require http(s); banner explains local server */
.file-protocol-voice-banner {
    max-width: 1200px;
    margin: 0 auto 16px;
    padding: 14px 18px;
    background: #fff3cd;
    border: 1px solid #e6c200;
    border-radius: 8px;
    color: #664d03;
    font-size: 0.95rem;
    line-height: 1.5;
}

.file-protocol-voice-banner strong {
    display: block;
    margin-bottom: 8px;
    font-size: 1.05rem;
}

.file-protocol-voice-banner p {
    margin: 8px 0 0;
}

.file-protocol-voice-banner pre {
    margin-top: 12px;
    padding: 12px 14px;
    background: #1e1e1e;
    color: #f5f5f5;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 0.85rem;
    line-height: 1.45;
}

body.dark-mode .file-protocol-voice-banner {
    background: #3d3419;
    border-color: #a68b28;
    color: #f5e6a8;
}

body.dark-mode .file-protocol-voice-banner pre {
    background: #0d0d0d;
    color: #e8e8e8;
}

/* ——— Mobile: tabs, compact display card, sticky transport (see end overrides) ——— */
.mobile-controls-tabs {
    display: none;
}

.mobile-transport-dock {
    display: none;
}

@media (max-width: 768px) {
    /* Tabs: switch between two control tiles without long scroll */
    .mobile-controls-tabs {
        display: flex;
        gap: 8px;
        margin-bottom: 14px;
    }

    .mobile-controls-tab {
        flex: 1;
        min-height: 44px;
        padding: 10px 12px;
        border: 2px solid #ddd;
        border-radius: 10px;
        background: #fff;
        color: #333;
        font-size: 0.85rem;
        font-weight: 600;
        cursor: pointer;
        transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    }

    .mobile-controls-tab.active {
        background: #4CAF50;
        border-color: #4CAF50;
        color: #fff;
    }

    .controls-section.mobile-tab-rhythm .control-tile[data-tile-id="sound-counter-silent"] {
        display: none;
    }

    .controls-section.mobile-tab-sound .control-tile[data-tile-id="rhythm-controls"] {
        display: none;
    }

    /* Hide tile drag handles on small screens (tabs replace reordering) */
    .control-tile .drag-handle {
        display: none !important;
    }

    /* Display card: flow layout instead of tall reserved gap + absolute buttons */
    .metronome-display {
        position: relative;
    }

    .beat-visualization {
        margin-bottom: 8px !important;
        padding: 12px 0 8px !important;
    }

    .metronome-controls {
        position: static !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        padding-top: 8px !important;
        margin-top: 4px;
    }

    .advanced-beat-dots {
        margin-bottom: 12px !important;
    }

    /* Sticky transport */
    .mobile-transport-dock {
        display: block;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 900;
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
        background: rgba(255, 255, 255, 0.96);
        border-top: 1px solid #ddd;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
        backdrop-filter: blur(8px);
    }

    .mobile-transport-inner {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        max-width: 1200px;
        margin: 0 auto;
    }

    .mobile-transport-tempo-btn {
        min-width: 44px;
        min-height: 44px;
        padding: 0 10px;
        border: 2px solid #ccc;
        border-radius: 10px;
        background: #fff;
        color: #333;
        font-size: 1.1rem;
        font-weight: 600;
        cursor: pointer;
    }

    .mobile-transport-bpm {
        display: flex;
        align-items: baseline;
        gap: 4px;
        min-width: 4.5rem;
        justify-content: center;
    }

    .mobile-transport-bpm-value {
        font-size: 1.35rem;
        font-weight: 600;
        color: #1b5e20;
    }

    .mobile-transport-bpm-label {
        font-size: 0.75rem;
        color: #666;
        font-weight: 500;
    }

    .mobile-transport-playstop {
        flex: 1;
        max-width: 140px;
        min-height: 44px;
        margin-left: 4px;
        padding: 0 14px;
        border: none;
        border-radius: 10px;
        background: #4CAF50;
        color: #fff;
        font-size: 0.95rem;
        font-weight: 600;
        cursor: pointer;
    }

    .mobile-transport-playstop.transport-stop {
        background: #f44336;
    }

    body {
        padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    }
}

@media (max-width: 480px) {
    .subdivision-buttons,
    .display-buttons {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 6px !important;
    }

    .subdivision-btn,
    .display-btn {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        width: auto !important;
        min-height: 40px !important;
        padding: 8px 6px !important;
        font-size: 0.82rem !important;
    }

    /* Subdivision buttons use a stacked dots + caption layout, which needs a
       touch more height on mobile to avoid clipping the caption row. */
    .subdivision-btn {
        min-height: 52px !important;
        padding: 6px 4px !important;
        gap: 4px !important;
    }

    .subdivision-caption {
        font-size: 0.72rem !important;
    }

    .subdivision-dots .sd-dot {
        width: 6px;
        height: 6px;
    }

    .subdivision-dots .sd-dot:first-child {
        width: 8px;
        height: 8px;
    }
}

/* ——— Mobile: fit primary controls in one screen (uses the blank space in the display card) ——— */
@media (max-width: 768px) {
    .app-container {
        padding: 8px !important;
    }

    .app-header {
        margin-bottom: 10px !important;
    }

    .app-header h1.app-title-lead {
        font-size: 0.95rem !important;
        line-height: 1.3 !important;
        margin-bottom: 4px !important;
        max-width: 34rem;
    }

    .app-header .app-brand-line {
        display: none;
    }

    /* Display card: remove blank space around circle, tuck everything in tight */
    .metronome-display {
        padding: 10px 12px !important;
        margin-bottom: 10px !important;
        border-radius: 14px;
    }

    .tempo-controls-display {
        margin-bottom: 6px !important;
        gap: 8px !important;
    }

    .tempo-btn-display {
        padding: 6px 10px !important;
        font-size: 0.85rem !important;
    }

    .tempo-value {
        font-size: 1.5rem !important;
    }

    .tempo-label {
        font-size: 0.8rem !important;
    }

    .beat-visualization {
        margin-bottom: 4px !important;
        padding: 4px 0 !important;
    }

    .pulsing-circle {
        width: 82px !important;
        height: 82px !important;
        margin: 0 auto 6px !important;
        border-width: 2px !important;
    }

    .beat-number {
        font-size: 1.75rem !important;
    }

    .metronome-controls {
        padding-top: 2px !important;
        margin-top: 0 !important;
        gap: 8px !important;
    }

    .metronome-tap-tempo-btn,
    .metronome-start-btn,
    .metronome-countin-btn {
        padding: 9px 6px !important;
        font-size: 0.78rem !important;
        min-height: 40px;
    }

    /* Tabs + controls tile: compact */
    .mobile-controls-tabs {
        margin-bottom: 8px !important;
    }

    .mobile-controls-tab {
        min-height: 38px !important;
        padding: 7px 8px !important;
        font-size: 0.8rem !important;
    }

    .controls-section {
        margin-bottom: 8px !important;
    }

    .control-tile {
        padding: 10px 12px !important;
        margin-bottom: 0 !important;
        border-radius: 12px;
    }

    .control-tile h3 {
        font-size: 0.85rem !important;
        margin-bottom: 6px !important;
    }

    .rhythm-controls {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .time-signature-section,
    .subdivision-section,
    .emphasis-section,
    .display-section {
        text-align: center;
    }

    .time-signature-select {
        padding: 6px 8px !important;
        margin-bottom: 0 !important;
        font-size: 0.9rem !important;
    }

    .subdivision-buttons {
        margin-bottom: 4px !important;
    }

    .subdivision-sounds-toggle {
        margin-bottom: 0 !important;
    }

    .emphasis-display-section {
        gap: 10px !important;
    }

    .emphasis-option {
        margin-bottom: 2px !important;
        font-size: 0.85rem !important;
    }

    .display-buttons {
        margin-bottom: 0 !important;
    }

    .theme-toggle {
        margin-top: 4px !important;
    }

    .theme-toggle-label {
        font-size: 0.82rem !important;
    }

    /* Keep the rest (ads, SEO, feedback, footer) accessible by scrolling — below the one-screen fold */
    .ad-slot-top {
        margin: 8px 0 !important;
        min-height: 60px;
    }
}

@media (max-width: 400px) {
    .app-header h1.app-title-lead {
        font-size: 0.88rem !important;
    }

    .pulsing-circle {
        width: 74px !important;
        height: 74px !important;
    }

    .beat-number {
        font-size: 1.55rem !important;
    }

    .tempo-btn-display {
        padding: 6px 7px !important;
        font-size: 0.78rem !important;
    }

    .metronome-tap-tempo-btn,
    .metronome-start-btn,
    .metronome-countin-btn {
        font-size: 0.74rem !important;
        padding: 8px 4px !important;
    }
}

body.dark-mode .mobile-transport-dock {
    background: rgba(30, 30, 30, 0.97);
    border-top-color: #444;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.35);
}

body.dark-mode .mobile-transport-tempo-btn {
    background: #2a2a2a;
    border-color: #555;
    color: #eee;
}

body.dark-mode .mobile-transport-bpm-value {
    color: #81c784;
}

body.dark-mode .mobile-transport-bpm-label {
    color: #aaa;
}

body.dark-mode .mobile-controls-tab {
    background: #2a2a2a;
    border-color: #555;
    color: #e0e0e0;
}

body.dark-mode .mobile-controls-tab.active {
    background: #4CAF50;
    border-color: #4CAF50;
    color: #fff;
}
