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

:root {
    /* Default Theme (Purple) */
    --bg-gradient-start: #667eea;
    --bg-gradient-end: #764ba2;
    --primary-color: #667eea;
    --primary-hover: #764ba2;
    --container-bg: #ffffff;
    --text-color: #333333;
    --text-secondary: #555555;
    --text-tertiary: #666666;
    --border-color: #e2e8f0;
    --surface-bg: #f7fafc;
    --pulse-active: #ff6b6b;
    --pulse-shadow: rgba(255, 107, 107, 0.6);
}

body.theme-light {
    /* Light Theme (Olive/Yellow) */
    --bg-gradient-start: #97B22D;
    --bg-gradient-end: #89751B;
    --primary-color: #97B22D;
    --primary-hover: #89751B;
    --container-bg: #FEFCAD;
    --text-color: #2d3748;
    --text-secondary: #4a5568;
    --text-tertiary: #718096;
    --border-color: #E3DE81;
    --surface-bg: #f1ff72;
    --pulse-active: #89751B;
    --pulse-shadow: rgba(137, 117, 27, 0.6);
}

body.theme-dark {
    /* Dark Theme (Dark Olive) */
    --bg-gradient-start: #2d3d0f;
    --bg-gradient-end: #1a2208;
    --primary-color: #97B22D;
    --primary-hover: #E3DE81;
    --container-bg: #1f2d0a;
    --text-color: #E3DAB2;
    --text-secondary: #E3DE81;
    --text-tertiary: #97B22D;
    --border-color: #3d4d1f;
    --surface-bg: #2a3a12;
    --pulse-active: #E3DE81;
    --pulse-shadow: rgba(227, 222, 129, 0.6);
}

body.theme-warm-light {
    /* Warm Light Theme */
    --bg-gradient-start: #C6BE28;
    --bg-gradient-end: #97B22D;
    --primary-color: #E49A32;
    --primary-hover: #C6BE28;
    --container-bg: #FEFCAD;
    --text-color: #3d3d1f;
    --text-secondary: #5d5d3f;
    --text-tertiary: #7d7d5f;
    --border-color: #E3DAB2;
    --surface-bg: #faedb6;
    --pulse-active: #E49A32;
    --pulse-shadow: rgba(228, 154, 50, 0.6);
}

body.theme-warm-dark {
    /* Warm Dark Theme */
    --bg-gradient-start: #2a2510;
    --bg-gradient-end: #1a1808;
    --primary-color: #E49A32;
    --primary-hover: #C6BE28;
    --container-bg: #2d2815;
    --text-color: #FEFCAD;
    --text-secondary: #E3DAB2;
    --text-tertiary: #C6BE28;
    --border-color: #4a3f1a;
    --surface-bg: #3a3220;
    --pulse-active: #E49A32;
    --pulse-shadow: rgba(228, 154, 50, 0.6);
}

body.theme-red {
    /* Red Theme */
    --bg-gradient-start: #dc2626;
    --bg-gradient-end: #991b1b;
    --primary-color: #ef4444;
    --primary-hover: #dc2626;
    --container-bg: #ffffff;
    --text-color: #1f2937;
    --text-secondary: #374151;
    --text-tertiary: #4b5563;
    --border-color: #fecaca;
    --surface-bg: #fef2f2;
    --pulse-active: #b91c1c;
    --pulse-shadow: rgba(185, 28, 28, 0.6);
}

body.theme-pink {
    /* Pink Theme */
    --bg-gradient-start: #ec4899;
    --bg-gradient-end: #be185d;
    --primary-color: #f472b6;
    --primary-hover: #ec4899;
    --container-bg: #ffffff;
    --text-color: #1f2937;
    --text-secondary: #374151;
    --text-tertiary: #4b5563;
    --border-color: #fbcfe8;
    --surface-bg: #fdf2f8;
    --pulse-active: #be185d;
    --pulse-shadow: rgba(190, 24, 93, 0.6);
}

