* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Cal Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    color: #e0e0e0;
    min-height: 100vh;
    overflow-x: hidden;
    touch-action: pan-y;
    -webkit-font-smoothing: antialiased;
}

/* Welcome Screen */
.welcome-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.welcome-content {
    text-align: center;
    padding: 40px;
    animation: welcomeFloat 3s ease-in-out infinite;
}

.welcome-logo {
    font-size: 5rem;
    margin-bottom: 20px;
    animation: welcomePulse 2s ease-in-out infinite;
}

.welcome-title {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(45deg, #6366f1, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
}

.welcome-subtitle {
    color: #a0a0a0;
    font-size: 1.1rem;
    margin-bottom: 40px;
    opacity: 0.9;
}

.welcome-btn {
    background: linear-gradient(45deg, #6366f1, #8b5cf6);
    border: none;
    color: white;
    padding: 18px 40px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.4);
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 auto;
}

.welcome-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(99, 102, 241, 0.5);
}

.welcome-btn span {
    font-size: 1.5rem;
}

@keyframes welcomeFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

@keyframes welcomePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Main App Styles */
.container {
    max-width: 400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    text-align: center;
    margin-bottom: 30px;
    padding-top: env(safe-area-inset-top, 20px);
}

.logo {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(45deg, #6366f1, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.subtitle {
    color: #a0a0a0;
    font-size: 1rem;
    opacity: 0.8;
}

.nav {
    display: none;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    justify-content: center;
}

.nav-item {
    background: none;
    border: none;
    color: #e0e0e0;
    padding: 10px 15px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0 5px;
    font-size: 0.9rem;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.nav-item.active {
    background: linear-gradient(45deg, #6366f1, #8b5cf6);
    color: white;
}

.back-button {
    display: none;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #e0e0e0;
    padding: 12px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 45px;
    height: 45px;
    margin-bottom: 20px;
}

.back-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(-2px);
}

.main-controls {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 25px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 15px;
    justify-content: center;
}

.timer-button {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #e0e0e0;
    padding: 8px 12px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timer-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.fx-button {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #e0e0e0;
    padding: 8px 12px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fx-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.volume-label {
    font-size: 0.9rem;
    color: #a0a0a0;
    min-width: 120px;
}

.volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 180px;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    flex: 1;
    max-width: 180px;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(45deg, #6366f1, #8b5cf6);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.volume-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(45deg, #6366f1, #8b5cf6);
    cursor: pointer;
    border: none;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.sound-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.sound-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.sound-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

.sound-card.playing {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.2);
}

.sound-card.playing::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    z-index: -1;
}

.sound-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
    display: block;
}

.sound-name {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: #e0e0e0;
}

.sound-volume {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.sound-volume input {
    width: 80px;
    height: 4px;
}

.timer-section {
    display: none;
}

.timer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.timer-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #e0e0e0;
}

.timer-display {
    font-size: 2rem;
    font-weight: 700;
    color: #6366f1;
    text-align: center;
    margin-bottom: 20px;
}

.timer-presets {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.timer-preset {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #e0e0e0;
    padding: 10px 5px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.timer-preset:hover {
    background: rgba(255, 255, 255, 0.2);
}

.timer-preset.active {
    background: linear-gradient(45deg, #6366f1, #8b5cf6);
    border-color: rgba(139, 92, 246, 0.5);
    color: white;
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.3);
}

.timer-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.timer-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #e0e0e0;
    padding: 12px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.timer-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.timer-btn.primary {
    background: linear-gradient(45deg, #6366f1, #8b5cf6);
    border-color: rgba(139, 92, 246, 0.5);
    color: white;
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.3);
}

.stop-button {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #e0e0e0;
    padding: 8px 12px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stop-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.stop-button:active {
    background: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.reset-button {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #e0e0e0;
    padding: 8px 12px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reset-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.settings-section {
    display: none;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-item:last-child {
    border-bottom: none;
}

.settings-label {
    font-size: 1rem;
    color: #e0e0e0;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 25px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-switch.active {
    background: linear-gradient(45deg, #6366f1, #8b5cf6);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 21px;
    height: 21px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.toggle-switch.active::after {
    transform: translateX(25px);
}

.footer {
    margin-top: auto;
    text-align: center;
    padding: 20px 0;
    color: #a0a0a0;
    font-size: 0.8rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer a {
    color: #6366f1;
    text-decoration: none;
}

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

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: linear-gradient(135deg, #2d2d2d 0%, #3d3d3d 100%);
    border-radius: 20px;
    padding: 30px;
    max-width: 350px;
    width: 100%;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: #e0e0e0;
}

.modal-text {
    color: #a0a0a0;
    margin-bottom: 25px;
    line-height: 1.5;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 15px;
}

.modal-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #e0e0e0;
    padding: 12px 25px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.modal-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-btn.primary {
    background: linear-gradient(45deg, #6366f1, #8b5cf6);
    color: white;
}

.update-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(45deg, #10b981, #059669);
    color: white;
    padding: 10px 15px;
    border-radius: 50px;
    font-size: 0.8rem;
    z-index: 999;
    animation: pulse 2s infinite;
}

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

.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Timer Modal Styles */
.timer-modal-content {
    max-width: 380px;
    background: linear-gradient(135deg, #1e1e2e 0%, #2d2d42 100%);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.timer-modal-content .modal-title {
    font-size: 1.3rem;
    background: linear-gradient(45deg, #6366f1, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.timer-modal-content .timer-display {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(45deg, #6366f1, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
    margin-bottom: 25px;
    text-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.timer-modal-content .timer-presets {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 25px;
}

.timer-modal-content .timer-preset {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #e0e0e0;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.timer-modal-content .timer-preset:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}

.timer-modal-content .timer-preset.active {
    background: linear-gradient(45deg, #6366f1, #8b5cf6);
    border-color: rgba(139, 92, 246, 0.5);
    color: white;
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.3);
}

.timer-modal-content .timer-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 20px;
}

.timer-modal-content .timer-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #e0e0e0;
    padding: 12px 20px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    min-width: 80px;
}

.timer-modal-content .timer-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}

.timer-modal-content .timer-btn.primary {
    background: linear-gradient(45deg, #6366f1, #8b5cf6);
    border-color: rgba(139, 92, 246, 0.5);
    color: white;
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.3);
}

/* Prevent iOS zoom */
input[type="range"] {
    touch-action: manipulation;
}

/* FX Modal Styles */
.fx-modal-content {
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    background: linear-gradient(135deg, #1e1e2e 0%, #2d2d42 100%);
    border: 1px solid rgba(139, 92, 246, 0.2);
    box-sizing: border-box;
}

.fx-presets {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 30px;
}

.fx-preset {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #e0e0e0;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.fx-preset:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.fx-preset.active {
    background: linear-gradient(45deg, #6366f1, #8b5cf6);
    border-color: rgba(139, 92, 246, 0.5);
    color: white;
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.3);
}

.fx-preset.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.1), transparent);
    pointer-events: none;
}

.fx-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
    max-height: 50vh;
    overflow-y: auto;
    padding-right: 5px;
}

.fx-control {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.fx-control:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.fx-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    font-weight: 600;
    color: #e0e0e0;
    margin-bottom: 12px;
}

.fx-label span {
    color: #8b5cf6;
    font-weight: 700;
    font-size: 0.9rem;
}

.fx-control input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.fx-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(45deg, #6366f1, #8b5cf6);
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    transition: all 0.3s ease;
}

.fx-control input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

.fx-control input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(45deg, #6366f1, #8b5cf6);
    cursor: pointer;
    border: none;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    transition: all 0.3s ease;
}

.fx-control input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

.fx-control input[type="range"]::-webkit-slider-track {
    height: 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.2);
}

.fx-control input[type="range"]::-moz-range-track {
    height: 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
}

/* Enhanced Modal Title */
.fx-modal-content .modal-title {
    font-size: 1.3rem;
    background: linear-gradient(45deg, #6366f1, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-shrink: 0;
}

.fx-modal-content .modal-title::before {
    content: '';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    margin-right: 10px;
}

.fx-modal-content .modal-title::before {
    content: '\f013';
    font-size: 1.2rem;
    background: none;
    -webkit-text-fill-color: initial;
}

/* Custom scrollbar for fx controls */
.fx-controls::-webkit-scrollbar {
    width: 6px;
}

.fx-controls::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.fx-controls::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.5);
    border-radius: 3px;
}

.fx-controls::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.7);
}

/* Additional mobile responsiveness for FX modal */
@media (max-height: 700px) {
    .fx-modal-content {
        max-height: 95vh;
        padding: 20px;
    }
    
    .fx-controls {
        max-height: 40vh;
        gap: 12px;
    }
    
    .fx-control {
        padding: 12px;
    }
    
    .fx-modal-content .modal-title {
        font-size: 1.2rem;
        margin-bottom: 15px;
    }
}

@media (max-height: 600px) {
    .fx-modal-content {
        max-height: 98vh;
        padding: 15px;
    }
    
    .fx-controls {
        max-height: 35vh;
    }
    
    .fx-presets {
        margin-bottom: 15px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 15px;
    }
    
    .sound-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .timer-presets {
        grid-template-columns: repeat(2, 1fr);
    }

    .welcome-content {
        padding: 20px;
    }

    .welcome-logo {
        font-size: 4rem;
    }

    .welcome-title {
        font-size: 2rem;
    }
    
    .timer-modal-content .timer-presets {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .timer-modal-content .timer-display {
        font-size: 2.5rem;
    }
}