body.theme-red-dark {
    /* Dark Red Theme */
    --bg-gradient-start: #7f1d1d;
    --bg-gradient-end: #450a0a;
    --primary-color: #ef4444;
    --primary-hover: #f87171;
    --container-bg: #1a0505;
    --text-color: #fecaca;
    --text-secondary: #fca5a5;
    --text-tertiary: #f87171;
    --border-color: #7f1d1d;
    --surface-bg: #450a0a;
    --pulse-active: #f87171;
    --pulse-shadow: rgba(248, 113, 113, 0.6);
}

body.theme-pink-dark {
    /* Dark Pink Theme */
    --bg-gradient-start: #831843;
    --bg-gradient-end: #500724;
    --primary-color: #f472b6;
    --primary-hover: #f9a8d4;
    --container-bg: #1a050f;
    --text-color: #fce7f3;
    --text-secondary: #fbcfe8;
    --text-tertiary: #f9a8d4;
    --border-color: #831843;
    --surface-bg: #500724;
    --pulse-active: #f9a8d4;
    --pulse-shadow: rgba(249, 168, 212, 0.6);
}

body.theme-black {
    /* Black Theme */
    --bg-gradient-start: #1f2937;
    --bg-gradient-end: #111827;
    --primary-color: #6b7280;
    --primary-hover: #9ca3af;
    --container-bg: #0f172a;
    --text-color: #f3f4f6;
    --text-secondary: #d1d5db;
    --text-tertiary: #9ca3af;
    --border-color: #374151;
    --surface-bg: #1e293b;
    --pulse-active: #e5e7eb;
    --pulse-shadow: rgba(229, 231, 235, 0.6);
}

body.theme-blue {
    /* Blue Theme */
    --bg-gradient-start: #3b82f6;
    --bg-gradient-end: #1e40af;
    --primary-color: #60a5fa;
    --primary-hover: #3b82f6;
    --container-bg: #ffffff;
    --text-color: #1f2937;
    --text-secondary: #374151;
    --text-tertiary: #4b5563;
    --border-color: #bfdbfe;
    --surface-bg: #eff6ff;
    --pulse-active: #1e40af;
    --pulse-shadow: rgba(30, 64, 175, 0.6);
}

body.theme-blue-dark {
    /* Dark Blue Theme (Dark with Bright Blues) */
    --bg-gradient-start: #0c4a6e;
    --bg-gradient-end: #082f49;
    --primary-color: #38bdf8;
    --primary-hover: #0ea5e9;
    --container-bg: #0a1929;
    --text-color: #e0f2fe;
    --text-secondary: #7dd3fc;
    --text-tertiary: #38bdf8;
    --border-color: #0e7490;
    --surface-bg: #164e63;
    --pulse-active: #0ea5e9;
    --pulse-shadow: rgba(14, 165, 233, 0.6);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    transition: background 0.3s ease;
}

.container {
    background: var(--container-bg);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 100%;
    position: relative;
    transition: background 0.3s ease;
}

/* Header Row */
.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    margin-bottom: 15px;
}

h1 {
    text-align: center;
    color: var(--text-color);
    font-size: 1.8em;
    flex: 1;
    transition: color 0.3s ease;
}

.header-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.theme-picker {
    position: relative;
    margin-right: 10px;
}

.theme-btn-active {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px solid var(--text-color);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.theme-btn-active:hover {
    transform: scale(1.1);
}

.theme-btn-active.theme-default {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.theme-btn-active.theme-light {
    background: linear-gradient(135deg, #97B22D 0%, #E3DE81 100%);
}

.theme-btn-active.theme-dark {
    background: linear-gradient(135deg, #2d3d0f 0%, #97B22D 100%);
}

.theme-btn-active.theme-warm-light {
    background: linear-gradient(135deg, #E49A32 0%, #FEFCAD 100%);
}

.theme-btn-active.theme-warm-dark {
    background: linear-gradient(135deg, #2a2510 0%, #E49A32 100%);
}

.theme-btn-active.theme-red {
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
}

.theme-btn-active.theme-pink {
    background: linear-gradient(135deg, #ec4899 0%, #be185d 100%);
}

.theme-btn-active.theme-red-dark {
    background: linear-gradient(135deg, #7f1d1d 0%, #ef4444 100%);
}

.theme-btn-active.theme-pink-dark {
    background: linear-gradient(135deg, #831843 0%, #f472b6 100%);
}

.theme-btn-active.theme-black {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
}

.theme-btn-active.theme-blue {
    background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
}

.theme-btn-active.theme-blue-dark {
    background: linear-gradient(135deg, #0c4a6e 0%, #38bdf8 100%);
}

.theme-dropdown {
    position: absolute;
    top: 40px;
    left: 0;
    background: var(--container-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 10px;
    display: none;
    grid-template-columns: 32px 32px;
    gap: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

.theme-dropdown[style*="display: flex"],
.theme-dropdown[style*="display: grid"] {
    display: grid !important;
}

.theme-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-btn:hover {
    transform: scale(1.1);
    border-color: var(--primary-color);
}

.theme-btn.active {
    border: 3px solid var(--text-color);
    box-shadow: 0 0 0 2px var(--container-bg), 0 0 8px rgba(0, 0, 0, 0.3);
}

.theme-btn.theme-default {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.theme-btn.theme-light {
    background: linear-gradient(135deg, #97B22D 0%, #E3DE81 100%);
}

.theme-btn.theme-dark {
    background: linear-gradient(135deg, #2d3d0f 0%, #97B22D 100%);
}

.theme-btn.theme-warm-light {
    background: linear-gradient(135deg, #E49A32 0%, #FEFCAD 100%);
}

.theme-btn.theme-warm-dark {
    background: linear-gradient(135deg, #2a2510 0%, #E49A32 100%);
}

.theme-btn.theme-red {
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
}

.theme-btn.theme-pink {
    background: linear-gradient(135deg, #ec4899 0%, #be185d 100%);
}

.theme-btn.theme-red-dark {
    background: linear-gradient(135deg, #7f1d1d 0%, #ef4444 100%);
}

.theme-btn.theme-pink-dark {
    background: linear-gradient(135deg, #831843 0%, #f472b6 100%);
}

.theme-btn.theme-black {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
}

.theme-btn.theme-blue {
    background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
}

.theme-btn.theme-blue-dark {
    background: linear-gradient(135deg, #0c4a6e 0%, #38bdf8 100%);
}

.info-btn {
    background: none;
    border: none;
    font-size: 1.5em;
    color: var(--primary-color);
    cursor: pointer;
    padding: 5px;
    transition: color 0.3s;
}

.info-btn:hover {
    color: var(--primary-hover);
}

.log-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
}

.log-btn:hover .hamburger-icon span {
    background: var(--primary-hover);
}

.hamburger-icon {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 24px;
}

.hamburger-icon span {
    display: block;
    width: 100%;
    height: 3px;
    background: var(--primary-color);
    border-radius: 2px;
    transition: background 0.3s;
}

h2 {
    color: var(--text-secondary);
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.3em;
    transition: color 0.3s ease;
}

h3 {
    color: var(--text-tertiary);
    margin-bottom: 10px;
    font-size: 1.1em;
    transition: color 0.3s ease;
}

/* Pulse Indicator */
.pulse-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin-bottom: 10px;
    padding: 10px 0;
}

.pulse-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.pulse {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--primary-color);
    transition: transform 0.1s ease, background 0.1s ease;
    cursor: pointer;
}

.pulse:hover {
    opacity: 0.8;
}

.pulse.active {
    transform: scale(1.2);
    background: var(--pulse-active);
    box-shadow: 0 0 30px var(--pulse-shadow);
}

/* Acceleration Meter */
.acceleration-meter {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--surface-bg);
    border: 3px solid var(--border-color);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    overflow: hidden;
    position: relative;
    transition: transform 0.1s ease, border-color 0.1s ease, box-shadow 0.1s ease, background 0.3s ease;
    cursor: pointer;
}

.acceleration-meter:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 10px var(--pulse-shadow);
}

.acceleration-meter.beat-detected {
    transform: scale(1.15);
    border-color: var(--primary-color);
    box-shadow: 0 0 20px var(--pulse-shadow);
}

.acceleration-bar {
    width: 100%;
    height: 0%;
    background: linear-gradient(to top, var(--primary-color), var(--primary-hover));
    border-radius: 0 0 50% 50%;
    transition: height 0.1s ease-out;
    position: absolute;
    bottom: 0;
}

.acceleration-bar.high {
    background: linear-gradient(to top, #f6ad55, #ed8936, #dd6b20);
}

.acceleration-bar.very-high {
    background: linear-gradient(to top, #fc8181, #f56565, #e53e3e);
}

.pulse-label {
    font-size: 0.8em;
    color: var(--text-tertiary);
    font-weight: 500;
    transition: color 0.3s ease;
}

/* Beat Detection Info */
.beat-info {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 10px;
    padding: 10px;
    background: var(--surface-bg);
    border-radius: 8px;
    transition: background 0.3s ease;
}

.beat-info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.beat-info-label {
    font-size: 0.75em;
    color: var(--text-tertiary);
    font-weight: 600;
    transition: color 0.3s ease;
}

.beat-info-value {
    font-size: 0.95em;
    color: var(--text-color);
    font-weight: 700;
    transition: color 0.3s ease;
}

.beat-info-value.status-inactive {
    color: var(--text-tertiary);
}

.beat-info-value.status-listening {
    color: #48bb78;
}

.beat-info-value.status-alert {
    color: #e53e3e;
}

/* BPM Display */
.bpm-display {
    text-align: center;
    font-size: 2.5em;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 5px 10px;
    border-radius: 8px;
}

.bpm-display:hover {
    background: var(--surface-bg);
    transform: scale(1.05);
}

.bpm-display:active {
    transform: scale(0.98);
}

/* BPM Preset Menu */
.bpm-preset-menu {
    background: var(--container-bg);
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.bpm-preset-header {
    text-align: center;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 1.1em;
    transition: color 0.3s ease;
}

.bpm-preset-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.bpm-preset-btn {
    padding: 10px;
    background: var(--surface-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    color: var(--text-color);
    transition: all 0.2s ease;
}

.bpm-preset-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 3px 10px var(--pulse-shadow);
}

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

/* Control Groups */
.control-group {
    margin-bottom: 15px;
}

.control-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.95em;
    transition: color 0.3s ease;
}

input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: var(--border-color);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    transition: background 0.3s ease;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    transition: background 0.3s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: var(--primary-hover);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
    transition: background 0.3s;
}

input[type="range"]::-moz-range-thumb:hover {
    background: var(--primary-hover);
}

/* Checkbox Toggle */
.btn-toggle {
    width: 100%;
    padding: 8px;
    font-size: 0.9em;
    font-weight: 600;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    background: var(--container-bg);
    color: var(--text-color);
    cursor: pointer;
    outline: none;
    transition: all 0.3s ease;
}

.btn-toggle:hover {
    border-color: var(--primary-hover);
    background: var(--surface-bg);
}

.btn-toggle[data-active="true"] {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-toggle[data-active="true"]:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.toggle-checkbox {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
    appearance: none;
    -webkit-appearance: none;
    border: 2px solid var(--primary-color);
    border-radius: 3px;
    background: var(--surface-bg);
    position: relative;
    transition: all 0.2s ease;
}

.toggle-checkbox:checked {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.toggle-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.toggle-checkbox:hover {
    border-color: var(--primary-hover);
}

.toggle-label {
    cursor: pointer;
    user-select: none;
}

.control-group label:has(.toggle-checkbox) {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin-bottom: 0;
}

/* Compact Controls Row */
.compact-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.dropdown-group {
    flex: 1;
}

.dropdown-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.95em;
    transition: color 0.3s ease;
}

.dropdown-group label:has(.toggle-checkbox) {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin-bottom: 5px;
    margin-top: 0;
}

.dropdown-select {
    width: 100%;
    padding: 8px;
    font-size: 0.9em;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    background: var(--container-bg);
    color: var(--text-color);
    cursor: pointer;
    outline: none;
    transition: all 0.3s ease;
}

.dropdown-select:hover {
    border-color: var(--primary-hover);
    background: var(--surface-bg);
}

.dropdown-select:focus {
    border-color: var(--primary-hover);
    box-shadow: 0 0 0 3px var(--border-color);
}

/* Buttons */
.btn {
    width: 100%;
    padding: 12px;
    font-size: 1.1em;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 5px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(var(--primary-color), 0.4);
}

.btn-primary.active {
    background: var(--pulse-active) !important;
}

.btn-primary.active:hover {
    background: var(--primary-hover) !important;
}

.btn-secondary {
    background: #48bb78;
    color: white;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #38a169;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(72, 187, 120, 0.4);
}

.btn-secondary.active {
    background: #e53e3e;
}

.btn-secondary.active:hover {
    background: #c53030;
}

/* Auto Mode Settings */
.auto-settings {
    background: var(--surface-bg);
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    transition: background 0.3s ease;
}

.sensitivity-group {
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sensitivity-group label {
    margin-bottom: 0;
    white-space: nowrap;
}

.sensitivity-group input[type="range"] {
    flex: 1;
}

.sensitivity-group span {
    min-width: 20px;
    text-align: center;
    font-weight: 600;
    color: var(--primary-color);
    transition: color 0.3s ease;
}

.sensitivity-group {
    color: var(--primary-color);
}

#autoStatus {
    color: var(--text-tertiary);
    font-weight: 600;
    transition: color 0.3s ease;
}

#autoStatus.listening {
    color: #48bb78;
}

#autoStatus.alert {
    color: #e53e3e;
}

/* Info Modal */
.info-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.info-modal-content {
    background: var(--container-bg);
    border-radius: 15px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    transition: background 0.3s ease;
}

.info-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px 15px 20px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    transition: border-color 0.3s ease;
}

.info-modal-header h3 {
    margin: 0;
    color: var(--text-color);
    transition: color 0.3s ease;
}

.log-header-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.clear-log-btn {
    background: #e53e3e;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clear-log-btn:hover {
    background: #c53030;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(229, 62, 62, 0.3);
}

.info-modal-content>div:not(.info-modal-header) {
    overflow-y: auto;
    flex: 1;
}

.info-modal-content h4 {
    color: var(--primary-color);
    margin-top: 15px;
    margin-bottom: 8px;
    font-size: 1.1em;
    transition: color 0.3s ease;
}

.info-modal-content h4:first-child {
    margin-top: 5px;
}

.info-modal-content p {
    margin: 8px 0;
    color: var(--text-secondary);
    line-height: 1.5;
    font-size: 0.9em;
    transition: color 0.3s ease;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: var(--text-tertiary);
    padding: 0;
    line-height: 1;
    transition: color 0.3s ease;
}

.close-btn:hover {
    color: var(--text-color);
}

.info-modal-content ul {
    list-style: none;
    padding: 0;
}

.info-modal-content li {
    margin: 10px 0;
    padding-left: 15px;
    position: relative;
    color: var(--text-secondary);
    line-height: 1.5;
    font-size: 0.9em;
    transition: color 0.3s ease;
}

.info-modal-content li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
    transition: color 0.3s ease;
}

/* Log Modal */
.log-modal-content {
    max-height: 80vh;
}

.log-container {
    padding: 15px 20px 20px;
    overflow-y: auto;
    flex: 1;
    max-height: 60vh;
}

.log-entries {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.log-session-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: var(--primary-color);
    color: white;
    border-radius: 8px;
    font-weight: 600;
    margin-top: 5px;
}

.log-session-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 1;
    gap: 15px;
}

.log-session-date {
    font-size: 1em;
}

.log-session-duration {
    font-size: 0.9em;
    opacity: 0.9;
}

.delete-session-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 1.3em;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin-left: 10px;
}

.delete-session-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.log-session-entries {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-left: 10px;
}

.log-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: var(--surface-bg);
    border-radius: 6px;
    border-left: 3px solid var(--border-color);
    transition: all 0.2s ease;
}

.log-entry:hover {
    background: var(--border-color);
    transform: translateX(4px);
    border-left-color: var(--primary-color);
}

.log-action {
    font-weight: 600;
    font-size: 1em;
    color: var(--text-color);
    transition: color 0.3s ease;
}

.log-action-started {
    color: #48bb78;
}

.log-action-stopped {
    color: #e53e3e;
}

.log-time {
    font-size: 0.85em;
    color: var(--text-tertiary);
    white-space: nowrap;
    transition: color 0.3s ease;
}

.log-empty {
    text-align: center;
    color: var(--text-tertiary);
    padding: 30px 20px;
    font-style: italic;
    transition: color 0.3s ease;
}

/* Stats Button */
.stats-btn {
    background: none;
    border: none;
    font-size: 1.3em;
    cursor: pointer;
    padding: 5px;
    transition: transform 0.2s ease;
}

.stats-btn:hover {
    transform: scale(1.1);
}

/* Stats Modal */
.stats-modal-content {
    max-height: 85vh;
}

.stats-container {
    padding: 15px 20px 20px;
    overflow-y: auto;
    flex: 1;
    max-height: 70vh;
}

.stats-section {
    margin-bottom: 20px;
}

.stats-section h4 {
    color: var(--primary-color);
    margin-bottom: 12px;
    font-size: 1em;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    transition: color 0.3s ease, border-color 0.3s ease;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.stat-item {
    background: var(--surface-bg);
    border-radius: 8px;
    padding: 12px 8px;
    text-align: center;
    transition: background 0.3s ease;
}

.stat-label {
    display: block;
    font-size: 0.7em;
    color: var(--text-tertiary);
    margin-bottom: 5px;
    font-weight: 500;
    transition: color 0.3s ease;
}

.stat-value {
    display: block;
    font-size: 1.4em;
    font-weight: 700;
    color: var(--text-color);
    transition: color 0.3s ease;
}

.stat-value.streak-value {
    color: #48bb78;
}

.stat-value.highlight {
    color: var(--primary-color);
}

/* BPM Chart */
#bpmChart {
    background: var(--surface-bg);
    border-radius: 8px;
    display: block;
    margin: 0 auto;
}

/* Achievements */
.achievements-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.achievement-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--surface-bg);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.achievement-item.locked {
    opacity: 0.5;
}

.achievement-item.unlocked {
    background: linear-gradient(135deg, rgba(72, 187, 120, 0.1), rgba(72, 187, 120, 0.05));
    border: 1px solid rgba(72, 187, 120, 0.3);
}

.achievement-icon {
    font-size: 1.5em;
}

.achievement-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.achievement-name {
    font-weight: 600;
    font-size: 0.9em;
    color: var(--text-color);
    transition: color 0.3s ease;
}

.achievement-desc {
    font-size: 0.75em;
    color: var(--text-tertiary);
    transition: color 0.3s ease;
}

.achievement-check {
    color: #48bb78;
    font-weight: bold;
    font-size: 1.2em;
}

/* Responsive Design */
@media (max-width: 400px) {
    .container {
        padding: 15px;
    }

    h1 {
        font-size: 1.5em;
    }

    .bpm-display {
        font-size: 2em;
    }

    .pulse-container {
        gap: 15px;
    }

    .pulse {
        width: 60px;
        height: 60px;
    }

    .acceleration-meter {
        width: 60px;
        height: 60px;
    }

    .pulse-label {
        font-size: 0.7em;
    }

    .beat-info {
        flex-direction: column;
        gap: 5px;
    }

    .beat-info-item {
        flex-direction: row;
        justify-content: space-between;
        width: 100%;
    }

    .log-entry {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .log-time {
        font-size: 0.75em;
    }

    .log-session-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .log-session-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
        width: 100%;
    }

    .log-session-duration {
        font-size: 0.85em;
    }

    .delete-session-btn {
        position: absolute;
        top: 10px;
        right: 10px;
    }

    /* Stats responsive */
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: left;
    }

    .stat-label {
        margin-bottom: 0;
    }
}